summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorAlexander Wuerstlein <arw@arw.name>2016-09-01 14:23:02 +0200
committerAlexander Wuerstlein <arw@arw.name>2016-09-02 13:51:43 +0200
commit335cd0cdd182606b4cac51850f32a9ccdba58d9b (patch)
treea704542f12a85e9b278bd7f0feff59b723077b30 /packages
parent61da29a98bedac7732cb03c3008d0047de6574f9 (diff)
downloadframeworks_base-335cd0cdd182606b4cac51850f32a9ccdba58d9b.zip
frameworks_base-335cd0cdd182606b4cac51850f32a9ccdba58d9b.tar.gz
frameworks_base-335cd0cdd182606b4cac51850f32a9ccdba58d9b.tar.bz2
connectivity-service: fix/improve unique hostname
ConnectivityService should set the net.hostname property to either the current DEVICE_HOSTNAME or android-ANDROID_ID or leave net.hostname unchanged if already set. However, the logic was flawed such that if DEVICE_HOSTNAME was empty but net.hostname was not, net.hostname would always be set to an empty string, leading to DHCP breakage later on. The logic has been fixed, clarified and improved such that: net.hostname will only be changed if it is empty. If net.hostname is empty, it will be set to either (in order): the nonempty value of DEVICE_HOSTNAME, android-ANDROID_ID or android-r-RANDOM_NUMBER. The last option is an addition to have a sensible fallback in case both DEVICE_HOSTNAME and ANDROID_ID are empty. The random number is generated by java.util.Random, because I consider cryptographically strong randomness unnecessary here and think possible blocking in SecureRandom might be undesirable. Thanks to stargo for pointing me to the right place to edit. Thanks to Ethan Chen for his stylistic advice. Change-Id: I603ab4d6a265456bf4fa310939965cfa677fc881
Diffstat (limited to 'packages')
0 files changed, 0 insertions, 0 deletions