Merge "Scroll notifications fullscreen" into sc-dev

This commit is contained in:
Lyn Han
2021-04-29 19:06:11 +00:00
committed by Android (Google) Code Review
4 changed files with 38 additions and 10 deletions

View File

@@ -431,6 +431,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private DismissAllAnimationListener mDismissAllAnimationListener; private DismissAllAnimationListener mDismissAllAnimationListener;
private NotificationRemoteInputManager mRemoteInputManager; private NotificationRemoteInputManager mRemoteInputManager;
private ShadeController mShadeController; private ShadeController mShadeController;
private Runnable mOnStackYChanged;
private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class); private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class);
private final LockscreenGestureLogger mLockscreenGestureLogger = private final LockscreenGestureLogger mLockscreenGestureLogger =
@@ -1142,14 +1143,22 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
*/ */
private void updateStackPosition() { private void updateStackPosition() {
// Consider interpolating from an mExpansionStartY for use on lockscreen and AOD // Consider interpolating from an mExpansionStartY for use on lockscreen and AOD
mAmbientState.setStackY( final float stackY = MathUtils.lerp(0, mTopPadding, mAmbientState.getExpansionFraction());
MathUtils.lerp(0, mTopPadding, mAmbientState.getExpansionFraction())); mAmbientState.setStackY(stackY);
if (mOnStackYChanged != null) {
mOnStackYChanged.run();
}
final float shadeBottom = getHeight() - getEmptyBottomMargin(); final float shadeBottom = getHeight() - getEmptyBottomMargin();
mAmbientState.setStackEndHeight(shadeBottom - mTopPadding); mAmbientState.setStackEndHeight(shadeBottom - mTopPadding);
mAmbientState.setStackHeight( mAmbientState.setStackHeight(
MathUtils.lerp(0, shadeBottom - mTopPadding, mAmbientState.getExpansionFraction())); MathUtils.lerp(0, shadeBottom - mTopPadding, mAmbientState.getExpansionFraction()));
} }
void setOnStackYChanged(Runnable onStackYChanged) {
mOnStackYChanged = onStackYChanged;
}
/** /**
* Update the height of the panel. * Update the height of the panel.
* *
@@ -4533,7 +4542,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
// We still want to call the normal scrolled changed for accessibility reasons // We still want to call the normal scrolled changed for accessibility reasons
onScrollChanged(mScrollX, ownScrollY, mScrollX, mOwnScrollY); onScrollChanged(mScrollX, ownScrollY, mScrollX, mOwnScrollY);
mOwnScrollY = ownScrollY; mOwnScrollY = ownScrollY;
updateChildren();
updateOnScrollChange(); updateOnScrollChange();
updateStackPosition();
} }
} }

View File

@@ -971,6 +971,10 @@ public class NotificationStackScrollLayoutController {
mView.setQsExpansionFraction(expansionFraction); mView.setQsExpansionFraction(expansionFraction);
} }
public void setOnStackYChanged(Runnable onStackYChanged) {
mView.setOnStackYChanged(onStackYChanged);
}
public float calculateAppearFractionBypass() { public float calculateAppearFractionBypass() {
return mView.calculateAppearFractionBypass(); return mView.calculateAppearFractionBypass();
} }

View File

@@ -151,7 +151,8 @@ public class StackScrollAlgorithm {
private void updateClipping(StackScrollAlgorithmState algorithmState, private void updateClipping(StackScrollAlgorithmState algorithmState,
AmbientState ambientState) { AmbientState ambientState) {
float drawStart = !ambientState.isOnKeyguard() ? ambientState.getStackY() : 0; float drawStart = !ambientState.isOnKeyguard()
? ambientState.getStackY() - ambientState.getScrollY() : 0;
float clipStart = 0; float clipStart = 0;
int childCount = algorithmState.visibleChildren.size(); int childCount = algorithmState.visibleChildren.size();
boolean firstHeadsUp = true; boolean firstHeadsUp = true;

View File

@@ -525,6 +525,7 @@ public class NotificationPanelViewController extends PanelViewController {
private NotificationShelfController mNotificationShelfController; private NotificationShelfController mNotificationShelfController;
private int mScrimCornerRadius; private int mScrimCornerRadius;
private int mScreenCornerRadius; private int mScreenCornerRadius;
private int mNotificationScrimPadding;
private final QuickAccessWalletClient mQuickAccessWalletClient; private final QuickAccessWalletClient mQuickAccessWalletClient;
private final Executor mUiExecutor; private final Executor mUiExecutor;
@@ -812,6 +813,8 @@ public class NotificationPanelViewController extends PanelViewController {
R.dimen.notification_scrim_corner_radius); R.dimen.notification_scrim_corner_radius);
mScreenCornerRadius = mResources.getDimensionPixelSize( mScreenCornerRadius = mResources.getDimensionPixelSize(
com.android.internal.R.dimen.rounded_corner_radius); com.android.internal.R.dimen.rounded_corner_radius);
mNotificationScrimPadding = mResources.getDimensionPixelSize(
R.dimen.notification_side_paddings);
} }
private void updateViewControllers(KeyguardStatusView keyguardStatusView, private void updateViewControllers(KeyguardStatusView keyguardStatusView,
@@ -2043,29 +2046,37 @@ public class NotificationPanelViewController extends PanelViewController {
mMediaHierarchyManager.setQsExpansion(qsExpansionFraction); mMediaHierarchyManager.setQsExpansion(qsExpansionFraction);
int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction); int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction);
mScrimController.setQsPosition(qsExpansionFraction, qsPanelBottomY); mScrimController.setQsPosition(qsExpansionFraction, qsPanelBottomY);
setNotificationBounds(qsExpansionFraction, qsPanelBottomY);
mNotificationStackScrollLayoutController.setQsExpansionFraction(qsExpansionFraction); mNotificationStackScrollLayoutController.setQsExpansionFraction(qsExpansionFraction);
mDepthController.setQsPanelExpansion(qsExpansionFraction); mDepthController.setQsPanelExpansion(qsExpansionFraction);
} }
private Runnable mOnStackYChanged = () -> {
if (mQs != null) {
setNotificationBounds();
}
};
/** /**
* Updates scrim bounds, QS clipping, and KSV clipping as well based on the bounds of the shade * Updates scrim bounds, QS clipping, and KSV clipping as well based on the bounds of the shade
* and QS state. * and QS state.
*
* @param qsFraction QS expansion fraction, from getQsExpansionFraction().
* @param qsPanelBottomY Absolute y position of the bottom of QS as it's being pulled.
*/ */
private void setNotificationBounds(float qsFraction, int qsPanelBottomY) { private void setNotificationBounds() {
int top = 0; int top = 0;
int bottom = 0; int bottom = 0;
int left = 0; int left = 0;
int right = 0; int right = 0;
boolean visible = (qsFraction > 0 || qsPanelBottomY > 0)
final int qsPanelBottomY = calculateQsBottomPosition(getQsExpansionFraction());
final boolean visible = (getQsExpansionFraction() > 0 || qsPanelBottomY > 0)
&& !mShouldUseSplitNotificationShade; && !mShouldUseSplitNotificationShade;
final float notificationTop = mAmbientState.getStackY()
- mNotificationScrimPadding
- mAmbientState.getScrollY();
setQsExpansionEnabled(mAmbientState.getScrollY() == 0);
int radius = mScrimCornerRadius; int radius = mScrimCornerRadius;
if (visible || !mShouldUseSplitNotificationShade) { if (visible || !mShouldUseSplitNotificationShade) {
if (!mShouldUseSplitNotificationShade) { if (!mShouldUseSplitNotificationShade) {
float notificationTop = mAmbientState.getStackY() - mQsNotificationTopPadding;
top = (int) Math.min(qsPanelBottomY, notificationTop); top = (int) Math.min(qsPanelBottomY, notificationTop);
bottom = getView().getBottom(); bottom = getView().getBottom();
left = getView().getLeft(); left = getView().getLeft();
@@ -3061,6 +3072,7 @@ public class NotificationPanelViewController extends PanelViewController {
// The expandedHeight is always the full panel Height when bypassing // The expandedHeight is always the full panel Height when bypassing
expandedHeight = getMaxPanelHeightNonBypass(); expandedHeight = getMaxPanelHeightNonBypass();
} }
mNotificationStackScrollLayoutController.setOnStackYChanged(mOnStackYChanged);
mNotificationStackScrollLayoutController.setExpandedHeight(expandedHeight); mNotificationStackScrollLayoutController.setExpandedHeight(expandedHeight);
updateKeyguardBottomAreaAlpha(); updateKeyguardBottomAreaAlpha();
updateBigClockAlpha(); updateBigClockAlpha();