diff options
author | Dan Sandler <dsandler@android.com> | 2014-02-24 18:38:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-24 18:38:12 +0000 |
commit | a6af10f82be80cc3394bbe45e3fd7dd240cd9a60 (patch) | |
tree | e69362e071e6490f76b56cb88676d462620e90f1 | |
parent | b0477c3ccc797f7d75f8ab4158bad98472bd2c57 (diff) | |
parent | 91d014a9658d63c141741414a998f1da89a4dbc6 (diff) | |
download | packages_apps_Settings-a6af10f82be80cc3394bbe45e3fd7dd240cd9a60.zip packages_apps_Settings-a6af10f82be80cc3394bbe45e3fd7dd240cd9a60.tar.gz packages_apps_Settings-a6af10f82be80cc3394bbe45e3fd7dd240cd9a60.tar.bz2 |
Merge "Settings>Security>Show notifications (on the lockscreen)."
-rw-r--r-- | res/values/strings.xml | 12 | ||||
-rw-r--r-- | res/xml/security_settings_biometric_weak.xml | 7 | ||||
-rw-r--r-- | res/xml/security_settings_password.xml | 7 | ||||
-rw-r--r-- | res/xml/security_settings_pattern.xml | 7 | ||||
-rw-r--r-- | res/xml/security_settings_pin.xml | 7 | ||||
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 32 |
6 files changed, 71 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index a5076e4..8cb1510 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4993,4 +4993,16 @@ <string name="dashboard_title">Overview</string> <string name="dashboard_wip" translatable="false">Overview - work in progress\n\nUse the Drawer on the left to see the settings list</string> + <!-- Notifications on lockscreen --> + <!-- Label for checkbox controlling the contents of notifications shown on + the secure lockscreen [CHAR LIMIT=16] --> + <string name="lock_screen_notifications">Show notifications</string> + <!-- Summary for lock_screen_notifications: sensitive information will be + hidden or redacted from notifications shown on a secure lock screen + [CHAR LIMIT=50] --> + <string name="lock_screen_notifications_summary_off">Sensitive notification contents will be hidden when locked</string> + <!-- Summary for lock_screen_notifications: all information will be + shown in notifications shown on a secure lock screen + [CHAR LIMIT=50] --> + <string name="lock_screen_notifications_summary_on">All notification contents will be shown when locked</string> </resources> diff --git a/res/xml/security_settings_biometric_weak.xml b/res/xml/security_settings_biometric_weak.xml index c2e8ab7..d994922 100644 --- a/res/xml/security_settings_biometric_weak.xml +++ b/res/xml/security_settings_biometric_weak.xml @@ -66,6 +66,13 @@ android:title="@string/nfc_unlock_title" android:persistent="false"/> + <CheckBoxPreference + android:key="toggle_lock_screen_notifications" + android:title="@string/lock_screen_notifications" + android:summaryOff="@string/lock_screen_notifications_summary_off" + android:summaryOn="@string/lock_screen_notifications_summary_on" + android:persistent="false" /> + </PreferenceCategory> </PreferenceScreen> diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml index a102efa..20d7644 100644 --- a/res/xml/security_settings_password.xml +++ b/res/xml/security_settings_password.xml @@ -53,6 +53,13 @@ android:title="@string/nfc_unlock_title" android:persistent="false"/> + <CheckBoxPreference + android:key="toggle_lock_screen_notifications" + android:title="@string/lock_screen_notifications" + android:summaryOff="@string/lock_screen_notifications_summary_off" + android:summaryOn="@string/lock_screen_notifications_summary_on" + android:persistent="false" /> + </PreferenceCategory> </PreferenceScreen> diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml index 0584e4a..c02df7a 100644 --- a/res/xml/security_settings_pattern.xml +++ b/res/xml/security_settings_pattern.xml @@ -57,6 +57,13 @@ android:title="@string/nfc_unlock_title" android:persistent="false"/> + <CheckBoxPreference + android:key="toggle_lock_screen_notifications" + android:title="@string/lock_screen_notifications" + android:summaryOff="@string/lock_screen_notifications_summary_off" + android:summaryOn="@string/lock_screen_notifications_summary_on" + android:persistent="false" /> + </PreferenceCategory> </PreferenceScreen> diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml index 1417e21..2636fa4 100644 --- a/res/xml/security_settings_pin.xml +++ b/res/xml/security_settings_pin.xml @@ -53,6 +53,13 @@ android:title="@string/nfc_unlock_title" android:persistent="false"/> + <CheckBoxPreference + android:key="toggle_lock_screen_notifications" + android:title="@string/lock_screen_notifications" + android:summaryOff="@string/lock_screen_notifications_summary_off" + android:summaryOn="@string/lock_screen_notifications_summary_on" + android:persistent="false" /> + </PreferenceCategory> </PreferenceScreen> diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index f75480b..84a07f2 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); |