Loading src/com/android/settings/sim/receivers/SimSlotChangeHandler.java +27 −10 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.UiccCardInfo; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.util.Log; Loading Loading @@ -91,10 +92,10 @@ public class SimSlotChangeHandler { Log.e(TAG, "Unable to find the removable slot. Do nothing."); return; } Log.i(TAG, "The removableSlotInfo: " + removableSlotInfo); int lastRemovableSlotState = getLastRemovableSimSlotState(mContext); int currentRemovableSlotState = removableSlotInfo.getCardStateInfo(); Log.i(TAG, Log.d(TAG, "lastRemovableSlotState: " + lastRemovableSlotState + ",currentRemovableSlotState: " + currentRemovableSlotState); boolean isRemovableSimInserted = Loading @@ -115,8 +116,12 @@ public class SimSlotChangeHandler { if (Flags.isDualSimOnboardingEnabled()) { // ForNewUi, when the user inserts the psim, showing the sim onboarding for the user // to setup the sim switching or the default data subscription. handleRemovableSimInsertWhenDsds(); // to setup the sim switching or the default data subscription in DSDS. // Will show dialog for below case. // 1. the psim slot is not active. // 2. there are one or more active sim. handleRemovableSimInsertWhenDsds(removableSlotInfo); return; } else if (!isMultipleEnabledProfilesSupported()) { Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing."); return; Loading @@ -124,8 +129,6 @@ public class SimSlotChangeHandler { handleRemovableSimInsertUnderDsdsMep(removableSlotInfo); return; } Log.d(TAG, "the device is already in DSDS mode and have the DDS. Do nothing."); return; } if (isRemovableSimInserted) { Loading Loading @@ -258,15 +261,29 @@ public class SimSlotChangeHandler { startChooseSimActivity(false); } private void handleRemovableSimInsertWhenDsds() { private boolean hasOtherActiveSubInfo(int psimSubId) { List<SubscriptionInfo> activeSubs = SubscriptionUtil.getActiveSubscriptions(mSubMgr); return activeSubs.stream() .anyMatch(subscriptionInfo -> subscriptionInfo.getSubscriptionId() != psimSubId); } private boolean hasAnyPortActiveInSlot(UiccSlotInfo removableSlotInfo) { return removableSlotInfo.getPorts().stream().anyMatch(UiccPortInfo::isActive); } private void handleRemovableSimInsertWhenDsds(UiccSlotInfo removableSlotInfo) { Log.i(TAG, "ForNewUi: Handle Removable SIM inserted"); List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription(); if (subscriptionInfos.isEmpty()) { Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing."); return; } Log.d(TAG, "ForNewUi and getAvailableRemovableSubscription:" + subscriptionInfos); startSimConfirmDialogActivity(subscriptionInfos.get(0).getSubscriptionId()); Log.d(TAG, "getAvailableRemovableSubscription:" + subscriptionInfos); int psimSubId = subscriptionInfos.get(0).getSubscriptionId(); if (!hasAnyPortActiveInSlot(removableSlotInfo) || hasOtherActiveSubInfo(psimSubId)) { Log.d(TAG, "ForNewUi Start Setup flow"); startSimConfirmDialogActivity(psimSubId); } } private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) { Loading Loading
src/com/android/settings/sim/receivers/SimSlotChangeHandler.java +27 −10 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.UiccCardInfo; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.util.Log; Loading Loading @@ -91,10 +92,10 @@ public class SimSlotChangeHandler { Log.e(TAG, "Unable to find the removable slot. Do nothing."); return; } Log.i(TAG, "The removableSlotInfo: " + removableSlotInfo); int lastRemovableSlotState = getLastRemovableSimSlotState(mContext); int currentRemovableSlotState = removableSlotInfo.getCardStateInfo(); Log.i(TAG, Log.d(TAG, "lastRemovableSlotState: " + lastRemovableSlotState + ",currentRemovableSlotState: " + currentRemovableSlotState); boolean isRemovableSimInserted = Loading @@ -115,8 +116,12 @@ public class SimSlotChangeHandler { if (Flags.isDualSimOnboardingEnabled()) { // ForNewUi, when the user inserts the psim, showing the sim onboarding for the user // to setup the sim switching or the default data subscription. handleRemovableSimInsertWhenDsds(); // to setup the sim switching or the default data subscription in DSDS. // Will show dialog for below case. // 1. the psim slot is not active. // 2. there are one or more active sim. handleRemovableSimInsertWhenDsds(removableSlotInfo); return; } else if (!isMultipleEnabledProfilesSupported()) { Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing."); return; Loading @@ -124,8 +129,6 @@ public class SimSlotChangeHandler { handleRemovableSimInsertUnderDsdsMep(removableSlotInfo); return; } Log.d(TAG, "the device is already in DSDS mode and have the DDS. Do nothing."); return; } if (isRemovableSimInserted) { Loading Loading @@ -258,15 +261,29 @@ public class SimSlotChangeHandler { startChooseSimActivity(false); } private void handleRemovableSimInsertWhenDsds() { private boolean hasOtherActiveSubInfo(int psimSubId) { List<SubscriptionInfo> activeSubs = SubscriptionUtil.getActiveSubscriptions(mSubMgr); return activeSubs.stream() .anyMatch(subscriptionInfo -> subscriptionInfo.getSubscriptionId() != psimSubId); } private boolean hasAnyPortActiveInSlot(UiccSlotInfo removableSlotInfo) { return removableSlotInfo.getPorts().stream().anyMatch(UiccPortInfo::isActive); } private void handleRemovableSimInsertWhenDsds(UiccSlotInfo removableSlotInfo) { Log.i(TAG, "ForNewUi: Handle Removable SIM inserted"); List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription(); if (subscriptionInfos.isEmpty()) { Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing."); return; } Log.d(TAG, "ForNewUi and getAvailableRemovableSubscription:" + subscriptionInfos); startSimConfirmDialogActivity(subscriptionInfos.get(0).getSubscriptionId()); Log.d(TAG, "getAvailableRemovableSubscription:" + subscriptionInfos); int psimSubId = subscriptionInfos.get(0).getSubscriptionId(); if (!hasAnyPortActiveInSlot(removableSlotInfo) || hasOtherActiveSubInfo(psimSubId)) { Log.d(TAG, "ForNewUi Start Setup flow"); startSimConfirmDialogActivity(psimSubId); } } private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) { Loading