Merge "Update scrims when changing quick settings clip, fix clipping bounds in split shade" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6b484c26fc
@@ -2213,10 +2213,16 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
int right = 0;
|
int right = 0;
|
||||||
|
|
||||||
final int qsPanelBottomY = calculateQsBottomPosition(computeQsExpansionFraction());
|
final int qsPanelBottomY = calculateQsBottomPosition(computeQsExpansionFraction());
|
||||||
final boolean visible = (computeQsExpansionFraction() > 0 || qsPanelBottomY > 0)
|
final boolean quickSettingsVisible = computeQsExpansionFraction() > 0 || qsPanelBottomY > 0;
|
||||||
&& !mShouldUseSplitNotificationShade;
|
|
||||||
|
|
||||||
if (!mShouldUseSplitNotificationShade) {
|
if (mShouldUseSplitNotificationShade && quickSettingsVisible) {
|
||||||
|
mAmbientState.setNotificationScrimTop(mSplitShadeNotificationsTopPadding);
|
||||||
|
|
||||||
|
top = Math.max(0, Math.min(qsPanelBottomY, mSplitShadeNotificationsTopPadding));
|
||||||
|
bottom = mNotificationStackScrollLayoutController.getHeight();
|
||||||
|
left = mNotificationStackScrollLayoutController.getLeft();
|
||||||
|
right = mNotificationStackScrollLayoutController.getRight();
|
||||||
|
} else {
|
||||||
if (mTransitioningToFullShadeProgress > 0.0f) {
|
if (mTransitioningToFullShadeProgress > 0.0f) {
|
||||||
// If we're transitioning, let's use the actual value. The else case
|
// If we're transitioning, let's use the actual value. The else case
|
||||||
// can be wrong during transitions when waiting for the keyguard to unlock
|
// can be wrong during transitions when waiting for the keyguard to unlock
|
||||||
@@ -2231,16 +2237,11 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
// notification bounds should take full screen width regardless of insets
|
// notification bounds should take full screen width regardless of insets
|
||||||
left = 0;
|
left = 0;
|
||||||
right = getView().getRight() + mDisplayRightInset;
|
right = getView().getRight() + mDisplayRightInset;
|
||||||
} else if (qsPanelBottomY > 0) { // so bounds are empty on lockscreen
|
|
||||||
mAmbientState.setNotificationScrimTop(mSplitShadeNotificationsTopPadding);
|
|
||||||
top = Math.min(qsPanelBottomY, mSplitShadeNotificationsTopPadding);
|
|
||||||
bottom = mNotificationStackScrollLayoutController.getHeight();
|
|
||||||
left = mNotificationStackScrollLayoutController.getLeft();
|
|
||||||
right = mNotificationStackScrollLayoutController.getRight();
|
|
||||||
}
|
}
|
||||||
// top should never be lower than bottom, otherwise it will be invisible.
|
// top should never be lower than bottom, otherwise it will be invisible.
|
||||||
top = Math.min(top, bottom);
|
top = Math.min(top, bottom);
|
||||||
applyQSClippingBounds(left, top, right, bottom, visible);
|
applyQSClippingBounds(left, top, right, bottom,
|
||||||
|
quickSettingsVisible && !mShouldUseSplitNotificationShade);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyQSClippingBounds(int left, int top, int right, int bottom,
|
private void applyQSClippingBounds(int left, int top, int right, int bottom,
|
||||||
|
|||||||
@@ -359,21 +359,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
mAnimateChange = state.getAnimateChange();
|
mAnimateChange = state.getAnimateChange();
|
||||||
mAnimationDuration = state.getAnimationDuration();
|
mAnimationDuration = state.getAnimationDuration();
|
||||||
|
|
||||||
mInFrontTint = state.getFrontTint();
|
applyState();
|
||||||
mBehindTint = state.getBehindTint();
|
|
||||||
mNotificationsTint = state.getNotifTint();
|
|
||||||
mBubbleTint = state.getBubbleTint();
|
|
||||||
|
|
||||||
mInFrontAlpha = state.getFrontAlpha();
|
|
||||||
mBehindAlpha = state.getBehindAlpha();
|
|
||||||
mBubbleAlpha = state.getBubbleAlpha();
|
|
||||||
mNotificationsAlpha = state.getNotifAlpha();
|
|
||||||
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha) || isNaN(mNotificationsAlpha)) {
|
|
||||||
throw new IllegalStateException("Scrim opacity is NaN for state: " + state + ", front: "
|
|
||||||
+ mInFrontAlpha + ", back: " + mBehindAlpha + ", notif: "
|
|
||||||
+ mNotificationsAlpha);
|
|
||||||
}
|
|
||||||
applyStateToAlpha();
|
|
||||||
|
|
||||||
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
|
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
|
||||||
// We need to disable focus otherwise AOD would end up with a gray overlay.
|
// We need to disable focus otherwise AOD would end up with a gray overlay.
|
||||||
@@ -637,7 +623,19 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyStateToAlpha() {
|
private void applyState() {
|
||||||
|
mInFrontTint = mState.getFrontTint();
|
||||||
|
mBehindTint = mState.getBehindTint();
|
||||||
|
mNotificationsTint = mState.getNotifTint();
|
||||||
|
mBubbleTint = mState.getBubbleTint();
|
||||||
|
|
||||||
|
mInFrontAlpha = mState.getFrontAlpha();
|
||||||
|
mBehindAlpha = mState.getBehindAlpha();
|
||||||
|
mBubbleAlpha = mState.getBubbleAlpha();
|
||||||
|
mNotificationsAlpha = mState.getNotifAlpha();
|
||||||
|
|
||||||
|
assertAlphasValid();
|
||||||
|
|
||||||
if (!mExpansionAffectsAlpha) {
|
if (!mExpansionAffectsAlpha) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -701,6 +699,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
mBehindTint = behindTint;
|
mBehindTint = behindTint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertAlphasValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAlphasValid() {
|
||||||
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha) || isNaN(mNotificationsAlpha)) {
|
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha) || isNaN(mNotificationsAlpha)) {
|
||||||
throw new IllegalStateException("Scrim opacity is NaN for state: " + mState
|
throw new IllegalStateException("Scrim opacity is NaN for state: " + mState
|
||||||
+ ", front: " + mInFrontAlpha + ", back: " + mBehindAlpha + ", notif: "
|
+ ", front: " + mInFrontAlpha + ", back: " + mBehindAlpha + ", notif: "
|
||||||
@@ -740,7 +743,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
|
|
||||||
|
|
||||||
private void applyAndDispatchState() {
|
private void applyAndDispatchState() {
|
||||||
applyStateToAlpha();
|
applyState();
|
||||||
if (mUpdatePending) {
|
if (mUpdatePending) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1209,6 +1212,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
pw.println(" ScrimController: ");
|
pw.println(" ScrimController: ");
|
||||||
pw.print(" state: ");
|
pw.print(" state: ");
|
||||||
pw.println(mState);
|
pw.println(mState);
|
||||||
|
pw.println(" mClipQsScrim = " + mState.mClipQsScrim);
|
||||||
|
|
||||||
pw.print(" frontScrim:");
|
pw.print(" frontScrim:");
|
||||||
pw.print(" viewAlpha=");
|
pw.print(" viewAlpha=");
|
||||||
|
|||||||
@@ -555,6 +555,49 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void disableClipQsScrimWithoutStateTransition_updatesTintAndAlpha() {
|
||||||
|
mScrimController.setClipsQsScrim(true);
|
||||||
|
mScrimController.transitionTo(ScrimState.BOUNCER);
|
||||||
|
|
||||||
|
mScrimController.setClipsQsScrim(false);
|
||||||
|
|
||||||
|
finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
|
// Back scrim should be visible without tint
|
||||||
|
assertScrimAlpha(Map.of(
|
||||||
|
mScrimInFront, TRANSPARENT,
|
||||||
|
mNotificationsScrim, TRANSPARENT,
|
||||||
|
mScrimBehind, OPAQUE));
|
||||||
|
assertScrimTinted(Map.of(
|
||||||
|
mScrimInFront, false,
|
||||||
|
mScrimBehind, false,
|
||||||
|
mNotificationsScrim, false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void enableClipQsScrimWithoutStateTransition_updatesTintAndAlpha() {
|
||||||
|
mScrimController.setClipsQsScrim(false);
|
||||||
|
mScrimController.transitionTo(ScrimState.BOUNCER);
|
||||||
|
|
||||||
|
mScrimController.setClipsQsScrim(true);
|
||||||
|
|
||||||
|
finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
|
// Back scrim should be clipping QS
|
||||||
|
// Notif scrim should be visible without tint
|
||||||
|
assertScrimAlpha(Map.of(
|
||||||
|
mScrimInFront, TRANSPARENT,
|
||||||
|
mNotificationsScrim, OPAQUE,
|
||||||
|
mScrimBehind, OPAQUE));
|
||||||
|
assertScrimTinted(Map.of(
|
||||||
|
mScrimInFront, false,
|
||||||
|
mScrimBehind, true,
|
||||||
|
mNotificationsScrim, false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void transitionToBouncer() {
|
public void transitionToBouncer() {
|
||||||
mScrimController.transitionTo(ScrimState.BOUNCER_SCRIMMED);
|
mScrimController.transitionTo(ScrimState.BOUNCER_SCRIMMED);
|
||||||
|
|||||||
Reference in New Issue
Block a user