From caa6359dbe613f4a4e44e6929701f3c234a251ec Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Fri, 8 Apr 2022 16:34:55 +0000 Subject: [PATCH] [Bouncer] Apply interpolation to udfps Apply interpolation to udfps view controller when boucer is in transit. Also rename the function so that it implies that it affects all elements that need to hide in order to show the bouncer. Bug: 228282858 Test: Manual Change-Id: I27d192fb2576c8e02ac193eaee2836da4027c88f --- .../BouncerPanelExpansionCalculator.kt | 4 ++-- .../keyguard/KeyguardHostViewController.java | 2 +- .../UdfpsKeyguardViewController.java | 19 +++++++++------ .../DreamOverlayContainerViewController.java | 8 +++---- .../com/android/systemui/qs/QSFragment.java | 2 +- .../statusbar/phone/PanelViewController.java | 2 +- .../statusbar/phone/ScrimController.java | 4 ++-- .../BouncerPanelExpansionCalculatorTest.kt | 24 +++++++++---------- ...eamOverlayContainerViewControllerTest.java | 2 +- .../android/systemui/qs/QSFragmentTest.java | 2 +- .../statusbar/phone/ScrimControllerTest.java | 12 +++++----- 11 files changed, 43 insertions(+), 38 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/BouncerPanelExpansionCalculator.kt b/packages/SystemUI/src/com/android/keyguard/BouncerPanelExpansionCalculator.kt index 1b2ea3b257abb..a08c9000355f8 100644 --- a/packages/SystemUI/src/com/android/keyguard/BouncerPanelExpansionCalculator.kt +++ b/packages/SystemUI/src/com/android/keyguard/BouncerPanelExpansionCalculator.kt @@ -23,7 +23,7 @@ object BouncerPanelExpansionCalculator { * Scale the alpha/position of the host view. */ @JvmStatic - fun getHostViewScaledExpansion(fraction: Float): Float { + fun showBouncerProgress(fraction: Float): Float { return when { fraction >= 0.9f -> 1f fraction < 0.6 -> 0f @@ -35,7 +35,7 @@ object BouncerPanelExpansionCalculator { * Scale the alpha/tint of the back scrim. */ @JvmStatic - fun getBackScrimScaledExpansion(fraction: Float): Float { + fun aboutToShowBouncerProgress(fraction: Float): Float { return MathUtils.constrain((fraction - 0.9f) / 0.1f, 0f, 1f) } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java index 8c3e066849b9a..239b478949d21 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java @@ -327,7 +327,7 @@ public class KeyguardHostViewController extends ViewController * @param fraction amount of the screen that should show. */ public void setExpansion(float fraction) { - float scaledFraction = BouncerPanelExpansionCalculator.getHostViewScaledExpansion(fraction); + float scaledFraction = BouncerPanelExpansionCalculator.showBouncerProgress(fraction); mView.setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f)); mView.setTranslationY(scaledFraction * mTranslationY); } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 5d131f2a00466..f5f07c8ca9890 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -25,6 +25,7 @@ import android.util.Log; import android.util.MathUtils; import android.view.MotionEvent; +import com.android.keyguard.BouncerPanelExpansionCalculator; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.R; import com.android.systemui.animation.ActivityLaunchAnimator; @@ -71,7 +72,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController