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

Commit 5ab9fe8e authored by Lingyu Feng's avatar Lingyu Feng
Browse files

Add Display#FLAG_ALLOWS_CONTENT_MODE_SWITCH

- For local display device and wifi display device, the flag should be
  enabled by default.

- For overlay display device used in CTS, the flag should be disabled
  by default; for other overlay display devices, the flag should be
  enabled by default to simulate connected displays.

- Virtual display device should not set this flag at this point.

Bug: 391965805
Test: atest DisplayContentTest
Test: modified tests in the same topic
Flag: com.android.server.display.feature.flags.enable_display_content_mode_management
Change-Id: I7e6a31f8d5271e36de437854bf0c22d8275b1354
parent 166bb0dc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -433,8 +433,9 @@ public final class DisplayManager {
    public static final int VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 8;

    /**
     * Virtual display flag: Indicates that the display should support system decorations. Virtual
     * displays without this flag shouldn't show home, navigation bar or wallpaper.
     * Virtual display flag: Indicates that the display supports and should always show system
     * decorations. Virtual displays without this flag shouldn't show home, navigation bar or
     * wallpaper.
     * <p>This flag doesn't work without {@link #VIRTUAL_DISPLAY_FLAG_TRUSTED}</p>
     *
     * @see #createVirtualDisplay
+2 −1
Original line number Diff line number Diff line
@@ -15405,7 +15405,8 @@ public final class Settings {
         * <ul>
         * <li><pre>secure</pre>: creates a secure display</li>
         * <li><pre>own_content_only</pre>: only shows this display's own content</li>
         * <li><pre>should_show_system_decorations</pre>: supports system decorations</li>
         * <li><pre>should_show_system_decorations</pre>: always shows system decorations</li>
         * <li><pre>fixed_content_mode</pre>: does not allow the content mode switch</li>
         * </ul>
         * </p><p>
         * Example:
+13 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public final class Display {
    /**
     * Display flag: Indicates that the display should show system decorations.
     * <p>
     * This flag identifies secondary displays that should show system decorations, such as
     * This flag identifies secondary displays that should always show system decorations, such as
     * navigation bar, home activity or wallpaper.
     * </p>
     * <p>Note that this flag doesn't work without {@link #FLAG_TRUSTED}</p>
@@ -400,6 +400,18 @@ public final class Display {
     */
    public static final int FLAG_ROTATES_WITH_CONTENT = 1 << 14;

    /**
     * Display flag: Indicates that the display is allowed to switch the content mode between
     * projected/extended and mirroring. This allows the display to dynamically add or remove the
     * home and system decorations.
     *
     * Note that this flag shouldn't be enabled with {@link #FLAG_PRIVATE} or
     * {@link #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS} at the same time; otherwise it will be ignored.
     *
     * @hide
     */
    public static final int FLAG_ALLOWS_CONTENT_MODE_SWITCH = 1 << 15;

    /**
     * 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
+3 −0
Original line number Diff line number Diff line
@@ -1125,6 +1125,9 @@ public final class DisplayInfo implements Parcelable {
        if ((flags & Display.FLAG_REAR) != 0) {
            result.append(", FLAG_REAR_DISPLAY");
        }
        if ((flags & Display.FLAG_ALLOWS_CONTENT_MODE_SWITCH) != 0) {
            result.append(", FLAG_ALLOWS_CONTENT_MODE_SWITCH");
        }
        return result.toString();
    }
}
+15 −2
Original line number Diff line number Diff line
@@ -122,8 +122,8 @@ final class DisplayDeviceInfo {
    public static final int FLAG_MASK_DISPLAY_CUTOUT = 1 << 11;

    /**
     * Flag: This flag identifies secondary displays that should show system decorations, such as
     * navigation bar, home activity or wallpaper.
     * Flag: This flag identifies secondary displays that should always show system decorations,
     * such as navigation bar, home activity or wallpaper.
     * <p>Note that this flag doesn't work without {@link #FLAG_TRUSTED}</p>
     * @hide
     */
@@ -190,6 +190,19 @@ final class DisplayDeviceInfo {
     */
    public static final int FLAG_STEAL_TOP_FOCUS_DISABLED = 1 << 19;

    /**
     * Flag: Indicates that the display is allowed to switch the content mode between
     * projected/extended and mirroring. This allows the display to dynamically add or remove the
     * home and system decorations.
     *
     * Note that this flag should not be enabled with any of {@link #FLAG_PRIVATE},
     * {@link #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS}, or {@link #FLAG_OWN_CONTENT_ONLY} at the
     * same time; otherwise it will be ignored.
     *
     * @hide
     */
    public static final int FLAG_ALLOWS_CONTENT_MODE_SWITCH = 1 << 20;

    /**
     * Touch attachment: Display does not receive touch.
     */
Loading