From a3ef83cc3cda1a5aadc094de41bacf8d733de30b Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 2 Jul 2013 12:41:31 -0700 Subject: [PATCH 1/2] am ef5c31ae: am db011499: am 753d754c: Merge "Fix NPE if mobile is not supported in checkMobileProvisioning." into jb-mr2-dev * commit 'ef5c31ae3eced8b5def6881c86d962fa07d43fb0': Fix NPE if mobile is not supported in checkMobileProvisioning. --- .../java/com/android/server/ConnectivityService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index fc346a25b7..f2e0f2988e 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -3564,6 +3564,16 @@ public class ConnectivityService extends IConnectivityManager.Stub { timeOutMs = CheckMp.MAX_TIMEOUT_MS; } + // Check that mobile networks are supported + if (!isNetworkSupported(ConnectivityManager.TYPE_MOBILE) + || !isNetworkSupported(ConnectivityManager.TYPE_MOBILE_HIPRI)) { + log("checkMobileProvisioning: X no mobile network"); + if (resultReceiver != null) { + resultReceiver.send(ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION, null); + } + return timeOutMs; + } + final long token = Binder.clearCallingIdentity(); try { CheckMp checkMp = new CheckMp(mContext, this); From 800495504c10b6c98040166ef1595a2e5cde3db4 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 13 Aug 2013 12:41:06 -0700 Subject: [PATCH 2/2] In isMobileOk don't execute finally if mobile data is not supported. Move the early return outside the try {} finally so we don't call setEnableFailFastMobileData(DctContants.DISABLED). Otherwise referencing counting is wrong and an exception is thrown in DcTrackerBase. Bug: 10304904 Change-Id: I5ba5121e473bada9f3daa8d6f3d3577cec8212fc --- .../java/com/android/server/ConnectivityService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index bb0d2483ae..a0e6dd1a87 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -3916,13 +3916,13 @@ public class ConnectivityService extends IConnectivityManager.Stub { Random rand = new Random(); mParams = params; - try { - if (mCs.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false) { - log("isMobileOk: not mobile capable"); - result = ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION; - return result; - } + if (mCs.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false) { + log("isMobileOk: not mobile capable"); + result = ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION; + return result; + } + try { // Enable fail fast as we'll do retries here and use a // hipri connection so the default connection stays active. log("isMobileOk: start hipri url=" + params.mUrl);