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

Commit 580cdfe1 authored by Thales Lima's avatar Thales Lima Committed by Android (Google) Code Review
Browse files

Merge "Use flag to determine which thread to use..." into main

parents 971e9ce2 5ce77165
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.tracing.Trace
import com.android.app.tracing.traceSection
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags
import com.android.wm.shell.common.WorkSerializer
import com.android.wm.shell.desktopmode.DisplayDeskState
import com.android.wm.shell.desktopmode.data.persistence.DesktopPersistentRepository
@@ -67,8 +68,14 @@ class DesktopRepository(
    private val activeTasksListeners = ArraySet<ActiveTasksListener>()
    private val visibleTasksListeners = ArrayMap<VisibleTasksListener, Executor>()

    private val persistentUpdateQueue = WorkSerializer(bgCoroutineScope)

    private val persistentUpdateQueue =
        WorkSerializer(
            if (Flags.repositoryBasedPersistenceBgThread()) {
                bgCoroutineScope
            } else {
                mainCoroutineScope
            }
        )
    /* Tracks corner/caption regions of desktop tasks, used to determine gesture exclusion. */
    private val desktopExclusionRegions = SparseArray<Region>()

+10 −2
Original line number Diff line number Diff line
@@ -51,7 +51,9 @@ import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.util.StubTransaction
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.cancel
import kotlinx.coroutines.test.TestScope
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -89,6 +91,7 @@ class DesktopImmersiveControllerTest : ShellTestCase() {

    private lateinit var controller: DesktopImmersiveController
    private lateinit var desktopRepository: DesktopRepository
    private val testScope = TestScope()

    @Before
    fun setUp() {
@@ -100,8 +103,8 @@ class DesktopImmersiveControllerTest : ShellTestCase() {
                mock(),
                mock(),
                mock(),
                mock(),
                TestScope(),
                testScope.backgroundScope,
                testScope.backgroundScope,
                mock(),
                desktopState,
                desktopConfig,
@@ -128,6 +131,11 @@ class DesktopImmersiveControllerTest : ShellTestCase() {
        desktopRepository.setActiveDesk(DEFAULT_DISPLAY, DEFAULT_DESK_ID)
    }

    @After
    fun tearDown() {
        testScope.cancel()
    }

    @Test
    fun enterImmersive_transitionReady_updatesRepository() {
        val task = createFreeformTask()
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ class DesksTransitionObserverTest : ShellTestCase() {
                /* shellController= */ mockShellController,
                /* persistentRepository= */ mock(),
                /* repositoryInitializer= */ mock(),
                testScope,
                testScope.backgroundScope,
                testScope.backgroundScope,
                /* userManager= */ mock(),
                desktopState,
+5 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertNotNull
import kotlinx.coroutines.cancel
import kotlinx.coroutines.test.TestScope
import org.junit.After
import org.junit.Assert.fail
@@ -71,6 +72,7 @@ class DesktopHeaderManageWindowsMenuTest : ShellTestCase() {
    private lateinit var desktopConfig: FakeDesktopConfig

    private var menu: DesktopHeaderManageWindowsMenu? = null
    private val testScope = TestScope()

    @Before
    fun setUp() {
@@ -92,8 +94,8 @@ class DesktopHeaderManageWindowsMenuTest : ShellTestCase() {
                shellController = mock(),
                persistentRepository = mock(),
                repositoryInitializer = mock(),
                mainCoroutineScope = mock(),
                bgCoroutineScope = TestScope(),
                mainCoroutineScope = testScope.backgroundScope,
                bgCoroutineScope = testScope.backgroundScope,
                userManager = mockUserManager,
                desktopState = desktopState,
                desktopConfig = desktopConfig,
@@ -108,6 +110,7 @@ class DesktopHeaderManageWindowsMenuTest : ShellTestCase() {
    fun tearDown() {
        menu?.removeFromContainer()
        mockitoSession.finishMocking()
        testScope.cancel()
    }

    @Test