Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa016f61 authored by Aaron Liu's avatar Aaron Liu Committed by Android (Google) Code Review
Browse files

Merge "Remove MODERN_BOUNCER flag." into tm-qpr-dev

parents 30bd64c8 e504df5f
Loading
Loading
Loading
Loading
+11 −52
Original line number Diff line number Diff line
@@ -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,18 +245,16 @@ 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)
                listenForBouncerExpansion(this)
                if (isModernAlternateBouncerEnabled) listenForAlternateBouncerVisibility(this)
            }
        }
    }
    }

    @VisibleForTesting
    internal suspend fun listenForBouncerExpansion(scope: CoroutineScope): Job {
@@ -332,7 +322,6 @@ constructor(

    override fun dump(pw: PrintWriter, args: Array<String>) {
        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")
        }
        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 {
+0 −7
Original line number Diff line number Diff line
@@ -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.
+4 −6
Original line number Diff line number Diff line
@@ -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);
        }

        if (featureFlags.isEnabled(Flags.UNOCCLUSION_TRANSITION)) {
            collectFlow(mView, keyguardTransitionInteractor.getLockscreenToDreamingTransition(),
+0 −1
Original line number Diff line number Diff line
@@ -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(
+10 −1
Original line number Diff line number Diff line
@@ -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<ViewGroup>(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<ViewGroup>(R.id.keyguard_bouncer_container)
    }
Loading