Skip TaskView settledProgress and fullscreenProgress updates for same progress value
This prevents calling settledProgress with the same value multiple times during the onFullscreenProgress animation. It was causing a performance issue when the icon visibility was switching between VISIBILE and INVISIBLE each frame of the animation. More information in the comments of b/398318613.
Bug: 398318613
Flag: com.android.launcher3.enable_overview_icon_menu
Test: Manual
Test: systemui-thermal-throttling-3-suite
Change-Id: Ib24bfd7541bb177d7141718fa36d2349f7ec9d46
diff --git a/quickstep/src/com/android/quickstep/views/IconAppChipView.kt b/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
index 8d53552..c20aa11 100644
--- a/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
+++ b/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
@@ -428,7 +428,6 @@
private const val INDEX_CONTENT_ALPHA = 0
private const val INDEX_COLOR_FILTER_ALPHA = 1
private const val INDEX_MODAL_ALPHA = 2
-
/** Used to hide the app chip for 90:10 flex split. */
private const val INDEX_MINIMUM_RATIO_ALPHA = 3
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt
index 276318c..f58ecbc 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -309,8 +309,10 @@
// progress: 0 = show icon and no insets; 1 = don't show icon and show full insets.
protected var fullscreenProgress = 0f
set(value) {
- field = Utilities.boundToRange(value, 0f, 1f)
- onFullscreenProgressChanged(field)
+ if (value != field) {
+ field = Utilities.boundToRange(value, 0f, 1f)
+ onFullscreenProgressChanged(field)
+ }
}
// gridProgress 0 = carousel; 1 = 2 row grid.
@@ -490,8 +492,10 @@
// 1 = The TaskView is settled and no longer transitioning
private var settledProgress = 1f
set(value) {
- field = value
- onSettledProgressUpdated(field)
+ if (value != field) {
+ field = value
+ onSettledProgressUpdated(field)
+ }
}
private val settledProgressPropertyFactory =
@@ -1687,7 +1691,9 @@
protected open fun onFullscreenProgressChanged(fullscreenProgress: Float) {
taskContainers.forEach {
- it.iconView.setVisibility(if (fullscreenProgress < 1) VISIBLE else INVISIBLE)
+ if (!enableOverviewIconMenu()) {
+ it.iconView.setVisibility(if (fullscreenProgress < 1) VISIBLE else INVISIBLE)
+ }
it.overlay.setFullscreenProgress(fullscreenProgress)
}
settledProgressFullscreen =