Merge "Implement e2e test for desktop windowing" into main

This commit is contained in:
Treehugger Robot authored and Android (Google) Code Review committed 2024-08-08 11:32:10 +00:00
commit 3307f87b82
15 files changed
+302 -90

No files matched your search

@@ -30,6 +30,8 @@ import android.view.ViewGroup
import androidx.core.view.updateLayoutParams
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
import com.android.launcher3.R
import com.android.launcher3.testing.TestLogging
import com.android.launcher3.testing.shared.TestProtocol
import com.android.launcher3.util.RunnableList
import com.android.launcher3.util.SplitConfigurationOptions
import com.android.launcher3.util.TransformingTouchDelegate
@@ -213,7 +215,15 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
}
override fun needsUpdate(dataChange: Int, flag: Int) =
if (flag == FLAG_UPDATE_THUMBNAIL) super.needsUpdate(dataChange, flag) else false
if (flag == FLAG_UPDATE_CORNER_RADIUS) false else super.needsUpdate(dataChange, flag)
override fun onIconLoaded(taskContainer: TaskContainer) {
// Update contentDescription of snapshotView only, individual task icon is unused.
taskContainer.snapshotView.contentDescription = taskContainer.task.titleDescription
}
// Ignoring [onIconUnloaded] as all tasks shares the same Desktop icon
override fun onIconUnloaded(taskContainer: TaskContainer) {}
// thumbnailView is laid out differently and is handled in onMeasure
override fun updateThumbnailSize() {}
@@ -228,6 +238,11 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
override fun launchTaskAnimated(): RunnableList? {
val recentsView = recentsView ?: return null
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN,
"launchDesktopFromRecents",
taskIds.contentToString()
)
val endCallback = RunnableList()
val desktopController = recentsView.desktopRecentsController
checkNotNull(desktopController) { "recentsController is null" }
@@ -901,18 +901,11 @@ constructor(
it.task.icon = icon
it.task.titleDescription = contentDescription
it.task.title = title
setIcon(it.iconView, icon)
if (enableOverviewIconMenu()) {
setText(it.iconView, title)
}
it.digitalWellBeingToast?.initialize(it.task)
onIconLoaded(it)
}
?.also { request -> pendingIconLoadRequests.add(request) }
} else {
setIcon(it.iconView, null)
if (enableOverviewIconMenu()) {
setText(it.iconView, null)
}
onIconUnloaded(it)
}
}
}
@@ -931,6 +924,21 @@ constructor(
pendingIconLoadRequests.clear()
}
protected open fun onIconLoaded(taskContainer: TaskContainer) {
setIcon(taskContainer.iconView, taskContainer.task.icon)
if (enableOverviewIconMenu()) {
setText(taskContainer.iconView, taskContainer.task.title)
}
taskContainer.digitalWellBeingToast?.initialize(taskContainer.task)
}
protected open fun onIconUnloaded(taskContainer: TaskContainer) {
setIcon(taskContainer.iconView, null)
if (enableOverviewIconMenu()) {
setText(taskContainer.iconView, null)
}
}
protected fun setIcon(iconView: TaskViewIcon, icon: Drawable?) {
with(iconView) {
if (icon != null) {
@@ -1152,6 +1160,11 @@ constructor(
isClickableAsLiveTile = true
return runnableList
}
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN,
"composeRecentsLaunchAnimator",
taskIds.contentToString()
)
val runnableList = RunnableList()
with(AnimatorSet()) {
TaskViewUtils.composeRecentsLaunchAnimator(