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

Commit 768cbbd3 authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "Add TestApi to always select the app requested display mode"

parents fe03f74e 97ba024f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package android {
    field public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
    field public static final String NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
    field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
    field public static final String OVERRIDE_DISPLAY_MODE_REQUESTS = "android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS";
    field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
    field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
@@ -1313,6 +1314,8 @@ package android.hardware.display {
    method public android.graphics.Point getStableDisplaySize();
    method public boolean isMinimalPostProcessingRequested(int);
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public void setShouldAlwaysRespectAppRequestedMode(boolean);
    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public boolean shouldAlwaysRespectAppRequestedMode();
    field public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 512; // 0x200
    field public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1024; // 0x400
  }
+24 −0
Original line number Diff line number Diff line
@@ -840,6 +840,30 @@ public final class DisplayManager {
        return mGlobal.getMinimumBrightnessCurve();
    }

    /**
     * When enabled the app requested mode is always selected regardless of user settings and
     * policies for low brightness, low battery, etc.
     *
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS)
    public void setShouldAlwaysRespectAppRequestedMode(boolean enabled) {
        mGlobal.setShouldAlwaysRespectAppRequestedMode(enabled);
    }

    /**
     * Returns whether we are running in a mode which always selects the app requested display mode
     * and ignores user settings and policies for low brightness, low battery etc.
     *
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS)
    public boolean shouldAlwaysRespectAppRequestedMode() {
        return mGlobal.shouldAlwaysRespectAppRequestedMode();
    }

    /**
     * Listens for changes in available display devices.
     */
+26 −0
Original line number Diff line number Diff line
@@ -699,6 +699,32 @@ public final class DisplayManagerGlobal {
        }
    }

    /**
     * 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
     * battery etc.
     */
    public void setShouldAlwaysRespectAppRequestedMode(boolean enabled) {
        try {
            mDm.setShouldAlwaysRespectAppRequestedMode(enabled);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Returns whether DisplayModeDirector is running in a mode which always selects the app
     * requested display mode and ignores user settings and policies for low brightness, low
     * battery etc.
     */
    public boolean shouldAlwaysRespectAppRequestedMode() {
        try {
            return mDm.shouldAlwaysRespectAppRequestedMode();
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    private final class DisplayManagerCallback extends IDisplayManagerCallback.Stub {
        @Override
        public void onDisplayEvent(int displayId, int event) {
+6 −0
Original line number Diff line number Diff line
@@ -128,4 +128,10 @@ interface IDisplayManager {
    // The wide gamut color space is returned from composition pipeline
    // based on hardware capability.
    int getPreferredWideGamutColorSpaceId();

    // 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
    // battery etc.
    void setShouldAlwaysRespectAppRequestedMode(boolean enabled);
    boolean shouldAlwaysRespectAppRequestedMode();
}
+8 −0
Original line number Diff line number Diff line
@@ -3914,6 +3914,14 @@
    <permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS"
        android:protectionLevel="signature" />

    <!-- Allows an application to override the display mode requests
         so the app requested mode will be selected and user settings and display
         policies will be ignored.
         @hide
         @TestApi -->
    <permission android:name="android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS"
                android:protectionLevel="signature" />

    <!-- @SystemApi Allows an application to control VPN.
         <p>Not for use by third-party applications.</p>
         @hide -->
Loading