Merge "Large screens: fully fade in behind scrim before anything else on shade" into tm-qpr-dev am: 14fdb4b9be
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21020973 Change-Id: Ib68c5d6c8b843564185fa31ea04a99f8f98c7851 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -791,20 +791,28 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
if (!mScreenOffAnimationController.shouldExpandNotifications()
|
if (!mScreenOffAnimationController.shouldExpandNotifications()
|
||||||
&& !mAnimatingPanelExpansionOnUnlock
|
&& !mAnimatingPanelExpansionOnUnlock
|
||||||
&& !occluding) {
|
&& !occluding) {
|
||||||
float behindFraction = getInterpolatedFraction();
|
|
||||||
behindFraction = (float) Math.pow(behindFraction, 0.8f);
|
|
||||||
if (mClipsQsScrim) {
|
if (mClipsQsScrim) {
|
||||||
|
float behindFraction = getInterpolatedFraction();
|
||||||
|
behindFraction = (float) Math.pow(behindFraction, 0.8f);
|
||||||
mBehindAlpha = mTransparentScrimBackground ? 0 : 1;
|
mBehindAlpha = mTransparentScrimBackground ? 0 : 1;
|
||||||
mNotificationsAlpha =
|
mNotificationsAlpha =
|
||||||
mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha;
|
mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha;
|
||||||
} else {
|
} else {
|
||||||
mBehindAlpha =
|
if (mTransparentScrimBackground) {
|
||||||
mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha;
|
mBehindAlpha = 0;
|
||||||
// Delay fade-in of notification scrim a bit further, to coincide with the
|
mNotificationsAlpha = 0;
|
||||||
// view fade in. Otherwise the empty panel can be quite jarring.
|
} else {
|
||||||
mNotificationsAlpha = mTransparentScrimBackground
|
// Behind scrim will finish fading in at 30% expansion.
|
||||||
? 0 : MathUtils.constrainedMap(0f, 1f, 0.3f, 0.75f,
|
float behindFraction = MathUtils
|
||||||
mPanelExpansionFraction);
|
.constrainedMap(0f, 1f, 0f, 0.3f, mPanelExpansionFraction);
|
||||||
|
mBehindAlpha = behindFraction * mDefaultScrimAlpha;
|
||||||
|
// Delay fade-in of notification scrim a bit further, to coincide with the
|
||||||
|
// behind scrim finishing fading in.
|
||||||
|
// Also to coincide with the view starting to fade in, otherwise the empty
|
||||||
|
// panel can be quite jarring.
|
||||||
|
mNotificationsAlpha = MathUtils
|
||||||
|
.constrainedMap(0f, 1f, 0.3f, 0.75f, mPanelExpansionFraction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mBehindTint = mState.getBehindTint();
|
mBehindTint = mState.getBehindTint();
|
||||||
mInFrontAlpha = 0;
|
mInFrontAlpha = 0;
|
||||||
|
|||||||
@@ -630,6 +630,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void transitionToUnlocked() {
|
public void transitionToUnlocked() {
|
||||||
|
mScrimController.setClipsQsScrim(false);
|
||||||
mScrimController.setRawPanelExpansionFraction(0f);
|
mScrimController.setRawPanelExpansionFraction(0f);
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||||
finishAnimationsImmediately();
|
finishAnimationsImmediately();
|
||||||
@@ -645,14 +646,21 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Back scrim should be visible after start dragging
|
// Back scrim should be visible after start dragging
|
||||||
mScrimController.setRawPanelExpansionFraction(0.3f);
|
mScrimController.setRawPanelExpansionFraction(0.29f);
|
||||||
assertScrimAlpha(Map.of(
|
assertScrimAlpha(Map.of(
|
||||||
mScrimInFront, TRANSPARENT,
|
mScrimInFront, TRANSPARENT,
|
||||||
mNotificationsScrim, TRANSPARENT,
|
mNotificationsScrim, TRANSPARENT,
|
||||||
mScrimBehind, SEMI_TRANSPARENT));
|
mScrimBehind, SEMI_TRANSPARENT));
|
||||||
|
|
||||||
|
// Back scrim should be opaque at 30%
|
||||||
|
mScrimController.setRawPanelExpansionFraction(0.3f);
|
||||||
|
assertScrimAlpha(Map.of(
|
||||||
|
mScrimInFront, TRANSPARENT,
|
||||||
|
mNotificationsScrim, TRANSPARENT,
|
||||||
|
mScrimBehind, OPAQUE));
|
||||||
|
|
||||||
// Then, notification scrim should fade in
|
// Then, notification scrim should fade in
|
||||||
mScrimController.setRawPanelExpansionFraction(0.7f);
|
mScrimController.setRawPanelExpansionFraction(0.31f);
|
||||||
assertScrimAlpha(Map.of(
|
assertScrimAlpha(Map.of(
|
||||||
mScrimInFront, TRANSPARENT,
|
mScrimInFront, TRANSPARENT,
|
||||||
mNotificationsScrim, SEMI_TRANSPARENT,
|
mNotificationsScrim, SEMI_TRANSPARENT,
|
||||||
|
|||||||
Reference in New Issue
Block a user