From f0348b13b8d156dfb676471ee12c2d84846bdf78 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Mon, 12 Nov 2018 15:26:34 -0500 Subject: [PATCH] Don't let NotificationMediaManager cause NPEs If setUpWithPresenter() hasn't been called on NotificationMediaManager, it can NPE when serving up APIs. Long term, we probably need a way to make sure classes which need to bet set up don't do anything before they get that chance. Test: open camera, kill sysui, make sure it boots Change-Id: Idc41bf9aeecda2bcc55c03b4c027c15fbc880a4f Fixes: 119322135 --- .../android/systemui/statusbar/NotificationMediaManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index c437b14e015c3..fc1e94a08478f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -280,7 +280,10 @@ public class NotificationMediaManager implements Dumpable { if (metaDataChanged) { getEntryManager().updateNotifications(); } - mPresenter.updateMediaMetaData(metaDataChanged, true); + + if (mPresenter != null) { + mPresenter.updateMediaMetaData(metaDataChanged, true); + } } public void clearCurrentMediaNotification() {