Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private static final int MSG_TIME_FORMAT_UPDATE = 344; private static final int MSG_REQUIRE_NFC_UNLOCK = 345; private static final int MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED = 346; private static final int MSG_SERVICE_PROVIDERS_UPDATED = 347; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -1826,6 +1827,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) { String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); mHandler.sendMessage(mHandler.obtainMessage(MSG_PHONE_STATE_CHANGED, state)); } else if (TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED.equals(action)) { mHandler.obtainMessage(MSG_SERVICE_PROVIDERS_UPDATED, intent).sendToTarget(); } else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { mHandler.sendEmptyMessage(MSG_AIRPLANE_MODE_CHANGED); } else if (Intent.ACTION_SERVICE_STATE.equals(action)) { Loading Loading @@ -2402,6 +2405,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab case MSG_SERVICE_STATE_CHANGE: handleServiceStateChange(msg.arg1, (ServiceState) msg.obj); break; case MSG_SERVICE_PROVIDERS_UPDATED: handleServiceProvidersUpdated((Intent) msg.obj); break; case MSG_SCREEN_TURNED_OFF: Trace.beginSection("KeyguardUpdateMonitor#handler MSG_SCREEN_TURNED_OFF"); handleScreenTurnedOff(); Loading Loading @@ -2472,6 +2478,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab filter.addAction(Intent.ACTION_SERVICE_STATE); filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); filter.addAction(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(UsbManager.ACTION_USB_PORT_COMPLIANCE_CHANGED); mBroadcastDispatcher.registerReceiverWithHandler(mBroadcastReceiver, filter, mHandler); Loading Loading @@ -3726,6 +3733,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab callbacksRefreshCarrierInfo(); } /** * Handle {@link #MSG_SERVICE_PROVIDERS_UPDATED} */ private void handleServiceProvidersUpdated(Intent intent) { mLogger.logServiceProvidersUpdated(intent); callbacksRefreshCarrierInfo(); } /** * Whether the keyguard is showing and not occluded. */ Loading packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt +19 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package com.android.keyguard.logging import android.content.Intent import android.hardware.biometrics.BiometricConstants.LockoutMode import android.os.PowerManager import android.os.PowerManager.WakeReason import android.telephony.ServiceState import android.telephony.SubscriptionInfo import android.telephony.SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX import android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID import android.telephony.TelephonyManager import com.android.keyguard.ActiveUnlockConfig import com.android.keyguard.FaceAuthUiEvent import com.android.keyguard.KeyguardListenModel Loading Loading @@ -363,6 +367,21 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) { ) } fun logServiceProvidersUpdated(intent: Intent) { logBuffer.log( TAG, VERBOSE, { int1 = intent.getIntExtra(EXTRA_SUBSCRIPTION_INDEX, INVALID_SUBSCRIPTION_ID) str1 = intent.getStringExtra(TelephonyManager.EXTRA_SPN) str2 = intent.getStringExtra(TelephonyManager.EXTRA_PLMN) }, { "action SERVICE_PROVIDERS_UPDATED subId=$int1 spn=$str1 plmn=$str2" } ) } fun logSimState(subId: Int, slotId: Int, state: Int) { logBuffer.log( TAG, Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,24 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue(); } @Test public void serviceProvidersUpdated_broadcastTriggersInfoRefresh() { // The callback is invoked once on init verify(mTestCallback, times(1)).onRefreshCarrierInfo(); // WHEN the SERVICE_PROVIDERS_UPDATED broadcast is sent Intent intent = new Intent(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED); intent.putExtra(TelephonyManager.EXTRA_SPN, "spn"); intent.putExtra(TelephonyManager.EXTRA_PLMN, "plmn"); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), putPhoneInfo(intent, null, true)); mTestableLooper.processAllMessages(); // THEN verify keyguardUpdateMonitorCallback receives a refresh callback // Note that we have times(2) here because it's been called once already verify(mTestCallback, times(2)).onRefreshCarrierInfo(); } @Test public void testTriesToAuthenticateFingerprint_whenKeyguard() { mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(0 /* why */); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private static final int MSG_TIME_FORMAT_UPDATE = 344; private static final int MSG_REQUIRE_NFC_UNLOCK = 345; private static final int MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED = 346; private static final int MSG_SERVICE_PROVIDERS_UPDATED = 347; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -1826,6 +1827,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) { String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); mHandler.sendMessage(mHandler.obtainMessage(MSG_PHONE_STATE_CHANGED, state)); } else if (TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED.equals(action)) { mHandler.obtainMessage(MSG_SERVICE_PROVIDERS_UPDATED, intent).sendToTarget(); } else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { mHandler.sendEmptyMessage(MSG_AIRPLANE_MODE_CHANGED); } else if (Intent.ACTION_SERVICE_STATE.equals(action)) { Loading Loading @@ -2402,6 +2405,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab case MSG_SERVICE_STATE_CHANGE: handleServiceStateChange(msg.arg1, (ServiceState) msg.obj); break; case MSG_SERVICE_PROVIDERS_UPDATED: handleServiceProvidersUpdated((Intent) msg.obj); break; case MSG_SCREEN_TURNED_OFF: Trace.beginSection("KeyguardUpdateMonitor#handler MSG_SCREEN_TURNED_OFF"); handleScreenTurnedOff(); Loading Loading @@ -2472,6 +2478,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab filter.addAction(Intent.ACTION_SERVICE_STATE); filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); filter.addAction(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(UsbManager.ACTION_USB_PORT_COMPLIANCE_CHANGED); mBroadcastDispatcher.registerReceiverWithHandler(mBroadcastReceiver, filter, mHandler); Loading Loading @@ -3726,6 +3733,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab callbacksRefreshCarrierInfo(); } /** * Handle {@link #MSG_SERVICE_PROVIDERS_UPDATED} */ private void handleServiceProvidersUpdated(Intent intent) { mLogger.logServiceProvidersUpdated(intent); callbacksRefreshCarrierInfo(); } /** * Whether the keyguard is showing and not occluded. */ Loading
packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt +19 −0 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package com.android.keyguard.logging import android.content.Intent import android.hardware.biometrics.BiometricConstants.LockoutMode import android.os.PowerManager import android.os.PowerManager.WakeReason import android.telephony.ServiceState import android.telephony.SubscriptionInfo import android.telephony.SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX import android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID import android.telephony.TelephonyManager import com.android.keyguard.ActiveUnlockConfig import com.android.keyguard.FaceAuthUiEvent import com.android.keyguard.KeyguardListenModel Loading Loading @@ -363,6 +367,21 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) { ) } fun logServiceProvidersUpdated(intent: Intent) { logBuffer.log( TAG, VERBOSE, { int1 = intent.getIntExtra(EXTRA_SUBSCRIPTION_INDEX, INVALID_SUBSCRIPTION_ID) str1 = intent.getStringExtra(TelephonyManager.EXTRA_SPN) str2 = intent.getStringExtra(TelephonyManager.EXTRA_PLMN) }, { "action SERVICE_PROVIDERS_UPDATED subId=$int1 spn=$str1 plmn=$str2" } ) } fun logSimState(subId: Int, slotId: Int, state: Int) { logBuffer.log( TAG, Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -653,6 +653,24 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isTrue(); } @Test public void serviceProvidersUpdated_broadcastTriggersInfoRefresh() { // The callback is invoked once on init verify(mTestCallback, times(1)).onRefreshCarrierInfo(); // WHEN the SERVICE_PROVIDERS_UPDATED broadcast is sent Intent intent = new Intent(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED); intent.putExtra(TelephonyManager.EXTRA_SPN, "spn"); intent.putExtra(TelephonyManager.EXTRA_PLMN, "plmn"); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), putPhoneInfo(intent, null, true)); mTestableLooper.processAllMessages(); // THEN verify keyguardUpdateMonitorCallback receives a refresh callback // Note that we have times(2) here because it's been called once already verify(mTestCallback, times(2)).onRefreshCarrierInfo(); } @Test public void testTriesToAuthenticateFingerprint_whenKeyguard() { mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(0 /* why */); Loading