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
This commit is contained in:
Robert Greenwalt
2010-01-14 17:47:58 -08:00
parent 993d19f923
commit d48f8ee465

View File

@@ -180,6 +180,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private ConnectivityService(Context context) { private ConnectivityService(Context context) {
if (DBG) Log.v(TAG, "ConnectivityService starting up"); 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; mContext = context;
mNetTrackers = new NetworkStateTracker[ mNetTrackers = new NetworkStateTracker[
ConnectivityManager.MAX_NETWORK_TYPE+1]; ConnectivityManager.MAX_NETWORK_TYPE+1];