Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72e5cecd authored by tom hsu's avatar tom hsu Committed by Tom Hsu
Browse files

Remove reference to PhoneConstant.

Create static constant in SimStatusDialogController.

Test: make
Test: m RunSettingsRoboTests
Change-Id: I2e1b9ac5b9ab051876f1bb26866d055f822bac90
parent d53cbefc
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.text.TextUtils;
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;
@@ -94,6 +93,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 static String CB_AREA_INFO_RECEIVED_ACTION =
            "com.android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
    private final static String GET_LATEST_CB_AREA_INFO_ACTION =
@@ -411,7 +413,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,
+13 −15
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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;
@@ -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);
@@ -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>());
@@ -429,7 +431,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -468,7 +470,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -507,7 +509,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -549,7 +551,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -589,8 +591,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -620,8 +621,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -653,8 +653,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(
@@ -686,8 +685,7 @@ public class SimStatusDialogControllerTest {
    @Test
    @Ignore
    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(