Don't clobber the net hostname if it's already set.

Be a good citizen.

Change-Id: Ic58aeab013e2ff34201be71e01e399390edbbb5f
This commit is contained in:
Robert Greenwalt
2010-12-06 09:30:17 -08:00
parent e70c6f53c6
commit 82cde1324d

View File

@@ -264,12 +264,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mHandler = new MyHandler(handlerThread.getLooper()); mHandler = new MyHandler(handlerThread.getLooper());
// setup our unique device name // setup our unique device name
if (TextUtils.isEmpty(SystemProperties.get("net.hostname"))) {
String id = Settings.Secure.getString(context.getContentResolver(), String id = Settings.Secure.getString(context.getContentResolver(),
Settings.Secure.ANDROID_ID); Settings.Secure.ANDROID_ID);
if (id != null && id.length() > 0) { if (id != null && id.length() > 0) {
String name = new String("android_").concat(id); String name = new String("android_").concat(id);
SystemProperties.set("net.hostname", name); SystemProperties.set("net.hostname", name);
} }
}
// read our default dns server ip // read our default dns server ip
String dns = Settings.Secure.getString(context.getContentResolver(), String dns = Settings.Secure.getString(context.getContentResolver(),