Made the notification side paddings consistent

The rounding and paddings are now consistent
throughout the shade. Before the notifications
were only rounded on the top, but the design
didn't work perfectly in all situations.

Bug: 69168591
Test: add notifications, observe consistent paddings
Change-Id: Idc60cb7d448193c65f77bafebb2d110809ecb725
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index d4de816..7a3da15 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -102,10 +102,7 @@
     <dimen name="notification_max_heads_up_height_increased">188dp</dimen>
 
     <!-- Side padding on the lockscreen on the side of notifications -->
-    <dimen name="notification_lockscreen_side_paddings">8dp</dimen>
-
-    <!-- Additional side padding for custom content if the app doesn't target P yet -->
-    <dimen name="notification_content_custom_view_side_padding">@dimen/notification_lockscreen_side_paddings</dimen>
+    <dimen name="notification_side_paddings">4dp</dimen>
 
     <!-- Height of a messaging notifications with actions at least. Not that this is an upper bound
          and the notification won't use this much, but is measured with wrap_content -->
@@ -121,7 +118,7 @@
     <dimen name="notification_min_interaction_height">40dp</dimen>
 
     <!-- the padding of the shelf icon container -->
-    <dimen name="shelf_icon_container_padding">21dp</dimen>
+    <dimen name="shelf_icon_container_padding">13dp</dimen>
 
     <!-- The padding of a notification icon on top to the start of the notification. Used for custom
          views where the distance can't be measured -->
@@ -226,7 +223,7 @@
     <dimen name="qs_footer_height">48dp</dimen>
 
     <!-- The padding between the notifications and the quick settings container -->
-    <dimen name="qs_notification_keyguard_padding">8dp</dimen>
+    <dimen name="qs_notification_padding">@dimen/notification_side_paddings</dimen>
 
     <!-- Height of the status bar header bar when expanded -->
     <dimen name="status_bar_header_height_expanded">124dp</dimen>
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index dd31365..fed97c5 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -86,10 +86,6 @@
     <item type="id" name="top_roundess_animator_start_tag"/>
     <item type="id" name="top_roundess_animator_end_tag"/>
 
-    <item type="id" name="side_padding_animator_tag"/>
-    <item type="id" name="side_padding_animator_start_tag"/>
-    <item type="id" name="side_padding_animator_end_tag"/>
-
     <!-- Accessibility actions for the notification menu -->
     <item type="id" name="action_snooze_undo"/>
     <item type="id" name="action_snooze_shorter"/>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index ff0357a..e59c703 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -931,13 +931,6 @@
     }
 
     @Override
-    public void setCurrentSidePaddings(float currentSidePaddings) {
-        super.setCurrentSidePaddings(currentSidePaddings);
-        mBackgroundNormal.setCurrentSidePaddings(currentSidePaddings);
-        mBackgroundDimmed.setCurrentSidePaddings(currentSidePaddings);
-    }
-
-    @Override
     protected boolean childNeedsClipping(View child) {
         if (child instanceof NotificationBackgroundView && isClippingNeeded()) {
             return true;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index f53eb48..d1e6dcc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -2362,16 +2362,15 @@
             NotificationContentView contentView = (NotificationContentView) child;
             if (isClippingNeeded()) {
                 return true;
-            } else if (!hasNoRoundingAndNoPadding() && contentView.shouldClipToSidePaddings()) {
+            } else if (!hasNoRounding() && contentView.shouldClipToRounding()) {
                 return true;
             }
         } else if (child == mChildrenContainer) {
-            if (isClippingNeeded() || ((isGroupExpanded() || isGroupExpansionChanging())
-                    && getClipBottomAmount() != 0.0f && getCurrentBottomRoundness() != 0.0f)) {
+            if (isClippingNeeded() || !hasNoRounding()) {
                 return true;
             }
         } else if (child instanceof NotificationGuts) {
-            return !hasNoRoundingAndNoPadding();
+            return !hasNoRounding();
         }
         return super.childNeedsClipping(child);
     }
@@ -2401,9 +2400,8 @@
         return super.getCustomClipPath(child);
     }
 
