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

Commit 14a845e7 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...

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

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

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


            res.add(createRecentTaskInfo(task));
            res.add(createRecentTaskInfo(task, true /* stripExtras */));
        }
        }
        return res;
        return res;
    }
    }
@@ -1832,9 +1832,9 @@ class RecentTasks {
    /**
    /**
     * Creates a new RecentTaskInfo from a Task.
     * 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();
        ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
        tr.fillTaskInfo(rti);
        tr.fillTaskInfo(rti, stripExtras);
        // Fill in some deprecated values
        // Fill in some deprecated values
        rti.id = rti.isRunning ? rti.taskId : INVALID_TASK_ID;
        rti.id = rti.isRunning ? rti.taskId : INVALID_TASK_ID;
        rti.persistentId = rti.taskId;
        rti.persistentId = rti.taskId;
+11 −1
Original line number Original line 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
     * 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.
     * task info will not include any extras or clip data.
     */
     */
    void fillTaskInfo(TaskInfo info) {
    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);
        getNumRunningActivities(mReuseActivitiesReport);
        info.userId = mUserId;
        info.userId = mUserId;
        info.stackId = getRootTaskId();
        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.
        // Make a copy of base intent because this is like a snapshot info.
        // Besides, {@link RecentTasks#getRecentTasksImpl} may modify it.
        // Besides, {@link RecentTasks#getRecentTasksImpl} may modify it.
        final int baseIntentFlags = baseIntent == null ? 0 : baseIntent.getFlags();
        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.baseIntent.setFlags(baseIntentFlags);
        info.baseActivity = mReuseActivitiesReport.base != null
        info.baseActivity = mReuseActivitiesReport.base != null
                ? mReuseActivitiesReport.base.intent.getComponent()
                ? mReuseActivitiesReport.base.intent.getComponent()