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

Commit 0f8e85dd authored by Julia Tuttle's avatar Julia Tuttle Committed by Android (Google) Code Review
Browse files

Merge "Tweak PromotedNotificationContentExtractor" into main

parents ceaacce7 13e2e235
Loading
Loading
Loading
Loading
+39 −47
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import org.junit.runner.RunWith

@SmallTest
@RunWith(AndroidJUnit4::class)
class PromotedNotificationContentExtractorTest : SysuiTestCase() {
class PromotedNotificationContentExtractorImplTest : SysuiTestCase() {
    private val kosmos = testKosmos()

    private val provider =
@@ -54,7 +54,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @DisableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun shouldNotExtract_bothFlagsDisabled() {
        val notif = createEntry().also { provider.promotedEntries.add(it) }
        val notif = createEntry()
        val content = extractContent(notif)
        assertThat(content).isNull()
    }
@@ -63,7 +63,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @EnableFlags(PromotedNotificationUi.FLAG_NAME)
    @DisableFlags(StatusBarNotifChips.FLAG_NAME)
    fun shouldExtract_promotedNotificationUiFlagEnabled() {
        val entry = createEntry().also { provider.promotedEntries.add(it) }
        val entry = createEntry()
        val content = extractContent(entry)
        assertThat(content).isNotNull()
    }
@@ -72,7 +72,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @EnableFlags(StatusBarNotifChips.FLAG_NAME)
    @DisableFlags(PromotedNotificationUi.FLAG_NAME)
    fun shouldExtract_statusBarNotifChipsFlagEnabled() {
        val entry = createEntry().also { provider.promotedEntries.add(it) }
        val entry = createEntry()
        val content = extractContent(entry)
        assertThat(content).isNotNull()
    }
@@ -80,7 +80,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun shouldExtract_bothFlagsEnabled() {
        val entry = createEntry().also { provider.promotedEntries.add(it) }
        val entry = createEntry()
        val content = extractContent(entry)
        assertThat(content).isNotNull()
    }
@@ -88,22 +88,19 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun shouldNotExtract_providerDidNotPromote() {
        val entry = createEntry().also { provider.promotedEntries.remove(it) }
        val entry = createEntry(promoted = false)
        val content = extractContent(entry)
        assertThat(content).isNull()
    }

    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_commonFields() {
        val entry =
            createEntry {
    fun extractsContent_commonFields() {
        val entry = createEntry {
            setSubText(TEST_SUB_TEXT)
            setContentTitle(TEST_CONTENT_TITLE)
            setContentText(TEST_CONTENT_TEXT)
                    setShortCriticalText(TEST_SHORT_CRITICAL_TEXT)
        }
                .also { provider.promotedEntries.add(it) }

        val content = extractContent(entry)

@@ -117,9 +114,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    @DisableFlags(android.app.Flags.FLAG_API_RICH_ONGOING)
    fun extractContent_apiFlagOff_shortCriticalTextNotExtracted() {
        val entry =
            createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) }
                .also { provider.promotedEntries.add(it) }
        val entry = createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) }

        val content = extractContent(entry)

@@ -134,9 +129,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
        android.app.Flags.FLAG_API_RICH_ONGOING,
    )
    fun extractContent_apiFlagOn_shortCriticalTextExtracted() {
        val entry =
            createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) }
                .also { provider.promotedEntries.add(it) }
        val entry = createEntry { setShortCriticalText(TEST_SHORT_CRITICAL_TEXT) }

        val content = extractContent(entry)

