From b78738fa06b092f910ffb39989dfb700d6b21788 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 5 Oct 2012 16:03:01 -0700 Subject: [PATCH] Clear identity when requesting current user. Bug: 7298189 Change-Id: Ie9c160f12067f1b9426acbfee67ef81e8f5f7992 --- .../com/android/server/NotificationManagerService.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index a3921c01d0575..85b488c9e1a2d 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1029,12 +1029,20 @@ public class NotificationManagerService extends INotificationManager.Stub } } + final int currentUser; + final long token = Binder.clearCallingIdentity(); + try { + currentUser = ActivityManager.getCurrentUser(); + } finally { + Binder.restoreCallingIdentity(token); + } + // If we're not supposed to beep, vibrate, etc. then don't. if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0) && (!(old != null && (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 )) && (r.userId == UserHandle.USER_ALL || - (r.userId == userId && r.userId == ActivityManager.getCurrentUser())) + (r.userId == userId && r.userId == currentUser)) && mSystemReady) { final AudioManager audioManager = (AudioManager) mContext