Merge "Show sim onboarding for user when insert sim and no DDS" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
3131ed3cef
@@ -31,10 +31,10 @@ import android.telephony.UiccCardInfo;
|
|||||||
import android.telephony.UiccSlotInfo;
|
import android.telephony.UiccSlotInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
import com.android.settings.network.SubscriptionUtil;
|
import com.android.settings.network.SubscriptionUtil;
|
||||||
import com.android.settings.network.UiccSlotUtil;
|
import com.android.settings.network.UiccSlotUtil;
|
||||||
import com.android.settings.network.UiccSlotsException;
|
import com.android.settings.network.UiccSlotsException;
|
||||||
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
|
|
||||||
import com.android.settings.sim.ChooseSimActivity;
|
import com.android.settings.sim.ChooseSimActivity;
|
||||||
import com.android.settings.sim.DsdsDialogActivity;
|
import com.android.settings.sim.DsdsDialogActivity;
|
||||||
import com.android.settings.sim.SimActivationNotifier;
|
import com.android.settings.sim.SimActivationNotifier;
|
||||||
@@ -86,11 +86,6 @@ public class SimSlotChangeHandler {
|
|||||||
throw new IllegalStateException("Cannot be called from main thread.");
|
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();
|
UiccSlotInfo removableSlotInfo = getRemovableUiccSlotInfo();
|
||||||
if (removableSlotInfo == null) {
|
if (removableSlotInfo == null) {
|
||||||
Log.e(TAG, "Unable to find the removable slot. Do nothing.");
|
Log.e(TAG, "Unable to find the removable slot. Do nothing.");
|
||||||
@@ -112,12 +107,25 @@ public class SimSlotChangeHandler {
|
|||||||
// Sets the current removable slot state.
|
// Sets the current removable slot state.
|
||||||
setRemovableSimSlotState(mContext, currentRemovableSlotState);
|
setRemovableSimSlotState(mContext, currentRemovableSlotState);
|
||||||
|
|
||||||
if (mTelMgr.getActiveModemCount() > 1 && isMultipleEnabledProfilesSupported()) {
|
if (mTelMgr.getActiveModemCount() > 1) {
|
||||||
if(!isRemovableSimInserted) {
|
if (!Flags.isDualSimOnboardingEnabled() && !isMultipleEnabledProfilesSupported()) {
|
||||||
Log.i(TAG, "Removable Sim is not inserted in DSDS mode and MEP. Do nothing.");
|
Log.d(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +172,8 @@ public class SimSlotChangeHandler {
|
|||||||
Log.i(
|
Log.i(
|
||||||
TAG,
|
TAG,
|
||||||
"Both removable SIM and eSIM are present. DSDS condition doesn't"
|
"Both removable SIM and eSIM are present. DSDS condition doesn't"
|
||||||
+ " satisfied. User inserted pSIM during SUW. Show choose SIM"
|
+ " satisfied. User inserted pSIM during SUW. Show choose SIM"
|
||||||
+ " screen.");
|
+ " screen.");
|
||||||
startChooseSimActivity(true);
|
startChooseSimActivity(true);
|
||||||
}
|
}
|
||||||
} else if (removableSlotAction == LAST_USER_ACTION_IN_SUW_REMOVE) {
|
} else if (removableSlotAction == LAST_USER_ACTION_IN_SUW_REMOVE) {
|
||||||
@@ -232,8 +240,8 @@ public class SimSlotChangeHandler {
|
|||||||
if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream()
|
if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream()
|
||||||
.findFirst().get().isActive()) {
|
.findFirst().get().isActive()) {
|
||||||
Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing."
|
Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing."
|
||||||
+ " The removableSlotInfo: " + removableSlotInfo
|
+ " The removableSlotInfo: " + removableSlotInfo
|
||||||
+ ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions);
|
+ ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +259,17 @@ public class SimSlotChangeHandler {
|
|||||||
startChooseSimActivity(false);
|
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) {
|
private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) {
|
||||||
Log.i(TAG, "Handle Removable SIM inserted under DSDS+Mep.");
|
Log.i(TAG, "Handle Removable SIM inserted under DSDS+Mep.");
|
||||||
|
|
||||||
@@ -309,7 +328,7 @@ public class SimSlotChangeHandler {
|
|||||||
try {
|
try {
|
||||||
// DEVICE_PROVISIONED is 0 if still in setup wizard. 1 if setup completed.
|
// DEVICE_PROVISIONED is 0 if still in setup wizard. 1 if setup completed.
|
||||||
return Settings.Global.getInt(
|
return Settings.Global.getInt(
|
||||||
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED)
|
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED)
|
||||||
== 1;
|
== 1;
|
||||||
} catch (Settings.SettingNotFoundException e) {
|
} catch (Settings.SettingNotFoundException e) {
|
||||||
Log.e(TAG, "Cannot get DEVICE_PROVISIONED from the device.", e);
|
Log.e(TAG, "Cannot get DEVICE_PROVISIONED from the device.", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user