@@ -151,7 +144,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
        android.app.Flags.FLAG_API_RICH_ONGOING,
    )
    fun extractContent_noShortCriticalTextSet_textIsNull() {
        val entry = createEntry {}.also { provider.promotedEntries.add(it) }
        val entry = createEntry { setShortCriticalText(null) }

        val content = extractContent(entry)

@@ -161,9 +154,8 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {

    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_fromBigPictureStyle() {
        val entry =
            createEntry { setStyle(BigPictureStyle()) }.also { provider.promotedEntries.add(it) }
    fun extractsContent_fromBigPictureStyle() {
        val entry = createEntry { setStyle(BigPictureStyle()) }

        val content = extractContent(entry)

@@ -174,8 +166,7 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_fromBigTextStyle() {
        val entry =
            createEntry { setStyle(BigTextStyle()) }.also { provider.promotedEntries.add(it) }
        val entry = createEntry { setStyle(BigTextStyle()) }

        val content = extractContent(entry)

@@ -187,11 +178,13 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_fromCallStyle() {
        val hangUpIntent =
            PendingIntent.getBroadcast(context, 0, Intent("hangup"), PendingIntent.FLAG_IMMUTABLE)

        val entry =
            createEntry { setStyle(CallStyle.forOngoingCall(TEST_PERSON, hangUpIntent)) }
                .also { provider.promotedEntries.add(it) }
            PendingIntent.getBroadcast(
                context,
                0,
                Intent("hangup_action"),
                PendingIntent.FLAG_IMMUTABLE,
            )
        val entry = createEntry { setStyle(CallStyle.forOngoingCall(TEST_PERSON, hangUpIntent)) }

        val content = extractContent(entry)

@@ -202,11 +195,9 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_fromProgressStyle() {
        val entry =
            createEntry {
        val entry = createEntry {
            setStyle(ProgressStyle().addProgressSegment(Segment(100)).setProgress(75))
        }
                .also { provider.promotedEntries.add(it) }

        val content = extractContent(entry)

@@ -220,13 +211,9 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun extractContent_fromIneligibleStyle() {
        val entry =
            createEntry {
                    setStyle(
                        MessagingStyle(TEST_PERSON).addMessage("message text", 0L, TEST_PERSON)
                    )
        val entry = createEntry {
            setStyle(MessagingStyle(TEST_PERSON).addMessage("message text", 0L, TEST_PERSON))
        }
                .also { provider.promotedEntries.add(it) }

        val content = extractContent(entry)

@@ -239,9 +226,14 @@ class PromotedNotificationContentExtractorTest : SysuiTestCase() {
        return underTest.extractContent(entry, recoveredBuilder)
    }

    private fun createEntry(builderBlock: Notification.Builder.() -> Unit = {}): NotificationEntry {
        val notif = Notification.Builder(context, "a").also(builderBlock).build()
        return NotificationEntryBuilder().setNotification(notif).build()
    private fun createEntry(
        promoted: Boolean = true,
        builderBlock: Notification.Builder.() -> Unit = {},
    ): NotificationEntry {
        val notif = Notification.Builder(context, "channel").also(builderBlock).build()
        return NotificationEntryBuilder().setNotification(notif).build().also {
            provider.shouldPromoteForEntry[it] = promoted
        }
    }

    companion object {
+13 −17
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -61,7 +60,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips;
import com.android.systemui.statusbar.notification.ConversationNotificationProcessor;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.promoted.FakePromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi;
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.BindParams;
@@ -105,7 +104,8 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
    @Mock private NotifLayoutInflaterFactory.Provider mNotifLayoutInflaterFactoryProvider;
    @Mock private HeadsUpStyleProvider mHeadsUpStyleProvider;
    @Mock private NotifLayoutInflaterFactory mNotifLayoutInflaterFactory;
    @Mock private PromotedNotificationContentExtractor mPromotedNotificationContentExtractor;
    private final FakePromotedNotificationContentExtractor mPromotedNotificationContentExtractor =
            new FakePromotedNotificationContentExtractor();

    private final SmartReplyStateInflater mSmartReplyStateInflater =
            new SmartReplyStateInflater() {
@@ -395,12 +395,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
    public void testExtractsPromotedContent_notWhenBothFlagsDisabled() throws Exception {
        final PromotedNotificationContentModel content =
                new PromotedNotificationContentModel.Builder("key").build();
        when(mPromotedNotificationContentExtractor.extractContent(any(), any()))
                .thenReturn(content);
        mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content);

        inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow);

        verify(mPromotedNotificationContentExtractor, never()).extractContent(any(), any());
        mPromotedNotificationContentExtractor.verifyZeroExtractCalls();
    }

    @Test
@@ -410,12 +409,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
            throws Exception {
        final PromotedNotificationContentModel content =
                new PromotedNotificationContentModel.Builder("key").build();
        when(mPromotedNotificationContentExtractor.extractContent(any(), any()))
                .thenReturn(content);
        mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content);

        inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow);

        verify(mPromotedNotificationContentExtractor, times(1)).extractContent(any(), any());
        mPromotedNotificationContentExtractor.verifyOneExtractCall();
        assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel());
    }

@@ -425,12 +423,11 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
    public void testExtractsPromotedContent_whenStatusBarNotifChipsFlagEnabled() throws Exception {
        final PromotedNotificationContentModel content =
                new PromotedNotificationContentModel.Builder("key").build();
        when(mPromotedNotificationContentExtractor.extractContent(any(), any()))
                .thenReturn(content);
        mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content);

        inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow);

        verify(mPromotedNotificationContentExtractor, times(1)).extractContent(any(), any());
        mPromotedNotificationContentExtractor.verifyOneExtractCall();
        assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel());
    }

@@ -439,23 +436,22 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
    public void testExtractsPromotedContent_whenBothFlagsEnabled() throws Exception {
        final PromotedNotificationContentModel content =
                new PromotedNotificationContentModel.Builder("key").build();
        when(mPromotedNotificationContentExtractor.extractContent(any(), any()))
                .thenReturn(content);
        mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), content);

        inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow);

        verify(mPromotedNotificationContentExtractor, times(1)).extractContent(any(), any());
        mPromotedNotificationContentExtractor.verifyOneExtractCall();
        assertEquals(content, mRow.getEntry().getPromotedNotificationContentModel());
    }

    @Test
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME})
    public void testExtractsPromotedContent_null() throws Exception {
        when(mPromotedNotificationContentExtractor.extractContent(any(), any())).thenReturn(null);
        mPromotedNotificationContentExtractor.resetForEntry(mRow.getEntry(), null);

        inflateAndWait(mNotificationInflater, FLAG_CONTENT_VIEW_ALL, mRow);

        verify(mPromotedNotificationContentExtractor, times(1)).extractContent(any(), any());
        mPromotedNotificationContentExtractor.verifyOneExtractCall();
        assertNull(mRow.getEntry().getPromotedNotificationContentModel());
    }

