From e53c4cb312e5bd0f5ef8415a6c476e59f060b639 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Mon, 16 Jan 2017 10:49:55 -0800 Subject: Fixed the logic for tethering provisioning re-evaluation Previously we only re-evaluate provisioning for SIM swap case The new logic covers both SIM swap case (ABSENT->NOT_READY->UNKNOWN->READY->LOADED) and modem reset case (NOT_READY->READY->LOADED) Test: Manual bug: 33815946 Merged-In: I9960123605b10d3fa5f3584c6c8b70b616acd6f8 AOSP-Change-Id: I9960123605b10d3fa5f3584c6c8b70b616acd6f8 CVE-2017-0554 Change-Id: I5d55db56b61780eb83e57bc021d36a129416ce5c (cherry picked from commit 3294256ba5b9e2ba2d8619d617e3d900e5386564) --- .../java/com/android/server/connectivity/Tethering.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 60d6772..873e0c3 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -1696,9 +1696,8 @@ public class Tethering extends BaseNetworkObserver { // used to verify this receiver is still current final private int mGenerationNumber; - // we're interested in edge-triggered LOADED notifications, so - // ignore LOADED unless we saw an ABSENT state first - private boolean mSimAbsentSeen = false; + // used to check the sim state transition from non-loaded to loaded + private boolean mSimNotLoadedSeen = false; public SimChangeBroadcastReceiver(int generationNumber) { super(); @@ -1716,14 +1715,14 @@ public class Tethering extends BaseNetworkObserver { final String state = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); - Log.d(TAG, "got Sim changed to state " + state + ", mSimAbsentSeen=" + - mSimAbsentSeen); - if (!mSimAbsentSeen && IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(state)) { - mSimAbsentSeen = true; + Log.d(TAG, "got Sim changed to state " + state + ", mSimNotLoadedSeen=" + + mSimNotLoadedSeen); + if (!mSimNotLoadedSeen && !IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(state)) { + mSimNotLoadedSeen = true; } - if (mSimAbsentSeen && IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(state)) { - mSimAbsentSeen = false; + if (mSimNotLoadedSeen && IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(state)) { + mSimNotLoadedSeen = false; try { if (mContext.getResources().getString(com.android.internal.R.string. config_mobile_hotspot_provision_app_no_ui).isEmpty() == false) { -- cgit v1.1