Loading src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java +5 −10 Original line number Diff line number Diff line Loading @@ -69,20 +69,15 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar { } } /** Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. */ // ToDo: delete this api and refactor the related code. public void run(int subscriptionId) { setState(State.RUNNING, Substate.UNUSED); mCallbackIntent = createCallbackIntent(); mEuiccManager.switchToSubscription(subscriptionId, mCallbackIntent); } /** * Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. * * @param subscriptionId the esim's subscriptionId. * @param port the esim's portId. If user wants to inactivate esim, then user must to assign the * the port. If user wants to activate esim, then the port can be -1. * @param port the esim's portId. If user wants to inactivate esim, then user must to assign * the corresponding port. If user wants to activate esim, then the port can be * {@link UiccSlotUtil#INVALID_PORT_ID}. When it is * {@link UiccSlotUtil#INVALID_PORT_ID}, the system will reassign a corresponding * port id. * @param removedSubInfo if the all of slots have sims, it should remove the one of active sim. * If the removedSubInfo is null, then use the default value. * The default value is the esim slot and portId 0. Loading src/com/android/settings/network/SwitchToRemovableSlotSidecar.java +0 −23 Original line number Diff line number Diff line Loading @@ -80,29 +80,6 @@ public class SwitchToRemovableSlotSidecar extends EuiccOperationSidecar } } /** * Starts switching to the removable slot. It disables the active eSIM profile before switching * if there is one. * * @param physicalSlotId removable physical SIM slot ID. */ // ToDo: delete this api and refactor the related code. public void run(int physicalSlotId) { mPhysicalSlotId = physicalSlotId; SubscriptionManager subscriptionManager = getContext().getSystemService(SubscriptionManager.class); if (SubscriptionUtil.getActiveSubscriptions(subscriptionManager).stream() .anyMatch(SubscriptionInfo::isEmbedded)) { // In SS mode, the esim is active, then inactivate the esim. Log.i(TAG, "There is an active eSIM profile. Disable the profile first."); // Use INVALID_SUBSCRIPTION_ID to disable the only active profile. mSwitchToSubscriptionSidecar.run(SubscriptionManager.INVALID_SUBSCRIPTION_ID, 0, null); } else { Log.i(TAG, "There is no active eSIM profiles. Start to switch to removable slot."); mSwitchSlotSidecar.runSwitchToRemovableSlot(mPhysicalSlotId, null); } } /** * Starts switching to the removable slot. * Loading src/com/android/settings/sim/ChooseSimActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -159,11 +159,12 @@ public class ChooseSimActivity extends Activity mSelectedItemIndex = subItem.getId(); if (mSelectedItemIndex == INDEX_PSIM) { Log.i(TAG, "Ready to switch to pSIM slot."); mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID); mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID, null); } else { Log.i(TAG, "Ready to switch to eSIM subscription with index: " + mSelectedItemIndex); mSwitchToEuiccSubscriptionSidecar.run( mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId()); mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId(), UiccSlotUtil.INVALID_PORT_ID, null); } } Loading src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.SidecarFragment; import com.android.settings.network.SwitchToEuiccSubscriptionSidecar; import com.android.settings.network.UiccSlotUtil; import com.android.settings.network.telephony.AlertDialogFragment; import com.android.settings.network.telephony.ConfirmDialogFragment; import com.android.settings.network.telephony.SubscriptionActionDialogActivity; Loading Loading @@ -110,7 +111,8 @@ public class SwitchToEsimConfirmDialogActivity extends SubscriptionActionDialogA return; } Log.i(TAG, "User confirmed to switch to embedded slot."); mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId()); mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId(), UiccSlotUtil.INVALID_PORT_ID, null); showProgressDialog( getString( R.string.sim_action_switch_sub_dialog_progress, Loading src/com/android/settings/sim/receivers/SimSlotChangeHandler.java +3 −2 Original line number Diff line number Diff line Loading @@ -210,10 +210,11 @@ public class SimSlotChangeHandler { } List<SubscriptionInfo> groupedEmbeddedSubscriptions = getGroupedEmbeddedSubscriptions(); if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream() .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 + ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions); return; } Loading Loading
src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java +5 −10 Original line number Diff line number Diff line Loading @@ -69,20 +69,15 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar { } } /** Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. */ // ToDo: delete this api and refactor the related code. public void run(int subscriptionId) { setState(State.RUNNING, Substate.UNUSED); mCallbackIntent = createCallbackIntent(); mEuiccManager.switchToSubscription(subscriptionId, mCallbackIntent); } /** * Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. * * @param subscriptionId the esim's subscriptionId. * @param port the esim's portId. If user wants to inactivate esim, then user must to assign the * the port. If user wants to activate esim, then the port can be -1. * @param port the esim's portId. If user wants to inactivate esim, then user must to assign * the corresponding port. If user wants to activate esim, then the port can be * {@link UiccSlotUtil#INVALID_PORT_ID}. When it is * {@link UiccSlotUtil#INVALID_PORT_ID}, the system will reassign a corresponding * port id. * @param removedSubInfo if the all of slots have sims, it should remove the one of active sim. * If the removedSubInfo is null, then use the default value. * The default value is the esim slot and portId 0. Loading
src/com/android/settings/network/SwitchToRemovableSlotSidecar.java +0 −23 Original line number Diff line number Diff line Loading @@ -80,29 +80,6 @@ public class SwitchToRemovableSlotSidecar extends EuiccOperationSidecar } } /** * Starts switching to the removable slot. It disables the active eSIM profile before switching * if there is one. * * @param physicalSlotId removable physical SIM slot ID. */ // ToDo: delete this api and refactor the related code. public void run(int physicalSlotId) { mPhysicalSlotId = physicalSlotId; SubscriptionManager subscriptionManager = getContext().getSystemService(SubscriptionManager.class); if (SubscriptionUtil.getActiveSubscriptions(subscriptionManager).stream() .anyMatch(SubscriptionInfo::isEmbedded)) { // In SS mode, the esim is active, then inactivate the esim. Log.i(TAG, "There is an active eSIM profile. Disable the profile first."); // Use INVALID_SUBSCRIPTION_ID to disable the only active profile. mSwitchToSubscriptionSidecar.run(SubscriptionManager.INVALID_SUBSCRIPTION_ID, 0, null); } else { Log.i(TAG, "There is no active eSIM profiles. Start to switch to removable slot."); mSwitchSlotSidecar.runSwitchToRemovableSlot(mPhysicalSlotId, null); } } /** * Starts switching to the removable slot. * Loading
src/com/android/settings/sim/ChooseSimActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -159,11 +159,12 @@ public class ChooseSimActivity extends Activity mSelectedItemIndex = subItem.getId(); if (mSelectedItemIndex == INDEX_PSIM) { Log.i(TAG, "Ready to switch to pSIM slot."); mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID); mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID, null); } else { Log.i(TAG, "Ready to switch to eSIM subscription with index: " + mSelectedItemIndex); mSwitchToEuiccSubscriptionSidecar.run( mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId()); mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId(), UiccSlotUtil.INVALID_PORT_ID, null); } } Loading
src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.SidecarFragment; import com.android.settings.network.SwitchToEuiccSubscriptionSidecar; import com.android.settings.network.UiccSlotUtil; import com.android.settings.network.telephony.AlertDialogFragment; import com.android.settings.network.telephony.ConfirmDialogFragment; import com.android.settings.network.telephony.SubscriptionActionDialogActivity; Loading Loading @@ -110,7 +111,8 @@ public class SwitchToEsimConfirmDialogActivity extends SubscriptionActionDialogA return; } Log.i(TAG, "User confirmed to switch to embedded slot."); mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId()); mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId(), UiccSlotUtil.INVALID_PORT_ID, null); showProgressDialog( getString( R.string.sim_action_switch_sub_dialog_progress, Loading
src/com/android/settings/sim/receivers/SimSlotChangeHandler.java +3 −2 Original line number Diff line number Diff line Loading @@ -210,10 +210,11 @@ public class SimSlotChangeHandler { } List<SubscriptionInfo> groupedEmbeddedSubscriptions = getGroupedEmbeddedSubscriptions(); if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream() .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 + ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions); return; } Loading