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

Commit dfe59eab authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF) Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-34057912-shortcut helper multi display-OCFRAILQVW" into main

* changes:
  Revert "Added multi-display support flag for shortcut helper"
  Revert "Added multi-display support for shortcut helper"
parents 2e961148 cec9d86e
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -2116,13 +2116,3 @@ flag {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "shortcut_helper_multi_display_support"
    namespace: "systemui"
    description: "Shortcut helper is triggered on the current display"
    bug: "406740115"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+5 −23
Original line number Diff line number Diff line
@@ -22,13 +22,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.keyboard.shortcut.shared.model.ShortcutHelperState.Active
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutHelperState
import com.android.systemui.keyboard.shortcut.shortcutHelperStateRepository
import com.android.systemui.keyboard.shortcut.shortcutHelperTestHelper
import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testScope
import com.android.systemui.shade.data.repository.fakeFocusedDisplayRepository
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
@@ -54,7 +51,7 @@ class ShortcutHelperStateRepositoryTest : SysuiTestCase() {

            helper.toggle(deviceId)

            assertThat(state).isEqualTo(Active(deviceId))
            assertThat(state).isEqualTo(ShortcutHelperState.Active(deviceId))
        }

    @Test
@@ -64,7 +61,7 @@ class ShortcutHelperStateRepositoryTest : SysuiTestCase() {

            helper.showFromActivity()

            assertThat(state).isEqualTo(Active(VIRTUAL_KEYBOARD))
            assertThat(state).isEqualTo(ShortcutHelperState.Active(VIRTUAL_KEYBOARD))
        }

    @Test
@@ -76,7 +73,7 @@ class ShortcutHelperStateRepositoryTest : SysuiTestCase() {
            fakeInputManager.addPhysicalKeyboard(deviceId)
            helper.showFromActivity()

            assertThat(state).isEqualTo(Active(deviceId))
            assertThat(state).isEqualTo(ShortcutHelperState.Active(deviceId))
        }

    @Test
@@ -89,21 +86,6 @@ class ShortcutHelperStateRepositoryTest : SysuiTestCase() {
            fakeInputManager.inputManager.disableInputDevice(deviceId)
            helper.showFromActivity()

            assertThat(state).isEqualTo(Active(VIRTUAL_KEYBOARD))
        }

    @Test
    fun activeStateDisplayId_isFocusedDisplay() =
        kosmos.runTest {
            val state by collectLastValue(repo.state)

            fakeFocusedDisplayRepository.setDisplayId(DISPLAY_ID)
            helper.showFromActivity()

            assertThat((state as Active).displayId).isEqualTo(DISPLAY_ID)
        }

    private companion object {
        const val DISPLAY_ID = 5
            assertThat(state).isEqualTo(ShortcutHelperState.Active(VIRTUAL_KEYBOARD))
        }
}
+0 −3
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.keyboard.shortcut.ui

import android.content.Context
import android.content.Context.INPUT_SERVICE
import android.content.applicationContext
import android.hardware.input.fakeInputManager
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -84,12 +83,10 @@ class ShortcutHelperDialogStarterTest : SysuiTestCase() {
        with(kosmos) {
            ShortcutHelperDialogStarter(
                coroutineScope,
                applicationContext,
                viewModel,
                shortcutCustomizationDialogStarterFactory,
                dialogFactory,
                activityStarter,
                testDispatcher,
            )
        }

+0 −45
Original line number Diff line number Diff line
@@ -19,11 +19,9 @@ package com.android.systemui.keyboard.shortcut.ui.viewmodel
import android.app.role.RoleManager
import android.app.role.mockRoleManager
import android.content.Context
import android.content.applicationContext
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.content.pm.PackageManager.NameNotFoundException
import android.view.Display
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Tv
import androidx.compose.material.icons.filled.VerticalSplit
@@ -44,24 +42,18 @@ import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.System
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
import com.android.systemui.keyboard.shortcut.shared.model.shortcut
import com.android.systemui.keyboard.shortcut.shortcutHelperCategoriesInteractor
import com.android.systemui.keyboard.shortcut.shortcutHelperCustomizationModeInteractor
import com.android.systemui.keyboard.shortcut.shortcutHelperStateInteractor
import com.android.systemui.keyboard.shortcut.shortcutHelperTestHelper
import com.android.systemui.keyboard.shortcut.shortcutHelperViewModel
import com.android.systemui.keyboard.shortcut.ui.model.IconSource
import com.android.systemui.keyboard.shortcut.ui.model.ShortcutCategoryUi
import com.android.systemui.keyboard.shortcut.ui.model.ShortcutsUiState
import com.android.systemui.keyboard.shortcut.ui.viewmodel.ShortcutHelperViewModel.Companion.EXTENDED_APPS_SHORTCUT_CUSTOMIZATION_LIMIT
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.model.sysUiState
import com.android.systemui.settings.FakeUserTracker
import com.android.systemui.settings.fakeUserTracker
import com.android.systemui.settings.userTracker
import com.android.systemui.shade.data.repository.fakeFocusedDisplayRepository
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SHORTCUT_HELPER_SHOWING
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
@@ -97,20 +89,6 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
    private val fakeUserTracker = kosmos.fakeUserTracker
    private val mockRoleManager = kosmos.mockRoleManager
    private val underTest = kosmos.shortcutHelperViewModel
    private val secondaryDisplayViewModel =
        with(kosmos) {
            ShortcutHelperViewModel(
                applicationContext,
                mockRoleManager,
                userTracker,
                applicationCoroutineScope,
                testDispatcher,
                shortcutHelperStateInteractor,
                shortcutHelperCategoriesInteractor,
                shortcutHelperCustomizationModeInteractor,
                displayId = SECONDARY_DISPLAY,
            )
        }
    private val fakeDefaultShortcutCategoriesRepository =
        kosmos.fakeDefaultShortcutCategoriesRepository
    private val fakeCustomShortcutCategoriesRepository =
@@ -221,28 +199,6 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
            assertThat(shouldShowNew).isEqualTo(shouldShow)
        }

    @Test
    fun shouldShow_falseWhenShortcutHelperTriggeredFromDifferentDisplay() =
        testScope.runTest {
            kosmos.fakeFocusedDisplayRepository.setDisplayId(Display.DEFAULT_DISPLAY)
            val shouldShow by collectLastValue(secondaryDisplayViewModel.shouldShow)

            testHelper.showFromActivity()

            assertThat(shouldShow).isFalse()
        }

    @Test
    fun shouldShow_TrueWhenShortcutHelperTriggeredFromSameDisplay() =
        testScope.runTest {
            kosmos.fakeFocusedDisplayRepository.setDisplayId(SECONDARY_DISPLAY)
            val shouldShow by collectLastValue(secondaryDisplayViewModel.shouldShow)

            testHelper.showFromActivity()

            assertThat(shouldShow).isTrue()
        }

    @Test
    fun sysUiStateFlag_disabledByDefault() =
        testScope.runTest {
@@ -708,6 +664,5 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
        const val FIRST_SIMPLE_GROUP_LABEL = "simple group 1"
        const val SECOND_SIMPLE_GROUP_LABEL = "simple group 2"
        const val TEST_PACKAGE = "test.package.name"
        const val SECONDARY_DISPLAY = 5
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -110,9 +110,5 @@ interface SystemUIDisplaySubcomponent {
         * removed, and the component will be destroyed.
         */
        fun stop() {}

        companion object {
            val NOP: LifecycleListener = object : LifecycleListener {}
        }
    }
}
Loading