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

Commit c480c268 authored by Jeremy Sim's avatar Jeremy Sim Committed by Android (Google) Code Review
Browse files

Merge "Allow user to tap on stashed app to launch task in fullscreen" into tm-qpr-dev

parents 1b30bab1 6692f782
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import android.view.animation.Interpolator;
 */
public interface SplitAnimationTimings {
    int TABLET_ENTER_DURATION = 866;
    int TABLET_CONFIRM_DURATION = 383;
    int TABLET_CONFIRM_DURATION = 500;

    int PHONE_ENTER_DURATION = 517;
    int PHONE_CONFIRM_DURATION = 333;
+45 −5
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_75;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_LAUNCH_FROM_STAGED_APP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_ACTIONS_SPLIT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
@@ -125,7 +126,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener;
import com.android.launcher3.DeviceProfile;
@@ -2903,6 +2903,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                    false /* fadeWithThumbnail */, true /* isStagedTask */);
        }

        // TODO (b/257513449): Launch animation not fully complete. OK to remove flag once it is.
        if (ENABLE_LAUNCH_FROM_STAGED_APP.get()) {
            mFirstFloatingTaskView.setOnClickListener(this::animateToFullscreen);
        }

        // SplitInstructionsView: animate in
        safeRemoveDragLayerView(mSplitInstructionsView);
        mSplitInstructionsView = SplitInstructionsView.getSplitInstructionsView(mActivity);
@@ -2946,6 +2951,34 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        });
    }

    private void animateToFullscreen(View view) {
        FloatingTaskView stagedTaskView = (FloatingTaskView) view;

        boolean isTablet = mActivity.getDeviceProfile().isTablet;
        int duration = isTablet
                ? SplitAnimationTimings.TABLET_CONFIRM_DURATION
                : SplitAnimationTimings.PHONE_CONFIRM_DURATION;

        PendingAnimation pendingAnimation = new PendingAnimation(duration);

        Rect firstTaskStartingBounds = new Rect();
        Rect firstTaskEndingBounds = new Rect();

        stagedTaskView.getBoundsOnScreen(firstTaskStartingBounds);
        mActivity.getDragLayer().getBoundsOnScreen(firstTaskEndingBounds);

        stagedTaskView.addConfirmAnimation(
                pendingAnimation,
                new RectF(firstTaskStartingBounds),
                firstTaskEndingBounds,
                false /* fadeWithThumbnail */,
                true /* isStagedTask */);

        pendingAnimation.addEndListener(success -> launchStagedTask());

        pendingAnimation.buildAnim().start();
    }

    /**
     * Creates a {@link PendingAnimation} for dismissing the specified {@link TaskView}.
     * @param dismissedTaskView the {@link TaskView} to be dismissed
@@ -4294,11 +4327,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        Rect firstTaskEndingBounds = mTempRect;

        boolean isTablet = mActivity.getDeviceProfile().isTablet;
        int duration = isTablet
                ? SplitAnimationTimings.TABLET_CONFIRM_DURATION
                : SplitAnimationTimings.PHONE_CONFIRM_DURATION;
        PendingAnimation pendingAnimation = new PendingAnimation(duration);
        SplitAnimationTimings timings = AnimUtils.getDeviceSplitToConfirmTimings(isTablet);
        PendingAnimation pendingAnimation = new PendingAnimation(timings.getDuration());

        int halfDividerSize = getResources()
                .getDimensionPixelSize(R.dimen.multi_window_task_divider_size) / 2;
@@ -4650,6 +4680,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        return mPendingAnimation;
    }

    protected void launchStagedTask() {
        if (mSplitHiddenTaskView != null) {
            // Split staging was started from an existing running task (in Overview)
            mSplitHiddenTaskView.launchTask(success -> resetFromSplitSelectionState());
        } else {
            // Split staging was started from a new intent (from app menu in Home/AllApps)
            mActivity.startActivity(mSplitSelectSource.intent);
        }
    }

    protected void onTaskLaunchAnimationEnd(boolean success) {
        if (success) {
            resetTaskVisuals();
+5 −0
Original line number Diff line number Diff line
@@ -342,6 +342,11 @@ public final class FeatureFlags {
    public static final BooleanFlag ENABLE_DEVICE_PROFILE_LOGGING = new DeviceFlag(
            "ENABLE_DEVICE_PROFILE_LOGGING", false, "Allows DeviceProfile logging");

    public static final BooleanFlag ENABLE_LAUNCH_FROM_STAGED_APP = getDebugFlag(
            "ENABLE_LAUNCH_FROM_STAGED_APP", false,
            "Enable the ability to tap a staged app during split select to launch it in full screen"
    );

    public static void initialize(Context context) {
        synchronized (sDebugFlags) {
            for (DebugFlag flag : sDebugFlags) {