diff options
| author | 2010-01-14 17:47:58 -0800 | |
|---|---|---|
| committer | 2010-01-14 18:09:17 -0800 | |
| commit | de8383ca312c03fa8e935ac1549ae31ce668652c (patch) | |
| tree | e46a21108681d02a40f1db0db47e6c79381bee30 | |
| parent | 8d528c85d00cea5168ed6842f17c7f5afae338c4 (diff) | |
Set net.hostname sys property to our unique ID.
Give us a default name networking wise so that wifi (at least) can use it.
Bug:2327089
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 80129d0671bd..6fa468a18cb9 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -180,6 +180,15 @@ public class ConnectivityService extends IConnectivityManager.Stub { private ConnectivityService(Context context) { if (DBG) Log.v(TAG, "ConnectivityService starting up"); + + // setup our unique device name + 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); + } + mContext = context; mNetTrackers = new NetworkStateTracker[ ConnectivityManager.MAX_NETWORK_TYPE+1]; |