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

Commit 526f4ce7 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Always look for MODE_OPENING during task launch from overview

* Previously the target mode was dependent on whether liveTile
was running or not, opposite targets seem to be coming in from
WM now.
* Remove a bunch of un-used code from LauncherSplitScreenListener
that was used when we only allowed one split pair in overview
previously. Now that is handled by RecentTasksController in shell
so we don't need any additional bookkeeping.

Fix: 212220301
Test: Able to launch side tasks in overview
Change-Id: I002340d98ba379cb4ab9ae37eadfa235d6b5e56d
parent ee09cd03
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -981,7 +981,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                mStateCallback.setState(STATE_SCALED_CONTROLLER_HOME | STATE_CAPTURE_SCREENSHOT);
                // Notify swipe-to-home (recents animation) is finished
                SystemUiProxy.INSTANCE.get(mContext).notifySwipeToHomeFinished();
                LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                break;
            case RECENTS:
                mStateCallback.setState(STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT
+0 −3
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import androidx.annotation.UiThread;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -172,7 +171,6 @@ public class OverviewCommandHelper {
            }
            if (cmd.type == TYPE_HOME) {
                mService.startActivity(mOverviewComponentObserver.getHomeIntent());
                LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                return true;
            }
        } else {
@@ -191,7 +189,6 @@ public class OverviewCommandHelper {
                    return launchTask(recents, getNextTask(recents), cmd);
                case TYPE_HOME:
                    recents.startHome();
                    LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                    return true;
            }
        }
+2 −4
Original line number Diff line number Diff line
@@ -170,11 +170,9 @@ public final class TaskViewUtils {
        boolean isQuickSwitch = v.isEndQuickswitchCuj();
        v.setEndQuickswitchCuj(false);

        boolean inLiveTileMode =
                ENABLE_QUICKSTEP_LIVE_TILE.get() && v.getRecentsView().getRunningTaskIndex() != -1;
        final RemoteAnimationTargets targets =
                new RemoteAnimationTargets(appTargets, wallpaperTargets, nonAppTargets,
                        !ENABLE_SHELL_TRANSITIONS && inLiveTileMode ? MODE_CLOSING : MODE_OPENING);
                        MODE_OPENING);
        final RemoteAnimationTargetCompat navBarTarget = targets.getNavBarRemoteAnimationTarget();

        SurfaceTransactionApplier applier = new SurfaceTransactionApplier(v);
@@ -276,7 +274,7 @@ public final class TaskViewUtils {
                        }
                    }
                });
            } else if (inLiveTileMode) {
            } else {
                // There is no transition animation for app launch from recent in live tile mode so
                // we have to trigger the navigation bar animation from system here.
                final RecentsAnimationController controller =
+0 −44
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@ import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.launcher3.util.SplitConfigurationOptions.StageType;
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitTaskPosition;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.wm.shell.splitscreen.ISplitScreenListener;

/**
@@ -20,9 +18,6 @@ import com.android.wm.shell.splitscreen.ISplitScreenListener;
 *
 * Use {@link #getRunningSplitTaskIds()} to determine which tasks, if any, are actively in
 * staged split.
 *
 * Use {@link #getPersistentSplitIds()} to know if tasks were in split screen before a quickswitch
 * gesture happened.
 */
public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {

@@ -34,21 +29,6 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
    private final StagedSplitTaskPosition mMainStagePosition = new StagedSplitTaskPosition();
    private final StagedSplitTaskPosition mSideStagePosition = new StagedSplitTaskPosition();

    private boolean mIsRecentsListFrozen = false;
    private final TaskStackChangeListener mTaskStackListener = new TaskStackChangeListener() {
        @Override
        public void onRecentTaskListFrozenChanged(boolean frozen) {
            super.onRecentTaskListFrozenChanged(frozen);
            mIsRecentsListFrozen = frozen;

            if (frozen) {
                mPersistentGroupedIds = getRunningSplitTaskIds();
            } else {
                mPersistentGroupedIds = EMPTY_ARRAY;
            }
        }
    };

    /**
     * Gets set to current split taskIDs whenever the task list is frozen, and set to empty array
     * whenever task list unfreezes. This also gets set to empty array whenever the user swipes to
@@ -68,25 +48,12 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
    /** Also call {@link #destroy()} when done. */
    public void init() {
        SystemUiProxy.INSTANCE.getNoCreate().registerSplitScreenListener(this);
        TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
    }

    public void destroy() {
        SystemUiProxy.INSTANCE.getNoCreate().unregisterSplitScreenListener(this);
        TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mTaskStackListener);
    }

    /**
     * This method returns the active split taskIDs that were active if a user quickswitched from
     * split screen to a fullscreen app as long as the recents task list remains frozen.
     */
    public int[] getPersistentSplitIds() {
        if (mIsRecentsListFrozen) {
            return mPersistentGroupedIds;
        } else {
            return getRunningSplitTaskIds();
        }
    }
    /**
     * @return index 0 will be task in left/top position, index 1 in right/bottom position.
     *         Will return empty array if device is not in staged split
@@ -141,17 +108,6 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
        }
    }

    /** Notifies SystemUi to remove any split screen state */
    public void notifySwipingToHome() {
        boolean hasSplitTasks = LauncherSplitScreenListener.INSTANCE.getNoCreate()
                .getPersistentSplitIds().length > 0;
        if (!hasSplitTasks) {
            return;
        }

        mPersistentGroupedIds = EMPTY_ARRAY;
    }

    private void resetTaskId(StagedSplitTaskPosition taskPosition) {
        taskPosition.taskId = -1;
    }