Fix NPE when deleting old zen rules
Test: manually revoke access for a DND app that has rules
created before and after b/189332346
Bug: 191773100
Bug: 189332346
Bug: 235823407
Change-Id: I069fcc124af24227fa50b61d4fc55d6dadc7a20b
Merged-In: I069fcc124af24227fa50b61d4fc55d6dadc7a20b
(cherry picked from commit b4fe101e5e)
This commit is contained in:
@@ -405,7 +405,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