Loading res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -5991,6 +5991,12 @@ <!-- [CHAR LIMIT=105] Zen mode settings: No notification light summary --> <string name="zen_mode_lights_summary">Prevent notifications silenced by Do Not Disturb from causing the light to pulse</string> <!-- [CHAR LIMIT=40] Zen mode settings: Don't turn the screen on option --> <string name="zen_mode_screen_on">Never turn on the screen</string> <!-- [CHAR LIMIT=130] Zen mode settings: Don't turn the screen on summary --> <string name="zen_mode_screen_on_summary">If the screen is off, prevent notifications silenced by Do Not Disturb from turning it on</string> <!-- [CHAR LIMIT=NONE] Content description for per-app notification settings button --> <string name="notification_app_settings_button">Notification settings</string> Loading res/xml/zen_mode_visual_interruptions_settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -28,4 +28,9 @@ android:summary="@string/zen_mode_lights_summary" android:persistent="false" /> <SwitchPreference android:key="screen_on" android:title="@string/zen_mode_screen_on" android:summary="@string/zen_mode_screen_on_summary" android:persistent="false" /> </PreferenceScreen> src/com/android/settings/notification/ZenModeVisualInterruptionSettings.java +16 −0 Original line number Diff line number Diff line Loading @@ -38,9 +38,11 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { private static final String KEY_PEEK = "peek"; private static final String KEY_LIGHTS = "lights"; private static final String KEY_SCREEN_ON = "screen_on"; private SwitchPreference mPeek; private SwitchPreference mLights; private SwitchPreference mScreenOn; private boolean mDisableListeners; private NotificationManager.Policy mPolicy; Loading Loading @@ -78,6 +80,19 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { return true; } }); mScreenOn = (SwitchPreference) root.findPreference(KEY_SCREEN_ON); mScreenOn.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (mDisableListeners) return true; final boolean val = (Boolean) newValue; MetricsLogger.action(mContext, MetricsLogger.ACTION_ZEN_ALLOW_SCREEN_ON, val); if (DEBUG) Log.d(TAG, "onPrefChange suppressScreenOn=" + val); savePolicy(getNewSuppressedEffects(val, Policy.SUPPRESSED_EFFECT_SCREEN_ON)); return true; } }); } @Override Loading @@ -100,6 +115,7 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { mDisableListeners = true; mPeek.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_PEEK)); mLights.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_LIGHTS)); mScreenOn.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_SCREEN_ON)); mDisableListeners = false; } Loading Loading
res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -5991,6 +5991,12 @@ <!-- [CHAR LIMIT=105] Zen mode settings: No notification light summary --> <string name="zen_mode_lights_summary">Prevent notifications silenced by Do Not Disturb from causing the light to pulse</string> <!-- [CHAR LIMIT=40] Zen mode settings: Don't turn the screen on option --> <string name="zen_mode_screen_on">Never turn on the screen</string> <!-- [CHAR LIMIT=130] Zen mode settings: Don't turn the screen on summary --> <string name="zen_mode_screen_on_summary">If the screen is off, prevent notifications silenced by Do Not Disturb from turning it on</string> <!-- [CHAR LIMIT=NONE] Content description for per-app notification settings button --> <string name="notification_app_settings_button">Notification settings</string> Loading
res/xml/zen_mode_visual_interruptions_settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -28,4 +28,9 @@ android:summary="@string/zen_mode_lights_summary" android:persistent="false" /> <SwitchPreference android:key="screen_on" android:title="@string/zen_mode_screen_on" android:summary="@string/zen_mode_screen_on_summary" android:persistent="false" /> </PreferenceScreen>
src/com/android/settings/notification/ZenModeVisualInterruptionSettings.java +16 −0 Original line number Diff line number Diff line Loading @@ -38,9 +38,11 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { private static final String KEY_PEEK = "peek"; private static final String KEY_LIGHTS = "lights"; private static final String KEY_SCREEN_ON = "screen_on"; private SwitchPreference mPeek; private SwitchPreference mLights; private SwitchPreference mScreenOn; private boolean mDisableListeners; private NotificationManager.Policy mPolicy; Loading Loading @@ -78,6 +80,19 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { return true; } }); mScreenOn = (SwitchPreference) root.findPreference(KEY_SCREEN_ON); mScreenOn.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (mDisableListeners) return true; final boolean val = (Boolean) newValue; MetricsLogger.action(mContext, MetricsLogger.ACTION_ZEN_ALLOW_SCREEN_ON, val); if (DEBUG) Log.d(TAG, "onPrefChange suppressScreenOn=" + val); savePolicy(getNewSuppressedEffects(val, Policy.SUPPRESSED_EFFECT_SCREEN_ON)); return true; } }); } @Override Loading @@ -100,6 +115,7 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase { mDisableListeners = true; mPeek.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_PEEK)); mLights.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_LIGHTS)); mScreenOn.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_SCREEN_ON)); mDisableListeners = false; } Loading