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

Commit 20d3ba20 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

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

parents a83ce345 1dafd042
Loading
Loading
Loading
Loading
+43 −15
Original line number Diff line number Diff line
@@ -132,7 +132,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;
@@ -1413,6 +1412,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);
@@ -1432,8 +1434,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);
@@ -1455,16 +1455,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);
@@ -1475,6 +1501,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
@@ -1081,8 +1081,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) {