Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce07a372 authored by Tony Wickham's avatar Tony Wickham
Browse files

Defer some heavy work from final frame of app -> home transition

- Call reapplyState() on the next frame after settling on home.
- Post some calls from RecentsView#reset() to the next frame.
- Remove onSwipeUpToRecentsComplete() which only called reapplyState()
  uncessarily.
- Also animate TASK_SECONDARY_TRANSLATION back to 0 to ensure state
  machine is in sync with long swipe resistance properties.

Test: profile swipe to home, significantly reduced last frame time.
Bug: 183139317
Change-Id: I37b1829f6f1d5a718e99c131935b87b5200d567f
parent 9d16d7f1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
        setter.setFloat(mRecentsView, ADJACENT_PAGE_VERTICAL_OFFSET, scaleAndOffset[2],
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
        setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
        PagedOrientationHandler orientationHandler =
                ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
        FloatProperty taskViewsFloat = orientationHandler.getSplitSelectTaskOffset(
+0 −1
Original line number Diff line number Diff line
@@ -1519,7 +1519,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

    private void setupLauncherUiAfterSwipeUpToRecentsAnimation() {
        endLauncherTransitionController();
        mActivityInterface.onSwipeUpToRecentsComplete();
        mRecentsView.onSwipeUpAnimationSuccess();
        if (LIVE_TILE.get()) {
            mTaskAnimationManager.setLiveTileCleanUpHandler(mInputConsumerProxy::destroy);
+2 −10
Original line number Diff line number Diff line
@@ -99,16 +99,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            DeviceProfile dp, Context context, Rect outRect,
            PagedOrientationHandler orientationHandler);

    public void onSwipeUpToRecentsComplete() {
        // Re apply state in case we did something funky during the transition.
        ACTIVITY_TYPE activity = getCreatedActivity();
        if (activity == null) {
            return;
        }
        activity.getStateManager().reapplyState();
    }

    public abstract void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState);
    /** Called when the animation to home has fully settled. */
    public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {}

    public abstract void onAssistantVisibilityChanged(float visibility);

+0 −6
Original line number Diff line number Diff line
@@ -65,12 +65,6 @@ public final class FallbackActivityInterface extends
        }
    }

    /** 4 */
    @Override
    public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
        onSwipeUpToRecentsComplete();
    }

    /** 5 */
    @Override
    public void onAssistantVisibilityChanged(float visibility) {
+8 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.QUICK_SWITCH;
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;

import android.animation.Animator;
@@ -84,9 +85,13 @@ public final class LauncherActivityInterface extends
        if (launcher == null) {
            return;
        }
        // Ensure recents is at the correct position for NORMAL state. For example, when we detach
        // recents, we assume the first task is invisible, making translation off by one task.
        launcher.getStateManager().reapplyState();
        // When going to home, the state animator we use has SKIP_OVERVIEW because we assume that
        // setRecentsAttachedToAppWindow() will handle animating Overview instead. Thus, at the end
        // of the animation, we should ensure recents is at the correct position for NORMAL state.
        // For example, when doing a long swipe to home, RecentsView may be scaled down. This is
        // relatively expensive, so do it on the next frame instead of critical path.
        MAIN_EXECUTOR.getHandler().post(launcher.getStateManager()::reapplyState);

        launcher.getRootView().setForceHideBackArrow(false);
        notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
    }
Loading