16

I was looking at changing the device name on my phone and the only instructions I found were to either root the device or use adb.

This got me thinking: is changing the device name restricted because the device name is packed with device specific information?

What, if anything, does the android device name reveal and what value does it have for tracking users/devices?

As requested an example device name: android-8ad48b628850044

Canadian Luke
  • 296
  • 3
  • 13
Robert
  • 263
  • 2
  • 6
  • 1
    @peterh i agree the question is too broad. As the name of the device is just a tag the subject of how that can be used doesn't fit this question. – Robert Feb 03 '17 at 09:13

1 Answers1

25

The device name is constructed as follows on first use:

    // setup our unique device name
    if (TextUtils.isEmpty(SystemProperties.get("net.hostname"))) {
        String id = Settings.Secure.getString(context.getContentResolver(),
                Settings.Secure.ANDROID_ID);
        if (id != null && id.length() > 0) {
            String name = new String("android-").concat(id);
            SystemProperties.set("net.hostname", name);
        }
    }

Where ANDROID_ID is a random 64-bit number.

So essentially the device name is unique and does not change during the lifetime of the device. While it does not reveal anything about the device itself, it might be used to track the device.

Hacktiker
  • 914
  • 7
  • 14
  • 3
    It's not clear from that whether a factory reset would clear the device name. That may be interesting if you treat it as identifying then dispose of the phone. – Chris H Feb 03 '17 at 10:57
  • 1
    That often depends on the manufacturer (ROM) and the type of reset used. In general a full reset including the system partition will cause it to be regenerated. – Rolf ツ Feb 03 '17 at 11:14
  • System apps [can change the ANDROID_ID](http://stackoverflow.com/questions/30832701/how-to-change-device-id-android-id-programmatically), such apps already exist in [Play Store](https://play.google.com/store/search?q=change%20android%20id&c=apps&hl=en). – molnarm Feb 03 '17 at 12:00
  • 1
    Also it isn't unique to the device, different users on the device will have different ids. – Malcolm Feb 03 '17 at 14:59
  • Re "it might be used to track the device": ...but one could also use the [MAC address](https://en.wikipedia.org/wiki/MAC_address) for that, which will not be changed even by a full factory reset of the device. (Although it seems that Google has [introduced](https://urbanjack.wordpress.com/2016/03/04/game-over-for-wifi-analytics-companies/) MAC address randomization to Android with version 6.0, following the lead of [iOS](http://www.imore.com/closer-look-ios-8s-mac-randomization).) – user2428118 Feb 03 '17 at 15:10
  • This is not hardcoded in the device. Installing a new image will generate another device ID. There are even cases of collisions. – Mindwin Feb 03 '17 at 19:14
  • @Mindwin, there shouldn't be very *many* collisions, though: one per four billion installs. – Mark Feb 03 '17 at 19:55