Fix taskbar flickering when clicking its bottom part
Using `MAIN_EXECUTOR.execute` caused the callback to sometimes
be postponed and executed out of order of other callbacks scheduled
using `Utilities.postAsyncCallback` (which uses asynchronous
messages instead [1]).
See detailed explanation in http://b/382015083#comment7.
[1] https://developer.android.com/reference/android/os/Message#setAsynchronous(boolean)
Bug: 382015083
Flag: EXEMPT bugfix
Test: manual
Change-Id: I409cf668764ffc8f7ba19b8c5e29426464ed6142
diff --git a/quickstep/src/com/android/quickstep/HomeVisibilityState.kt b/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
index 241e16d..1345e0b 100644
--- a/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
+++ b/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
@@ -18,6 +18,7 @@
import android.os.RemoteException
import android.util.Log
+import com.android.launcher3.Utilities
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.util.Executors
import com.android.wm.shell.shared.IHomeTransitionListener.Stub
@@ -41,10 +42,13 @@
transitions?.setHomeTransitionListener(
object : Stub() {
override fun onHomeVisibilityChanged(isVisible: Boolean) {
- Executors.MAIN_EXECUTOR.execute {
- isHomeVisible = isVisible
- listeners.forEach { it.onHomeVisibilityChanged(isVisible) }
- }
+ Utilities.postAsyncCallback(
+ Executors.MAIN_EXECUTOR.handler,
+ {
+ isHomeVisible = isVisible
+ listeners.forEach { it.onHomeVisibilityChanged(isVisible) }
+ },
+ )
}
}
)