Loading core/api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -53129,6 +53129,7 @@ package android.view { method @Nullable public abstract android.view.View getCurrentFocus(); method @NonNull public abstract android.view.View getDecorView(); method public static int getDefaultFeatures(android.content.Context); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public float getDesiredHdrHeadroom(); method public android.transition.Transition getEnterTransition(); method public android.transition.Transition getExitTransition(); method protected final int getFeatures(); Loading Loading @@ -53198,6 +53199,7 @@ package android.view { method public abstract void setDecorCaptionShade(int); method public void setDecorFitsSystemWindows(boolean); method protected void setDefaultWindowFormat(int); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public void setDesiredHdrHeadroom(@FloatRange(from=0.0f, to=10000.0) float); method public void setDimAmount(float); method public void setElevation(float); method public void setEnterTransition(android.transition.Transition); Loading Loading @@ -53547,6 +53549,7 @@ package android.view { method public int describeContents(); method public int getBlurBehindRadius(); method public int getColorMode(); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public float getDesiredHdrHeadroom(); method public int getFitInsetsSides(); method public int getFitInsetsTypes(); method public final CharSequence getTitle(); Loading @@ -53556,6 +53559,7 @@ package android.view { method public void setBlurBehindRadius(@IntRange(from=0) int); method public void setCanPlayMoveAnimation(boolean); method public void setColorMode(int); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public void setDesiredHdrHeadroom(@FloatRange(from=0.0f, to=10000.0f) float); method public void setFitInsetsIgnoringVisibility(boolean); method public void setFitInsetsSides(int); method public void setFitInsetsTypes(int); core/java/android/view/ViewRootImpl.java +8 −4 Original line number Diff line number Diff line Loading @@ -1730,7 +1730,7 @@ public final class ViewRootImpl implements ViewParent, attrs.getTitle().toString()); mAttachInfo.mThreadedRenderer = renderer; renderer.setSurfaceControl(mSurfaceControl, mBlastBufferQueue); updateColorModeIfNeeded(attrs.getColorMode()); updateColorModeIfNeeded(attrs.getColorMode(), attrs.getDesiredHdrHeadroom()); updateRenderHdrSdrRatio(); updateForceDarkMode(); mAttachInfo.mHardwareAccelerated = true; Loading Loading @@ -3349,7 +3349,7 @@ public final class ViewRootImpl implements ViewParent, } final boolean alwaysConsumeSystemBarsChanged = mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars; updateColorModeIfNeeded(lp.getColorMode()); updateColorModeIfNeeded(lp.getColorMode(), lp.getDesiredHdrHeadroom()); surfaceCreated = !hadSurface && mSurface.isValid(); surfaceDestroyed = hadSurface && !mSurface.isValid(); Loading Loading @@ -5652,7 +5652,8 @@ public final class ViewRootImpl implements ViewParent, mUpdateHdrSdrRatioInfo = true; } private void updateColorModeIfNeeded(@ActivityInfo.ColorMode int colorMode) { private void updateColorModeIfNeeded(@ActivityInfo.ColorMode int colorMode, float desiredRatio) { if (mAttachInfo.mThreadedRenderer == null) { return; } Loading @@ -5666,7 +5667,10 @@ public final class ViewRootImpl implements ViewParent, && !getConfiguration().isScreenWideColorGamut()) { colorMode = ActivityInfo.COLOR_MODE_DEFAULT; } float desiredRatio = mAttachInfo.mThreadedRenderer.setColorMode(colorMode); float automaticRatio = mAttachInfo.mThreadedRenderer.setColorMode(colorMode); if (desiredRatio == 0 || desiredRatio > automaticRatio) { desiredRatio = automaticRatio; } if (desiredRatio != mDesiredHdrSdrRatio) { mDesiredHdrSdrRatio = desiredRatio; updateRenderHdrSdrRatio(); Loading core/java/android/view/Window.java +43 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTE import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IdRes; import android.annotation.LayoutRes; import android.annotation.NonNull; Loading Loading @@ -1329,6 +1331,47 @@ public abstract class Window { dispatchWindowAttributesChanged(attrs); } /** * <p>Sets the desired about of HDR headroom to be used when rendering as a ratio of * targetHdrPeakBrightnessInNits / targetSdrWhitePointInNits. Only applies when * {@link #setColorMode(int)} is {@link ActivityInfo#COLOR_MODE_HDR}</p> * * <p>By default the system will choose an amount of HDR headroom that is appropriate * for the underlying device capabilities & bit-depth of the panel. However, for some types * of content this can end up being more headroom than necessary or desired. An example * would be a messaging app or gallery thumbnail view where some amount of HDR pop is desired * without overly influencing the perceived brightness of the majority SDR content. This can * also be used to animate in/out of an HDR range for smoother transitions.</p> * * <p>Note: The actual amount of HDR headroom that will be given is subject to a variety * of factors such as ambient conditions, display capabilities, or bit-depth limitations. * See {@link Display#getHdrSdrRatio()} for more information as well as how to query the * current value.</p> * * @param desiredHeadroom The amount of HDR headroom that is desired. Must be >= 1.0 (no HDR) * and <= 10,000.0. Passing 0.0 will reset to the default, automatically * chosen value. * @see #getDesiredHdrHeadroom() * @see Display#getHdrSdrRatio() */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public void setDesiredHdrHeadroom( @FloatRange(from = 0.0f, to = 10000.0) float desiredHeadroom) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.setDesiredHdrHeadroom(desiredHeadroom); dispatchWindowAttributesChanged(attrs); } /** * Get the desired amount of HDR headroom as set by {@link #setDesiredHdrHeadroom(float)} * @return The amount of HDR headroom set, or 0 for automatic/default behavior. * @see #setDesiredHdrHeadroom(float) */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public float getDesiredHdrHeadroom() { return getAttributes().getDesiredHdrHeadroom(); } /** * If {@code isPreferred} is true, this method requests that the connected display does minimal * post processing when this window is visible on the screen. Otherwise, it requests that the Loading core/java/android/view/WindowManager.java +47 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import static android.view.WindowLayoutParamsProto.Y; import android.Manifest.permission; import android.annotation.CallbackExecutor; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; Loading Loading @@ -4315,6 +4316,9 @@ public interface WindowManager extends ViewManager { @ActivityInfo.ColorMode private int mColorMode = COLOR_MODE_DEFAULT; /** @hide */ private float mDesiredHdrHeadroom = 0; /** * Carries the requests about {@link WindowInsetsController.Appearance} and * {@link WindowInsetsController.Behavior} to the system windows which can produce insets. Loading Loading @@ -4716,6 +4720,39 @@ public interface WindowManager extends ViewManager { return mColorMode; } /** * <p>Sets the desired about of HDR headroom to be used when rendering as a ratio of * targetHdrPeakBrightnessInNits / targetSdrWhitePointInNits. Only applies when * {@link #setColorMode(int)} is {@link ActivityInfo#COLOR_MODE_HDR}</p> * * @see Window#setDesiredHdrHeadroom(float) * @param desiredHeadroom Desired amount of HDR headroom. Must be in the range of 1.0 (SDR) * to 10,000.0, or 0.0 to reset to default. */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public void setDesiredHdrHeadroom( @FloatRange(from = 0.0f, to = 10000.0f) float desiredHeadroom) { if (!Float.isFinite(desiredHeadroom)) { throw new IllegalArgumentException("desiredHeadroom must be finite: " + desiredHeadroom); } if (desiredHeadroom != 0 && (desiredHeadroom < 1.0f || desiredHeadroom > 10000.0f)) { throw new IllegalArgumentException( "desiredHeadroom must be 0.0 or in the range [1.0, 10000.0f], received: " + desiredHeadroom); } mDesiredHdrHeadroom = desiredHeadroom; } /** * Get the desired amount of HDR headroom as set by {@link #setDesiredHdrHeadroom(float)} * @return The amount of HDR headroom set, or 0 for automatic/default behavior. */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public float getDesiredHdrHeadroom() { return mDesiredHdrHeadroom; } /** * <p> * Blurs the screen behind the window. The effect is similar to that of {@link #dimAmount}, Loading Loading @@ -4866,6 +4903,7 @@ public interface WindowManager extends ViewManager { checkNonRecursiveParams(); out.writeTypedArray(paramsForRotation, 0 /* parcelableFlags */); out.writeInt(mDisplayFlags); out.writeFloat(mDesiredHdrHeadroom); } public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR Loading Loading @@ -4937,6 +4975,7 @@ public interface WindowManager extends ViewManager { forciblyShownTypes = in.readInt(); paramsForRotation = in.createTypedArray(LayoutParams.CREATOR); mDisplayFlags = in.readInt(); mDesiredHdrHeadroom = in.readFloat(); } @SuppressWarnings({"PointlessBitwiseExpression"}) Loading Loading @@ -5197,6 +5236,11 @@ public interface WindowManager extends ViewManager { changes |= COLOR_MODE_CHANGED; } if (mDesiredHdrHeadroom != o.mDesiredHdrHeadroom) { mDesiredHdrHeadroom = o.mDesiredHdrHeadroom; changes |= COLOR_MODE_CHANGED; } if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) { preferMinimalPostProcessing = o.preferMinimalPostProcessing; changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED; Loading Loading @@ -5424,6 +5468,9 @@ public interface WindowManager extends ViewManager { if (mColorMode != COLOR_MODE_DEFAULT) { sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); } if (mDesiredHdrHeadroom != 0) { sb.append(" desiredHdrHeadroom=").append(mDesiredHdrHeadroom); } if (preferMinimalPostProcessing) { sb.append(" preferMinimalPostProcessing="); sb.append(preferMinimalPostProcessing); Loading tests/SilkFX/src/com/android/test/silkfx/common/ColorModeControls.kt +8 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ class ColorModeControls : LinearLayout, WindowObserver { private var window: Window? = null private var currentModeDisplay: TextView? = null private var desiredRatio = 0.0f override fun onFinishInflate() { super.onFinishInflate() val window = window ?: throw IllegalStateException("Failed to attach window") Loading Loading @@ -67,6 +69,7 @@ class ColorModeControls : LinearLayout, WindowObserver { override fun onAttachedToWindow() { super.onAttachedToWindow() desiredRatio = window?.desiredHdrHeadroom ?: 0.0f val hdrVis = if (display.isHdrSdrRatioAvailable) { display.registerHdrSdrRatioChangedListener({ it.run() }, hdrSdrListener) View.VISIBLE Loading @@ -83,6 +86,11 @@ class ColorModeControls : LinearLayout, WindowObserver { } private fun setColorMode(newMode: Int) { if (newMode == ActivityInfo.COLOR_MODE_HDR && window!!.colorMode == ActivityInfo.COLOR_MODE_HDR) { desiredRatio = (desiredRatio + 1) % 5.0f window!!.desiredHdrHeadroom = desiredRatio } window!!.colorMode = newMode updateModeInfoDisplay() } Loading Loading
core/api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -53129,6 +53129,7 @@ package android.view { method @Nullable public abstract android.view.View getCurrentFocus(); method @NonNull public abstract android.view.View getDecorView(); method public static int getDefaultFeatures(android.content.Context); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public float getDesiredHdrHeadroom(); method public android.transition.Transition getEnterTransition(); method public android.transition.Transition getExitTransition(); method protected final int getFeatures(); Loading Loading @@ -53198,6 +53199,7 @@ package android.view { method public abstract void setDecorCaptionShade(int); method public void setDecorFitsSystemWindows(boolean); method protected void setDefaultWindowFormat(int); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public void setDesiredHdrHeadroom(@FloatRange(from=0.0f, to=10000.0) float); method public void setDimAmount(float); method public void setElevation(float); method public void setEnterTransition(android.transition.Transition); Loading Loading @@ -53547,6 +53549,7 @@ package android.view { method public int describeContents(); method public int getBlurBehindRadius(); method public int getColorMode(); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public float getDesiredHdrHeadroom(); method public int getFitInsetsSides(); method public int getFitInsetsTypes(); method public final CharSequence getTitle(); Loading @@ -53556,6 +53559,7 @@ package android.view { method public void setBlurBehindRadius(@IntRange(from=0) int); method public void setCanPlayMoveAnimation(boolean); method public void setColorMode(int); method @FlaggedApi("com.android.graphics.hwui.flags.limited_hdr") public void setDesiredHdrHeadroom(@FloatRange(from=0.0f, to=10000.0f) float); method public void setFitInsetsIgnoringVisibility(boolean); method public void setFitInsetsSides(int); method public void setFitInsetsTypes(int);
core/java/android/view/ViewRootImpl.java +8 −4 Original line number Diff line number Diff line Loading @@ -1730,7 +1730,7 @@ public final class ViewRootImpl implements ViewParent, attrs.getTitle().toString()); mAttachInfo.mThreadedRenderer = renderer; renderer.setSurfaceControl(mSurfaceControl, mBlastBufferQueue); updateColorModeIfNeeded(attrs.getColorMode()); updateColorModeIfNeeded(attrs.getColorMode(), attrs.getDesiredHdrHeadroom()); updateRenderHdrSdrRatio(); updateForceDarkMode(); mAttachInfo.mHardwareAccelerated = true; Loading Loading @@ -3349,7 +3349,7 @@ public final class ViewRootImpl implements ViewParent, } final boolean alwaysConsumeSystemBarsChanged = mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars; updateColorModeIfNeeded(lp.getColorMode()); updateColorModeIfNeeded(lp.getColorMode(), lp.getDesiredHdrHeadroom()); surfaceCreated = !hadSurface && mSurface.isValid(); surfaceDestroyed = hadSurface && !mSurface.isValid(); Loading Loading @@ -5652,7 +5652,8 @@ public final class ViewRootImpl implements ViewParent, mUpdateHdrSdrRatioInfo = true; } private void updateColorModeIfNeeded(@ActivityInfo.ColorMode int colorMode) { private void updateColorModeIfNeeded(@ActivityInfo.ColorMode int colorMode, float desiredRatio) { if (mAttachInfo.mThreadedRenderer == null) { return; } Loading @@ -5666,7 +5667,10 @@ public final class ViewRootImpl implements ViewParent, && !getConfiguration().isScreenWideColorGamut()) { colorMode = ActivityInfo.COLOR_MODE_DEFAULT; } float desiredRatio = mAttachInfo.mThreadedRenderer.setColorMode(colorMode); float automaticRatio = mAttachInfo.mThreadedRenderer.setColorMode(colorMode); if (desiredRatio == 0 || desiredRatio > automaticRatio) { desiredRatio = automaticRatio; } if (desiredRatio != mDesiredHdrSdrRatio) { mDesiredHdrSdrRatio = desiredRatio; updateRenderHdrSdrRatio(); Loading
core/java/android/view/Window.java +43 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTE import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IdRes; import android.annotation.LayoutRes; import android.annotation.NonNull; Loading Loading @@ -1329,6 +1331,47 @@ public abstract class Window { dispatchWindowAttributesChanged(attrs); } /** * <p>Sets the desired about of HDR headroom to be used when rendering as a ratio of * targetHdrPeakBrightnessInNits / targetSdrWhitePointInNits. Only applies when * {@link #setColorMode(int)} is {@link ActivityInfo#COLOR_MODE_HDR}</p> * * <p>By default the system will choose an amount of HDR headroom that is appropriate * for the underlying device capabilities & bit-depth of the panel. However, for some types * of content this can end up being more headroom than necessary or desired. An example * would be a messaging app or gallery thumbnail view where some amount of HDR pop is desired * without overly influencing the perceived brightness of the majority SDR content. This can * also be used to animate in/out of an HDR range for smoother transitions.</p> * * <p>Note: The actual amount of HDR headroom that will be given is subject to a variety * of factors such as ambient conditions, display capabilities, or bit-depth limitations. * See {@link Display#getHdrSdrRatio()} for more information as well as how to query the * current value.</p> * * @param desiredHeadroom The amount of HDR headroom that is desired. Must be >= 1.0 (no HDR) * and <= 10,000.0. Passing 0.0 will reset to the default, automatically * chosen value. * @see #getDesiredHdrHeadroom() * @see Display#getHdrSdrRatio() */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public void setDesiredHdrHeadroom( @FloatRange(from = 0.0f, to = 10000.0) float desiredHeadroom) { final WindowManager.LayoutParams attrs = getAttributes(); attrs.setDesiredHdrHeadroom(desiredHeadroom); dispatchWindowAttributesChanged(attrs); } /** * Get the desired amount of HDR headroom as set by {@link #setDesiredHdrHeadroom(float)} * @return The amount of HDR headroom set, or 0 for automatic/default behavior. * @see #setDesiredHdrHeadroom(float) */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public float getDesiredHdrHeadroom() { return getAttributes().getDesiredHdrHeadroom(); } /** * If {@code isPreferred} is true, this method requests that the connected display does minimal * post processing when this window is visible on the screen. Otherwise, it requests that the Loading
core/java/android/view/WindowManager.java +47 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import static android.view.WindowLayoutParamsProto.Y; import android.Manifest.permission; import android.annotation.CallbackExecutor; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; Loading Loading @@ -4315,6 +4316,9 @@ public interface WindowManager extends ViewManager { @ActivityInfo.ColorMode private int mColorMode = COLOR_MODE_DEFAULT; /** @hide */ private float mDesiredHdrHeadroom = 0; /** * Carries the requests about {@link WindowInsetsController.Appearance} and * {@link WindowInsetsController.Behavior} to the system windows which can produce insets. Loading Loading @@ -4716,6 +4720,39 @@ public interface WindowManager extends ViewManager { return mColorMode; } /** * <p>Sets the desired about of HDR headroom to be used when rendering as a ratio of * targetHdrPeakBrightnessInNits / targetSdrWhitePointInNits. Only applies when * {@link #setColorMode(int)} is {@link ActivityInfo#COLOR_MODE_HDR}</p> * * @see Window#setDesiredHdrHeadroom(float) * @param desiredHeadroom Desired amount of HDR headroom. Must be in the range of 1.0 (SDR) * to 10,000.0, or 0.0 to reset to default. */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public void setDesiredHdrHeadroom( @FloatRange(from = 0.0f, to = 10000.0f) float desiredHeadroom) { if (!Float.isFinite(desiredHeadroom)) { throw new IllegalArgumentException("desiredHeadroom must be finite: " + desiredHeadroom); } if (desiredHeadroom != 0 && (desiredHeadroom < 1.0f || desiredHeadroom > 10000.0f)) { throw new IllegalArgumentException( "desiredHeadroom must be 0.0 or in the range [1.0, 10000.0f], received: " + desiredHeadroom); } mDesiredHdrHeadroom = desiredHeadroom; } /** * Get the desired amount of HDR headroom as set by {@link #setDesiredHdrHeadroom(float)} * @return The amount of HDR headroom set, or 0 for automatic/default behavior. */ @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_LIMITED_HDR) public float getDesiredHdrHeadroom() { return mDesiredHdrHeadroom; } /** * <p> * Blurs the screen behind the window. The effect is similar to that of {@link #dimAmount}, Loading Loading @@ -4866,6 +4903,7 @@ public interface WindowManager extends ViewManager { checkNonRecursiveParams(); out.writeTypedArray(paramsForRotation, 0 /* parcelableFlags */); out.writeInt(mDisplayFlags); out.writeFloat(mDesiredHdrHeadroom); } public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR Loading Loading @@ -4937,6 +4975,7 @@ public interface WindowManager extends ViewManager { forciblyShownTypes = in.readInt(); paramsForRotation = in.createTypedArray(LayoutParams.CREATOR); mDisplayFlags = in.readInt(); mDesiredHdrHeadroom = in.readFloat(); } @SuppressWarnings({"PointlessBitwiseExpression"}) Loading Loading @@ -5197,6 +5236,11 @@ public interface WindowManager extends ViewManager { changes |= COLOR_MODE_CHANGED; } if (mDesiredHdrHeadroom != o.mDesiredHdrHeadroom) { mDesiredHdrHeadroom = o.mDesiredHdrHeadroom; changes |= COLOR_MODE_CHANGED; } if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) { preferMinimalPostProcessing = o.preferMinimalPostProcessing; changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED; Loading Loading @@ -5424,6 +5468,9 @@ public interface WindowManager extends ViewManager { if (mColorMode != COLOR_MODE_DEFAULT) { sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); } if (mDesiredHdrHeadroom != 0) { sb.append(" desiredHdrHeadroom=").append(mDesiredHdrHeadroom); } if (preferMinimalPostProcessing) { sb.append(" preferMinimalPostProcessing="); sb.append(preferMinimalPostProcessing); Loading
tests/SilkFX/src/com/android/test/silkfx/common/ColorModeControls.kt +8 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ class ColorModeControls : LinearLayout, WindowObserver { private var window: Window? = null private var currentModeDisplay: TextView? = null private var desiredRatio = 0.0f override fun onFinishInflate() { super.onFinishInflate() val window = window ?: throw IllegalStateException("Failed to attach window") Loading Loading @@ -67,6 +69,7 @@ class ColorModeControls : LinearLayout, WindowObserver { override fun onAttachedToWindow() { super.onAttachedToWindow() desiredRatio = window?.desiredHdrHeadroom ?: 0.0f val hdrVis = if (display.isHdrSdrRatioAvailable) { display.registerHdrSdrRatioChangedListener({ it.run() }, hdrSdrListener) View.VISIBLE Loading @@ -83,6 +86,11 @@ class ColorModeControls : LinearLayout, WindowObserver { } private fun setColorMode(newMode: Int) { if (newMode == ActivityInfo.COLOR_MODE_HDR && window!!.colorMode == ActivityInfo.COLOR_MODE_HDR) { desiredRatio = (desiredRatio + 1) % 5.0f window!!.desiredHdrHeadroom = desiredRatio } window!!.colorMode = newMode updateModeInfoDisplay() } Loading