+22 −16
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ import com.android.systemui.res.R
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.notification.ConversationNotificationProcessor
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor
import com.android.systemui.statusbar.notification.promoted.FakePromotedNotificationContentExtractor
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.BindParams
@@ -67,7 +67,6 @@ import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.spy
import org.mockito.kotlin.times
import org.mockito.kotlin.verify
@@ -110,7 +109,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
                return inflatedSmartReplyState
            }
        }
    private val promotedNotificationContentExtractor: PromotedNotificationContentExtractor = mock()
    private val promotedNotificationContentExtractor = FakePromotedNotificationContentExtractor()

    @Before
    fun setUp() {
@@ -234,7 +233,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
                packageContext = mContext,
                remoteViews = NewRemoteViews(),
                contentModel = NotificationContentModel(headsUpStatusBarModel),
                extractedPromotedNotificationContentModel = null,
                promotedContent = null,
            )
        val countDownLatch = CountDownLatch(1)
        NotificationRowContentBinderImpl.applyRemoteView(
@@ -475,12 +474,11 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
    @DisableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun testExtractsPromotedContent_notWhenBothFlagsDisabled() {
        val content = PromotedNotificationContentModel.Builder("key").build()
        whenever(promotedNotificationContentExtractor.extractContent(any(), any()))
            .thenReturn(content)
        promotedNotificationContentExtractor.resetForEntry(row.entry, content)

        inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row)

        verify(promotedNotificationContentExtractor, never()).extractContent(any(), any())
        promotedNotificationContentExtractor.verifyZeroExtractCalls()
    }

    @Test
@@ -488,12 +486,11 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
    @DisableFlags(StatusBarNotifChips.FLAG_NAME)
    fun testExtractsPromotedContent_whenPromotedNotificationUiFlagEnabled() {
        val content = PromotedNotificationContentModel.Builder("key").build()
        whenever(promotedNotificationContentExtractor.extractContent(any(), any()))
            .thenReturn(content)
        promotedNotificationContentExtractor.resetForEntry(row.entry, content)

        inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row)

        verify(promotedNotificationContentExtractor, times(1)).extractContent(any(), any())
        promotedNotificationContentExtractor.verifyOneExtractCall()
        Assert.assertEquals(content, row.entry.promotedNotificationContentModel)
    }

@@ -502,12 +499,11 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
    @DisableFlags(PromotedNotificationUi.FLAG_NAME)
    fun testExtractsPromotedContent_whenStatusBarNotifChipsFlagEnabled() {
        val content = PromotedNotificationContentModel.Builder("key").build()
        whenever(promotedNotificationContentExtractor.extractContent(any(), any()))
            .thenReturn(content)
        promotedNotificationContentExtractor.resetForEntry(row.entry, content)

        inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row)

        verify(promotedNotificationContentExtractor, times(1)).extractContent(any(), any())
        promotedNotificationContentExtractor.verifyOneExtractCall()
        Assert.assertEquals(content, row.entry.promotedNotificationContentModel)
    }

