Loading core/api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2859,6 +2859,9 @@ package android.hardware.display { field public final boolean nightMode; field public final String packageName; field public final float powerBrightnessFactor; field public final boolean reduceBrightColors; field public final float reduceBrightColorsOffset; field public final int reduceBrightColorsStrength; field public final long timeStamp; } Loading core/java/android/hardware/display/BrightnessChangeEvent.java +55 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,23 @@ public final class BrightnessChangeEvent implements Parcelable { /** If night mode color filter is active this will be the temperature in kelvin */ public final int colorTemperature; /** Whether the bright color reduction color transform is active */ public final boolean reduceBrightColors; /** How strong the bright color reduction color transform is set (only applicable if active), * specified as an integer from 0 - 100, inclusive. This value (scaled to 0-1, inclusive) is * then used in Ynew = (a * scaledStrength^2 + b * scaledStrength + c) * Ycurrent, where a, b, * and c are coefficients provided in the bright color reduction coefficient matrix, and * Ycurrent is the current hardware brightness in nits. */ public final int reduceBrightColorsStrength; /** Applied offset for the bright color reduction color transform (only applicable if active). * The offset is computed by summing the coefficients a, b, and c, from the coefficient matrix * and multiplying by the current brightness. */ public final float reduceBrightColorsOffset; /** Brightness level before slider adjustment */ public final float lastBrightness; Loading Loading @@ -105,8 +122,9 @@ public final class BrightnessChangeEvent implements Parcelable { private BrightnessChangeEvent(float brightness, long timeStamp, String packageName, int userId, float[] luxValues, long[] luxTimestamps, float batteryLevel, float powerBrightnessFactor, boolean nightMode, int colorTemperature, float lastBrightness, boolean isDefaultBrightnessConfig, boolean isUserSetBrightness, long[] colorValueBuckets, long colorSampleDuration) { boolean reduceBrightColors, int reduceBrightColorsStrength, float reduceBrightColorsOffset, float lastBrightness, boolean isDefaultBrightnessConfig, boolean isUserSetBrightness, long[] colorValueBuckets, long colorSampleDuration) { this.brightness = brightness; this.timeStamp = timeStamp; this.packageName = packageName; Loading @@ -117,6 +135,9 @@ public final class BrightnessChangeEvent implements Parcelable { this.powerBrightnessFactor = powerBrightnessFactor; this.nightMode = nightMode; this.colorTemperature = colorTemperature; this.reduceBrightColors = reduceBrightColors; this.reduceBrightColorsStrength = reduceBrightColorsStrength; this.reduceBrightColorsOffset = reduceBrightColorsOffset; this.lastBrightness = lastBrightness; this.isDefaultBrightnessConfig = isDefaultBrightnessConfig; this.isUserSetBrightness = isUserSetBrightness; Loading @@ -136,6 +157,9 @@ public final class BrightnessChangeEvent implements Parcelable { this.powerBrightnessFactor = other.powerBrightnessFactor; this.nightMode = other.nightMode; this.colorTemperature = other.colorTemperature; this.reduceBrightColors = other.reduceBrightColors; this.reduceBrightColorsStrength = other.reduceBrightColorsStrength; this.reduceBrightColorsOffset = other.reduceBrightColorsOffset; this.lastBrightness = other.lastBrightness; this.isDefaultBrightnessConfig = other.isDefaultBrightnessConfig; this.isUserSetBrightness = other.isUserSetBrightness; Loading @@ -154,6 +178,9 @@ public final class BrightnessChangeEvent implements Parcelable { powerBrightnessFactor = source.readFloat(); nightMode = source.readBoolean(); colorTemperature = source.readInt(); reduceBrightColors = source.readBoolean(); reduceBrightColorsStrength = source.readInt(); reduceBrightColorsOffset = source.readFloat(); lastBrightness = source.readFloat(); isDefaultBrightnessConfig = source.readBoolean(); isUserSetBrightness = source.readBoolean(); Loading Loading @@ -188,6 +215,9 @@ public final class BrightnessChangeEvent implements Parcelable { dest.writeFloat(powerBrightnessFactor); dest.writeBoolean(nightMode); dest.writeInt(colorTemperature); dest.writeBoolean(reduceBrightColors); dest.writeInt(reduceBrightColorsStrength); dest.writeFloat(reduceBrightColorsOffset); dest.writeFloat(lastBrightness); dest.writeBoolean(isDefaultBrightnessConfig); dest.writeBoolean(isUserSetBrightness); Loading @@ -207,6 +237,9 @@ public final class BrightnessChangeEvent implements Parcelable { private float mPowerBrightnessFactor; private boolean mNightMode; private int mColorTemperature; private boolean mReduceBrightColors; private int mReduceBrightColorsStrength; private float mReduceBrightColorsOffset; private float mLastBrightness; private boolean mIsDefaultBrightnessConfig; private boolean mIsUserSetBrightness; Loading Loading @@ -273,6 +306,24 @@ public final class BrightnessChangeEvent implements Parcelable { return this; } /** {@see BrightnessChangeEvent#reduceBrightColors} */ public Builder setReduceBrightColors(boolean reduceBrightColors) { mReduceBrightColors = reduceBrightColors; return this; } /** {@see BrightnessChangeEvent#reduceBrightColorsStrength} */ public Builder setReduceBrightColorsStrength(int strength) { mReduceBrightColorsStrength = strength; return this; } /** {@see BrightnessChangeEvent#reduceBrightColorsOffset} */ public Builder setReduceBrightColorsOffset(float offset) { mReduceBrightColorsOffset = offset; return this; } /** {@see BrightnessChangeEvent#lastBrightness} */ public Builder setLastBrightness(float lastBrightness) { mLastBrightness = lastBrightness; Loading Loading @@ -304,7 +355,8 @@ public final class BrightnessChangeEvent implements Parcelable { public BrightnessChangeEvent build() { return new BrightnessChangeEvent(mBrightness, mTimeStamp, mPackageName, mUserId, mLuxValues, mLuxTimestamps, mBatteryLevel, mPowerBrightnessFactor, mNightMode, mColorTemperature, mLastBrightness, mPowerBrightnessFactor, mNightMode, mColorTemperature, mReduceBrightColors, mReduceBrightColorsStrength, mReduceBrightColorsOffset, mLastBrightness, mIsDefaultBrightnessConfig, mIsUserSetBrightness, mColorValueBuckets, mColorSampleDuration); } Loading core/java/android/hardware/display/ColorDisplayManager.java +99 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,56 @@ public final class ColorDisplayManager { return mManager.isDisplayWhiteBalanceEnabled(); } /** * Enables or disables reduce bright colors. * * @hide */ @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setReduceBrightColorsActivated(boolean activated) { return mManager.setReduceBrightColorsActivated(activated); } /** * Returns whether reduce bright colors is currently enabled. * * @hide */ public boolean isReduceBrightColorsActivated() { return mManager.isReduceBrightColorsActivated(); } /** * Set the strength level of bright color reduction to apply to the display. * * @param strength 0-100 (inclusive), where 100 is full strength * @return whether the change was applied successfully * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setReduceBrightColorsStrength(@IntRange(from = 0, to = 100) int strength) { return mManager.setReduceBrightColorsStrength(strength); } /** * Gets the strength of the bright color reduction transform. * * @hide */ public int getReduceBrightColorsStrength() { return mManager.getReduceBrightColorsStrength(); } /** * Gets the brightness impact of the bright color reduction transform, as in the factor by which * the current brightness (in nits) should be multiplied to obtain the brightness offset 'b'. * * @hide */ public float getReduceBrightColorsOffsetFactor() { return mManager.getReduceBrightColorsOffsetFactor(); } /** * Returns {@code true} if Night Display is supported by the device. * Loading Loading @@ -477,6 +527,15 @@ public final class ColorDisplayManager { return context.getResources().getBoolean(R.bool.config_displayWhiteBalanceAvailable); } /** * Returns {@code true} if reduce bright colors is supported by the device. * * @hide */ public static boolean isReduceBrightColorsAvailable(Context context) { return context.getResources().getBoolean(R.bool.config_reduceBrightColorsAvailable); } /** * Check if the color transforms are color accelerated. Some transforms are experimental only * on non-accelerated platforms due to the performance implications. Loading Loading @@ -678,6 +737,46 @@ public final class ColorDisplayManager { } } boolean isReduceBrightColorsActivated() { try { return mCdm.isReduceBrightColorsActivated(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } boolean setReduceBrightColorsActivated(boolean activated) { try { return mCdm.setReduceBrightColorsActivated(activated); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } int getReduceBrightColorsStrength() { try { return mCdm.getReduceBrightColorsStrength(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } boolean setReduceBrightColorsStrength(int strength) { try { return mCdm.setReduceBrightColorsStrength(strength); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } float getReduceBrightColorsOffsetFactor() { try { return mCdm.getReduceBrightColorsOffsetFactor(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } int getColorMode() { try { return mCdm.getColorMode(); Loading core/java/android/hardware/display/IColorDisplayManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,10 @@ interface IColorDisplayManager { boolean isDisplayWhiteBalanceEnabled(); boolean setDisplayWhiteBalanceEnabled(boolean enabled); boolean isReduceBrightColorsActivated(); boolean setReduceBrightColorsActivated(boolean activated); int getReduceBrightColorsStrength(); boolean setReduceBrightColorsStrength(int strength); float getReduceBrightColorsOffsetFactor(); } No newline at end of file core/res/res/values/config.xml +12 −19 Original line number Diff line number Diff line Loading @@ -831,28 +831,21 @@ <!-- B y-intercept --> <item>-0.198650895</item> </string-array> <string-array name="config_reduceBrightColorsCoefficientsNative"> <!-- R a-coefficient --> <item>-0.691218457</item> <!-- R b-coefficient --> <item>0.050135153</item> <!-- R y-intercept --> <item>0.917684143</item> <!-- G a-coefficient --> <item>-0.691218457</item> <!-- G b-coefficient --> <item>0.050135153</item> <!-- G y-intercept --> <item>0.917684143</item> <!-- B a-coefficient --> <item>-0.691218457</item> <!-- B b-coefficient --> <item>0.050135153</item> <!-- B y-intercept --> <item>0.917684143</item> <!-- Control whether bright color reduction is available. This should only be enabled on devices that have a HWC implementation that can apply the matrix passed to setColorTransform without impacting power, performance, and app compatibility (e.g. protected content). --> <bool name="config_reduceBrightColorsAvailable">@bool/config_setColorTransformAccelerated</bool> <string-array name="config_reduceBrightColorsCoefficientsNonlinear"> <!-- a-coefficient --> <item>-0.4429953456</item> <!-- b-coefficient --> <item>-0.2434077725</item> <!-- y-intercept --> <item>0.9809063061</item> </string-array> <string-array name="config_reduceBrightColorsCoefficients"> <!-- R a-coefficient --> <item>0.00000000000000154</item> <!-- R b-coefficient --> <item>-1.0</item> <!-- R y-intercept --> <item>1.045977011</item> <!-- G a-coefficient --> <item>0.00000000000000224</item> <!-- G b-coefficient --> <item>-1.0</item> <!-- G y-intercept --> <item>1.045977011</item> <!-- B a-coefficient --> <item>0.0000000000000022</item> <!-- B b-coefficient --> <item>-1.0</item> <!-- B y-intercept --> <item>1.045977011</item> <!-- a-coefficient --> <item>-0.000000000000001</item> <!-- b-coefficient --> <item>-0.955555555555554</item> <!-- y-intercept --> <item>1.000000000000000</item> </string-array> <!-- Boolean indicating whether display white balance is supported. --> Loading Loading
core/api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2859,6 +2859,9 @@ package android.hardware.display { field public final boolean nightMode; field public final String packageName; field public final float powerBrightnessFactor; field public final boolean reduceBrightColors; field public final float reduceBrightColorsOffset; field public final int reduceBrightColorsStrength; field public final long timeStamp; } Loading
core/java/android/hardware/display/BrightnessChangeEvent.java +55 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,23 @@ public final class BrightnessChangeEvent implements Parcelable { /** If night mode color filter is active this will be the temperature in kelvin */ public final int colorTemperature; /** Whether the bright color reduction color transform is active */ public final boolean reduceBrightColors; /** How strong the bright color reduction color transform is set (only applicable if active), * specified as an integer from 0 - 100, inclusive. This value (scaled to 0-1, inclusive) is * then used in Ynew = (a * scaledStrength^2 + b * scaledStrength + c) * Ycurrent, where a, b, * and c are coefficients provided in the bright color reduction coefficient matrix, and * Ycurrent is the current hardware brightness in nits. */ public final int reduceBrightColorsStrength; /** Applied offset for the bright color reduction color transform (only applicable if active). * The offset is computed by summing the coefficients a, b, and c, from the coefficient matrix * and multiplying by the current brightness. */ public final float reduceBrightColorsOffset; /** Brightness level before slider adjustment */ public final float lastBrightness; Loading Loading @@ -105,8 +122,9 @@ public final class BrightnessChangeEvent implements Parcelable { private BrightnessChangeEvent(float brightness, long timeStamp, String packageName, int userId, float[] luxValues, long[] luxTimestamps, float batteryLevel, float powerBrightnessFactor, boolean nightMode, int colorTemperature, float lastBrightness, boolean isDefaultBrightnessConfig, boolean isUserSetBrightness, long[] colorValueBuckets, long colorSampleDuration) { boolean reduceBrightColors, int reduceBrightColorsStrength, float reduceBrightColorsOffset, float lastBrightness, boolean isDefaultBrightnessConfig, boolean isUserSetBrightness, long[] colorValueBuckets, long colorSampleDuration) { this.brightness = brightness; this.timeStamp = timeStamp; this.packageName = packageName; Loading @@ -117,6 +135,9 @@ public final class BrightnessChangeEvent implements Parcelable { this.powerBrightnessFactor = powerBrightnessFactor; this.nightMode = nightMode; this.colorTemperature = colorTemperature; this.reduceBrightColors = reduceBrightColors; this.reduceBrightColorsStrength = reduceBrightColorsStrength; this.reduceBrightColorsOffset = reduceBrightColorsOffset; this.lastBrightness = lastBrightness; this.isDefaultBrightnessConfig = isDefaultBrightnessConfig; this.isUserSetBrightness = isUserSetBrightness; Loading @@ -136,6 +157,9 @@ public final class BrightnessChangeEvent implements Parcelable { this.powerBrightnessFactor = other.powerBrightnessFactor; this.nightMode = other.nightMode; this.colorTemperature = other.colorTemperature; this.reduceBrightColors = other.reduceBrightColors; this.reduceBrightColorsStrength = other.reduceBrightColorsStrength; this.reduceBrightColorsOffset = other.reduceBrightColorsOffset; this.lastBrightness = other.lastBrightness; this.isDefaultBrightnessConfig = other.isDefaultBrightnessConfig; this.isUserSetBrightness = other.isUserSetBrightness; Loading @@ -154,6 +178,9 @@ public final class BrightnessChangeEvent implements Parcelable { powerBrightnessFactor = source.readFloat(); nightMode = source.readBoolean(); colorTemperature = source.readInt(); reduceBrightColors = source.readBoolean(); reduceBrightColorsStrength = source.readInt(); reduceBrightColorsOffset = source.readFloat(); lastBrightness = source.readFloat(); isDefaultBrightnessConfig = source.readBoolean(); isUserSetBrightness = source.readBoolean(); Loading Loading @@ -188,6 +215,9 @@ public final class BrightnessChangeEvent implements Parcelable { dest.writeFloat(powerBrightnessFactor); dest.writeBoolean(nightMode); dest.writeInt(colorTemperature); dest.writeBoolean(reduceBrightColors); dest.writeInt(reduceBrightColorsStrength); dest.writeFloat(reduceBrightColorsOffset); dest.writeFloat(lastBrightness); dest.writeBoolean(isDefaultBrightnessConfig); dest.writeBoolean(isUserSetBrightness); Loading @@ -207,6 +237,9 @@ public final class BrightnessChangeEvent implements Parcelable { private float mPowerBrightnessFactor; private boolean mNightMode; private int mColorTemperature; private boolean mReduceBrightColors; private int mReduceBrightColorsStrength; private float mReduceBrightColorsOffset; private float mLastBrightness; private boolean mIsDefaultBrightnessConfig; private boolean mIsUserSetBrightness; Loading Loading @@ -273,6 +306,24 @@ public final class BrightnessChangeEvent implements Parcelable { return this; } /** {@see BrightnessChangeEvent#reduceBrightColors} */ public Builder setReduceBrightColors(boolean reduceBrightColors) { mReduceBrightColors = reduceBrightColors; return this; } /** {@see BrightnessChangeEvent#reduceBrightColorsStrength} */ public Builder setReduceBrightColorsStrength(int strength) { mReduceBrightColorsStrength = strength; return this; } /** {@see BrightnessChangeEvent#reduceBrightColorsOffset} */ public Builder setReduceBrightColorsOffset(float offset) { mReduceBrightColorsOffset = offset; return this; } /** {@see BrightnessChangeEvent#lastBrightness} */ public Builder setLastBrightness(float lastBrightness) { mLastBrightness = lastBrightness; Loading Loading @@ -304,7 +355,8 @@ public final class BrightnessChangeEvent implements Parcelable { public BrightnessChangeEvent build() { return new BrightnessChangeEvent(mBrightness, mTimeStamp, mPackageName, mUserId, mLuxValues, mLuxTimestamps, mBatteryLevel, mPowerBrightnessFactor, mNightMode, mColorTemperature, mLastBrightness, mPowerBrightnessFactor, mNightMode, mColorTemperature, mReduceBrightColors, mReduceBrightColorsStrength, mReduceBrightColorsOffset, mLastBrightness, mIsDefaultBrightnessConfig, mIsUserSetBrightness, mColorValueBuckets, mColorSampleDuration); } Loading
core/java/android/hardware/display/ColorDisplayManager.java +99 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,56 @@ public final class ColorDisplayManager { return mManager.isDisplayWhiteBalanceEnabled(); } /** * Enables or disables reduce bright colors. * * @hide */ @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setReduceBrightColorsActivated(boolean activated) { return mManager.setReduceBrightColorsActivated(activated); } /** * Returns whether reduce bright colors is currently enabled. * * @hide */ public boolean isReduceBrightColorsActivated() { return mManager.isReduceBrightColorsActivated(); } /** * Set the strength level of bright color reduction to apply to the display. * * @param strength 0-100 (inclusive), where 100 is full strength * @return whether the change was applied successfully * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setReduceBrightColorsStrength(@IntRange(from = 0, to = 100) int strength) { return mManager.setReduceBrightColorsStrength(strength); } /** * Gets the strength of the bright color reduction transform. * * @hide */ public int getReduceBrightColorsStrength() { return mManager.getReduceBrightColorsStrength(); } /** * Gets the brightness impact of the bright color reduction transform, as in the factor by which * the current brightness (in nits) should be multiplied to obtain the brightness offset 'b'. * * @hide */ public float getReduceBrightColorsOffsetFactor() { return mManager.getReduceBrightColorsOffsetFactor(); } /** * Returns {@code true} if Night Display is supported by the device. * Loading Loading @@ -477,6 +527,15 @@ public final class ColorDisplayManager { return context.getResources().getBoolean(R.bool.config_displayWhiteBalanceAvailable); } /** * Returns {@code true} if reduce bright colors is supported by the device. * * @hide */ public static boolean isReduceBrightColorsAvailable(Context context) { return context.getResources().getBoolean(R.bool.config_reduceBrightColorsAvailable); } /** * Check if the color transforms are color accelerated. Some transforms are experimental only * on non-accelerated platforms due to the performance implications. Loading Loading @@ -678,6 +737,46 @@ public final class ColorDisplayManager { } } boolean isReduceBrightColorsActivated() { try { return mCdm.isReduceBrightColorsActivated(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } boolean setReduceBrightColorsActivated(boolean activated) { try { return mCdm.setReduceBrightColorsActivated(activated); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } int getReduceBrightColorsStrength() { try { return mCdm.getReduceBrightColorsStrength(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } boolean setReduceBrightColorsStrength(int strength) { try { return mCdm.setReduceBrightColorsStrength(strength); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } float getReduceBrightColorsOffsetFactor() { try { return mCdm.getReduceBrightColorsOffsetFactor(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } int getColorMode() { try { return mCdm.getColorMode(); Loading
core/java/android/hardware/display/IColorDisplayManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,10 @@ interface IColorDisplayManager { boolean isDisplayWhiteBalanceEnabled(); boolean setDisplayWhiteBalanceEnabled(boolean enabled); boolean isReduceBrightColorsActivated(); boolean setReduceBrightColorsActivated(boolean activated); int getReduceBrightColorsStrength(); boolean setReduceBrightColorsStrength(int strength); float getReduceBrightColorsOffsetFactor(); } No newline at end of file
core/res/res/values/config.xml +12 −19 Original line number Diff line number Diff line Loading @@ -831,28 +831,21 @@ <!-- B y-intercept --> <item>-0.198650895</item> </string-array> <string-array name="config_reduceBrightColorsCoefficientsNative"> <!-- R a-coefficient --> <item>-0.691218457</item> <!-- R b-coefficient --> <item>0.050135153</item> <!-- R y-intercept --> <item>0.917684143</item> <!-- G a-coefficient --> <item>-0.691218457</item> <!-- G b-coefficient --> <item>0.050135153</item> <!-- G y-intercept --> <item>0.917684143</item> <!-- B a-coefficient --> <item>-0.691218457</item> <!-- B b-coefficient --> <item>0.050135153</item> <!-- B y-intercept --> <item>0.917684143</item> <!-- Control whether bright color reduction is available. This should only be enabled on devices that have a HWC implementation that can apply the matrix passed to setColorTransform without impacting power, performance, and app compatibility (e.g. protected content). --> <bool name="config_reduceBrightColorsAvailable">@bool/config_setColorTransformAccelerated</bool> <string-array name="config_reduceBrightColorsCoefficientsNonlinear"> <!-- a-coefficient --> <item>-0.4429953456</item> <!-- b-coefficient --> <item>-0.2434077725</item> <!-- y-intercept --> <item>0.9809063061</item> </string-array> <string-array name="config_reduceBrightColorsCoefficients"> <!-- R a-coefficient --> <item>0.00000000000000154</item> <!-- R b-coefficient --> <item>-1.0</item> <!-- R y-intercept --> <item>1.045977011</item> <!-- G a-coefficient --> <item>0.00000000000000224</item> <!-- G b-coefficient --> <item>-1.0</item> <!-- G y-intercept --> <item>1.045977011</item> <!-- B a-coefficient --> <item>0.0000000000000022</item> <!-- B b-coefficient --> <item>-1.0</item> <!-- B y-intercept --> <item>1.045977011</item> <!-- a-coefficient --> <item>-0.000000000000001</item> <!-- b-coefficient --> <item>-0.955555555555554</item> <!-- y-intercept --> <item>1.000000000000000</item> </string-array> <!-- Boolean indicating whether display white balance is supported. --> Loading