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

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

Fix NPE by returning empty params.

Re-entrant calls make it possible for inflation to occur after removal.
While http://ag/11334076 prevented the actual inflation from occuring in
this case, it was still possible to hit an NPE by attempting to modify a
notification's inflation parameters that didn't exist. This provides a
temporary workaround by just returning an empty params object.

Bug: 156989744
Test: atest SystemUITests
Change-Id: Ia86a92e0e447e521a6011e7edd32ebdd974a2c6b
parent 10bee631
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -69,9 +69,12 @@ public abstract class BindStage<Params> extends BindRequester {
        if (params == null) {
            // 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".
            // lead to inflation after the notification is "removed". We return an empty params
            // to avoid any NPEs for now, but we should remove this when all re-entrant calls are
            // fixed.
            Log.wtf(TAG, String.format("Entry does not have any stage parameters. key: %s",
                            entry.getKey()));
            return newStageParams();
        }
        return params;
    }