diff options
| author | 2024-06-27 17:20:53 +0000 | |
|---|---|---|
| committer | 2024-06-27 17:20:53 +0000 | |
| commit | 691986df2bbf138335c9a0c457f21d2402b33c16 (patch) | |
| tree | fd47e6c4e0249764927594b327400ac840ea975d | |
| parent | 492d107b2eb0eb7c9949c2f41636d1aa4133e166 (diff) | |
| parent | d4cfbb807cfe20f901743b3b9424463f87a27150 (diff) | |
Merge "Remove references to udfps_view_performance flag" into main
2 files changed, 142 insertions, 163 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt index 60b48f28fc23..242e822664c0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt @@ -324,7 +324,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun showUdfpsOverlay_awake() = testScope.runTest { withReason(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) powerRepository.updateWakefulness( rawState = WakefulnessState.AWAKE, lastWakeReason = WakeSleepReason.POWER_BUTTON, @@ -341,7 +340,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun showUdfpsOverlay_whileGoingToSleep() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.OFF, to = KeyguardState.GONE, @@ -370,7 +368,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun showUdfpsOverlay_whileAsleep() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.OFF, to = KeyguardState.GONE, @@ -399,7 +396,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun neverRemoveViewThatHasNotBeenAdded() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) controllerOverlay.show(udfpsController, overlayParams) val view = controllerOverlay.getTouchOverlay() view?.let { @@ -414,7 +410,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun showUdfpsOverlay_afterFinishedTransitioningToAOD() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.OFF, to = KeyguardState.GONE, @@ -542,7 +537,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun addViewPending_layoutIsNotUpdated() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) mSetFlagsRule.enableFlags(Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR) // GIVEN going to sleep @@ -580,7 +574,6 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { fun updateOverlayParams_viewLayoutUpdated() = testScope.runTest { withReasonSuspend(REASON_AUTH_KEYGUARD) { - mSetFlagsRule.enableFlags(Flags.FLAG_UDFPS_VIEW_PERFORMANCE) powerRepository.updateWakefulness( rawState = WakefulnessState.AWAKE, lastWakeReason = WakeSleepReason.POWER_BUTTON, diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt index 01cc33c6c1f6..e03d160adc8d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt @@ -45,7 +45,6 @@ import android.view.accessibility.AccessibilityManager.TouchExplorationStateChan import androidx.annotation.LayoutRes import androidx.annotation.VisibleForTesting import com.android.keyguard.KeyguardUpdateMonitor -import com.android.systemui.Flags.udfpsViewPerformance import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor import com.android.systemui.biometrics.shared.model.UdfpsOverlayParams @@ -82,67 +81,66 @@ import kotlinx.coroutines.launch private const val TAG = "UdfpsControllerOverlay" -@VisibleForTesting -const val SETTING_REMOVE_ENROLLMENT_UI = "udfps_overlay_remove_enrollment_ui" +@VisibleForTesting const val SETTING_REMOVE_ENROLLMENT_UI = "udfps_overlay_remove_enrollment_ui" /** * Keeps track of the overlay state and UI resources associated with a single FingerprintService - * request. This state can persist across configuration changes via the [show] and [hide] - * methods. + * request. This state can persist across configuration changes via the [show] and [hide] methods. */ @ExperimentalCoroutinesApi @UiThread -class UdfpsControllerOverlay @JvmOverloads constructor( - private val context: Context, - private val inflater: LayoutInflater, - private val windowManager: WindowManager, - private val accessibilityManager: AccessibilityManager, - private val statusBarStateController: StatusBarStateController, - private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager, - private val keyguardUpdateMonitor: KeyguardUpdateMonitor, - private val dialogManager: SystemUIDialogManager, - private val dumpManager: DumpManager, - private val transitionController: LockscreenShadeTransitionController, - private val configurationController: ConfigurationController, - private val keyguardStateController: KeyguardStateController, - private val unlockedScreenOffAnimationController: UnlockedScreenOffAnimationController, - private var udfpsDisplayModeProvider: UdfpsDisplayModeProvider, - val requestId: Long, - @RequestReason val requestReason: Int, - private val controllerCallback: IUdfpsOverlayControllerCallback, - private val onTouch: (View, MotionEvent, Boolean) -> Boolean, - private val activityTransitionAnimator: ActivityTransitionAnimator, - private val primaryBouncerInteractor: PrimaryBouncerInteractor, - private val alternateBouncerInteractor: AlternateBouncerInteractor, - private val isDebuggable: Boolean = Build.IS_DEBUGGABLE, - private val udfpsKeyguardAccessibilityDelegate: UdfpsKeyguardAccessibilityDelegate, - private val transitionInteractor: KeyguardTransitionInteractor, - private val selectedUserInteractor: SelectedUserInteractor, - private val deviceEntryUdfpsTouchOverlayViewModel: - Lazy<DeviceEntryUdfpsTouchOverlayViewModel>, - private val defaultUdfpsTouchOverlayViewModel: Lazy<DefaultUdfpsTouchOverlayViewModel>, - private val shadeInteractor: ShadeInteractor, - private val udfpsOverlayInteractor: UdfpsOverlayInteractor, - private val powerInteractor: PowerInteractor, - @Application private val scope: CoroutineScope, +class UdfpsControllerOverlay +@JvmOverloads +constructor( + private val context: Context, + private val inflater: LayoutInflater, + private val windowManager: WindowManager, + private val accessibilityManager: AccessibilityManager, + private val statusBarStateController: StatusBarStateController, + private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager, + private val keyguardUpdateMonitor: KeyguardUpdateMonitor, + private val dialogManager: SystemUIDialogManager, + private val dumpManager: DumpManager, + private val transitionController: LockscreenShadeTransitionController, + private val configurationController: ConfigurationController, + private val keyguardStateController: KeyguardStateController, + private val unlockedScreenOffAnimationController: UnlockedScreenOffAnimationController, + private var udfpsDisplayModeProvider: UdfpsDisplayModeProvider, + val requestId: Long, + @RequestReason val requestReason: Int, + private val controllerCallback: IUdfpsOverlayControllerCallback, + private val onTouch: (View, MotionEvent, Boolean) -> Boolean, + private val activityTransitionAnimator: ActivityTransitionAnimator, + private val primaryBouncerInteractor: PrimaryBouncerInteractor, + private val alternateBouncerInteractor: AlternateBouncerInteractor, + private val isDebuggable: Boolean = Build.IS_DEBUGGABLE, + private val udfpsKeyguardAccessibilityDelegate: UdfpsKeyguardAccessibilityDelegate, + private val transitionInteractor: KeyguardTransitionInteractor, + private val selectedUserInteractor: SelectedUserInteractor, + private val deviceEntryUdfpsTouchOverlayViewModel: Lazy<DeviceEntryUdfpsTouchOverlayViewModel>, + private val defaultUdfpsTouchOverlayViewModel: Lazy<DefaultUdfpsTouchOverlayViewModel>, + private val shadeInteractor: ShadeInteractor, + private val udfpsOverlayInteractor: UdfpsOverlayInteractor, + private val powerInteractor: PowerInteractor, + @Application private val scope: CoroutineScope, ) { private val currentStateUpdatedToOffAodOrDozing: Flow<Unit> = transitionInteractor.currentKeyguardState .filter { - it == KeyguardState.OFF || - it == KeyguardState.AOD || - it == KeyguardState.DOZING + it == KeyguardState.OFF || it == KeyguardState.AOD || it == KeyguardState.DOZING } - .map { } // map to Unit + .map {} // map to Unit private var listenForCurrentKeyguardState: Job? = null private var addViewRunnable: Runnable? = null private var overlayViewLegacy: UdfpsView? = null private set + private var overlayTouchView: UdfpsTouchOverlay? = null /** - * Get the current UDFPS overlay touch view which is a different View depending on whether - * the DeviceEntryUdfpsRefactor flag is enabled or not. + * Get the current UDFPS overlay touch view which is a different View depending on whether the + * DeviceEntryUdfpsRefactor flag is enabled or not. + * * @return The view, when [isShowing], else null */ fun getTouchOverlay(): View? { @@ -158,23 +156,28 @@ class UdfpsControllerOverlay @JvmOverloads constructor( private var overlayTouchListener: TouchExplorationStateChangeListener? = null - private val coreLayoutParams = WindowManager.LayoutParams( - WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, - 0 /* flags set in computeLayoutParams() */, - PixelFormat.TRANSLUCENT - ).apply { - title = TAG - fitInsetsTypes = 0 - gravity = android.view.Gravity.TOP or android.view.Gravity.LEFT - layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS - flags = (Utils.FINGERPRINT_OVERLAY_LAYOUT_PARAM_FLAGS or - WindowManager.LayoutParams.FLAG_SPLIT_TOUCH) - privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY or - WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION - // Avoid announcing window title. - accessibilityTitle = " " - inputFeatures = WindowManager.LayoutParams.INPUT_FEATURE_SPY - } + private val coreLayoutParams = + WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, + 0 /* flags set in computeLayoutParams() */, + PixelFormat.TRANSLUCENT + ) + .apply { + title = TAG + fitInsetsTypes = 0 + gravity = android.view.Gravity.TOP or android.view.Gravity.LEFT + layoutInDisplayCutoutMode = + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS + flags = + (Utils.FINGERPRINT_OVERLAY_LAYOUT_PARAM_FLAGS or + WindowManager.LayoutParams.FLAG_SPLIT_TOUCH) + privateFlags = + WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY or + WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION + // Avoid announcing window title. + accessibilityTitle = " " + inputFeatures = WindowManager.LayoutParams.INPUT_FEATURE_SPY + } /** If the overlay is currently showing. */ val isShowing: Boolean @@ -209,51 +212,51 @@ class UdfpsControllerOverlay @JvmOverloads constructor( sensorBounds = Rect(params.sensorBounds) try { if (DeviceEntryUdfpsRefactor.isEnabled) { - overlayTouchView = (inflater.inflate( - R.layout.udfps_touch_overlay, null, false - ) as UdfpsTouchOverlay).apply { - // This view overlaps the sensor area - // prevent it from being selectable during a11y - if (requestReason.isImportantForAccessibility()) { - importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO - } - - addViewNowOrLater(this, null) - when (requestReason) { - REASON_AUTH_KEYGUARD -> - UdfpsTouchOverlayBinder.bind( - view = this, - viewModel = deviceEntryUdfpsTouchOverlayViewModel.get(), - udfpsOverlayInteractor = udfpsOverlayInteractor, - ) - else -> - UdfpsTouchOverlayBinder.bind( - view = this, - viewModel = defaultUdfpsTouchOverlayViewModel.get(), - udfpsOverlayInteractor = udfpsOverlayInteractor, - ) - } - } + overlayTouchView = + (inflater.inflate(R.layout.udfps_touch_overlay, null, false) + as UdfpsTouchOverlay) + .apply { + // This view overlaps the sensor area + // prevent it from being selectable during a11y + if (requestReason.isImportantForAccessibility()) { + importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO + } + + addViewNowOrLater(this, null) + when (requestReason) { + REASON_AUTH_KEYGUARD -> + UdfpsTouchOverlayBinder.bind( + view = this, + viewModel = deviceEntryUdfpsTouchOverlayViewModel.get(), + udfpsOverlayInteractor = udfpsOverlayInteractor, + ) + else -> + UdfpsTouchOverlayBinder.bind( + view = this, + viewModel = defaultUdfpsTouchOverlayViewModel.get(), + udfpsOverlayInteractor = udfpsOverlayInteractor, + ) + } + } } else { - overlayViewLegacy = (inflater.inflate( - R.layout.udfps_view, null, false - ) as UdfpsView).apply { - overlayParams = params - setUdfpsDisplayModeProvider(udfpsDisplayModeProvider) - val animation = inflateUdfpsAnimation(this, controller) - if (animation != null) { - animation.init() - animationViewController = animation + overlayViewLegacy = + (inflater.inflate(R.layout.udfps_view, null, false) as UdfpsView).apply { + overlayParams = params + setUdfpsDisplayModeProvider(udfpsDisplayModeProvider) + val animation = inflateUdfpsAnimation(this, controller) + if (animation != null) { + animation.init() + animationViewController = animation + } + // This view overlaps the sensor area + // prevent it from being selectable during a11y + if (requestReason.isImportantForAccessibility()) { + importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO + } + + addViewNowOrLater(this, animation) + sensorRect = sensorBounds } - // This view overlaps the sensor area - // prevent it from being selectable during a11y - if (requestReason.isImportantForAccessibility()) { - importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO - } - - addViewNowOrLater(this, animation) - sensorRect = sensorBounds - } } getTouchOverlay()?.apply { touchExplorationEnabled = accessibilityManager.isTouchExplorationEnabled @@ -269,7 +272,7 @@ class UdfpsControllerOverlay @JvmOverloads constructor( } } accessibilityManager.addTouchExplorationStateChangeListener( - overlayTouchListener!! + overlayTouchListener!! ) overlayTouchListener?.onTouchExplorationStateChanged(true) } @@ -284,30 +287,18 @@ class UdfpsControllerOverlay @JvmOverloads constructor( } private fun addViewNowOrLater(view: View, animation: UdfpsAnimationViewController<*>?) { - if (udfpsViewPerformance()) { - addViewRunnable = kotlinx.coroutines.Runnable { + addViewRunnable = + kotlinx.coroutines.Runnable { Trace.setCounter("UdfpsAddView", 1) - windowManager.addView( - view, - coreLayoutParams.updateDimensions(animation) - ) - } - if (powerInteractor.detailedWakefulness.value.isAwake()) { - // Device is awake, so we add the view immediately. - addViewIfPending() - } else { - listenForCurrentKeyguardState?.cancel() - listenForCurrentKeyguardState = scope.launch { - currentStateUpdatedToOffAodOrDozing.collect { - addViewIfPending() - } - } + windowManager.addView(view, coreLayoutParams.updateDimensions(animation)) } + if (powerInteractor.detailedWakefulness.value.isAwake()) { + // Device is awake, so we add the view immediately. + addViewIfPending() } else { - windowManager.addView( - view, - coreLayoutParams.updateDimensions(animation) - ) + listenForCurrentKeyguardState?.cancel() + listenForCurrentKeyguardState = + scope.launch { currentStateUpdatedToOffAodOrDozing.collect { addViewIfPending() } } } } @@ -340,23 +331,26 @@ class UdfpsControllerOverlay @JvmOverloads constructor( ): UdfpsAnimationViewController<*>? { DeviceEntryUdfpsRefactor.assertInLegacyMode() - val isEnrollment = when (requestReason) { - REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> true - else -> false - } + val isEnrollment = + when (requestReason) { + REASON_ENROLL_FIND_SENSOR, + REASON_ENROLL_ENROLLING -> true + else -> false + } - val filteredRequestReason = if (isEnrollment && shouldRemoveEnrollmentUi()) { - REASON_AUTH_OTHER - } else { - requestReason - } + val filteredRequestReason = + if (isEnrollment && shouldRemoveEnrollmentUi()) { + REASON_AUTH_OTHER + } else { + requestReason + } return when (filteredRequestReason) { REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> { // Enroll udfps UI is handled by settings, so use empty view here UdfpsFpmEmptyViewController( - view.addUdfpsView(R.layout.udfps_fpm_empty_view){ + view.addUdfpsView(R.layout.udfps_fpm_empty_view) { updateAccessibilityViewLocation(sensorBounds) }, statusBarStateController, @@ -434,14 +428,10 @@ class UdfpsControllerOverlay @JvmOverloads constructor( udfpsDisplayModeProvider.disable(null) } getTouchOverlay()?.apply { - if (udfpsViewPerformance()) { - if (this.parent != null) { - windowManager.removeView(this) - } - Trace.setCounter("UdfpsAddView", 0) - } else { + if (this.parent != null) { windowManager.removeView(this) } + Trace.setCounter("UdfpsAddView", 0) setOnTouchListener(null) setOnHoverListener(null) overlayTouchListener?.let { @@ -475,22 +465,19 @@ class UdfpsControllerOverlay @JvmOverloads constructor( val paddingX = animation?.paddingX ?: 0 val paddingY = animation?.paddingY ?: 0 - val isEnrollment = when (requestReason) { - REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> true - else -> false - } + val isEnrollment = + when (requestReason) { + REASON_ENROLL_FIND_SENSOR, + REASON_ENROLL_ENROLLING -> true + else -> false + } // Use expanded overlay unless touchExploration enabled var rotatedBounds = if (accessibilityManager.isTouchExplorationEnabled && isEnrollment) { Rect(overlayParams.sensorBounds) } else { - Rect( - 0, - 0, - overlayParams.naturalDisplayWidth, - overlayParams.naturalDisplayHeight - ) + Rect(0, 0, overlayParams.naturalDisplayWidth, overlayParams.naturalDisplayHeight) } val rot = overlayParams.rotation @@ -498,7 +485,8 @@ class UdfpsControllerOverlay @JvmOverloads constructor( if (!shouldRotate(animation)) { Log.v( TAG, - "Skip rotating UDFPS bounds " + Surface.rotationToString(rot) + + "Skip rotating UDFPS bounds " + + Surface.rotationToString(rot) + " animation=$animation" + " isGoingToSleep=${keyguardUpdateMonitor.isGoingToSleep}" + " isOccluded=${keyguardStateController.isOccluded}" @@ -559,6 +547,4 @@ class UdfpsControllerOverlay @JvmOverloads constructor( @RequestReason private fun Int.isImportantForAccessibility() = - this == REASON_ENROLL_FIND_SENSOR || - this == REASON_ENROLL_ENROLLING || - this == REASON_AUTH_BP + this == REASON_ENROLL_FIND_SENSOR || this == REASON_ENROLL_ENROLLING || this == REASON_AUTH_BP |