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

Commit be0e7f20 authored by dakinola's avatar dakinola Committed by Daniel Akinola
Browse files

Show AppSelectorActivity for all users

Fix an issue where app selector could only be opened on primary user

Fix: 339789605
Bug: 298975543
Flag: NONE unnecesary
Test: PSS screen recording from system on a secondary user while opening a new app
Test: PSS screen recording from system on a secondary user while opening a recent app
Test: PSS screen recording from 3P app on a secondary user while opening a new app
Test: PSS screen recording from 3P app on a secondary user while opening a recent app
Test: PSS screen sharing on a secondary user while opening a new app
Test: PSS screen sharing on a secondary user while opening a recent app
Change-Id: I698a12f12ba2cfade23b6f10824815614c79db88
parent 9046efe0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -650,6 +650,7 @@
        <!-- started from MediaProjectionManager -->
        <activity
            android:name=".mediaprojection.permission.MediaProjectionPermissionActivity"
            android:showForAllUsers="true"
            android:exported="true"
            android:theme="@style/Theme.SystemUI.MediaProjectionAlertDialog"
            android:finishOnCloseSystemDialogs="true"
@@ -660,6 +661,7 @@
        <activity
            android:name=".mediaprojection.appselector.MediaProjectionAppSelectorActivity"
            android:theme="@style/Theme.SystemUI.MediaProjectionAppSelector"
            android:showForAllUsers="true"
            android:finishOnCloseSystemDialogs="true"
            android:excludeFromRecents="true"
            android:documentLaunchMode="never"
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ constructor(
            // opening the app selector in split screen mode, the foreground task will be the second
            // task in index 0.
            val foregroundGroup =
                if (groupedTasks.first().splitBounds != null) groupedTasks.first()
                if (groupedTasks.firstOrNull()?.splitBounds != null) groupedTasks.first()
                else groupedTasks.elementAtOrNull(1)
            val foregroundTaskId1 = foregroundGroup?.taskInfo1?.taskId
            val foregroundTaskId2 = foregroundGroup?.taskInfo2?.taskId
+5 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.media.projection.IMediaProjectionManager.EXTRA_USER_REVIEW
import static android.media.projection.MediaProjectionManager.OVERRIDE_DISABLE_MEDIA_PROJECTION_SINGLE_APP_OPTION;
import static android.media.projection.ReviewGrantedConsentResult.RECORD_CANCEL;
import static android.media.projection.ReviewGrantedConsentResult.RECORD_CONTENT_DISPLAY;
import static android.os.UserHandle.USER_SYSTEM;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import static com.android.systemui.mediaprojection.permission.ScreenShareOptionKt.ENTIRE_SCREEN;
@@ -31,7 +32,6 @@ import static com.android.systemui.mediaprojection.permission.ScreenShareOptionK
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions.LaunchCookie;
import android.app.AlertDialog;
import android.app.StatusBarManager;
@@ -366,11 +366,11 @@ public class MediaProjectionPermissionActivity extends Activity
                intent.putExtra(EXTRA_USER_REVIEW_GRANTED_CONSENT, mReviewGrantedConsentRequired);
                intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);

                // Start activity from the current foreground user to avoid creating a separate
                // SystemUI process without access to recent tasks because it won't have
                // WM Shell running inside.
                // Start activity as system user and manually show app selector to all users to
                // avoid creating a separate SystemUI process without access to recent tasks
                // because it won't have WM Shell running inside.
                mUserSelectingTask = true;
                startActivityAsUser(intent, UserHandle.of(ActivityManager.getCurrentUser()));
                startActivityAsUser(intent, UserHandle.of(USER_SYSTEM));
                // close shade if it's open
                mStatusBarManager.collapsePanels();
            }