Merge "Fix notification cancel reason when AutoCancel flag is present"

This commit is contained in:
Chloris Kuo
2020-12-04 23:21:16 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions

View File

@@ -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

View File

@@ -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