Merge "Remove feature flag for OverviewCommandHelper timeout" into main

This commit is contained in:
Treehugger Robot
2025-04-17 14:33:39 -07:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 45 deletions
-10
View File
@@ -29,16 +29,6 @@ flag {
bug: "357860832"
}
flag {
name: "enable_overview_command_helper_timeout"
namespace: "launcher_overview"
description: "Enables OverviewCommandHelper new version with a timeout to prevent the queue to be unresponsive."
bug: "351122926"
metadata {
purpose: PURPOSE_BUGFIX
}
}
flag {
name: "enable_desktop_exploded_view"
namespace: "launcher_overview"
@@ -34,7 +34,6 @@ import com.android.app.tracing.traceSection
import com.android.internal.jank.Cuj
import com.android.launcher3.DeviceProfile
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
import com.android.launcher3.Flags.enableOverviewCommandHelperTimeout
import com.android.launcher3.PagedView
import com.android.launcher3.logger.LauncherAtom
import com.android.launcher3.logging.StatsLogManager
@@ -43,7 +42,6 @@ import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVER
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT
import com.android.launcher3.taskbar.TaskbarManager
import com.android.launcher3.taskbar.TaskbarUIController
import com.android.launcher3.util.Executors
import com.android.launcher3.util.RunnableList
import com.android.launcher3.util.coroutines.DispatcherProvider
import com.android.launcher3.util.coroutines.ProductionDispatchers
@@ -61,15 +59,15 @@ import com.android.quickstep.views.RecentsView
import com.android.quickstep.views.TaskView
import com.android.systemui.shared.recents.model.ThumbnailData
import com.android.systemui.shared.system.InteractionJankMonitorWrapper
import java.io.PrintWriter
import java.util.concurrent.ConcurrentLinkedDeque
import kotlin.coroutines.resume
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withTimeout
import java.io.PrintWriter
import java.util.concurrent.ConcurrentLinkedDeque
import kotlin.coroutines.resume
/** Helper class to handle various atomic commands for switching between Overview. */
class OverviewCommandHelper
@@ -125,11 +123,7 @@ constructor(
if (commandQueue.size == 1) {
Log.d(TAG, "execute: $command - queue size: ${commandQueue.size}")
if (enableOverviewCommandHelperTimeout()) {
coroutineScope.launch(dispatcherProvider.main) { processNextCommand() }
} else {
Executors.MAIN_EXECUTOR.execute { processNextCommand() }
}
coroutineScope.launch(dispatcherProvider.main) { processNextCommand() }
} else {
Log.d(TAG, "not executed: $command - queue size: ${commandQueue.size}")
}
@@ -188,25 +182,14 @@ constructor(
command.status = CommandStatus.PROCESSING
Log.d(TAG, "executing command: $command")
if (enableOverviewCommandHelperTimeout()) {
coroutineScope.launch(dispatcherProvider.main) {
traceSection("OverviewCommandHelper.executeCommandWithTimeout") {
withTimeout(QUEUE_WAIT_DURATION_IN_MS) {
executeCommandSuspended(command)
ensureActive()
onCommandFinished(command)
}
coroutineScope.launch(dispatcherProvider.main) {
traceSection("OverviewCommandHelper.executeCommandWithTimeout") {
withTimeout(QUEUE_WAIT_DURATION_IN_MS) {
executeCommandSuspended(command)
ensureActive()
onCommandFinished(command)
}
}
} else {
val result =
executeCommand(command, onCallbackResult = { onCommandFinished(command) })
Log.d(TAG, "command executed: $command with result: $result")
if (result) {
onCommandFinished(command)
} else {
Log.d(TAG, "waiting for command callback: $command")
}
}
}
@@ -16,18 +16,15 @@
package com.android.quickstep
import android.platform.test.flag.junit.SetFlagsRule
import android.view.Display.DEFAULT_DISPLAY
import androidx.test.filters.SmallTest
import com.android.app.displaylib.DisplayRepository
import com.android.launcher3.Flags
import com.android.launcher3.LauncherState
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.statemanager.StatefulActivity
import com.android.launcher3.uioverrides.QuickstepLauncher
import com.android.launcher3.util.LauncherMultivalentJUnit
import com.android.launcher3.util.TestDispatcherProvider
import com.android.launcher3.util.rule.setFlags
import com.android.quickstep.OverviewCommandHelper.CommandInfo
import com.android.quickstep.OverviewCommandHelper.CommandInfo.CommandStatus
import com.android.quickstep.OverviewCommandHelper.CommandType
@@ -45,7 +42,6 @@ import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.doAnswer
@@ -59,8 +55,6 @@ import org.mockito.kotlin.whenever
@RunWith(LauncherMultivalentJUnit::class)
@OptIn(ExperimentalCoroutinesApi::class)
class OverviewCommandHelperTest {
@get:Rule val setFlagsRule: SetFlagsRule = SetFlagsRule()
private lateinit var sut: OverviewCommandHelper
private val dispatcher = StandardTestDispatcher()
private val testScope = TestScope(dispatcher)
@@ -86,8 +80,6 @@ class OverviewCommandHelperTest {
@Suppress("UNCHECKED_CAST")
@Before
fun setup() {
setFlagsRule.setFlags(true, Flags.FLAG_ENABLE_OVERVIEW_COMMAND_HELPER_TIMEOUT)
setupDefaultDisplay()
val overviewComponentObserver = mock<OverviewComponentObserver>()