diff options
author | Xiangyu/Malcolm Chen <refuhoo@google.com> | 2020-05-12 19:05:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-12 19:05:37 +0000 |
commit | fc8f8994136c7180572bbfb25ecff3bdd789973e (patch) | |
tree | 2930db87937f5794286867e62a19ab61491b15bf /tests/telephonytests | |
parent | d5c796f75c629e248acb403251cdbec1760d1fd9 (diff) | |
parent | cdd84b30622df5bdf5e9589e2edc846d44e9dd5a (diff) | |
download | telephony-fc8f8994136c7180572bbfb25ecff3bdd789973e.tar.gz |
Merge "Fix bug that disabled pSIM stays inactive after unplugging." into rvc-dev
Diffstat (limited to 'tests/telephonytests')
-rw-r--r-- | tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java index 6786e7c2c4..ce5be8e50d 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java @@ -15,7 +15,7 @@ */ package com.android.internal.telephony; -import static android.telephony.SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID; +import static android.telephony.SubscriptionManager.UICC_APPLICATIONS_ENABLED; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -192,12 +192,6 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), eq(IccCardConstants.INTENT_VALUE_ICC_ABSENT)); verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged(); - ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); - verify(mContentProvider).update(any(), valueCapture.capture(), - eq(UNIQUE_KEY_SUBSCRIPTION_ID + " IN (" + FAKE_SUB_ID_1 + ")"), any()); - boolean uiccApplicationsEnabled = valueCapture.getValue() - .getAsBoolean(SubscriptionManager.UICC_APPLICATIONS_ENABLED); - assertTrue(uiccApplicationsEnabled); } @Test @@ -282,6 +276,44 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest { @Test @SmallTest + public void testSimNotReadyDisabledUiccApps() throws Exception { + String iccId = "123456"; + doReturn(mIccCard).when(mPhone).getIccCard(); + doReturn(false).when(mIccCard).isEmptyProfile(); + doReturn(iccId).when(mUiccSlot).getIccId(); + doReturn(mSubInfo).when(mSubscriptionController).getSubInfoForIccId(iccId); + doReturn(false).when(mSubInfo).areUiccApplicationsEnabled(); + + mUpdater.updateInternalIccState( + IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null, FAKE_SUB_ID_1); + + processAllMessages(); + assertTrue(mUpdater.isSubInfoInitialized()); + // Sub info should be cleared and change should be notified. + verify(mSubscriptionController).clearSubInfoRecord(eq(FAKE_SUB_ID_1)); + verify(mSubscriptionController).notifySubscriptionInfoChanged(); + // No new sub should be added. + verify(mSubscriptionManager, never()).addSubscriptionInfoRecord(any(), anyInt()); + verify(mSubscriptionContent, never()).put(anyString(), any()); + CarrierConfigManager mConfigManager = (CarrierConfigManager) + mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); + verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1), + eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY)); + + // When becomes ABSENT, UICC_APPLICATIONS_ENABLED should be reset to true. + mUpdater.updateInternalIccState( + IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, FAKE_SUB_ID_1); + processAllMessages(); + ArgumentCaptor<ContentValues> valueCapture = ArgumentCaptor.forClass(ContentValues.class); + verify(mContentProvider).update(eq(SubscriptionManager.CONTENT_URI), valueCapture.capture(), + eq(SubscriptionManager.ICC_ID + "=\'" + iccId + "\'"), eq(null)); + ContentValues contentValues = valueCapture.getValue(); + assertTrue(contentValues != null && contentValues.getAsBoolean( + UICC_APPLICATIONS_ENABLED)); + } + + @Test + @SmallTest public void testSimError() throws Exception { mUpdater.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR, null, FAKE_SUB_ID_1); |