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

Commit 65460403 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Add back gesture support when split selection active

* Currently this exits the current launcher state
back to homescreen whenever back is performed while
split selection is active.
* Open UX question if that needs to be changed.

Test: Did back gesture from workspace, overview, all apps
http://recall/-/cMb5xTTxhmZtFt04eYnmQj/g0kpGTsqlj0RSt4OfDBkpf
Bug: 295449659
Flag: ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE
Change-Id: I74fe51aaf4301fb723d2e69e6b1b39d127f492d8
parent aa619b90
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchControlle
import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.BackPressHandler;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Executors;
import com.android.launcher3.util.IntSet;
@@ -229,7 +230,8 @@ public class QuickstepLauncher extends Launcher {
        mSplitSelectStateController =
                new SplitSelectStateController(this, mHandler, getStateManager(),
                        getDepthController(), getStatsLogManager(),
                        SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this));
                        SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this),
                        () -> onStateBack());
        overviewPanel.init(mActionsView, mSplitSelectStateController);
        mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this,
                mSplitSelectStateController);
@@ -254,6 +256,7 @@ public class QuickstepLauncher extends Launcher {
        mEnableWidgetDepth = SystemProperties.getBoolean("ro.launcher.depth.widget", true);
        getWorkspace().addOverlayCallback(progress ->
                onTaskbarInAppDisplayProgressUpdate(progress, MINUS_ONE_PAGE_PROGRESS_INDEX));
        addBackAnimationCallback(mSplitSelectStateController.getSplitBackHandler());
    }

    @Override
@@ -479,6 +482,7 @@ public class QuickstepLauncher extends Launcher {
        mHotseatPredictionController.destroy();
        mSplitWithKeyboardShortcutController.onDestroy();
        if (mViewCapture != null) mViewCapture.close();
        removeBackAnimationCallback(mSplitSelectStateController.getSplitBackHandler());
    }

    @Override
@@ -663,6 +667,10 @@ public class QuickstepLauncher extends Launcher {
        anim.buildAnim().start();
    }

    @Override
    protected boolean isSplitSelectionEnabled() {
        return mSplitSelectStateController.isSplitSelectActive();
    }

    @Override
    protected void onResume() {
+2 −1
Original line number Diff line number Diff line
@@ -136,7 +136,8 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
        mSplitSelectStateController =
                new SplitSelectStateController(this, mHandler, getStateManager(),
                        null /* depthController */, getStatsLogManager(),
                        SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this));
                        SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this),
                        null /*activityBackCallback*/);
        mDragLayer.recreateControllers();
        mFallbackRecentsView.init(mActionsView, mSplitSelectStateController);

+32 −5
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
@@ -77,8 +76,10 @@ import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.BackPressHandler;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.quickstep.OverviewComponentObserver;
@@ -113,9 +114,11 @@ import java.util.function.Consumer;
public class SplitSelectStateController {
    private static final String TAG = "SplitSelectStateCtor";

    private Context mContext;
    private StatefulActivity mContext;
    private final Handler mHandler;
    private final RecentsModel mRecentTasksModel;
    @Nullable
    private final Runnable mActivityBackCallback;
    private final SplitAnimationController mSplitAnimationController;
    private final AppPairsController mAppPairsController;
    private final SplitSelectDataHolder mSplitSelectDataHolder;
@@ -142,9 +145,28 @@ public class SplitSelectStateController {

    private final List<SplitSelectionListener> mSplitSelectionListeners = new ArrayList<>();

    public SplitSelectStateController(Context context, Handler handler, StateManager stateManager,
            DepthController depthController, StatsLogManager statsLogManager,
            SystemUiProxy systemUiProxy, RecentsModel recentsModel) {
    private final BackPressHandler mSplitBackHandler = new BackPressHandler() {
        @Override
        public boolean canHandleBack() {
            return FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() &&
                    isSplitSelectActive();
        }

        @Override
        public void onBackInvoked() {
            // When exiting from split selection, leave current context to go to
            // homescreen as well
            getSplitAnimationController().playPlaceholderDismissAnim(mContext);
            if (mActivityBackCallback != null) {
                mActivityBackCallback.run();
            }
        }
    };

    public SplitSelectStateController(StatefulActivity context, Handler handler,
            StateManager stateManager, DepthController depthController,
            StatsLogManager statsLogManager, SystemUiProxy systemUiProxy, RecentsModel recentsModel,
            Runnable activityBackCallback) {
        mContext = context;
        mHandler = handler;
        mStatsLogManager = statsLogManager;
@@ -152,6 +174,7 @@ public class SplitSelectStateController {
        mStateManager = stateManager;
        mDepthController = depthController;
        mRecentTasksModel = recentsModel;
        mActivityBackCallback = activityBackCallback;
        mSplitAnimationController = new SplitAnimationController(this);
        mAppPairsController = new AppPairsController(context, this, statsLogManager);
        mSplitSelectDataHolder = new SplitSelectDataHolder(mContext);
@@ -716,6 +739,10 @@ public class SplitSelectStateController {
        return mAppPairsController;
    }

    public BackPressHandler getSplitBackHandler() {
        return mSplitBackHandler;
    }

    public void dump(String prefix, PrintWriter writer) {
        if (mSplitSelectDataHolder != null) {
            mSplitSelectDataHolder.dump(prefix, writer);
+15 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep.views;

import static com.android.app.animation.Interpolators.LINEAR;
@@ -47,8 +62,6 @@ import com.android.systemui.shared.system.QuickStepContract;
 * {@link #addConfirmAnimation(PendingAnimation, RectF, Rect, boolean, boolean)}
 * giving a starting and ending bounds. Currently this is set to use the split placeholder view,
 * but it could be generified.
 *
 * TODO: Figure out how to copy thumbnail data from existing TaskView to this view.
 */
public class FloatingTaskView extends FrameLayout {

+4 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.launcher3.logging.StatsLogManager
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.statehandlers.DepthController
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.statemanager.StatefulActivity
import com.android.launcher3.util.ComponentKey
import com.android.launcher3.util.SplitConfigurationOptions
import com.android.launcher3.util.withArgCaptor
@@ -58,7 +59,7 @@ class SplitSelectStateControllerTest {
    @Mock lateinit var statsLogManager: StatsLogManager
    @Mock lateinit var stateManager: StateManager<LauncherState>
    @Mock lateinit var handler: Handler
    @Mock lateinit var context: Context
    @Mock lateinit var context: StatefulActivity<*>
    @Mock lateinit var recentsModel: RecentsModel
    @Mock lateinit var pendingIntent: PendingIntent

@@ -81,7 +82,8 @@ class SplitSelectStateControllerTest {
                depthController,
                statsLogManager,
                systemUiProxy,
                recentsModel
                recentsModel,
                null /*activityBackCallback*/
            )
    }

Loading