Skip to content

Commit f864401

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge changes I00665385,Ic76db232 into jb-mr1-dev
* changes: Send accessibility notification events only for the current user. No sound produced on global actions dialog pops up if no vibrator is present.
2 parents c194016 + c31ed39 commit f864401

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4302,6 +4302,9 @@ private boolean isGlobalAccessibilityGestureEnabled() {
43024302
}
43034303

43044304
public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always) {
4305+
if (!mVibrator.hasVibrator()) {
4306+
return false;
4307+
}
43054308
final boolean hapticsDisabled = Settings.System.getIntForUser(mContext.getContentResolver(),
43064309
Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) == 0;
43074310
if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,14 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
991991
| Notification.FLAG_NO_CLEAR;
992992
}
993993

994+
final int currentUser;
995+
final long token = Binder.clearCallingIdentity();
996+
try {
997+
currentUser = ActivityManager.getCurrentUser();
998+
} finally {
999+
Binder.restoreCallingIdentity(token);
1000+
}
1001+
9941002
if (notification.icon != 0) {
9951003
final StatusBarNotification n = new StatusBarNotification(
9961004
pkg, id, tag, r.uid, r.initialPid, score, notification, user);
@@ -1015,7 +1023,10 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10151023
Binder.restoreCallingIdentity(identity);
10161024
}
10171025
}
1018-
sendAccessibilityEvent(notification, pkg);
1026+
// Send accessibility events only for the current user.
1027+
if (currentUser == userId) {
1028+
sendAccessibilityEvent(notification, pkg);
1029+
}
10191030
} else {
10201031
Slog.e(TAG, "Ignoring notification with icon==0: " + notification);
10211032
if (old != null && old.statusBarKey != null) {
@@ -1029,14 +1040,6 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10291040
}
10301041
}
10311042

1032-
final int currentUser;
1033-
final long token = Binder.clearCallingIdentity();
1034-
try {
1035-
currentUser = ActivityManager.getCurrentUser();
1036-
} finally {
1037-
Binder.restoreCallingIdentity(token);
1038-
}
1039-
10401043
// If we're not supposed to beep, vibrate, etc. then don't.
10411044
if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0)
10421045
&& (!(old != null

0 commit comments

Comments
 (0)