Merge "Defer some heavy work from final frame of app -> home transition" into sc-dev

This commit is contained in:
Tony Wickham
2021-05-12 18:59:41 +00:00
committed by Android (Google) Code Review
6 changed files with 22 additions and 26 deletions

View File

@@ -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(

View File

@@ -1521,7 +1521,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);

View File

@@ -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);

View File

@@ -65,12 +65,6 @@ public final class FallbackActivityInterface extends
}
}
/** 4 */
@Override
public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
onSwipeUpToRecentsComplete();
}
/** 5 */
@Override
public void onAssistantVisibilityChanged(float visibility) {

View File

@@ -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());
}

View File

@@ -1585,12 +1585,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mLiveTileParams.setTargetSet(null);
mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);
unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
setCurrentPage(0);
LayoutUtils.setViewEnabled(mActionsView, true);
if (mOrientationState.setGestureActive(false)) {
updateOrientationHandler();
}
// These are relatively expensive and don't need to be done this frame (RecentsView isn't
// visible anyway), so defer by a frame to get off the critical path, e.g. app to home.
post(() -> {
unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
setCurrentPage(0);
LayoutUtils.setViewEnabled(mActionsView, true);
if (mOrientationState.setGestureActive(false)) {
updateOrientationHandler();
}
});
}
public int getRunningTaskId() {