public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification";
/**
+ * If nonzero, will show the zen update settings suggestion.
+ * @hide
+ */
+ public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion";
+
+ /**
+ * If nonzero, zen has not been updated to reflect new changes.
+ * @hide
+ */
+ public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated";
+
+ /**
+ * If nonzero, zen setting suggestion has beem viewed by user
+ * @hide
+ */
+ public static final String ZEN_SETTINGS_SUGGESTION_VIEWED =
+ "zen_settings_suggestion_viewed";
+
+ /**
* Backup and restore agent timeout parameters.
* These parameters are represented by a comma-delimited key-value list.
*
Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG,
Settings.Global.SHOW_TEMPERATURE_WARNING,
Settings.Global.SHOW_ZEN_UPGRADE_NOTIFICATION,
+ Settings.Global.SHOW_ZEN_SETTINGS_SUGGESTION,
+ Settings.Global.ZEN_SETTINGS_UPDATED,
+ Settings.Global.ZEN_SETTINGS_SUGGESTION_VIEWED,
Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 165;
+ private static final int SETTINGS_VERSION = 166;
private final int mUserId;
}
if (currentVersion == 164) {
- // Version 164: Add a gesture for silencing phones
+ // Version 164: show zen upgrade notification
final SettingsState settings = getGlobalSettingsLocked();
final Setting currentSetting = settings.getSettingLocked(
Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
currentVersion = 165;
}
+ if (currentVersion == 165) {
+ // Version 165: Show zen settings suggestion and zen updated
+ final SettingsState settings = getGlobalSettingsLocked();
+ final Setting currentSetting = settings.getSettingLocked(
+ Global.SHOW_ZEN_SETTINGS_SUGGESTION);
+ if (currentSetting.isNull()) {
+ settings.insertSettingLocked(
+ Global.SHOW_ZEN_SETTINGS_SUGGESTION, "1",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+
+ final Setting currentUpdatedSetting = settings.getSettingLocked(
+ Global.ZEN_SETTINGS_UPDATED);
+ if (currentUpdatedSetting.isNull()) {
+ settings.insertSettingLocked(
+ Global.ZEN_SETTINGS_UPDATED, "0",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+
+ final Setting currentSettingSuggestionViewed = settings.getSettingLocked(
+ Global.ZEN_SETTINGS_SUGGESTION_VIEWED);
+ if (currentSettingSuggestionViewed.isNull()) {
+ settings.insertSettingLocked(
+ Global.ZEN_SETTINGS_SUGGESTION_VIEWED, "0",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+
+ currentVersion = 166;
+ }
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
public void setManualZenMode(int zenMode, Uri conditionId, String caller, String reason) {
setManualZenMode(zenMode, conditionId, reason, caller, true /*setRingerMode*/);
+ Settings.Global.putInt(mContext.getContentResolver(), Global.SHOW_ZEN_SETTINGS_SUGGESTION,
+ 0);
}
private void setManualZenMode(int zenMode, Uri conditionId, String reason, String caller,
appendDefaultRules(config);
reason += ", reset to default rules";
}
+ } else {
+ // devices not restoring/upgrading already have updated zen settings
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Global.ZEN_SETTINGS_UPDATED, 1);
}
if (DEBUG) Log.d(TAG, reason);
synchronized (mConfig) {
for (ZenRule automaticRule : mConfig.automaticRules.values()) {
if (automaticRule.isAutomaticActive()) {
if (zenSeverity(automaticRule.zenMode) > zenSeverity(zen)) {
+ // automatic rule triggered dnd and user hasn't seen update dnd dialog
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ Global.ZEN_SETTINGS_SUGGESTION_VIEWED, 1) == 0) {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Global.SHOW_ZEN_SETTINGS_SUGGESTION, 1);
+ }
zen = automaticRule.zenMode;
}
}