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

Commit 9449285d authored by Evan Laird's avatar Evan Laird
Browse files

Don't let everyone reach into NotificationData.Entry for its row

Test: atest SystemUITests
Change-Id: I0b4b66769afcf39c35800d293c22263e31790788
parent ce7357ad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ public class BubbleController {
        for (BubbleView bv : mBubbles.values()) {
            NotificationData.Entry entry = bv.getEntry();
            if (entry != null) {
                if (entry.row.isRemoved() || entry.isBubbleDismissed() || entry.row.isDismissed()) {
                if (entry.isRowRemoved() || entry.isBubbleDismissed() || entry.isRowDismissed()) {
                    viewsToRemove.add(bv);
                }
            }
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class BubbleView extends LinearLayout implements BubbleTouchHandler.Float
     * @return the view to display when the bubble is expanded.
     */
    public ExpandableNotificationRow getRowView() {
        return mEntry.row;
        return mEntry.getRow();
    }

    @Override
+3 −4
Original line number Diff line number Diff line
@@ -112,8 +112,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
            return;
        }

        alertEntry.mEntry.row.sendAccessibilityEvent(
                AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        alertEntry.mEntry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        if (alert) {
            alertEntry.updateEntry(true /* updatePostTime */);
        }
@@ -186,7 +185,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
        alertEntry.setEntry(entry);
        mAlertEntries.put(entry.key, alertEntry);
        onAlertEntryAdded(alertEntry);
        entry.row.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
    }

    /**
@@ -207,7 +206,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
        Entry entry = alertEntry.mEntry;
        mAlertEntries.remove(key);
        onAlertEntryRemoved(alertEntry);
        entry.row.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        alertEntry.reset();
        if (mExtendedLifetimeAlertEntries.contains(entry)) {
            if (mNotificationLifetimeFinishedCallback != null) {
+3 −3
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public final class AmbientPulseManager extends AlertingNotificationManager {
    @Override
    protected void onAlertEntryAdded(AlertEntry alertEntry) {
        NotificationData.Entry entry = alertEntry.mEntry;
        entry.row.setAmbientPulsing(true);
        entry.setAmbientPulsing(true);
        for (OnAmbientChangedListener listener : mListeners) {
            listener.onAmbientStateChanged(entry, true);
        }
@@ -88,11 +88,11 @@ public final class AmbientPulseManager extends AlertingNotificationManager {
    @Override
    protected void onAlertEntryRemoved(AlertEntry alertEntry) {
        NotificationData.Entry entry = alertEntry.mEntry;
        entry.row.setAmbientPulsing(false);
        entry.setAmbientPulsing(false);
        for (OnAmbientChangedListener listener : mListeners) {
            listener.onAmbientStateChanged(entry, false);
        }
        entry.row.freeContentViewWhenSafe(FLAG_CONTENT_VIEW_AMBIENT);
        entry.freeContentViewWhenSafe(FLAG_CONTENT_VIEW_AMBIENT);
    }

    @Override
+1 −8
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class NotificationMediaManager implements Dumpable {
            for (int i = 0; i < N; i++) {
                final NotificationData.Entry entry = activeNotifications.get(i);

                if (isMediaNotification(entry)) {
                if (entry.isMediaNotification()) {
                    final MediaSession.Token token =
                            entry.notification.getNotification().extras.getParcelable(
                                    Notification.EXTRA_MEDIA_SESSION);
@@ -336,13 +336,6 @@ public class NotificationMediaManager implements Dumpable {
        return PlaybackState.STATE_NONE;
    }

    private boolean isMediaNotification(NotificationData.Entry entry) {
        // TODO: confirm that there's a valid media key
        return entry.row.getExpandedContentView() != null
                && entry.row.getExpandedContentView().findViewById(
                        com.android.internal.R.id.media_actions) != null;
    }

    private void clearCurrentMediaNotificationSession() {
        mMediaMetadata = null;
        if (mMediaController != null) {
Loading