1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.display; 18 19 import android.Manifest; 20 import android.annotation.FlaggedApi; 21 import android.annotation.IntDef; 22 import android.annotation.IntRange; 23 import android.annotation.NonNull; 24 import android.annotation.RequiresPermission; 25 import android.annotation.SystemApi; 26 import android.annotation.SystemService; 27 import android.annotation.TestApi; 28 import android.content.ContentResolver; 29 import android.content.Context; 30 import android.metrics.LogMaker; 31 import android.os.IBinder; 32 import android.os.RemoteException; 33 import android.os.ServiceManager; 34 import android.os.ServiceManager.ServiceNotFoundException; 35 import android.provider.Settings.Secure; 36 37 import com.android.internal.R; 38 import com.android.internal.logging.MetricsLogger; 39 import com.android.internal.logging.nano.MetricsProto.MetricsEvent; 40 import com.android.server.display.feature.flags.Flags; 41 42 import java.lang.annotation.Retention; 43 import java.lang.annotation.RetentionPolicy; 44 import java.time.LocalTime; 45 46 /** 47 * Manages the display's color transforms and modes. 48 * 49 * @hide 50 */ 51 @SystemApi 52 @SystemService(Context.COLOR_DISPLAY_SERVICE) 53 public final class ColorDisplayManager { 54 55 /** 56 * @hide 57 */ 58 @Retention(RetentionPolicy.SOURCE) 59 @IntDef({CAPABILITY_NONE, CAPABILITY_PROTECTED_CONTENT, CAPABILITY_HARDWARE_ACCELERATION_GLOBAL, 60 CAPABILITY_HARDWARE_ACCELERATION_PER_APP}) 61 public @interface CapabilityType {} 62 63 /** 64 * The device does not support color transforms. 65 * 66 * @hide 67 */ 68 @SystemApi 69 public static final int CAPABILITY_NONE = 0x0; 70 /** 71 * The device can use GPU composition on protected content (layers whose buffers are protected 72 * in the trusted memory zone). 73 * 74 * @hide 75 */ 76 @SystemApi 77 public static final int CAPABILITY_PROTECTED_CONTENT = 0x1; 78 /** 79 * The device's hardware can efficiently apply transforms to the entire display. 80 * 81 * @hide 82 */ 83 @SystemApi 84 public static final int CAPABILITY_HARDWARE_ACCELERATION_GLOBAL = 0x2; 85 /** 86 * The device's hardware can efficiently apply transforms to a specific Surface (window) so 87 * that apps can be transformed independently of one another. 88 * 89 * @hide 90 */ 91 @SystemApi 92 public static final int CAPABILITY_HARDWARE_ACCELERATION_PER_APP = 0x4; 93 94 /** 95 * @hide 96 */ 97 @Retention(RetentionPolicy.SOURCE) 98 @IntDef({ AUTO_MODE_DISABLED, AUTO_MODE_CUSTOM_TIME, AUTO_MODE_TWILIGHT }) 99 public @interface AutoMode {} 100 101 /** 102 * Auto mode value to prevent Night display from being automatically activated. It can still 103 * be activated manually via {@link #setNightDisplayActivated(boolean)}. 104 * 105 * @see #setNightDisplayAutoMode(int) 106 * 107 * @hide 108 */ 109 @SystemApi 110 public static final int AUTO_MODE_DISABLED = 0; 111 /** 112 * Auto mode value to automatically activate Night display at a specific start and end time. 113 * 114 * @see #setNightDisplayAutoMode(int) 115 * @see #setNightDisplayCustomStartTime(LocalTime) 116 * @see #setNightDisplayCustomEndTime(LocalTime) 117 * 118 * @hide 119 */ 120 @SystemApi 121 public static final int AUTO_MODE_CUSTOM_TIME = 1; 122 /** 123 * Auto mode value to automatically activate Night display from sunset to sunrise. 124 * 125 * @see #setNightDisplayAutoMode(int) 126 * 127 * @hide 128 */ 129 @SystemApi 130 public static final int AUTO_MODE_TWILIGHT = 2; 131 132 /** 133 * @hide 134 */ 135 @Retention(RetentionPolicy.SOURCE) 136 @IntDef({COLOR_MODE_NATURAL, COLOR_MODE_BOOSTED, COLOR_MODE_SATURATED, COLOR_MODE_AUTOMATIC}) 137 public @interface ColorMode {} 138 139 /** 140 * Color mode with natural colors. 141 * 142 * @hide 143 * @see #setColorMode(int) 144 */ 145 public static final int COLOR_MODE_NATURAL = 0; 146 /** 147 * Color mode with boosted colors. 148 * 149 * @hide 150 * @see #setColorMode(int) 151 */ 152 public static final int COLOR_MODE_BOOSTED = 1; 153 /** 154 * Color mode with saturated colors. 155 * 156 * @hide 157 * @see #setColorMode(int) 158 */ 159 public static final int COLOR_MODE_SATURATED = 2; 160 /** 161 * Color mode with automatic colors. 162 * 163 * @hide 164 * @see #setColorMode(int) 165 */ 166 public static final int COLOR_MODE_AUTOMATIC = 3; 167 168 /** 169 * Display color mode range reserved for vendor customizations by the RenderIntent definition in 170 * hardware/interfaces/graphics/common/1.1/types.hal. These are NOT directly related to (but ARE 171 * mutually exclusive with) the {@link ColorMode} constants, but ARE directly related (and ARE 172 * mutually exclusive with) the DISPLAY_COLOR_* constants in DisplayTransformManager. 173 * 174 * @hide 175 */ 176 public static final int VENDOR_COLOR_MODE_RANGE_MIN = 256; // 0x100 177 /** 178 * @hide 179 */ 180 public static final int VENDOR_COLOR_MODE_RANGE_MAX = 511; // 0x1ff 181 182 private final ColorDisplayManagerInternal mManager; 183 private MetricsLogger mMetricsLogger; 184 185 /** 186 * @hide 187 */ ColorDisplayManager()188 public ColorDisplayManager() { 189 mManager = ColorDisplayManagerInternal.getInstance(); 190 } 191 192 /** 193 * (De)activates the night display transform. 194 * 195 * @hide 196 */ 197 @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setNightDisplayActivated(boolean activated)198 public boolean setNightDisplayActivated(boolean activated) { 199 return mManager.setNightDisplayActivated(activated); 200 } 201 202 /** 203 * Returns whether the night display transform is currently active. 204 * 205 * @hide 206 */ isNightDisplayActivated()207 public boolean isNightDisplayActivated() { 208 return mManager.isNightDisplayActivated(); 209 } 210 211 /** 212 * Sets the color temperature of the night display transform. 213 * 214 * @hide 215 */ 216 @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setNightDisplayColorTemperature(int temperature)217 public boolean setNightDisplayColorTemperature(int temperature) { 218 return mManager.setNightDisplayColorTemperature(temperature); 219 } 220 221 /** 222 * Gets the color temperature of the night display transform. 223 * 224 * @hide 225 */ getNightDisplayColorTemperature()226 public int getNightDisplayColorTemperature() { 227 return mManager.getNightDisplayColorTemperature(); 228 } 229 230 /** 231 * Returns the current auto mode value controlling when Night display will be automatically 232 * activated. One of {@link #AUTO_MODE_DISABLED}, {@link #AUTO_MODE_CUSTOM_TIME}, or 233 * {@link #AUTO_MODE_TWILIGHT}. 234 * 235 * @hide 236 */ 237 @SystemApi 238 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) getNightDisplayAutoMode()239 public @AutoMode int getNightDisplayAutoMode() { 240 return mManager.getNightDisplayAutoMode(); 241 } 242 243 /** 244 * Returns the current auto mode value, without validation, or {@code 1} if the auto mode has 245 * never been set. 246 * 247 * @hide 248 */ getNightDisplayAutoModeRaw()249 public int getNightDisplayAutoModeRaw() { 250 return mManager.getNightDisplayAutoModeRaw(); 251 } 252 253 /** 254 * Sets the current auto mode value controlling when Night display will be automatically 255 * activated. One of {@link #AUTO_MODE_DISABLED}, {@link #AUTO_MODE_CUSTOM_TIME}, or 256 * {@link #AUTO_MODE_TWILIGHT}. 257 * 258 * @param autoMode the new auto mode to use 259 * @return {@code true} if new auto mode was set successfully 260 * 261 * @hide 262 */ 263 @SystemApi 264 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setNightDisplayAutoMode(@utoMode int autoMode)265 public boolean setNightDisplayAutoMode(@AutoMode int autoMode) { 266 if (autoMode != AUTO_MODE_DISABLED 267 && autoMode != AUTO_MODE_CUSTOM_TIME 268 && autoMode != AUTO_MODE_TWILIGHT) { 269 throw new IllegalArgumentException("Invalid autoMode: " + autoMode); 270 } 271 if (mManager.getNightDisplayAutoMode() != autoMode) { 272 getMetricsLogger().write(new LogMaker( 273 MetricsEvent.ACTION_NIGHT_DISPLAY_AUTO_MODE_CHANGED) 274 .setType(MetricsEvent.TYPE_ACTION) 275 .setSubtype(autoMode)); 276 } 277 return mManager.setNightDisplayAutoMode(autoMode); 278 } 279 280 /** 281 * Returns the local time when Night display will be automatically activated when using 282 * {@link ColorDisplayManager#AUTO_MODE_CUSTOM_TIME}. 283 * 284 * @hide 285 */ getNightDisplayCustomStartTime()286 public @NonNull LocalTime getNightDisplayCustomStartTime() { 287 return mManager.getNightDisplayCustomStartTime().getLocalTime(); 288 } 289 290 /** 291 * Sets the local time when Night display will be automatically activated when using 292 * {@link ColorDisplayManager#AUTO_MODE_CUSTOM_TIME}. 293 * 294 * @param startTime the local time to automatically activate Night display 295 * @return {@code true} if the new custom start time was set successfully 296 * 297 * @hide 298 */ 299 @SystemApi 300 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setNightDisplayCustomStartTime(@onNull LocalTime startTime)301 public boolean setNightDisplayCustomStartTime(@NonNull LocalTime startTime) { 302 if (startTime == null) { 303 throw new IllegalArgumentException("startTime cannot be null"); 304 } 305 getMetricsLogger().write(new LogMaker( 306 MetricsEvent.ACTION_NIGHT_DISPLAY_AUTO_MODE_CUSTOM_TIME_CHANGED) 307 .setType(MetricsEvent.TYPE_ACTION) 308 .setSubtype(0)); 309 return mManager.setNightDisplayCustomStartTime(new Time(startTime)); 310 } 311 312 /** 313 * Returns the local time when Night display will be automatically deactivated when using 314 * {@link #AUTO_MODE_CUSTOM_TIME}. 315 * 316 * @hide 317 */ getNightDisplayCustomEndTime()318 public @NonNull LocalTime getNightDisplayCustomEndTime() { 319 return mManager.getNightDisplayCustomEndTime().getLocalTime(); 320 } 321 322 /** 323 * Sets the local time when Night display will be automatically deactivated when using 324 * {@link #AUTO_MODE_CUSTOM_TIME}. 325 * 326 * @param endTime the local time to automatically deactivate Night display 327 * @return {@code true} if the new custom end time was set successfully 328 * 329 * @hide 330 */ 331 @SystemApi 332 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setNightDisplayCustomEndTime(@onNull LocalTime endTime)333 public boolean setNightDisplayCustomEndTime(@NonNull LocalTime endTime) { 334 if (endTime == null) { 335 throw new IllegalArgumentException("endTime cannot be null"); 336 } 337 getMetricsLogger().write(new LogMaker( 338 MetricsEvent.ACTION_NIGHT_DISPLAY_AUTO_MODE_CUSTOM_TIME_CHANGED) 339 .setType(MetricsEvent.TYPE_ACTION) 340 .setSubtype(1)); 341 return mManager.setNightDisplayCustomEndTime(new Time(endTime)); 342 } 343 344 /** 345 * Sets the current display color mode. 346 * 347 * @hide 348 */ setColorMode(int colorMode)349 public void setColorMode(int colorMode) { 350 mManager.setColorMode(colorMode); 351 } 352 353 /** 354 * Gets the current display color mode. 355 * 356 * @hide 357 */ getColorMode()358 public int getColorMode() { 359 return mManager.getColorMode(); 360 } 361 362 /** 363 * Returns whether the specified color mode is part of the standard set. 364 * 365 * @hide 366 */ isStandardColorMode(int mode)367 public static boolean isStandardColorMode(int mode) { 368 return mode == ColorDisplayManager.COLOR_MODE_NATURAL 369 || mode == ColorDisplayManager.COLOR_MODE_BOOSTED 370 || mode == ColorDisplayManager.COLOR_MODE_SATURATED 371 || mode == ColorDisplayManager.COLOR_MODE_AUTOMATIC; 372 } 373 374 /** 375 * Returns whether the device has a wide color gamut display. 376 * 377 * @hide 378 */ 379 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) isDeviceColorManaged()380 public boolean isDeviceColorManaged() { 381 return mManager.isDeviceColorManaged(); 382 } 383 384 /** 385 * Set the level of color saturation to apply to the display. 386 * 387 * @param saturationLevel 0-100 (inclusive), where 100 is full saturation 388 * @return whether the saturation level change was applied successfully 389 * @hide 390 */ 391 @SystemApi 392 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setSaturationLevel(@ntRangefrom = 0, to = 100) int saturationLevel)393 public boolean setSaturationLevel(@IntRange(from = 0, to = 100) int saturationLevel) { 394 return mManager.setSaturationLevel(saturationLevel); 395 } 396 397 /** 398 * Gets whether or not a non-default saturation level is currently applied to the display. 399 * 400 * @return {@code true} if the display is not at full saturation 401 * @hide 402 */ 403 @TestApi 404 @FlaggedApi(android.app.Flags.FLAG_MODES_API) 405 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) isSaturationActivated()406 public boolean isSaturationActivated() { 407 return mManager.isSaturationActivated(); 408 } 409 410 /** 411 * Set the level of color saturation to apply to a specific app. 412 * 413 * @param packageName the package name of the app whose windows should be desaturated 414 * @param saturationLevel 0-100 (inclusive), where 100 is full saturation 415 * @return whether the saturation level change was applied successfully 416 * @hide 417 */ 418 @SystemApi 419 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setAppSaturationLevel(@onNull String packageName, @IntRange(from = 0, to = 100) int saturationLevel)420 public boolean setAppSaturationLevel(@NonNull String packageName, 421 @IntRange(from = 0, to = 100) int saturationLevel) { 422 return mManager.setAppSaturationLevel(packageName, saturationLevel); 423 } 424 425 /** 426 * Enables or disables display white balance. 427 * 428 * @hide 429 */ 430 @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setDisplayWhiteBalanceEnabled(boolean enabled)431 public boolean setDisplayWhiteBalanceEnabled(boolean enabled) { 432 return mManager.setDisplayWhiteBalanceEnabled(enabled); 433 } 434 435 /** 436 * Returns whether display white balance is currently enabled. Even if enabled, it may or may 437 * not be active, if another transform with higher priority is active. 438 * 439 * @hide 440 */ isDisplayWhiteBalanceEnabled()441 public boolean isDisplayWhiteBalanceEnabled() { 442 return mManager.isDisplayWhiteBalanceEnabled(); 443 } 444 445 /** 446 * Enables or disables reduce bright colors. 447 * 448 * @hide 449 */ 450 @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setReduceBrightColorsActivated(boolean activated)451 public boolean setReduceBrightColorsActivated(boolean activated) { 452 return mManager.setReduceBrightColorsActivated(activated); 453 } 454 455 /** 456 * Returns whether reduce bright colors is currently enabled. 457 * 458 * @hide 459 */ isReduceBrightColorsActivated()460 public boolean isReduceBrightColorsActivated() { 461 return mManager.isReduceBrightColorsActivated(); 462 } 463 464 /** 465 * Set the strength level of bright color reduction to apply to the display. 466 * 467 * @param strength 0-100 (inclusive), where 100 is full strength 468 * @return whether the change was applied successfully 469 * @hide 470 */ 471 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) setReduceBrightColorsStrength(@ntRangefrom = 0, to = 100) int strength)472 public boolean setReduceBrightColorsStrength(@IntRange(from = 0, to = 100) int strength) { 473 return mManager.setReduceBrightColorsStrength(strength); 474 } 475 476 /** 477 * Gets the strength of the bright color reduction transform. 478 * 479 * @hide 480 */ getReduceBrightColorsStrength()481 public int getReduceBrightColorsStrength() { 482 return mManager.getReduceBrightColorsStrength(); 483 } 484 485 /** 486 * Gets the brightness impact of the bright color reduction transform, as in the factor by which 487 * the current brightness (in nits) should be multiplied to obtain the brightness offset 'b'. 488 * 489 * @hide 490 */ getReduceBrightColorsOffsetFactor()491 public float getReduceBrightColorsOffsetFactor() { 492 return mManager.getReduceBrightColorsOffsetFactor(); 493 } 494 495 /** 496 * Returns {@code true} if Night Display is supported by the device. 497 * 498 * @hide 499 */ isNightDisplayAvailable(Context context)500 public static boolean isNightDisplayAvailable(Context context) { 501 return context.getResources().getBoolean(R.bool.config_nightDisplayAvailable); 502 } 503 504 /** 505 * Returns the minimum allowed color temperature (in Kelvin) to tint the display when 506 * activated. 507 * 508 * @hide 509 */ getMinimumColorTemperature(Context context)510 public static int getMinimumColorTemperature(Context context) { 511 return context.getResources() 512 .getInteger(R.integer.config_nightDisplayColorTemperatureMin); 513 } 514 515 /** 516 * Returns the maximum allowed color temperature (in Kelvin) to tint the display when 517 * activated. 518 * 519 * @hide 520 */ getMaximumColorTemperature(Context context)521 public static int getMaximumColorTemperature(Context context) { 522 return context.getResources() 523 .getInteger(R.integer.config_nightDisplayColorTemperatureMax); 524 } 525 526 /** 527 * Returns {@code true} if display white balance is supported by the device. 528 * 529 * @hide 530 */ isDisplayWhiteBalanceAvailable(Context context)531 public static boolean isDisplayWhiteBalanceAvailable(Context context) { 532 return context.getResources().getBoolean(R.bool.config_displayWhiteBalanceAvailable); 533 } 534 535 /** 536 * Returns {@code true} if reduce bright colors is supported by the device. 537 * Will return false if even dimmer is enabled - since this is the successor to RBC and cannot 538 * be run concurrently. 539 * 540 * @hide 541 */ isReduceBrightColorsAvailable(Context context)542 public static boolean isReduceBrightColorsAvailable(Context context) { 543 return context.getResources().getBoolean(R.bool.config_reduceBrightColorsAvailable) 544 && !(Flags.evenDimmer() && context.getResources().getBoolean( 545 com.android.internal.R.bool.config_evenDimmerEnabled)); 546 } 547 548 /** 549 * Returns the minimum allowed brightness reduction strength in percentage when activated. 550 * 551 * @hide 552 */ getMinimumReduceBrightColorsStrength(Context context)553 public static int getMinimumReduceBrightColorsStrength(Context context) { 554 return context.getResources() 555 .getInteger(R.integer.config_reduceBrightColorsStrengthMin); 556 } 557 558 /** 559 * Returns the maximum allowed brightness reduction strength in percentage when activated. 560 * 561 * @hide 562 */ getMaximumReduceBrightColorsStrength(Context context)563 public static int getMaximumReduceBrightColorsStrength(Context context) { 564 return context.getResources() 565 .getInteger(R.integer.config_reduceBrightColorsStrengthMax); 566 } 567 568 /** 569 * Check if the color transforms are color accelerated. Some transforms are experimental only 570 * on non-accelerated platforms due to the performance implications. 571 * 572 * @hide 573 */ isColorTransformAccelerated(Context context)574 public static boolean isColorTransformAccelerated(Context context) { 575 return context.getResources().getBoolean(R.bool.config_setColorTransformAccelerated); 576 } 577 578 /** 579 * Returns the available software and hardware color transform capabilities of this device. 580 * 581 * @hide 582 */ 583 @SystemApi 584 @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) getTransformCapabilities()585 public @CapabilityType int getTransformCapabilities() { 586 return mManager.getTransformCapabilities(); 587 } 588 589 /** 590 * Returns whether accessibility transforms are currently enabled, which determines whether 591 * color modes are currently configurable for this device. 592 * 593 * @hide 594 */ areAccessibilityTransformsEnabled(Context context)595 public static boolean areAccessibilityTransformsEnabled(Context context) { 596 final ContentResolver cr = context.getContentResolver(); 597 return Secure.getInt(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0) == 1 598 || Secure.getInt(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0) == 1; 599 } 600 getMetricsLogger()601 private MetricsLogger getMetricsLogger() { 602 if (mMetricsLogger == null) { 603 mMetricsLogger = new MetricsLogger(); 604 } 605 return mMetricsLogger; 606 } 607 608 private static class ColorDisplayManagerInternal { 609 610 private static ColorDisplayManagerInternal sInstance; 611 612 private final IColorDisplayManager mCdm; 613 ColorDisplayManagerInternal(IColorDisplayManager colorDisplayManager)614 private ColorDisplayManagerInternal(IColorDisplayManager colorDisplayManager) { 615 mCdm = colorDisplayManager; 616 } 617 getInstance()618 public static ColorDisplayManagerInternal getInstance() { 619 synchronized (ColorDisplayManagerInternal.class) { 620 if (sInstance == null) { 621 try { 622 IBinder b = ServiceManager.getServiceOrThrow(Context.COLOR_DISPLAY_SERVICE); 623 sInstance = new ColorDisplayManagerInternal( 624 IColorDisplayManager.Stub.asInterface(b)); 625 } catch (ServiceNotFoundException e) { 626 throw new IllegalStateException(e); 627 } 628 } 629 return sInstance; 630 } 631 } 632 isNightDisplayActivated()633 boolean isNightDisplayActivated() { 634 try { 635 return mCdm.isNightDisplayActivated(); 636 } catch (RemoteException e) { 637 throw e.rethrowFromSystemServer(); 638 } 639 } 640 setNightDisplayActivated(boolean activated)641 boolean setNightDisplayActivated(boolean activated) { 642 try { 643 return mCdm.setNightDisplayActivated(activated); 644 } catch (RemoteException e) { 645 throw e.rethrowFromSystemServer(); 646 } 647 } 648 getNightDisplayColorTemperature()649 int getNightDisplayColorTemperature() { 650 try { 651 return mCdm.getNightDisplayColorTemperature(); 652 } catch (RemoteException e) { 653 throw e.rethrowFromSystemServer(); 654 } 655 } 656 setNightDisplayColorTemperature(int temperature)657 boolean setNightDisplayColorTemperature(int temperature) { 658 try { 659 return mCdm.setNightDisplayColorTemperature(temperature); 660 } catch (RemoteException e) { 661 throw e.rethrowFromSystemServer(); 662 } 663 } 664 getNightDisplayAutoMode()665 int getNightDisplayAutoMode() { 666 try { 667 return mCdm.getNightDisplayAutoMode(); 668 } catch (RemoteException e) { 669 throw e.rethrowFromSystemServer(); 670 } 671 } 672 getNightDisplayAutoModeRaw()673 int getNightDisplayAutoModeRaw() { 674 try { 675 return mCdm.getNightDisplayAutoModeRaw(); 676 } catch (RemoteException e) { 677 throw e.rethrowFromSystemServer(); 678 } 679 } 680 setNightDisplayAutoMode(int autoMode)681 boolean setNightDisplayAutoMode(int autoMode) { 682 try { 683 return mCdm.setNightDisplayAutoMode(autoMode); 684 } catch (RemoteException e) { 685 throw e.rethrowFromSystemServer(); 686 } 687 } 688 getNightDisplayCustomStartTime()689 Time getNightDisplayCustomStartTime() { 690 try { 691 return mCdm.getNightDisplayCustomStartTime(); 692 } catch (RemoteException e) { 693 throw e.rethrowFromSystemServer(); 694 } 695 } 696 setNightDisplayCustomStartTime(Time startTime)697 boolean setNightDisplayCustomStartTime(Time startTime) { 698 try { 699 return mCdm.setNightDisplayCustomStartTime(startTime); 700 } catch (RemoteException e) { 701 throw e.rethrowFromSystemServer(); 702 } 703 } 704 getNightDisplayCustomEndTime()705 Time getNightDisplayCustomEndTime() { 706 try { 707 return mCdm.getNightDisplayCustomEndTime(); 708 } catch (RemoteException e) { 709 throw e.rethrowFromSystemServer(); 710 } 711 } 712 setNightDisplayCustomEndTime(Time endTime)713 boolean setNightDisplayCustomEndTime(Time endTime) { 714 try { 715 return mCdm.setNightDisplayCustomEndTime(endTime); 716 } catch (RemoteException e) { 717 throw e.rethrowFromSystemServer(); 718 } 719 } 720 isDeviceColorManaged()721 boolean isDeviceColorManaged() { 722 try { 723 return mCdm.isDeviceColorManaged(); 724 } catch (RemoteException e) { 725 throw e.rethrowFromSystemServer(); 726 } 727 } 728 setSaturationLevel(int saturationLevel)729 boolean setSaturationLevel(int saturationLevel) { 730 try { 731 return mCdm.setSaturationLevel(saturationLevel); 732 } catch (RemoteException e) { 733 throw e.rethrowFromSystemServer(); 734 } 735 } 736 isSaturationActivated()737 boolean isSaturationActivated() { 738 try { 739 return mCdm.isSaturationActivated(); 740 } catch (RemoteException e) { 741 throw e.rethrowFromSystemServer(); 742 } 743 } 744 setAppSaturationLevel(String packageName, int saturationLevel)745 boolean setAppSaturationLevel(String packageName, int saturationLevel) { 746 try { 747 return mCdm.setAppSaturationLevel(packageName, saturationLevel); 748 } catch (RemoteException e) { 749 throw e.rethrowFromSystemServer(); 750 } 751 } 752 isDisplayWhiteBalanceEnabled()753 boolean isDisplayWhiteBalanceEnabled() { 754 try { 755 return mCdm.isDisplayWhiteBalanceEnabled(); 756 } catch (RemoteException e) { 757 throw e.rethrowFromSystemServer(); 758 } 759 } 760 setDisplayWhiteBalanceEnabled(boolean enabled)761 boolean setDisplayWhiteBalanceEnabled(boolean enabled) { 762 try { 763 return mCdm.setDisplayWhiteBalanceEnabled(enabled); 764 } catch (RemoteException e) { 765 throw e.rethrowFromSystemServer(); 766 } 767 } 768 isReduceBrightColorsActivated()769 boolean isReduceBrightColorsActivated() { 770 try { 771 return mCdm.isReduceBrightColorsActivated(); 772 } catch (RemoteException e) { 773 throw e.rethrowFromSystemServer(); 774 } 775 } 776 setReduceBrightColorsActivated(boolean activated)777 boolean setReduceBrightColorsActivated(boolean activated) { 778 try { 779 return mCdm.setReduceBrightColorsActivated(activated); 780 } catch (RemoteException e) { 781 throw e.rethrowFromSystemServer(); 782 } 783 } 784 getReduceBrightColorsStrength()785 int getReduceBrightColorsStrength() { 786 try { 787 return mCdm.getReduceBrightColorsStrength(); 788 } catch (RemoteException e) { 789 throw e.rethrowFromSystemServer(); 790 } 791 } 792 setReduceBrightColorsStrength(int strength)793 boolean setReduceBrightColorsStrength(int strength) { 794 try { 795 return mCdm.setReduceBrightColorsStrength(strength); 796 } catch (RemoteException e) { 797 throw e.rethrowFromSystemServer(); 798 } 799 } 800 getReduceBrightColorsOffsetFactor()801 float getReduceBrightColorsOffsetFactor() { 802 try { 803 return mCdm.getReduceBrightColorsOffsetFactor(); 804 } catch (RemoteException e) { 805 throw e.rethrowFromSystemServer(); 806 } 807 } 808 getColorMode()809 int getColorMode() { 810 try { 811 return mCdm.getColorMode(); 812 } catch (RemoteException e) { 813 throw e.rethrowFromSystemServer(); 814 } 815 } 816 setColorMode(int colorMode)817 void setColorMode(int colorMode) { 818 try { 819 mCdm.setColorMode(colorMode); 820 } catch (RemoteException e) { 821 throw e.rethrowFromSystemServer(); 822 } 823 } 824 getTransformCapabilities()825 int getTransformCapabilities() { 826 try { 827 return mCdm.getTransformCapabilities(); 828 } catch (RemoteException e) { 829 throw e.rethrowFromSystemServer(); 830 } 831 } 832 } 833 } 834