From 1e9d30430735362639b3e3a69ca7928ffa55fce1 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Tue, 15 Mar 2022 14:58:50 -0500 Subject: [PATCH] Encapsulate background width updates to ActivatableNotificationView Bug: 213480466 Test: normal short shelf usage => no regressions Change-Id: If14da43648663f425ed2ce417d9b3d376980a473 --- .../android/systemui/statusbar/NotificationShelf.java | 5 +---- .../notification/row/ActivatableNotificationView.java | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 3dd717d2f377d..eaa66bbc15acc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -226,10 +226,7 @@ public class NotificationShelf extends ActivatableNotificationView implements ? MathUtils.lerp(shortestWidth, getWidth(), fractionToShade) : getWidth(); ActivatableNotificationView anv = (ActivatableNotificationView) this; - NotificationBackgroundView bg = anv.getBackgroundNormal(); - if (bg != null) { - anv.getBackgroundNormal().setActualWidth((int) actualWidth); - } + anv.setBackgroundWidth((int) actualWidth); if (mShelfIcons != null) { mShelfIcons.setActualLayoutWidth((int) actualWidth); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index fca2aa167e37b..577d536262b2a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -163,10 +163,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } /** - * @return The background of this view. + * @param width The actual width to apply to the background view. */ - public NotificationBackgroundView getBackgroundNormal() { - return mBackgroundNormal; + public void setBackgroundWidth(int width) { + if (mBackgroundNormal == null) { + return; + } + mBackgroundNormal.setActualWidth(width); } @Override