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

Commit 91c32cde authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Convert inline controls to entryadapter

Test: AssistantFeedbackControllerTest
Test: BundleEntryAdapterTest
Test: NotificationEntryAdapterTest
Test: FeedbackInfoTest
Test: NotificationGutsManagerTest
Test: PromotedNotificationInfoTest
Test: PartialConversationInfoTest
Test: perform actions on notification guts with flag on/off
Bug: 395857098
Flag: com.android.systemui.notification_bundle_ui

Change-Id: I9eab07280afd7c1bb1bd07874e8ecdb54c92885c
parent d04635b1
Loading
Loading
Loading
Loading
+28 −26
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.app.NotificationChannel;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.testing.TestableLooper;

@@ -101,52 +102,53 @@ public class AssistantFeedbackControllerTest extends SysuiTestCase {
        switchFlag("false");
        // test flag disables logic with default values
        assertEquals(STATUS_UNCHANGED, mAssistantFeedbackController.getFeedbackStatus(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED).getRanking()));
        assertNull(mAssistantFeedbackController.getFeedbackIcon(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED).getRanking()));
        // test that the flag disables logic with values that otherwise would return a value
        assertEquals(STATUS_UNCHANGED, mAssistantFeedbackController.getFeedbackStatus(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED).getRanking()));
        assertNull(mAssistantFeedbackController.getFeedbackIcon(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED).getRanking()));
    }

    @Test
    public void testFeedback_noChange() {
        switchFlag("true");
        assertEquals(STATUS_UNCHANGED, mAssistantFeedbackController.getFeedbackStatus(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED).getRanking()));
        assertNull(mAssistantFeedbackController.getFeedbackIcon(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_UNCHANGED).getRanking()));
    }

    @Test
    public void testFeedback_changedImportance() {
        switchFlag("true");
        NotificationEntry entry = getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_UNCHANGED);
        assertEquals(STATUS_PROMOTED, mAssistantFeedbackController.getFeedbackStatus(entry));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(entry));

        entry = getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_LOW, RANKING_UNCHANGED);
        assertEquals(STATUS_SILENCED, mAssistantFeedbackController.getFeedbackStatus(entry));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(entry));

        entry = getEntry(IMPORTANCE_LOW, IMPORTANCE_MIN, RANKING_UNCHANGED);
        assertEquals(STATUS_DEMOTED, mAssistantFeedbackController.getFeedbackStatus(entry));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(entry));
        NotificationListenerService.Ranking ranking =
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_UNCHANGED).getRanking();
        assertEquals(STATUS_PROMOTED, mAssistantFeedbackController.getFeedbackStatus(ranking));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(ranking));

        ranking = getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_LOW, RANKING_UNCHANGED).getRanking();
        assertEquals(STATUS_SILENCED, mAssistantFeedbackController.getFeedbackStatus(ranking));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(ranking));

        ranking = getEntry(IMPORTANCE_LOW, IMPORTANCE_MIN, RANKING_UNCHANGED).getRanking();
        assertEquals(STATUS_DEMOTED, mAssistantFeedbackController.getFeedbackStatus(ranking));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(ranking));
    }

    @Test
    public void testFeedback_changedRanking() {
        switchFlag("true");
        NotificationEntry entry =
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_PROMOTED);
        assertEquals(STATUS_PROMOTED, mAssistantFeedbackController.getFeedbackStatus(entry));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(entry));

        entry = getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_DEMOTED);
        assertEquals(STATUS_DEMOTED, mAssistantFeedbackController.getFeedbackStatus(entry));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(entry));
        NotificationListenerService.Ranking ranking =
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_PROMOTED).getRanking();
        assertEquals(STATUS_PROMOTED, mAssistantFeedbackController.getFeedbackStatus(ranking));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(ranking));

        ranking = getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_DEFAULT, RANKING_DEMOTED).getRanking();
        assertEquals(STATUS_DEMOTED, mAssistantFeedbackController.getFeedbackStatus(ranking));
        assertNotNull(mAssistantFeedbackController.getFeedbackIcon(ranking));
    }

    @Test
