summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack Yu <jackyu@google.com> 2017-01-16 10:49:55 -0800
committer Jack Yu <jackyu@google.com> 2017-01-27 09:30:26 -0800
commit16485b89633ff8db022ffdb41b8567aed58824d0 (patch)
treeadbae92c72ddf44fa2269e1e465029f5fdf04fc7
parent22a7c7ddf2a72f779f60ef0427a7495b566bfaea (diff)
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 Change-Id: I9960123605b10d3fa5f3584c6c8b70b616acd6f8
-rw-r--r--services/core/java/com/android/server/connectivity/Tethering.java21
1 files changed, 8 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index b0e45097aff6..9d63462d6abc 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -1244,10 +1244,6 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
return false;
}
- private boolean isSimCardAbsent(String state) {
- return IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(state);
- }
-
private boolean isSimCardLoaded(String state) {
return IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(state);
}
@@ -1264,9 +1260,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) {
mGenerationNumber = generationNumber;
@@ -1284,16 +1279,16 @@ 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);
+ Log.d(TAG, "got Sim changed to state " + state + ", mSimNotLoadedSeen=" +
+ mSimNotLoadedSeen);
- if (isSimCardAbsent(state)) {
- if (!mSimAbsentSeen) mSimAbsentSeen = true;
+ if (!isSimCardLoaded(state)) {
+ if (!mSimNotLoadedSeen) mSimNotLoadedSeen = true;
return;
}
- if (isSimCardLoaded(state) && mSimAbsentSeen) {
- mSimAbsentSeen = false;
+ if (isSimCardLoaded(state) && mSimNotLoadedSeen) {
+ mSimNotLoadedSeen = false;
if (!hasMobileHotspotProvisionApp()) return;