Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cefc606 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add onDragSuccess to EntryAdapter

Test: NotificationEntryAdapterTest
Test: ExpandableNotificationRowTest
Bug: 395857098
Flag: com.android.systemui.notification_bundle_ui
Change-Id: I23c15432abc426bebb4ef327d96c71c1f37d0480
parent 27114f78
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -352,6 +352,22 @@ class NotificationEntryAdapterTest : SysuiTestCase() {
        assertThat(underTest.isFullScreenCapable).isTrue()
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun onDragSuccess() {
        val notification: Notification =
            Notification.Builder(mContext, "")
                .setSmallIcon(R.drawable.ic_person)
                .addAction(mock(Notification.Action::class.java))
                .build()
        val entry = NotificationEntryBuilder().setNotification(notification).build()

        underTest = factory.create(entry) as NotificationEntryAdapter

        underTest.onDragSuccess()
        verify(kosmos.mockNotificationActivityStarter).onDragSuccess(entry)
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun onNotificationBubbleIconClicked() {
+15 −7
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.View;

import com.android.systemui.DejankUtils;
import com.android.systemui.power.domain.interactor.PowerInteractor;
import com.android.systemui.statusbar.notification.collection.EntryAdapter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;
@@ -44,12 +45,19 @@ public final class NotificationClicker implements View.OnClickListener {
    private final Optional<Bubbles> mBubblesOptional;
    private final NotificationActivityStarter mNotificationActivityStarter;

    private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener =
            new ExpandableNotificationRow.OnDragSuccessListener() {
    private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener
            = new ExpandableNotificationRow.OnDragSuccessListener() {
        @Override
        public void onDragSuccess(NotificationEntry entry) {
            NotificationBundleUi.assertInLegacyMode();
            mNotificationActivityStarter.onDragSuccess(entry);
        }

        @Override
        public void onDragSuccess(EntryAdapter entryAdapter) {
            NotificationBundleUi.isUnexpectedlyInLegacyMode();
            entryAdapter.onDragSuccess();
        }
    };

    private NotificationClicker(
+5 −0
Original line number Diff line number Diff line
@@ -121,6 +121,11 @@ class BundleEntryAdapter(val entry: BundleEntry) : EntryAdapter {
        return false
    }

    override fun onDragSuccess() {
        // do nothing. these should not be draggable
        Log.wtf(TAG, "onDragSuccess() called")
    }

    override fun onNotificationBubbleIconClicked() {
        // do nothing. these cannot be a bubble
        Log.wtf(TAG, "onNotificationBubbleIconClicked() called")
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ public interface EntryAdapter {
        return false;
    }

    void onDragSuccess();

    /**
     * Process a click on a notification bubble icon
     */
+4 −0
Original line number Diff line number Diff line
@@ -145,6 +145,10 @@ class NotificationEntryAdapter(
        return entry.sbn.notification.fullScreenIntent != null
    }

    override fun onDragSuccess() {
        notificationActivityStarter.onDragSuccess(entry)
    }

    override fun onNotificationBubbleIconClicked() {
        notificationActivityStarter.onNotificationBubbleIconClicked(entry)
    }
Loading