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

Commit fc8f82bc authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Allow showing content on virtual displays when locked

This adds new flag to virtual display that changes its
behavior when keyguard is shown, but can be dismissed without
entering credentials. This can be applied only to private
virtual displays.

Bug: 34280365
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testVirtualDisplayHidesContentWhenLocked
Test: #testShowWhenLockedVirtualDisplay
Test: #testShowWhenLockedPublicVirtualDisplay
Change-Id: I9c19d36295e62f59bd1db1352af707d54ea51667
parent 298c8782
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15246,6 +15246,7 @@ package android.hardware.display {
    field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
    field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
    field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
    field public static final int VIRTUAL_DISPLAY_FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
  }
  public static abstract interface DisplayManager.DisplayListener {
@@ -42575,6 +42576,7 @@ package android.view {
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_ROUND = 16; // 0x10
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int INVALID_DISPLAY = -1; // 0xffffffff
    field public static final int STATE_DOZE = 3; // 0x3
+2 −0
Original line number Diff line number Diff line
@@ -15823,6 +15823,7 @@ package android.hardware.display {
    field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
    field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
    field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
    field public static final int VIRTUAL_DISPLAY_FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
  }
  public static abstract interface DisplayManager.DisplayListener {
@@ -45976,6 +45977,7 @@ package android.view {
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_ROUND = 16; // 0x10
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int INVALID_DISPLAY = -1; // 0xffffffff
    field public static final int STATE_DOZE = 3; // 0x3
+2 −0
Original line number Diff line number Diff line
@@ -15279,6 +15279,7 @@ package android.hardware.display {
    field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
    field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
    field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
    field public static final int VIRTUAL_DISPLAY_FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
  }
  public static abstract interface DisplayManager.DisplayListener {
@@ -42877,6 +42878,7 @@ package android.view {
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_ROUND = 16; // 0x10
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 32; // 0x20
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int INVALID_DISPLAY = -1; // 0xffffffff
    field public static final int STATE_DOZE = 3; // 0x3
+23 −7
Original line number Diff line number Diff line
@@ -108,13 +108,14 @@ public final class DisplayManager {
     * </p>
     *
     * <p>
     * A private virtual display belongs to the application that created it.
     * Only the a owner of a private virtual display is allowed to place windows upon it.
     * The private virtual display also does not participate in display mirroring: it will
     * neither receive mirrored content from another display nor allow its own content to
     * be mirrored elsewhere.  More precisely, the only processes that are allowed to
     * enumerate or interact with the private display are those that have the same UID as the
     * application that originally created the private virtual display.
     * A private virtual display belongs to the application that created it.  Only the a owner of a
     * private virtual display and the apps that are already on that display are allowed to place
     * windows upon it.  The private virtual display also does not participate in display mirroring:
     * it will neither receive mirrored content from another display nor allow its own content to be
     * mirrored elsewhere.  More precisely, the only processes that are allowed to enumerate or
     * interact with the private display are those that have the same UID as the application that
     * originally created the private virtual display or as the activities that are already on that
     * display.
     * </p>
     *
     * @see #createVirtualDisplay
@@ -234,6 +235,21 @@ public final class DisplayManager {
     */
    public static final int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 1 << 4;

    /**
     * Virtual display flag: Allows content to be displayed on private virtual displays when
     * keyguard is shown but is insecure.
     *
     * <p>
     * This flag can only be applied to private displays as defined by the
     * {@link Display#FLAG_PRIVATE} display flag. It is mutually exclusive with
     * {@link #VIRTUAL_DISPLAY_FLAG_PUBLIC}. If both flags are specified then this flag's behavior
     * will not be applied.
     * </p>
     *
     * @see #createVirtualDisplay
     */
    public static final int VIRTUAL_DISPLAY_FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 1 << 5;

    /** @hide */
    public DisplayManager(Context context) {
        mContext = context;
+14 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public final class Display {

    /**
     * Display flag: Indicates that the display is private.  Only the application that
     * owns the display can create windows on it.
     * owns the display and apps that are already on the display can create windows on it.
     *
     * @see #getFlags
     */
@@ -193,6 +193,19 @@ public final class Display {
     */
    public static final int FLAG_ROUND = 1 << 4;

    /**
     * Display flag: Indicates that the display can show its content when non-secure keyguard is
     * shown.
     * <p>
     * This flag identifies secondary displays that won't show keyguard if it can be dismissed
     * without entering credentials. Display content will be shown even if other displays are
     * locked.
     * </p>
     *
     * @see #getFlags
     */
    public static final int FLAG_SHOW_WITH_INSECURE_LOCKSCREEN = 1 << 5;

    /**
     * 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