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

Commit d44a04db authored by Chloris Kuo's avatar Chloris Kuo
Browse files

Fix notification cancel reason when AutoCancel flag is present

Test: atest, manual test on device
Bug: 174615543
Change-Id: I7183752b42c2335064cfed0b2b13c44fe247eb49
parent d1ea1214
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -378,8 +378,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
                // We have to post the removal to the UI thread for synchronization.
                mMainThreadHandler.post(() -> {
                    final Runnable removeNotification = () -> {
                        mOnUserInteractionCallback.onDismiss(entry, REASON_CLICK);
                        mClickNotifier.onNotificationClick(entry.getKey(), nv);
                        mOnUserInteractionCallback.onDismiss(entry, REASON_CLICK);
                    };
                    if (mPresenter.isCollapsing()) {
                        // To avoid lags we're only performing the remove
+6 −3
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ import com.android.systemui.wmshell.BubblesManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;

@@ -261,11 +263,12 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {

        verify(mAssistManager).hideAssist();

        verify(mClickNotifier).onNotificationClick(
        InOrder orderVerifier = Mockito.inOrder(mClickNotifier, mOnUserInteractionCallback);
        orderVerifier.verify(mClickNotifier).onNotificationClick(
                eq(sbn.getKey()), any(NotificationVisibility.class));

        // Notification calls dismiss callback to remove notification due to FLAG_AUTO_CANCEL
        verify(mOnUserInteractionCallback).onDismiss(mNotificationRow.getEntry(), REASON_CLICK);
        orderVerifier.verify(mOnUserInteractionCallback).onDismiss(mNotificationRow.getEntry(),
                REASON_CLICK);
    }

    @Test