From 19be149de78818771293b40bf2238886200b170f Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Thu, 6 Feb 2014 14:43:50 -0800 Subject: [PATCH 1/5] Remove unneeded new RIL command. Remove the recently added RIL_REQUEST_SET_RADIO_MODE command and update the definition of the RIL_REQUEST_NV_RESET_CONFIG parameter. Also remove some accidentally added debug log lines. Bug: 12864208 Change-Id: I6f035d6900c9fcb1427bad62057d7b4a1d3cd99c --- .../core/java/com/android/server/ConnectivityService.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 342336e1d8..2afb53d7b3 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -169,9 +169,9 @@ public class ConnectivityService extends IConnectivityManager.Stub { private static final String TAG = "ConnectivityService"; private static final boolean DBG = true; - private static final boolean VDBG = true; + private static final boolean VDBG = false; - private static final boolean LOGD_RULES = true; + private static final boolean LOGD_RULES = false; // TODO: create better separation between radio types and network types @@ -4504,7 +4504,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { * @param seconds */ private static void sleep(int seconds) { - log("XXXXX sleeping for " + seconds + " sec"); long stopTime = System.nanoTime() + (seconds * 1000000000); long sleepTime; while ((sleepTime = stopTime - System.nanoTime()) > 0) { @@ -4513,7 +4512,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { } catch (InterruptedException ignored) { } } - log("XXXXX returning from sleep"); } private static void log(String s) { From 5fad0b3ae577ce7d02e76221705e57d19976e675 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Wed, 19 Mar 2014 14:26:28 -0700 Subject: [PATCH 2/5] Catch Netd exceptions to avoid runtime restart bug:13475636 Change-Id: If36a0051a957fc066711fe8225f8981bc07add04 --- .../core/java/com/android/server/ConnectivityService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 68b779c023..ca1c0aee29 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2434,7 +2434,9 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (timeout > 0 && iface != null) { try { mNetd.addIdleTimer(iface, timeout, type); - } catch (RemoteException e) { + } catch (Exception e) { + // You shall not crash! + loge("Exception in setupDataActivityTracking " + e); } } } @@ -2451,7 +2453,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { try { // the call fails silently if no idletimer setup for this interface mNetd.removeIdleTimer(iface); - } catch (RemoteException e) { + } catch (Exception e) { + loge("Exception in removeDataActivityTracking " + e); } } } From 09480006afe4c0610e45ceed124f37f5dacaebc8 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Tue, 13 May 2014 06:32:53 -0700 Subject: [PATCH 3/5] Comment out some new netd calls to fix networking. bug:14869053 Change-Id: Ifc44f3cbadd0402c7b06e01962695e6b65dc48b3 --- .../core/java/com/android/server/ConnectivityService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index c1ffd56ae5..ce2aefb6b5 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2084,7 +2084,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { getConnectivityChangeDelay()); } try { - mNetd.removeNetwork(thisNetId); +// mNetd.removeNetwork(thisNetId); } catch (Exception e) { loge("Exception removing network: " + e); } finally { @@ -2388,7 +2388,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { int thisNetId = nextNetId(); thisNet.setNetId(thisNetId); try { - mNetd.createNetwork(thisNetId, thisIface); +// mNetd.createNetwork(thisNetId, thisIface); } catch (Exception e) { loge("Exception creating network :" + e); teardown(thisNet); @@ -2420,7 +2420,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { int thisNetId = nextNetId(); thisNet.setNetId(thisNetId); try { - mNetd.createNetwork(thisNetId, thisIface); +// mNetd.createNetwork(thisNetId, thisIface); } catch (Exception e) { loge("Exception creating network :" + e); teardown(thisNet); From c63e50cd55b1da8ef11857e578c96bc2d2aed74c Mon Sep 17 00:00:00 2001 From: Sreeram Ramachandran Date: Wed, 14 May 2014 14:45:00 -0700 Subject: [PATCH 4/5] Fix reboot loop due to NPE. All that's old is new again: http://ag/63748. Change-Id: I83df48447dbcb7f6edf02bd07abf721b009afa49 --- core/java/android/net/ProxyInfo.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/net/ProxyInfo.java b/core/java/android/net/ProxyInfo.java index 991d9dacd7..ceedd98e77 100644 --- a/core/java/android/net/ProxyInfo.java +++ b/core/java/android/net/ProxyInfo.java @@ -160,6 +160,8 @@ public class ProxyInfo implements Parcelable { } mExclusionList = source.getExclusionListAsString(); mParsedExclusionList = source.mParsedExclusionList; + } else { + mPacFileUrl = Uri.EMPTY; } } From 837da9fd5917e863b5bea4269c7f86d056054228 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 15 May 2014 15:27:13 -0700 Subject: [PATCH 5/5] Add net.dns system properties Some apps rely on them. bug: 14992618 Change-Id: I5766f26b77004e9cfcc90fac657817eab67f9ac7 --- .../android/server/ConnectivityService.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 0708e55d4a..982dce0a73 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -5491,10 +5491,29 @@ public class ConnectivityService extends IConnectivityManager.Stub { } catch (Exception e) { loge("Exception in setDnsServersForNetwork: " + e); } - // TODO - setprop "net.dnsX" + NetworkAgentInfo defaultNai = mNetworkForRequestId.get(mDefaultRequest.requestId); + if (defaultNai != null && defaultNai.network.netId == netId) { + setDefaultDnsSystemProperties(dnses); + } } } + private void setDefaultDnsSystemProperties(Collection dnses) { + int last = 0; + for (InetAddress dns : dnses) { + ++last; + String key = "net.dns" + last; + String value = dns.getHostAddress(); + SystemProperties.set(key, value); + } + for (int i = last + 1; i <= mNumDnsEntries; ++i) { + String key = "net.dns" + i; + SystemProperties.set(key, ""); + } + mNumDnsEntries = last; + } + + private void updateCapabilities(NetworkAgentInfo networkAgent, NetworkCapabilities networkCapabilities) { // TODO - what else here? Verify still satisfies everybody? @@ -5610,6 +5629,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (mDefaultRequest.requestId == nri.request.requestId) { isNewDefault = true; updateActiveDefaultNetwork(newNetwork); + if (newNetwork.linkProperties != null) { + setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnses()); + } else { + setDefaultDnsSystemProperties(new ArrayList()); + } } } }