Merge "Fixed NPE in RankingHelper.writeXml. Make sure that mRecords is operated with the object lock."
am: 51e5edcb9b
Change-Id: I4f57eb27caffbf6462dcad23660f05efce21e74e
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index da6e9c0..abd85cd 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -1401,11 +1401,14 @@
}
// Package upgrade
try {
- Record fullRecord = getRecord(pkg,
- mPm.getPackageUidAsUser(pkg, changeUserId));
- if (fullRecord != null) {
- createDefaultChannelIfNeeded(fullRecord);
- deleteDefaultChannelIfNeeded(fullRecord);
+ synchronized (mRecords) {
+ final String key = recordKey(pkg,
+ mPm.getPackageUidAsUser(pkg, changeUserId));
+ Record fullRecord = mRecords.get(key);
+ if (fullRecord != null) {
+ createDefaultChannelIfNeeded(fullRecord);
+ deleteDefaultChannelIfNeeded(fullRecord);
+ }
}
} catch (NameNotFoundException e) {}
}