Loading packages/SystemUI/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -576,6 +576,7 @@ android_library { "TraceurCommon", "Traceur-res", "//frameworks/libs/systemui:motion_tool_lib", "//frameworks/libs/systemui:contextualeducationlib", "notification_flags_lib", "PlatformComposeCore", "PlatformComposeSceneTransitionLayout", Loading Loading @@ -736,6 +737,7 @@ android_library { "WindowManager-Shell", "LowLightDreamLib", "//frameworks/libs/systemui:motion_tool_lib", "//frameworks/libs/systemui:contextualeducationlib", "androidx.core_core-animation-testing", "androidx.compose.ui_ui", "flag-junit", Loading packages/SystemUI/multivalentTests/src/com/android/systemui/education/data/repository/ContextualEducationRepositoryTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestableContext import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.google.common.truth.Truth.assertThat import java.io.File import java.time.Clock Loading Loading @@ -70,8 +70,8 @@ class ContextualEducationRepositoryTest : SysuiTestCase() { fun changeRetrievedValueForNewUser() = testScope.runTest { // Update data for old user. underTest.incrementSignalCount(BACK_GESTURE) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) underTest.incrementSignalCount(BACK) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.signalCount).isEqualTo(1) // User is changed. Loading @@ -83,17 +83,17 @@ class ContextualEducationRepositoryTest : SysuiTestCase() { @Test fun incrementSignalCount() = testScope.runTest { underTest.incrementSignalCount(BACK_GESTURE) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) underTest.incrementSignalCount(BACK) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.signalCount).isEqualTo(1) } @Test fun dataAddedOnUpdateShortcutTriggerTime() = testScope.runTest { val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.lastShortcutTriggeredTime).isNull() underTest.updateShortcutTriggerTime(BACK_GESTURE) underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(clock.instant()) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest Loading @@ -47,15 +47,15 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { @Test fun newEducationInfoOnMaxSignalCountReached() = testScope.runTest { tryTriggeringEducation(BACK_GESTURE) tryTriggeringEducation(BACK) val model by collectLastValue(underTest.educationTriggered) assertThat(model?.gestureType).isEqualTo(BACK_GESTURE) assertThat(model?.gestureType).isEqualTo(BACK) } @Test fun noEducationInfoBeforeMaxSignalCountReached() = testScope.runTest { repository.incrementSignalCount(BACK_GESTURE) repository.incrementSignalCount(BACK) val model by collectLastValue(underTest.educationTriggered) assertThat(model).isNull() } Loading @@ -64,8 +64,8 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { fun noEducationInfoWhenShortcutTriggeredPreviously() = testScope.runTest { val model by collectLastValue(underTest.educationTriggered) repository.updateShortcutTriggerTime(BACK_GESTURE) tryTriggeringEducation(BACK_GESTURE) repository.updateShortcutTriggerTime(BACK) tryTriggeringEducation(BACK) assertThat(model).isNull() } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt +5 −9 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.education.data.repository.fakeEduClock import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest Loading @@ -41,11 +41,9 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { fun dataUpdatedOnIncrementSignalCount() = testScope.runTest { val model by collectLastValue( kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK_GESTURE) ) collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) val originalValue = model!!.signalCount underTest.incrementSignalCount(BACK_GESTURE) underTest.incrementSignalCount(BACK) assertThat(model?.signalCount).isEqualTo(originalValue + 1) } Loading @@ -53,11 +51,9 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { fun dataAddedOnUpdateShortcutTriggerTime() = testScope.runTest { val model by collectLastValue( kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK_GESTURE) ) collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) assertThat(model?.lastShortcutTriggeredTime).isNull() underTest.updateShortcutTriggerTime(BACK_GESTURE) underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(kosmos.fakeEduClock.instant()) } } packages/SystemUI/shared/src/com/android/systemui/shared/education/GestureType.ktdeleted 100644 → 0 +0 −21 Original line number Diff line number Diff line /* * Copyright 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shared.education enum class GestureType { BACK_GESTURE, } Loading
packages/SystemUI/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -576,6 +576,7 @@ android_library { "TraceurCommon", "Traceur-res", "//frameworks/libs/systemui:motion_tool_lib", "//frameworks/libs/systemui:contextualeducationlib", "notification_flags_lib", "PlatformComposeCore", "PlatformComposeSceneTransitionLayout", Loading Loading @@ -736,6 +737,7 @@ android_library { "WindowManager-Shell", "LowLightDreamLib", "//frameworks/libs/systemui:motion_tool_lib", "//frameworks/libs/systemui:contextualeducationlib", "androidx.core_core-animation-testing", "androidx.compose.ui_ui", "flag-junit", Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/education/data/repository/ContextualEducationRepositoryTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestableContext import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.google.common.truth.Truth.assertThat import java.io.File import java.time.Clock Loading Loading @@ -70,8 +70,8 @@ class ContextualEducationRepositoryTest : SysuiTestCase() { fun changeRetrievedValueForNewUser() = testScope.runTest { // Update data for old user. underTest.incrementSignalCount(BACK_GESTURE) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) underTest.incrementSignalCount(BACK) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.signalCount).isEqualTo(1) // User is changed. Loading @@ -83,17 +83,17 @@ class ContextualEducationRepositoryTest : SysuiTestCase() { @Test fun incrementSignalCount() = testScope.runTest { underTest.incrementSignalCount(BACK_GESTURE) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) underTest.incrementSignalCount(BACK) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.signalCount).isEqualTo(1) } @Test fun dataAddedOnUpdateShortcutTriggerTime() = testScope.runTest { val model by collectLastValue(underTest.readGestureEduModelFlow(BACK_GESTURE)) val model by collectLastValue(underTest.readGestureEduModelFlow(BACK)) assertThat(model?.lastShortcutTriggeredTime).isNull() underTest.updateShortcutTriggerTime(BACK_GESTURE) underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(clock.instant()) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest Loading @@ -47,15 +47,15 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { @Test fun newEducationInfoOnMaxSignalCountReached() = testScope.runTest { tryTriggeringEducation(BACK_GESTURE) tryTriggeringEducation(BACK) val model by collectLastValue(underTest.educationTriggered) assertThat(model?.gestureType).isEqualTo(BACK_GESTURE) assertThat(model?.gestureType).isEqualTo(BACK) } @Test fun noEducationInfoBeforeMaxSignalCountReached() = testScope.runTest { repository.incrementSignalCount(BACK_GESTURE) repository.incrementSignalCount(BACK) val model by collectLastValue(underTest.educationTriggered) assertThat(model).isNull() } Loading @@ -64,8 +64,8 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { fun noEducationInfoWhenShortcutTriggeredPreviously() = testScope.runTest { val model by collectLastValue(underTest.educationTriggered) repository.updateShortcutTriggerTime(BACK_GESTURE) tryTriggeringEducation(BACK_GESTURE) repository.updateShortcutTriggerTime(BACK) tryTriggeringEducation(BACK) assertThat(model).isNull() } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadStatsInteractorTest.kt +5 −9 Original line number Diff line number Diff line Loading @@ -20,10 +20,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.contextualeducation.GestureType.BACK import com.android.systemui.education.data.repository.contextualEducationRepository import com.android.systemui.education.data.repository.fakeEduClock import com.android.systemui.kosmos.testScope import com.android.systemui.shared.education.GestureType.BACK_GESTURE import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest Loading @@ -41,11 +41,9 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { fun dataUpdatedOnIncrementSignalCount() = testScope.runTest { val model by collectLastValue( kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK_GESTURE) ) collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) val originalValue = model!!.signalCount underTest.incrementSignalCount(BACK_GESTURE) underTest.incrementSignalCount(BACK) assertThat(model?.signalCount).isEqualTo(originalValue + 1) } Loading @@ -53,11 +51,9 @@ class KeyboardTouchpadStatsInteractorTest : SysuiTestCase() { fun dataAddedOnUpdateShortcutTriggerTime() = testScope.runTest { val model by collectLastValue( kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK_GESTURE) ) collectLastValue(kosmos.contextualEducationRepository.readGestureEduModelFlow(BACK)) assertThat(model?.lastShortcutTriggeredTime).isNull() underTest.updateShortcutTriggerTime(BACK_GESTURE) underTest.updateShortcutTriggerTime(BACK) assertThat(model?.lastShortcutTriggeredTime).isEqualTo(kosmos.fakeEduClock.instant()) } }
packages/SystemUI/shared/src/com/android/systemui/shared/education/GestureType.ktdeleted 100644 → 0 +0 −21 Original line number Diff line number Diff line /* * Copyright 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shared.education enum class GestureType { BACK_GESTURE, }