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

Commit a6190645 authored by Kevin Han's avatar Kevin Han
Browse files

Don't throw exception for inflation after removal

There are some cases where we seem to be inflating after the removal of
a notification, most likely related to a re-entrant call where we
remove a notification as part of a notification update listener.  This
throws an exception since we assume a removed notification doesn't need
to inflate anything.

Until we fix the underlying issue, we loosen the guarantee and remove
the exception and instead just return early.

Bug: 155324756
Test: builds
Change-Id: I702391311e9d06319f4d93dd584ecc2a4dd78a36
parent 10f48bb6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.row;

import android.annotation.MainThread;
import android.util.ArrayMap;
import android.util.Log;

import androidx.annotation.NonNull;

@@ -66,8 +67,10 @@ public abstract class BindStage<Params> extends BindRequester {
    public final Params getStageParams(@NonNull NotificationEntry entry) {
        Params params = mContentParams.get(entry);
        if (params == null) {
            throw new IllegalStateException(
                    String.format("Entry does not have any stage parameters. key: %s",
            // TODO: This should throw an exception but there are some cases of re-entrant calls
            // in NotificationEntryManager (e.g. b/155324756) that cause removal in update that
            // lead to inflation after the notification is "removed".
            Log.wtf(TAG, String.format("Entry does not have any stage parameters. key: %s",
                            entry.getKey()));
        }
        return params;
@@ -92,6 +95,8 @@ public abstract class BindStage<Params> extends BindRequester {
     */
    protected abstract Params newStageParams();

    private static final String TAG = "BindStage";

    /**
     * Interface for callback.
     */
+3 −5
Original line number Diff line number Diff line
@@ -115,6 +115,9 @@ public final class NotifBindPipeline {
        mLogger.logManagedRow(entry.getKey());

        final BindEntry bindEntry = getBindEntry(entry);
        if (bindEntry == null) {
            return;
        }
        bindEntry.row = row;
        if (bindEntry.invalidated) {
            requestPipelineRun(entry);
@@ -223,11 +226,6 @@ public final class NotifBindPipeline {

    private @NonNull BindEntry getBindEntry(NotificationEntry entry) {
        final BindEntry bindEntry = mBindEntries.get(entry);
        if (bindEntry == null) {
            throw new IllegalStateException(
                    String.format("Attempting bind on an inactive notification. key: %s",
                            entry.getKey()));
        }
        return bindEntry;
    }