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

Commit ba0b5952 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Support split from fullscreen with shortcuts

Recording: https://recall.googleplex.com/projects/f46cfe9c-8076-4efe-bf8a-b1cc4f1f5e1b/sessions/978a3a55-2982-4026-9726-2a73cb694258

TODO: improve transition animation

Bug: 246661484
Test: manual
Change-Id: Id0d1aec0685bc18f4b273f8e466996efc1d9a3d8
Merged-In: Id0d1aec0685bc18f4b273f8e466996efc1d9a3d8
parent 17137e8b
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import android.view.View;
import android.view.WindowManagerGlobal;
import android.window.SplashScreen;

import androidx.annotation.BinderThread;
import androidx.annotation.Nullable;

import com.android.app.viewcapture.ViewCapture;
@@ -135,6 +136,7 @@ import com.android.quickstep.util.QuickstepOnboardingPrefs;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteFadeOutAnimationListener;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.SplitWithKeyboardShortcutController;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
@@ -179,6 +181,8 @@ public class QuickstepLauncher extends Launcher {
    private @Nullable UnfoldTransitionProgressProvider mUnfoldTransitionProgressProvider;
    private @Nullable RotationChangeProvider mRotationChangeProvider;
    private @Nullable LauncherUnfoldAnimationController mLauncherUnfoldAnimationController;

    private SplitWithKeyboardShortcutController mSplitWithKeyboardShortcutController;
    /**
     * If Launcher restarted while in the middle of an Overview split select, it needs this data to
     * recover. In all other cases this will remain null.
@@ -194,11 +198,13 @@ public class QuickstepLauncher extends Launcher {
        super.setupViews();

        mActionsView = findViewById(R.id.overview_actions_view);
        RecentsView overviewPanel = (RecentsView) getOverviewPanel();
        RecentsView overviewPanel = getOverviewPanel();
        SplitSelectStateController controller =
                new SplitSelectStateController(this, mHandler, getStateManager(),
                        getDepthController(), getStatsLogManager());
        overviewPanel.init(mActionsView, controller);
        mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this,
                controller);
        mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize());
        mActionsView.updateVerticalMargin(DisplayController.getNavigationMode(this));

@@ -321,6 +327,17 @@ public class QuickstepLauncher extends Launcher {
        super.showAllAppsFromIntent(alreadyOnHome);
    }

    protected void onItemClicked(View view) {
        if (!mSplitWithKeyboardShortcutController.handleSecondAppSelectionForSplit(view)) {
            QuickstepLauncher.super.getItemOnClickListener().onClick(view);
        }
    }

    @Override
    public View.OnClickListener getItemOnClickListener() {
        return this::onItemClicked;
    }

    @Override
    public Stream<SystemShortcut.Factory> getSupportedShortcuts() {
        Stream<SystemShortcut.Factory> base = Stream.of(WellbeingModel.SHORTCUT_FACTORY);
@@ -402,6 +419,7 @@ public class QuickstepLauncher extends Launcher {

        super.onDestroy();
        mHotseatPredictionController.destroy();
        mSplitWithKeyboardShortcutController.onDestroy();
        if (mViewCapture != null) mViewCapture.close();
    }

@@ -832,6 +850,12 @@ public class QuickstepLauncher extends Launcher {
        return activityOptions;
    }

    @Override
    @BinderThread
    public void enterStageSplitFromRunningApp(boolean leftOrTop) {
        mSplitWithKeyboardShortcutController.enterStageSplit(leftOrTop);
    }

    /**
     * Adds a new launch cookie for the activity launch if supported.
     *
+3 −6
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.graphics.Matrix;
@@ -399,9 +398,8 @@ public final class TaskViewUtils {
     */
    public static void composeRecentsSplitLaunchAnimator(GroupedTaskView launchingTaskView,
            @NonNull StateManager stateManager, @Nullable DepthController depthController,
            int initialTaskId, @Nullable PendingIntent initialTaskPendingIntent, int secondTaskId,
            @NonNull TransitionInfo transitionInfo, SurfaceControl.Transaction t,
            @NonNull Runnable finishCallback) {
            int initialTaskId, int secondTaskId, @NonNull TransitionInfo transitionInfo,
            SurfaceControl.Transaction t, @NonNull Runnable finishCallback) {
        if (launchingTaskView != null) {
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.addListener(new AnimatorListenerAdapter() {
@@ -491,8 +489,7 @@ public final class TaskViewUtils {
     * If it is null, then it will simply fade in the starting apps and fade out launcher (for the
     * case where launcher handles animating starting split tasks from app icon) */
    public static void composeRecentsSplitLaunchAnimatorLegacy(
            @Nullable GroupedTaskView launchingTaskView, int initialTaskId,
            @Nullable PendingIntent initialTaskPendingIntent, int secondTaskId,
            @Nullable GroupedTaskView launchingTaskView, int initialTaskId, int secondTaskId,
            @NonNull RemoteAnimationTarget[] appTargets,
            @NonNull RemoteAnimationTarget[] wallpaperTargets,
            @NonNull RemoteAnimationTarget[] nonAppTargets,
+10 −0
Original line number Diff line number Diff line
@@ -298,6 +298,16 @@ public class TouchInteractionService extends Service
            MAIN_EXECUTOR.execute(ProxyScreenStatusProvider.INSTANCE::onScreenTurningOff);
        }

        @BinderThread
        @Override
        public void enterStageSplitFromRunningApp(boolean leftOrTop) {
            StatefulActivity activity =
                    mOverviewComponentObserver.getActivityInterface().getCreatedActivity();
            if (activity != null) {
                activity.enterStageSplitFromRunningApp(leftOrTop);
            }
        }

        /**
         * Preloads the Overview activity.
         *
+151 −81

File changed.

Preview size limit exceeded, changes collapsed.

+193 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading