Merge changes from topic "presubmit-am-bc07d8feb3004d48aa07bf8ab49f6ece" into tm-mainline-prod
* changes:
[automerge] [Bouncer] Apply interpolation to udfps 2p: caa6359dbe
[Bouncer] Apply interpolation to udfps
This commit is contained in:
committed by
Android (Google) Code Review
commit
b2e9485cb1
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -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<Ud
|
||||
private float mTransitionToFullShadeProgress;
|
||||
private float mLastDozeAmount;
|
||||
private long mLastUdfpsBouncerShowTime = -1;
|
||||
private float mStatusBarExpansion;
|
||||
private float mPanelExpansionFraction;
|
||||
private boolean mLaunchTransitionFadingAway;
|
||||
private boolean mIsLaunchingActivity;
|
||||
private float mActivityLaunchProgress;
|
||||
@@ -188,7 +189,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
pw.println("mQsExpanded=" + mQsExpanded);
|
||||
pw.println("mIsBouncerVisible=" + mIsBouncerVisible);
|
||||
pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
|
||||
pw.println("mStatusBarExpansion=" + mStatusBarExpansion);
|
||||
pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction);
|
||||
pw.println("unpausedAlpha=" + mView.getUnpausedAlpha());
|
||||
pw.println("mUdfpsRequested=" + mUdfpsRequested);
|
||||
pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
|
||||
@@ -324,14 +325,16 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
*/
|
||||
@Override
|
||||
public void updateAlpha() {
|
||||
// fade icon on transitions to showing the status bar, but if mUdfpsRequested, then
|
||||
// the keyguard is occluded by some application - so instead use the input bouncer
|
||||
// hidden amount to determine the fade
|
||||
float expansion = mUdfpsRequested ? mInputBouncerHiddenAmount : mStatusBarExpansion;
|
||||
// Fade icon on transitions to showing the status bar or bouncer, but if mUdfpsRequested,
|
||||
// then the keyguard is occluded by some application - so instead use the input bouncer
|
||||
// hidden amount to determine the fade.
|
||||
float expansion = mUdfpsRequested ? mInputBouncerHiddenAmount : mPanelExpansionFraction;
|
||||
|
||||
int alpha = mShowingUdfpsBouncer ? 255
|
||||
: (int) MathUtils.constrain(
|
||||
MathUtils.map(.5f, .9f, 0f, 255f, expansion),
|
||||
0f, 255f);
|
||||
|
||||
if (!mShowingUdfpsBouncer) {
|
||||
alpha *= (1.0f - mTransitionToFullShadeProgress);
|
||||
|
||||
@@ -471,7 +474,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
@Override
|
||||
public void onPanelExpansionChanged(
|
||||
float fraction, boolean expanded, boolean tracking) {
|
||||
mStatusBarExpansion = fraction;
|
||||
mPanelExpansionFraction =
|
||||
mKeyguardViewManager.bouncerIsInTransit() ? BouncerPanelExpansionCalculator
|
||||
.aboutToShowBouncerProgress(fraction) : fraction;
|
||||
updateAlpha();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.systemui.dreams;
|
||||
|
||||
import static com.android.keyguard.BouncerPanelExpansionCalculator.getBackScrimScaledExpansion;
|
||||
import static com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress;
|
||||
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamAlphaScaledExpansion;
|
||||
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamYPositionScaledExpansion;
|
||||
import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
|
||||
@@ -217,19 +217,19 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve
|
||||
|
||||
mBlurUtils.applyBlur(mView.getViewRootImpl(),
|
||||
(int) mBlurUtils.blurRadiusOfRatio(
|
||||
1 - getBackScrimScaledExpansion(bouncerHideAmount)), false);
|
||||
1 - aboutToShowBouncerProgress(bouncerHideAmount)), false);
|
||||
}
|
||||
|
||||
private static float getAlpha(int position, float expansion) {
|
||||
return Interpolators.LINEAR_OUT_SLOW_IN.getInterpolation(
|
||||
position == POSITION_TOP ? getDreamAlphaScaledExpansion(expansion)
|
||||
: getBackScrimScaledExpansion(expansion + 0.03f));
|
||||
: aboutToShowBouncerProgress(expansion + 0.03f));
|
||||
}
|
||||
|
||||
private float getTranslationY(int position, float expansion) {
|
||||
final float fraction = Interpolators.LINEAR_OUT_SLOW_IN.getInterpolation(
|
||||
position == POSITION_TOP ? getDreamYPositionScaledExpansion(expansion)
|
||||
: getBackScrimScaledExpansion(expansion + 0.03f));
|
||||
: aboutToShowBouncerProgress(expansion + 0.03f));
|
||||
return MathUtils.lerp(-mDreamOverlayMaxTranslationY, 0, fraction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
|
||||
view.setVisibility((View.VISIBLE));
|
||||
}
|
||||
float alpha = mQSPanelController.bouncerInTransit()
|
||||
? BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(progress)
|
||||
? BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(progress)
|
||||
: ShadeInterpolation.getContentAlpha(progress);
|
||||
view.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ public abstract class PanelViewController {
|
||||
mExpandedFraction = Math.min(1f,
|
||||
maxPanelHeight == 0 ? 0 : mExpandedHeight / maxPanelHeight);
|
||||
mAmbientState.setExpansionFraction(mStatusBarKeyguardViewManager.bouncerIsInTransit()
|
||||
? BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(mExpandedFraction)
|
||||
? BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(mExpandedFraction)
|
||||
: mExpandedFraction);
|
||||
onHeightUpdated(mExpandedHeight);
|
||||
updatePanelExpansionAndVisibility();
|
||||
|
||||
@@ -790,7 +790,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
|
||||
if (mBouncerHiddenFraction != KeyguardBouncer.EXPANSION_HIDDEN) {
|
||||
final float interpolatedFraction =
|
||||
BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(
|
||||
BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(
|
||||
mBouncerHiddenFraction);
|
||||
mBehindAlpha = MathUtils.lerp(mDefaultScrimAlpha, mBehindAlpha,
|
||||
interpolatedFraction);
|
||||
@@ -1076,7 +1076,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
private float getInterpolatedFraction() {
|
||||
if (mStatusBarKeyguardViewManager.bouncerIsInTransit()) {
|
||||
return BouncerPanelExpansionCalculator
|
||||
.getBackScrimScaledExpansion(mPanelExpansionFraction);
|
||||
.aboutToShowBouncerProgress(mPanelExpansionFraction);
|
||||
}
|
||||
return ShadeInterpolation.getNotificationScrimAlpha(mPanelExpansionFraction);
|
||||
}
|
||||
|
||||
@@ -29,29 +29,29 @@ import org.junit.runner.RunWith
|
||||
class BouncerPanelExpansionCalculatorTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun testGetHostViewScaledExpansion() {
|
||||
assertThat(BouncerPanelExpansionCalculator.getHostViewScaledExpansion(1f))
|
||||
assertThat(BouncerPanelExpansionCalculator.showBouncerProgress(1f))
|
||||
.isEqualTo(1f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getHostViewScaledExpansion(0.9f))
|
||||
assertThat(BouncerPanelExpansionCalculator.showBouncerProgress(0.9f))
|
||||
.isEqualTo(1f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getHostViewScaledExpansion(0.59f))
|
||||
assertThat(BouncerPanelExpansionCalculator.showBouncerProgress(0.59f))
|
||||
.isEqualTo(0f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getHostViewScaledExpansion(0f))
|
||||
assertThat(BouncerPanelExpansionCalculator.showBouncerProgress(0f))
|
||||
.isEqualTo(0f)
|
||||
assertEquals(BouncerPanelExpansionCalculator
|
||||
.getHostViewScaledExpansion(0.8f), 2f / 3f, 0.01f)
|
||||
.showBouncerProgress(0.8f), 2f / 3f, 0.01f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetBackScrimScaledExpansion() {
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(1f))
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(1f))
|
||||
.isEqualTo(1f)
|
||||
assertEquals(BouncerPanelExpansionCalculator
|
||||
.getBackScrimScaledExpansion(0.95f), 1f / 2f, 0.01f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(0.9f))
|
||||
.aboutToShowBouncerProgress(0.95f), 1f / 2f, 0.01f)
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(0.9f))
|
||||
.isEqualTo(0f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(0.5f))
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(0.5f))
|
||||
.isEqualTo(0f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(0f))
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(0f))
|
||||
.isEqualTo(0f)
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ class BouncerPanelExpansionCalculatorTest : SysuiTestCase() {
|
||||
.getKeyguardClockScaledExpansion(0.8f), 1f / 3f, 0.01f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getKeyguardClockScaledExpansion(0.7f))
|
||||
.isEqualTo(0f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(0.5f))
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(0.5f))
|
||||
.isEqualTo(0f)
|
||||
assertThat(BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(0f))
|
||||
assertThat(BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(0f))
|
||||
.isEqualTo(0f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
|
||||
|
||||
final float bouncerHideAmount = 0.05f;
|
||||
final float scaledFraction =
|
||||
BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(bouncerHideAmount);
|
||||
BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(bouncerHideAmount);
|
||||
|
||||
bouncerExpansionCaptor.getValue().onExpansionChanged(bouncerHideAmount);
|
||||
verify(mBlurUtils).blurRadiusOfRatio(1 - scaledFraction);
|
||||
|
||||
@@ -214,7 +214,7 @@ public class QSFragmentTest extends SysuiBaseFragmentTest {
|
||||
|
||||
assertThat(mQsFragmentView.getAlpha())
|
||||
.isEqualTo(
|
||||
BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(
|
||||
BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(
|
||||
transitionProgress));
|
||||
}
|
||||
|
||||
|
||||
@@ -1244,11 +1244,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
float expansion = 0.8f;
|
||||
float expectedAlpha =
|
||||
BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, expectedAlpha, expansion);
|
||||
|
||||
expansion = 0.2f;
|
||||
expectedAlpha = BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
expectedAlpha = BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, expectedAlpha, expansion);
|
||||
}
|
||||
|
||||
@@ -1284,7 +1284,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
// Verify normal behavior after
|
||||
mScrimController.setUnocclusionAnimationRunning(false);
|
||||
float expansion = 0.4f;
|
||||
float alpha = 1 - BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
float alpha = 1 - BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, alpha, expansion);
|
||||
}
|
||||
|
||||
@@ -1316,15 +1316,15 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
|
||||
float expansion = 0.8f;
|
||||
float alpha = 1 - BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
float alpha = 1 - BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, alpha, expansion);
|
||||
|
||||
expansion = 0.4f;
|
||||
alpha = 1 - BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
alpha = 1 - BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, alpha, expansion);
|
||||
|
||||
expansion = 0.2f;
|
||||
alpha = 1 - BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(expansion);
|
||||
alpha = 1 - BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, alpha, expansion);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user