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

Commit 0c88200e authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Reapply "App-to-Web: Use userContext when getting DomainVerificationManager."" into main

parents 3cfc93c3 81d2f4a2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import kotlinx.coroutines.withContext
 */
internal class OpenByDefaultDialog(
    private val context: Context,
    private val userContext: Context,
    private val taskInfo: RunningTaskInfo,
    private val taskSurface: SurfaceControl,
    private val displayController: DisplayController,
@@ -75,7 +76,7 @@ internal class OpenByDefaultDialog(
    private lateinit var openInBrowserButton: RadioButton

    private val domainVerificationManager =
        context.getSystemService(DomainVerificationManager::class.java)!!
        userContext.getSystemService(DomainVerificationManager::class.java)!!
    private val packageName = taskInfo.baseActivity?.packageName!!

    private var loadAppInfoJob: Job? = null
+3 −2
Original line number Diff line number Diff line
@@ -1234,7 +1234,8 @@ public abstract class WMShellModule {
            Optional<CompatUIHandler> compatUI,
            DesksOrganizer desksOrganizer,
            ShellDesktopState shelldesktopState,
            DesktopConfig desktopConfig
            DesktopConfig desktopConfig,
            UserProfileContexts userProfileContexts
    ) {
        if (!shelldesktopState.canEnterDesktopModeOrShowAppHandle()) {
            return Optional.empty();
@@ -1253,7 +1254,7 @@ public abstract class WMShellModule {
                desktopModeUiEventLogger, taskResourceLoader, recentsTransitionHandler,
                desktopModeCompatPolicy, desktopTilingDecorViewModel,
                multiDisplayDragMoveIndicatorController, compatUI.orElse(null),
                desksOrganizer, shelldesktopState, desktopConfig));
                desksOrganizer, shelldesktopState, desktopConfig, userProfileContexts));
    }

    @WMSingleton
+10 −4
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ import com.android.wm.shell.common.MultiDisplayDragMoveIndicatorController;
import com.android.wm.shell.common.MultiInstanceHelper;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.common.UserProfileContexts;
import com.android.wm.shell.compatui.CompatUIController;
import com.android.wm.shell.compatui.api.CompatUIHandler;
import com.android.wm.shell.compatui.impl.CompatUIRequests;
@@ -262,6 +263,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
    private final MultiDisplayDragMoveIndicatorController mMultiDisplayDragMoveIndicatorController;
    private final LatencyTracker mLatencyTracker;
    private final CompatUIHandler mCompatUI;
    private final UserProfileContexts mUserProfileContexts;

    public DesktopModeWindowDecorViewModel(
            Context context,
@@ -306,7 +308,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            CompatUIHandler compatUI,
            DesksOrganizer desksOrganizer,
            ShellDesktopState shellDesktopState,
            DesktopConfig desktopConfig) {
            DesktopConfig desktopConfig,
            UserProfileContexts userProfileContexts) {
        this(
                context,
                shellExecutor,
@@ -357,7 +360,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                compatUI,
                desksOrganizer,
                shellDesktopState,
                desktopConfig);
                desktopConfig,
                userProfileContexts);
    }

    @VisibleForTesting
@@ -411,7 +415,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            CompatUIHandler compatUI,
            DesksOrganizer desksOrganizer,
            ShellDesktopState shellDesktopState,
            DesktopConfig desktopConfig) {
            DesktopConfig desktopConfig,
            UserProfileContexts userProfileContexts) {
        mContext = context;
        mMainExecutor = shellExecutor;
        mMainHandler = mainHandler;
@@ -453,6 +458,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        mAssistContentRequester = assistContentRequester;
        mWindowDecorViewHostSupplier = windowDecorViewHostSupplier;
        mCompatUI = compatUI;
        mUserProfileContexts = userProfileContexts;
        mOnDisplayChangingListener = (displayId, fromRotation, toRotation, displayAreaInfo, t) -> {
            DesktopModeWindowDecoration decoration;
            RunningTaskInfo taskInfo;
@@ -1909,7 +1915,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                        DesktopExperienceFlags.ENABLE_BUG_FIXES_FOR_SECONDARY_DISPLAY.isTrue()
                                ? mDisplayController.getDisplayContext(taskInfo.displayId)
                                : mContext,
                        mContext.createContextAsUser(UserHandle.of(taskInfo.userId), 0 /* flags */),
                        mUserProfileContexts.getOrCreate(taskInfo.userId),
                        mDisplayController,
                        mTaskResourceLoader,
                        mSplitScreenController,
+1 −0
Original line number Diff line number Diff line
@@ -1272,6 +1272,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        if (isOpenByDefaultDialogActive()) return;
        mOpenByDefaultDialog = new OpenByDefaultDialog(
                mContext,
                mUserContext,
                mTaskInfo,
                mTaskSurface,
                mDisplayController,
+1 −0
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ class AppHandleController(
        if (isOpenByDefaultDialogActive) return
        openByDefaultDialog = OpenByDefaultDialog(
            context,
            userContext,
            taskInfo,
            taskSurface,
            displayController,
Loading