diff options
author | Malcolm Chen <refuhoo@google.com> | 2019-06-25 18:19:23 -0700 |
---|---|---|
committer | Malcolm Chen <refuhoo@google.com> | 2019-06-27 14:08:37 -0700 |
commit | bc24e5830c362eddaae756d7d848098a2742ff5a (patch) | |
tree | a5805a740c84f3c5b9c640d877c7da08444e8bb4 | |
parent | 2489964f84b830a7172e34f06231101ddc671f7e (diff) | |
download | AlternativeNetworkAccess-bc24e5830c362eddaae756d7d848098a2742ff5a.tar.gz |
When oppt profile is disabled, make sure to enable the modem stack.
Whenever there's a oppt subscription change, check and enable modem
stack if oppt subscription is no longer active on that slot.
Bug: 136022701
Test: manual
Change-Id: I1a5fd0fc26c84a31ca024ed9c441a2a46c8d9533
-rw-r--r-- | src/com/android/ons/ONSProfileSelector.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/android/ons/ONSProfileSelector.java b/src/com/android/ons/ONSProfileSelector.java index 30c3b6c..37719f5 100644 --- a/src/com/android/ons/ONSProfileSelector.java +++ b/src/com/android/ons/ONSProfileSelector.java @@ -165,6 +165,7 @@ public class ONSProfileSelector { new SubscriptionManager.OnOpportunisticSubscriptionsChangedListener() { @Override public void onOpportunisticSubscriptionsChanged() { + logDebug("onOpportunisticSubscriptionsChanged."); mHandler.sendEmptyMessage(MSG_PROFILE_UPDATE); } }; @@ -586,7 +587,7 @@ public class ONSProfileSelector { } private boolean enableModem(int subId, boolean enable) { - if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + if (!mSubscriptionManager.isActiveSubId(subId)) { return false; } @@ -726,6 +727,24 @@ public class ONSProfileSelector { } } + private void enableModemStackForNonOpportunisticSlots() { + int phoneCount = mTelephonyManager.getPhoneCount(); + // Do nothing in single SIM mode. + if (phoneCount < 2) return; + + for (int i = 0; i < phoneCount; i++) { + boolean hasActiveOpptProfile = false; + for (SubscriptionInfo info : mOppSubscriptionInfos) { + if (info.getSimSlotIndex() == i) { + hasActiveOpptProfile = true; + } + } + // If the slot doesn't have active opportunistic profile anymore, it's back to + // DSDS use-case. Make sure the the modem stack is enabled. + if (!hasActiveOpptProfile) mTelephonyManager.enableModemForSlot(i, true); + } + } + @VisibleForTesting protected void init(Context c, ONSProfileSelectionCallback profileSelectionCallback) { mContext = c; @@ -750,6 +769,7 @@ public class ONSProfileSelector { case MSG_PROFILE_UPDATE: synchronized (mLock) { updateOpportunisticSubscriptions(); + enableModemStackForNonOpportunisticSlots(); } break; case MSG_START_PROFILE_SELECTION: |