Loading packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInt import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.UserActivityNotifierKosmosKt; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.kosmos.Kosmos; import com.android.systemui.log.SessionTracker; Loading Loading @@ -190,6 +191,8 @@ public class UdfpsControllerTest extends SysuiTestCase { private UdfpsOverlayInteractor mUdfpsOverlayInteractor; @Mock private SelectedUserInteractor mSelectedUserInteractor; @Mock private Lazy<WakefulnessLifecycle> mWakefulnessLifecycle; // Capture listeners so that they can be used to send events @Captor Loading Loading @@ -306,7 +309,8 @@ public class UdfpsControllerTest extends SysuiTestCase { mUdfpsOverlayInteractor, mPowerInteractor, mock(CoroutineScope.class), UserActivityNotifierKosmosKt.getUserActivityNotifier(mKosmos) UserActivityNotifierKosmosKt.getUserActivityNotifier(mKosmos), mWakefulnessLifecycle ); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); mOverlayController = mOverlayCaptor.getValue(); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +35 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static android.hardware.biometrics.BiometricRequestConstants.REASON_ENROL import static android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_FIND_SENSOR; import static com.android.internal.util.LatencyTracker.ACTION_UDFPS_ILLUMINATE; import static com.android.internal.util.LatencyTracker.ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP; import static com.android.internal.util.Preconditions.checkNotNull; import static com.android.systemui.classifier.Classifier.UDFPS_AUTHENTICATION; Loading Loading @@ -93,6 +94,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInt import com.android.systemui.doze.DozeReceiver; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.FalsingManager; Loading Loading @@ -260,6 +262,29 @@ public class UdfpsController implements DozeReceiver, Dumpable { } }; private final WakefulnessLifecycle mWakefulnessLifecycle; private final WakefulnessLifecycle.Observer mWakefulnessLifecycleObserver = new WakefulnessLifecycle.Observer() { @Override public void onStartedGoingToSleep() { mLatencyTracker.onActionCancel( ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); mLatencyTracker.onActionStart( ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); } }; private final View.OnAttachStateChangeListener mOverlayAttachStateListener = new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(@NonNull View v) { mLatencyTracker.onActionEnd(ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); } @Override public void onViewDetachedFromWindow(@NonNull View v) {} }; @Override public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { final int touchConfigId = mContext.getResources().getInteger( Loading Loading @@ -693,7 +718,8 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull UdfpsOverlayInteractor udfpsOverlayInteractor, @NonNull PowerInteractor powerInteractor, @Application CoroutineScope scope, UserActivityNotifier userActivityNotifier) { UserActivityNotifier userActivityNotifier, Lazy<WakefulnessLifecycle> wakefulnessLifecycle) { mContext = context; mExecution = execution; mVibrator = vibrator; Loading Loading @@ -772,6 +798,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { udfpsHapticsSimulator.setUdfpsController(this); udfpsShell.setUdfpsOverlayController(mUdfpsOverlayController); mWakefulnessLifecycle = wakefulnessLifecycle.get(); if (mWakefulnessLifecycle != null) { mWakefulnessLifecycle.addObserver(mWakefulnessLifecycleObserver); } } /** Loading Loading @@ -821,7 +852,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { + " isn't running on keyguard. Skip show."); return; } if (overlay.show(mOverlayParams)) { final View.OnAttachStateChangeListener listener = mWakefulnessLifecycle == null ? null : mOverlayAttachStateListener; if (overlay.show(mOverlayParams, listener)) { Log.d(TAG, "showUdfpsOverlay | adding window reason=" + requestReason); mOnFingerDown = false; mAttemptedToDismissKeyguard = false; Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +10 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.LayoutInflater import android.view.MotionEvent import android.view.Surface import android.view.View import android.view.View.OnAttachStateChangeListener import android.view.WindowManager import android.view.accessibility.AccessibilityManager import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener Loading Loading @@ -109,6 +110,7 @@ constructor( private var sensorBounds: Rect = Rect() private var overlayTouchListener: TouchExplorationStateChangeListener? = null private var overlayAttachStateListener: OnAttachStateChangeListener? = null private val coreLayoutParams = WindowManager.LayoutParams( Loading Loading @@ -141,11 +143,16 @@ constructor( private var touchExplorationEnabled = false fun show(params: UdfpsOverlayParams): Boolean { return show(params, null) } /** Show the overlay or return false and do nothing if it is already showing. */ @SuppressLint("ClickableViewAccessibility") fun show(params: UdfpsOverlayParams): Boolean { fun show(params: UdfpsOverlayParams, attachListener: OnAttachStateChangeListener?): Boolean { if (getTouchOverlay() == null) { overlayParams = params overlayAttachStateListener = attachListener sensorBounds = Rect(params.sensorBounds) try { overlayTouchView = Loading @@ -158,6 +165,7 @@ constructor( importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO } overlayAttachStateListener?.let { addOnAttachStateChangeListener(it) } addViewNowOrLater(this, null) when (requestReason) { REASON_AUTH_KEYGUARD -> Loading Loading @@ -259,6 +267,7 @@ constructor( Trace.setCounter("UdfpsAddView", 0) setOnTouchListener(null) setOnHoverListener(null) overlayAttachStateListener?.let { removeOnAttachStateChangeListener(it) } overlayTouchListener?.let { accessibilityManager.removeTouchExplorationStateChangeListener(it) } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInt import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.UserActivityNotifierKosmosKt; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.kosmos.Kosmos; import com.android.systemui.log.SessionTracker; Loading Loading @@ -190,6 +191,8 @@ public class UdfpsControllerTest extends SysuiTestCase { private UdfpsOverlayInteractor mUdfpsOverlayInteractor; @Mock private SelectedUserInteractor mSelectedUserInteractor; @Mock private Lazy<WakefulnessLifecycle> mWakefulnessLifecycle; // Capture listeners so that they can be used to send events @Captor Loading Loading @@ -306,7 +309,8 @@ public class UdfpsControllerTest extends SysuiTestCase { mUdfpsOverlayInteractor, mPowerInteractor, mock(CoroutineScope.class), UserActivityNotifierKosmosKt.getUserActivityNotifier(mKosmos) UserActivityNotifierKosmosKt.getUserActivityNotifier(mKosmos), mWakefulnessLifecycle ); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); mOverlayController = mOverlayCaptor.getValue(); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +35 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static android.hardware.biometrics.BiometricRequestConstants.REASON_ENROL import static android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_FIND_SENSOR; import static com.android.internal.util.LatencyTracker.ACTION_UDFPS_ILLUMINATE; import static com.android.internal.util.LatencyTracker.ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP; import static com.android.internal.util.Preconditions.checkNotNull; import static com.android.systemui.classifier.Classifier.UDFPS_AUTHENTICATION; Loading Loading @@ -93,6 +94,7 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInt import com.android.systemui.doze.DozeReceiver; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.FalsingManager; Loading Loading @@ -260,6 +262,29 @@ public class UdfpsController implements DozeReceiver, Dumpable { } }; private final WakefulnessLifecycle mWakefulnessLifecycle; private final WakefulnessLifecycle.Observer mWakefulnessLifecycleObserver = new WakefulnessLifecycle.Observer() { @Override public void onStartedGoingToSleep() { mLatencyTracker.onActionCancel( ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); mLatencyTracker.onActionStart( ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); } }; private final View.OnAttachStateChangeListener mOverlayAttachStateListener = new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(@NonNull View v) { mLatencyTracker.onActionEnd(ACTION_UDFPS_OVERLAY_ATTACHED_AFTER_GOING_TO_SLEEP); } @Override public void onViewDetachedFromWindow(@NonNull View v) {} }; @Override public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { final int touchConfigId = mContext.getResources().getInteger( Loading Loading @@ -693,7 +718,8 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull UdfpsOverlayInteractor udfpsOverlayInteractor, @NonNull PowerInteractor powerInteractor, @Application CoroutineScope scope, UserActivityNotifier userActivityNotifier) { UserActivityNotifier userActivityNotifier, Lazy<WakefulnessLifecycle> wakefulnessLifecycle) { mContext = context; mExecution = execution; mVibrator = vibrator; Loading Loading @@ -772,6 +798,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { udfpsHapticsSimulator.setUdfpsController(this); udfpsShell.setUdfpsOverlayController(mUdfpsOverlayController); mWakefulnessLifecycle = wakefulnessLifecycle.get(); if (mWakefulnessLifecycle != null) { mWakefulnessLifecycle.addObserver(mWakefulnessLifecycleObserver); } } /** Loading Loading @@ -821,7 +852,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { + " isn't running on keyguard. Skip show."); return; } if (overlay.show(mOverlayParams)) { final View.OnAttachStateChangeListener listener = mWakefulnessLifecycle == null ? null : mOverlayAttachStateListener; if (overlay.show(mOverlayParams, listener)) { Log.d(TAG, "showUdfpsOverlay | adding window reason=" + requestReason); mOnFingerDown = false; mAttemptedToDismissKeyguard = false; Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +10 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.LayoutInflater import android.view.MotionEvent import android.view.Surface import android.view.View import android.view.View.OnAttachStateChangeListener import android.view.WindowManager import android.view.accessibility.AccessibilityManager import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener Loading Loading @@ -109,6 +110,7 @@ constructor( private var sensorBounds: Rect = Rect() private var overlayTouchListener: TouchExplorationStateChangeListener? = null private var overlayAttachStateListener: OnAttachStateChangeListener? = null private val coreLayoutParams = WindowManager.LayoutParams( Loading Loading @@ -141,11 +143,16 @@ constructor( private var touchExplorationEnabled = false fun show(params: UdfpsOverlayParams): Boolean { return show(params, null) } /** Show the overlay or return false and do nothing if it is already showing. */ @SuppressLint("ClickableViewAccessibility") fun show(params: UdfpsOverlayParams): Boolean { fun show(params: UdfpsOverlayParams, attachListener: OnAttachStateChangeListener?): Boolean { if (getTouchOverlay() == null) { overlayParams = params overlayAttachStateListener = attachListener sensorBounds = Rect(params.sensorBounds) try { overlayTouchView = Loading @@ -158,6 +165,7 @@ constructor( importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO } overlayAttachStateListener?.let { addOnAttachStateChangeListener(it) } addViewNowOrLater(this, null) when (requestReason) { REASON_AUTH_KEYGUARD -> Loading Loading @@ -259,6 +267,7 @@ constructor( Trace.setCounter("UdfpsAddView", 0) setOnTouchListener(null) setOnHoverListener(null) overlayAttachStateListener?.let { removeOnAttachStateChangeListener(it) } overlayTouchListener?.let { accessibilityManager.removeTouchExplorationStateChangeListener(it) } Loading