-    private boolean hasNoRoundingAndNoPadding() {
-        return mCurrentSidePaddings == 0 && getCurrentBottomRoundness() == 0.0f
-                && getCurrentTopRoundness() == 0.0f;
+    private boolean hasNoRounding() {
+        return getCurrentBottomRoundness() == 0.0f && getCurrentTopRoundness() == 0.0f;
     }
 
     public boolean isShowingAmbient() {
@@ -2418,20 +2416,6 @@
         }
     }
 
-    @Override
-    public void setCurrentSidePaddings(float currentSidePaddings) {
-        if (mIsSummaryWithChildren) {
-            List<ExpandableNotificationRow> notificationChildren =
-                    mChildrenContainer.getNotificationChildren();
-            int size = notificationChildren.size();
-            for (int i = 0; i < size; i++) {
-                ExpandableNotificationRow row = notificationChildren.get(i);
-                row.setCurrentSidePaddings(currentSidePaddings);
-            }
-        }
-        super.setCurrentSidePaddings(currentSidePaddings);
-    }
-
     public static class NotificationViewState extends ExpandableViewState {
 
         private final StackScrollState mOverallState;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java
index db19d2f..8a3645a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java
@@ -69,7 +69,6 @@
     private float mBottomRoundness;
     private float mTopRoundness;
     private int mBackgroundTop;
-    protected int mCurrentSidePaddings;
 
     /**
      * {@code true} if the children views of the {@link ExpandableOutlineView} are translated when
@@ -83,9 +82,9 @@
             if (!mCustomOutline && mCurrentTopRoundness == 0.0f
                     && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners) {
                 int translation = mShouldTranslateContents ? (int) getTranslation() : 0;
-                int left = Math.max(translation + mCurrentSidePaddings, mCurrentSidePaddings);
+                int left = Math.max(translation, 0);
                 int top = mClipTopAmount + mBackgroundTop;
-                int right = getWidth() - mCurrentSidePaddings + Math.min(translation, 0);
+                int right = getWidth() + Math.min(translation, 0);
                 int bottom = Math.max(getActualHeight() - mClipBottomAmount, top);
                 outline.setRect(left, top, right, bottom);
             } else {
@@ -115,9 +114,9 @@
         if (!mCustomOutline) {
             int translation = mShouldTranslateContents && !ignoreTranslation
                     ? (int) getTranslation() : 0;
-            left = Math.max(translation + mCurrentSidePaddings, mCurrentSidePaddings);
+            left = Math.max(translation, 0);
             top = mClipTopAmount + mBackgroundTop;
-            right = getWidth() - mCurrentSidePaddings + Math.min(translation, 0);
+            right = getWidth() + Math.min(translation, 0);
             bottom = Math.max(getActualHeight(), top);
             int intersectBottom = Math.max(getActualHeight() - mClipBottomAmount, top);
             if (bottom != intersectBottom) {
@@ -135,8 +134,6 @@
             top = mOutlineRect.top;
             right = mOutlineRect.right;
             bottom = mOutlineRect.bottom;
-            left = Math.max(mCurrentSidePaddings, left);
-            right = Math.min(getWidth() - mCurrentSidePaddings, right);
         }
         height = bottom - top;
         if (height == 0) {
@@ -162,13 +159,6 @@
         return roundedRectPath;
     }
 
-    protected Path getRoundedRectPath(int left, int top, int right, int bottom, float topRoundness,
-            float bottomRoundness) {
-        getRoundedRectPath(left, top, right, bottom, topRoundness, bottomRoundness,
-                mTmpPath);
-        return mTmpPath;
-    }
-
     private void getRoundedRectPath(int left, int top, int right, int bottom, float topRoundness,
             float bottomRoundness, Path outPath) {
         outPath.reset();
@@ -395,10 +385,4 @@
     public Path getCustomClipPath(View child) {
         return null;
     }
-
-    public void setCurrentSidePaddings(float currentSidePaddings) {
-        mCurrentSidePaddings = (int) currentSidePaddings;
-        invalidateOutline();
-        invalidate();
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java
index 68cf51c..45b35d0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java
@@ -41,7 +41,6 @@
     private int mClipBottomAmount;
     private int mTintColor;
     private float[] mCornerRadii = new float[8];
-    private int mCurrentSidePaddings;
     private boolean mBottomIsRounded;
     private int mBackgroundTop;
     private boolean mBottomAmountClips = true;
@@ -68,8 +67,7 @@
             if (mBottomIsRounded && mBottomAmountClips) {
                 bottom -= mClipBottomAmount;
             }
-            drawable.setBounds(mCurrentSidePaddings, mBackgroundTop,
-                    getWidth() - mCurrentSidePaddings, bottom);
+            drawable.setBounds(0, mBackgroundTop, getWidth(), bottom);
             drawable.draw(canvas);
         }
     }
@@ -206,11 +204,6 @@
         }
     }
 
-    public void setCurrentSidePaddings(float currentSidePaddings) {
-        mCurrentSidePaddings = (int) currentSidePaddings;
-        invalidate();
-    }
-
     public void setBackgroundTop(int backgroundTop) {
         mBackgroundTop = backgroundTop;
         invalidate();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 39c2131..c73e548 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -136,7 +136,6 @@
     private int mClipBottomAmount;
     private boolean mIsLowPriority;
     private boolean mIsContentExpandable;
-    private int mCustomViewSidePaddings;
 
 
     public NotificationContentView(Context context, AttributeSet attrs) {
@@ -150,8 +149,6 @@
                 R.dimen.min_notification_layout_height);
         mNotificationContentMarginEnd = getResources().getDimensionPixelSize(
                 com.android.internal.R.dimen.notification_content_margin_end);
-        mCustomViewSidePaddings = getResources().getDimensionPixelSize(
-                R.dimen.notification_content_custom_view_side_padding);
     }
 
     public void setHeights(int smallHeight, int headsUpMaxHeight, int maxHeight,
@@ -391,22 +388,6 @@
         mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child,
                 mContainingNotification);
         mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
-        updateMargins(child);
-    }
-
-    private void updateMargins(View child) {
-        if (child == null) {
-            return;
-        }
-        NotificationViewWrapper wrapper = getWrapperForView(child);
-        boolean isCustomView = wrapper instanceof NotificationCustomViewWrapper;
-        boolean needsMargins = isCustomView &&
-                child.getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P;
-        int padding = needsMargins ? mCustomViewSidePaddings : 0;
-        MarginLayoutParams layoutParams = (MarginLayoutParams) child.getLayoutParams();
-        layoutParams.setMarginStart(padding);
-        layoutParams.setMarginEnd(padding);
-        child.setLayoutParams(layoutParams);
     }
 
     private NotificationViewWrapper getWrapperForView(View child) {
@@ -456,7 +437,6 @@
         mExpandedChild = child;
         mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child,
                 mContainingNotification);
-        updateMargins(child);
     }
 
     public void setHeadsUpChild(View child) {
@@ -490,7 +470,6 @@
         mHeadsUpChild = child;
         mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child,
                 mContainingNotification);
-        updateMargins(child);
     }
 
     public void setAmbientChild(View child) {
@@ -1510,19 +1489,19 @@
         return false;
     }
 
-    public boolean shouldClipToSidePaddings() {
-        boolean needsPaddings = shouldClipToSidePaddings(getVisibleType());
+    public boolean shouldClipToRounding() {
+        boolean needsPaddings = shouldClipToRounding(getVisibleType());
         if (mUserExpanding) {
-             needsPaddings |= shouldClipToSidePaddings(mTransformationStartVisibleType);
+             needsPaddings |= shouldClipToRounding(mTransformationStartVisibleType);
         }
         return needsPaddings;
     }
 
-    private boolean shouldClipToSidePaddings(int visibleType) {
+    private boolean shouldClipToRounding(int visibleType) {
         NotificationViewWrapper visibleWrapper = getVisibleWrapper(visibleType);
         if (visibleWrapper == null) {
             return false;
         }
-        return visibleWrapper.shouldClipToSidePaddings();
+        return visibleWrapper.shouldClipToRounding();
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
index b2604fe..037eeb2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java
@@ -176,8 +176,6 @@
         final Resources res = mContext.getResources();
         mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size);
         mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height);
-        mSidePadding = res.getDimensionPixelSize(R.dimen.notification_lockscreen_side_paddings);
-        mIconPadding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding);
         mMenuItems.clear();
         // Construct the menu items based on the notification
         if (mParent != null && mParent.getStatusBarNotification() != null) {
@@ -498,8 +496,8 @@
         final int count = mMenuContainer.getChildCount();
         for (int i = 0; i < count; i++) {
             final View v = mMenuContainer.getChildAt(i);
-            final float left = mSidePadding + i * mHorizSpaceForIcon;
-            final float right = mParent.getWidth() - (mHorizSpaceForIcon * (i + 1)) - mSidePadding;
+            final float left = i * mHorizSpaceForIcon;
+            final float right = mParent.getWidth() - (mHorizSpaceForIcon * (i + 1));
             v.setX(showOnLeft ? left : right);
         }
         mOnLeft = showOnLeft;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
index 66682e4..0d22095 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
@@ -38,7 +38,6 @@
     private final Paint mGreyPaint = new Paint();
     private boolean mIsLegacy;
     private int mLegacyColor;
-    private boolean mBeforeP;
 
     protected NotificationCustomViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
         super(ctx, view, row);
@@ -119,15 +118,7 @@
     }
 
     @Override
-    public boolean shouldClipToSidePaddings() {
-        // Before P we ensure that they are now drawing inside out content bounds since we inset
-        // the view. If they target P, then we don't have that guarantee and we need to be safe.
-        return !mBeforeP;
-    }
-
-    @Override
-    public void onContentUpdated(ExpandableNotificationRow row) {
-        super.onContentUpdated(row);
-        mBeforeP = row.getEntry().targetSdk < Build.VERSION_CODES.P;
+    public boolean shouldClipToRounding() {
+        return true;
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
index 060e6d6..d7c08cc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
@@ -62,7 +62,7 @@
     }
 
     @Override
-    public boolean shouldClipToSidePaddings() {
+    public boolean shouldClipToRounding() {
         return true;
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
index e07112f..fd085d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
@@ -265,11 +265,6 @@
         updateActionOffset();
     }
 
-    @Override
-    public boolean shouldClipToSidePaddings() {
-        return mActionsContainer != null && mActionsContainer.getVisibility() != View.GONE;
-    }
-
     private void updateActionOffset() {
         if (mActionsContainer != null) {
             // We should never push the actions higher than they are in the headsup view.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
index 8a767bb..c71d604 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
@@ -195,7 +195,7 @@
         return 0;
     }
 
-    public boolean shouldClipToSidePaddings() {
+    public boolean shouldClipToRounding() {
         return false;
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 61dd22f..751db14 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -309,7 +309,7 @@
         mIndicationBottomPadding = getResources().getDimensionPixelSize(
                 R.dimen.keyguard_indication_bottom_padding);
         mQsNotificationTopPadding = getResources().getDimensionPixelSize(
-                R.dimen.qs_notification_keyguard_padding);
+                R.dimen.qs_notification_padding);
     }
 
     public void updateResources() {
@@ -451,7 +451,8 @@
         boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending();
         int stackScrollerPadding;
         if (mStatusBarState != StatusBarState.KEYGUARD) {
-            stackScrollerPadding = (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight;
+            stackScrollerPadding = (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight
+            +  mQsNotificationTopPadding;
             mTopPaddingAdjustment = 0;
         } else {
             mClockPositionAlgorithm.setup(
@@ -1381,7 +1382,7 @@
                     mNotificationStackScroller.getIntrinsicPadding(),
                     mQsMaxExpansionHeight + mQsNotificationTopPadding);
         } else {
-            return mQsExpansionHeight;
+            return mQsExpansionHeight + mQsNotificationTopPadding;
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index fe39a89..1d2baf1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -76,7 +76,6 @@
 import com.android.systemui.statusbar.DismissView;
 import com.android.systemui.statusbar.EmptyShadeView;
 import com.android.systemui.statusbar.ExpandableNotificationRow;
-import com.android.systemui.statusbar.ExpandableOutlineView;
 import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.NotificationData;
 import com.android.systemui.statusbar.NotificationGuts;
@@ -84,10 +83,8 @@
 import com.android.systemui.statusbar.NotificationSnooze;
 import com.android.systemui.statusbar.StackScrollerDecorView;
 import com.android.systemui.statusbar.StatusBarState;
-import com.android.systemui.statusbar.notification.AnimatableProperty;
 import com.android.systemui.statusbar.notification.FakeShadowView;
 import com.android.systemui.statusbar.notification.NotificationUtils;
-import com.android.systemui.statusbar.notification.PropertyAnimator;
 import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.phone.StatusBar;
@@ -123,16 +120,7 @@
     /**
      * Sentinel value for no current active pointer. Used by {@link #mActivePointerId}.
      */
-    private static final int INVALID_POINTER = -1;
-    private static final AnimatableProperty SIDE_PADDINGS = AnimatableProperty.from(
-            "sidePaddings",
-            NotificationStackScrollLayout::setCurrentSidePadding,
-            NotificationStackScrollLayout::getCurrentSidePadding,
-            R.id.side_padding_animator_tag,
-            R.id.side_padding_animator_end_tag,
-            R.id.side_padding_animator_start_tag);
-    private static final AnimationProperties SIDE_PADDING_PROPERTIES =
-            new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
+    private static final int INVALID_POINTER = -1;;
 
     private ExpandHelper mExpandHelper;
     private NotificationSwipeHelper mSwipeHelper;
@@ -140,7 +128,6 @@
     private int mCurrentStackHeight = Integer.MAX_VALUE;
     private final Paint mBackgroundPaint = new Paint();
     private final Path mBackgroundPath = new Path();
-    private final float[] mBackgroundRadii = new float[8];
     private final boolean mShouldDrawNotificationBackground;
 
     private float mExpandedHeight;
@@ -171,7 +158,6 @@
     private int mTopPadding;
     private int mBottomMargin;
     private int mBottomInset = 0;
-    private float mCurrentSidePadding;
 
     /**
      * The algorithm which calculates the properties for our children
@@ -399,7 +385,6 @@
     private boolean mHeadsUpGoingAwayAnimationsAllowed = true;
     private Runnable mAnimateScroll = this::animateScroll;
     private int mCornerRadius;
-    private int mLockscreenSidePaddings;
     private int mSidePaddings;
 
     public NotificationStackScrollLayout(Context context) {
@@ -437,8 +422,7 @@
                 res.getBoolean(R.bool.config_fadeNotificationsOnDismiss);
 
         updateWillNotDraw();
-        mBackgroundPaint.setAntiAlias(true);
-        mBackgroundPaint.setStyle(Paint.Style.FILL);
+        mBackgroundPaint.setAntiAlias(true);;
         if (DEBUG) {
             mDebugPaint = new Paint();
             mDebugPaint.setColor(0xffff0000);
@@ -486,7 +470,8 @@
     protected void onDraw(Canvas canvas) {
         if (mShouldDrawNotificationBackground && !mAmbientState.isDark()
                 && mCurrentBounds.top < mCurrentBounds.bottom) {
-            canvas.drawPath(mBackgroundPath, mBackgroundPaint);
+            canvas.drawRoundRect(mSidePaddings, mCurrentBounds.top, getWidth() - mSidePaddings,
+                    mCurrentBounds.bottom, mCornerRadius, mCornerRadius, mBackgroundPaint);
         }
 
         if (DEBUG) {
@@ -539,8 +524,7 @@
                 R.dimen.min_top_overscroll_to_qs);
         mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
         mBottomMargin = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom);
-        mLockscreenSidePaddings = res.getDimensionPixelSize(
-                R.dimen.notification_lockscreen_side_paddings);
+        mSidePaddings = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
         mMinInteractionHeight = res.getDimensionPixelSize(
                 R.dimen.notification_min_interaction_height);
         mCornerRadius = res.getDimensionPixelSize(
@@ -571,11 +555,15 @@
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+        int width = MeasureSpec.getSize(widthMeasureSpec);
+        int childWidthSpec = MeasureSpec.makeMeasureSpec(width - mSidePaddings * 2,
+                MeasureSpec.getMode(widthMeasureSpec));
         // We need to measure all children even the GONE ones, such that the heights are calculated
         // correctly as they are used to calculate how many we can fit on the screen.
         final int size = getChildCount();
         for (int i = 0; i < size; i++) {
-            measureChild(getChildAt(i), widthMeasureSpec, heightMeasureSpec);
+            measureChild(getChildAt(i), childWidthSpec, heightMeasureSpec);
         }
     }
 
@@ -2242,31 +2230,9 @@
         mScrimController.setExcludedBackgroundArea(
                 mFadingOut || mParentNotFullyVisible || mAmbientState.isDark() || mIsClipped ? null
                         : mCurrentBounds);
-        updateBackgroundPath();
         invalidate();
     }
 
-    private void updateBackgroundPath() {
-        mBackgroundPath.reset();
-        float topRoundness = 0;
-        if (mFirstVisibleBackgroundChild != null) {
-            topRoundness = mFirstVisibleBackgroundChild.getCurrentBackgroundRadiusTop();
-        }
-        topRoundness = onKeyguard() ? mCornerRadius : topRoundness;
-        float bottomRoundNess = mCornerRadius;
-        mBackgroundRadii[0] = topRoundness;
-        mBackgroundRadii[1] = topRoundness;
-        mBackgroundRadii[2] = topRoundness;
-        mBackgroundRadii[3] = topRoundness;
-        mBackgroundRadii[4] = bottomRoundNess;
-        mBackgroundRadii[5] = bottomRoundNess;
-        mBackgroundRadii[6] = bottomRoundNess;
-        mBackgroundRadii[7] = bottomRoundNess;
-        mBackgroundPath.addRoundRect(mCurrentSidePadding, mCurrentBounds.top,
-                getWidth() - mCurrentSidePadding, mCurrentBounds.bottom, mBackgroundRadii,
-                Path.Direction.CCW);
-    }
-
     /**
      * Update the background bounds to the new desired bounds
      */
@@ -2279,8 +2245,8 @@
             mBackgroundBounds.left = mTempInt2[0];
             mBackgroundBounds.right = mTempInt2[0] + getWidth();
         }
