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

Commit 02d082dd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add Window.isWideColorGamut()"

parents 3ac44eb1 adae59b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46539,6 +46539,7 @@ package android.view {
    method public final boolean isActive();
    method public abstract boolean isFloating();
    method public abstract boolean isShortcutKey(int, android.view.KeyEvent);
    method public boolean isWideColorGamut();
    method public final void makeActive();
    method protected abstract void onActive();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
+1 −0
Original line number Diff line number Diff line
@@ -50086,6 +50086,7 @@ package android.view {
    method public final boolean isActive();
    method public abstract boolean isFloating();
    method public abstract boolean isShortcutKey(int, android.view.KeyEvent);
    method public boolean isWideColorGamut();
    method public final void makeActive();
    method protected abstract void onActive();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
+1 −0
Original line number Diff line number Diff line
@@ -46949,6 +46949,7 @@ package android.view {
    method public final boolean isActive();
    method public abstract boolean isFloating();
    method public abstract boolean isShortcutKey(int, android.view.KeyEvent);
    method public boolean isWideColorGamut();
    method public final void makeActive();
    method protected abstract void onActive();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
+31 −4
Original line number Diff line number Diff line
@@ -1139,11 +1139,18 @@ public abstract class Window {
    }

    /**
     * <p>Set the color mode of the window. Setting the color mode might
     * <p>Sets the requested color mode of the window. The requested the color mode might
     * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
     *
     * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
     * <p>The requested color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
     * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.</p>
     *
     * <p>The requested color mode is not guaranteed to be honored. Please refer to
     * {@link #getColorMode()} for more information.</p>
     *
     * @see #getColorMode()
     * @see Display#isWideColorGamut()
     * @see Configuration#isScreenWideColorGamut()
     */
    public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
        final WindowManager.LayoutParams attrs = getAttributes();
@@ -1152,14 +1159,34 @@ public abstract class Window {
    }

    /**
     * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
     * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
     * Returns the requested color mode of the window, one of
     * {@link ActivityInfo#COLOR_MODE_DEFAULT}, {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT}
     * or {@link ActivityInfo#COLOR_MODE_HDR}. If {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT}
     * was requested it is possible the window will not be put in wide color gamut mode depending
     * on device and display support for that mode. Use {@link #isWideColorGamut} to determine
     * if the window is currently in wide color gamut mode.
     *
     * @see #setColorMode(int)
     * @see Display#isWideColorGamut()
     * @see Configuration#isScreenWideColorGamut()
     */
    @ActivityInfo.ColorMode
    public int getColorMode() {
        return getAttributes().getColorMode();
    }

    /**
     * Returns true if this window's color mode is {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT},
     * the display has a wide color gamut and this device supports wide color gamut rendering.
     *
     * @see Display#isWideColorGamut()
     * @see Configuration#isScreenWideColorGamut()
     */
    public boolean isWideColorGamut() {
        return getColorMode() == ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT
                && getContext().getResources().getConfiguration().isScreenWideColorGamut();
    }

    /**
     * Set the amount of dim behind the window when using
     * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}.  This overrides