diff options
author | Dan Sandler <dsandler@android.com> | 2014-02-19 14:42:55 -0500 |
---|---|---|
committer | Dan Sandler <dsandler@android.com> | 2014-02-24 01:28:49 +0000 |
commit | 91d014a9658d63c141741414a998f1da89a4dbc6 (patch) | |
tree | 6c989a56dd3343446617cc923dcd4a321e6a4bbc /src/com | |
parent | dba5623a0b6ddec7c56a23e516f4f39be02bd0b0 (diff) | |
download | packages_apps_Settings-91d014a9658d63c141741414a998f1da89a4dbc6.tar.gz packages_apps_Settings-91d014a9658d63c141741414a998f1da89a4dbc6.tar.bz2 packages_apps_Settings-91d014a9658d63c141741414a998f1da89a4dbc6.zip |
Settings>Security>Show notifications (on the lockscreen).
Allows the user to toggle
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
which if set shows the complete private contents of that
user's notifications atop a securely locked screen. When
unset, only the "public" versions of notifications are shown
(which may include explicit redactions made by the app).
See f/b change I32bb7939 for details.
This checkbox is hidden for insecure keyguards ("off" and
"none"). It is also unavailable if
Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS is not set
(see f/b change I9c517949.)
Change-Id: Ie1b4c6b949b597b97e536d8ea7e35c9de9b6995f
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index f75480bca..84a07f235 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -31,7 +31,6 @@ import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.nfc.NfcUnlock; import android.os.Bundle; -import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.CheckBoxPreference; @@ -86,6 +85,7 @@ public class SecuritySettings extends RestrictedSettingsFragment private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks"; private static final String KEY_CREDENTIALS_MANAGER = "credentials_management"; private static final String KEY_NOTIFICATION_ACCESS = "manage_notification_access"; + private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "toggle_lock_screen_notifications"; private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive"; private PackageManager mPM; @@ -110,6 +110,7 @@ public class SecuritySettings extends RestrictedSettingsFragment private CheckBoxPreference mEnableKeyguardWidgets; private Preference mNotificationAccess; + private CheckBoxPreference mLockscreenNotifications; private boolean mIsPrimary; @@ -355,9 +356,34 @@ public class SecuritySettings extends RestrictedSettingsFragment protectByRestrictions(mResetCredentials); protectByRestrictions(root.findPreference(KEY_CREDENTIALS_INSTALL)); } + + mLockscreenNotifications + = (CheckBoxPreference) root.findPreference(KEY_LOCK_SCREEN_NOTIFICATIONS); + if (mLockscreenNotifications != null) { + if (!getDeviceLockscreenNotificationsEnabled()) { + final PreferenceGroup lockscreenCategory = + (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY); + if (lockscreenCategory != null) { + lockscreenCategory.removePreference(mLockscreenNotifications); + } + } else { + mLockscreenNotifications.setChecked(getLockscreenAllowPrivateNotifications()); + } + } + return root; } + private boolean getDeviceLockscreenNotificationsEnabled() { + return 0 != Settings.Global.getInt(getContentResolver(), + Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0); + } + + private boolean getLockscreenAllowPrivateNotifications() { + return 0 != Settings.Secure.getInt(getContentResolver(), + Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0); + } + private int getNumEnabledNotificationListeners() { final String flat = Settings.Secure.getString(getContentResolver(), Settings.Secure.ENABLED_NOTIFICATION_LISTENERS); @@ -591,6 +617,10 @@ public class SecuritySettings extends RestrictedSettingsFragment } else if (KEY_TOGGLE_VERIFY_APPLICATIONS.equals(key)) { Settings.Global.putInt(getContentResolver(), Settings.Global.PACKAGE_VERIFIER_ENABLE, mToggleVerifyApps.isChecked() ? 1 : 0); + } else if (KEY_LOCK_SCREEN_NOTIFICATIONS.equals(key)) { + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, + mLockscreenNotifications.isChecked() ? 1 : 0); } else { // If we didn't handle it, let preferences handle it. return super.onPreferenceTreeClick(preferenceScreen, preference); |