Always apply config updates.

In case the config and global settings are mismatched.

Bug: 29617474
Change-Id: I3a3ae338dce45c7c7e579d56f6d05b581e0dd8f7
This commit is contained in:
Julia Reynolds
2016-06-28 10:01:28 -04:00
parent 5e41f90a92
commit 81a560a90d

View File

@@ -332,14 +332,16 @@ public class ZenModeHelper {
}
mConditions.evaluateConfig(config, false /*processSubscriptions*/); // may modify config
mConfigs.put(config.user, config);
if (config.equals(mConfig)) return true;
if (DEBUG) Log.d(TAG, "setConfig reason=" + reason, new Throwable());
ZenLog.traceConfig(reason, mConfig, config);
final boolean policyChanged = !Objects.equals(getNotificationPolicy(mConfig),
getNotificationPolicy(config));
boolean configChanged = !config.equals(mConfig);
mConfig = config;
dispatchOnConfigChanged();
if (policyChanged){
if (configChanged) {
dispatchOnConfigChanged();
}
if (policyChanged) {
dispatchOnPolicyChanged();
}
final String val = Integer.toString(mConfig.hashCode());
@@ -372,9 +374,9 @@ public class ZenModeHelper {
private boolean evaluateZenMode(String reason, boolean setRingerMode) {
if (DEBUG) Log.d(TAG, "evaluateZenMode");
final int zenBefore = mZenMode;
final ArraySet<ZenRule> automaticRules = new ArraySet<ZenRule>();
final int zen = computeZenMode(automaticRules);
if (zen == mZenMode) return false;
ZenLog.traceSetZenMode(zen, reason);
mZenMode = zen;
updateRingerModeAffectedStreams();
@@ -383,7 +385,9 @@ public class ZenModeHelper {
applyZenToRingerMode();
}
applyRestrictions();
mHandler.postDispatchOnZenModeChanged();
if (zen != zenBefore) {
mHandler.postDispatchOnZenModeChanged();
}
return true;
}