From 4deacc24200a7abc999cbdbc50e62de718bb1889 Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Wed, 15 Jan 2014 13:08:03 -0800 Subject: [PATCH] Add new RIL commands to read/write NV items and reset NV config. Add new RIL commands and generic code cleanups. The only changes required for OMA DM support are the addition of five new methods in ITelephony.aidl for reading/writing NV items and performing NV config and radio resets (requires MODIFY_PHONE_STATE), along with the new RIL request IDs in RILConstants.java. Bug: 12864208 Change-Id: I958d2571580d98a49936ef2e6822e5ac086acbe2 --- core/java/android/net/ConnectivityManager.java | 2 ++ .../com/android/server/ConnectivityService.java | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 6ac126efd4..3a35cb9537 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -800,6 +800,8 @@ public class ConnectivityManager { * Ensure that a network route exists to deliver traffic to the specified * host via the specified network interface. An attempt to add a route that * already exists is ignored, but treated as successful. + *

This method requires the caller to hold the permission + * {@link android.Manifest.permission#CHANGE_NETWORK_STATE}. * @param networkType the type of the network over which traffic to the specified * host is to be routed * @param hostAddress the IP address of the host to which the route is desired diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 015185f819..934973064a 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 = false; + private static final boolean VDBG = true; - private static final boolean LOGD_RULES = false; + private static final boolean LOGD_RULES = true; // TODO: create better separation between radio types and network types @@ -4495,11 +4495,16 @@ public class ConnectivityService extends IConnectivityManager.Stub { * @param seconds */ private static void sleep(int seconds) { - try { - Thread.sleep(seconds * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); + log("XXXXX sleeping for " + seconds + " sec"); + long stopTime = System.nanoTime() + (seconds * 1000000000); + long sleepTime; + while ((sleepTime = stopTime - System.nanoTime()) > 0) { + try { + Thread.sleep(sleepTime / 1000000); + } catch (InterruptedException ignored) { + } } + log("XXXXX returning from sleep"); } private static void log(String s) {