Remove reference to PhoneConstant.
Create static constant in SimStatusDialogController. Test: make Test: m RunSettingsRoboTests Change-Id: I2e1b9ac5b9ab051876f1bb26866d055f822bac90 Merged-In: I2e1b9ac5b9ab051876f1bb26866d055f822bac90
This commit is contained in:
@@ -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;
|
||||
@@ -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
|
||||
@@ -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,
|
||||
|
@@ -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>());
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
@@ -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(
|
||||
|
Reference in New Issue
Block a user