@@ -515,15 +511,25 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun testExtractsPromotedContent_whenBothFlagsEnabled() {
        val content = PromotedNotificationContentModel.Builder("key").build()
        whenever(promotedNotificationContentExtractor.extractContent(any(), any()))
            .thenReturn(content)
        promotedNotificationContentExtractor.resetForEntry(row.entry, content)

        inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row)

        verify(promotedNotificationContentExtractor, times(1)).extractContent(any(), any())
        promotedNotificationContentExtractor.verifyOneExtractCall()
        Assert.assertEquals(content, row.entry.promotedNotificationContentModel)
    }

    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME, StatusBarNotifChips.FLAG_NAME)
    fun testExtractsPromotedContent_null() {
        promotedNotificationContentExtractor.resetForEntry(row.entry, null)

        inflateAndWait(notificationInflater, FLAG_CONTENT_VIEW_ALL, row)

        promotedNotificationContentExtractor.verifyOneExtractCall()
        Assert.assertNull(row.entry.promotedNotificationContentModel)
    }

    private class ExceptionHolder {
        var exception: Exception? = null
    }
+3 −3
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ import com.android.systemui.statusbar.notification.headsup.HeadsUpManager;
import com.android.systemui.statusbar.notification.icon.IconBuilder;
import com.android.systemui.statusbar.notification.icon.IconManager;
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.promoted.FakePromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow.ExpandableNotificationRowLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow.OnExpandClickListener;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
@@ -201,7 +201,7 @@ public class NotificationTestHelper {
                                new MockSmartReplyInflater(),
                                mock(NotifLayoutInflaterFactory.Provider.class),
                                mock(HeadsUpStyleProvider.class),
                                mock(PromotedNotificationContentExtractor.class),
                                new FakePromotedNotificationContentExtractor(),
                                mock(NotificationRowContentBinderLogger.class))
                        : new NotificationContentInflater(
                                mock(NotifRemoteViewCache.class),
@@ -212,7 +212,7 @@ public class NotificationTestHelper {
                                new MockSmartReplyInflater(),
                                mock(NotifLayoutInflaterFactory.Provider.class),
                                mock(HeadsUpStyleProvider.class),
                                mock(PromotedNotificationContentExtractor.class),
                                new FakePromotedNotificationContentExtractor(),
                                mock(NotificationRowContentBinderLogger.class));
        contentBinder.setInflateSynchronously(true);
        mBindStage = new RowContentBindStage(contentBinder,
+9 −16
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.systemui.statusbar.notification.data.NotificationDataLayerMod
import com.android.systemui.statusbar.notification.domain.NotificationDomainLayerModule;
import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor;
import com.android.systemui.statusbar.notification.footer.ui.viewmodel.FooterViewModelModule;
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager;
import com.android.systemui.statusbar.notification.icon.ConversationIconManager;
import com.android.systemui.statusbar.notification.icon.IconManager;
import com.android.systemui.statusbar.notification.init.NotificationsController;
@@ -78,8 +79,7 @@ import com.android.systemui.statusbar.notification.logging.NotificationPanelLogg
import com.android.systemui.statusbar.notification.logging.NotificationPanelLoggerImpl;
import com.android.systemui.statusbar.notification.logging.dagger.NotificationsLogModule;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationLogger;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationsProvider;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractorImpl;
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel;
import com.android.systemui.statusbar.notification.row.NotificationEntryProcessorFactory;
import com.android.systemui.statusbar.notification.row.NotificationEntryProcessorFactoryLooperImpl;
@@ -92,7 +92,6 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager;
import com.android.systemui.statusbar.policy.ZenModesCleanupStartable;

import dagger.Binds;
@@ -105,8 +104,6 @@ import kotlin.coroutines.CoroutineContext;

import kotlinx.coroutines.CoroutineScope;

import java.util.Optional;

import javax.inject.Provider;

/**
@@ -315,21 +312,17 @@ public interface NotificationsModule {
    @ClassKey(ZenModesCleanupStartable.class)
    CoreStartable bindsZenModesCleanup(ZenModesCleanupStartable zenModesCleanup);

    /**
     * Provides {@link
     * com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor} if
     * one of the relevant feature flags is enabled.
     */
    /** Provides the default implementation of {@link PromotedNotificationContentExtractor} if at
     * least one of the relevant feature flags is enabled, or an implementation that always returns
     * null if none are enabled. */
    @Provides
    @SysUISingleton
    static Optional<PromotedNotificationContentExtractor>
            providePromotedNotificationContentExtractor(
                    PromotedNotificationsProvider provider, Context context,
                    PromotedNotificationLogger logger) {
    static PromotedNotificationContentExtractor providesPromotedNotificationContentExtractor(
            Provider<PromotedNotificationContentExtractorImpl> implProvider) {
        if (PromotedNotificationContentModel.featureFlagEnabled()) {
            return Optional.of(new PromotedNotificationContentExtractor(provider, context, logger));
            return implProvider.get();
        } else {
            return Optional.empty();
            return (entry, recoveredBuilder) -> null;
        }
    }
}
Loading