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

Commit d670a864 authored by Helen Cheuk's avatar Helen Cheuk Committed by Android (Google) Code Review
Browse files

Merge "[Contextual Edu] Only store keyboard shortcut time for All Apps" into main

parents e5f64acb 12216cde
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.contextualeducation.GestureType
import com.android.systemui.contextualeducation.GestureType.ALL_APPS
import com.android.systemui.contextualeducation.GestureType.BACK
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.education.data.model.GestureEduModel
@@ -220,17 +221,19 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() {
            verify(kosmos.mockEduInputManager)
                .registerKeyGestureEventListener(any(), listenerCaptor.capture())

            val backGestureEvent =
            val allAppsKeyGestureEvent =
                KeyGestureEvent(
                    /* deviceId= */ 1,
                    intArrayOf(KeyEvent.KEYCODE_ESCAPE),
                    IntArray(0),
                    KeyEvent.META_META_ON,
                    KeyGestureEvent.KEY_GESTURE_TYPE_BACK
                    KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS
                )
            listenerCaptor.value.onKeyGestureEvent(backGestureEvent)
            listenerCaptor.value.onKeyGestureEvent(allAppsKeyGestureEvent)

            val model by
                collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK))
                collectLastValue(
                    kosmos.contextualEducationRepository.readGestureEduModelFlow(ALL_APPS)
                )
            assertThat(model?.lastShortcutTriggeredTime).isEqualTo(eduClock.instant())
        }

+1 −5
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLoggin
import com.android.systemui.contextualeducation.GestureType
import com.android.systemui.contextualeducation.GestureType.ALL_APPS
import com.android.systemui.contextualeducation.GestureType.BACK
import com.android.systemui.contextualeducation.GestureType.HOME
import com.android.systemui.contextualeducation.GestureType.OVERVIEW
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.education.dagger.ContextualEducationModule.EduClock
@@ -68,11 +66,9 @@ constructor(

    private val keyboardShortcutTriggered: Flow<GestureType> = conflatedCallbackFlow {
        val listener = KeyGestureEventListener { event ->
            // Only store keyboard shortcut time for gestures providing keyboard education
            val shortcutType =
                when (event.keyGestureType) {
                    KeyGestureEvent.KEY_GESTURE_TYPE_BACK -> BACK
                    KeyGestureEvent.KEY_GESTURE_TYPE_HOME -> HOME
                    KeyGestureEvent.KEY_GESTURE_TYPE_RECENT_APPS -> OVERVIEW
                    KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS -> ALL_APPS
                    else -> null
                }