Implement per-app sensitivity settings toggle.

Change-Id: I0e70e6ce5c4a56d738c1850c50c2e268296d9d92
Depends-On: I2d5cf6782273744cbf9b309dec76780cc0a4c39e
Bug: 16324353
This commit is contained in:
Chris Wren
2014-09-02 17:26:17 -04:00
parent d6cfeba9f7
commit 56131de741
3 changed files with 32 additions and 6 deletions

View File

@@ -136,7 +136,9 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE);
final boolean secure = new LockPatternUtils(getActivity()).isSecure();
if (!secure) {
final boolean enabled = getLockscreenNotificationsEnabled();
final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
if (!secure || !enabled || !allowPrivate) {
getPreferenceScreen().removePreference(mSensitive);
}
@@ -186,6 +188,16 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
}
}
private boolean getLockscreenNotificationsEnabled() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0;
}
private boolean getLockscreenAllowPrivateNotifications() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
}
private void toastAndFinish() {
Toast.makeText(mContext, R.string.app_not_found_dlg_text, Toast.LENGTH_SHORT).show();
getActivity().finish();