use of android.service.notification.ZenModeConfig in project android_frameworks_base by DirtyUnicorns.
the class ZenModeHelper method loadConfigForUser.
private void loadConfigForUser(int user, String reason) {
if (mUser == user || user < UserHandle.USER_SYSTEM)
return;
mUser = user;
if (DEBUG)
Log.d(TAG, reason + " u=" + user);
ZenModeConfig config = mConfigs.get(user);
if (config == null) {
if (DEBUG)
Log.d(TAG, reason + " generating default config for user " + user);
config = mDefaultConfig.copy();
config.user = user;
}
synchronized (mConfig) {
setConfigLocked(config, reason);
}
cleanUpZenRules();
}
use of android.service.notification.ZenModeConfig in project android_frameworks_base by DirtyUnicorns.
the class ZenModeConditions method onConditionChanged.
@Override
public void onConditionChanged(Uri id, Condition condition) {
if (DEBUG)
Log.d(TAG, "onConditionChanged " + id + " " + condition);
ZenModeConfig config = mHelper.getConfig();
if (config == null)
return;
boolean updated = updateCondition(id, condition, config.manualRule);
for (ZenRule automaticRule : config.automaticRules.values()) {
updated |= updateCondition(id, condition, automaticRule);
updated |= updateSnoozing(automaticRule);
}
if (updated) {
mHelper.setConfig(config, "conditionChanged");
}
}
use of android.service.notification.ZenModeConfig in project android_frameworks_base by ResurrectionRemix.
the class ZenModeControllerImpl method updateZenModeConfig.
private void updateZenModeConfig() {
final ZenModeConfig config = mNoMan.getZenModeConfig();
if (Objects.equals(config, mConfig))
return;
final ZenRule oldRule = mConfig != null ? mConfig.manualRule : null;
mConfig = config;
fireConfigChanged(config);
final ZenRule newRule = config != null ? config.manualRule : null;
if (Objects.equals(oldRule, newRule))
return;
fireManualRuleChanged(newRule);
}
use of android.service.notification.ZenModeConfig in project platform_frameworks_base by android.
the class ZenModeHelper method setManualZenMode.
private void setManualZenMode(int zenMode, Uri conditionId, String reason, String caller, boolean setRingerMode) {
ZenModeConfig newConfig;
synchronized (mConfig) {
if (mConfig == null)
return;
if (!Global.isValidZenMode(zenMode))
return;
if (DEBUG)
Log.d(TAG, "setManualZenMode " + Global.zenModeToString(zenMode) + " conditionId=" + conditionId + " reason=" + reason + " setRingerMode=" + setRingerMode);
newConfig = mConfig.copy();
if (zenMode == Global.ZEN_MODE_OFF) {
newConfig.manualRule = null;
for (ZenRule automaticRule : newConfig.automaticRules.values()) {
if (automaticRule.isAutomaticActive()) {
automaticRule.snoozing = true;
}
}
} else {
final ZenRule newRule = new ZenRule();
newRule.enabled = true;
newRule.zenMode = zenMode;
newRule.conditionId = conditionId;
newRule.enabler = caller;
newConfig.manualRule = newRule;
}
setConfigLocked(newConfig, reason, setRingerMode);
}
}
use of android.service.notification.ZenModeConfig in project platform_frameworks_base by android.
the class ZenModeConditions method onConditionChanged.
@Override
public void onConditionChanged(Uri id, Condition condition) {
if (DEBUG)
Log.d(TAG, "onConditionChanged " + id + " " + condition);
ZenModeConfig config = mHelper.getConfig();
if (config == null)
return;
boolean updated = updateCondition(id, condition, config.manualRule);
for (ZenRule automaticRule : config.automaticRules.values()) {
updated |= updateCondition(id, condition, automaticRule);
updated |= updateSnoozing(automaticRule);
}
if (updated) {
mHelper.setConfig(config, "conditionChanged");
}
}
Aggregations