OSDN Git Service

Fixed the logic for tethering provisioning re-evaluation am: 91a0bc9564 am: 40d0753b1...
authorJack Yu <jackyu@google.com>
Thu, 2 Feb 2017 22:55:10 +0000 (22:55 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Thu, 2 Feb 2017 22:55:10 +0000 (22:55 +0000)
am: ecadb9d7cb

Change-Id: I85221b6dc0097893ec6d5d3fbbe09d549ecc1b18

services/core/java/com/android/server/connectivity/Tethering.java

index da9c547..de919a3 100644 (file)
@@ -1541,9 +1541,8 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
             // 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();
@@ -1561,14 +1560,14 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
                 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) {