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

Commit 306e3618 authored by Ben Lin's avatar Ben Lin
Browse files

Start New Window PendingIntent as task's user

We used to use the context from the system level, and for certain
devices such as HSUM devices, these are system user context which then
will not be rendered activable by Core.

Bug: 392561846
Test: Manual, open new window
Flag: EXEMPT bug fix
Change-Id: I400b3c51832676bac8d7294894b8f39ec0965654
parent 1ddbe049
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2103,6 +2103,7 @@ class DesktopTasksController(
        // TODO(b/337915660): Add a transition handler for these; animations
        //  need updates in some cases.
        val baseActivity = callingTaskInfo.baseActivity ?: return
        val userHandle = UserHandle.of(callingTaskInfo.userId)
        val fillIn: Intent =
            userProfileContexts
                .getOrCreate(callingTaskInfo.userId)
@@ -2110,11 +2111,13 @@ class DesktopTasksController(
                .getLaunchIntentForPackage(baseActivity.packageName) ?: return
        fillIn.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
        val launchIntent =
            PendingIntent.getActivity(
            PendingIntent.getActivityAsUser(
                context,
                /* requestCode= */ 0,
                fillIn,
                PendingIntent.FLAG_IMMUTABLE,
                /* options= */ null,
                userHandle,
            )
        val options = createNewWindowOptions(callingTaskInfo)
        when (options.launchWindowingMode) {
+6 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ object DesktopTestHelpers {
            .setActivityType(ACTIVITY_TYPE_STANDARD)
            .setWindowingMode(WINDOWING_MODE_FREEFORM)
            .setLastActiveTime(100)
            .setUserId(DEFAULT_USER_ID)
            .apply { bounds?.let { setBounds(it) } }
            .build()

@@ -50,6 +51,7 @@ object DesktopTestHelpers {
            .setToken(MockToken().token())
            .setActivityType(ACTIVITY_TYPE_STANDARD)
            .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
            .setUserId(DEFAULT_USER_ID)
            .setLastActiveTime(100)

    /** Create a task that has windowing mode set to [WINDOWING_MODE_FULLSCREEN] */
@@ -63,6 +65,7 @@ object DesktopTestHelpers {
            .setToken(MockToken().token())
            .setActivityType(ACTIVITY_TYPE_STANDARD)
            .setWindowingMode(WINDOWING_MODE_MULTI_WINDOW)
            .setUserId(DEFAULT_USER_ID)
            .setLastActiveTime(100)
            .build()

@@ -72,6 +75,7 @@ object DesktopTestHelpers {
            .setToken(MockToken().token())
            .setActivityType(ACTIVITY_TYPE_HOME)
            .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
            .setUserId(DEFAULT_USER_ID)
            .setLastActiveTime(100)
            .build()

@@ -91,4 +95,6 @@ object DesktopTestHelpers {
        createSystemModalTask().apply {
            baseActivity = ComponentName("com.test.dummypackage", "TestClass")
        }

    const val DEFAULT_USER_ID = 10
}