Fix NPE when deleting old zen rules am: 7bb9cd92bf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19202448 Change-Id: I5849b48a9a54f52c1bb7a8eafa9595c160577547 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -383,7 +383,14 @@ public class ZenModeHelper {
|
|||||||
newConfig = mConfig.copy();
|
newConfig = mConfig.copy();
|
||||||
for (int i = newConfig.automaticRules.size() - 1; i >= 0; i--) {
|
for (int i = newConfig.automaticRules.size() - 1; i >= 0; i--) {
|
||||||
ZenRule rule = newConfig.automaticRules.get(newConfig.automaticRules.keyAt(i));
|
ZenRule rule = newConfig.automaticRules.get(newConfig.automaticRules.keyAt(i));
|
||||||
if (rule.pkg.equals(packageName) && canManageAutomaticZenRule(rule)) {
|
String pkg = rule.pkg != null
|
||||||
|
? rule.pkg
|
||||||
|
: (rule.component != null)
|
||||||
|
? rule.component.getPackageName()
|
||||||
|
: (rule.configurationActivity != null)
|
||||||
|
? rule.configurationActivity.getPackageName()
|
||||||
|
: null;
|
||||||
|
if (Objects.equals(pkg, packageName) && canManageAutomaticZenRule(rule)) {
|
||||||
newConfig.automaticRules.removeAt(i);
|
newConfig.automaticRules.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user