f49aa3395173275912e73aa5b5808081bceb690c
[android/platform/frameworks/opt/telephony.git] / tests / telephonytests / src / com / android / internal / telephony / SubscriptionInfoUpdaterTest.java
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.internal.telephony;
17
18 import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
19
20 import static org.mockito.Mockito.any;
21 import static org.mockito.Mockito.anyBoolean;
22 import static org.mockito.Mockito.anyInt;
23 import static org.mockito.Mockito.anyString;
24 import static org.mockito.Mockito.doAnswer;
25 import static org.mockito.Mockito.doReturn;
26 import static org.mockito.Mockito.eq;
27 import static org.mockito.Mockito.times;
28 import static org.mockito.Mockito.verify;
29
30 import android.content.ContentProvider;
31 import android.content.ContentValues;
32 import android.content.Context;
33 import android.content.Intent;
34 import android.content.pm.UserInfo;
35 import android.net.Uri;
36 import android.os.AsyncResult;
37 import android.os.HandlerThread;
38 import android.os.Message;
39 import android.telephony.CarrierConfigManager;
40 import android.telephony.SubscriptionInfo;
41 import android.telephony.SubscriptionManager;
42 import android.test.mock.MockContentProvider;
43 import android.test.mock.MockContentResolver;
44 import android.test.suitebuilder.annotation.SmallTest;
45
46 import com.android.internal.telephony.uicc.IccCardProxy;
47 import com.android.internal.telephony.uicc.IccFileHandler;
48 import com.android.internal.telephony.uicc.IccRecords;
49 import com.android.internal.telephony.uicc.IccUtils;
50
51 import org.junit.After;
52 import org.junit.Before;
53 import org.junit.Test;
54 import org.mockito.Mock;
55 import org.mockito.invocation.InvocationOnMock;
56 import org.mockito.stubbing.Answer;
57
58 import java.util.Arrays;
59 import java.util.HashMap;
60
61 public class SubscriptionInfoUpdaterTest extends TelephonyTest {
62
63     private static final int FAKE_SUB_ID_1 = 0;
64     private static final int FAKE_SUB_ID_2 = 1;
65     private static final String FAKE_MCC_MNC_1 = "123456";
66     private static final String FAKE_MCC_MNC_2 = "456789";
67
68     private SubscriptionInfoUpdaterHandlerThread mSubscriptionInfoUpdaterHandlerThread;
69     private IccRecords mIccRecord;
70     @Mock
71     private UserInfo mUserInfo;
72     @Mock
73     private SubscriptionInfo mSubInfo;
74     @Mock
75     private ContentProvider mContentProvider;
76     @Mock
77     private HashMap<String, Object> mSubscriptionContent;
78     @Mock
79     private IccFileHandler mIccFileHandler;
80
81     /*Custom ContentProvider */
82     private class FakeSubscriptionContentProvider extends MockContentProvider {
83         @Override
84         public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
85             for (String key : values.keySet()) {
86                 mSubscriptionContent.put(key, values.get(key));
87             }
88             return 1;
89         }
90     }
91
92     private class SubscriptionInfoUpdaterHandlerThread extends HandlerThread {
93
94         private SubscriptionInfoUpdaterHandlerThread(String name) {
95             super(name);
96         }
97
98         @Override
99         public void onLooperPrepared() {
100             new SubscriptionInfoUpdater(mContext, new Phone[]{mPhone},
101                     new CommandsInterface[]{mSimulatedCommands});
102             setReady(true);
103         }
104     }
105
106     @Before
107     public void setUp() throws Exception {
108         super.setUp(this.getClass().getSimpleName());
109
110         replaceInstance(SubscriptionInfoUpdater.class, "mIccId", null, new String[1]);
111         replaceInstance(SubscriptionInfoUpdater.class, "mInsertSimState", null, new int[1]);
112         replaceInstance(SubscriptionInfoUpdater.class, "mContext", null, null);
113         replaceInstance(SubscriptionInfoUpdater.class, "PROJECT_SIM_NUM", null, 1);
114
115         doReturn(1).when(mTelephonyManager).getSimCount();
116         doReturn(1).when(mTelephonyManager).getPhoneCount();
117
118         doReturn(mUserInfo).when(mIActivityManager).getCurrentUser();
119         doReturn(new int[]{FAKE_SUB_ID_1}).when(mSubscriptionController).getSubId(0);
120         doReturn(new int[]{FAKE_SUB_ID_1}).when(mSubscriptionManager).getActiveSubscriptionIdList();
121         mContentProvider = new FakeSubscriptionContentProvider();
122         ((MockContentResolver) mContext.getContentResolver()).addProvider(
123                 SubscriptionManager.CONTENT_URI.getAuthority(),
124                 mContentProvider);
125         mIccRecord = mIccCardProxy.getIccRecords();
126
127         mSubscriptionInfoUpdaterHandlerThread = new SubscriptionInfoUpdaterHandlerThread(TAG);
128         mSubscriptionInfoUpdaterHandlerThread.start();
129         waitUntilReady();
130     }
131
132     @After
133     public void tearDown() throws Exception {
134         mSubscriptionInfoUpdaterHandlerThread.quitSafely();
135         super.tearDown();
136     }
137
138     @Test
139     @SmallTest
140     public void testSimAbsent() throws Exception {
141         doReturn(Arrays.asList(mSubInfo)).when(mSubscriptionController)
142                 .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString());
143         Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
144         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
145                 IccCardConstants.INTENT_VALUE_ICC_ABSENT);
146         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
147
148         mContext.sendBroadcast(mIntent);
149
150         waitForMs(100);
151         verify(mSubscriptionContent).put(eq(SubscriptionManager.SIM_SLOT_INDEX),
152                 eq(SubscriptionManager.INVALID_SIM_SLOT_INDEX));
153
154         CarrierConfigManager mConfigManager = (CarrierConfigManager)
155                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
156         verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
157                 eq(IccCardConstants.INTENT_VALUE_ICC_ABSENT));
158         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
159     }
160
161     @Test
162     @SmallTest
163     public void testSimUnknown() throws Exception {
164         Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
165         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
166                 IccCardConstants.INTENT_VALUE_ICC_UNKNOWN);
167         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
168
169         mContext.sendBroadcast(mIntent);
170
171         waitForMs(100);
172         verify(mSubscriptionContent, times(0)).put(anyString(), any());
173         CarrierConfigManager mConfigManager = (CarrierConfigManager)
174                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
175         verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
176                 eq(IccCardConstants.INTENT_VALUE_ICC_UNKNOWN));
177         verify(mSubscriptionController, times(0)).notifySubscriptionInfoChanged();
178     }
179
180     @Test
181     @SmallTest
182     public void testSimError() throws Exception {
183         Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
184         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
185                 IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR);
186         mIntent.putExtra(PhoneConstants.PHONE_KEY, 0);
187
188         mContext.sendBroadcast(mIntent);
189         waitForMs(100);
190         verify(mSubscriptionContent, times(0)).put(anyString(), any());
191         CarrierConfigManager mConfigManager = (CarrierConfigManager)
192                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
193         verify(mConfigManager).updateConfigForPhoneId(eq(0),
194                 eq(IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR));
195         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
196     }
197
198     @Test
199     @SmallTest
200     public void testWrongSimState() throws Exception {
201         Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
202         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
203                 IccCardConstants.INTENT_VALUE_ICC_IMSI);
204         mIntent.putExtra(PhoneConstants.PHONE_KEY, 2);
205
206         mContext.sendBroadcast(mIntent);
207         waitForMs(100);
208         verify(mSubscriptionContent, times(0)).put(anyString(), any());
209         CarrierConfigManager mConfigManager = (CarrierConfigManager)
210                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
211         verify(mConfigManager, times(0)).updateConfigForPhoneId(eq(2),
212                 eq(IccCardConstants.INTENT_VALUE_ICC_IMSI));
213         verify(mSubscriptionController, times(0)).notifySubscriptionInfoChanged();
214     }
215
216     @Test
217     @SmallTest
218     public void testSimLoaded() throws Exception {
219         /* mock new sim got loaded and there is no sim loaded before */
220         doReturn(null).when(mSubscriptionController)
221                 .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString());
222         doReturn("89012604200000000000").when(mIccRecord).getIccId();
223         doReturn(FAKE_MCC_MNC_1).when(mTelephonyManager).getSimOperatorNumeric(FAKE_SUB_ID_1);
224         Intent intentInternalSimStateChanged =
225                 new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
226         intentInternalSimStateChanged.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
227                 IccCardConstants.INTENT_VALUE_ICC_LOADED);
228         intentInternalSimStateChanged.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
229
230         mContext.sendBroadcast(intentInternalSimStateChanged);
231         waitForMs(100);
232
233         // verify SIM_STATE_CHANGED broadcast. It should be broadcast twice, once for
234         // READ_PHONE_STATE and once for READ_PRIVILEGED_PHONE_STATE
235         /* todo: cannot verify as intent is sent using ActivityManagerNative.broadcastStickyIntent()
236          * uncomment code below when that is fixed
237          */
238         /* ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
239         ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
240         verify(mContext, times(2)).sendBroadcast(intentArgumentCaptor.capture(),
241                 stringArgumentCaptor.capture());
242         assertEquals(TelephonyIntents.ACTION_SIM_STATE_CHANGED,
243                 intentArgumentCaptor.getAllValues().get(0).getAction());
244         assertEquals(Manifest.permission.READ_PHONE_STATE,
245                 stringArgumentCaptor.getAllValues().get(0));
246         assertEquals(TelephonyIntents.ACTION_SIM_STATE_CHANGED,
247                 intentArgumentCaptor.getAllValues().get(1).getAction());
248         assertEquals(Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
249                 stringArgumentCaptor.getAllValues().get(1)); */
250
251         SubscriptionManager mSubscriptionManager = SubscriptionManager.from(mContext);
252         verify(mTelephonyManager).getSimOperatorNumeric(FAKE_SUB_ID_1);
253         verify(mSubscriptionManager, times(1)).addSubscriptionInfoRecord(
254                 eq("89012604200000000000"), eq(FAKE_SUB_ID_1));
255         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
256         verify(mSubscriptionController, times(1)).setMccMnc(FAKE_MCC_MNC_1, FAKE_SUB_ID_1);
257         CarrierConfigManager mConfigManager = (CarrierConfigManager)
258                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
259         verify(mConfigManager, times(1)).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
260                 eq(IccCardConstants.INTENT_VALUE_ICC_LOADED));
261
262         // ACTION_USER_UNLOCKED should trigger another SIM_STATE_CHANGED
263         Intent intentSimStateChanged = new Intent(Intent.ACTION_USER_UNLOCKED);
264         mContext.sendBroadcast(intentSimStateChanged);
265         waitForMs(100);
266
267         // verify SIM_STATE_CHANGED broadcast
268         /* todo: cannot verify as intent is sent using ActivityManagerNative.broadcastStickyIntent()
269          * uncomment code below when that is fixed
270          */
271         /* verify(mContext, times(4)).sendBroadcast(intentArgumentCaptor.capture(),
272                 stringArgumentCaptor.capture());
273         assertEquals(TelephonyIntents.ACTION_SIM_STATE_CHANGED,
274                 intentArgumentCaptor.getAllValues().get(2).getAction());
275         assertEquals(Manifest.permission.READ_PHONE_STATE,
276                 stringArgumentCaptor.getAllValues().get(2));
277         assertEquals(TelephonyIntents.ACTION_SIM_STATE_CHANGED,
278                 intentArgumentCaptor.getAllValues().get(3).getAction());
279         assertEquals(Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
280                 stringArgumentCaptor.getAllValues().get(3)); */
281     }
282
283     @Test
284     @SmallTest
285     public void testSimLoadedEmptyOperatorNumeric() throws Exception {
286         /* mock new sim got loaded and there is no sim loaded before */
287         doReturn(null).when(mSubscriptionController)
288                 .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString());
289         doReturn("89012604200000000000").when(mIccRecord).getIccId();
290         // operator numeric is empty
291         doReturn("").when(mTelephonyManager).getSimOperatorNumeric(FAKE_SUB_ID_1);
292         Intent mIntent = new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
293         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
294                 IccCardConstants.INTENT_VALUE_ICC_LOADED);
295         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
296
297         mContext.sendBroadcast(mIntent);
298         waitForMs(100);
299         SubscriptionManager mSubscriptionManager = SubscriptionManager.from(mContext);
300         verify(mTelephonyManager).getSimOperatorNumeric(FAKE_SUB_ID_1);
301         verify(mSubscriptionManager, times(1)).addSubscriptionInfoRecord(
302                 eq("89012604200000000000"), eq(FAKE_SUB_ID_1));
303         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
304         verify(mSubscriptionController, times(0)).setMccMnc(anyString(), anyInt());
305         CarrierConfigManager mConfigManager = (CarrierConfigManager)
306                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
307         verify(mConfigManager, times(1)).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
308                 eq(IccCardConstants.INTENT_VALUE_ICC_LOADED));
309     }
310
311     @Test
312     @SmallTest
313     public void testSimLockedWithOutIccId() throws Exception {
314         /* mock no IccId Info present and try to query IccId
315          after IccId query, update subscriptionDB */
316         doReturn(mIccFileHandler).when(mIccCardProxy).getIccFileHandler();
317         doAnswer(new Answer<Void>() {
318             @Override
319             public Void answer(InvocationOnMock invocation) throws Throwable {
320                 Message msg = (Message) invocation.getArguments()[1];
321                 AsyncResult.forMessage(msg).result = IccUtils
322                         .hexStringToBytes("89012604200000000000");
323                 msg.sendToTarget();
324                 return null;
325             }
326         }).when(mIccFileHandler).loadEFTransparent(anyInt(), any(Message.class));
327
328         doReturn(Arrays.asList(mSubInfo)).when(mSubscriptionController)
329                 .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString());
330
331         Intent mIntent = new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
332         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
333                 IccCardConstants.INTENT_VALUE_ICC_LOCKED);
334         mIntent.putExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON, "TESTING");
335         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
336
337         mContext.sendBroadcast(mIntent);
338         waitForMs(100);
339
340         /* old IccId != new queried IccId */
341         verify(mSubscriptionContent).put(eq(SubscriptionManager.SIM_SLOT_INDEX),
342                 eq(SubscriptionManager.INVALID_SIM_SLOT_INDEX));
343         SubscriptionManager mSubscriptionManager = SubscriptionManager.from(mContext);
344         verify(mSubscriptionManager, times(1)).addSubscriptionInfoRecord(
345                 eq("98106240020000000000"), eq(FAKE_SUB_ID_1));
346
347         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
348         CarrierConfigManager mConfigManager = (CarrierConfigManager)
349                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
350         verify(mConfigManager, times(1)).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
351                 eq(IccCardConstants.INTENT_VALUE_ICC_LOCKED));
352     }
353
354     @Test
355     @SmallTest
356     public void testDualSimLoaded() throws Exception {
357         // Mock there is two sim cards
358
359         replaceInstance(SubscriptionInfoUpdater.class, "mIccId", null,
360                 new String[]{null, null});
361         replaceInstance(SubscriptionInfoUpdater.class, "PROJECT_SIM_NUM", null, 2);
362         replaceInstance(SubscriptionInfoUpdater.class, "mPhone", null,
363                 new Phone[]{mPhone, mPhone});
364         replaceInstance(SubscriptionInfoUpdater.class, "mInsertSimState", null,
365                 new int[]{SubscriptionInfoUpdater.SIM_NOT_CHANGE,
366                         SubscriptionInfoUpdater.SIM_NOT_CHANGE});
367
368         doReturn(new int[]{FAKE_SUB_ID_1, FAKE_SUB_ID_2}).when(mSubscriptionManager)
369                 .getActiveSubscriptionIdList();
370         doReturn(FAKE_SUB_ID_1).when(mSubscriptionController).getPhoneId(eq(FAKE_SUB_ID_1));
371         doReturn(FAKE_SUB_ID_2).when(mSubscriptionController).getPhoneId(eq(FAKE_SUB_ID_2));
372         doReturn(2).when(mTelephonyManager).getSimCount();
373         doReturn(FAKE_MCC_MNC_1).when(mTelephonyManager).getSimOperatorNumeric(eq(FAKE_SUB_ID_1));
374         doReturn(FAKE_MCC_MNC_2).when(mTelephonyManager).getSimOperatorNumeric(eq(FAKE_SUB_ID_2));
375         // Mock there is no sim inserted before
376         doReturn(null).when(mSubscriptionController)
377                 .getSubInfoUsingSlotIndexWithCheck(anyInt(), anyBoolean(), anyString());
378         doReturn("89012604200000000000").when(mIccRecord).getIccId();
379
380         // Mock sending a sim loaded for SIM 1
381         Intent mIntent = new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
382         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
383                 IccCardConstants.INTENT_VALUE_ICC_LOADED);
384         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
385         mContext.sendBroadcast(mIntent);
386         waitForMs(100);
387
388         SubscriptionManager mSubscriptionManager = SubscriptionManager.from(mContext);
389         verify(mSubscriptionManager, times(0)).addSubscriptionInfoRecord(anyString(), anyInt());
390         verify(mSubscriptionController, times(0)).notifySubscriptionInfoChanged();
391         verify(mSubscriptionController, times(0)).setMccMnc(anyString(), anyInt());
392
393         // Mock sending a sim loaded for SIM 2
394         doReturn("89012604200000000001").when(mIccRecord).getIccId();
395         mIntent = new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
396         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
397                 IccCardConstants.INTENT_VALUE_ICC_LOADED);
398         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_2);
399         mContext.sendBroadcast(mIntent);
400         waitForMs(100);
401
402         verify(mSubscriptionManager, times(1)).addSubscriptionInfoRecord(eq("89012604200000000000"),
403                 eq(FAKE_SUB_ID_1));
404         verify(mSubscriptionManager, times(1)).addSubscriptionInfoRecord(eq("89012604200000000001"),
405                 eq(FAKE_SUB_ID_2));
406         verify(mSubscriptionController, times(1)).setMccMnc(eq(FAKE_MCC_MNC_1), eq(FAKE_SUB_ID_1));
407         verify(mSubscriptionController, times(1)).setMccMnc(eq(FAKE_MCC_MNC_2), eq(FAKE_SUB_ID_2));
408         verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
409     }
410
411     @Test
412     @SmallTest
413     public void testSimLockWIthIccId() throws Exception {
414         /* no need for IccId query */
415
416         replaceInstance(SubscriptionInfoUpdater.class, "mIccId", null,
417                 new String[]{"89012604200000000000"});
418         doReturn(mIccFileHandler).when(mIccCardProxy).getIccFileHandler();
419
420         Intent mIntent = new Intent(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
421         mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
422                 IccCardConstants.INTENT_VALUE_ICC_LOCKED);
423         mIntent.putExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON, "TESTING");
424         mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);
425
426         mContext.sendBroadcast(mIntent);
427         waitForMs(100);
428
429         verify(mIccFileHandler, times(0)).loadEFTransparent(anyInt(), any(Message.class));
430         SubscriptionManager mSubscriptionManager = SubscriptionManager.from(mContext);
431         verify(mSubscriptionManager, times(0)).addSubscriptionInfoRecord(
432                 anyString(), eq(FAKE_SUB_ID_1));
433         verify(mSubscriptionController, times(0)).notifySubscriptionInfoChanged();
434         CarrierConfigManager mConfigManager = (CarrierConfigManager)
435                 mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
436         /* broadcast is done */
437         verify(mConfigManager, times(1)).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
438                 eq(IccCardConstants.INTENT_VALUE_ICC_LOCKED));
439     }
440
441 }