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

Commit 64ae08aa authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Show non-top tasks in the docked stack in recents.

Allows the user to access the task through recents since
it isn't currently visible on screen.

Also, changed recents to launch task currently in the docked
stack in the fullscreen stack when selected from recents list.

Bug: 27864383
Change-Id: I58549023920d064a30b6355367c3193ce3207bbd
parent 47f542fc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1410,10 +1410,10 @@ public class ActivityManager {
    public static final int RECENT_IGNORE_HOME_STACK_TASKS = 0x0008;

    /**
     * Ignores all tasks that are on the docked stack.
     * Ignores the top task in the docked stack.
     * @hide
     */
    public static final int RECENT_INGORE_DOCKED_STACK_TASKS = 0x0010;
    public static final int RECENT_INGORE_DOCKED_STACK_TOP_TASK = 0x0010;

    /**
     * Ignores all tasks that are on the pinned stack.
+2 −2
Original line number Diff line number Diff line
@@ -438,7 +438,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        }

        // Launch the task
        ssp.startActivityFromRecents(mContext, toTask.key.id, toTask.title, launchOpts);
        ssp.startActivityFromRecents(mContext, toTask.key, toTask.title, launchOpts);
    }

    /**
@@ -510,7 +510,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        MetricsLogger.count(mContext, "overview_affiliated_task_launch", 1);

        // Launch the task
        ssp.startActivityFromRecents(mContext, toTask.key.id, toTask.title, launchOpts);
        ssp.startActivityFromRecents(mContext, toTask.key, toTask.title, launchOpts);
    }

    public void showNextAffiliatedTask() {
+14 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.recents.misc;

import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
@@ -77,6 +78,7 @@ import com.android.internal.os.BackgroundThread;
import com.android.systemui.R;
import com.android.systemui.recents.RecentsDebugFlags;
import com.android.systemui.recents.RecentsImpl;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.tv.RecentsTvImpl;
import com.android.systemui.recents.model.ThumbnailData;

@@ -284,7 +286,7 @@ public class SystemServicesProxy {
        int numTasksToQuery = Math.max(minNumTasksToQuery, numLatestTasks);
        List<ActivityManager.RecentTaskInfo> tasks = mAm.getRecentTasksForUser(numTasksToQuery,
                ActivityManager.RECENT_IGNORE_HOME_STACK_TASKS |
                ActivityManager.RECENT_INGORE_DOCKED_STACK_TASKS |
                ActivityManager.RECENT_INGORE_DOCKED_STACK_TOP_TASK |
                ActivityManager.RECENT_INGORE_PINNED_STACK_TASKS |
                ActivityManager.RECENT_IGNORE_UNAVAILABLE |
                ActivityManager.RECENT_INCLUDE_PROFILES |
@@ -962,11 +964,20 @@ public class SystemServicesProxy {
    }

    /** Starts an activity from recents. */
    public boolean startActivityFromRecents(Context context, int taskId, String taskName,
    public boolean startActivityFromRecents(Context context, Task.TaskKey taskKey, String taskName,
            ActivityOptions options) {
        if (mIam != null) {
            try {
                mIam.startActivityFromRecents(taskId, options == null ? null : options.toBundle());
                if (taskKey.stackId == DOCKED_STACK_ID) {
                    // We show non-visible docked tasks in Recents, but we always want to launch
                    // them in the fullscreen stack.
                    if (options == null) {
                        options = ActivityOptions.makeBasic();
                    }
                    options.setLaunchStackId(FULLSCREEN_WORKSPACE_STACK_ID);
                }
                mIam.startActivityFromRecents(
                        taskKey.id, options == null ? null : options.toBundle());
                return true;
            } catch (Exception e) {
                Log.e(TAG, context.getString(R.string.recents_launch_error_message, taskName), e);
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ public class RecentsTvTransitionHelper {
    private void startTaskActivity(TaskStack stack, Task task, @Nullable TaskCardView taskView,
            ActivityOptions opts,final ActivityOptions.OnAnimationStartedListener animStartedListener) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startActivityFromRecents(mContext, task.key.id, task.title, opts)) {
        if (ssp.startActivityFromRecents(mContext, task.key, task.title, opts)) {
            // Keep track of the index of the task launch
            int taskIndexFromFront = 0;
            int taskIndex = stack.indexOfStackTask(task);
+3 −3
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public class RecentsTvView extends FrameLayout {
            Task task = mTaskStackHorizontalView.getFocusedTask();
            if (task != null) {
                SystemServicesProxy ssp = Recents.getSystemServices();
                ssp.startActivityFromRecents(getContext(), task.key.id, task.title, null);
                ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                return true;
            }
        }
@@ -123,7 +123,7 @@ public class RecentsTvView extends FrameLayout {
            Task task = stack.getLaunchTarget();
            if (task != null) {
                SystemServicesProxy ssp = Recents.getSystemServices();
                ssp.startActivityFromRecents(getContext(), task.key.id, task.title, null);
                ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                return true;
            }
        }
@@ -140,7 +140,7 @@ public class RecentsTvView extends FrameLayout {
                TaskCardView tv = taskViews.get(j);
                if (tv.getTask() == task) {
                    SystemServicesProxy ssp = Recents.getSystemServices();
                    ssp.startActivityFromRecents(getContext(), task.key.id, task.title, null);
                    ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                    return true;
                }
            }
Loading