-        mBackgroundBounds.left += mCurrentSidePadding;
-        mBackgroundBounds.right -= mCurrentSidePadding;
+        mBackgroundBounds.left += mSidePaddings;
+        mBackgroundBounds.right -= mSidePaddings;
         if (!mIsExpanded) {
             mBackgroundBounds.top = 0;
             mBackgroundBounds.bottom = 0;
@@ -2892,8 +2858,7 @@
 
     private void applyRoundedNess() {
         if (mFirstVisibleBackgroundChild != null) {
-            mFirstVisibleBackgroundChild.setTopRoundness(
-                    mStatusBarState == StatusBarState.KEYGUARD ? 1.0f : 0.0f,
+            mFirstVisibleBackgroundChild.setTopRoundness(1.0f,
                     mFirstVisibleBackgroundChild.isShown()
                             && !mChildrenToAddAnimated.contains(mFirstVisibleBackgroundChild));
         }
@@ -2902,7 +2867,6 @@
                     mLastVisibleBackgroundChild.isShown()
                             && !mChildrenToAddAnimated.contains(mLastVisibleBackgroundChild));
         }
-        updateBackgroundPath();
         invalidate();
     }
 
@@ -2912,7 +2876,6 @@
         generateAddAnimation(child, false /* fromMoreCard */);
         updateAnimationState(child);
         updateChronometerForChild(child);
