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

Commit 0f6cb2d7 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Passing stack id with RunningTaskInfo."

parents 04582832 5510f6c1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1199,6 +1199,12 @@ public class ActivityManager {
         */
        public int id;

        /**
         * The stack that currently contains this task.
         * @hide
         */
        public int stackId;

        /**
         * The component launched as the first activity in the task.  This can
         * be considered the "application" of this task.
@@ -1248,6 +1254,7 @@ public class ActivityManager {

        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(id);
            dest.writeInt(stackId);
            ComponentName.writeToParcel(baseActivity, dest);
            ComponentName.writeToParcel(topActivity, dest);
            if (thumbnail != null) {
@@ -1264,6 +1271,7 @@ public class ActivityManager {

        public void readFromParcel(Parcel source) {
            id = source.readInt();
            stackId = source.readInt();
            baseActivity = ComponentName.readFromParcel(source);
            topActivity = ComponentName.readFromParcel(source);
            if (source.readInt() != 0) {
+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub
        // Return early if there is no running task (can't determine affiliated tasks in this case)
        if (runningTask == null) return;
        // Return early if the running task is in the home stack (optimization)
        if (ssp.isInHomeStack(runningTask.id)) return;
        if (SystemServicesProxy.isHomeStack(runningTask.stackId)) return;

        // Find the task in the recents list
        ArrayList<Task> tasks = focusedStack.getTasks();
+14 −10
Original line number Diff line number Diff line
@@ -247,8 +247,10 @@ public class SystemServicesProxy {
                return true;
            }

            // Note, this is only valid because we currently only allow the recents and home
            // activities in the home stack
            if (isHomeTopMost != null) {
                isHomeTopMost.value = isInHomeStack(topTask.id);
                isHomeTopMost.value = SystemServicesProxy.isHomeStack(topTask.stackId);
            }
        }
        return false;
@@ -313,16 +315,18 @@ public class SystemServicesProxy {
        }
    }

    /** Returns whether the specified task is in the home stack */
    public boolean isInHomeStack(int taskId) {
        if (mAm == null) return false;

        // If we are mocking, then just return false
        if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
            return false;
    /**
     * Returns whether the given stack id is the home stack id.
     */
    public static boolean isHomeStack(int stackId) {
        return stackId == ActivityManager.HOME_STACK_ID;
    }

        return mAm.isInHomeStack(taskId);
    /**
     * Returns whether the given stack id is the freeform workspace stack id.
     */
    public static boolean isFreeformStack(int stackId) {
        return stackId == ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.ActivityManager.FIRST_STATIC_STACK_ID;
import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.HOME_STACK_ID;
import static android.app.ActivityManager.INVALID_STACK_ID;
import static android.app.ActivityManager.LAST_STATIC_STACK_ID;
import static android.app.ActivityManager.PINNED_STACK_ID;
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
@@ -4375,6 +4376,7 @@ final class ActivityStack {

            RunningTaskInfo ci = new RunningTaskInfo();
            ci.id = task.taskId;
            ci.stackId = (task.stack == null) ? INVALID_STACK_ID : task.stack.getStackId();
            ci.baseActivity = r.intent.getComponent();
            ci.topActivity = top.intent.getComponent();
            ci.lastActiveTime = task.lastActiveTime;