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

Commit cad68b3c authored by Jeffrey Huang's avatar Jeffrey Huang Committed by Android (Google) Code Review
Browse files

Merge "Display IMEI info when sim is removed"

parents d42f19e0 c8badc7c
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -80,9 +80,6 @@ public class ImeiInfoDialogController {
     * Sets IMEI/MEID information based on whether the device is CDMA or GSM.
     */
    public void populateImeiInfo() {
        if (mSubscriptionInfo == null) {
            return;
        }
        if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
            updateDialogForCdmaPhone();
        } else {
@@ -94,7 +91,8 @@ public class ImeiInfoDialogController {
        final Resources res = mDialog.getContext().getResources();
        mDialog.setText(ID_MEID_NUMBER_VALUE, getMeid());
        mDialog.setText(ID_MIN_NUMBER_VALUE,
                mTelephonyManager.getCdmaMin(mSubscriptionInfo.getSubscriptionId()));
                mSubscriptionInfo != null ? mTelephonyManager.getCdmaMin(
                        mSubscriptionInfo.getSubscriptionId()) : "");

        if (res.getBoolean(R.bool.config_msid_enable)) {
            mDialog.setText(ID_MIN_NUMBER_LABEL,
@@ -103,7 +101,7 @@ public class ImeiInfoDialogController {

        mDialog.setText(ID_PRL_VERSION_VALUE, getCdmaPrlVersion());

        if (isCdmaLteEnabled()) {
        if (mSubscriptionInfo != null && isCdmaLteEnabled()) {
            // Show IMEI for LTE device
            mDialog.setText(ID_IMEI_VALUE,
                    getTextAsDigits(mTelephonyManager.getImei(mSlotId)));
+11 −0
Original line number Diff line number Diff line
@@ -111,6 +111,17 @@ public class ImeiInfoDialogControllerTest {
        verify(mDialog).removeViewFromScreen(ID_GSM_SETTINGS);
    }

    @Test
    public void populateImeiInfo_cdmaSimDisabled_shouldRemoveImeiInfoAndSetMinToEmpty() {
        ReflectionHelpers.setField(mController, "mSubscriptionInfo", null);
        when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);

        mController.populateImeiInfo();

        verify(mDialog).setText(ID_MIN_NUMBER_VALUE, "");
        verify(mDialog).removeViewFromScreen(ID_GSM_SETTINGS);
    }

    @Test
    public void populateImeinfo_gsm_shouldSetImeiAndRemoveCdmaSettings() {
        when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_GSM);