diff options
author | Julia Reynolds <juliacr@google.com> | 2015-08-14 19:17:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-14 19:17:31 +0000 |
commit | 7df411d0cced4a849bcdca58fa3c27eb731e0862 (patch) | |
tree | 4ef921b418eee6d18e34a4d375e063229f3785da /services | |
parent | 16fa58cb133f539016a5e013897c7de7f58ff16d (diff) | |
parent | ea6c4489598fce95ac0e22ff13290a9fb264db5a (diff) | |
download | frameworks_base-7df411d0cced4a849bcdca58fa3c27eb731e0862.zip frameworks_base-7df411d0cced4a849bcdca58fa3c27eb731e0862.tar.gz frameworks_base-7df411d0cced4a849bcdca58fa3c27eb731e0862.tar.bz2 |
Merge "Clear calling identity before getting the current user." into mnc-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 9426b76..4351798 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3615,22 +3615,28 @@ public class NotificationManagerService extends SystemService { public ArraySet<String> getGrantedPackages() { final ArraySet<String> pkgs = new ArraySet<>(); - final String setting = Settings.Secure.getStringForUser( - getContext().getContentResolver(), - Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, - ActivityManager.getCurrentUser()); - if (setting != null) { - final String[] tokens = setting.split(SEPARATOR); - for (int i = 0; i < tokens.length; i++) { - String token = tokens[i]; - if (token != null) { - token.trim(); - } - if (TextUtils.isEmpty(token)) { - continue; + + long identity = Binder.clearCallingIdentity(); + try { + final String setting = Settings.Secure.getStringForUser( + getContext().getContentResolver(), + Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, + ActivityManager.getCurrentUser()); + if (setting != null) { + final String[] tokens = setting.split(SEPARATOR); + for (int i = 0; i < tokens.length; i++) { + String token = tokens[i]; + if (token != null) { + token.trim(); + } + if (TextUtils.isEmpty(token)) { + continue; + } + pkgs.add(token); } - pkgs.add(token); } + } finally { + Binder.restoreCallingIdentity(identity); } return pkgs; } |