blob: ffe3ece52e45859623d33b7bc41168e81127bcca [file] [log] [blame]
Lucas Dupin5e0f0d22018-02-26 13:32:16 -08001/*
2 * Copyright (C) 2018 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
17package com.android.keyguard;
18
Bill Linef81cbd2018-07-05 17:48:49 +080019import static com.google.common.truth.Truth.assertThat;
20
Lucas Dupin3d053532019-01-29 12:35:22 -080021import static org.mockito.ArgumentMatchers.any;
22import static org.mockito.ArgumentMatchers.anyInt;
23import static org.mockito.ArgumentMatchers.anyString;
24import static org.mockito.Mockito.doAnswer;
25import static org.mockito.Mockito.never;
26import static org.mockito.Mockito.reset;
27import static org.mockito.Mockito.spy;
28import static org.mockito.Mockito.verify;
29import static org.mockito.Mockito.when;
Bill Linef81cbd2018-07-05 17:48:49 +080030
Lucas Dupin3d053532019-01-29 12:35:22 -080031import android.app.admin.DevicePolicyManager;
32import android.app.trust.TrustManager;
Lucas Dupin7ff82b02018-05-16 12:14:10 -070033import android.content.Context;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080034import android.content.Intent;
Lucas Dupin3d053532019-01-29 12:35:22 -080035import android.content.pm.PackageManager;
36import android.hardware.biometrics.BiometricManager;
37import android.hardware.biometrics.BiometricSourceType;
38import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
39import android.hardware.face.FaceManager;
40import android.hardware.fingerprint.FingerprintManager;
Bill Linef81cbd2018-07-05 17:48:49 +080041import android.os.Bundle;
Lucas Dupin3d053532019-01-29 12:35:22 -080042import android.os.UserManager;
Bill Linef81cbd2018-07-05 17:48:49 +080043import android.telephony.ServiceState;
44import android.telephony.SubscriptionManager;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080045import android.test.suitebuilder.annotation.SmallTest;
46import android.testing.AndroidTestingRunner;
Lucas Dupin3d053532019-01-29 12:35:22 -080047import android.testing.TestableContext;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080048import android.testing.TestableLooper;
49import android.testing.TestableLooper.RunWithLooper;
50
51import com.android.internal.telephony.IccCardConstants;
Bill Linef81cbd2018-07-05 17:48:49 +080052import com.android.internal.telephony.PhoneConstants;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080053import com.android.internal.telephony.TelephonyIntents;
54import com.android.systemui.SysuiTestCase;
55
56import org.junit.Assert;
57import org.junit.Before;
58import org.junit.Test;
59import org.junit.runner.RunWith;
Lucas Dupin3d053532019-01-29 12:35:22 -080060import org.mockito.Mock;
61import org.mockito.MockitoAnnotations;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080062
63import java.util.concurrent.atomic.AtomicBoolean;
64
65@SmallTest
66@RunWith(AndroidTestingRunner.class)
Lucas Dupin7ff82b02018-05-16 12:14:10 -070067// We must run on the main looper because KeyguardUpdateMonitor#mHandler is initialized with
68// new Handler(Looper.getMainLooper()).
69//
70// Using the main looper should be avoided whenever possible, please don't copy this over to
71// new tests.
72@RunWithLooper(setAsMainLooper = true)
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080073public class KeyguardUpdateMonitorTest extends SysuiTestCase {
74
Lucas Dupin3d053532019-01-29 12:35:22 -080075 @Mock
76 private KeyguardUpdateMonitor.StrongAuthTracker mStrongAuthTracker;
77 @Mock
78 private TrustManager mTrustManager;
79 @Mock
80 private FingerprintManager mFingerprintManager;
81 @Mock
82 private FaceManager mFaceManager;
83 @Mock
84 private BiometricManager mBiometricManager;
85 @Mock
86 private PackageManager mPackageManager;
87 @Mock
88 private UserManager mUserManager;
89 @Mock
90 private DevicePolicyManager mDevicePolicyManager;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080091 private TestableLooper mTestableLooper;
Lucas Dupin3d053532019-01-29 12:35:22 -080092 private TestableKeyguardUpdateMonitor mKeyguardUpdateMonitor;
Lucas Dupin5e0f0d22018-02-26 13:32:16 -080093
94 @Before
95 public void setup() {
Lucas Dupin3d053532019-01-29 12:35:22 -080096 MockitoAnnotations.initMocks(this);
97 TestableContext context = spy(mContext);
98 when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
99 when(context.getPackageManager()).thenReturn(mPackageManager);
100 doAnswer(invocation -> {
101 IBiometricEnabledOnKeyguardCallback callback = invocation.getArgument(0);
102 callback.onChanged(BiometricSourceType.FACE, true /* enabled */);
103 return null;
104 }).when(mBiometricManager).registerEnabledOnKeyguardCallback(any());
105 when(mFaceManager.isHardwareDetected()).thenReturn(true);
106 when(mFaceManager.hasEnrolledTemplates()).thenReturn(true);
107 when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
108 when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
Kevin Chynfdfd2d32019-03-01 14:52:15 -0800109 when(mUserManager.isPrimaryUser()).thenReturn(true);
Lucas Dupin3d053532019-01-29 12:35:22 -0800110 when(mStrongAuthTracker.isUnlockingWithBiometricAllowed()).thenReturn(true);
111 context.addMockSystemService(TrustManager.class, mTrustManager);
112 context.addMockSystemService(FingerprintManager.class, mFingerprintManager);
113 context.addMockSystemService(BiometricManager.class, mBiometricManager);
114 context.addMockSystemService(FaceManager.class, mFaceManager);
115 context.addMockSystemService(UserManager.class, mUserManager);
116 context.addMockSystemService(DevicePolicyManager.class, mDevicePolicyManager);
117
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800118 mTestableLooper = TestableLooper.get(this);
Lucas Dupin3d053532019-01-29 12:35:22 -0800119 mKeyguardUpdateMonitor = new TestableKeyguardUpdateMonitor(context);
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800120 }
121
122 @Test
123 public void testIgnoresSimStateCallback_rebroadcast() {
124 Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
125
Lucas Dupin3d053532019-01-29 12:35:22 -0800126 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), intent);
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800127 mTestableLooper.processAllMessages();
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700128 Assert.assertTrue("onSimStateChanged not called",
Lucas Dupin3d053532019-01-29 12:35:22 -0800129 mKeyguardUpdateMonitor.hasSimStateJustChanged());
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800130
131 intent.putExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, true);
Lucas Dupin3d053532019-01-29 12:35:22 -0800132 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), intent);
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800133 mTestableLooper.processAllMessages();
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700134 Assert.assertFalse("onSimStateChanged should have been skipped",
Lucas Dupin3d053532019-01-29 12:35:22 -0800135 mKeyguardUpdateMonitor.hasSimStateJustChanged());
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700136 }
137
Bill Linef81cbd2018-07-05 17:48:49 +0800138 @Test
139 public void testTelephonyCapable_BootInitState() {
Lucas Dupin3d053532019-01-29 12:35:22 -0800140 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800141 }
142
143 @Test
144 public void testTelephonyCapable_SimState_Absent() {
145 Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
146 intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
147 , IccCardConstants.INTENT_VALUE_ICC_ABSENT);
Lucas Dupin3d053532019-01-29 12:35:22 -0800148 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800149 , putPhoneInfo(intent,null, false));
150 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800151 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
Bill Linef81cbd2018-07-05 17:48:49 +0800152 }
153
154 @Test
155 public void testTelephonyCapable_SimInvalid_ServiceState_InService() {
156 // SERVICE_STATE - IN_SERVICE, but SIM_STATE is invalid TelephonyCapable should be False
Bill Linef81cbd2018-07-05 17:48:49 +0800157 Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
158 Bundle data = new Bundle();
159 ServiceState state = new ServiceState();
160 state.setState(ServiceState.STATE_IN_SERVICE);
161 state.fillInNotifierBundle(data);
Lucas Dupin3d053532019-01-29 12:35:22 -0800162 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800163 , putPhoneInfo(intent, data, false));
164 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800165 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800166 }
167
168 @Test
169 public void testTelephonyCapable_SimValid_ServiceState_PowerOff() {
170 // Simulate AirplaneMode case, SERVICE_STATE - POWER_OFF, check TelephonyCapable False
171 // Only receive ServiceState callback IN_SERVICE -> OUT_OF_SERVICE -> POWER_OFF
Bill Linef81cbd2018-07-05 17:48:49 +0800172 Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
173 intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
174 , IccCardConstants.INTENT_VALUE_ICC_LOADED);
175 Bundle data = new Bundle();
176 ServiceState state = new ServiceState();
177 state.setState(ServiceState.STATE_POWER_OFF);
178 state.fillInNotifierBundle(data);
Lucas Dupin3d053532019-01-29 12:35:22 -0800179 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800180 , putPhoneInfo(intent, data, true));
181 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800182 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
Bill Linef81cbd2018-07-05 17:48:49 +0800183 }
184
185 /* Normal SIM inserted flow
186 * ServiceState: ---OutOfServie----->PowerOff->OutOfServie--->InService
187 * SimState: ----NOT_READY---->READY----------------------LOADED>>>
188 * Subscription: --------null---->null--->"Chunghwa Telecom"-------->>>
189 * System: -------------------------------BOOT_COMPLETED------>>>
190 * TelephonyCapable:(F)-(F)-(F)-(F)-(F)-(F)-(F)-(F)-(F)-(F)------(T)-(T)>>
191 */
192 @Test
193 public void testTelephonyCapable_BootInitState_ServiceState_OutOfService() {
Bill Linef81cbd2018-07-05 17:48:49 +0800194 Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
195 Bundle data = new Bundle();
196 ServiceState state = new ServiceState();
197 state.setState(ServiceState.STATE_OUT_OF_SERVICE);
198 state.fillInNotifierBundle(data);
199 intent.putExtras(data);
Lucas Dupin3d053532019-01-29 12:35:22 -0800200 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800201 , putPhoneInfo(intent, data, false));
202 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800203 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800204 }
205
206 @Test
207 public void testTelephonyCapable_BootInitState_SimState_NotReady() {
Bill Linef81cbd2018-07-05 17:48:49 +0800208 Bundle data = new Bundle();
209 ServiceState state = new ServiceState();
210 state.setState(ServiceState.STATE_OUT_OF_SERVICE);
211 state.fillInNotifierBundle(data);
212 Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
213 intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
214 , IccCardConstants.INTENT_VALUE_ICC_NOT_READY);
Lucas Dupin3d053532019-01-29 12:35:22 -0800215 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800216 , putPhoneInfo(intent, data, false));
217 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800218 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800219 }
220
221 @Test
222 public void testTelephonyCapable_BootInitState_SimState_Ready() {
Bill Linef81cbd2018-07-05 17:48:49 +0800223 Bundle data = new Bundle();
224 ServiceState state = new ServiceState();
225 state.setState(ServiceState.STATE_OUT_OF_SERVICE);
226 state.fillInNotifierBundle(data);
227 Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
228 intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
229 , IccCardConstants.INTENT_VALUE_ICC_READY);
Lucas Dupin3d053532019-01-29 12:35:22 -0800230 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800231 , putPhoneInfo(intent, data, false));
232 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800233 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800234 }
235
236 @Test
237 public void testTelephonyCapable_BootInitState_ServiceState_PowerOff() {
Bill Linef81cbd2018-07-05 17:48:49 +0800238 Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
239 Bundle data = new Bundle();
240 ServiceState state = new ServiceState();
241 state.setState(ServiceState.STATE_POWER_OFF);
242 state.fillInNotifierBundle(data);
Lucas Dupin3d053532019-01-29 12:35:22 -0800243 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800244 , putPhoneInfo(intent, data, false));
245 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800246 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800247 }
248
249 @Test
250 public void testTelephonyCapable_SimValid_ServiceState_InService() {
Bill Linef81cbd2018-07-05 17:48:49 +0800251 Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
252 Bundle data = new Bundle();
253 ServiceState state = new ServiceState();
254 state.setState(ServiceState.STATE_IN_SERVICE);
255 state.fillInNotifierBundle(data);
Lucas Dupin3d053532019-01-29 12:35:22 -0800256 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800257 , putPhoneInfo(intent, data, true));
258 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800259 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
Bill Linef81cbd2018-07-05 17:48:49 +0800260 }
261
262 @Test
263 public void testTelephonyCapable_SimValid_SimState_Loaded() {
Bill Linef81cbd2018-07-05 17:48:49 +0800264 Bundle data = new Bundle();
265 ServiceState state = new ServiceState();
266 state.setState(ServiceState.STATE_IN_SERVICE);
267 state.fillInNotifierBundle(data);
268 Intent intentSimState = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
269 intentSimState.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
270 , IccCardConstants.INTENT_VALUE_ICC_LOADED);
Lucas Dupin3d053532019-01-29 12:35:22 -0800271 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800272 , putPhoneInfo(intentSimState, data, true));
273 mTestableLooper.processAllMessages();
274 // Even SimState Loaded, still need ACTION_SERVICE_STATE_CHANGED turn on mTelephonyCapable
Lucas Dupin3d053532019-01-29 12:35:22 -0800275 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse();
Bill Linef81cbd2018-07-05 17:48:49 +0800276
277 Intent intentServiceState = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
278 intentSimState.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE
279 , IccCardConstants.INTENT_VALUE_ICC_LOADED);
Lucas Dupin3d053532019-01-29 12:35:22 -0800280 mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext()
Bill Linef81cbd2018-07-05 17:48:49 +0800281 , putPhoneInfo(intentServiceState, data, true));
282 mTestableLooper.processAllMessages();
Lucas Dupin3d053532019-01-29 12:35:22 -0800283 assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue();
284 }
285
286 @Test
287 public void testTriesToAuthenticate_whenBouncer() {
288 mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true);
289 mTestableLooper.processAllMessages();
290
291 verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
292 verify(mFaceManager).isHardwareDetected();
293 verify(mFaceManager).hasEnrolledTemplates(anyInt());
294 }
295
296 @Test
297 public void testTriesToAuthenticate_whenKeyguard() {
298 mKeyguardUpdateMonitor.dispatchStartedWakingUp();
299 mTestableLooper.processAllMessages();
300 mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
301 verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
302 }
303
304 @Test
305 public void skipsAuthentication_whenEncryptedKeyguard() {
306 reset(mUserManager);
307 when(mUserManager.isUserUnlocked(anyInt())).thenReturn(false);
308
309 mKeyguardUpdateMonitor.dispatchStartedWakingUp();
310 mTestableLooper.processAllMessages();
311 mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
312 verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any());
313 }
314
315 @Test
316 public void testTriesToAuthenticate_whenAssistant() {
317 mKeyguardUpdateMonitor.setKeyguardOccluded(true);
318 mKeyguardUpdateMonitor.setAssistantVisible(true);
319
320 verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
321 }
322
323 @Test
Lucas Dupin3d053532019-01-29 12:35:22 -0800324 public void testOnFaceAuthenticated_skipsFaceWhenAuthenticated() {
325 mKeyguardUpdateMonitor.onFaceAuthenticated(KeyguardUpdateMonitor.getCurrentUser());
326 mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true);
327 mTestableLooper.processAllMessages();
328
329 verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any());
330 }
331
332 @Test
333 public void testGetUserCanSkipBouncer_whenFace() {
334 int user = KeyguardUpdateMonitor.getCurrentUser();
335 mKeyguardUpdateMonitor.onFaceAuthenticated(user);
336 assertThat(mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)).isTrue();
337 }
338
339 @Test
340 public void testGetUserCanSkipBouncer_whenFingerprint() {
341 int user = KeyguardUpdateMonitor.getCurrentUser();
342 mKeyguardUpdateMonitor.onFingerprintAuthenticated(user);
343 assertThat(mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)).isTrue();
344 }
345
346 @Test
347 public void testGetUserCanSkipBouncer_whenTrust() {
348 int user = KeyguardUpdateMonitor.getCurrentUser();
349 mKeyguardUpdateMonitor.onTrustChanged(true /* enabled */, user, 0 /* flags */);
350 assertThat(mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)).isTrue();
Bill Linef81cbd2018-07-05 17:48:49 +0800351 }
352
353 private Intent putPhoneInfo(Intent intent, Bundle data, Boolean simInited) {
354 int subscription = simInited
355 ? 1/* mock subid=1 */ : SubscriptionManager.DUMMY_SUBSCRIPTION_ID_BASE;
356 if (data != null) intent.putExtras(data);
357 intent.putExtra(PhoneConstants.PHONE_NAME_KEY, "Phone");
358 intent.putExtra("subscription", subscription);
359 intent.putExtra("slot", 0/* SLOT 1 */);
360 return intent;
361 }
362
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700363 private class TestableKeyguardUpdateMonitor extends KeyguardUpdateMonitor {
364 AtomicBoolean mSimStateChanged = new AtomicBoolean(false);
365
366 protected TestableKeyguardUpdateMonitor(Context context) {
367 super(context);
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700368 context.unregisterReceiver(mBroadcastReceiver);
Lucas Dupin3d053532019-01-29 12:35:22 -0800369 context.unregisterReceiver(mBroadcastAllReceiver);
370 mStrongAuthTracker = KeyguardUpdateMonitorTest.this.mStrongAuthTracker;
Lucas Dupin7ff82b02018-05-16 12:14:10 -0700371 }
372
373 public boolean hasSimStateJustChanged() {
374 return mSimStateChanged.getAndSet(false);
375 }
376
377 @Override
378 protected void handleSimStateChange(int subId, int slotId,
379 IccCardConstants.State state) {
380 mSimStateChanged.set(true);
381 super.handleSimStateChange(subId, slotId, state);
382 }
Lucas Dupin5e0f0d22018-02-26 13:32:16 -0800383 }
384}