Add null check for notification preference helper

Not sure about the exact situation, but depending on timing or
vendor implementation, this NPE could happen and at least we
should avoid this as it's system_server process.

We observed this when running WM CTS for ARC.

Bug: 225309857
Test: Run WM CTS
Change-Id: I095b0f51d8a0d436cca5072073032b26ddd11a90
This commit is contained in:
Kazuki Takise
2022-03-18 19:13:23 +09:00
parent f5ff7aa9f0
commit 0a8a686f1c

View File

@@ -601,8 +601,10 @@ public class PreferencesHelper implements RankingConfig {
out.attribute(null, ATT_NAME, r.pkg);
if (!notifPermissions.isEmpty()) {
Pair<Integer, String> app = new Pair(r.uid, r.pkg);
final Pair<Boolean, Boolean> permission = notifPermissions.get(app);
out.attributeInt(null, ATT_IMPORTANCE,
notifPermissions.get(app).first ? IMPORTANCE_DEFAULT : IMPORTANCE_NONE);
permission != null && permission.first ? IMPORTANCE_DEFAULT
: IMPORTANCE_NONE);
notifPermissions.remove(app);
} else {
if (r.importance != DEFAULT_IMPORTANCE) {