Revert "[RESTRICT AUTOMERGE] Trim the activity info of another uid if no privilege"

This reverts commit 17df433a3d.

Reason for revert: apps crashed due to the top activity info trimmed

Bug: 264269392 263434196 263438172
Change-Id: I078080b14b7cf7c6e605739f22f40f86802d3950
This commit is contained in:
Louis Chang
2023-01-04 05:00:37 +00:00
parent 17df433a3d
commit 5caf2dde3d
4 changed files with 3 additions and 32 deletions

View File

@@ -84,7 +84,7 @@ class AppTaskImpl extends IAppTask.Stub {
throw new IllegalArgumentException("Unable to find task ID " + mTaskId);
}
return mService.getRecentTasks().createRecentTaskInfo(task,
false /* stripExtras */, true /* getTasksAllowed */);
false /* stripExtras */);
} finally {
Binder.restoreCallingIdentity(origId);
}

View File

@@ -961,7 +961,7 @@ class RecentTasks {
continue;
}
res.add(createRecentTaskInfo(task, true /* stripExtras */, getTasksAllowed));
res.add(createRecentTaskInfo(task, true /* stripExtras */));
}
return res;
}
@@ -1833,16 +1833,12 @@ class RecentTasks {
/**
* Creates a new RecentTaskInfo from a Task.
*/
ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr, boolean stripExtras,
boolean getTasksAllowed) {
ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr, boolean stripExtras) {
ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
tr.fillTaskInfo(rti, stripExtras);
// Fill in some deprecated values
rti.id = rti.isRunning ? rti.taskId : INVALID_TASK_ID;
rti.persistentId = rti.taskId;
if (!getTasksAllowed) {
Task.trimIneffectiveInfo(tr, rti);
}
return rti;
}

View File

@@ -129,10 +129,6 @@ class RunningTasks {
final RunningTaskInfo rti = task.getTaskInfo();
// Fill in some deprecated values
rti.id = rti.taskId;
if (!mAllowed) {
Task.trimIneffectiveInfo(task, rti);
}
return rti;
}
}

View File

@@ -3631,27 +3631,6 @@ class Task extends WindowContainer<WindowContainer> {
: null;
}
/**
* Removes the activity info if the activity belongs to a different uid, which is
* different from the app that hosts the task.
*/
static void trimIneffectiveInfo(Task task, TaskInfo info) {
final ActivityRecord baseActivity = task.getActivity(r -> !r.finishing,
false /* traverseTopToBottom */);
final int baseActivityUid =
baseActivity != null ? baseActivity.getUid() : task.effectiveUid;
if (info.topActivityInfo != null
&& task.effectiveUid != info.topActivityInfo.applicationInfo.uid) {
info.topActivity = null;
info.topActivityInfo = null;
}
if (task.effectiveUid != baseActivityUid) {
info.baseActivity = null;
}
}
/**
* Returns a {@link TaskInfo} with information from this task.
*/