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

Commit aecbbd4f authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Release the content views when we mark a notification UNINFLATED.

Fixes: 215700025
Test: manual
Change-Id: Ibd5530ca1085dfa459d1b7c919d41156a16db452
parent f5c48984
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -79,6 +79,11 @@ public class NotifInflaterImpl implements NotifInflater {
        entry.abortTask();
    }

    @Override
    public void releaseViews(@NonNull NotificationEntry entry) {
        requireBinder().releaseViews(entry);
    }

    private NotificationContentInflater.InflationCallback wrapInflationCallback(
            InflationCallback callback) {
        return new NotificationContentInflater.InflationCallback() {
+1 −0
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ public class PreparationCoordinator implements Coordinator {

    private void freeNotifViews(NotificationEntry entry) {
        mViewBarn.removeViewForEntry(entry);
        mNotifInflater.releaseViews(entry);
        // TODO: clear the entry's row here, or even better, stop setting the row on the entry!
        mInflationStates.put(entry, STATE_UNINFLATED);
    }
+5 −0
Original line number Diff line number Diff line
@@ -46,6 +46,11 @@ interface NotifInflater {
     */
    fun abortInflation(entry: NotificationEntry)

    /**
     * Called to let the system remove the content views from the notification row.
     */
    fun releaseViews(entry: NotificationEntry)

    /**
     * Callback once all the views are inflated and bound for a given NotificationEntry.
     */
+5 −0
Original line number Diff line number Diff line
@@ -50,4 +50,9 @@ public interface NotificationRowBinder {
            NotificationUiAdjustment oldAdjustment,
            NotificationUiAdjustment newAdjustment,
            NotificationRowContentBinder.InflationCallback callback);

    /**
     * Called when a notification is no longer likely to be displayed and can have its views freed.
     */
    void releaseViews(NotificationEntry entry);
}
+16 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.collection.inflation;

import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_CONTRACTED;
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_EXPANDED;
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_PUBLIC;

import static java.util.Objects.requireNonNull;
@@ -161,6 +163,18 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        }
    }

    @Override
    public void releaseViews(NotificationEntry entry) {
        if (!entry.rowExists()) {
            return;
        }
        final RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
        params.markContentViewsFreeable(FLAG_CONTENT_VIEW_CONTRACTED);
        params.markContentViewsFreeable(FLAG_CONTENT_VIEW_EXPANDED);
        params.markContentViewsFreeable(FLAG_CONTENT_VIEW_PUBLIC);
        mRowContentBindStage.requestRebind(entry, null);
    }

    /**
     * Bind row to various controllers and managers. This is only called when the row is first
     * created.
@@ -249,6 +263,8 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        }

        RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
        params.requireContentViews(FLAG_CONTENT_VIEW_CONTRACTED);
        params.requireContentViews(FLAG_CONTENT_VIEW_EXPANDED);
        params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
        params.setUseLowPriority(isLowPriority);
        boolean needsRedaction =
Loading