diff options
author | 2025-03-13 14:12:26 -0700 | |
---|---|---|
committer | 2025-03-13 14:12:26 -0700 | |
commit | 35b49cfff5a4e6346f80690c936321d14d53365c (patch) | |
tree | 7abeaac122461ea2af7667d84fd2dcfaca5fab90 | |
parent | 158797c61f79e5642d867a00cec2cbc42d492311 (diff) | |
parent | 9c4dfaa7aaac14c342e8f733bd29176d17c47c86 (diff) |
Merge "Migrate NotificationClick to EntryAdapter" into main
7 files changed, 21 insertions, 19 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt index 9faab58913f0..101874807474 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt @@ -127,7 +127,7 @@ class BundleEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBubble() { - assertThat(underTest.isBubbleCapable).isFalse() + assertThat(underTest.isBubble).isFalse() } @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt index 12ade62c3570..7449064bc65b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt @@ -110,7 +110,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRow_adapter() { - val row = Mockito.mock(ExpandableNotificationRow::class.java) + val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() @@ -128,7 +128,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter_groupSummary() { - val row = Mockito.mock(ExpandableNotificationRow::class.java) + val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) @@ -175,7 +175,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isClearable_adapter() { - val row = Mockito.mock(ExpandableNotificationRow::class.java) + val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() @@ -193,7 +193,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSummarization_adapter() { - val row = Mockito.mock(ExpandableNotificationRow::class.java) + val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() @@ -213,7 +213,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getIcons_adapter() { - val row = Mockito.mock(ExpandableNotificationRow::class.java) + val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() @@ -258,7 +258,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canDragAndDrop() { - val pi = Mockito.mock(PendingIntent::class.java) + val pi = mock(PendingIntent::class.java) Mockito.`when`(pi.isActivity).thenReturn(true) val notification: Notification = Notification.Builder(mContext, "") @@ -284,7 +284,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { val entry = NotificationEntryBuilder().setNotification(notification).build() underTest = factory.create(entry) as NotificationEntryAdapter - assertThat(underTest.isBubbleCapable).isEqualTo(entry.isBubble) + assertThat(underTest.isBubble).isEqualTo(entry.isBubble) } @Test @@ -350,7 +350,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { val notification: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) - .setFullScreenIntent(Mockito.mock(PendingIntent::class.java), true) + .setFullScreenIntent(mock(PendingIntent::class.java), true) .build() val entry = @@ -399,7 +399,7 @@ class NotificationEntryAdapterTest : SysuiTestCase() { val notification: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) - .addAction(Mockito.mock(Notification.Action::class.java)) + .addAction(mock(Notification.Action::class.java)) .build() val entry = NotificationEntryBuilder().setNotification(notification).build() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java index 3bb1ff161b6f..fed9417edd88 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java @@ -81,7 +81,6 @@ public final class NotificationClicker implements View.OnClickListener { mPowerInteractor.wakeUpIfDozing("NOTIFICATION_CLICK", PowerManager.WAKE_REASON_GESTURE); final ExpandableNotificationRow row = (ExpandableNotificationRow) v; - final NotificationEntry entry = row.getEntry(); mLogger.logOnClick(row.getLoggingKey()); // Check if the notification is displaying the menu, if so slide notification back @@ -109,16 +108,16 @@ public final class NotificationClicker implements View.OnClickListener { DejankUtils.postAfterTraversal(() -> row.setJustClicked(false)); if (NotificationBundleUi.isEnabled()) { - if (!row.getEntryAdapter().isBubbleCapable() && mBubblesOptional.isPresent()) { + if (!row.getEntryAdapter().isBubble() && mBubblesOptional.isPresent()) { mBubblesOptional.get().collapseStack(); } + row.getEntryAdapter().onEntryClicked(row); } else { if (!row.getEntryLegacy().isBubble() && mBubblesOptional.isPresent()) { mBubblesOptional.get().collapseStack(); } + mNotificationActivityStarter.onNotificationClicked(row.getEntryLegacy(), row); } - - mNotificationActivityStarter.onNotificationClicked(entry, row); } private boolean isMenuVisible(ExpandableNotificationRow row) { @@ -129,9 +128,12 @@ public final class NotificationClicker implements View.OnClickListener { * Attaches the click listener to the row if appropriate. */ public void register(ExpandableNotificationRow row, StatusBarNotification sbn) { + boolean isBubble = NotificationBundleUi.isEnabled() + ? row.getEntryAdapter().isBubble() + : row.getEntryLegacy().isBubble(); Notification notification = sbn.getNotification(); if (notification.contentIntent != null || notification.fullScreenIntent != null - || row.getEntry().isBubble()) { + || isBubble) { if (NotificationBundleUi.isEnabled()) { row.setBubbleClickListener( v -> row.getEntryAdapter().onNotificationBubbleIconClicked()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt index e743d87a784c..be17ae56c315 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt @@ -98,7 +98,7 @@ class BundleEntryAdapter(val entry: BundleEntry) : EntryAdapter { return false } - override fun isBubbleCapable(): Boolean { + override fun isBubble(): Boolean { return false } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java index f39bd0324995..3757ebfb9986 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java @@ -125,7 +125,7 @@ public interface EntryAdapter { boolean canDragAndDrop(); - boolean isBubbleCapable(); + boolean isBubble(); @Nullable String getStyle(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt index 12cfa91d9890..a23c5a3ea9f2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt @@ -121,7 +121,7 @@ class NotificationEntryAdapter( return false } - override fun isBubbleCapable(): Boolean { + override fun isBubble(): Boolean { return entry.isBubble } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index cb1e898ef5b1..488aa44ddd3b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -1605,7 +1605,7 @@ public class NotificationContentView extends FrameLayout implements Notification if (shouldShowBubbleButton(entry)) { boolean isBubble = NotificationBundleUi.isEnabled() - ? mContainingNotification.getEntryAdapter().isBubbleCapable() + ? mContainingNotification.getEntryAdapter().isBubble() : entry.isBubble(); // explicitly resolve drawable resource using SystemUI's theme Drawable d = mContext.getDrawable(isBubble |