summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/SecuritySettings.java
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2013-04-04 14:30:04 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-05 19:57:03 +0000
commit79b9bfe56ee4036fbe8d9bcac01260356309ae2f (patch)
treea40f853e0ac2450d45525407fbc9da7a6ebbba12 /src/com/android/settings/SecuritySettings.java
parente44f5e2bd6624f5df91e2676b1ef5e3ddf279066 (diff)
downloadpackages_apps_Settings-79b9bfe56ee4036fbe8d9bcac01260356309ae2f.zip
packages_apps_Settings-79b9bfe56ee4036fbe8d9bcac01260356309ae2f.tar.gz
packages_apps_Settings-79b9bfe56ee4036fbe8d9bcac01260356309ae2f.tar.bz2
Notification listeners can be enabled in Settings>Security.
Also known as android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS. Bug: 8454150 Change-Id: I0c2433bf58ba4c78cd461326bd014535c7f67578
Diffstat (limited to 'src/com/android/settings/SecuritySettings.java')
-rw-r--r--src/com/android/settings/SecuritySettings.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 971a196..d75d630 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -79,6 +79,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications";
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 PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
DevicePolicyManager mDPM;
@@ -100,6 +101,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
private CheckBoxPreference mToggleVerifyApps;
private CheckBoxPreference mPowerButtonInstantlyLocks;
+ private Preference mNotificationAccess;
+
private boolean mIsPrimary;
@Override
@@ -283,9 +286,28 @@ public class SecuritySettings extends SettingsPreferenceFragment
}
}
+ final int n = getNumEnabledNotificationListeners();
+ mNotificationAccess = findPreference(KEY_NOTIFICATION_ACCESS);
+ if (n == 0) {
+ mNotificationAccess.setSummary(getResources().getString(
+ R.string.manage_notification_access_summary_zero));
+ } else {
+ mNotificationAccess.setSummary(String.format(getResources().getQuantityString(
+ R.plurals.manage_notification_access_summary_nonzero,
+ n, n)));
+ }
+
return root;
}
+ private int getNumEnabledNotificationListeners() {
+ final String flat = Settings.Secure.getString(getContentResolver(),
+ Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
+ if (flat == null || "".equals(flat)) return 0;
+ final String[] components = flat.split(":");
+ return components.length;
+ }
+
private boolean isNonMarketAppsAllowed() {
return Settings.Global.getInt(getContentResolver(),
Settings.Global.INSTALL_NON_MARKET_APPS, 0) > 0;