Merge "DND Visual interruptions: don't turn screen on."
This commit is contained in:
committed by
Android (Google) Code Review
commit
a1049aea99
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user