Remove reference to PhoneConstant.
Create static constant in SimStatusDialogController.
Test: make
Test: m RunSettingsRoboTests
Change-Id: I2e1b9ac5b9ab051876f1bb26866d055f822bac90
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index 26d8e2b..8096c0b 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -43,7 +43,6 @@
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 @@
@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 @@
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,
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
index 88acbd0..851dfe0 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -24,6 +24,7 @@
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.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 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 @@
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 @@
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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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(