Merge "Synchronize access of mSubscriptions"
This commit is contained in:
@@ -76,6 +76,8 @@ public class ZenModeConditions implements ConditionProviders.Callback {
|
|||||||
evaluateRule(automaticRule, current, processSubscriptions);
|
evaluateRule(automaticRule, current, processSubscriptions);
|
||||||
updateSnoozing(automaticRule);
|
updateSnoozing(automaticRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized (mSubscriptions) {
|
||||||
final int N = mSubscriptions.size();
|
final int N = mSubscriptions.size();
|
||||||
for (int i = N - 1; i >= 0; i--) {
|
for (int i = N - 1; i >= 0; i--) {
|
||||||
final Uri id = mSubscriptions.keyAt(i);
|
final Uri id = mSubscriptions.keyAt(i);
|
||||||
@@ -87,6 +89,7 @@ public class ZenModeConditions implements ConditionProviders.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mFirstEvaluation = false;
|
mFirstEvaluation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +155,9 @@ public class ZenModeConditions implements ConditionProviders.Callback {
|
|||||||
}
|
}
|
||||||
if (processSubscriptions) {
|
if (processSubscriptions) {
|
||||||
if (mConditionProviders.subscribeIfNecessary(rule.component, rule.conditionId)) {
|
if (mConditionProviders.subscribeIfNecessary(rule.component, rule.conditionId)) {
|
||||||
|
synchronized (mSubscriptions) {
|
||||||
mSubscriptions.put(rule.conditionId, rule.component);
|
mSubscriptions.put(rule.conditionId, rule.component);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(TAG, "zmc failed to subscribe");
|
if (DEBUG) Log.d(TAG, "zmc failed to subscribe");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user