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

Commit aef5aa78 authored by Kriti Dang's avatar Kriti Dang
Browse files

Boot time resolution changes in framework

Adding API and changes to incorporate boot-time resolution HAL APIs

Bug: 209598222
Test: atest CtsBootDisplayModeTestCases

Change-Id: I7081af903d8259cf7c0009238e7968d458ff3325
parent bce8d161
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2705,6 +2705,7 @@ package android.view {
    method @NonNull public android.view.Display.Mode getDefaultMode();
    method @NonNull public int[] getReportedHdrTypes();
    method @NonNull public android.graphics.ColorSpace[] getSupportedWideColorGamut();
    method @Nullable public android.view.Display.Mode getSystemPreferredDisplayMode();
    method public int getType();
    method @Nullable public android.view.Display.Mode getUserPreferredDisplayMode();
    method public boolean hasAccess(int);
+11 −0
Original line number Diff line number Diff line
@@ -915,6 +915,17 @@ public final class DisplayManagerGlobal {
        }
    }

    /**
     * Returns the system preferred display mode.
     */
    public Display.Mode getSystemPreferredDisplayMode(int displayId) {
        try {
            return mDm.getSystemPreferredDisplayMode(displayId);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * When enabled the app requested display resolution and refresh rate is always selected
     * in DisplayModeDirector regardless of user settings and policies for low brightness, low
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ interface IDisplayManager {
    // Requires MODIFY_USER_PREFERRED_DISPLAY_MODE permission.
    void setUserPreferredDisplayMode(int displayId, in Mode mode);
    Mode getUserPreferredDisplayMode(int displayId);
    Mode getSystemPreferredDisplayMode(int displayId);

    // When enabled the app requested display resolution and refresh rate is always selected
    // in DisplayModeDirector regardless of user settings and policies for low brightness, low
+13 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,19 @@ public final class Display {
        return mDisplayInfo.removeMode;
    }

    /**
     * Returns the system's preferred display mode. This mode will be used when the user has not
     * specified a display-mode preference. This returns null if the boot display mode feature is
     * not supported by system.
     *
     * @hide
     */
    @TestApi
    @Nullable
    public Display.Mode getSystemPreferredDisplayMode() {
        return mGlobal.getSystemPreferredDisplayMode(getDisplayId());
    }

    /**
     * Returns the display's HDR capabilities.
     *
+39 −2
Original line number Diff line number Diff line
@@ -197,6 +197,9 @@ public final class SurfaceControl implements Parcelable {
    private static native int[] nativeGetCompositionDataspaces();
    private static native boolean nativeSetActiveColorMode(IBinder displayToken,
            int colorMode);
    private static native boolean nativeGetBootDisplayModeSupport();
    private static native void nativeSetBootDisplayMode(IBinder displayToken, int displayMode);
    private static native void nativeClearBootDisplayMode(IBinder displayToken);
    private static native void nativeSetAutoLowLatencyMode(IBinder displayToken, boolean on);
    private static native void nativeSetGameContentType(IBinder displayToken, boolean on);
    private static native void nativeSetDisplayPowerMode(
@@ -1874,6 +1877,8 @@ public final class SurfaceControl implements Parcelable {
        public boolean autoLowLatencyModeSupported;
        public boolean gameContentTypeSupported;

        public int preferredBootDisplayMode;

        @Override
        public String toString() {
            return "DynamicDisplayInfo{"
@@ -1883,7 +1888,8 @@ public final class SurfaceControl implements Parcelable {
                    + ", activeColorMode=" + activeColorMode
                    + ", hdrCapabilities=" + hdrCapabilities
                    + ", autoLowLatencyModeSupported=" + autoLowLatencyModeSupported
                    + ", gameContentTypeSupported" + gameContentTypeSupported + "}";
                    + ", gameContentTypeSupported" + gameContentTypeSupported
                    + ", preferredBootDisplayMode" + preferredBootDisplayMode + "}";
        }

        @Override
@@ -1895,7 +1901,8 @@ public final class SurfaceControl implements Parcelable {
                && activeDisplayModeId == that.activeDisplayModeId
                && Arrays.equals(supportedColorModes, that.supportedColorModes)
                && activeColorMode == that.activeColorMode
                && Objects.equals(hdrCapabilities, that.hdrCapabilities);
                && Objects.equals(hdrCapabilities, that.hdrCapabilities)
                && preferredBootDisplayMode == that.preferredBootDisplayMode;
        }

        @Override
@@ -2259,6 +2266,36 @@ public final class SurfaceControl implements Parcelable {
        return colorSpaces;
    }

    /**
     * @hide
     */
    public static boolean getBootDisplayModeSupport() {
        return nativeGetBootDisplayModeSupport();
    }

    /** There is no associated getter for this method.  When this is set, the display is expected
     * to start up in this mode next time the device reboots.
     * @hide
     */
    public static void setBootDisplayMode(IBinder displayToken, int displayModeId) {
        if (displayToken == null) {
            throw new IllegalArgumentException("displayToken must not be null");
        }

        nativeSetBootDisplayMode(displayToken, displayModeId);
    }

    /**
     * @hide
     */
    public static void clearBootDisplayMode(IBinder displayToken) {
        if (displayToken == null) {
            throw new IllegalArgumentException("displayToken must not be null");
        }

        nativeClearBootDisplayMode(displayToken);
    }

    /**
     * @hide
     */
Loading