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

Commit 076a75f3 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Animate sideFpsIndicator alpha-in on the primary bouncer" into udc-qpr-dev

parents 30efa295 93f74bba
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -50,7 +50,9 @@ import androidx.annotation.RawRes
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieProperty
import com.airbnb.lottie.model.KeyPath
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
import com.android.keyguard.KeyguardPINView
import com.android.systemui.Dumpable
import com.android.systemui.R
import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractor
@@ -112,7 +114,7 @@ constructor(
    private val isReverseDefaultRotation =
        context.resources.getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)

    private var overlayHideAnimator: ViewPropertyAnimator? = null
    private var overlayShowAnimator: ViewPropertyAnimator? = null

    private var overlayView: View? = null
        set(value) {
@@ -122,13 +124,23 @@ constructor(
                windowManager.removeView(oldView)
                orientationListener.disable()
            }
            overlayHideAnimator?.cancel()
            overlayHideAnimator = null
            overlayShowAnimator?.cancel()
            overlayShowAnimator = null

            field = value
            field?.let { newView ->
                if (requests.contains(SideFpsUiRequestSource.PRIMARY_BOUNCER)) {
                    newView.alpha = 0f
                    overlayShowAnimator =
                        newView
                            .animate()
                            .alpha(1f)
                            .setDuration(KeyguardPINView.ANIMATION_DURATION)
                            .setInterpolator(Interpolators.ALPHA_IN)
                }
                windowManager.addView(newView, overlayViewParams)
                orientationListener.enable()
                overlayShowAnimator?.start()
            }
        }
    @VisibleForTesting var overlayOffsets: SensorLocationInternal = SensorLocationInternal.DEFAULT
+21 −0
Original line number Diff line number Diff line
@@ -840,6 +840,27 @@ class SideFpsControllerTest : SysuiTestCase() {

            assertThat((lpFlags and PRIVATE_FLAG_TRUSTED_OVERLAY) != 0).isTrue()
        }

    @Test
    fun primaryBouncerRequestAnimatesAlphaIn() = testWithDisplay {
        sideFpsController.show(SideFpsUiRequestSource.PRIMARY_BOUNCER, REASON_AUTH_KEYGUARD)
        executor.runAllReady()
        verify(sideFpsView).animate()
    }

    @Test
    fun alternateBouncerRequestsDoesNotAnimateAlphaIn() = testWithDisplay {
        sideFpsController.show(SideFpsUiRequestSource.ALTERNATE_BOUNCER, REASON_AUTH_KEYGUARD)
        executor.runAllReady()
        verify(sideFpsView, never()).animate()
    }

    @Test
    fun autoShowRequestsDoesNotAnimateAlphaIn() = testWithDisplay {
        sideFpsController.show(SideFpsUiRequestSource.AUTO_SHOW, REASON_AUTH_KEYGUARD)
        executor.runAllReady()
        verify(sideFpsView, never()).animate()
    }
}

private fun insetsForSmallNavbar() = insetsWithBottom(60)