Don't clobber the net hostname if it's already set.
Be a good citizen.
Change-Id: Ic58aeab013e2ff34201be71e01e399390edbbb5f
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 7e76ea5..43c857a 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -264,11 +264,13 @@
mHandler = new MyHandler(handlerThread.getLooper());
// 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);
+ 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);
+ }
}
// read our default dns server ip