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