@@ -155,7 +157,7 @@ public class AssistantFeedbackControllerTest extends SysuiTestCase {
        FeedbackIcon expected = new FeedbackIcon(com.android.internal.R.drawable.ic_feedback_uprank,
                com.android.internal.R.string.notification_feedback_indicator_promoted);
        assertEquals(expected, mAssistantFeedbackController.getFeedbackIcon(
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED)));
                getEntry(IMPORTANCE_DEFAULT, IMPORTANCE_HIGH, RANKING_PROMOTED).getRanking()));
    }

    private NotificationEntry getEntry(int oldImportance, int newImportance,
+5 −1
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier.Companion.TYPE_NON_PERSON
import com.android.systemui.statusbar.notification.row.entryAdapterFactory
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -36,13 +38,15 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWithLooper
class BundleEntryAdapterTest : SysuiTestCase() {
    private val kosmos = testKosmos()
    private lateinit var underTest: BundleEntryAdapter

    @get:Rule val setFlagsRule = SetFlagsRule()
    private val factory: EntryAdapterFactory = kosmos.entryAdapterFactory

    @Before
    fun setUp() {
        underTest = BundleEntryAdapter(BundleEntry("key"))
        underTest = factory.create(BundleEntry("key")) as BundleEntryAdapter
    }

    @Test
+109 −1
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.res.R
import com.android.systemui.statusbar.RankingBuilder
import com.android.systemui.statusbar.notification.collection.coordinator.mockVisualStabilityCoordinator
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender
import com.android.systemui.statusbar.notification.collection.provider.mockHighPriorityProvider
import com.android.systemui.statusbar.notification.mockNotificationActivityStarter
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier.Companion.TYPE_FULL_PERSON
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
@@ -41,9 +44,12 @@ import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.anyLong
import org.mockito.Mockito
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.kotlin.any
import org.mockito.kotlin.eq

@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -255,6 +261,109 @@ class NotificationEntryAdapterTest : SysuiTestCase() {
        assertThat(underTest.sbn).isEqualTo(entry.sbn)
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()

        underTest = factory.create(entry) as NotificationEntryAdapter
        assertThat(underTest.ranking).isEqualTo(entry.ranking)
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()
        val callback =
            Mockito.mock(NotifLifetimeExtender.OnEndLifetimeExtensionCallback::class.java)

        underTest = factory.create(entry) as NotificationEntryAdapter
        underTest.endLifetimeExtension(callback, Mockito.mock(NotifLifetimeExtender::class.java))
        verify(callback).onEndLifetimeExtension(any(), eq(entry))
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()

        underTest = factory.create(entry) as NotificationEntryAdapter

        underTest.onImportanceChanged()
        verify(kosmos.mockVisualStabilityCoordinator)
            .temporarilyAllowSectionChanges(eq(entry), anyLong())
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()
        underTest = factory.create(entry) as NotificationEntryAdapter

        assertThat(underTest.isMarkedForUserTriggeredMovement)
            .isEqualTo(entry.isMarkedForUserTriggeredMovement)

        underTest.markForUserTriggeredMovement()
        assertThat(underTest.isMarkedForUserTriggeredMovement)
            .isEqualTo(entry.isMarkedForUserTriggeredMovement)
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()
        underTest = factory.create(entry) as NotificationEntryAdapter

        underTest.isHighPriority

        verify(kosmos.mockHighPriorityProvider).isHighPriority(entry)
    }

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

        val entry = NotificationEntryBuilder().setNotification(notification).build()
        underTest = factory.create(entry) as NotificationEntryAdapter

        assertThat(underTest.isBlockable).isEqualTo(entry.isBlockable)
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun canDragAndDrop() {
@@ -436,7 +545,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() {

        underTest = factory.create(entry) as NotificationEntryAdapter


        underTest.onEntryClicked(row)
        verify(kosmos.mockNotificationActivityStarter).onNotificationClicked(entry, row)
    }
+62 −2
Original line number Diff line number Diff line
@@ -15,12 +15,15 @@
 */
package com.android.systemui.statusbar.notification.collection.coordinator

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.testing.TestableLooper.RunWithLooper
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.DumpManager
import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.statusbar.notification.collection.EntryAdapter
import com.android.systemui.statusbar.notification.collection.NotifPipeline
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder
@@ -30,6 +33,9 @@ import com.android.systemui.statusbar.notification.collection.render.NotifGutsVi
import com.android.systemui.statusbar.notification.collection.render.NotifGutsViewManager
import com.android.systemui.statusbar.notification.row.NotificationGuts
import com.android.systemui.statusbar.notification.row.NotificationGuts.GutsContent
import com.android.systemui.statusbar.notification.row.entryAdapterFactory
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi
import com.android.systemui.testKosmos
import com.android.systemui.util.mockito.withArgCaptor
import com.google.common.truth.Truth.assertThat
import org.junit.Before
@@ -45,12 +51,16 @@ import org.mockito.MockitoAnnotations.initMocks
@RunWith(AndroidJUnit4::class)
@RunWithLooper
class GutsCoordinatorTest : SysuiTestCase() {

    private val kosmos = testKosmos()
    private lateinit var coordinator: GutsCoordinator
    private lateinit var notifLifetimeExtender: NotifLifetimeExtender
    private lateinit var notifGutsViewListener: NotifGutsViewListener

    private lateinit var entry1: NotificationEntry
    private lateinit var entry2: NotificationEntry
    private lateinit var entryAdapter1: EntryAdapter
    private lateinit var entryAdapter2: EntryAdapter

    @Mock private lateinit var notifGutsViewManager: NotifGutsViewManager
    @Mock private lateinit var pipeline: NotifPipeline
@@ -73,11 +83,59 @@ class GutsCoordinatorTest : SysuiTestCase() {
        notifLifetimeExtender.setCallback(lifetimeExtenderCallback)
        entry1 = NotificationEntryBuilder().setId(1).build()
        entry2 = NotificationEntryBuilder().setId(2).build()
        entryAdapter1 = kosmos.entryAdapterFactory.create(entry1)
        entryAdapter2 = kosmos.entryAdapterFactory.create(entry2)
        whenever(notificationGuts.gutsContent).thenReturn(mock(GutsContent::class.java))
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun testSimpleLifetimeExtension() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entryAdapter1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
        notifGutsViewListener.onGutsClose(entryAdapter1)
        verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun testDoubleOpenLifetimeExtension() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entryAdapter1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
        notifGutsViewListener.onGutsOpen(entryAdapter1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
        notifGutsViewListener.onGutsClose(entryAdapter1)
        verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun testTwoEntryLifetimeExtension() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entryAdapter1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entryAdapter2, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isTrue()
        notifGutsViewListener.onGutsClose(entryAdapter1)
        verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry1)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isTrue()
        notifGutsViewListener.onGutsClose(entryAdapter2)
        verify(lifetimeExtenderCallback).onEndLifetimeExtension(notifLifetimeExtender, entry2)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
    }

    @Test
    @DisableFlags(NotificationBundleUi.FLAG_NAME)
    fun testSimpleLifetimeExtension_entry() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entry1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
@@ -87,7 +145,8 @@ class GutsCoordinatorTest : SysuiTestCase() {
    }

    @Test
    fun testDoubleOpenLifetimeExtension() {
    @DisableFlags(NotificationBundleUi.FLAG_NAME)
    fun testDoubleOpenLifetimeExtension_entry() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entry1, notificationGuts)
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isTrue()
@@ -99,7 +158,8 @@ class GutsCoordinatorTest : SysuiTestCase() {
    }

    @Test
    fun testTwoEntryLifetimeExtension() {
    @DisableFlags(NotificationBundleUi.FLAG_NAME)
    fun testTwoEntryLifetimeExtension_entry() {
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry1, 0)).isFalse()
        assertThat(notifLifetimeExtender.maybeExtendLifetime(entry2, 0)).isFalse()
        notifGutsViewListener.onGutsOpen(entry1, notificationGuts)
+23 −12
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.view.LayoutInflater;
import android.view.View;
@@ -132,7 +133,7 @@ public class FeedbackInfoTest extends SysuiTestCase {
    @Test
    public void testBindNotification_SetsTextApplicationName() {
        when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name");
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(),
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow, mAssistantFeedbackController, mStatusBarService,
                mNotificationGutsManager);
        final TextView textView = mFeedbackInfo.findViewById(R.id.pkg_name);
@@ -144,7 +145,7 @@ public class FeedbackInfoTest extends SysuiTestCase {
        final Drawable iconDrawable = mock(Drawable.class);
        when(mMockPackageManager.getApplicationIcon(any(ApplicationInfo.class)))
                .thenReturn(iconDrawable);
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(),
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow, mAssistantFeedbackController, mStatusBarService,
                mNotificationGutsManager);
        final ImageView iconView = mFeedbackInfo.findViewById(R.id.pkg_icon);
@@ -153,9 +154,11 @@ public class FeedbackInfoTest extends SysuiTestCase {

    @Test
    public void testPrompt_silenced() {
        when(mAssistantFeedbackController.getFeedbackStatus(any(NotificationEntry.class)))
        when(mAssistantFeedbackController.getFeedbackStatus(
                any(NotificationListenerService.Ranking.class)))
                .thenReturn(STATUS_SILENCED);
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);
        TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
        assertEquals("This notification was automatically demoted to Silent by the system. "
@@ -165,9 +168,11 @@ public class FeedbackInfoTest extends SysuiTestCase {

    @Test
    public void testPrompt_promoted() {
        when(mAssistantFeedbackController.getFeedbackStatus(any(NotificationEntry.class)))
        when(mAssistantFeedbackController.getFeedbackStatus(
                any(NotificationListenerService.Ranking.class)))
                .thenReturn(STATUS_PROMOTED);
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);
        TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
        assertEquals("This notification was automatically ranked higher in your shade. "
@@ -177,9 +182,11 @@ public class FeedbackInfoTest extends SysuiTestCase {

    @Test
    public void testPrompt_alerted() {
        when(mAssistantFeedbackController.getFeedbackStatus(any(NotificationEntry.class)))
        when(mAssistantFeedbackController.getFeedbackStatus(
                any(NotificationListenerService.Ranking.class)))
                .thenReturn(STATUS_ALERTED);
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);
        TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
        assertEquals("This notification was automatically promoted to Default by the system. "
@@ -189,9 +196,11 @@ public class FeedbackInfoTest extends SysuiTestCase {

    @Test
    public void testPrompt_demoted() {
        when(mAssistantFeedbackController.getFeedbackStatus(any(NotificationEntry.class)))
        when(mAssistantFeedbackController.getFeedbackStatus(
                any(NotificationListenerService.Ranking.class)))
                .thenReturn(STATUS_DEMOTED);
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);
        TextView prompt = mFeedbackInfo.findViewById(R.id.prompt);
        assertEquals("This notification was automatically ranked lower in your shade. "
@@ -201,7 +210,8 @@ public class FeedbackInfoTest extends SysuiTestCase {

    @Test
    public void testPositiveFeedback() {
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);

        final View yes = mFeedbackInfo.findViewById(R.id.yes);
@@ -218,7 +228,8 @@ public class FeedbackInfoTest extends SysuiTestCase {
                any(NotificationMenuRowPlugin.MenuItem.class)))
                .thenReturn(true);

        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry(), mMockNotificationRow,
        mFeedbackInfo.bindGuts(mMockPackageManager, mSbn, getEntry().getRanking(),
                mMockNotificationRow,
                mAssistantFeedbackController, mStatusBarService, mNotificationGutsManager);

        final View no = mFeedbackInfo.findViewById(R.id.no);
Loading