Merge "Revert "[RESTRICT AUTOMERGE] Trim the activity info of another uid if no privilege"" into sc-dev
This commit is contained in:
@@ -84,7 +84,7 @@ class AppTaskImpl extends IAppTask.Stub {
|
|||||||
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 */, true /* getTasksAllowed */);
|
false /* stripExtras */);
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -974,7 +974,7 @@ class RecentTasks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.add(createRecentTaskInfo(task, true /* stripExtras */, getTasksAllowed));
|
res.add(createRecentTaskInfo(task, true /* stripExtras */));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1886,8 +1886,7 @@ class RecentTasks {
|
|||||||
/**
|
/**
|
||||||
* Creates a new RecentTaskInfo from a Task.
|
* Creates a new RecentTaskInfo from a Task.
|
||||||
*/
|
*/
|
||||||
ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr, boolean stripExtras,
|
ActivityManager.RecentTaskInfo createRecentTaskInfo(Task tr, boolean stripExtras) {
|
||||||
boolean getTasksAllowed) {
|
|
||||||
final ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
|
final ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
|
||||||
// If the recent Task is detached, we consider it will be re-attached to the default
|
// If the recent Task is detached, we consider it will be re-attached to the default
|
||||||
// TaskDisplayArea because we currently only support recent overview in the default TDA.
|
// TaskDisplayArea because we currently only support recent overview in the default TDA.
|
||||||
@@ -1899,9 +1898,6 @@ class RecentTasks {
|
|||||||
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;
|
||||||
rti.lastSnapshotData.set(tr.mLastTaskSnapshotData);
|
rti.lastSnapshotData.set(tr.mLastTaskSnapshotData);
|
||||||
if (!getTasksAllowed) {
|
|
||||||
Task.trimIneffectiveInfo(tr, rti);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill in organized child task info for the task created by organizer.
|
// Fill in organized child task info for the task created by organizer.
|
||||||
if (tr.mCreatedByOrganizer) {
|
if (tr.mCreatedByOrganizer) {
|
||||||
|
|||||||
@@ -137,10 +137,6 @@ class RunningTasks {
|
|||||||
task.fillTaskInfo(rti, !mKeepIntentExtra);
|
task.fillTaskInfo(rti, !mKeepIntentExtra);
|
||||||
// Fill in some deprecated values
|
// Fill in some deprecated values
|
||||||
rti.id = rti.taskId;
|
rti.id = rti.taskId;
|
||||||
|
|
||||||
if (!mAllowed) {
|
|
||||||
Task.trimIneffectiveInfo(task, rti);
|
|
||||||
}
|
|
||||||
return rti;
|
return rti;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4156,27 +4156,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
info.mTopActivityLocusId = topRecord != null ? topRecord.getLocusId() : null;
|
info.mTopActivityLocusId = topRecord != null ? topRecord.getLocusId() : 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable PictureInPictureParams getPictureInPictureParams() {
|
@Nullable PictureInPictureParams getPictureInPictureParams() {
|
||||||
return getPictureInPictureParams(getTopMostTask());
|
return getPictureInPictureParams(getTopMostTask());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
|||||||
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
|
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
|
||||||
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
|
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
|
||||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||||
import static android.os.Process.NOBODY_UID;
|
|
||||||
|
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
@@ -1146,35 +1145,21 @@ public class RecentTasksTest extends WindowTestsBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateRecentTaskInfo_detachedTask() {
|
public void testCreateRecentTaskInfo_detachedTask() {
|
||||||
final Task task = createTaskBuilder(".Task").build();
|
final Task task = createTaskBuilder(".Task").setCreateActivity(true).build();
|
||||||
new ActivityBuilder(mSupervisor.mService)
|
|
||||||
.setTask(task)
|
|
||||||
.setUid(NOBODY_UID)
|
|
||||||
.setComponent(new ComponentName("com.foo", ".BarActivity"))
|
|
||||||
.build();
|
|
||||||
final TaskDisplayArea tda = task.getDisplayArea();
|
final TaskDisplayArea tda = task.getDisplayArea();
|
||||||
|
|
||||||
assertTrue(task.isAttached());
|
assertTrue(task.isAttached());
|
||||||
assertTrue(task.supportsMultiWindow());
|
assertTrue(task.supportsMultiWindow());
|
||||||
|
|
||||||
RecentTaskInfo info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
|
RecentTaskInfo info = mRecentTasks.createRecentTaskInfo(task, true);
|
||||||
true /* getTasksAllowed */);
|
|
||||||
|
|
||||||
assertTrue(info.supportsMultiWindow);
|
assertTrue(info.supportsMultiWindow);
|
||||||
assertTrue(info.supportsSplitScreenMultiWindow);
|
assertTrue(info.supportsSplitScreenMultiWindow);
|
||||||
|
|
||||||
info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
|
|
||||||
false /* getTasksAllowed */);
|
|
||||||
|
|
||||||
assertTrue(info.topActivity == null);
|
|
||||||
assertTrue(info.topActivityInfo == null);
|
|
||||||
assertTrue(info.baseActivity == null);
|
|
||||||
|
|
||||||
// The task can be put in split screen even if it is not attached now.
|
// The task can be put in split screen even if it is not attached now.
|
||||||
task.removeImmediately();
|
task.removeImmediately();
|
||||||
|
|
||||||
info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
|
info = mRecentTasks.createRecentTaskInfo(task, true);
|
||||||
true /* getTasksAllowed */);
|
|
||||||
|
|
||||||
assertTrue(info.supportsMultiWindow);
|
assertTrue(info.supportsMultiWindow);
|
||||||
assertTrue(info.supportsSplitScreenMultiWindow);
|
assertTrue(info.supportsSplitScreenMultiWindow);
|
||||||
@@ -1184,8 +1169,7 @@ public class RecentTasksTest extends WindowTestsBase {
|
|||||||
doReturn(false).when(tda).supportsNonResizableMultiWindow();
|
doReturn(false).when(tda).supportsNonResizableMultiWindow();
|
||||||
doReturn(false).when(task).isResizeable();
|
doReturn(false).when(task).isResizeable();
|
||||||
|
|
||||||
info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
|
info = mRecentTasks.createRecentTaskInfo(task, true);
|
||||||
true /* getTasksAllowed */);
|
|
||||||
|
|
||||||
assertFalse(info.supportsMultiWindow);
|
assertFalse(info.supportsMultiWindow);
|
||||||
assertFalse(info.supportsSplitScreenMultiWindow);
|
assertFalse(info.supportsSplitScreenMultiWindow);
|
||||||
@@ -1194,8 +1178,7 @@ public class RecentTasksTest extends WindowTestsBase {
|
|||||||
// the device supports it.
|
// the device supports it.
|
||||||
doReturn(true).when(tda).supportsNonResizableMultiWindow();
|
doReturn(true).when(tda).supportsNonResizableMultiWindow();
|
||||||
|
|
||||||
info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
|
info = mRecentTasks.createRecentTaskInfo(task, true);
|
||||||
true /* getTasksAllowed */);
|
|
||||||
|
|
||||||
assertTrue(info.supportsMultiWindow);
|
assertTrue(info.supportsMultiWindow);
|
||||||
assertTrue(info.supportsSplitScreenMultiWindow);
|
assertTrue(info.supportsSplitScreenMultiWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user