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

Commit 919ddf19 authored by Ats Jenk's avatar Ats Jenk
Browse files

Set up a place holder tile for desktop

Create a placeholder tile in recents for desktop.
It is based on launcher task information. With extra flag indicating it
is for desktop.
When it is clicked, it will call sysui to show apps on desktop.

Test: manually verify that desktop tasks do not show up separately in
recents
Bug: 244348395

Change-Id: I8535a54e1545841cd988d4770e6fc5e857277cda
parent d859a200
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -255,7 +255,8 @@ public class RecentTasksList {
        TaskLoadResult allTasks = new TaskLoadResult(requestId, loadKeysOnly, rawTasks.size());
        for (GroupedRecentTaskInfo rawTask : rawTasks) {
            if (rawTask.getType() == GroupedRecentTaskInfo.TYPE_FREEFORM) {
                // TODO: add entry for freeform tasks
                GroupTask desktopTask = createDesktopTask(rawTask);
                allTasks.add(desktopTask);
                continue;
            }
            ActivityManager.RecentTaskInfo taskInfo1 = rawTask.getTaskInfo1();
@@ -283,6 +284,16 @@ public class RecentTasksList {
        return allTasks;
    }

    private GroupTask createDesktopTask(GroupedRecentTaskInfo taskInfo) {
        // TODO(b/244348395): create a subclass of GroupTask for desktop tile
        // We need a single task information as the primary task. Use the first task
        Task.TaskKey key = new Task.TaskKey(taskInfo.getTaskInfo1());
        Task task = new Task(key);
        task.desktopTile = true;
        task.topActivity = key.sourceComponent;
        return new GroupTask(task, null, null);
    }

    private SplitConfigurationOptions.SplitBounds convertSplitBounds(
            SplitBounds shellSplitBounds) {
        return shellSplitBounds == null ?
+20 −2
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationCon
import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController;
import com.android.systemui.shared.system.smartspace.SmartspaceState;
import com.android.wm.shell.back.IBackAnimation;
import com.android.wm.shell.desktopmode.IDesktopMode;
import com.android.wm.shell.floating.IFloatingTasks;
import com.android.wm.shell.onehanded.IOneHanded;
import com.android.wm.shell.pip.IPip;
@@ -95,6 +96,7 @@ public class SystemUiProxy implements ISystemUiProxy {
    private IStartingWindow mStartingWindow;
    private IRecentTasks mRecentTasks;
    private IBackAnimation mBackAnimation;
    private IDesktopMode mDesktopMode;
    private final DeathRecipient mSystemUiProxyDeathRecipient = () -> {
        MAIN_EXECUTOR.execute(() -> clearProxy());
    };
@@ -169,7 +171,7 @@ public class SystemUiProxy implements ISystemUiProxy {
            IFloatingTasks floatingTasks, IOneHanded oneHanded, IShellTransitions shellTransitions,
            IStartingWindow startingWindow, IRecentTasks recentTasks,
            ISysuiUnlockAnimationController sysuiUnlockAnimationController,
            IBackAnimation backAnimation) {
            IBackAnimation backAnimation, IDesktopMode desktopMode) {
        unlinkToDeath();
        mSystemUiProxy = proxy;
        mPip = pip;
@@ -181,6 +183,7 @@ public class SystemUiProxy implements ISystemUiProxy {
        mSysuiUnlockAnimationController = sysuiUnlockAnimationController;
        mRecentTasks = recentTasks;
        mBackAnimation = backAnimation;
        mDesktopMode = desktopMode;
        linkToDeath();
        // re-attach the listeners once missing due to setProxy has not been initialized yet.
        if (mPipAnimationListener != null && mPip != null) {
@@ -207,7 +210,7 @@ public class SystemUiProxy implements ISystemUiProxy {
    }

    public void clearProxy() {
        setProxy(null, null, null, null, null, null, null, null, null, null);
        setProxy(null, null, null, null, null, null, null, null, null, null, null);
    }

    // TODO(141886704): Find a way to remove this
@@ -908,4 +911,19 @@ public class SystemUiProxy implements ISystemUiProxy {

        return false;
    }

    //
    // Desktop Mode
    //

    /** Call shell to show all apps active on the desktop */
    public void showDesktopApps() {
        if (mDesktopMode != null) {
            try {
                mDesktopMode.showDesktopApps();
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call showDesktopApps", e);
            }
        }
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_RECENT_TASKS;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_BACK_ANIMATION;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_DESKTOP_MODE;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_FLOATING_TASKS;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_ONE_HANDED;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_PIP;
@@ -111,6 +112,7 @@ import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController;
import com.android.systemui.shared.tracing.ProtoTraceable;
import com.android.wm.shell.back.IBackAnimation;
import com.android.wm.shell.desktopmode.IDesktopMode;
import com.android.wm.shell.floating.IFloatingTasks;
import com.android.wm.shell.onehanded.IOneHanded;
import com.android.wm.shell.pip.IPip;
@@ -184,10 +186,12 @@ public class TouchInteractionService extends Service
                    bundle.getBinder(KEY_EXTRA_RECENT_TASKS));
            IBackAnimation backAnimation = IBackAnimation.Stub.asInterface(
                    bundle.getBinder(KEY_EXTRA_SHELL_BACK_ANIMATION));
            IDesktopMode desktopMode = IDesktopMode.Stub.asInterface(
                    bundle.getBinder(KEY_EXTRA_SHELL_DESKTOP_MODE));
            MAIN_EXECUTOR.execute(() -> {
                SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy, pip,
                        splitscreen, floatingTasks, onehanded, shellTransitions, startingWindow,
                        recentTasks, launcherUnlockAnimationController, backAnimation);
                        recentTasks, launcherUnlockAnimationController, backAnimation, desktopMode);
                TouchInteractionService.this.initInputMonitor("TISBinder#onInitialize()");
                preloadOverview(true /* fromInit */);
            });
+6 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskIconCache;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
@@ -708,6 +709,11 @@ public class TaskView extends FrameLayout implements Reusable {
        RecentsView recentsView = getRecentsView();
        RemoteTargetHandle[] remoteTargetHandles = recentsView.mRemoteTargetHandles;
        RunnableList runnableList = new RunnableList();
        if (mTask != null && mTask.desktopTile) {
            // clicked on desktop
            SystemUiProxy.INSTANCE.get(getContext()).showDesktopApps();
            return runnableList;
        }
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask() && remoteTargetHandles != null) {
            if (!mIsClickableAsLiveTile) {
                return runnableList;