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 <android/gui/DisplayBrightness.h>
20 #include <android/gui/IFpsListener.h>
21 #include <android/gui/IHdrLayerInfoListener.h>
22 #include <android/gui/IScreenCaptureListener.h>
23 #include <android/gui/ITransactionTraceListener.h>
24 #include <android/gui/ITunnelModeEnabledListener.h>
25 #include <android/gui/IWindowInfosListener.h>
26 #include <binder/IBinder.h>
27 #include <binder/IInterface.h>
28 #include <ftl/Flags.h>
29 #include <gui/FrameTimelineInfo.h>
30 #include <gui/ITransactionCompletedListener.h>
31 #include <math/vec4.h>
32 #include <stdint.h>
33 #include <sys/types.h>
34 #include <ui/ConfigStoreTypes.h>
35 #include <ui/DisplayId.h>
36 #include <ui/DisplayMode.h>
37 #include <ui/DisplayedFrameStats.h>
38 #include <ui/FrameStats.h>
39 #include <ui/GraphicBuffer.h>
40 #include <ui/GraphicTypes.h>
41 #include <ui/PixelFormat.h>
42 #include <ui/Rotation.h>
43 #include <utils/Errors.h>
44 #include <utils/RefBase.h>
45 #include <utils/Timers.h>
46 #include <utils/Vector.h>
47 
48 #include <optional>
49 #include <unordered_set>
50 #include <vector>
51 
52 namespace android {
53 
54 struct client_cache_t;
55 struct ComposerState;
56 struct DisplayCaptureArgs;
57 struct DisplayStatInfo;
58 struct DisplayState;
59 struct InputWindowCommands;
60 struct LayerCaptureArgs;
61 class LayerDebugInfo;
62 class HdrCapabilities;
63 class IDisplayEventConnection;
64 class IGraphicBufferProducer;
65 class ISurfaceComposerClient;
66 class IRegionSamplingListener;
67 class Rect;
68 enum class FrameEvent;
69 
70 using gui::IScreenCaptureListener;
71 
72 namespace ui {
73 
74 struct DisplayMode;
75 struct DisplayState;
76 struct DynamicDisplayInfo;
77 struct StaticDisplayInfo;
78 
79 } // namespace ui
80 
81 /*
82  * This class defines the Binder IPC interface for accessing various
83  * SurfaceFlinger features.
84  */
85 class ISurfaceComposer: public IInterface {
86 public:
87     DECLARE_META_INTERFACE(SurfaceComposer)
88 
89     static constexpr size_t MAX_LAYERS = 4096;
90 
91     // flags for setTransactionState()
92     enum {
93         eSynchronous = 0x01,
94         eAnimation = 0x02,
95 
96         // Explicit indication that this transaction and others to follow will likely result in a
97         // lot of layers being composed, and thus, SurfaceFlinger should wake-up earlier to avoid
98         // missing frame deadlines. In this case SurfaceFlinger will wake up at
99         // (sf vsync offset - debug.sf.early_phase_offset_ns). SurfaceFlinger will continue to be
100         // in the early configuration until it receives eEarlyWakeupEnd. These flags are
101         // expected to be used by WindowManager only and are guarded by
102         // android.permission.ACCESS_SURFACE_FLINGER
103         eEarlyWakeupStart = 0x08,
104         eEarlyWakeupEnd = 0x10,
105     };
106 
107     enum VsyncSource {
108         eVsyncSourceApp = 0,
109         eVsyncSourceSurfaceFlinger = 1
110     };
111 
112     enum class EventRegistration {
113         modeChanged = 1 << 0,
114         frameRateOverride = 1 << 1,
115     };
116 
117     using EventRegistrationFlags = Flags<EventRegistration>;
118 
119     /*
120      * Create a connection with SurfaceFlinger.
121      */
122     virtual sp<ISurfaceComposerClient> createConnection() = 0;
123 
124     /* return an IDisplayEventConnection */
125     virtual sp<IDisplayEventConnection> createDisplayEventConnection(
126             VsyncSource vsyncSource = eVsyncSourceApp,
127             EventRegistrationFlags eventRegistration = {}) = 0;
128 
129     /* create a virtual display
130      * requires ACCESS_SURFACE_FLINGER permission.
131      */
132     virtual sp<IBinder> createDisplay(const String8& displayName,
133             bool secure) = 0;
134 
135     /* destroy a virtual display
136      * requires ACCESS_SURFACE_FLINGER permission.
137      */
138     virtual void destroyDisplay(const sp<IBinder>& display) = 0;
139 
140     /* get stable IDs for connected physical displays.
141      */
142     virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const = 0;
143 
144     virtual status_t getPrimaryPhysicalDisplayId(PhysicalDisplayId*) const = 0;
145 
146     // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic.
getInternalDisplayId()147     std::optional<PhysicalDisplayId> getInternalDisplayId() const {
148         const auto displayIds = getPhysicalDisplayIds();
149         return displayIds.empty() ? std::nullopt : std::make_optional(displayIds.front());
150     }
151 
152     /* get token for a physical display given its stable ID obtained via getPhysicalDisplayIds or a
153      * DisplayEventReceiver hotplug event.
154      */
155     virtual sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const = 0;
156 
157     // TODO(b/74619554): Remove this stopgap once the framework is display-agnostic.
getInternalDisplayToken()158     sp<IBinder> getInternalDisplayToken() const {
159         const auto displayId = getInternalDisplayId();
160         return displayId ? getPhysicalDisplayToken(*displayId) : nullptr;
161     }
162 
163     /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
164     virtual status_t setTransactionState(
165             const FrameTimelineInfo& frameTimelineInfo, const Vector<ComposerState>& state,
166             const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
167             const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime,
168             bool isAutoTimestamp, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks,
169             const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) = 0;
170 
171     /* signal that we're done booting.
172      * Requires ACCESS_SURFACE_FLINGER permission
173      */
174     virtual void bootFinished() = 0;
175 
176     /* verify that an IGraphicBufferProducer was created by SurfaceFlinger.
177      */
178     virtual bool authenticateSurfaceTexture(
179             const sp<IGraphicBufferProducer>& surface) const = 0;
180 
181     /* Returns the frame timestamps supported by SurfaceFlinger.
182      */
183     virtual status_t getSupportedFrameTimestamps(
184             std::vector<FrameEvent>* outSupported) const = 0;
185 
186     /* set display power mode. depending on the mode, it can either trigger
187      * screen on, off or low power mode and wait for it to complete.
188      * requires ACCESS_SURFACE_FLINGER permission.
189      */
190     virtual void setPowerMode(const sp<IBinder>& display, int mode) = 0;
191 
192 
193     /* returns display statistics for a given display
194      * intended to be used by the media framework to properly schedule
195      * video frames */
196     virtual status_t getDisplayStats(const sp<IBinder>& display,
197             DisplayStatInfo* stats) = 0;
198 
199     /**
200      * Get transactional state of given display.
201      */
202     virtual status_t getDisplayState(const sp<IBinder>& display, ui::DisplayState*) = 0;
203 
204     /**
205      * Gets immutable information about given physical display.
206      */
207     virtual status_t getStaticDisplayInfo(const sp<IBinder>& display, ui::StaticDisplayInfo*) = 0;
208 
209     /**
210      * Gets dynamic information about given physical display.
211      */
212     virtual status_t getDynamicDisplayInfo(const sp<IBinder>& display, ui::DynamicDisplayInfo*) = 0;
213 
214     virtual status_t getDisplayNativePrimaries(const sp<IBinder>& display,
215             ui::DisplayPrimaries& primaries) = 0;
216     virtual status_t setActiveColorMode(const sp<IBinder>& display,
217             ui::ColorMode colorMode) = 0;
218 
219     /**
220      * Switches Auto Low Latency Mode on/off on the connected display, if it is
221      * available. This should only be called if the display supports Auto Low
222      * Latency Mode as reported in #getDynamicDisplayInfo.
223      * For more information, see the HDMI 2.1 specification.
224      */
225     virtual void setAutoLowLatencyMode(const sp<IBinder>& display, bool on) = 0;
226 
227     /**
228      * This will start sending infoframes to the connected display with
229      * ContentType=Game (if on=true). This should only be called if the display
230      * Game Content Type as reported in #getDynamicDisplayInfo.
231      * For more information, see the HDMI 1.4 specification.
232      */
233     virtual void setGameContentType(const sp<IBinder>& display, bool on) = 0;
234 
235     /**
236      * Capture the specified screen. This requires READ_FRAME_BUFFER
237      * permission.  This function will fail if there is a secure window on
238      * screen and DisplayCaptureArgs.captureSecureLayers is false.
239      *
240      * This function can capture a subregion (the source crop) of the screen.
241      * The subregion can be optionally rotated.  It will also be scaled to
242      * match the size of the output buffer.
243      */
244     virtual status_t captureDisplay(const DisplayCaptureArgs& args,
245                                     const sp<IScreenCaptureListener>& captureListener) = 0;
246 
247     virtual status_t captureDisplay(uint64_t displayOrLayerStack,
248                                     const sp<IScreenCaptureListener>& captureListener) = 0;
249 
250     template <class AA>
251     struct SpHash {
operatorSpHash252         size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); }
253     };
254 
255     /**
256      * Capture a subtree of the layer hierarchy, potentially ignoring the root node.
257      * This requires READ_FRAME_BUFFER permission. This function will fail if there
258      * is a secure window on screen
259      */
260     virtual status_t captureLayers(const LayerCaptureArgs& args,
261                                    const sp<IScreenCaptureListener>& captureListener) = 0;
262 
263     /* Clears the frame statistics for animations.
264      *
265      * Requires the ACCESS_SURFACE_FLINGER permission.
266      */
267     virtual status_t clearAnimationFrameStats() = 0;
268 
269     /* Gets the frame statistics for animations.
270      *
271      * Requires the ACCESS_SURFACE_FLINGER permission.
272      */
273     virtual status_t getAnimationFrameStats(FrameStats* outStats) const = 0;
274 
275     /* Overrides the supported HDR modes for the given display device.
276      *
277      * Requires the ACCESS_SURFACE_FLINGER permission.
278      */
279     virtual status_t overrideHdrTypes(const sp<IBinder>& display,
280                                       const std::vector<ui::Hdr>& hdrTypes) = 0;
281 
282     /* Pulls surfaceflinger atoms global stats and layer stats to pipe to statsd.
283      *
284      * Requires the calling uid be from system server.
285      */
286     virtual status_t onPullAtom(const int32_t atomId, std::string* outData, bool* success) = 0;
287 
288     virtual status_t enableVSyncInjections(bool enable) = 0;
289 
290     virtual status_t injectVSync(nsecs_t when) = 0;
291 
292     /* Gets the list of active layers in Z order for debugging purposes
293      *
294      * Requires the ACCESS_SURFACE_FLINGER permission.
295      */
296     virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) = 0;
297 
298     virtual status_t getColorManagement(bool* outGetColorManagement) const = 0;
299 
300     /* Gets the composition preference of the default data space and default pixel format,
301      * as well as the wide color gamut data space and wide color gamut pixel format.
302      * If the wide color gamut data space is V0_SRGB, then it implies that the platform
303      * has no wide color gamut support.
304      *
305      * Requires the ACCESS_SURFACE_FLINGER permission.
306      */
307     virtual status_t getCompositionPreference(ui::Dataspace* defaultDataspace,
308                                               ui::PixelFormat* defaultPixelFormat,
309                                               ui::Dataspace* wideColorGamutDataspace,
310                                               ui::PixelFormat* wideColorGamutPixelFormat) const = 0;
311     /*
312      * Requires the ACCESS_SURFACE_FLINGER permission.
313      */
314     virtual status_t getDisplayedContentSamplingAttributes(const sp<IBinder>& display,
315                                                            ui::PixelFormat* outFormat,
316                                                            ui::Dataspace* outDataspace,
317                                                            uint8_t* outComponentMask) const = 0;
318 
319     /* Turns on the color sampling engine on the display.
320      *
321      * Requires the ACCESS_SURFACE_FLINGER permission.
322      */
323     virtual status_t setDisplayContentSamplingEnabled(const sp<IBinder>& display, bool enable,
324                                                       uint8_t componentMask,
325                                                       uint64_t maxFrames) = 0;
326 
327     /* Returns statistics on the color profile of the last frame displayed for a given display
328      *
329      * Requires the ACCESS_SURFACE_FLINGER permission.
330      */
331     virtual status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames,
332                                                uint64_t timestamp,
333                                                DisplayedFrameStats* outStats) const = 0;
334 
335     /*
336      * Gets whether SurfaceFlinger can support protected content in GPU composition.
337      * Requires the ACCESS_SURFACE_FLINGER permission.
338      */
339     virtual status_t getProtectedContentSupport(bool* outSupported) const = 0;
340 
341     /*
342      * Queries whether the given display is a wide color display.
343      * Requires the ACCESS_SURFACE_FLINGER permission.
344      */
345     virtual status_t isWideColorDisplay(const sp<IBinder>& token,
346                                         bool* outIsWideColorDisplay) const = 0;
347 
348     /* Registers a listener to stream median luma updates from SurfaceFlinger.
349      *
350      * The sampling area is bounded by both samplingArea and the given stopLayerHandle
351      * (i.e., only layers behind the stop layer will be captured and sampled).
352      *
353      * Multiple listeners may be provided so long as they have independent listeners.
354      * If multiple listeners are provided, the effective sampling region for each listener will
355      * be bounded by whichever stop layer has a lower Z value.
356      *
357      * Requires the same permissions as captureLayers and captureScreen.
358      */
359     virtual status_t addRegionSamplingListener(const Rect& samplingArea,
360                                                const sp<IBinder>& stopLayerHandle,
361                                                const sp<IRegionSamplingListener>& listener) = 0;
362 
363     /*
364      * Removes a listener that was streaming median luma updates from SurfaceFlinger.
365      */
366     virtual status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener) = 0;
367 
368     /* Registers a listener that streams fps updates from SurfaceFlinger.
369      *
370      * The listener will stream fps updates for the layer tree rooted at the layer denoted by the
371      * task ID, i.e., the layer must have the task ID as part of its layer metadata with key
372      * METADATA_TASK_ID. If there is no such layer, then no fps is expected to be reported.
373      *
374      * Multiple listeners may be supported.
375      *
376      * Requires the READ_FRAME_BUFFER permission.
377      */
378     virtual status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener) = 0;
379     /*
380      * Removes a listener that was streaming fps updates from SurfaceFlinger.
381      */
382     virtual status_t removeFpsListener(const sp<gui::IFpsListener>& listener) = 0;
383 
384     /* Registers a listener to receive tunnel mode enabled updates from SurfaceFlinger.
385      *
386      * Requires ACCESS_SURFACE_FLINGER permission.
387      */
388     virtual status_t addTunnelModeEnabledListener(
389             const sp<gui::ITunnelModeEnabledListener>& listener) = 0;
390 
391     /*
392      * Removes a listener that was receiving tunnel mode enabled updates from SurfaceFlinger.
393      *
394      * Requires ACCESS_SURFACE_FLINGER permission.
395      */
396     virtual status_t removeTunnelModeEnabledListener(
397             const sp<gui::ITunnelModeEnabledListener>& listener) = 0;
398 
399     /* Sets the refresh rate boundaries for the display.
400      *
401      * The primary refresh rate range represents display manager's general guidance on the display
402      * modes we'll consider when switching refresh rates. Unless we get an explicit signal from an
403      * app, we should stay within this range.
404      *
405      * The app request refresh rate range allows us to consider more display modes when switching
406      * refresh rates. Although we should generally stay within the primary range, specific
407      * considerations, such as layer frame rate settings specified via the setFrameRate() api, may
408      * cause us to go outside the primary range. We never go outside the app request range. The app
409      * request range will be greater than or equal to the primary refresh rate range, never smaller.
410      *
411      * defaultMode is used to narrow the list of display modes SurfaceFlinger will consider
412      * switching between. Only modes with a mode group and resolution matching defaultMode
413      * will be considered for switching. The defaultMode corresponds to an ID of mode in the list
414      * of supported modes returned from getDynamicDisplayInfo().
415      */
416     virtual status_t setDesiredDisplayModeSpecs(
417             const sp<IBinder>& displayToken, ui::DisplayModeId defaultMode,
418             bool allowGroupSwitching, float primaryRefreshRateMin, float primaryRefreshRateMax,
419             float appRequestRefreshRateMin, float appRequestRefreshRateMax) = 0;
420 
421     virtual status_t getDesiredDisplayModeSpecs(const sp<IBinder>& displayToken,
422                                                 ui::DisplayModeId* outDefaultMode,
423                                                 bool* outAllowGroupSwitching,
424                                                 float* outPrimaryRefreshRateMin,
425                                                 float* outPrimaryRefreshRateMax,
426                                                 float* outAppRequestRefreshRateMin,
427                                                 float* outAppRequestRefreshRateMax) = 0;
428     /*
429      * Gets whether brightness operations are supported on a display.
430      *
431      * displayToken
432      *      The token of the display.
433      * outSupport
434      *      An output parameter for whether brightness operations are supported.
435      *
436      * Returns NO_ERROR upon success. Otherwise,
437      *      NAME_NOT_FOUND if the display is invalid, or
438      *      BAD_VALUE      if the output parameter is invalid.
439      */
440     virtual status_t getDisplayBrightnessSupport(const sp<IBinder>& displayToken,
441                                                  bool* outSupport) const = 0;
442 
443     /*
444      * Sets the brightness of a display.
445      *
446      * displayToken
447      *      The token of the display whose brightness is set.
448      * brightness
449      *      The DisplayBrightness info to set on the desired display.
450      *
451      * Returns NO_ERROR upon success. Otherwise,
452      *      NAME_NOT_FOUND    if the display is invalid, or
453      *      BAD_VALUE         if the brightness is invalid, or
454      *      INVALID_OPERATION if brightness operations are not supported.
455      */
456     virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken,
457                                           const gui::DisplayBrightness& brightness) = 0;
458 
459     /*
460      * Adds a listener that receives HDR layer information. This is used in combination
461      * with setDisplayBrightness to adjust the display brightness depending on factors such
462      * as whether or not HDR is in use.
463      *
464      * Returns NO_ERROR upon success or NAME_NOT_FOUND if the display is invalid.
465      */
466     virtual status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken,
467                                              const sp<gui::IHdrLayerInfoListener>& listener) = 0;
468     /*
469      * Removes a listener that was added with addHdrLayerInfoListener.
470      *
471      * Returns NO_ERROR upon success, NAME_NOT_FOUND if the display is invalid, and BAD_VALUE if
472      *     the listener wasn't registered.
473      *
474      */
475     virtual status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken,
476                                                 const sp<gui::IHdrLayerInfoListener>& listener) = 0;
477 
478     /*
479      * Sends a power boost to the composer. This function is asynchronous.
480      *
481      * boostId
482      *      boost id according to android::hardware::power::Boost
483      *
484      * Returns NO_ERROR upon success.
485      */
486     virtual status_t notifyPowerBoost(int32_t boostId) = 0;
487 
488     /*
489      * Sets the global configuration for all the shadows drawn by SurfaceFlinger. Shadow follows
490      * material design guidelines.
491      *
492      * ambientColor
493      *      Color to the ambient shadow. The alpha is premultiplied.
494      *
495      * spotColor
496      *      Color to the spot shadow. The alpha is premultiplied. The position of the spot shadow
497      *      depends on the light position.
498      *
499      * lightPosY/lightPosZ
500      *      Position of the light used to cast the spot shadow. The X value is always the display
501      *      width / 2.
502      *
503      * lightRadius
504      *      Radius of the light casting the shadow.
505      */
506     virtual status_t setGlobalShadowSettings(const half4& ambientColor, const half4& spotColor,
507                                              float lightPosY, float lightPosZ,
508                                              float lightRadius) = 0;
509 
510     /*
511      * Sets the intended frame rate for a surface. See ANativeWindow_setFrameRate() for more info.
512      */
513     virtual status_t setFrameRate(const sp<IGraphicBufferProducer>& surface, float frameRate,
514                                   int8_t compatibility, int8_t changeFrameRateStrategy) = 0;
515 
516     /*
517      * Acquire a frame rate flexibility token from SurfaceFlinger. While this token is acquired,
518      * surface flinger will freely switch between frame rates in any way it sees fit, regardless of
519      * the current restrictions applied by DisplayManager. This is useful to get consistent behavior
520      * for tests. Release the token by releasing the returned IBinder reference.
521      */
522     virtual status_t acquireFrameRateFlexibilityToken(sp<IBinder>* outToken) = 0;
523 
524     /*
525      * Sets the frame timeline vsync info received from choreographer that corresponds to next
526      * buffer submitted on that surface.
527      */
528     virtual status_t setFrameTimelineInfo(const sp<IGraphicBufferProducer>& surface,
529                                           const FrameTimelineInfo& frameTimelineInfo) = 0;
530 
531     /*
532      * Adds a TransactionTraceListener to listen for transaction tracing state updates.
533      */
534     virtual status_t addTransactionTraceListener(
535             const sp<gui::ITransactionTraceListener>& listener) = 0;
536 
537     /**
538      * Gets priority of the RenderEngine in SurfaceFlinger.
539      */
540     virtual int getGPUContextPriority() = 0;
541 
542     /**
543      * Gets the number of buffers SurfaceFlinger would need acquire. This number
544      * would be propagated to the client via MIN_UNDEQUEUED_BUFFERS so that the
545      * client could allocate enough buffers to match SF expectations of the
546      * pipeline depth. SurfaceFlinger will make sure that it will give the app at
547      * least the time configured as the 'appDuration' before trying to latch
548      * the buffer.
549      *
550      * The total buffers needed for a given configuration is basically the
551      * numbers of vsyncs a single buffer is used across the stack. For the default
552      * configuration a buffer is held ~1 vsync by the app, ~1 vsync by SurfaceFlinger
553      * and 1 vsync by the display. The extra buffers are calculated as the
554      * number of additional buffers on top of the 2 buffers already present
555      * in MIN_UNDEQUEUED_BUFFERS.
556      */
557     virtual status_t getMaxAcquiredBufferCount(int* buffers) const = 0;
558 
559     virtual status_t addWindowInfosListener(
560             const sp<gui::IWindowInfosListener>& windowInfosListener) const = 0;
561     virtual status_t removeWindowInfosListener(
562             const sp<gui::IWindowInfosListener>& windowInfosListener) const = 0;
563 };
564 
565 // ----------------------------------------------------------------------------
566 
567 class BnSurfaceComposer: public BnInterface<ISurfaceComposer> {
568 public:
569     enum ISurfaceComposerTag {
570         // Note: BOOT_FINISHED must remain this value, it is called from
571         // Java by ActivityManagerService.
572         BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
573         CREATE_CONNECTION,
574         GET_STATIC_DISPLAY_INFO,
575         CREATE_DISPLAY_EVENT_CONNECTION,
576         CREATE_DISPLAY,
577         DESTROY_DISPLAY,
578         GET_PHYSICAL_DISPLAY_TOKEN,
579         SET_TRANSACTION_STATE,
580         AUTHENTICATE_SURFACE,
581         GET_SUPPORTED_FRAME_TIMESTAMPS,
582         GET_DISPLAY_MODES,       // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
583         GET_ACTIVE_DISPLAY_MODE, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
584         GET_DISPLAY_STATE,
585         CAPTURE_DISPLAY,
586         CAPTURE_LAYERS,
587         CLEAR_ANIMATION_FRAME_STATS,
588         GET_ANIMATION_FRAME_STATS,
589         SET_POWER_MODE,
590         GET_DISPLAY_STATS,
591         GET_HDR_CAPABILITIES,    // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
592         GET_DISPLAY_COLOR_MODES, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
593         GET_ACTIVE_COLOR_MODE,   // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
594         SET_ACTIVE_COLOR_MODE,
595         ENABLE_VSYNC_INJECTIONS,
596         INJECT_VSYNC,
597         GET_LAYER_DEBUG_INFO,
598         GET_COMPOSITION_PREFERENCE,
599         GET_COLOR_MANAGEMENT,
600         GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
601         SET_DISPLAY_CONTENT_SAMPLING_ENABLED,
602         GET_DISPLAYED_CONTENT_SAMPLE,
603         GET_PROTECTED_CONTENT_SUPPORT,
604         IS_WIDE_COLOR_DISPLAY,
605         GET_DISPLAY_NATIVE_PRIMARIES,
606         GET_PHYSICAL_DISPLAY_IDS,
607         ADD_REGION_SAMPLING_LISTENER,
608         REMOVE_REGION_SAMPLING_LISTENER,
609         SET_DESIRED_DISPLAY_MODE_SPECS,
610         GET_DESIRED_DISPLAY_MODE_SPECS,
611         GET_DISPLAY_BRIGHTNESS_SUPPORT,
612         SET_DISPLAY_BRIGHTNESS,
613         CAPTURE_DISPLAY_BY_ID,
614         NOTIFY_POWER_BOOST,
615         SET_GLOBAL_SHADOW_SETTINGS,
616         GET_AUTO_LOW_LATENCY_MODE_SUPPORT, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
617         SET_AUTO_LOW_LATENCY_MODE,
618         GET_GAME_CONTENT_TYPE_SUPPORT, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead.
619         SET_GAME_CONTENT_TYPE,
620         SET_FRAME_RATE,
621         ACQUIRE_FRAME_RATE_FLEXIBILITY_TOKEN,
622         SET_FRAME_TIMELINE_INFO,
623         ADD_TRANSACTION_TRACE_LISTENER,
624         GET_GPU_CONTEXT_PRIORITY,
625         GET_MAX_ACQUIRED_BUFFER_COUNT,
626         GET_DYNAMIC_DISPLAY_INFO,
627         ADD_FPS_LISTENER,
628         REMOVE_FPS_LISTENER,
629         OVERRIDE_HDR_TYPES,
630         ADD_HDR_LAYER_INFO_LISTENER,
631         REMOVE_HDR_LAYER_INFO_LISTENER,
632         ON_PULL_ATOM,
633         ADD_TUNNEL_MODE_ENABLED_LISTENER,
634         REMOVE_TUNNEL_MODE_ENABLED_LISTENER,
635         ADD_WINDOW_INFOS_LISTENER,
636         REMOVE_WINDOW_INFOS_LISTENER,
637         GET_PRIMARY_PHYSICAL_DISPLAY_ID,
638         // Always append new enum to the end.
639     };
640 
641     virtual status_t onTransact(uint32_t code, const Parcel& data,
642             Parcel* reply, uint32_t flags = 0);
643 };
644 
645 } // namespace android
646