Loading quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java +46 −41 Original line number Diff line number Diff line Loading @@ -15,27 +15,32 @@ */ package com.android.quickstep; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.UiThreadHelper; import com.android.quickstep.util.RemoteAnimationTargetSet; import com.android.systemui.shared.system.BackgroundExecutor; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import java.util.concurrent.ExecutorService; /** * Wrapper around RecentsAnimationController to help with some synchronization */ public class RecentsAnimationWrapper { public RecentsAnimationControllerCompat controller; public RemoteAnimationTargetSet targetSet; private RecentsAnimationControllerCompat mController; private boolean mInputConsumerEnabled = false; private boolean mBehindSystemBars = true; private boolean mSplitScreenMinimized = false; private final ExecutorService mExecutorService = new LooperExecutor(UiThreadHelper.getBackgroundLooper()); public synchronized void setController( RecentsAnimationControllerCompat controller, RemoteAnimationTargetSet targetSet) { TraceHelper.partitionSection("RecentsController", "Set controller " + controller); this.controller = controller; this.mController = controller; this.targetSet = targetSet; if (mInputConsumerEnabled) { Loading @@ -48,8 +53,9 @@ public class RecentsAnimationWrapper { * on the background thread. */ public void finish(boolean toHome, Runnable onFinishComplete) { BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; mController = null; TraceHelper.endSection("RecentsController", "Finish " + controller + ", toHome=" + toHome); if (controller != null) { Loading @@ -58,8 +64,6 @@ public class RecentsAnimationWrapper { if (onFinishComplete != null) { onFinishComplete.run(); } controller = null; } } }); } Loading @@ -67,14 +71,13 @@ public class RecentsAnimationWrapper { public void enableInputConsumer() { mInputConsumerEnabled = true; if (mInputConsumerEnabled) { BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Enabling consumer on " + controller); if (controller != null) { controller.setInputConsumerEnabled(true); } } }); } } Loading @@ -84,14 +87,13 @@ public class RecentsAnimationWrapper { return; } mBehindSystemBars = behindSystemBars; BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Setting behind system bars on " + controller); if (controller != null) { controller.setAnimationTargetsBehindSystemBars(behindSystemBars); } } }); } Loading @@ -106,25 +108,28 @@ public class RecentsAnimationWrapper { return; } mSplitScreenMinimized = minimized; BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Setting minimize dock on " + controller); if (controller != null) { controller.setSplitScreenMinimized(minimized); } } }); } public void hideCurrentInputMethod() { BackgroundExecutor.get().submit(() -> { synchronized (this) { TraceHelper.partitionSection("RecentsController", "Hiding currentinput method"); mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Hiding currentinput method on " + controller); if (controller != null) { controller.hideCurrentInputMethod(); } } }); } public RecentsAnimationControllerCompat getController() { return mController; } } quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +31 −36 Original line number Diff line number Diff line Loading @@ -491,21 +491,18 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private void updateFinalShift() { float shift = mCurrentShift.value; synchronized (mRecentsAnimationWrapper) { if (mRecentsAnimationWrapper.controller != null) { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { Interpolator interpolator = mInteractionType == INTERACTION_QUICK_SCRUB ? ACCEL_2 : LINEAR; float interpolated = interpolator.getInterpolation(shift); mClipAnimationHelper.applyTransform( mRecentsAnimationWrapper.targetSet, interpolated); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, interpolated); // TODO: This logic is spartanic! boolean passedThreshold = shift > 0.12f; mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold); if (mActivityControlHelper.shouldMinimizeSplitScreen()) { mRecentsAnimationWrapper .setSplitScreenMinimizedForTransaction(passedThreshold); } mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold); } } Loading Loading @@ -707,12 +704,11 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private void switchToScreenshot() { boolean finishTransitionPosted = false; synchronized (mRecentsAnimationWrapper) { if (mRecentsAnimationWrapper.controller != null) { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { // Update the screenshot of the task if (mTaskSnapshot == null) { mTaskSnapshot = mRecentsAnimationWrapper.controller .screenshotTask(mRunningTaskId); mTaskSnapshot = controller.screenshotTask(mRunningTaskId); } TaskView taskView = mRecentsView.updateThumbnail(mRunningTaskId, mTaskSnapshot); mRecentsView.setRunningTaskHidden(false); Loading @@ -729,7 +725,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { }.attach(); } } } if (!finishTransitionPosted) { // If we haven't posted a draw callback, set the state immediately. setStateOnUiThread(STATE_SCREENSHOT_CAPTURED); Loading Loading
quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java +46 −41 Original line number Diff line number Diff line Loading @@ -15,27 +15,32 @@ */ package com.android.quickstep; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.UiThreadHelper; import com.android.quickstep.util.RemoteAnimationTargetSet; import com.android.systemui.shared.system.BackgroundExecutor; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import java.util.concurrent.ExecutorService; /** * Wrapper around RecentsAnimationController to help with some synchronization */ public class RecentsAnimationWrapper { public RecentsAnimationControllerCompat controller; public RemoteAnimationTargetSet targetSet; private RecentsAnimationControllerCompat mController; private boolean mInputConsumerEnabled = false; private boolean mBehindSystemBars = true; private boolean mSplitScreenMinimized = false; private final ExecutorService mExecutorService = new LooperExecutor(UiThreadHelper.getBackgroundLooper()); public synchronized void setController( RecentsAnimationControllerCompat controller, RemoteAnimationTargetSet targetSet) { TraceHelper.partitionSection("RecentsController", "Set controller " + controller); this.controller = controller; this.mController = controller; this.targetSet = targetSet; if (mInputConsumerEnabled) { Loading @@ -48,8 +53,9 @@ public class RecentsAnimationWrapper { * on the background thread. */ public void finish(boolean toHome, Runnable onFinishComplete) { BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; mController = null; TraceHelper.endSection("RecentsController", "Finish " + controller + ", toHome=" + toHome); if (controller != null) { Loading @@ -58,8 +64,6 @@ public class RecentsAnimationWrapper { if (onFinishComplete != null) { onFinishComplete.run(); } controller = null; } } }); } Loading @@ -67,14 +71,13 @@ public class RecentsAnimationWrapper { public void enableInputConsumer() { mInputConsumerEnabled = true; if (mInputConsumerEnabled) { BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Enabling consumer on " + controller); if (controller != null) { controller.setInputConsumerEnabled(true); } } }); } } Loading @@ -84,14 +87,13 @@ public class RecentsAnimationWrapper { return; } mBehindSystemBars = behindSystemBars; BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Setting behind system bars on " + controller); if (controller != null) { controller.setAnimationTargetsBehindSystemBars(behindSystemBars); } } }); } Loading @@ -106,25 +108,28 @@ public class RecentsAnimationWrapper { return; } mSplitScreenMinimized = minimized; BackgroundExecutor.get().submit(() -> { synchronized (this) { mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Setting minimize dock on " + controller); if (controller != null) { controller.setSplitScreenMinimized(minimized); } } }); } public void hideCurrentInputMethod() { BackgroundExecutor.get().submit(() -> { synchronized (this) { TraceHelper.partitionSection("RecentsController", "Hiding currentinput method"); mExecutorService.submit(() -> { RecentsAnimationControllerCompat controller = mController; TraceHelper.partitionSection("RecentsController", "Hiding currentinput method on " + controller); if (controller != null) { controller.hideCurrentInputMethod(); } } }); } public RecentsAnimationControllerCompat getController() { return mController; } }
quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +31 −36 Original line number Diff line number Diff line Loading @@ -491,21 +491,18 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private void updateFinalShift() { float shift = mCurrentShift.value; synchronized (mRecentsAnimationWrapper) { if (mRecentsAnimationWrapper.controller != null) { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { Interpolator interpolator = mInteractionType == INTERACTION_QUICK_SCRUB ? ACCEL_2 : LINEAR; float interpolated = interpolator.getInterpolation(shift); mClipAnimationHelper.applyTransform( mRecentsAnimationWrapper.targetSet, interpolated); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, interpolated); // TODO: This logic is spartanic! boolean passedThreshold = shift > 0.12f; mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold); if (mActivityControlHelper.shouldMinimizeSplitScreen()) { mRecentsAnimationWrapper .setSplitScreenMinimizedForTransaction(passedThreshold); } mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold); } } Loading Loading @@ -707,12 +704,11 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private void switchToScreenshot() { boolean finishTransitionPosted = false; synchronized (mRecentsAnimationWrapper) { if (mRecentsAnimationWrapper.controller != null) { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { // Update the screenshot of the task if (mTaskSnapshot == null) { mTaskSnapshot = mRecentsAnimationWrapper.controller .screenshotTask(mRunningTaskId); mTaskSnapshot = controller.screenshotTask(mRunningTaskId); } TaskView taskView = mRecentsView.updateThumbnail(mRunningTaskId, mTaskSnapshot); mRecentsView.setRunningTaskHidden(false); Loading @@ -729,7 +725,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { }.attach(); } } } if (!finishTransitionPosted) { // If we haven't posted a draw callback, set the state immediately. setStateOnUiThread(STATE_SCREENSHOT_CAPTURED); Loading