Loading packages/SystemUI/aconfig/systemui.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -1236,6 +1236,13 @@ flag { is_fixed_read_only: true } flag { name: "glanceable_hub_back_action" namespace: "systemui" description: "Support back action from glanceable hub" bug: "382771533" } flag { name: "dream_overlay_updated_font" namespace: "systemui" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.back.domain.interactor import android.platform.test.annotations.EnableFlags import android.platform.test.annotations.RequiresFlagsDisabled import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider Loading @@ -31,6 +32,7 @@ import androidx.test.filters.SmallTest import com.android.internal.statusbar.IStatusBarService import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.CommunalBackActionInteractor import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope Loading Loading @@ -93,6 +95,7 @@ class BackActionInteractorTest : SysuiTestCase() { @Mock private lateinit var onBackInvokedDispatcher: WindowOnBackInvokedDispatcher @Mock private lateinit var iStatusBarService: IStatusBarService @Mock private lateinit var headsUpManager: HeadsUpManager @Mock private lateinit var communalBackActionInteractor: CommunalBackActionInteractor private val keyguardRepository = FakeKeyguardRepository() private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor by lazy { Loading @@ -117,6 +120,7 @@ class BackActionInteractorTest : SysuiTestCase() { windowRootViewVisibilityInteractor, shadeBackActionInteractor, qsController, communalBackActionInteractor, ) } Loading Loading @@ -306,6 +310,19 @@ class BackActionInteractorTest : SysuiTestCase() { verify(shadeBackActionInteractor).onBackProgressed(0.4f) } @Test @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_BACK_ACTION) fun onBackAction_communalCanBeDismissed_communalBackActionInteractorCalled() { backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() val callback = getBackInvokedCallback() whenever(communalBackActionInteractor.canBeDismissed()).thenReturn(true) callback.onBackInvoked() verify(communalBackActionInteractor).onBackPressed() } private fun getBackInvokedCallback(): OnBackInvokedCallback { testScope.runCurrent() val captor = argumentCaptor<OnBackInvokedCallback>() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 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.communal.domain.interactor import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.communalSceneRepository import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.runCurrent import com.android.systemui.kosmos.runTest import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith @SmallTest @OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalBackActionInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private var Kosmos.underTest by Fixture { communalBackActionInteractor } @Test @EnableFlags(FLAG_COMMUNAL_HUB) fun communalShowing_canBeDismissed() = kosmos.runTest { setCommunalAvailable(true) assertThat(underTest.canBeDismissed()).isEqualTo(false) communalInteractor.changeScene(CommunalScenes.Communal, "test") runCurrent() assertThat(underTest.canBeDismissed()).isEqualTo(true) } @Test @EnableFlags(FLAG_COMMUNAL_HUB) fun onBackPressed_invokesSceneChange() = kosmos.runTest { underTest.onBackPressed() runCurrent() assertThat(communalSceneRepository.currentScene.value).isEqualTo(CommunalScenes.Blank) } } packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt +0 −13 Original line number Diff line number Diff line Loading @@ -129,19 +129,6 @@ class CommunalTutorialInteractorTest : SysuiTestCase() { assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_STARTED) } @Test fun tutorialState_startedAndCommunalSceneShowing_stateWillNotUpdate() = testScope.runTest { val tutorialSettingState by collectLastValue(communalTutorialRepository.tutorialSettingState) communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_STARTED) goToCommunal() assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_STARTED) } @Test fun tutorialState_completedAndCommunalSceneShowing_stateWillNotUpdate() = testScope.runTest { Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import static com.android.systemui.Flags.glanceableHubBackAction; import static com.android.systemui.shared.Flags.shadeAllowBackGesture; import android.annotation.LongDef; Loading Loading @@ -352,6 +353,10 @@ public class QuickStepContract { } // Disable back gesture on the hub, but not when the shade is showing. if ((sysuiStateFlags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) { // Allow back gesture on Glanceable Hub with back action support. if (glanceableHubBackAction()) { return false; } // Use QS expanded signal as the notification panel is always considered visible // expanded when on the lock screen and when opening hub over lock screen. This does // mean that back gesture is disabled when opening shade over hub while in portrait Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -1236,6 +1236,13 @@ flag { is_fixed_read_only: true } flag { name: "glanceable_hub_back_action" namespace: "systemui" description: "Support back action from glanceable hub" bug: "382771533" } flag { name: "dream_overlay_updated_font" namespace: "systemui" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/back/domain/interactor/BackActionInteractorTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.back.domain.interactor import android.platform.test.annotations.EnableFlags import android.platform.test.annotations.RequiresFlagsDisabled import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider Loading @@ -31,6 +32,7 @@ import androidx.test.filters.SmallTest import com.android.internal.statusbar.IStatusBarService import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.domain.interactor.CommunalBackActionInteractor import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope Loading Loading @@ -93,6 +95,7 @@ class BackActionInteractorTest : SysuiTestCase() { @Mock private lateinit var onBackInvokedDispatcher: WindowOnBackInvokedDispatcher @Mock private lateinit var iStatusBarService: IStatusBarService @Mock private lateinit var headsUpManager: HeadsUpManager @Mock private lateinit var communalBackActionInteractor: CommunalBackActionInteractor private val keyguardRepository = FakeKeyguardRepository() private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor by lazy { Loading @@ -117,6 +120,7 @@ class BackActionInteractorTest : SysuiTestCase() { windowRootViewVisibilityInteractor, shadeBackActionInteractor, qsController, communalBackActionInteractor, ) } Loading Loading @@ -306,6 +310,19 @@ class BackActionInteractorTest : SysuiTestCase() { verify(shadeBackActionInteractor).onBackProgressed(0.4f) } @Test @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_BACK_ACTION) fun onBackAction_communalCanBeDismissed_communalBackActionInteractorCalled() { backActionInteractor.start() windowRootViewVisibilityInteractor.setIsLockscreenOrShadeVisible(true) powerInteractor.setAwakeForTest() val callback = getBackInvokedCallback() whenever(communalBackActionInteractor.canBeDismissed()).thenReturn(true) callback.onBackInvoked() verify(communalBackActionInteractor).onBackPressed() } private fun getBackInvokedCallback(): OnBackInvokedCallback { testScope.runCurrent() val captor = argumentCaptor<OnBackInvokedCallback>() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalBackActionInteractorTest.kt 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 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.communal.domain.interactor import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.communalSceneRepository import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.runCurrent import com.android.systemui.kosmos.runTest import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith @SmallTest @OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) class CommunalBackActionInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private var Kosmos.underTest by Fixture { communalBackActionInteractor } @Test @EnableFlags(FLAG_COMMUNAL_HUB) fun communalShowing_canBeDismissed() = kosmos.runTest { setCommunalAvailable(true) assertThat(underTest.canBeDismissed()).isEqualTo(false) communalInteractor.changeScene(CommunalScenes.Communal, "test") runCurrent() assertThat(underTest.canBeDismissed()).isEqualTo(true) } @Test @EnableFlags(FLAG_COMMUNAL_HUB) fun onBackPressed_invokesSceneChange() = kosmos.runTest { underTest.onBackPressed() runCurrent() assertThat(communalSceneRepository.currentScene.value).isEqualTo(CommunalScenes.Blank) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt +0 −13 Original line number Diff line number Diff line Loading @@ -129,19 +129,6 @@ class CommunalTutorialInteractorTest : SysuiTestCase() { assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_STARTED) } @Test fun tutorialState_startedAndCommunalSceneShowing_stateWillNotUpdate() = testScope.runTest { val tutorialSettingState by collectLastValue(communalTutorialRepository.tutorialSettingState) communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_STARTED) goToCommunal() assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_STARTED) } @Test fun tutorialState_completedAndCommunalSceneShowing_stateWillNotUpdate() = testScope.runTest { Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import static com.android.systemui.Flags.glanceableHubBackAction; import static com.android.systemui.shared.Flags.shadeAllowBackGesture; import android.annotation.LongDef; Loading Loading @@ -352,6 +353,10 @@ public class QuickStepContract { } // Disable back gesture on the hub, but not when the shade is showing. if ((sysuiStateFlags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) { // Allow back gesture on Glanceable Hub with back action support. if (glanceableHubBackAction()) { return false; } // Use QS expanded signal as the notification panel is always considered visible // expanded when on the lock screen and when opening hub over lock screen. This does // mean that back gesture is disabled when opening shade over hub while in portrait Loading