Merge "[Telephony Setting] Add supplementary conditions for CDMA display IMEI info when subscriptionInfo is null" into qt-qpr1-dev
This commit is contained in:
@@ -119,7 +119,8 @@ public class ImeiInfoDialogController {
|
|||||||
|
|
||||||
mDialog.setText(ID_PRL_VERSION_VALUE, getCdmaPrlVersion());
|
mDialog.setText(ID_PRL_VERSION_VALUE, getCdmaPrlVersion());
|
||||||
|
|
||||||
if (mSubscriptionInfo != null && isCdmaLteEnabled()) {
|
if ((mSubscriptionInfo != null && isCdmaLteEnabled()) ||
|
||||||
|
(mSubscriptionInfo == null && isSimPresent(mSlotId))) {
|
||||||
// Show IMEI for LTE device
|
// Show IMEI for LTE device
|
||||||
mDialog.setText(ID_IMEI_VALUE,
|
mDialog.setText(ID_IMEI_VALUE,
|
||||||
getTextAsDigits(mTelephonyManager.getImei(mSlotId)));
|
getTextAsDigits(mTelephonyManager.getImei(mSlotId)));
|
||||||
@@ -151,6 +152,15 @@ public class ImeiInfoDialogController {
|
|||||||
== PhoneConstants.LTE_ON_CDMA_TRUE;
|
== PhoneConstants.LTE_ON_CDMA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isSimPresent(int slotId) {
|
||||||
|
final int simState = mTelephonyManager.getSimState(slotId);
|
||||||
|
if ((simState != TelephonyManager.SIM_STATE_ABSENT) &&
|
||||||
|
(simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
String getMeid() {
|
String getMeid() {
|
||||||
return mTelephonyManager.getMeid(mSlotId);
|
return mTelephonyManager.getMeid(mSlotId);
|
||||||
|
@@ -142,6 +142,37 @@ public class ImeiInfoDialogControllerTest {
|
|||||||
verify(mDialog).removeViewFromScreen(ID_GSM_SETTINGS);
|
verify(mDialog).removeViewFromScreen(ID_GSM_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void populateImeiInfo_cdmaSimPresent_shouldSetImeiInfoAndSetAllCdmaSetting() {
|
||||||
|
ReflectionHelpers.setField(mController, "mSubscriptionInfo", null);
|
||||||
|
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
|
||||||
|
when(mTelephonyManager.getSimState(anyInt())).thenReturn(
|
||||||
|
TelephonyManager.SIM_STATE_PRESENT);
|
||||||
|
|
||||||
|
mController.populateImeiInfo();
|
||||||
|
|
||||||
|
verify(mDialog).setText(ID_MEID_NUMBER_VALUE, MEID_NUMBER);
|
||||||
|
verify(mDialog).setText(ID_MIN_NUMBER_VALUE, "");
|
||||||
|
verify(mDialog).setText(ID_PRL_VERSION_VALUE, "");
|
||||||
|
verify(mDialog).setText(eq(ID_IMEI_VALUE), any());
|
||||||
|
verify(mDialog).setText(eq(ID_IMEI_SV_VALUE), any());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void populateImeiInfo_cdmaSimABSENT_shouldSetImeiInfoAndSetAllCdmaSetting() {
|
||||||
|
ReflectionHelpers.setField(mController, "mSubscriptionInfo", null);
|
||||||
|
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
|
||||||
|
when(mTelephonyManager.getSimState(anyInt())).thenReturn(TelephonyManager.SIM_STATE_ABSENT);
|
||||||
|
|
||||||
|
mController.populateImeiInfo();
|
||||||
|
|
||||||
|
verify(mDialog).setText(ID_MEID_NUMBER_VALUE, MEID_NUMBER);
|
||||||
|
verify(mDialog).setText(ID_MIN_NUMBER_VALUE, "");
|
||||||
|
verify(mDialog).setText(ID_PRL_VERSION_VALUE, "");
|
||||||
|
verify(mDialog).removeViewFromScreen(ID_GSM_SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateImeiInfo_gsmSimDisabled_shouldSetImeiAndRemoveCdmaSettings() {
|
public void populateImeiInfo_gsmSimDisabled_shouldSetImeiAndRemoveCdmaSettings() {
|
||||||
ReflectionHelpers.setField(mController, "mSubscriptionInfo", null);
|
ReflectionHelpers.setField(mController, "mSubscriptionInfo", null);
|
||||||
|
Reference in New Issue
Block a user