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

Commit 559d50b8 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Further restrict activity launch on virtual displays" into...

Merge "Merge "Further restrict activity launch on virtual displays" into oc-dev am: 36dbd3d4 am: c8cccd76" into oc-dr1-dev-plus-aosp
parents 72f4e8e3 af08c843
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.Manifest.permission.CHANGE_CONFIGURATION;
import static android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST;
import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS;
import static android.Manifest.permission.READ_FRAME_BUFFER;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
@@ -10297,7 +10298,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    @Override
    public void moveStackToDisplay(int stackId, int displayId) {
        enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveStackToDisplay()");
        enforceCallingPermission(INTERNAL_SYSTEM_WINDOW, "moveStackToDisplay()");
        synchronized (this) {
            final long ident = Binder.clearCallingIdentity();
+5 −7
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.am;

import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS;
import static android.Manifest.permission.START_ANY_ACTIVITY;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
@@ -1672,8 +1673,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            // owner.
            final int launchDisplayId = options.getLaunchDisplayId();
            if (launchDisplayId != INVALID_DISPLAY
                    && !isCallerAllowedToLaunchOnDisplay(callingPid, callingUid, launchDisplayId,
                    aInfo)) {
                    && !isCallerAllowedToLaunchOnDisplay(callingPid, callingUid, launchDisplayId)) {
                final String msg = "Permission Denial: starting " + intent.toString()
                        + " from " + callerApp + " (pid=" + callingPid
                        + ", uid=" + callingUid + ") with launchDisplayId="
@@ -1687,8 +1687,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
    }

    /** Check if caller is allowed to launch activities on specified display. */
    boolean isCallerAllowedToLaunchOnDisplay(int callingPid, int callingUid, int launchDisplayId,
            ActivityInfo aInfo) {
    boolean isCallerAllowedToLaunchOnDisplay(int callingPid, int callingUid, int launchDisplayId) {
        if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check: displayId=" + launchDisplayId
                + " callingPid=" + callingPid + " callingUid=" + callingUid);

@@ -1699,7 +1698,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }

        // Check if the caller can manage activity stacks.
        final int startAnyPerm = mService.checkPermission(MANAGE_ACTIVITY_STACKS, callingPid,
        final int startAnyPerm = mService.checkPermission(INTERNAL_SYSTEM_WINDOW, callingPid,
                callingUid);
        if (startAnyPerm == PERMISSION_GRANTED) {
            if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:"
@@ -1708,8 +1707,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }

        if (activityDisplay.mDisplay.getType() == TYPE_VIRTUAL
                && activityDisplay.mDisplay.getOwnerUid() != SYSTEM_UID
                && (aInfo.flags & ActivityInfo.FLAG_ALLOW_EMBEDDED) == 0) {
                && activityDisplay.mDisplay.getOwnerUid() != SYSTEM_UID) {
            // Limit launching on virtual displays, because their contents can be read from Surface
            // by apps that created them.
            if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:"