From e504df5f793ba1fd6be96e4d7ad28eef951f7bce Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 26 Jan 2023 10:42:58 -0800 Subject: [PATCH] Remove MODERN_BOUNCER flag. and its references. Fixes: 254512385 Test: open bouncer and close it. Change-Id: I30ce739d7422bb7b7fb26c4a98187e80605c7131 --- .../biometrics/UdfpsKeyguardViewController.kt | 63 ++++--------------- .../src/com/android/systemui/flags/Flags.kt | 7 --- ...NotificationShadeWindowViewController.java | 10 ++- .../UdfpsKeyguardViewControllerBaseTest.java | 1 - ...tificationShadeWindowViewControllerTest.kt | 11 +++- .../NotificationShadeWindowViewTest.java | 10 +++ 6 files changed, 35 insertions(+), 67 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt index d072ec7cd9437..addbee954feaa 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt @@ -33,7 +33,6 @@ import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor -import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionListener @@ -83,7 +82,6 @@ constructor( ) { private val useExpandedOverlay: Boolean = featureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) - private val isModernBouncerEnabled: Boolean = featureFlags.isEnabled(Flags.MODERN_BOUNCER) private val isModernAlternateBouncerEnabled: Boolean = featureFlags.isEnabled(Flags.MODERN_ALTERNATE_BOUNCER) private var showingUdfpsBouncer = false @@ -109,12 +107,6 @@ constructor( ) } } - /** - * Hidden amount of input (pin/pattern/password) bouncer. This is used - * [KeyguardBouncerConstants.EXPANSION_VISIBLE] (0f) to - * [KeyguardBouncerConstants.EXPANSION_HIDDEN] (1f). Only used for the non-modernBouncer. - */ - private var inputBouncerHiddenAmount = KeyguardBouncerConstants.EXPANSION_HIDDEN private var inputBouncerExpansion = 0f // only used for modernBouncer private val stateListener: StatusBarStateController.StateListener = @@ -253,15 +245,13 @@ constructor( } init { - if (isModernBouncerEnabled || isModernAlternateBouncerEnabled) { - view.repeatWhenAttached { - // repeatOnLifecycle CREATED (as opposed to STARTED) because the Bouncer expansion - // can make the view not visible; and we still want to listen for events - // that may make the view visible again. - repeatOnLifecycle(Lifecycle.State.CREATED) { - if (isModernBouncerEnabled) listenForBouncerExpansion(this) - if (isModernAlternateBouncerEnabled) listenForAlternateBouncerVisibility(this) - } + view.repeatWhenAttached { + // repeatOnLifecycle CREATED (as opposed to STARTED) because the Bouncer expansion + // can make the view not visible; and we still want to listen for events + // that may make the view visible again. + repeatOnLifecycle(Lifecycle.State.CREATED) { + listenForBouncerExpansion(this) + if (isModernAlternateBouncerEnabled) listenForAlternateBouncerVisibility(this) } } } @@ -332,7 +322,6 @@ constructor( override fun dump(pw: PrintWriter, args: Array) { super.dump(pw, args) - pw.println("isModernBouncerEnabled=$isModernBouncerEnabled") pw.println("isModernAlternateBouncerEnabled=$isModernAlternateBouncerEnabled") pw.println("showingUdfpsAltBouncer=$showingUdfpsBouncer") pw.println( @@ -352,11 +341,7 @@ constructor( pw.println("udfpsRequestedByApp=$udfpsRequested") pw.println("launchTransitionFadingAway=$launchTransitionFadingAway") pw.println("lastDozeAmount=$lastDozeAmount") - if (isModernBouncerEnabled) { - pw.println("inputBouncerExpansion=$inputBouncerExpansion") - } else { - pw.println("inputBouncerHiddenAmount=$inputBouncerHiddenAmount") - } + pw.println("inputBouncerExpansion=$inputBouncerExpansion") view.dump(pw) } @@ -383,7 +368,6 @@ constructor( } else { keyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false) } - updateBouncerHiddenAmount() updateAlpha() updatePauseAuth() return true @@ -424,19 +408,11 @@ constructor( } fun isBouncerExpansionGreaterThan(bouncerExpansionThreshold: Float): Boolean { - return if (isModernBouncerEnabled) { - inputBouncerExpansion >= bouncerExpansionThreshold - } else { - inputBouncerHiddenAmount < bouncerExpansionThreshold - } + return inputBouncerExpansion >= bouncerExpansionThreshold } fun isInputBouncerFullyVisible(): Boolean { - return if (isModernBouncerEnabled) { - inputBouncerExpansion == 1f - } else { - keyguardViewManager.isBouncerShowing && !alternateBouncerInteractor.isVisibleState() - } + return inputBouncerExpansion == 1f } override fun listenForTouchesOutsideView(): Boolean { @@ -488,11 +464,7 @@ constructor( } private fun getInputBouncerHiddenAmt(): Float { - return if (isModernBouncerEnabled) { - 1f - inputBouncerExpansion - } else { - inputBouncerHiddenAmount - } + return 1f - inputBouncerExpansion } /** Update the scale factor based on the device's resolution. */ @@ -500,19 +472,6 @@ constructor( udfpsController.mOverlayParams?.scaleFactor?.let { view.setScaleFactor(it) } } - private fun updateBouncerHiddenAmount() { - if (isModernBouncerEnabled) { - return - } - val altBouncerShowing = alternateBouncerInteractor.isVisibleState() - if (altBouncerShowing || !keyguardViewManager.primaryBouncerIsOrWillBeShowing()) { - inputBouncerHiddenAmount = 1f - } else if (keyguardViewManager.isBouncerShowing) { - // input bouncer is fully showing - inputBouncerHiddenAmount = 0f - } - } - private val legacyAlternateBouncer: LegacyAlternateBouncer = object : LegacyAlternateBouncer { override fun showAlternateBouncer(): Boolean { diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 219664db3b9dc..d9daf959331b8 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -127,13 +127,6 @@ object Flags { @JvmField val LOCKSCREEN_CUSTOM_CLOCKS = unreleasedFlag(207, "lockscreen_custom_clocks", teamfood = true) - /** - * Flag to enable the usage of the new bouncer data source. This is a refactor of and eventual - * replacement of KeyguardBouncer.java. - */ - // TODO(b/254512385): Tracking Bug - @JvmField val MODERN_BOUNCER = releasedFlag(208, "modern_bouncer") - /** * Whether the clock on a wide lock screen should use the new "stepping" animation for moving * the digits when the clock moves. diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index 7ed6e3e556237..60fa865b83bcd 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -160,12 +160,10 @@ public class NotificationShadeWindowViewController { // This view is not part of the newly inflated expanded status bar. mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container); - if (featureFlags.isEnabled(Flags.MODERN_BOUNCER)) { - KeyguardBouncerViewBinder.bind( - mView.findViewById(R.id.keyguard_bouncer_container), - keyguardBouncerViewModel, - keyguardBouncerComponentFactory); - } + KeyguardBouncerViewBinder.bind( + mView.findViewById(R.id.keyguard_bouncer_container), + keyguardBouncerViewModel, + keyguardBouncerComponentFactory); if (featureFlags.isEnabled(Flags.UNOCCLUSION_TRANSITION)) { collectFlow(mView, keyguardTransitionInteractor.getLockscreenToDreamingTransition(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java index 498cc2926a718..dbbc2663a879d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java @@ -147,7 +147,6 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { protected UdfpsKeyguardViewController createUdfpsKeyguardViewController( boolean useModernBouncer, boolean useExpandedOverlay) { - mFeatureFlags.set(Flags.MODERN_BOUNCER, useModernBouncer); mFeatureFlags.set(Flags.MODERN_ALTERNATE_BOUNCER, useModernBouncer); mFeatureFlags.set(Flags.UDFPS_NEW_TOUCH_DETECTION, useExpandedOverlay); UdfpsKeyguardViewController controller = new UdfpsKeyguardViewController( diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt index 4c768253202a4..e5d5e3b8433a1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt @@ -45,13 +45,16 @@ import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.statusbar.phone.PhoneStatusBarViewController import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.android.systemui.statusbar.window.StatusBarWindowStateController +import com.android.systemui.util.mockito.any import com.google.common.truth.Truth.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Mock +import org.mockito.Mockito import org.mockito.Mockito.anyFloat +import org.mockito.Mockito.mock import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.Mockito.`when` as whenever @@ -102,7 +105,6 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { @Mock private lateinit var alternateBouncerInteractor: AlternateBouncerInteractor @Mock lateinit var keyguardBouncerComponentFactory: KeyguardBouncerComponent.Factory - @Mock lateinit var keyguardBouncerContainer: ViewGroup @Mock lateinit var keyguardBouncerComponent: KeyguardBouncerComponent @Mock lateinit var keyguardHostViewController: KeyguardHostViewController @Mock lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor @@ -116,6 +118,12 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) whenever(view.bottom).thenReturn(VIEW_BOTTOM) + whenever(view.findViewById(R.id.keyguard_bouncer_container)) + .thenReturn(mock(ViewGroup::class.java)) + whenever(keyguardBouncerComponentFactory.create(any(ViewGroup::class.java))) + .thenReturn(keyguardBouncerComponent) + whenever(keyguardBouncerComponent.keyguardHostViewController) + .thenReturn(keyguardHostViewController) underTest = NotificationShadeWindowViewController( lockscreenShadeTransitionController, FalsingCollectorFake(), @@ -275,6 +283,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { @Test fun testGetBouncerContainer() { + Mockito.clearInvocations(view) underTest.bouncerContainer verify(view).findViewById(R.id.keyguard_bouncer_container) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java index d43562443d6e2..5cc3ef1def9ed 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java @@ -29,9 +29,11 @@ import android.os.SystemClock; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; +import android.view.ViewGroup; import androidx.test.filters.SmallTest; +import com.android.keyguard.KeyguardHostViewController; import com.android.keyguard.LockIconViewController; import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.R; @@ -94,6 +96,8 @@ public class NotificationShadeWindowViewTest extends SysuiTestCase { @Mock private FeatureFlags mFeatureFlags; @Mock private KeyguardBouncerViewModel mKeyguardBouncerViewModel; @Mock private KeyguardBouncerComponent.Factory mKeyguardBouncerComponentFactory; + @Mock private KeyguardBouncerComponent mKeyguardBouncerComponent; + @Mock private KeyguardHostViewController mKeyguardHostViewController; @Mock private NotificationInsetsController mNotificationInsetsController; @Mock private AlternateBouncerInteractor mAlternateBouncerInteractor; @Mock private KeyguardTransitionInteractor mKeyguardTransitionInteractor; @@ -110,6 +114,12 @@ public class NotificationShadeWindowViewTest extends SysuiTestCase { when(mView.findViewById(R.id.notification_stack_scroller)) .thenReturn(mNotificationStackScrollLayout); + when(mView.findViewById(R.id.keyguard_bouncer_container)).thenReturn(mock(ViewGroup.class)); + when(mKeyguardBouncerComponentFactory.create(any(ViewGroup.class))).thenReturn( + mKeyguardBouncerComponent); + when(mKeyguardBouncerComponent.getKeyguardHostViewController()).thenReturn( + mKeyguardHostViewController); + when(mStatusBarStateController.isDozing()).thenReturn(false); mDependency.injectTestDependency(ShadeController.class, mShadeController);