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

Commit c0dc208e authored by Winson Chung's avatar Winson Chung
Browse files

Disallow background activity starts when starting a dropped intent

Bug: 328861542
Test: atest CrossAppDragAndDropTest
Test: Manual test with sample app

Change-Id: If9ddefd56dfb1a61b85331c07f94867edf6c4e08
parent 65f13a35
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1166,7 +1166,7 @@ class DesktopTasksController(
            pendingIntentLaunchFlags =
                Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
            setPendingIntentBackgroundActivityStartMode(
                ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
                ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_DENIED
            )
            isPendingIntentBackgroundActivityLaunchAllowedByPermission = true
        }
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.draganddrop;

import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_DENIED;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED;
import static android.app.ComponentOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION;
@@ -301,6 +302,8 @@ public class DragAndDropPolicy {
                position);
        final ActivityOptions baseActivityOpts = ActivityOptions.makeBasic();
        baseActivityOpts.setDisallowEnterPictureInPictureWhileLaunching(true);
        baseActivityOpts.setPendingIntentBackgroundActivityStartMode(
                MODE_BACKGROUND_ACTIVITY_START_DENIED);
        // TODO(b/255649902): Rework this so that SplitScreenController can always use the options
        // instead of a fillInIntent since it's assuming that the PendingIntent is mutable
        baseActivityOpts.setPendingIntentLaunchFlags(FLAG_ACTIVITY_NEW_TASK