Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4740141 authored by Selim Cinek's avatar Selim Cinek
Browse files

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.

Change-Id: If63c5434b4e438fea560e0013a12c60655103977
Test: existing tests pass
Bug: 33457118
parent 810bcde1
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -981,12 +981,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();
@@ -996,14 +996,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);
            }

        } catch (RemoteException ex) {
            // system process is dead if we're here.
@@ -1977,8 +1971,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                                        Runnable removeRunnable = new Runnable() {
                                            @Override
                                            public void run() {
                                                performRemoveNotification(parentToCancelFinal,
                                                        true);
                                                performRemoveNotification(parentToCancelFinal);
                                            }
                                        };
                                        if (isCollapsing()) {
+2 −2
Original line number Diff line number Diff line
@@ -1747,12 +1747,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