From 626447294a48ffe31d864b98ec8f343febf47603 Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 18 Oct 2019 13:13:00 -0400 Subject: [PATCH 1/3] Remove last ranking-derived member from NotifEntry This can be extracted directly from the Ranking, no need to store a second copy. Test: atest Change-Id: I254079fd010ca4e984c28a96e471f5dd9075c81c --- .../android/systemui/bubbles/BubbleData.java | 2 +- .../collection/NotificationEntry.java | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index 2f7f47b6cda7d..4e229c00b8912 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -184,7 +184,7 @@ public class BubbleData { Log.d(TAG, "notificationEntryUpdated: " + entry); } Bubble bubble = getBubbleWithKey(entry.getKey()); - suppressFlyout = !entry.isVisuallyInterruptive || suppressFlyout; + suppressFlyout = !entry.getRanking().visuallyInterruptive() || suppressFlyout; if (bubble == null) { // Create a new bubble diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index e004ca7d1f1d9..048e784cd3d5e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -155,12 +155,6 @@ public final class NotificationEntry { */ private boolean hasSentReply; - /** - * Whether this notification has changed in visual appearance since the previous post. - * New notifications are interruptive by default. - */ - public boolean isVisuallyInterruptive; - /** * Whether this notification is shown to the user as a high priority notification: visible on * the lock screen/status bar and in the top section in the shade. @@ -236,10 +230,15 @@ public final class NotificationEntry { throw new IllegalArgumentException("New key " + ranking.getKey() + " doesn't match existing key " + mKey); } + mRanking = ranking; - isVisuallyInterruptive = ranking.visuallyInterruptive(); } + + /* + * Convenience getters for SBN and Ranking members + */ + public NotificationChannel getChannel() { return mRanking.getChannel(); } @@ -287,6 +286,12 @@ public final class NotificationEntry { } + /* + * Old methods + * + * TODO: Remove as many of these as possible + */ + public void setInterruption() { interruption = true; } From 2aa7e34b94f7dbc48e552763f266c2b112df1c76 Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 18 Oct 2019 13:17:24 -0400 Subject: [PATCH 2/3] Remove unused autoredacted member from NotifEntry It was set but never read. Test: atest Change-Id: Ia8ca7fd6b58c7065ec5cf012f385706c76cd06f6 --- .../statusbar/notification/collection/NotificationEntry.java | 1 - .../notification/collection/NotificationRowBinderImpl.java | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index 048e784cd3d5e..153fddaa8cb3a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -115,7 +115,6 @@ public final class NotificationEntry { public StatusBarIconView centeredIcon; public StatusBarIconView aodIcon; private boolean interruption; - public boolean autoRedacted; // whether the redacted notification was generated by us public int targetSdk; private long lastFullScreenIntentLaunchTime = NOT_LAUNCHED_YET; public CharSequence remoteInputText; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java index 5dbb9c544d7b4..396c5fefd8b78 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java @@ -248,7 +248,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { // TODO: should updates to the entry be happening somewhere else? entry.setIconTag(R.id.icon_is_pre_L, entry.targetSdk < Build.VERSION_CODES.LOLLIPOP); - entry.autoRedacted = entry.getSbn().getNotification().publicVersion == null; entry.setRow(row); row.setOnActivatedListener(mPresenter); From 9ebf382b45f14ac923fe8e6b6792d4dc9ff2f70e Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 18 Oct 2019 13:31:20 -0400 Subject: [PATCH 3/3] Cleanup unused areas of NotifEntry and related - Remove unused `noisy` member - Remove unused Bubble getter - Move unfortunate static constants to the bottom of the file where they are less of a bother for comprehension Test: atest Change-Id: Id3875cd9a883070650530a86383e5ab69bf2c185 --- .../src/com/android/systemui/bubbles/BubbleView.java | 10 ---------- .../notification/collection/NotificationEntry.java | 12 ++++++------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java index 780c3148a324b..fe4fa90a272dd 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java @@ -39,7 +39,6 @@ import com.android.launcher3.icons.ShadowGenerator; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; /** * A floating object on the screen that can post message updates. @@ -141,15 +140,6 @@ public class BubbleView extends FrameLayout { mUserBadgedAppIcon = appIcon; } - /** - * @return the {@link ExpandableNotificationRow} view to display notification content when the - * bubble is expanded. - */ - @Nullable - public ExpandableNotificationRow getRowView() { - return (mBubble != null) ? mBubble.getEntry().getRow() : null; - } - /** Changes the dot's visibility to match the bubble view's state. */ void updateDotVisibility(boolean animate) { updateDotVisibility(animate, null /* after */); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index 153fddaa8cb3a..71fc5490d656c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -85,11 +85,6 @@ import java.util.Objects; * clean this up in the future. */ public final class NotificationEntry { - private static final long LAUNCH_COOLDOWN = 2000; - private static final long REMOTE_INPUT_COOLDOWN = 500; - private static final long INITIALIZATION_DELAY = 400; - private static final long NOT_LAUNCHED_YET = -LAUNCH_COOLDOWN; - private static final int COLOR_INVALID = 1; private final String mKey; private StatusBarNotification mSbn; @@ -109,7 +104,6 @@ public final class NotificationEntry { * TODO: Remove every member beneath this line if possible */ - public boolean noisy; public StatusBarIconView icon; public StatusBarIconView expandedIcon; public StatusBarIconView centeredIcon; @@ -965,4 +959,10 @@ public final class NotificationEntry { this.index = index; } } + + private static final long LAUNCH_COOLDOWN = 2000; + private static final long REMOTE_INPUT_COOLDOWN = 500; + private static final long INITIALIZATION_DELAY = 400; + private static final long NOT_LAUNCHED_YET = -LAUNCH_COOLDOWN; + private static final int COLOR_INVALID = 1; }