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

Commit 82163a45 authored by Jeremy Sim's avatar Jeremy Sim Committed by Automerger Merge Worker
Browse files

Merge "Fix bug with drag-to-split involving work profiles" into udc-dev am:...

Merge "Fix bug with drag-to-split involving work profiles" into udc-dev am: 57d6975c am: cbe2af09 am: 286b4e4b

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



Change-Id: I8c789eb34ded723f4d253d00e1bdd0919cfda776
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6b58b46b 286b4e4b
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -371,7 +371,8 @@ public class RecentTasksController implements TaskStackListenerCallback,
     * Find the background task that match the given component.
     * Find the background task that match the given component.
     */
     */
    @Nullable
    @Nullable
    public ActivityManager.RecentTaskInfo findTaskInBackground(ComponentName componentName) {
    public ActivityManager.RecentTaskInfo findTaskInBackground(ComponentName componentName,
            int userId) {
        if (componentName == null) {
        if (componentName == null) {
            return null;
            return null;
        }
        }
@@ -383,7 +384,7 @@ public class RecentTasksController implements TaskStackListenerCallback,
            if (task.isVisible) {
            if (task.isVisible) {
                continue;
                continue;
            }
            }
            if (componentName.equals(task.baseIntent.getComponent())) {
            if (componentName.equals(task.baseIntent.getComponent()) && userId == task.userId) {
                return task;
                return task;
            }
            }
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -723,7 +723,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
                // in the background with priority.
                // in the background with priority.
                final ActivityManager.RecentTaskInfo taskInfo = mRecentTasksOptional
                final ActivityManager.RecentTaskInfo taskInfo = mRecentTasksOptional
                        .map(recentTasks -> recentTasks.findTaskInBackground(
                        .map(recentTasks -> recentTasks.findTaskInBackground(
                                intent.getIntent().getComponent()))
                                intent.getIntent().getComponent(), userId1))
                        .orElse(null);
                        .orElse(null);
                if (taskInfo != null) {
                if (taskInfo != null) {
                    startTask(taskInfo.taskId, position, options);
                    startTask(taskInfo.taskId, position, options);
+2 −2
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ public class SplitScreenControllerTests extends ShellTestCase {
        doReturn(topRunningTask).when(mRecentTasks).getTopRunningTask();
        doReturn(topRunningTask).when(mRecentTasks).getTopRunningTask();
        // Put the same component into a task in the background
        // Put the same component into a task in the background
        ActivityManager.RecentTaskInfo sameTaskInfo = new ActivityManager.RecentTaskInfo();
        ActivityManager.RecentTaskInfo sameTaskInfo = new ActivityManager.RecentTaskInfo();
        doReturn(sameTaskInfo).when(mRecentTasks).findTaskInBackground(any());
        doReturn(sameTaskInfo).when(mRecentTasks).findTaskInBackground(any(), anyInt());


        mSplitScreenController.startIntent(pendingIntent, mContext.getUserId(), null,
        mSplitScreenController.startIntent(pendingIntent, mContext.getUserId(), null,
                SPLIT_POSITION_TOP_OR_LEFT, null);
                SPLIT_POSITION_TOP_OR_LEFT, null);
@@ -247,7 +247,7 @@ public class SplitScreenControllerTests extends ShellTestCase {
                SPLIT_POSITION_BOTTOM_OR_RIGHT);
                SPLIT_POSITION_BOTTOM_OR_RIGHT);
        // Put the same component into a task in the background
        // Put the same component into a task in the background
        doReturn(new ActivityManager.RecentTaskInfo()).when(mRecentTasks)
        doReturn(new ActivityManager.RecentTaskInfo()).when(mRecentTasks)
                .findTaskInBackground(any());
                .findTaskInBackground(any(), anyInt());


        mSplitScreenController.startIntent(pendingIntent, mContext.getUserId(), null,
        mSplitScreenController.startIntent(pendingIntent, mContext.getUserId(), null,
                SPLIT_POSITION_TOP_OR_LEFT, null);
                SPLIT_POSITION_TOP_OR_LEFT, null);