Show sim onboarding for user when insert sim and no DDS
When the user remove the sim and then insert it back, the DDS may be -1. If the DDS is -1, then the mobile data can not be turned on. Show the sim onboarding for user for this case, the user can update DDS by the flow. Bug: 336380853 Test: verified UI Change-Id: I7fd086cb08917f2cac2c1252585687179a2a2f93
This commit is contained in:
committed by
SongFerng Wang
parent
1acb816217
commit
5f3fc72bd4
@@ -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,12 +107,25 @@ 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;
|
||||
}
|
||||
handleRemovableSimInsertUnderDsdsMep(removableSlotInfo);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -164,8 +172,8 @@ public class SimSlotChangeHandler {
|
||||
Log.i(
|
||||
TAG,
|
||||
"Both removable SIM and eSIM are present. DSDS condition doesn't"
|
||||
+ " satisfied. User inserted pSIM during SUW. Show choose SIM"
|
||||
+ " screen.");
|
||||
+ " satisfied. User inserted pSIM during SUW. Show choose SIM"
|
||||
+ " screen.");
|
||||
startChooseSimActivity(true);
|
||||
}
|
||||
} else if (removableSlotAction == LAST_USER_ACTION_IN_SUW_REMOVE) {
|
||||
@@ -232,8 +240,8 @@ public class SimSlotChangeHandler {
|
||||
if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream()
|
||||
.findFirst().get().isActive()) {
|
||||
Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing."
|
||||
+ " The removableSlotInfo: " + removableSlotInfo
|
||||
+ ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions);
|
||||
+ " The removableSlotInfo: " + removableSlotInfo
|
||||
+ ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
|
||||
@@ -309,7 +328,7 @@ public class SimSlotChangeHandler {
|
||||
try {
|
||||
// DEVICE_PROVISIONED is 0 if still in setup wizard. 1 if setup completed.
|
||||
return Settings.Global.getInt(
|
||||
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED)
|
||||
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED)
|
||||
== 1;
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
Log.e(TAG, "Cannot get DEVICE_PROVISIONED from the device.", e);
|
||||
|
||||
Reference in New Issue
Block a user