Fix issue with swipe up animation stalling after swiping up
- When the launcher activity is killed, the next init will attempt to
create a sync applier, which uses the ViewRootImpl of the target
view. But when onActivityInit() is called, the recents view has not
been attached to the hierarchy so the view root is not accessible.
The SyncRtSurfaceTransactionApplier also ignores scheduling all
updates when it has a non-existant view root, which leads to the
app surface getting stuck midway during a swipe up (only affects the
duration of the animation)
Bug: 119661847
Test: adb shell am force-stop com.google.android.apps.nexuslauncher
then try and swipe up slowly
Change-Id: I8eef9fe38c55c0cb438d63b41c335f78679278a3
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 78a2055..878af1b 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -403,7 +403,20 @@
}
mRecentsView = activity.getOverviewPanel();
- mSyncTransactionApplier = new SyncRtSurfaceTransactionApplier(mRecentsView);
+ mRecentsView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
+ @Override
+ public void onViewAttachedToWindow(View v) {
+ // We can only initialize the SyncRtSurfaceTransactionApplier when the view has been
+ // attached
+ mSyncTransactionApplier = new SyncRtSurfaceTransactionApplier(mRecentsView);
+ mRecentsView.removeOnAttachStateChangeListener(this);
+ }
+
+ @Override
+ public void onViewDetachedFromWindow(View v) {
+ // Do nothing
+ }
+ });
mQuickScrubController = mRecentsView.getQuickScrubController();
mLayoutListener = mActivityControlHelper.createLayoutListener(mActivity);