From fdf954a35338367b847b95a867a6022ca91a16e7 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 13 Nov 2019 14:14:30 -0800 Subject: [PATCH] Check if returned surface params are null before adding them for surface transform We call finish recents animation before app switch animation finishes. When we finish, the live tile params are not cleared up. This change takes care of - clean up recents animation targets when it's finished - do a sanity check on live tile surface params before adding them to the surface transform array Fixes: 143889142 Test: Swipe up to Overview in live tile mode, switch to a different task, and make sure it doesn't crash anymore Change-Id: I089cf0a97744461d1fec4d0c97e0c3c6c1049ae3 --- .../src/com/android/quickstep/BaseSwipeUpHandler.java | 8 +++++++- .../src/com/android/quickstep/FallbackSwipeHandler.java | 5 ++--- .../src/com/android/quickstep/LauncherSwipeHandler.java | 3 --- .../src/com/android/quickstep/TaskViewUtils.java | 7 +++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 4f50e33b00..b14da5c8d8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -48,12 +48,12 @@ import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory; +import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AppWindowAnimationHelper; import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams; import com.android.quickstep.util.RectFSpringAnim; -import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -285,12 +285,18 @@ public abstract class BaseSwipeUpHandler @Override public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) { super.onRecentsAnimationCanceled(thumbnailData); - if (mRecentsView != null) { - mRecentsView.setRecentsAnimationTargets(null, null); - } mActivityInitListener.unregister(); mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED); ActiveGestureLog.INSTANCE.addLog("cancelRecentsAnimation"); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java index 2522c0fb96..bfe5738ba5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java @@ -172,8 +172,11 @@ public final class TaskViewUtils { AppWindowAnimationHelper.TransformParams liveTileParams = v.getRecentsView().getLiveTileParams(true /* mightNeedToRefill */); if (liveTileParams != null) { - Collections.addAll(surfaceParamsList, - liveTileAnimationHelper.getSurfaceParams(liveTileParams)); + SurfaceParams[] liveTileSurfaceParams = + liveTileAnimationHelper.getSurfaceParams(liveTileParams); + if (liveTileSurfaceParams != null) { + Collections.addAll(surfaceParamsList, liveTileSurfaceParams); + } } } // Apply surface transform using the surface params list.