Merge "Add more condition to avoid to open the SimOnboardingActivity" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
ac7236ec0f
@@ -28,6 +28,7 @@ import android.telephony.SubscriptionInfo;
|
|||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.UiccCardInfo;
|
import android.telephony.UiccCardInfo;
|
||||||
|
import android.telephony.UiccPortInfo;
|
||||||
import android.telephony.UiccSlotInfo;
|
import android.telephony.UiccSlotInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -91,10 +92,10 @@ public class SimSlotChangeHandler {
|
|||||||
Log.e(TAG, "Unable to find the removable slot. Do nothing.");
|
Log.e(TAG, "Unable to find the removable slot. Do nothing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "The removableSlotInfo: " + removableSlotInfo);
|
||||||
int lastRemovableSlotState = getLastRemovableSimSlotState(mContext);
|
int lastRemovableSlotState = getLastRemovableSimSlotState(mContext);
|
||||||
int currentRemovableSlotState = removableSlotInfo.getCardStateInfo();
|
int currentRemovableSlotState = removableSlotInfo.getCardStateInfo();
|
||||||
Log.i(TAG,
|
Log.d(TAG,
|
||||||
"lastRemovableSlotState: " + lastRemovableSlotState + ",currentRemovableSlotState: "
|
"lastRemovableSlotState: " + lastRemovableSlotState + ",currentRemovableSlotState: "
|
||||||
+ currentRemovableSlotState);
|
+ currentRemovableSlotState);
|
||||||
boolean isRemovableSimInserted =
|
boolean isRemovableSimInserted =
|
||||||
@@ -115,8 +116,12 @@ public class SimSlotChangeHandler {
|
|||||||
|
|
||||||
if (Flags.isDualSimOnboardingEnabled()) {
|
if (Flags.isDualSimOnboardingEnabled()) {
|
||||||
// ForNewUi, when the user inserts the psim, showing the sim onboarding for the user
|
// ForNewUi, when the user inserts the psim, showing the sim onboarding for the user
|
||||||
// to setup the sim switching or the default data subscription.
|
// to setup the sim switching or the default data subscription in DSDS.
|
||||||
handleRemovableSimInsertWhenDsds();
|
// 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()) {
|
} else if (!isMultipleEnabledProfilesSupported()) {
|
||||||
Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
|
Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
|
||||||
return;
|
return;
|
||||||
@@ -124,8 +129,6 @@ public class SimSlotChangeHandler {
|
|||||||
handleRemovableSimInsertUnderDsdsMep(removableSlotInfo);
|
handleRemovableSimInsertUnderDsdsMep(removableSlotInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "the device is already in DSDS mode and have the DDS. Do nothing.");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRemovableSimInserted) {
|
if (isRemovableSimInserted) {
|
||||||
@@ -258,15 +261,29 @@ public class SimSlotChangeHandler {
|
|||||||
startChooseSimActivity(false);
|
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();
|
List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription();
|
||||||
if (subscriptionInfos.isEmpty()) {
|
if (subscriptionInfos.isEmpty()) {
|
||||||
Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing.");
|
Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "ForNewUi and getAvailableRemovableSubscription:"
|
Log.d(TAG, "getAvailableRemovableSubscription:" + subscriptionInfos);
|
||||||
+ subscriptionInfos);
|
int psimSubId = subscriptionInfos.get(0).getSubscriptionId();
|
||||||
startSimConfirmDialogActivity(subscriptionInfos.get(0).getSubscriptionId());
|
if (!hasAnyPortActiveInSlot(removableSlotInfo) || hasOtherActiveSubInfo(psimSubId)) {
|
||||||
|
Log.d(TAG, "ForNewUi Start Setup flow");
|
||||||
|
startSimConfirmDialogActivity(psimSubId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) {
|
private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user