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

Commit 3937f88d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix notification HSUM bug" into main

parents 43776a28 28376cc4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.settings.userTracker
import com.android.systemui.touchpad.data.repository.FakeTouchpadRepository
import com.google.common.truth.Truth.assertThat
import kotlin.time.Duration.Companion.hours
@@ -91,6 +92,7 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() {
                context,
                interactor,
                notificationManager,
                kosmos.userTracker,
            )
        notificationCaptor = ArgumentCaptor.forClass(Notification::class.java)
        underTest.start()
@@ -140,12 +142,13 @@ class TutorialNotificationCoordinatorTest : SysuiTestCase() {
    fun doNotShowNotification() =
        testScope.runTest {
            advanceTimeBy(LAUNCH_DELAY)
            verify(notificationManager, never()).notify(eq(TAG), eq(NOTIFICATION_ID), any())
            verify(notificationManager, never())
                .notifyAsUser(eq(TAG), eq(NOTIFICATION_ID), any(), any())
        }

    private fun verifyNotification(@StringRes titleResId: Int, @StringRes contentResId: Int) {
        verify(notificationManager)
            .notify(eq(TAG), eq(NOTIFICATION_ID), notificationCaptor.capture())
            .notifyAsUser(eq(TAG), eq(NOTIFICATION_ID), notificationCaptor.capture(), any())
        val notification = notificationCaptor.value
        val actualTitle = notification.getString(Notification.EXTRA_TITLE)
        val actualContent = notification.getString(Notification.EXTRA_TEXT)
+3 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.inputdevice.tutorial.ui.view.KeyboardTouchpadTutoria
import com.android.systemui.inputdevice.tutorial.ui.view.KeyboardTouchpadTutorialActivity.Companion.INTENT_TUTORIAL_TYPE_KEYBOARD
import com.android.systemui.inputdevice.tutorial.ui.view.KeyboardTouchpadTutorialActivity.Companion.INTENT_TUTORIAL_TYPE_TOUCHPAD
import com.android.systemui.res.R
import com.android.systemui.settings.UserTracker
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import com.android.app.tracing.coroutines.launchTraced as launch
@@ -51,6 +52,7 @@ constructor(
    @Application private val context: Context,
    private val tutorialSchedulerInteractor: TutorialSchedulerInteractor,
    private val notificationManager: NotificationManager,
    private val userTracker: UserTracker,
) {
    fun start() {
        backgroundScope.launch {
@@ -85,7 +87,7 @@ constructor(
                .addExtras(extras)
                .build()

        notificationManager.notify(TAG, NOTIFICATION_ID, notification)
        notificationManager.notifyAsUser(TAG, NOTIFICATION_ID, notification, userTracker.userHandle)
    }

    private fun createNotificationChannel() {