Skip to content

Commit d7eece3

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Clear identity when requesting current user." into jb-mr1-dev
2 parents b06ccdf + b78738f commit d7eece3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

services/java/com/android/server/NotificationManagerService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,12 +1029,20 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10291029
}
10301030
}
10311031

1032+
final int currentUser;
1033+
final long token = Binder.clearCallingIdentity();
1034+
try {
1035+
currentUser = ActivityManager.getCurrentUser();
1036+
} finally {
1037+
Binder.restoreCallingIdentity(token);
1038+
}
1039+
10321040
// If we're not supposed to beep, vibrate, etc. then don't.
10331041
if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0)
10341042
&& (!(old != null
10351043
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
10361044
&& (r.userId == UserHandle.USER_ALL ||
1037-
(r.userId == userId && r.userId == ActivityManager.getCurrentUser()))
1045+
(r.userId == userId && r.userId == currentUser))
10381046
&& mSystemReady) {
10391047

10401048
final AudioManager audioManager = (AudioManager) mContext

0 commit comments

Comments
 (0)