-        updateCurrentSidePaddings(child);
     }
 
     private void updateHideSensitiveForChild(View child) {
@@ -4359,43 +4322,6 @@
     public void setStatusBarState(int statusBarState) {
         mStatusBarState = statusBarState;
         mAmbientState.setStatusBarState(statusBarState);
-        applyRoundedNess();
-        updateSidePaddings();
-    }
-
-    private void updateSidePaddings() {
-        int sidePaddings = mStatusBarState == StatusBarState.KEYGUARD ? mLockscreenSidePaddings : 0;
-        if (sidePaddings != mSidePaddings) {
-            boolean animate = isShown();
-            mSidePaddings = sidePaddings;
-            PropertyAnimator.setProperty(this, SIDE_PADDINGS, sidePaddings,
-                    SIDE_PADDING_PROPERTIES, animate);
-        }
-    }
-
-    protected void setCurrentSidePadding(float sidePadding) {
-        mCurrentSidePadding = sidePadding;
-        updateBackground();
-        applySidePaddingsToChildren();
-    }
-
-    private void applySidePaddingsToChildren() {
-        for (int i = 0; i < getChildCount(); i++) {
-            View view = getChildAt(i);
-            updateCurrentSidePaddings(view);
-        }
-    }
-
-    private void updateCurrentSidePaddings(View view) {
-        if (!(view instanceof ExpandableOutlineView)) {
-            return;
-        }
-        ExpandableOutlineView outlineView = (ExpandableOutlineView) view;
-        outlineView.setCurrentSidePaddings(mCurrentSidePadding);
-    }
-
-    protected float getCurrentSidePadding() {
-        return mCurrentSidePadding;
     }
 
     public void setExpandingVelocity(float expandingVelocity) {