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

Commit eeca5edd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Added support for creating always unlocked displays" into main

parents 307b1b2b a081ee9c
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1971,7 +1971,8 @@ public final class DisplayManagerService extends SystemService {

        if (callingUid != Process.SYSTEM_UID
                && (flags & VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP) != 0) {
            if (!checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")) {
            if (!(checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")
                    || checkCallingPermission(ACCESS_COMPUTER_CONTROL, "createVirtualDisplay()"))) {
                throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to "
                        + "create a virtual display which is not in the default DisplayGroup.");
            }
@@ -1985,10 +1986,11 @@ public final class DisplayManagerService extends SystemService {
            flags &= ~VIRTUAL_DISPLAY_FLAG_ALWAYS_UNLOCKED;
        }

        if ((flags & VIRTUAL_DISPLAY_FLAG_ALWAYS_UNLOCKED) != 0) {
        if (callingUid != Process.SYSTEM_UID
                    && !checkCallingPermission(ADD_ALWAYS_UNLOCKED_DISPLAY,
                    "createVirtualDisplay()")) {
                && (flags & VIRTUAL_DISPLAY_FLAG_ALWAYS_UNLOCKED) != 0) {
            if (!(checkCallingPermission(ADD_ALWAYS_UNLOCKED_DISPLAY, "createVirtualDisplay()")
                     || checkCallingPermission(ACCESS_COMPUTER_CONTROL,
                    "createVirtualDisplay()"))) {
                throw new SecurityException(
                        "Requires ADD_ALWAYS_UNLOCKED_DISPLAY permission to "
                                + "create an always unlocked virtual display.");