DND Visual interruptions: don't turn screen on.
Change-Id: I15b66918e53e733c779cf8f79d12e03a213fb26d
This commit is contained in:
@@ -5991,6 +5991,12 @@
|
|||||||
<!-- [CHAR LIMIT=105] Zen mode settings: No notification light summary -->
|
<!-- [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>
|
<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
|
<!-- [CHAR LIMIT=NONE] Content description for per-app notification
|
||||||
settings button -->
|
settings button -->
|
||||||
<string name="notification_app_settings_button">Notification settings</string>
|
<string name="notification_app_settings_button">Notification settings</string>
|
||||||
|
@@ -28,4 +28,9 @@
|
|||||||
android:summary="@string/zen_mode_lights_summary"
|
android:summary="@string/zen_mode_lights_summary"
|
||||||
android:persistent="false" />
|
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>
|
</PreferenceScreen>
|
||||||
|
@@ -38,9 +38,11 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase {
|
|||||||
|
|
||||||
private static final String KEY_PEEK = "peek";
|
private static final String KEY_PEEK = "peek";
|
||||||
private static final String KEY_LIGHTS = "lights";
|
private static final String KEY_LIGHTS = "lights";
|
||||||
|
private static final String KEY_SCREEN_ON = "screen_on";
|
||||||
|
|
||||||
private SwitchPreference mPeek;
|
private SwitchPreference mPeek;
|
||||||
private SwitchPreference mLights;
|
private SwitchPreference mLights;
|
||||||
|
private SwitchPreference mScreenOn;
|
||||||
|
|
||||||
private boolean mDisableListeners;
|
private boolean mDisableListeners;
|
||||||
private NotificationManager.Policy mPolicy;
|
private NotificationManager.Policy mPolicy;
|
||||||
@@ -78,6 +80,19 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase {
|
|||||||
return true;
|
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
|
@Override
|
||||||
@@ -100,6 +115,7 @@ public class ZenModeVisualInterruptionSettings extends ZenModeSettingsBase {
|
|||||||
mDisableListeners = true;
|
mDisableListeners = true;
|
||||||
mPeek.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_PEEK));
|
mPeek.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_PEEK));
|
||||||
mLights.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_LIGHTS));
|
mLights.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_LIGHTS));
|
||||||
|
mScreenOn.setChecked(isEffectSuppressed(Policy.SUPPRESSED_EFFECT_SCREEN_ON));
|
||||||
mDisableListeners = false;
|
mDisableListeners = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user