Loading src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java +4 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.PhoneConstants; import com.android.settings.R; import com.android.settingslib.DeviceInfoUtils; import com.android.settingslib.Utils; Loading Loading @@ -101,6 +100,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O @VisibleForTesting final static int IMS_REGISTRATION_STATE_VALUE_ID = R.id.ims_reg_state_value; @VisibleForTesting static final int MAX_PHONE_COUNT_SINGLE_SIM = 1; private final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = new OnSubscriptionsChangedListener() { @Override Loading Loading @@ -486,7 +488,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O boolean shouldHaveEid = false; String eid = null; if (mTelephonyManager.getPhoneCount() > PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM) { if (mTelephonyManager.getActiveModemCount() > MAX_PHONE_COUNT_SINGLE_SIM) { // Get EID per-SIM in multi-SIM mode Map<Integer, Integer> mapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); int pSlotId = mapping.getOrDefault(mSlotIndex, Loading tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java +13 −15 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.MAX_PHONE_COUNT_SINGLE_SIM; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.NETWORK_PROVIDER_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.OPERATOR_INFO_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.OPERATOR_INFO_VALUE_ID; Loading @@ -33,6 +34,7 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_VALUE_ID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -61,7 +63,6 @@ import android.telephony.euicc.EuiccManager; import androidx.lifecycle.LifecycleOwner; import com.android.internal.telephony.PhoneConstants; import com.android.settings.R; import com.android.settings.testutils.shadow.ShadowDeviceInfoUtils; import com.android.settingslib.DeviceInfoUtils; Loading Loading @@ -125,6 +126,8 @@ public class SimStatusDialogControllerTest { private static final String TEST_EID_FROM_CARD = "11111111111111111111111111111111"; private static final String TEST_EID_FROM_MANAGER = "22222222222222222222222222222222"; private static final int MAX_PHONE_COUNT_DUAL_SIM = 2; @Before public void setup() { MockitoAnnotations.initMocks(this); Loading Loading @@ -152,8 +155,7 @@ public class SimStatusDialogControllerTest { ReflectionHelpers.setField(mController, "mEuiccManager", mEuiccManager); ReflectionHelpers.setField(mController, "mSubscriptionManager", mSubscriptionManager); when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getUiccCardsInfo()).thenReturn(new ArrayList<UiccCardInfo>()); when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn( new HashMap<Integer, Integer>()); Loading Loading @@ -428,7 +430,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldNotSetEid() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -466,7 +468,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidFromCard() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -504,7 +506,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidFromManager() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -545,7 +547,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldRemoveEid() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -584,8 +586,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldNotSetEidInSingleSimMode() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -614,8 +615,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidInSingleSimModeWithEnabledEuicc() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -646,8 +646,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidInSingleSimModeWithDisabledEuicc() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -678,8 +677,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldRemoveEidInSingleSimMode() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading
src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java +4 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.telephony.PhoneConstants; import com.android.settings.R; import com.android.settingslib.DeviceInfoUtils; import com.android.settingslib.Utils; Loading Loading @@ -101,6 +100,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O @VisibleForTesting final static int IMS_REGISTRATION_STATE_VALUE_ID = R.id.ims_reg_state_value; @VisibleForTesting static final int MAX_PHONE_COUNT_SINGLE_SIM = 1; private final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = new OnSubscriptionsChangedListener() { @Override Loading Loading @@ -486,7 +488,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O boolean shouldHaveEid = false; String eid = null; if (mTelephonyManager.getPhoneCount() > PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM) { if (mTelephonyManager.getActiveModemCount() > MAX_PHONE_COUNT_SINGLE_SIM) { // Get EID per-SIM in multi-SIM mode Map<Integer, Integer> mapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); int pSlotId = mapping.getOrDefault(mSlotIndex, Loading
tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java +13 −15 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.MAX_PHONE_COUNT_SINGLE_SIM; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.NETWORK_PROVIDER_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.OPERATOR_INFO_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.OPERATOR_INFO_VALUE_ID; Loading @@ -33,6 +34,7 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_VALUE_ID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -61,7 +63,6 @@ import android.telephony.euicc.EuiccManager; import androidx.lifecycle.LifecycleOwner; import com.android.internal.telephony.PhoneConstants; import com.android.settings.R; import com.android.settings.testutils.shadow.ShadowDeviceInfoUtils; import com.android.settingslib.DeviceInfoUtils; Loading Loading @@ -125,6 +126,8 @@ public class SimStatusDialogControllerTest { private static final String TEST_EID_FROM_CARD = "11111111111111111111111111111111"; private static final String TEST_EID_FROM_MANAGER = "22222222222222222222222222222222"; private static final int MAX_PHONE_COUNT_DUAL_SIM = 2; @Before public void setup() { MockitoAnnotations.initMocks(this); Loading Loading @@ -152,8 +155,7 @@ public class SimStatusDialogControllerTest { ReflectionHelpers.setField(mController, "mEuiccManager", mEuiccManager); ReflectionHelpers.setField(mController, "mSubscriptionManager", mSubscriptionManager); when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getUiccCardsInfo()).thenReturn(new ArrayList<UiccCardInfo>()); when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn( new HashMap<Integer, Integer>()); Loading Loading @@ -428,7 +430,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldNotSetEid() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -466,7 +468,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidFromCard() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -504,7 +506,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidFromManager() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -545,7 +547,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldRemoveEid() { when(mTelephonyManager.getPhoneCount()).thenReturn(PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo1 = new UiccCardInfo( Loading Loading @@ -584,8 +586,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldNotSetEidInSingleSimMode() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -614,8 +615,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidInSingleSimModeWithEnabledEuicc() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -646,8 +646,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldSetEidInSingleSimModeWithDisabledEuicc() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading Loading @@ -678,8 +677,7 @@ public class SimStatusDialogControllerTest { @Test public void initialize_updateEid_shouldRemoveEidInSingleSimMode() { when(mTelephonyManager.getPhoneCount()).thenReturn( PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM); when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM); ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>(); UiccCardInfo uiccCardInfo = new UiccCardInfo( Loading