Loading quickstep/src/com/android/quickstep/RecentsAnimationController.java +14 −3 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.UiThread; import androidx.annotation.UiThread; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.RunnableList; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; Loading @@ -43,6 +44,8 @@ public class RecentsAnimationController { private boolean mUseLauncherSysBarFlags = false; private boolean mUseLauncherSysBarFlags = false; private boolean mSplitScreenMinimized = false; private boolean mSplitScreenMinimized = false; private boolean mFinishRequested = false; private RunnableList mPendingFinishCallbacks = new RunnableList(); public RecentsAnimationController(RecentsAnimationControllerCompat controller, public RecentsAnimationController(RecentsAnimationControllerCompat controller, boolean allowMinimizeSplitScreen, boolean allowMinimizeSplitScreen, Loading Loading @@ -132,14 +135,22 @@ public class RecentsAnimationController { @UiThread @UiThread public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) { public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) { if (mFinishRequested) { // If finishing, add to pending finish callbacks, otherwise, if finished, adding to the // destroyed RunnableList will just trigger the callback to be called immediately mPendingFinishCallbacks.add(callback); return; } // Finish not yet requested mFinishRequested = true; mOnFinishedListener.accept(this); mOnFinishedListener.accept(this); mPendingFinishCallbacks.add(callback); UI_HELPER_EXECUTOR.execute(() -> { UI_HELPER_EXECUTOR.execute(() -> { mController.finish(toRecents, sendUserLeaveHint); mController.finish(toRecents, sendUserLeaveHint); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME); if (callback != null) { MAIN_EXECUTOR.execute(mPendingFinishCallbacks::executeAllAndDestroy); MAIN_EXECUTOR.execute(callback); } }); }); } } Loading src/com/android/launcher3/util/RunnableList.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,9 @@ public class RunnableList { * Ads a runnable to this list * Ads a runnable to this list */ */ public void add(Runnable runnable) { public void add(Runnable runnable) { if (runnable == null) { return; } if (mDestroyed) { if (mDestroyed) { runnable.run(); runnable.run(); return; return; Loading Loading
quickstep/src/com/android/quickstep/RecentsAnimationController.java +14 −3 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import androidx.annotation.NonNull; import androidx.annotation.UiThread; import androidx.annotation.UiThread; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.RunnableList; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; Loading @@ -43,6 +44,8 @@ public class RecentsAnimationController { private boolean mUseLauncherSysBarFlags = false; private boolean mUseLauncherSysBarFlags = false; private boolean mSplitScreenMinimized = false; private boolean mSplitScreenMinimized = false; private boolean mFinishRequested = false; private RunnableList mPendingFinishCallbacks = new RunnableList(); public RecentsAnimationController(RecentsAnimationControllerCompat controller, public RecentsAnimationController(RecentsAnimationControllerCompat controller, boolean allowMinimizeSplitScreen, boolean allowMinimizeSplitScreen, Loading Loading @@ -132,14 +135,22 @@ public class RecentsAnimationController { @UiThread @UiThread public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) { public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) { if (mFinishRequested) { // If finishing, add to pending finish callbacks, otherwise, if finished, adding to the // destroyed RunnableList will just trigger the callback to be called immediately mPendingFinishCallbacks.add(callback); return; } // Finish not yet requested mFinishRequested = true; mOnFinishedListener.accept(this); mOnFinishedListener.accept(this); mPendingFinishCallbacks.add(callback); UI_HELPER_EXECUTOR.execute(() -> { UI_HELPER_EXECUTOR.execute(() -> { mController.finish(toRecents, sendUserLeaveHint); mController.finish(toRecents, sendUserLeaveHint); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME); if (callback != null) { MAIN_EXECUTOR.execute(mPendingFinishCallbacks::executeAllAndDestroy); MAIN_EXECUTOR.execute(callback); } }); }); } } Loading
src/com/android/launcher3/util/RunnableList.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,9 @@ public class RunnableList { * Ads a runnable to this list * Ads a runnable to this list */ */ public void add(Runnable runnable) { public void add(Runnable runnable) { if (runnable == null) { return; } if (mDestroyed) { if (mDestroyed) { runnable.run(); runnable.run(); return; return; Loading