Allow app tasks api to fetch its own task base-intent extras am: 02757715fb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11973240 Change-Id: I17421e2098296ce98a6794ff26de2d84847d19f4
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user