1 /*
2  * Copyright (C) 2006 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 #pragma once
18 
19 #include <stdint.h>
20 #include <sys/types.h>
21 
22 #include <binder/IBinder.h>
23 #include <binder/IInterface.h>
24 
25 #include <gui/ITransactionCompletedListener.h>
26 
27 #include <math/vec4.h>
28 
29 #include <ui/ConfigStoreTypes.h>
30 #include <ui/DisplayedFrameStats.h>
31 #include <ui/FrameStats.h>
32 #include <ui/GraphicBuffer.h>
33 #include <ui/GraphicTypes.h>
34 #include <ui/PhysicalDisplayId.h>
35 #include <ui/PixelFormat.h>
36 #include <ui/Rotation.h>
37 
38 #include <utils/Errors.h>
39 #include <utils/RefBase.h>
40 #include <utils/Timers.h>
41 #include <utils/Vector.h>
42 
43 #include <optional>
44 #include <unordered_set>
45 #include <vector>
46 
47 namespace android {
48 
49 struct client_cache_t;
50 struct ComposerState;
51 struct DisplayConfig;
52 struct DisplayInfo;
53 struct DisplayStatInfo;
54 struct DisplayState;
55 struct InputWindowCommands;
56 class LayerDebugInfo;
57 class HdrCapabilities;
58 class IDisplayEventConnection;
59 class IGraphicBufferProducer;
60 class ISurfaceComposerClient;
61 class IRegionSamplingListener;
62 class Rect;
63 enum class FrameEvent;
64 
65 namespace ui {
66 
67 struct DisplayState;
68 
69 } // namespace ui
70 
71 /*
72  * This class defines the Binder IPC interface for accessing various
73  * SurfaceFlinger features.
74  */
75 class ISurfaceComposer: public IInterface {
76 public:
77     DECLARE_META_INTERFACE(SurfaceComposer)
78 
79     static constexpr size_t MAX_LAYERS = 4096;
80 
81     // flags for setTransactionState()
82     enum {
83         eSynchronous = 0x01,
84         eAnimation = 0x02,
85 
86         // DEPRECATED - use eExplicitEarlyWakeup[Start|End]
87         eEarlyWakeup = 0x04,
88 
89         // Explicit indication that this transaction and others to follow will likely result in a
90         // lot of layers being composed, and thus, SurfaceFlinger should wake-up earlier to avoid
91         // missing frame deadlines. In this case SurfaceFlinger will wake up at
92         // (sf vsync offset - debug.sf.early_phase_offset_ns). SurfaceFlinger will continue to be
93         // in the early configuration until it receives eExplicitEarlyWakeupEnd. These flags are
94         // expected to be used by WindowManager only and are guarded by
95         // android.permission.ACCESS_SURFACE_FLINGER
96         eExplicitEarlyWakeupStart = 0x08,
97         eExplicitEarlyWakeupEnd = 0x10,
98     };
99 
100     enum VsyncSource {
101         eVsyncSourceApp = 0,
102         eVsyncSourceSurfaceFlinger = 1
103     };
104 
105     enum ConfigChanged { eConfigChangedSuppress = 0, eConfigChangedDispatch = 1 };
106 
107     /*
108      * Create a connection with SurfaceFlinger.
109      */
110     virtual sp<ISurfaceComposerClient> createConnection() = 0;
111 
112     /* return an IDisplayEventConnection */
113     virtual sp<IDisplayEventConnection> createDisplayEventConnection(
114             VsyncSource vsyncSource = eVsyncSourceApp,
115             ConfigChanged configChanged = eConfigChangedSuppress) = 0;
116 
117     /* create a virtual display
118      * requires ACCESS_SURFACE_FLINGER permission.
119      */
120     virtual sp<IBinder> createDisplay(const String8& displayName,
121             bool secure) = 0;
122 
123     /* destroy a virtual display
124      * requires ACCESS_SURFACE_FLINGER permission.
125      */
126     virtual void destroyDisplay(const sp<IBinder>& display) = 0;
127 
128     /* get stable IDs for connected physical displays.
129      */
130     virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0;
131 
132     // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic.
getInternalDisplayId()133     std::optional<PhysicalDisplayId> getInternalDisplayId() const {
134         const auto displayIds = getPhysicalDisplayIds();
135         return displayIds.empty() ? std::nullopt : std::make_optional(displayIds.front());
136     }
137 
138     /* get token for a physical display given its stable ID obtained via getPhysicalDisplayIds or a
139      * DisplayEventReceiver hotplug event.
140      */
141     virtual sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const = 0;
142 
143     // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic.
getInternalDisplayToken()144     sp<IBinder> getInternalDisplayToken() const {
145         const auto displayId = getInternalDisplayId();
146         return displayId ? getPhysicalDisplayToken(*displayId) : nullptr;
147     }
148 
149     /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
150     virtual void setTransactionState(const Vector<ComposerState>& state,
151                                      const Vector<DisplayState>& displays, uint32_t flags,
152                                      const sp<IBinder>& applyToken,
153                                      const InputWindowCommands& inputWindowCommands,
154                                      int64_t desiredPresentTime,
155                                      const client_cache_t& uncacheBuffer, bool hasListenerCallbacks,
156                                      const std::vector<ListenerCallbacks>& listenerCallbacks) = 0;
157 
158     /* signal that we're done booting.
159      * Requires ACCESS_SURFACE_FLINGER permission
160      */
161     virtual void bootFinished() = 0;
162 
163     /* verify that an IGraphicBufferProducer was created by SurfaceFlinger.
164      */
165     virtual bool authenticateSurfaceTexture(
166             const sp<IGraphicBufferProducer>& surface) const = 0;
167 
168     /* Returns the frame timestamps supported by SurfaceFlinger.
169      */
170     virtual status_t getSupportedFrameTimestamps(
171             std::vector<FrameEvent>* outSupported) const = 0;
172 
173     /* set display power mode. depending on the mode, it can either trigger
174      * screen on, off or low power mode and wait for it to complete.
175      * requires ACCESS_SURFACE_FLINGER permission.
176      */
177     virtual void setPowerMode(const sp<IBinder>& display, int mode) = 0;
178 
179 
180     /* returns display statistics for a given display
181      * intended to be used by the media framework to properly schedule
182      * video frames */
183     virtual status_t getDisplayStats(const sp<IBinder>& display,
184             DisplayStatInfo* stats) = 0;
185 
186     /**
187      * Get transactional state of given display.
188      */
189     virtual status_t getDisplayState(const sp<IBinder>& display, ui::DisplayState*) = 0;
190 
191     /**
192      * Get immutable information about given physical display.
193      */
194     virtual status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo*) = 0;
195 
196     /**
197      * Get configurations supported by given physical display.
198      */
199     virtual status_t getDisplayConfigs(const sp<IBinder>& display, Vector<DisplayConfig>*) = 0;
200 
201     /**
202      * Get the index into configurations returned by getDisplayConfigs,
203      * corresponding to the active configuration.
204      */
205     virtual int getActiveConfig(const sp<IBinder>& display) = 0;
206 
207     virtual status_t getDisplayColorModes(const sp<IBinder>& display,
208             Vector<ui::ColorMode>* outColorModes) = 0;
209     virtual status_t getDisplayNativePrimaries(const sp<IBinder>& display,
210             ui::DisplayPrimaries& primaries) = 0;
211     virtual ui::ColorMode getActiveColorMode(const sp<IBinder>& display) = 0;
212     virtual status_t setActiveColorMode(const sp<IBinder>& display,
213             ui::ColorMode colorMode) = 0;
214 
215     /**
216      * Returns true if the connected display reports support for HDMI 2.1 Auto
217      * Low Latency Mode.
218      * For more information, see the HDMI 2.1 specification.
219      */
220     virtual status_t getAutoLowLatencyModeSupport(const sp<IBinder>& display,
221                                                   bool* outSupport) const = 0;
222 
223     /**
224      * Switches Auto Low Latency Mode on/off on the connected display, if it is
225      * available. This should only be called if #getAutoLowLatencyMode returns
226      * true.
227      * For more information, see the HDMI 2.1 specification.
228      */
229     virtual void setAutoLowLatencyMode(const sp<IBinder>& display, bool on) = 0;
230 
231     /**
232      * Returns true if the connected display reports support for Game Content Type.
233      * For more information, see the HDMI 1.4 specification.
234      */
235     virtual status_t getGameContentTypeSupport(const sp<IBinder>& display,
236                                                bool* outSupport) const = 0;
237 
238     /**
239      * This will start sending infoframes to the connected display with
240      * ContentType=Game (if on=true). This will switch the disply to Game mode.
241      * This should only be called if #getGameContentTypeSupport returns true.
242      * For more information, see the HDMI 1.4 specification.
243      */
244     virtual void setGameContentType(const sp<IBinder>& display, bool on) = 0;
245 
246     /**
247      * Capture the specified screen. This requires READ_FRAME_BUFFER
248      * permission.  This function will fail if there is a secure window on
249      * screen.
250      *
251      * This function can capture a subregion (the source crop) of the screen.
252      * The subregion can be optionally rotated.  It will also be scaled to
253      * match the size of the output buffer.
254      *
255      * reqDataspace and reqPixelFormat specify the data space and pixel format
256      * of the buffer. The caller should pick the data space and pixel format
257      * that it can consume.
258      *
259      * sourceCrop is the crop on the logical display.
260      *
261      * reqWidth and reqHeight specifies the size of the buffer.  When either
262      * of them is 0, they are set to the size of the logical display viewport.
263      *
264      * When useIdentityTransform is true, layer transformations are disabled.
265      *
266      * rotation specifies the rotation of the source crop (and the pixels in
267      * it) around its center.
268      */
269     virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer,
270                                    bool& outCapturedSecureLayers, ui::Dataspace reqDataspace,
271                                    ui::PixelFormat reqPixelFormat, const Rect& sourceCrop,
272                                    uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform,
273                                    ui::Rotation rotation = ui::ROTATION_0,
274                                    bool captureSecureLayers = false) = 0;
275     /**
276      * Capture the specified screen. This requires READ_FRAME_BUFFER
277      * permission.  This function will fail if there is a secure window on
278      * screen.
279      *
280      * This function can capture a subregion (the source crop) of the screen
281      * into an sRGB buffer with RGBA_8888 pixel format.
282      * The subregion can be optionally rotated.  It will also be scaled to
283      * match the size of the output buffer.
284      *
285      * At the moment, sourceCrop is ignored and is always set to the visible
286      * region (projected display viewport) of the screen.
287      *
288      * reqWidth and reqHeight specifies the size of the buffer.  When either
289      * of them is 0, they are set to the size of the logical display viewport.
290      *
291      * When useIdentityTransform is true, layer transformations are disabled.
292      *
293      * rotation specifies the rotation of the source crop (and the pixels in
294      * it) around its center.
295      */
296     virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer,
297                                    const Rect& sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
298                                    bool useIdentityTransform,
299                                    ui::Rotation rotation = ui::ROTATION_0) {
300         bool outIgnored;
301         return captureScreen(display, outBuffer, outIgnored, ui::Dataspace::V0_SRGB,
302                              ui::PixelFormat::RGBA_8888, sourceCrop, reqWidth, reqHeight,
303                              useIdentityTransform, rotation);
304     }
305 
306     virtual status_t captureScreen(uint64_t displayOrLayerStack, ui::Dataspace* outDataspace,
307                                    sp<GraphicBuffer>* outBuffer) = 0;
308 
309     template <class AA>
310     struct SpHash {
operatorSpHash311         size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); }
312     };
313 
314     /**
315      * Capture a subtree of the layer hierarchy, potentially ignoring the root node.
316      *
317      * reqDataspace and reqPixelFormat specify the data space and pixel format
318      * of the buffer. The caller should pick the data space and pixel format
319      * that it can consume.
320      */
321     virtual status_t captureLayers(
322             const sp<IBinder>& layerHandleBinder, sp<GraphicBuffer>* outBuffer,
323             ui::Dataspace reqDataspace, ui::PixelFormat reqPixelFormat, const Rect& sourceCrop,
324             const std::unordered_set<sp<IBinder>, SpHash<IBinder>>& excludeHandles,
325             float frameScale = 1.0, bool childrenOnly = false) = 0;
326 
327     /**
328      * Capture a subtree of the layer hierarchy into an sRGB buffer with RGBA_8888 pixel format,
329      * potentially ignoring the root node.
330      */
331     status_t captureLayers(const sp<IBinder>& layerHandleBinder, sp<GraphicBuffer>* outBuffer,
332                            const Rect& sourceCrop, float frameScale = 1.0,
333                            bool childrenOnly = false) {
334         return captureLayers(layerHandleBinder, outBuffer, ui::Dataspace::V0_SRGB,
335                              ui::PixelFormat::RGBA_8888, sourceCrop, {}, frameScale, childrenOnly);
336     }
337 
338     /* Clears the frame statistics for animations.
339      *
340      * Requires the ACCESS_SURFACE_FLINGER permission.
341      */
342     virtual status_t clearAnimationFrameStats() = 0;
343 
344     /* Gets the frame statistics for animations.
345      *
346      * Requires the ACCESS_SURFACE_FLINGER permission.
347      */
348     virtual status_t getAnimationFrameStats(FrameStats* outStats) const = 0;
349 
350     /* Gets the supported HDR capabilities of the given display.
351      *
352      * Requires the ACCESS_SURFACE_FLINGER permission.
353      */
354     virtual status_t getHdrCapabilities(const sp<IBinder>& display,
355             HdrCapabilities* outCapabilities) const = 0;
356 
357     virtual status_t enableVSyncInjections(bool enable) = 0;
358 
359     virtual status_t injectVSync(nsecs_t when) = 0;
360 
361     /* Gets the list of active layers in Z order for debugging purposes
362      *
363      * Requires the ACCESS_SURFACE_FLINGER permission.
364      */
365     virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) = 0;
366 
367     virtual status_t getColorManagement(bool* outGetColorManagement) const = 0;
368 
369     /* Gets the composition preference of the default data space and default pixel format,
370      * as well as the wide color gamut data space and wide color gamut pixel format.
371      * If the wide color gamut data space is V0_SRGB, then it implies that the platform
372      * has no wide color gamut support.
373      *
374      * Requires the ACCESS_SURFACE_FLINGER permission.
375      */
376     virtual status_t getCompositionPreference(ui::Dataspace* defaultDataspace,
377                                               ui::PixelFormat* defaultPixelFormat,
378                                               ui::Dataspace* wideColorGamutDataspace,
379                                               ui::PixelFormat* wideColorGamutPixelFormat) const = 0;
380     /*
381      * Requires the ACCESS_SURFACE_FLINGER permission.
382      */
383     virtual status_t getDisplayedContentSamplingAttributes(const sp<IBinder>& display,
384                                                            ui::PixelFormat* outFormat,
385                                                            ui::Dataspace* outDataspace,
386                                                            uint8_t* outComponentMask) const = 0;
387 
388     /* Turns on the color sampling engine on the display.
389      *
390      * Requires the ACCESS_SURFACE_FLINGER permission.
391      */
392     virtual status_t setDisplayContentSamplingEnabled(const sp<IBinder>& display, bool enable,
393                                                       uint8_t componentMask,
394                                                       uint64_t maxFrames) = 0;
395 
396     /* Returns statistics on the color profile of the last frame displayed for a given display
397      *
398      * Requires the ACCESS_SURFACE_FLINGER permission.
399      */
400     virtual status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames,
401                                                uint64_t timestamp,
402                                                DisplayedFrameStats* outStats) const = 0;
403 
404     /*
405      * Gets whether SurfaceFlinger can support protected content in GPU composition.
406      * Requires the ACCESS_SURFACE_FLINGER permission.
407      */
408     virtual status_t getProtectedContentSupport(bool* outSupported) const = 0;
409 
410     /*
411      * Queries whether the given display is a wide color display.
412      * Requires the ACCESS_SURFACE_FLINGER permission.
413      */
414     virtual status_t isWideColorDisplay(const sp<IBinder>& token,
415                                         bool* outIsWideColorDisplay) const = 0;
416 
417     /* Registers a listener to stream median luma updates from SurfaceFlinger.
418      *
419      * The sampling area is bounded by both samplingArea and the given stopLayerHandle
420      * (i.e., only layers behind the stop layer will be captured and sampled).
421      *
422      * Multiple listeners may be provided so long as they have independent listeners.
423      * If multiple listeners are provided, the effective sampling region for each listener will
424      * be bounded by whichever stop layer has a lower Z value.
425      *
426      * Requires the same permissions as captureLayers and captureScreen.
427      */
428     virtual status_t addRegionSamplingListener(const Rect& samplingArea,
429                                                const sp<IBinder>& stopLayerHandle,
430                                                const sp<IRegionSamplingListener>& listener) = 0;
431 
432     /*
433      * Removes a listener that was streaming median luma updates from SurfaceFlinger.
434      */
435     virtual status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener) = 0;
436 
437     /* Sets the refresh rate boundaries for the display.
438      *
439      * The primary refresh rate range represents display manager's general guidance on the display
440      * configs we'll consider when switching refresh rates. Unless we get an explicit signal from an
441      * app, we should stay within this range.
442      *
443      * The app request refresh rate range allows us to consider more display configs when switching
444      * refresh rates. Although we should generally stay within the primary range, specific
445      * considerations, such as layer frame rate settings specified via the setFrameRate() api, may
446      * cause us to go outside the primary range. We never go outside the app request range. The app
447      * request range will be greater than or equal to the primary refresh rate range, never smaller.
448      *
449      * defaultConfig is used to narrow the list of display configs SurfaceFlinger will consider
450      * switching between. Only configs with a config group and resolution matching defaultConfig
451      * will be considered for switching. The defaultConfig index corresponds to the list of configs
452      * returned from getDisplayConfigs().
453      */
454     virtual status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
455                                                   int32_t defaultConfig,
456                                                   float primaryRefreshRateMin,
457                                                   float primaryRefreshRateMax,
458                                                   float appRequestRefreshRateMin,
459                                                   float appRequestRefreshRateMax) = 0;
460 
461     virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
462                                                   int32_t* outDefaultConfig,
463                                                   float* outPrimaryRefreshRateMin,
464                                                   float* outPrimaryRefreshRateMax,
465                                                   float* outAppRequestRefreshRateMin,
466                                                   float* outAppRequestRefreshRateMax) = 0;
467     /*
468      * Gets whether brightness operations are supported on a display.
469      *
470      * displayToken
471      *      The token of the display.
472      * outSupport
473      *      An output parameter for whether brightness operations are supported.
474      *
475      * Returns NO_ERROR upon success. Otherwise,
476      *      NAME_NOT_FOUND if the display is invalid, or
477      *      BAD_VALUE      if the output parameter is invalid.
478      */
479     virtual status_t getDisplayBrightnessSupport(const sp<IBinder>& displayToken,
480                                                  bool* outSupport) const = 0;
481 
482     /*
483      * Sets the brightness of a display.
484      *
485      * displayToken
486      *      The token of the display whose brightness is set.
487      * brightness
488      *      A number between 0.0f (minimum brightness) and 1.0 (maximum brightness), or -1.0f to
489      *      turn the backlight off.
490      *
491      * Returns NO_ERROR upon success. Otherwise,
492      *      NAME_NOT_FOUND    if the display is invalid, or
493      *      BAD_VALUE         if the brightness is invalid, or
494      *      INVALID_OPERATION if brightness operations are not supported.
495      */
496     virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) = 0;
497 
498     /*
499      * Sends a power hint to the composer. This function is asynchronous.
500      *
501      * hintId
502      *      hint id according to android::hardware::power::V1_0::PowerHint
503      *
504      * Returns NO_ERROR upon success.
505      */
506     virtual status_t notifyPowerHint(int32_t hintId) = 0;
507 
508     /*
509      * Sets the global configuration for all the shadows drawn by SurfaceFlinger. Shadow follows
510      * material design guidelines.
511      *
512      * ambientColor
513      *      Color to the ambient shadow. The alpha is premultiplied.
514      *
515      * spotColor
516      *      Color to the spot shadow. The alpha is premultiplied. The position of the spot shadow
517      *      depends on the light position.
518      *
519      * lightPosY/lightPosZ
520      *      Position of the light used to cast the spot shadow. The X value is always the display
521      *      width / 2.
522      *
523      * lightRadius
524      *      Radius of the light casting the shadow.
525      */
526     virtual status_t setGlobalShadowSettings(const half4& ambientColor, const half4& spotColor,
527                                              float lightPosY, float lightPosZ,
528                                              float lightRadius) = 0;
529 
530     /*
531      * Sets the intended frame rate for a surface. See ANativeWindow_setFrameRate() for more info.
532      */
533     virtual status_t setFrameRate(const sp<IGraphicBufferProducer>& surface, float frameRate,
534                                   int8_t compatibility) = 0;
535 
536     /*
537      * Acquire a frame rate flexibility token from SurfaceFlinger. While this token is acquired,
538      * surface flinger will freely switch between frame rates in any way it sees fit, regardless of
539      * the current restrictions applied by DisplayManager. This is useful to get consistent behavior
540      * for tests. Release the token by releasing the returned IBinder reference.
541      */
542     virtual status_t acquireFrameRateFlexibilityToken(sp<IBinder>* outToken) = 0;
543 };
544 
545 // ----------------------------------------------------------------------------
546 
547 class BnSurfaceComposer: public BnInterface<ISurfaceComposer> {
548 public:
549     enum ISurfaceComposerTag {
550         // Note: BOOT_FINISHED must remain this value, it is called from
551         // Java by ActivityManagerService.
552         BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
553         CREATE_CONNECTION,
554         GET_DISPLAY_INFO,
555         CREATE_DISPLAY_EVENT_CONNECTION,
556         CREATE_DISPLAY,
557         DESTROY_DISPLAY,
558         GET_PHYSICAL_DISPLAY_TOKEN,
559         SET_TRANSACTION_STATE,
560         AUTHENTICATE_SURFACE,
561         GET_SUPPORTED_FRAME_TIMESTAMPS,
562         GET_DISPLAY_CONFIGS,
563         GET_ACTIVE_CONFIG,
564         GET_DISPLAY_STATE,
565         CAPTURE_SCREEN,
566         CAPTURE_LAYERS,
567         CLEAR_ANIMATION_FRAME_STATS,
568         GET_ANIMATION_FRAME_STATS,
569         SET_POWER_MODE,
570         GET_DISPLAY_STATS,
571         GET_HDR_CAPABILITIES,
572         GET_DISPLAY_COLOR_MODES,
573         GET_ACTIVE_COLOR_MODE,
574         SET_ACTIVE_COLOR_MODE,
575         ENABLE_VSYNC_INJECTIONS,
576         INJECT_VSYNC,
577         GET_LAYER_DEBUG_INFO,
578         GET_COMPOSITION_PREFERENCE,
579         GET_COLOR_MANAGEMENT,
580         GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
581         SET_DISPLAY_CONTENT_SAMPLING_ENABLED,
582         GET_DISPLAYED_CONTENT_SAMPLE,
583         GET_PROTECTED_CONTENT_SUPPORT,
584         IS_WIDE_COLOR_DISPLAY,
585         GET_DISPLAY_NATIVE_PRIMARIES,
586         GET_PHYSICAL_DISPLAY_IDS,
587         ADD_REGION_SAMPLING_LISTENER,
588         REMOVE_REGION_SAMPLING_LISTENER,
589         SET_DESIRED_DISPLAY_CONFIG_SPECS,
590         GET_DESIRED_DISPLAY_CONFIG_SPECS,
591         GET_DISPLAY_BRIGHTNESS_SUPPORT,
592         SET_DISPLAY_BRIGHTNESS,
593         CAPTURE_SCREEN_BY_ID,
594         NOTIFY_POWER_HINT,
595         SET_GLOBAL_SHADOW_SETTINGS,
596         GET_AUTO_LOW_LATENCY_MODE_SUPPORT,
597         SET_AUTO_LOW_LATENCY_MODE,
598         GET_GAME_CONTENT_TYPE_SUPPORT,
599         SET_GAME_CONTENT_TYPE,
600         SET_FRAME_RATE,
601         ACQUIRE_FRAME_RATE_FLEXIBILITY_TOKEN,
602         // Always append new enum to the end.
603     };
604 
605     virtual status_t onTransact(uint32_t code, const Parcel& data,
606             Parcel* reply, uint32_t flags = 0);
607 };
608 
609 } // namespace android
610