Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -626,7 +626,6 @@ public class NotificationEntryManager implements entry = new NotificationEntry( notification, ranking, mFgsFeatureController.isForegroundServiceDismissalEnabled(), SystemClock.uptimeMillis()); mAllNotifications.add(entry); mLeakDetector.trackInstance(entry); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java +9 −2 Original line number Diff line number Diff line Loading @@ -56,10 +56,12 @@ import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.Pair; import android.util.Slog; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; Loading Loading @@ -240,6 +242,10 @@ public class NotifCollection implements Dumpable { Assert.isMainThread(); checkForReentrantCall(); // TODO (b/206842750): This method is called from (silent) clear all and non-clear all // contexts and should be checking the NO_CLEAR flag, rather than depending on NSSL // to pass in a properly filtered list of notifications final List<NotificationEntry> entriesToLocallyDismiss = new ArrayList<>(); for (int i = 0; i < entriesToDismiss.size(); i++) { NotificationEntry entry = entriesToDismiss.get(i).first; Loading Loading @@ -742,12 +748,13 @@ public class NotifCollection implements Dumpable { * * See NotificationManager.cancelGroupChildrenByListLocked() for corresponding code. */ private static boolean shouldAutoDismissChildren( @VisibleForTesting static boolean shouldAutoDismissChildren( NotificationEntry entry, String dismissedGroupKey) { return entry.getSbn().getGroupKey().equals(dismissedGroupKey) && !entry.getSbn().getNotification().isGroupSummary() && !hasFlag(entry, Notification.FLAG_FOREGROUND_SERVICE) && !hasFlag(entry, Notification.FLAG_ONGOING_EVENT) && !hasFlag(entry, Notification.FLAG_BUBBLE) && entry.getDismissState() != DISMISSED; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +20 −36 Original line number Diff line number Diff line Loading @@ -174,7 +174,6 @@ public final class NotificationEntry extends ListEntry { private boolean mAutoHeadsUp; private boolean mPulseSupressed; private boolean mAllowFgsDismissal; private int mBucket = BUCKET_ALERTING; @Nullable private Long mPendingAnimationDuration; private boolean mIsMarkedForUserTriggeredMovement; Loading @@ -192,14 +191,6 @@ public final class NotificationEntry extends ListEntry { public NotificationEntry( @NonNull StatusBarNotification sbn, @NonNull Ranking ranking, long creationTime) { this(sbn, ranking, false, creationTime); } public NotificationEntry( @NonNull StatusBarNotification sbn, @NonNull Ranking ranking, boolean allowFgsDismissal, long creationTime ) { super(requireNonNull(requireNonNull(sbn).getKey()), creationTime); Loading @@ -209,8 +200,6 @@ public final class NotificationEntry extends ListEntry { mKey = sbn.getKey(); setSbn(sbn); setRanking(ranking); mAllowFgsDismissal = allowFgsDismissal; } @Override Loading Loading @@ -743,13 +732,11 @@ public final class NotificationEntry extends ListEntry { /** * @return Can the underlying notification be cleared? This can be different from whether the * notification can be dismissed in case notifications are sensitive on the lockscreen. * @see #canViewBeDismissed() */ // TOOD: This logic doesn't belong on NotificationEntry. It should be moved to the // ForegroundsServiceDismissalFeatureController or some other controller that can be added // as a dependency to any class that needs to answer this question. // TODO: This logic doesn't belong on NotificationEntry. It should be moved to a controller // that can be added as a dependency to any class that needs to answer this question. public boolean isClearable() { if (!isDismissable()) { if (!mSbn.isClearable()) { return false; } Loading @@ -757,7 +744,7 @@ public final class NotificationEntry extends ListEntry { if (children != null && children.size() > 0) { for (int i = 0; i < children.size(); i++) { NotificationEntry child = children.get(i); if (!child.isDismissable()) { if (!child.getSbn().isClearable()) { return false; } } Loading @@ -766,28 +753,25 @@ public final class NotificationEntry extends ListEntry { } /** * Notifications might have any combination of flags: * - FLAG_ONGOING_EVENT * - FLAG_NO_CLEAR * - FLAG_FOREGROUND_SERVICE * * We want to allow dismissal of notifications that represent foreground services, which may * have all 3 flags set. If we only find NO_CLEAR though, we don't want to allow dismissal * @return Can the underlying notification be individually dismissed? * @see #canViewBeDismissed() */ private boolean isDismissable() { boolean ongoing = ((mSbn.getNotification().flags & Notification.FLAG_ONGOING_EVENT) != 0); boolean noclear = ((mSbn.getNotification().flags & Notification.FLAG_NO_CLEAR) != 0); boolean fgs = ((mSbn.getNotification().flags & FLAG_FOREGROUND_SERVICE) != 0); if (mAllowFgsDismissal) { if (noclear && !ongoing && !fgs) { // TODO: This logic doesn't belong on NotificationEntry. It should be moved to a controller // that can be added as a dependency to any class that needs to answer this question. public boolean isDismissable() { if (mSbn.isOngoing()) { return false; } return true; } else { return mSbn.isClearable(); List<NotificationEntry> children = getAttachedNotifChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size(); i++) { NotificationEntry child = children.get(i); if (child.getSbn().isOngoing()) { return false; } } } return true; } public boolean canViewBeDismissed() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class OnUserInteractionCallbackImpl implements OnUserInteractionCallback String group = entry.getSbn().getGroup(); if (mNotifCollection.isOnlyChildInGroup(entry)) { NotificationEntry summary = mNotifCollection.getGroupSummary(group); if (summary != null && summary.isClearable()) return summary; if (summary != null && summary.isDismissable()) return summary; } return null; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/OnUserInteractionCallbackImplLegacy.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class OnUserInteractionCallbackImplLegacy implements OnUserInteractionCal public NotificationEntry getGroupSummaryToDismiss(NotificationEntry entry) { if (mGroupMembershipManager.isOnlyChildInGroup(entry)) { NotificationEntry groupSummary = mGroupMembershipManager.getLogicalGroupSummary(entry); return groupSummary.isClearable() ? groupSummary : null; return groupSummary.isDismissable() ? groupSummary : null; } return null; } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -626,7 +626,6 @@ public class NotificationEntryManager implements entry = new NotificationEntry( notification, ranking, mFgsFeatureController.isForegroundServiceDismissalEnabled(), SystemClock.uptimeMillis()); mAllNotifications.add(entry); mLeakDetector.trackInstance(entry); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java +9 −2 Original line number Diff line number Diff line Loading @@ -56,10 +56,12 @@ import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.Pair; import android.util.Slog; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; Loading Loading @@ -240,6 +242,10 @@ public class NotifCollection implements Dumpable { Assert.isMainThread(); checkForReentrantCall(); // TODO (b/206842750): This method is called from (silent) clear all and non-clear all // contexts and should be checking the NO_CLEAR flag, rather than depending on NSSL // to pass in a properly filtered list of notifications final List<NotificationEntry> entriesToLocallyDismiss = new ArrayList<>(); for (int i = 0; i < entriesToDismiss.size(); i++) { NotificationEntry entry = entriesToDismiss.get(i).first; Loading Loading @@ -742,12 +748,13 @@ public class NotifCollection implements Dumpable { * * See NotificationManager.cancelGroupChildrenByListLocked() for corresponding code. */ private static boolean shouldAutoDismissChildren( @VisibleForTesting static boolean shouldAutoDismissChildren( NotificationEntry entry, String dismissedGroupKey) { return entry.getSbn().getGroupKey().equals(dismissedGroupKey) && !entry.getSbn().getNotification().isGroupSummary() && !hasFlag(entry, Notification.FLAG_FOREGROUND_SERVICE) && !hasFlag(entry, Notification.FLAG_ONGOING_EVENT) && !hasFlag(entry, Notification.FLAG_BUBBLE) && entry.getDismissState() != DISMISSED; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +20 −36 Original line number Diff line number Diff line Loading @@ -174,7 +174,6 @@ public final class NotificationEntry extends ListEntry { private boolean mAutoHeadsUp; private boolean mPulseSupressed; private boolean mAllowFgsDismissal; private int mBucket = BUCKET_ALERTING; @Nullable private Long mPendingAnimationDuration; private boolean mIsMarkedForUserTriggeredMovement; Loading @@ -192,14 +191,6 @@ public final class NotificationEntry extends ListEntry { public NotificationEntry( @NonNull StatusBarNotification sbn, @NonNull Ranking ranking, long creationTime) { this(sbn, ranking, false, creationTime); } public NotificationEntry( @NonNull StatusBarNotification sbn, @NonNull Ranking ranking, boolean allowFgsDismissal, long creationTime ) { super(requireNonNull(requireNonNull(sbn).getKey()), creationTime); Loading @@ -209,8 +200,6 @@ public final class NotificationEntry extends ListEntry { mKey = sbn.getKey(); setSbn(sbn); setRanking(ranking); mAllowFgsDismissal = allowFgsDismissal; } @Override Loading Loading @@ -743,13 +732,11 @@ public final class NotificationEntry extends ListEntry { /** * @return Can the underlying notification be cleared? This can be different from whether the * notification can be dismissed in case notifications are sensitive on the lockscreen. * @see #canViewBeDismissed() */ // TOOD: This logic doesn't belong on NotificationEntry. It should be moved to the // ForegroundsServiceDismissalFeatureController or some other controller that can be added // as a dependency to any class that needs to answer this question. // TODO: This logic doesn't belong on NotificationEntry. It should be moved to a controller // that can be added as a dependency to any class that needs to answer this question. public boolean isClearable() { if (!isDismissable()) { if (!mSbn.isClearable()) { return false; } Loading @@ -757,7 +744,7 @@ public final class NotificationEntry extends ListEntry { if (children != null && children.size() > 0) { for (int i = 0; i < children.size(); i++) { NotificationEntry child = children.get(i); if (!child.isDismissable()) { if (!child.getSbn().isClearable()) { return false; } } Loading @@ -766,28 +753,25 @@ public final class NotificationEntry extends ListEntry { } /** * Notifications might have any combination of flags: * - FLAG_ONGOING_EVENT * - FLAG_NO_CLEAR * - FLAG_FOREGROUND_SERVICE * * We want to allow dismissal of notifications that represent foreground services, which may * have all 3 flags set. If we only find NO_CLEAR though, we don't want to allow dismissal * @return Can the underlying notification be individually dismissed? * @see #canViewBeDismissed() */ private boolean isDismissable() { boolean ongoing = ((mSbn.getNotification().flags & Notification.FLAG_ONGOING_EVENT) != 0); boolean noclear = ((mSbn.getNotification().flags & Notification.FLAG_NO_CLEAR) != 0); boolean fgs = ((mSbn.getNotification().flags & FLAG_FOREGROUND_SERVICE) != 0); if (mAllowFgsDismissal) { if (noclear && !ongoing && !fgs) { // TODO: This logic doesn't belong on NotificationEntry. It should be moved to a controller // that can be added as a dependency to any class that needs to answer this question. public boolean isDismissable() { if (mSbn.isOngoing()) { return false; } return true; } else { return mSbn.isClearable(); List<NotificationEntry> children = getAttachedNotifChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size(); i++) { NotificationEntry child = children.get(i); if (child.getSbn().isOngoing()) { return false; } } } return true; } public boolean canViewBeDismissed() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class OnUserInteractionCallbackImpl implements OnUserInteractionCallback String group = entry.getSbn().getGroup(); if (mNotifCollection.isOnlyChildInGroup(entry)) { NotificationEntry summary = mNotifCollection.getGroupSummary(group); if (summary != null && summary.isClearable()) return summary; if (summary != null && summary.isDismissable()) return summary; } return null; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/OnUserInteractionCallbackImplLegacy.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class OnUserInteractionCallbackImplLegacy implements OnUserInteractionCal public NotificationEntry getGroupSummaryToDismiss(NotificationEntry entry) { if (mGroupMembershipManager.isOnlyChildInGroup(entry)) { NotificationEntry groupSummary = mGroupMembershipManager.getLogicalGroupSummary(entry); return groupSummary.isClearable() ? groupSummary : null; return groupSummary.isDismissable() ? groupSummary : null; } return null; } Loading