summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bernardo Rufino <brufino@google.com> 2020-01-29 15:45:38 +0000
committer Bernardo Rufino <brufino@google.com> 2020-01-29 15:45:38 +0000
commit3c584d624e659d5c1d471489e05f31f38df94691 (patch)
treeb86e043eace10e1cce1d88d2c0aab69193ace11f
parentc847a7ad12eb36ecad53f2e0b78370b02ad6ad54 (diff)
Surround platform-compat check with Binder.clearCallingIdentity()
Otherwise it fails permission check since it would use the caller's uid. Bug: 148521528 Test: Post a background custom toast and observe it either posts the toast or shows a textual warning toast (before this change, neither would happen and we'd see a SE in logcat). Change-Id: I338846bda08b8a002440dd3b1a43393f2ff25011
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index eea59ca26f34..11dd0ef9ea61 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2682,6 +2682,7 @@ public class NotificationManagerService extends SystemService {
if (callback != null && !appIsForeground && !isSystemToast) {
boolean block;
+ long id = Binder.clearCallingIdentity();
try {
block = mPlatformCompat.isChangeEnabledByPackageName(
CHANGE_BACKGROUND_CUSTOM_TOAST_BLOCK, pkg,
@@ -2691,6 +2692,8 @@ public class NotificationManagerService extends SystemService {
Slog.e(TAG, "Unexpected exception while checking block background custom toasts"
+ " change", e);
block = false;
+ } finally {
+ Binder.restoreCallingIdentity(id);
}
if (block) {
// TODO(b/144152069): Remove informative toast