Merge "Always apply config updates." into mnc-dr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f437bd068c
@@ -332,14 +332,16 @@ public class ZenModeHelper {
|
|||||||
}
|
}
|
||||||
mConditions.evaluateConfig(config, false /*processSubscriptions*/); // may modify config
|
mConditions.evaluateConfig(config, false /*processSubscriptions*/); // may modify config
|
||||||
mConfigs.put(config.user, config);
|
mConfigs.put(config.user, config);
|
||||||
if (config.equals(mConfig)) return true;
|
|
||||||
if (DEBUG) Log.d(TAG, "setConfig reason=" + reason, new Throwable());
|
if (DEBUG) Log.d(TAG, "setConfig reason=" + reason, new Throwable());
|
||||||
ZenLog.traceConfig(reason, mConfig, config);
|
ZenLog.traceConfig(reason, mConfig, config);
|
||||||
final boolean policyChanged = !Objects.equals(getNotificationPolicy(mConfig),
|
final boolean policyChanged = !Objects.equals(getNotificationPolicy(mConfig),
|
||||||
getNotificationPolicy(config));
|
getNotificationPolicy(config));
|
||||||
|
boolean configChanged = !config.equals(mConfig);
|
||||||
mConfig = config;
|
mConfig = config;
|
||||||
dispatchOnConfigChanged();
|
if (configChanged) {
|
||||||
if (policyChanged){
|
dispatchOnConfigChanged();
|
||||||
|
}
|
||||||
|
if (policyChanged) {
|
||||||
dispatchOnPolicyChanged();
|
dispatchOnPolicyChanged();
|
||||||
}
|
}
|
||||||
final String val = Integer.toString(mConfig.hashCode());
|
final String val = Integer.toString(mConfig.hashCode());
|
||||||
@@ -372,9 +374,9 @@ public class ZenModeHelper {
|
|||||||
|
|
||||||
private boolean evaluateZenMode(String reason, boolean setRingerMode) {
|
private boolean evaluateZenMode(String reason, boolean setRingerMode) {
|
||||||
if (DEBUG) Log.d(TAG, "evaluateZenMode");
|
if (DEBUG) Log.d(TAG, "evaluateZenMode");
|
||||||
|
final int zenBefore = mZenMode;
|
||||||
final ArraySet<ZenRule> automaticRules = new ArraySet<ZenRule>();
|
final ArraySet<ZenRule> automaticRules = new ArraySet<ZenRule>();
|
||||||
final int zen = computeZenMode(automaticRules);
|
final int zen = computeZenMode(automaticRules);
|
||||||
if (zen == mZenMode) return false;
|
|
||||||
ZenLog.traceSetZenMode(zen, reason);
|
ZenLog.traceSetZenMode(zen, reason);
|
||||||
mZenMode = zen;
|
mZenMode = zen;
|
||||||
updateRingerModeAffectedStreams();
|
updateRingerModeAffectedStreams();
|
||||||
@@ -383,7 +385,9 @@ public class ZenModeHelper {
|
|||||||
applyZenToRingerMode();
|
applyZenToRingerMode();
|
||||||
}
|
}
|
||||||
applyRestrictions();
|
applyRestrictions();
|
||||||
mHandler.postDispatchOnZenModeChanged();
|
if (zen != zenBefore) {
|
||||||
|
mHandler.postDispatchOnZenModeChanged();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user