Implement per-app sensitivity settings toggle.

Change-Id: Iaa1de63b720bf93bdf432117604740e509fe3ab0
Depends-On: I2d5cf6782273744cbf9b309dec76780cc0a4c39e
Bug: 16324353
This commit is contained in:
Chris Wren
2014-09-04 15:20:05 +00:00
parent ee846f8828
commit 3d903185c7
3 changed files with 33 additions and 6 deletions

View File

@@ -137,7 +137,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);
}
@@ -193,6 +195,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();