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

Commit 5a763a25 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Support live tile in Overview (Pt2) - Complete functionality

- Punch a hole (by erasing part of launcher where current task is rendered) to reveal app surface drawn underneath using surface transform. We use LauncherLayoutListener before reaching OVERVIEW threshold, and TaskView after threshold due to layering constraint (it's above Overview but below All Apps)
- Render live tile following user-trigger scrolling (horizontal and vertical) by tracking the task view rect.
- When user launches the current running app (through the live tile or icon in the app drawer), finish recents animation to app.
- When user launches another app (through Overview or other entry points where user opens an app), take a screenshot of the current running app, switch to screenshot mode and launch the other app.
- Refactor ClipAnimationController#ApplyTransform to consolidate transforming by progress and by getting the current rect of the app on the screen.

Bug: 111697218
Test: manual test

Change-Id: I0ad764399e872f181a9d65dc453f0175f2b58dd1
parent 80a6d72b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides;
import static com.android.launcher3.AbstractFloatingView.TYPE_QUICKSTEP_PREVIEW;
import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
@@ -45,7 +46,11 @@ public class AllAppsState extends LauncherState {

    @Override
    public void onStateEnabled(Launcher launcher) {
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            AbstractFloatingView.closeAllOpenViews(launcher);
        } else {
            AbstractFloatingView.closeAllOpenViewsExcept(launcher, TYPE_QUICKSTEP_PREVIEW);
        }
        dispatchWindowStateChanged(launcher);
    }

+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides;
import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -231,6 +232,12 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
            mFlingBlockCheck.onEvent();
        }
        mCurrentAnimation.setPlayFraction(totalDisplacement * mProgressMultiplier);

        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            if (mRecentsView.getCurrentPage() != 0 || isGoingUp) {
                mRecentsView.redrawLiveTile(true);
            }
        }
        return true;
    }

@@ -267,6 +274,13 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        anim.setFloatValues(nextFrameProgress, goingToEnd ? 1f : 0f);
        anim.setDuration(animationDuration);
        anim.setInterpolator(scrollInterpolatorForVelocity(velocity));
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            anim.addUpdateListener(valueAnimator -> {
                if (mRecentsView.getCurrentPage() != 0 || mCurrentAnimationIsGoingUp) {
                    mRecentsView.redrawLiveTile(true);
                }
            });
        }
        anim.start();
    }

+14 −0
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
     */
    int getContainerType();

    boolean isInLiveTileMode();

    class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher> {

        @Override
@@ -440,6 +442,13 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
            return launcher != null ? launcher.getStateManager().getState().containerType
                    : LauncherLogProto.ContainerType.APP;
        }

        @Override
        public boolean isInLiveTileMode() {
            Launcher launcher = getCreatedActivity();
            return launcher != null && launcher.getStateManager().getState() == OVERVIEW &&
                    launcher.isStarted();
        }
    }

    class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
@@ -625,6 +634,11 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        public int getContainerType() {
            return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
        }

        @Override
        public boolean isInLiveTileMode() {
            return false;
        }
    }

    interface LayoutListener {
+8 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASK_STABILIZER;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -124,6 +125,12 @@ public class QuickScrubController implements OnAlarmListener {
        mActivityControlHelper = controlHelper;
        mTouchInteractionLog = touchInteractionLog;

        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            if (mRecentsView.getRunningTaskView() != null) {
                mRecentsView.getRunningTaskView().setShowScreenshot(false);
            }
        }

        if (mIsQuickSwitch) {
            mShouldSwitchToNext = true;
            mPrevProgressDelta = 0;
@@ -342,6 +349,7 @@ public class QuickScrubController implements OnAlarmListener {
        if (action != null) {
            action.run();
        }
        mRecentsView.setEnableDrawingLiveTile(true);
    }

    public void onTaskRemoved(int taskId) {
+0 −1
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ public class RecentsModel extends TaskStackChangeListener {

    private float mWindowCornerRadius = -1;


    private RecentsModel(Context context) {
        mContext = context;

Loading