diff options
3 files changed, 15 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index f2c4f70da6c6..2ba25d76135f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -73,7 +73,6 @@ import android.widget.ScrollView; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.graphics.ColorUtils; -import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.keyguard.KeyguardSliceView; import com.android.settingslib.Utils; @@ -261,6 +260,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable protected EmptyShadeView mEmptyShadeView; private boolean mDismissAllInProgress; private boolean mFadeNotificationsOnDismiss; + private FooterDismissListener mFooterDismissListener; /** * Was the scroller scrolled to the top when the down motion was observed? @@ -448,8 +448,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private final Rect mTmpRect = new Rect(); private DismissListener mDismissListener; private DismissAllAnimationListener mDismissAllAnimationListener; - @VisibleForTesting - protected final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class); private final NotificationRemoteInputManager mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class); @@ -5328,9 +5326,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @VisibleForTesting - void clearNotifications( - @SelectedRows int selection, - boolean closeShade) { + void clearNotifications(@SelectedRows int selection, boolean closeShade) { // animate-swipe all dismissable notifications, then animate the shade closed int numChildren = getChildCount(); @@ -5463,7 +5459,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable FooterView footerView = (FooterView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_notification_footer, this, false); footerView.setDismissButtonClickListener(v -> { - mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES); + if (mFooterDismissListener != null) { + mFooterDismissListener.onDismiss(); + } clearNotifications(ROWS_ALL, true /* closeShade */); }); footerView.setManageButtonClickListener(v -> { @@ -5692,6 +5690,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mHighPriorityBeforeSpeedBump = highPriorityBeforeSpeedBump; } + void setFooterDismissListener(FooterDismissListener listener) { + mFooterDismissListener = listener; + } + /** * A listener that is notified when the empty space below the notifications is clicked on */ @@ -6303,6 +6305,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable void onDismiss(@SelectedRows int selectedRows); } + interface FooterDismissListener { + void onDismiss(); + } + interface DismissAllAnimationListener { void onAnimationEnd( List<ExpandableNotificationRow> viewsToRemove, @SelectedRows int selectedRows); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index e07375f76a3b..96649afca36b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -628,6 +628,8 @@ public class NotificationStackScrollLayoutController { mView.setDismissAllAnimationListener(this::onAnimationEnd); mView.setDismissListener((selection) -> mUiEventLogger.log( NotificationPanelEvent.fromSelection(selection))); + mView.setFooterDismissListener(() -> + mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES)); if (mFgFeatureController.isForegroundServiceDismissalEnabled()) { mView.initializeForegroundServiceSection( diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index cda94c4fdf41..564d946352c7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -97,7 +97,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private EmptyShadeView mEmptyShadeView; @Mock private NotificationRemoteInputManager mRemoteInputManager; @Mock private RemoteInputController mRemoteInputController; - @Mock private MetricsLogger mMetricsLogger; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider; @Mock private NotificationSectionsManager mNotificationSectionsManager; @@ -125,7 +124,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { NotificationBlockingHelperManager.class, mBlockingHelperManager); mDependency.injectTestDependency(SysuiStatusBarStateController.class, mBarState); - mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); mDependency.injectTestDependency(NotificationRemoteInputManager.class, mRemoteInputManager); mDependency.injectMockDependency(ShadeController.class); |