From 5e018206e24c6067d43319c4c9e887ff71b8d7ed Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 15 Dec 2016 14:44:36 -0800 Subject: [PATCH] Removing notifications always immediately when swiping them away When swiping away notifications we were previously relying on the notification manager to cancel the notification for us. If the state diverges however (due to bugs) this leads to unrecoverable empty holes which is super bad. Merged-In: If63c5434b4e438fea560e0013a12c60655103977 Change-Id: If63c5434b4e438fea560e0013a12c60655103977 Test: existing tests pass Bug: 33457118 --- .../src/com/android/systemui/statusbar/BaseStatusBar.java | 15 ++++----------- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 4866fca05916..1afdc15e46cb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -979,12 +979,12 @@ public abstract class BaseStatusBar extends SystemUI implements // Accessibility feedback v.announceForAccessibility( mContext.getString(R.string.accessibility_notification_dismissed)); - performRemoveNotification(row.getStatusBarNotification(), false /* removeView */); + performRemoveNotification(row.getStatusBarNotification()); } }); } - protected void performRemoveNotification(StatusBarNotification n, boolean removeView) { + protected void performRemoveNotification(StatusBarNotification n) { final String pkg = n.getPackageName(); final String tag = n.getTag(); final int id = n.getId(); @@ -994,14 +994,8 @@ public abstract class BaseStatusBar extends SystemUI implements if (FORCE_REMOTE_INPUT_HISTORY && mKeysKeptForRemoteInput.contains(n.getKey())) { mKeysKeptForRemoteInput.remove(n.getKey()); - removeView = true; - } - if (mRemoteInputEntriesToRemoveOnCollapse.remove(mNotificationData.get(n.getKey()))) { - removeView = true; - } - if (removeView) { - removeNotification(n.getKey(), null); } + removeNotification(n.getKey(), null); } catch (RemoteException ex) { // system process is dead if we're here. @@ -2000,8 +1994,7 @@ public abstract class BaseStatusBar extends SystemUI implements Runnable removeRunnable = new Runnable() { @Override public void run() { - performRemoveNotification(parentToCancelFinal, - true); + performRemoveNotification(parentToCancelFinal); } }; if (isCollapsing()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 90d3f45c4b67..302535988a40 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1719,12 +1719,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } @Override - protected void performRemoveNotification(StatusBarNotification n, boolean removeView) { + protected void performRemoveNotification(StatusBarNotification n) { Entry entry = mNotificationData.get(n.getKey()); if (mRemoteInputController.isRemoteInputActive(entry)) { mRemoteInputController.removeRemoteInput(entry, null); } - super.performRemoveNotification(n, removeView); + super.performRemoveNotification(n); } @Override -- 2.11.0