Merge "Expanding notification scrim to the edge of the screen" into sc-dev

This commit is contained in:
Lucas Dupin
2021-06-04 00:03:36 +00:00
committed by Android (Google) Code Review

View File

@@ -42,6 +42,7 @@ import android.content.res.Resources;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.Insets;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
@@ -55,7 +56,6 @@ import android.os.UserManager;
import android.os.VibrationEffect; import android.os.VibrationEffect;
import android.util.Log; import android.util.Log;
import android.util.MathUtils; import android.util.MathUtils;
import android.view.DisplayCutout;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.VelocityTracker; import android.view.VelocityTracker;
@@ -376,8 +376,8 @@ public class NotificationPanelViewController extends PanelViewController {
private float mOverStretchAmount; private float mOverStretchAmount;
private float mDownX; private float mDownX;
private float mDownY; private float mDownY;
private int mDisplayCutoutTopInset = 0; // in pixels private int mDisplayTopInset = 0; // in pixels
private int mDisplayCutoutLeftInset = 0; // in pixels private int mDisplayRightInset = 0; // in pixels
private int mSplitShadeNotificationsTopPadding; private int mSplitShadeNotificationsTopPadding;
private final KeyguardClockPositionAlgorithm private final KeyguardClockPositionAlgorithm
@@ -1268,7 +1268,7 @@ public class NotificationPanelViewController extends PanelViewController {
hasVisibleNotifications, darkamount, mOverStretchAmount, hasVisibleNotifications, darkamount, mOverStretchAmount,
bypassEnabled, getUnlockedStackScrollerPadding(), bypassEnabled, getUnlockedStackScrollerPadding(),
computeQsExpansionFraction(), computeQsExpansionFraction(),
mDisplayCutoutTopInset, mDisplayTopInset,
mShouldUseSplitNotificationShade); mShouldUseSplitNotificationShade);
mClockPositionAlgorithm.run(mClockPositionResult); mClockPositionAlgorithm.run(mClockPositionResult);
boolean animate = mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending(); boolean animate = mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending();
@@ -2217,8 +2217,9 @@ public class NotificationPanelViewController extends PanelViewController {
: notificationTop); : notificationTop);
} }
bottom = getView().getBottom(); bottom = getView().getBottom();
left = getView().getLeft() - mDisplayCutoutLeftInset; // notification bounds should take full screen width regardless of insets
right = getView().getRight() - mDisplayCutoutLeftInset; left = 0;
right = getView().getRight() + mDisplayRightInset;
} else if (qsPanelBottomY > 0) { // so bounds are empty on lockscreen } else if (qsPanelBottomY > 0) { // so bounds are empty on lockscreen
top = Math.min(qsPanelBottomY, mSplitShadeNotificationsTopPadding); top = Math.min(qsPanelBottomY, mSplitShadeNotificationsTopPadding);
bottom = mNotificationStackScrollLayoutController.getHeight(); bottom = mNotificationStackScrollLayoutController.getHeight();
@@ -4486,9 +4487,11 @@ public class NotificationPanelViewController extends PanelViewController {
private class OnApplyWindowInsetsListener implements View.OnApplyWindowInsetsListener { private class OnApplyWindowInsetsListener implements View.OnApplyWindowInsetsListener {
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
final DisplayCutout displayCutout = v.getRootWindowInsets().getDisplayCutout(); // the same types of insets that are handled in NotificationShadeWindowView
mDisplayCutoutTopInset = displayCutout != null ? displayCutout.getSafeInsetTop() : 0; int insetTypes = WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout();
mDisplayCutoutLeftInset = displayCutout != null ? displayCutout.getSafeInsetLeft() : 0; Insets combinedInsets = insets.getInsetsIgnoringVisibility(insetTypes);
mDisplayTopInset = combinedInsets.top;
mDisplayRightInset = combinedInsets.right;
mNavigationBarBottomHeight = insets.getStableInsetBottom(); mNavigationBarBottomHeight = insets.getStableInsetBottom();
updateMaxHeadsUpTranslation(); updateMaxHeadsUpTranslation();