Merge "Show sim onboarding for user when insert sim and no DDS" into main

This commit is contained in:
SongFerng Wang
2024-05-07 04:54:19 +00:00
committed by Android (Google) Code Review

View File

@@ -31,10 +31,10 @@ import android.telephony.UiccCardInfo;
import android.telephony.UiccSlotInfo;
import android.util.Log;
import com.android.settings.flags.Flags;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.network.UiccSlotUtil;
import com.android.settings.network.UiccSlotsException;
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
import com.android.settings.sim.ChooseSimActivity;
import com.android.settings.sim.DsdsDialogActivity;
import com.android.settings.sim.SimActivationNotifier;
@@ -86,11 +86,6 @@ public class SimSlotChangeHandler {
throw new IllegalStateException("Cannot be called from main thread.");
}
if (mTelMgr.getActiveModemCount() > 1 && !isMultipleEnabledProfilesSupported()) {
Log.i(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
return;
}
UiccSlotInfo removableSlotInfo = getRemovableUiccSlotInfo();
if (removableSlotInfo == null) {
Log.e(TAG, "Unable to find the removable slot. Do nothing.");
@@ -112,14 +107,27 @@ public class SimSlotChangeHandler {
// Sets the current removable slot state.
setRemovableSimSlotState(mContext, currentRemovableSlotState);
if (mTelMgr.getActiveModemCount() > 1 && isMultipleEnabledProfilesSupported()) {
if(!isRemovableSimInserted) {
Log.i(TAG, "Removable Sim is not inserted in DSDS mode and MEP. Do nothing.");
if (mTelMgr.getActiveModemCount() > 1) {
if (!Flags.isDualSimOnboardingEnabled() && !isMultipleEnabledProfilesSupported()) {
Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
return;
}
if (!isRemovableSimInserted) {
Log.d(TAG, "Removable Sim is not inserted in DSDS mode. Do nothing.");
return;
}
boolean isDdsInvalidForNewUi = Flags.isDualSimOnboardingEnabled()
&& SubscriptionManager.getDefaultDataSubscriptionId()
== SubscriptionManager.INVALID_SUBSCRIPTION_ID;
if (isDdsInvalidForNewUi) {
handleRemovableSimInsertWhenDsdsAndNoDds();
} else if (isMultipleEnabledProfilesSupported()) {
handleRemovableSimInsertUnderDsdsMep(removableSlotInfo);
return;
}
Log.d(TAG, "the device is already in DSDS mode and have the DDS. Do nothing.");
return;
}
if (isRemovableSimInserted) {
handleSimInsert(removableSlotInfo);
@@ -251,6 +259,17 @@ public class SimSlotChangeHandler {
startChooseSimActivity(false);
}
private void handleRemovableSimInsertWhenDsdsAndNoDds() {
List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription();
if (subscriptionInfos.isEmpty()) {
Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing.");
return;
}
Log.d(TAG, "isDdsInvalidForNewUi and getAvailableRemovableSubscription:"
+ subscriptionInfos);
startSimConfirmDialogActivity(subscriptionInfos.get(0).getSubscriptionId());
}
private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) {
Log.i(TAG, "Handle Removable SIM inserted under DSDS+Mep.");