DO NOT MERGE Updating the method name to match the functionality
Bug: 136283226
Test: Manual
Change-Id: I563f88d5c1a0c466442921352c36f4a4d7fc8168
diff --git a/src/com/android/car/notification/CarNotificationListener.java b/src/com/android/car/notification/CarNotificationListener.java
index d2c33bd..f121736 100644
--- a/src/com/android/car/notification/CarNotificationListener.java
+++ b/src/com/android/car/notification/CarNotificationListener.java
@@ -108,7 +108,7 @@
@Override
public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) {
- if (isNotificationFromCurrentUser(sbn)) {
+ if (!isNotificationForCurrentUser(sbn)) {
return;
}
mRankingMap = rankingMap;
@@ -156,7 +156,7 @@
*/
Map<String, StatusBarNotification> getNotifications() {
return mActiveNotifications.entrySet().stream()
- .filter(x -> (!isNotificationFromCurrentUser(x.getValue())))
+ .filter(x -> (isNotificationForCurrentUser(x.getValue())))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
@@ -180,14 +180,11 @@
mHandler = handler;
}
- private boolean isNotificationFromCurrentUser(StatusBarNotification sbn) {
+ private boolean isNotificationForCurrentUser(StatusBarNotification sbn) {
// Notifications should only be shown for the current user and the the notifications from
// the system when CarNotification is running as SystemUI component.
- if (sbn.getUser().getIdentifier() != ActivityManager.getCurrentUser()
- && sbn.getUser().getIdentifier() != UserHandle.USER_ALL) {
- return true;
- }
- return false;
+ return (sbn.getUser().getIdentifier() == ActivityManager.getCurrentUser()
+ || sbn.getUser().getIdentifier() == UserHandle.USER_ALL);
}
private void notifyNotificationRemoved(StatusBarNotification sbn) {