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

Commit d2d05f5b authored by Chris Wren's avatar Chris Wren Committed by Android Git Automerger
Browse files

am f975e308: Merge "Fix notification update path for structural updates." into lmp-preview-dev

* commit 'f975e3080447fa0b8dc6110329b669ae3838f202':
  Fix notification update path for structural updates.
parents 52a32726 20d3ba20
Loading
Loading
Loading
Loading
+43 −15
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ public abstract class BaseStatusBar extends SystemUI implements
    // for heads up notifications
    protected HeadsUpNotificationView mHeadsUpNotificationView;
    protected int mHeadsUpNotificationDecay;
    protected long mInterruptingNotificationTime;

    // used to notify status bar for suppressing notification LED
    protected boolean mPanelSlightlyVisible;
@@ -1420,6 +1419,9 @@ public abstract class BaseStatusBar extends SystemUI implements
                && !TextUtils.equals(notification.getNotification().tickerText,
                oldEntry.notification.getNotification().tickerText);

        final boolean shouldInterrupt = shouldInterrupt(notification);
        final boolean alertAgain = alertAgain(oldEntry);
        boolean updateSuccessful = false;
        if (contentsUnchanged && bigContentsUnchanged && headsUpContentsUnchanged
                && publicUnchanged) {
            if (DEBUG) Log.d(TAG, "reusing notification for key: " + key);
@@ -1439,8 +1441,6 @@ public abstract class BaseStatusBar extends SystemUI implements
                    }
                }

                final boolean shouldInterrupt = shouldInterrupt(notification);
                final boolean alertAgain = alertAgain(oldEntry);
                if (wasHeadsUp) {
                    if (shouldInterrupt) {
                        updateHeadsUpViews(oldEntry, notification);
@@ -1462,16 +1462,42 @@ public abstract class BaseStatusBar extends SystemUI implements
                }
                mNotificationData.updateRanking(ranking);
                updateNotifications();
                updateSuccessful = true;
            }
            catch (RuntimeException e) {
                // It failed to add cleanly.  Log, and remove the view from the panel.
                Log.w(TAG, "Couldn't reapply views for package " + contentView.getPackage(), e);
                removeNotificationViews(key, ranking);
                addNotificationViews(notification, ranking);
            }
        } else {
        }
        if (!updateSuccessful) {
            if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key);
            if (DEBUG) Log.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed"));
            if (wasHeadsUp) {
                if (shouldInterrupt) {
                    if (DEBUG) Log.d(TAG, "rebuilding heads up for key: " + key);
                    Entry newEntry = new Entry(notification, null);
                    ViewGroup holder = mHeadsUpNotificationView.getHolder();
                    if (inflateViewsForHeadsUp(newEntry, holder)) {
                        mHeadsUpNotificationView.showNotification(newEntry);
                        if (alertAgain) {
                            resetHeadsUpDecayTimer();
                        }
                    } else {
                        Log.w(TAG, "Couldn't create new updated headsup for package "
                                + contentView.getPackage());
                    }
                } else {
                    if (DEBUG) Log.d(TAG, "releasing heads up for key: " + key);
                    oldEntry.notification = notification;
                    mHeadsUpNotificationView.releaseAndClose();
                    return;
                }
            } else {
                if (shouldInterrupt && alertAgain) {
                    if (DEBUG) Log.d(TAG, "reposting to invoke heads up for key: " + key);
                    removeNotificationViews(key, ranking);
                    addNotificationInternal(notification, ranking);  //this will pop the headsup
                } else {
                    if (DEBUG) Log.d(TAG, "rebuilding update in place for key: " + key);
                    removeNotificationViews(key, ranking);
                    addNotificationViews(notification, ranking);
                    final NotificationData.Entry newEntry = mNotificationData.findByKey(key);
@@ -1482,6 +1508,8 @@ public abstract class BaseStatusBar extends SystemUI implements
                        newEntry.row.notifyHeightChanged();
                    }
                }
            }
        }

        // Update the veto button accordingly (and as a result, whether this row is
        // swipe-dismissable)
+0 −2
Original line number Diff line number Diff line
@@ -1068,8 +1068,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            Entry interruptionCandidate = new Entry(notification, null);
            ViewGroup holder = mHeadsUpNotificationView.getHolder();
            if (inflateViewsForHeadsUp(interruptionCandidate, holder)) {
                mInterruptingNotificationTime = System.currentTimeMillis();

                // 1. Populate mHeadsUpNotificationView
                mHeadsUpNotificationView.showNotification(interruptionCandidate);

+4 −2
Original line number Diff line number Diff line
@@ -78,8 +78,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
    }

    public boolean showNotification(NotificationData.Entry headsUp) {
        if (mHeadsUp != null && headsUp != null && !mHeadsUp.key.equals(headsUp.key)) {
            // bump any previous heads up back to the shade
            release();
        }

        mHeadsUp = headsUp;
        if (mContentHolder != null) {