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

Commit e3f58d37 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Revert "Trim the activity info of another uid if no privilege"" into...

Merge "Revert "Trim the activity info of another uid if no privilege"" into tm-qpr-dev am: 36993538 am: 9b16d8e4

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



Change-Id: Ia4b311d1e63366c1c1032a1d53c09a45da22e07b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents eac1a801 9b16d8e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,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);
            }
+2 −6
Original line number Diff line number Diff line
@@ -976,7 +976,7 @@ class RecentTasks {
                continue;
            }

            res.add(createRecentTaskInfo(task, true /* stripExtras */, getTasksAllowed));
            res.add(createRecentTaskInfo(task, true /* stripExtras */));
        }
        return res;
    }
@@ -1889,8 +1889,7 @@ 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) {
        final ActivityManager.RecentTaskInfo rti = new ActivityManager.RecentTaskInfo();
        // 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.
@@ -1902,9 +1901,6 @@ class RecentTasks {
        rti.id = rti.isRunning ? rti.taskId : INVALID_TASK_ID;
        rti.persistentId = rti.taskId;
        rti.lastSnapshotData.set(tr.mLastTaskSnapshotData);
        if (!getTasksAllowed) {
            Task.trimIneffectiveInfo(tr, rti);
        }

        // Fill in organized child task info for the task created by organizer.
        if (tr.mCreatedByOrganizer) {
+0 −4
Original line number Diff line number Diff line
@@ -173,10 +173,6 @@ class RunningTasks implements Consumer<Task> {
        }
        // Fill in some deprecated values
        rti.id = rti.taskId;

        if (!mAllowed) {
            Task.trimIneffectiveInfo(task, rti);
        }
        return rti;
    }
}
+0 −21
Original line number Diff line number Diff line
@@ -3418,27 +3418,6 @@ class Task extends TaskFragment {
        info.isSleeping = shouldSleepActivities();
    }

    /**
     * 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() {
        final Task topTask = getTopMostTask();
        if (topTask == null) return null;
+5 −22
Original line number Diff line number Diff line
@@ -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_SINGLE_INSTANCE;
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.doReturn;
@@ -1208,34 +1207,20 @@ public class RecentTasksTest extends WindowTestsBase {

    @Test
    public void testCreateRecentTaskInfo_detachedTask() {
        final Task task = createTaskBuilder(".Task").build();
        new ActivityBuilder(mSupervisor.mService)
                .setTask(task)
                .setUid(NOBODY_UID)
                .setComponent(getUniqueComponentName())
                .build();
        final Task task = createTaskBuilder(".Task").setCreateActivity(true).build();
        final TaskDisplayArea tda = task.getDisplayArea();

        assertTrue(task.isAttached());
        assertTrue(task.supportsMultiWindow());

        RecentTaskInfo info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
                true /* getTasksAllowed */);
        RecentTaskInfo info = mRecentTasks.createRecentTaskInfo(task, true);

        assertTrue(info.supportsMultiWindow);

        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.
        task.removeImmediately();

        info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
                true /* getTasksAllowed */);
        info = mRecentTasks.createRecentTaskInfo(task, true);

        assertTrue(info.supportsMultiWindow);

@@ -1244,8 +1229,7 @@ public class RecentTasksTest extends WindowTestsBase {
        doReturn(false).when(tda).supportsNonResizableMultiWindow();
        doReturn(false).when(task).isResizeable();

        info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
                true /* getTasksAllowed */);
        info = mRecentTasks.createRecentTaskInfo(task, true);

        assertFalse(info.supportsMultiWindow);

@@ -1253,8 +1237,7 @@ public class RecentTasksTest extends WindowTestsBase {
        // the device supports it.
        doReturn(true).when(tda).supportsNonResizableMultiWindow();

        info = mRecentTasks.createRecentTaskInfo(task, true /* stripExtras */,
                true /* getTasksAllowed */);
        info = mRecentTasks.createRecentTaskInfo(task, true);

        assertTrue(info.supportsMultiWindow);
    }