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

Commit f9f88c9c authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Revert "Add back gesture navigation to Glanceable Hub."" into main

parents d81fcfba 76d286d2
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -1257,13 +1257,6 @@ flag {
  is_fixed_read_only: true
  is_fixed_read_only: true
}
}


flag {
    name: "glanceable_hub_back_action"
    namespace: "systemui"
    description: "Support back action from glanceable hub"
    bug: "382771533"
}

flag {
flag {
    name: "dream_overlay_updated_font"
    name: "dream_overlay_updated_font"
    namespace: "systemui"
    namespace: "systemui"
+0 −17
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package com.android.systemui.back.domain.interactor
package com.android.systemui.back.domain.interactor


import android.platform.test.annotations.EnableFlags
import android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.platform.test.flag.junit.DeviceFlagsValueProvider
@@ -32,7 +31,6 @@ import androidx.test.filters.SmallTest
import com.android.internal.statusbar.IStatusBarService
import com.android.internal.statusbar.IStatusBarService
import com.android.systemui.Flags
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
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.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.testScope
@@ -93,7 +91,6 @@ class BackActionInteractorTest : SysuiTestCase() {
    @Mock private lateinit var onBackInvokedDispatcher: WindowOnBackInvokedDispatcher
    @Mock private lateinit var onBackInvokedDispatcher: WindowOnBackInvokedDispatcher
    @Mock private lateinit var iStatusBarService: IStatusBarService
    @Mock private lateinit var iStatusBarService: IStatusBarService
    @Mock private lateinit var headsUpManager: HeadsUpManager
    @Mock private lateinit var headsUpManager: HeadsUpManager
    @Mock private lateinit var communalBackActionInteractor: CommunalBackActionInteractor


    private val keyguardRepository = FakeKeyguardRepository()
    private val keyguardRepository = FakeKeyguardRepository()
    private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor by lazy {
    private val windowRootViewVisibilityInteractor: WindowRootViewVisibilityInteractor by lazy {
@@ -118,7 +115,6 @@ class BackActionInteractorTest : SysuiTestCase() {
            windowRootViewVisibilityInteractor,
            windowRootViewVisibilityInteractor,
            shadeBackActionInteractor,
            shadeBackActionInteractor,
            qsController,
            qsController,
            communalBackActionInteractor,
        )
        )
    }
    }


@@ -297,19 +293,6 @@ class BackActionInteractorTest : SysuiTestCase() {
        verify(shadeBackActionInteractor).onBackProgressed(0.4f)
        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 {
    private fun getBackInvokedCallback(): OnBackInvokedCallback {
        testScope.runCurrent()
        testScope.runCurrent()
        val captor = argumentCaptor<OnBackInvokedCallback>()
        val captor = argumentCaptor<OnBackInvokedCallback>()
+0 −61
Original line number Original line 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 org.junit.Test
import org.junit.runner.RunWith

@SmallTest
@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)
        }
}
+13 −0
Original line number Original line Diff line number Diff line
@@ -127,6 +127,19 @@ class CommunalTutorialInteractorTest : SysuiTestCase() {
            assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_STARTED)
            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
    @Test
    fun tutorialState_completedAndCommunalSceneShowing_stateWillNotUpdate() =
    fun tutorialState_completedAndCommunalSceneShowing_stateWillNotUpdate() =
        testScope.runTest {
        testScope.runTest {
+0 −3
Original line number Original line Diff line number Diff line
@@ -16,10 +16,8 @@


package com.android.systemui.shared.system
package com.android.systemui.shared.system


import android.platform.test.annotations.DisableFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_BACK_ACTION
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_COMMUNAL_HUB_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_COMMUNAL_HUB_SHOWING
@@ -32,7 +30,6 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(AndroidJUnit4::class)
class QuickStepContractTest : SysuiTestCase() {
class QuickStepContractTest : SysuiTestCase() {
    @Test
    @Test
    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_ACTION)
    fun isBackGestureDisabled_hubShowing() {
    fun isBackGestureDisabled_hubShowing() {
        val sysuiStateFlags = SYSUI_STATE_COMMUNAL_HUB_SHOWING
        val sysuiStateFlags = SYSUI_STATE_COMMUNAL_HUB_SHOWING


Loading