am 8dd0bce6: am 4e65a05f: am ac5f9628: am 7df411d0: Merge "Clear calling identity before getting the current user." into mnc-dev
* commit '8dd0bce6174ffff075e8c780a5245b5c4a5df2a7':
Clear calling identity before getting the current user.
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 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();
+
+ 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);
}
- if (TextUtils.isEmpty(token)) {
- continue;
- }
- pkgs.add(token);
}
+ } finally {
+ Binder.restoreCallingIdentity(identity);
}
return pkgs;
}