Loading quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +15 −30 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; Loading @@ -59,10 +63,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import java.util.function.BiPredicate; import java.util.function.Consumer; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; /** * {@link ActivityControlHelper} for the in-launcher recents. */ Loading Loading @@ -163,21 +163,16 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe } activity.getStateManager().setRestState(resetState); final LauncherState fromState; if (!activityVisible) { // Since the launcher is not visible, we can safely reset the scroll position. final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; activity.getStateManager().goToState(fromState, false); // Since all apps is not visible, we can safely reset the scroll position. // This ensures then the next swipe up to all-apps starts from scroll 0. activity.getAppsView().reset(false /* animate */); fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; activity.getStateManager().goToState(fromState, false); // Optimization, hide the all apps view to prevent layout while initializing activity.getAppsView().getContentView().setVisibility(View.GONE); AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal); } else { fromState = startState; } return new AnimationFactory() { private Animator mShelfAnim; Loading @@ -185,8 +180,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe @Override public void createActivityController(long transitionLength) { createActivityControllerInternal(activity, activityVisible, fromState, transitionLength, callback); createActivityControllerInternal(activity, fromState, transitionLength, callback); } @Override Loading Loading @@ -230,18 +224,9 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe }; } private void createActivityControllerInternal(Launcher activity, boolean wasVisible, LauncherState fromState, long transitionLength, Consumer<AnimatorPlaybackController> callback) { private void createActivityControllerInternal(Launcher activity, LauncherState fromState, long transitionLength, Consumer<AnimatorPlaybackController> callback) { LauncherState endState = OVERVIEW; if (wasVisible && fromState != BACKGROUND_APP) { // If a translucent app was launched fom launcher, animate launcher states. DeviceProfile dp = activity.getDeviceProfile(); long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); callback.accept(activity.getStateManager() .createAnimationToNewWorkspace(fromState, endState, accuracy)); return; } if (fromState == endState) { return; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +22 −6 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ import android.view.WindowInsets; import android.view.WindowManager; import android.view.animation.Interpolator; import androidx.annotation.NonNull; import androidx.annotation.UiThread; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; Loading Loading @@ -103,9 +106,6 @@ import com.android.systemui.shared.system.WindowCallbacksCompat; import java.util.function.BiFunction; import java.util.function.Consumer; import androidx.annotation.NonNull; import androidx.annotation.UiThread; @TargetApi(Build.VERSION_CODES.O) public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> implements SwipeAnimationListener, OnApplyWindowInsetsListener { Loading Loading @@ -429,8 +429,19 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> // If we've already ended the gesture and are going home, don't prepare recents UI, // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL. if (mGestureEndTarget != HOME) { Runnable initAnimFactory = () -> { mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity, mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated); mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated); }; if (mWasLauncherAlreadyVisible) { // Launcher is visible, but might be about to stop. Thus, if we prepare recents // now, it might get overridden by moveToRestState() in onStop(). To avoid this, // wait until the next gesture (and possibly launcher) starts. mStateCallback.addCallback(STATE_GESTURE_STARTED, initAnimFactory); } else { initAnimFactory.run(); } } AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible); Loading Loading @@ -1044,7 +1055,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> } private void invalidateHandlerWithLauncher() { if (mLauncherTransitionController != null) { if (mLauncherTransitionController.getAnimationPlayer().isStarted()) { mLauncherTransitionController.getAnimationPlayer().cancel(); } mLauncherTransitionController = null; } mRecentsView.setEnableFreeScroll(true); mRecentsView.setRunningTaskIconScaledDown(false); Loading Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +15 −30 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; Loading @@ -59,10 +63,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import java.util.function.BiPredicate; import java.util.function.Consumer; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; /** * {@link ActivityControlHelper} for the in-launcher recents. */ Loading Loading @@ -163,21 +163,16 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe } activity.getStateManager().setRestState(resetState); final LauncherState fromState; if (!activityVisible) { // Since the launcher is not visible, we can safely reset the scroll position. final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; activity.getStateManager().goToState(fromState, false); // Since all apps is not visible, we can safely reset the scroll position. // This ensures then the next swipe up to all-apps starts from scroll 0. activity.getAppsView().reset(false /* animate */); fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; activity.getStateManager().goToState(fromState, false); // Optimization, hide the all apps view to prevent layout while initializing activity.getAppsView().getContentView().setVisibility(View.GONE); AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal); } else { fromState = startState; } return new AnimationFactory() { private Animator mShelfAnim; Loading @@ -185,8 +180,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe @Override public void createActivityController(long transitionLength) { createActivityControllerInternal(activity, activityVisible, fromState, transitionLength, callback); createActivityControllerInternal(activity, fromState, transitionLength, callback); } @Override Loading Loading @@ -230,18 +224,9 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe }; } private void createActivityControllerInternal(Launcher activity, boolean wasVisible, LauncherState fromState, long transitionLength, Consumer<AnimatorPlaybackController> callback) { private void createActivityControllerInternal(Launcher activity, LauncherState fromState, long transitionLength, Consumer<AnimatorPlaybackController> callback) { LauncherState endState = OVERVIEW; if (wasVisible && fromState != BACKGROUND_APP) { // If a translucent app was launched fom launcher, animate launcher states. DeviceProfile dp = activity.getDeviceProfile(); long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); callback.accept(activity.getStateManager() .createAnimationToNewWorkspace(fromState, endState, accuracy)); return; } if (fromState == endState) { return; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +22 −6 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ import android.view.WindowInsets; import android.view.WindowManager; import android.view.animation.Interpolator; import androidx.annotation.NonNull; import androidx.annotation.UiThread; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; Loading Loading @@ -103,9 +106,6 @@ import com.android.systemui.shared.system.WindowCallbacksCompat; import java.util.function.BiFunction; import java.util.function.Consumer; import androidx.annotation.NonNull; import androidx.annotation.UiThread; @TargetApi(Build.VERSION_CODES.O) public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> implements SwipeAnimationListener, OnApplyWindowInsetsListener { Loading Loading @@ -429,8 +429,19 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> // If we've already ended the gesture and are going home, don't prepare recents UI, // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL. if (mGestureEndTarget != HOME) { Runnable initAnimFactory = () -> { mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity, mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated); mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated); }; if (mWasLauncherAlreadyVisible) { // Launcher is visible, but might be about to stop. Thus, if we prepare recents // now, it might get overridden by moveToRestState() in onStop(). To avoid this, // wait until the next gesture (and possibly launcher) starts. mStateCallback.addCallback(STATE_GESTURE_STARTED, initAnimFactory); } else { initAnimFactory.run(); } } AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible); Loading Loading @@ -1044,7 +1055,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> } private void invalidateHandlerWithLauncher() { if (mLauncherTransitionController != null) { if (mLauncherTransitionController.getAnimationPlayer().isStarted()) { mLauncherTransitionController.getAnimationPlayer().cancel(); } mLauncherTransitionController = null; } mRecentsView.setEnableFreeScroll(true); mRecentsView.setRunningTaskIconScaledDown(false); Loading