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

Commit 22e7ee6f authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Allow app tasks api to fetch its own task base-intent extras am: 02757715 am: 32f36b75

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11973240

Change-Id: I3670b30c1e2eec13606a3a3704a53e86ef4b363d
parents d15e6ec7 32f36b75
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -83,7 +83,8 @@ class AppTaskImpl extends IAppTask.Stub {
                if (task == null) {
                    throw new IllegalArgumentException("Unable to find task ID " + mTaskId);
                }
                return mService.getRecentTasks().createRecentTaskInfo(task);
                return mService.getRecentTasks().createRecentTaskInfo(task,
                        false /* stripExtras */);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
+3 −3
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ class RecentTasks {
                continue;
            }

            res.add(createRecentTaskInfo(task));
            res.add(createRecentTaskInfo(task, true /* stripExtras */));
        }
        return res;
    }
@@ -1832,9 +1832,9 @@ class RecentTasks {
    /**
     * Creates a new RecentTaskInfo from a Task.
     */
    ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr) {
    ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr, boolean stripExtras) {
        ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
        tr.fillTaskInfo(rti);
        tr.fillTaskInfo(rti, stripExtras);
        // Fill in some deprecated values
        rti.id = rti.isRunning ? rti.taskId : INVALID_TASK_ID;
        rti.persistentId = rti.taskId;
+11 −1
Original line number Diff line number Diff line
@@ -3551,11 +3551,19 @@ class Task extends WindowContainer<WindowContainer> {
        }
    }


    /**
     * Fills in a {@link TaskInfo} with information from this task. Note that the base intent in the
     * task info will not include any extras or clip data.
     */
    void fillTaskInfo(TaskInfo info) {
        fillTaskInfo(info, true /* stripExtras */);
    }

    /**
     * Fills in a {@link TaskInfo} with information from this task.
     */
    void fillTaskInfo(TaskInfo info, boolean stripExtras) {
        getNumRunningActivities(mReuseActivitiesReport);
        info.userId = mUserId;
        info.stackId = getRootTaskId();
@@ -3566,7 +3574,9 @@ class Task extends WindowContainer<WindowContainer> {
        // Make a copy of base intent because this is like a snapshot info.
        // Besides, {@link RecentTasks#getRecentTasksImpl} may modify it.
        final int baseIntentFlags = baseIntent == null ? 0 : baseIntent.getFlags();
        info.baseIntent = baseIntent == null ? new Intent() : baseIntent.cloneFilter();
        info.baseIntent = baseIntent == null
                ? new Intent()
                : stripExtras ? baseIntent.cloneFilter() : new Intent(baseIntent);
        info.baseIntent.setFlags(baseIntentFlags);
        info.baseActivity = mReuseActivitiesReport.base != null
                ? mReuseActivitiesReport.base.intent.getComponent()