Loading core/java/android/hardware/display/DisplayManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,15 @@ public final class DisplayManager { @TestApi public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1 << 10; /** * Virtual display flags: Indicates that the display should not be a part of the default * DisplayGroup and instead be part of a new DisplayGroup. * * @see #createVirtualDisplay * @hide */ public static final int VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP = 1 << 11; /** @hide */ public DisplayManager(Context context) { mContext = context; Loading core/java/android/view/Display.java +9 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,15 @@ public final class Display { @TestApi public static final int FLAG_TRUSTED = 1 << 7; /** * Flag: Indicates that the display should not be a part of the default DisplayGroup and * instead be part of a new DisplayGroup. * * @hide * @see #getFlags() */ public static final int FLAG_OWN_DISPLAY_GROUP = 1 << 8; /** * Display flag: Indicates that the contents of the display should not be scaled * to fit the physical screen dimensions. Used for development only to emulate Loading services/core/java/com/android/server/display/DisplayDeviceInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,14 @@ final class DisplayDeviceInfo { */ public static final int FLAG_TRUSTED = 1 << 13; /** * Flag: Indicates that the display should not be a part of the default {@link DisplayGroup} and * instead be part of a new {@link DisplayGroup}. * * @hide */ public static final int FLAG_OWN_DISPLAY_GROUP = 1 << 14; /** * Touch attachment: Display does not receive touch. */ Loading services/core/java/com/android/server/display/DisplayGroup.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.display; import java.util.ArrayList; import java.util.List; /** * Represents a collection of {@link LogicalDisplay}s which act in unison for certain behaviors and * operations. */ public class DisplayGroup { final List<LogicalDisplay> mDisplays = new ArrayList<>(); void addDisplay(LogicalDisplay display) { if (!mDisplays.contains(display)) { mDisplays.add(display); } } boolean removeDisplay(LogicalDisplay display) { return mDisplays.remove(display); } } services/core/java/com/android/server/display/DisplayManagerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS; Loading Loading @@ -2024,6 +2025,9 @@ public final class DisplayManagerService extends SystemService { if ((flags & VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY) != 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; } if ((flags & VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP; } if (projection != null) { try { Loading Loading @@ -2062,6 +2066,14 @@ 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()")) { throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to " + "create a virtual display which is not in the default DisplayGroup."); } } if ((flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) == 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS; } Loading Loading
core/java/android/hardware/display/DisplayManager.java +9 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,15 @@ public final class DisplayManager { @TestApi public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1 << 10; /** * Virtual display flags: Indicates that the display should not be a part of the default * DisplayGroup and instead be part of a new DisplayGroup. * * @see #createVirtualDisplay * @hide */ public static final int VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP = 1 << 11; /** @hide */ public DisplayManager(Context context) { mContext = context; Loading
core/java/android/view/Display.java +9 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,15 @@ public final class Display { @TestApi public static final int FLAG_TRUSTED = 1 << 7; /** * Flag: Indicates that the display should not be a part of the default DisplayGroup and * instead be part of a new DisplayGroup. * * @hide * @see #getFlags() */ public static final int FLAG_OWN_DISPLAY_GROUP = 1 << 8; /** * Display flag: Indicates that the contents of the display should not be scaled * to fit the physical screen dimensions. Used for development only to emulate Loading
services/core/java/com/android/server/display/DisplayDeviceInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,14 @@ final class DisplayDeviceInfo { */ public static final int FLAG_TRUSTED = 1 << 13; /** * Flag: Indicates that the display should not be a part of the default {@link DisplayGroup} and * instead be part of a new {@link DisplayGroup}. * * @hide */ public static final int FLAG_OWN_DISPLAY_GROUP = 1 << 14; /** * Touch attachment: Display does not receive touch. */ Loading
services/core/java/com/android/server/display/DisplayGroup.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.display; import java.util.ArrayList; import java.util.List; /** * Represents a collection of {@link LogicalDisplay}s which act in unison for certain behaviors and * operations. */ public class DisplayGroup { final List<LogicalDisplay> mDisplays = new ArrayList<>(); void addDisplay(LogicalDisplay display) { if (!mDisplays.contains(display)) { mDisplays.add(display); } } boolean removeDisplay(LogicalDisplay display) { return mDisplays.remove(display); } }
services/core/java/com/android/server/display/DisplayManagerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS; Loading Loading @@ -2024,6 +2025,9 @@ public final class DisplayManagerService extends SystemService { if ((flags & VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY) != 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; } if ((flags & VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP; } if (projection != null) { try { Loading Loading @@ -2062,6 +2066,14 @@ 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()")) { throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to " + "create a virtual display which is not in the default DisplayGroup."); } } if ((flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) == 0) { flags &= ~VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS; } Loading