• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 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.gui;
18 
19 import android.gui.CaptureArgs;
20 import android.gui.Color;
21 import android.gui.CompositionPreference;
22 import android.gui.ContentSamplingAttributes;
23 import android.gui.DisplayBrightness;
24 import android.gui.DisplayCaptureArgs;
25 import android.gui.DisplayDecorationSupport;
26 import android.gui.DisplayedFrameStats;
27 import android.gui.DisplayModeSpecs;
28 import android.gui.DisplayPrimaries;
29 import android.gui.DisplayState;
30 import android.gui.DisplayStatInfo;
31 import android.gui.DynamicDisplayInfo;
32 import android.gui.FrameEvent;
33 import android.gui.FrameStats;
34 import android.gui.HdrConversionCapability;
35 import android.gui.HdrConversionStrategy;
36 import android.gui.IActivePictureListener;
37 import android.gui.IDisplayEventConnection;
38 import android.gui.IFpsListener;
39 import android.gui.IHdrLayerInfoListener;
40 import android.gui.IRegionSamplingListener;
41 import android.gui.IScreenCaptureListener;
42 import android.gui.ISurfaceComposerClient;
43 import android.gui.ITunnelModeEnabledListener;
44 import android.gui.IWindowInfosListener;
45 import android.gui.IWindowInfosPublisher;
46 import android.gui.IJankListener;
47 import android.gui.LayerCaptureArgs;
48 import android.gui.OverlayProperties;
49 import android.gui.PullAtomData;
50 import android.gui.ScreenCaptureResults;
51 import android.gui.ARect;
52 import android.gui.SchedulingPolicy;
53 import android.gui.StalledTransactionInfo;
54 import android.gui.StaticDisplayInfo;
55 import android.gui.WindowInfosListenerInfo;
56 
57 /** @hide */
58 interface ISurfaceComposer {
59 
60     enum VsyncSource {
61         eVsyncSourceApp = 0,
62         eVsyncSourceSurfaceFlinger = 1
63     }
64 
65     enum EventRegistration {
66         modeChanged = 1 << 0,
67         frameRateOverride = 1 << 1,
68     }
69 
70     enum OptimizationPolicy {
71         optimizeForPower = 0,
72         optimizeForPerformance = 1,
73     }
74 
75     /**
76      * Signal that we're done booting.
77      * Requires ACCESS_SURFACE_FLINGER permission
78      */
bootFinished()79     void bootFinished();
80 
81     /**
82      * Create a display event connection.
83      *
84      * layerHandle
85      *     Optional binder handle representing a Layer in SF to associate the new
86      *     DisplayEventConnection with. This handle can be found inside a surface control after
87      *     surface creation, see ISurfaceComposerClient::createSurface. Set to null if no layer
88      *     association should be made.
89      */
createDisplayEventConnection(VsyncSource vsyncSource, EventRegistration eventRegistration, @nullable IBinder layerHandle)90     @nullable IDisplayEventConnection createDisplayEventConnection(VsyncSource vsyncSource,
91             EventRegistration eventRegistration, @nullable IBinder layerHandle);
92 
93     /**
94      * Create a connection with SurfaceFlinger.
95      */
createConnection()96     @nullable ISurfaceComposerClient createConnection();
97 
98     /**
99      * Create a virtual display.
100      *
101      * displayName
102      *     The name of the virtual display.
103      * isSecure
104      *     Whether this virtual display is secure.
105      * optimizationPolicy
106      *     Whether to optimize for power or performance. Displays that are optimizing for power may
107      *     be dependent on a different display that optimizes for performance when they are on,
108      *     which will guarantee performance for all of the other displays.
109      * uniqueId
110      *     The unique ID for the display.
111      * requestedRefreshRate
112      *     The refresh rate, frames per second, to request on the virtual display.
113      *     This is just a request, the actual rate may be adjusted to align well
114      *     with physical displays running concurrently. If 0 is specified, the
115      *     virtual display is refreshed at the physical display refresh rate.
116      *
117      * requires ACCESS_SURFACE_FLINGER permission.
118      */
createVirtualDisplay(@tf8InCpp String displayName, boolean isSecure, OptimizationPolicy optimizationPolicy, @utf8InCpp String uniqueId, float requestedRefreshRate)119     @nullable IBinder createVirtualDisplay(@utf8InCpp String displayName, boolean isSecure,
120             OptimizationPolicy optimizationPolicy, @utf8InCpp String uniqueId, float requestedRefreshRate);
121 
122     /**
123      * Destroy a virtual display.
124      * requires ACCESS_SURFACE_FLINGER permission.
125      */
destroyVirtualDisplay(IBinder displayToken)126     void destroyVirtualDisplay(IBinder displayToken);
127 
128     /**
129      * Get stable IDs for connected physical displays.
130      */
getPhysicalDisplayIds()131     long[] getPhysicalDisplayIds();
132 
133     /**
134      * Get token for a physical display given its stable ID obtained via getPhysicalDisplayIds or
135      * a DisplayEventReceiver hotplug event.
136      */
getPhysicalDisplayToken(long displayId)137     @nullable IBinder getPhysicalDisplayToken(long displayId);
138 
139     /**
140      * Returns the frame timestamps supported by SurfaceFlinger.
141      */
getSupportedFrameTimestamps()142     FrameEvent[] getSupportedFrameTimestamps();
143 
144     /**
145      * Set display power mode. depending on the mode, it can either trigger
146      * screen on, off or low power mode and wait for it to complete.
147      * requires ACCESS_SURFACE_FLINGER permission.
148      */
setPowerMode(IBinder display, int mode)149     void setPowerMode(IBinder display, int mode);
150 
151     /**
152      * Returns display statistics for a given display
153      * intended to be used by the media framework to properly schedule
154      * video frames */
getDisplayStats(@ullable IBinder display)155     DisplayStatInfo getDisplayStats(@nullable IBinder display);
156 
157     /**
158      * Get transactional state of given display.
159      */
getDisplayState(IBinder display)160     DisplayState getDisplayState(IBinder display);
161 
162     /**
163      * Gets immutable information about given physical display.
164      */
getStaticDisplayInfo(long displayId)165     StaticDisplayInfo getStaticDisplayInfo(long displayId);
166 
167     /**
168      * Gets dynamic information about given physical display.
169      */
getDynamicDisplayInfoFromId(long displayId)170     DynamicDisplayInfo getDynamicDisplayInfoFromId(long displayId);
171 
getDynamicDisplayInfoFromToken(IBinder display)172     DynamicDisplayInfo getDynamicDisplayInfoFromToken(IBinder display);
173 
getDisplayNativePrimaries(IBinder display)174     DisplayPrimaries getDisplayNativePrimaries(IBinder display);
175 
setActiveColorMode(IBinder display, int colorMode)176     void setActiveColorMode(IBinder display, int colorMode);
177 
178     /**
179      * Sets the user-preferred display mode that a device should boot in.
180      */
setBootDisplayMode(IBinder display, int displayModeId)181     void setBootDisplayMode(IBinder display, int displayModeId);
182 
183     /**
184      * Clears the user-preferred display mode. The device should now boot in system preferred
185      * display mode.
186      */
clearBootDisplayMode(IBinder display)187     void clearBootDisplayMode(IBinder display);
188 
189     /**
190      * Gets whether boot time display mode operations are supported on the device.
191      *
192      * outSupport
193      *      An output parameter for whether boot time display mode operations are supported.
194      *
195      * Returns NO_ERROR upon success. Otherwise,
196      *      NAME_NOT_FOUND if the display is invalid, or
197      *      BAD_VALUE      if the output parameter is invalid.
198      */
199     // TODO(b/213909104) : Add unit tests to verify surface flinger boot time APIs
getBootDisplayModeSupport()200     boolean getBootDisplayModeSupport();
201 
202     /**
203      * Gets the HDR conversion capabilities of the device. The conversion capability defines whether
204      * conversion from sourceType to outputType is possible (with or without latency).
205      *
206      * Requires the ACCESS_SURFACE_FLINGER permission.
207      */
getHdrConversionCapabilities()208      List<HdrConversionCapability> getHdrConversionCapabilities();
209 
210      /**
211       * Sets the HDR conversion strategy of the device.
212       * Returns the preferred HDR output type of the device, in case when HdrConversionStrategy has
213       * autoAllowedHdrTypes set. Returns Hdr::INVALID in other cases.
214       *
215       * Requires the ACCESS_SURFACE_FLINGER permission.
216       */
setHdrConversionStrategy(in HdrConversionStrategy hdrConversionStrategy)217      int setHdrConversionStrategy(in HdrConversionStrategy hdrConversionStrategy);
218 
219      /**
220       * Gets whether HDR output conversion operations are supported on the device.
221       */
getHdrOutputConversionSupport()222      boolean getHdrOutputConversionSupport();
223 
224     /**
225      * Switches Auto Low Latency Mode on/off on the connected display, if it is
226      * available. This should only be called if the display supports Auto Low
227      * Latency Mode as reported in #getDynamicDisplayInfo.
228      * For more information, see the HDMI 2.1 specification.
229      */
setAutoLowLatencyMode(IBinder display, boolean on)230     void setAutoLowLatencyMode(IBinder display, boolean on);
231 
232     /**
233      * This will start sending infoframes to the connected display with
234      * ContentType=Game (if on=true). This should only be called if the display
235      * Game Content Type as reported in #getDynamicDisplayInfo.
236      * For more information, see the HDMI 1.4 specification.
237      */
setGameContentType(IBinder display, boolean on)238     void setGameContentType(IBinder display, boolean on);
239 
240     /**
241      * Gets the maximum number of picture profiles supported by the display.
242      */
getMaxLayerPictureProfiles(IBinder display)243     int getMaxLayerPictureProfiles(IBinder display);
244 
245     /**
246      * Capture the specified screen. This requires READ_FRAME_BUFFER
247      * permission.  This function will fail if there is a secure window on
248      * screen and DisplayCaptureArgs.captureSecureLayers is false.
249      *
250      * This function can capture a subregion (the source crop) of the screen.
251      * The subregion can be optionally rotated.  It will also be scaled to
252      * match the size of the output buffer.
253      */
captureDisplay(in DisplayCaptureArgs args, IScreenCaptureListener listener)254     oneway void captureDisplay(in DisplayCaptureArgs args, IScreenCaptureListener listener);
255 
256     /**
257      * Capture the specified screen. This requires the READ_FRAME_BUFFER
258      * permission.
259      */
captureDisplayById(long displayId, in CaptureArgs args, IScreenCaptureListener listener)260     oneway void captureDisplayById(long displayId, in CaptureArgs args,
261             IScreenCaptureListener listener);
262 
263     /**
264      * Capture a subtree of the layer hierarchy, potentially ignoring the root node.
265      * This requires READ_FRAME_BUFFER permission. This function will fail if there
266      * is a secure window on screen. This is a blocking call and will return the
267      * ScreenCaptureResults, including the captured buffer. Because this is blocking, the
268      * caller doesn't care about the fence and the binder thread in SurfaceFlinger will wait
269      * on the fence to fire before returning the results.
270      */
captureLayersSync(in LayerCaptureArgs args)271     ScreenCaptureResults captureLayersSync(in LayerCaptureArgs args);
272 
273     /**
274      * Capture a subtree of the layer hierarchy, potentially ignoring the root node.
275      * This requires READ_FRAME_BUFFER permission. This function will fail if there
276      * is a secure window on screen
277      */
captureLayers(in LayerCaptureArgs args, IScreenCaptureListener listener)278     oneway void captureLayers(in LayerCaptureArgs args, IScreenCaptureListener listener);
279 
280     /**
281      * Clears the frame statistics for animations.
282      *
283      * Requires the ACCESS_SURFACE_FLINGER permission.
284      */
clearAnimationFrameStats()285     void clearAnimationFrameStats();
286 
287     /**
288      * Gets the frame statistics for animations.
289      *
290      * Requires the ACCESS_SURFACE_FLINGER permission.
291      */
getAnimationFrameStats()292     FrameStats getAnimationFrameStats();
293 
294     /**
295      * Overrides the supported HDR modes for the given display device.
296      *
297      * Requires the ACCESS_SURFACE_FLINGER permission.
298      */
overrideHdrTypes(IBinder display, in int[] hdrTypes)299     void overrideHdrTypes(IBinder display, in int[] hdrTypes);
300 
301     /**
302      * Pulls surfaceflinger atoms global stats and layer stats to pipe to statsd.
303      *
304      * Requires the calling uid be from system server.
305      */
onPullAtom(int atomId)306     PullAtomData onPullAtom(int atomId);
307 
308     /**
309      * Gets the composition preference of the default data space and default pixel format,
310      * as well as the wide color gamut data space and wide color gamut pixel format.
311      * If the wide color gamut data space is V0_SRGB, then it implies that the platform
312      * has no wide color gamut support.
313      *
314      */
getCompositionPreference()315     CompositionPreference getCompositionPreference();
316 
317     /**
318      * Requires the ACCESS_SURFACE_FLINGER permission.
319      */
getDisplayedContentSamplingAttributes(IBinder display)320     ContentSamplingAttributes getDisplayedContentSamplingAttributes(IBinder display);
321 
322     /**
323      * Turns on the color sampling engine on the display.
324      *
325      * Requires the ACCESS_SURFACE_FLINGER permission.
326      */
setDisplayContentSamplingEnabled(IBinder display, boolean enable, byte componentMask, long maxFrames)327     void setDisplayContentSamplingEnabled(IBinder display, boolean enable, byte componentMask, long maxFrames);
328 
329     /**
330      * Returns statistics on the color profile of the last frame displayed for a given display
331      *
332      * Requires the ACCESS_SURFACE_FLINGER permission.
333      */
getDisplayedContentSample(IBinder display, long maxFrames, long timestamp)334     DisplayedFrameStats getDisplayedContentSample(IBinder display, long maxFrames, long timestamp);
335 
336     /**
337      * Gets whether SurfaceFlinger can support protected content in GPU composition.
338      */
getProtectedContentSupport()339     boolean getProtectedContentSupport();
340 
341     /**
342      * Queries whether the given display is a wide color display.
343      * Requires the ACCESS_SURFACE_FLINGER permission.
344      */
isWideColorDisplay(IBinder token)345     boolean isWideColorDisplay(IBinder token);
346 
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      */
addRegionSamplingListener(in ARect samplingArea, @nullable IBinder stopLayerHandle, IRegionSamplingListener listener)359     void addRegionSamplingListener(in ARect samplingArea, @nullable IBinder stopLayerHandle, IRegionSamplingListener listener);
360 
361     /**
362      * Removes a listener that was streaming median luma updates from SurfaceFlinger.
363      */
removeRegionSamplingListener(IRegionSamplingListener listener)364     void removeRegionSamplingListener(IRegionSamplingListener listener);
365 
366     /**
367      * Registers a listener that streams fps updates from SurfaceFlinger.
368      *
369      * The listener will stream fps updates for the layer tree rooted at the layer denoted by the
370      * task ID, i.e., the layer must have the task ID as part of its layer metadata with key
371      * METADATA_TASK_ID. If there is no such layer, then no fps is expected to be reported.
372      *
373      * Multiple listeners may be supported.
374      *
375      * Requires the READ_FRAME_BUFFER permission.
376      */
addFpsListener(int taskId, IFpsListener listener)377     void addFpsListener(int taskId, IFpsListener listener);
378 
379     /**
380      * Removes a listener that was streaming fps updates from SurfaceFlinger.
381      */
removeFpsListener(IFpsListener listener)382     void removeFpsListener(IFpsListener listener);
383 
384     /**
385      * Registers a listener to receive tunnel mode enabled updates from SurfaceFlinger.
386      *
387      * Requires ACCESS_SURFACE_FLINGER permission.
388      */
addTunnelModeEnabledListener(ITunnelModeEnabledListener listener)389     void addTunnelModeEnabledListener(ITunnelModeEnabledListener listener);
390 
391     /**
392      * Removes a listener that was receiving tunnel mode enabled updates from SurfaceFlinger.
393      *
394      * Requires ACCESS_SURFACE_FLINGER permission.
395      */
removeTunnelModeEnabledListener(ITunnelModeEnabledListener listener)396     void removeTunnelModeEnabledListener(ITunnelModeEnabledListener listener);
397 
398     /**
399      * Sets the refresh rate boundaries for the display.
400      *
401      * @see DisplayModeSpecs.aidl for details.
402      */
setDesiredDisplayModeSpecs(IBinder displayToken, in DisplayModeSpecs specs)403     void setDesiredDisplayModeSpecs(IBinder displayToken, in DisplayModeSpecs specs);
404 
getDesiredDisplayModeSpecs(IBinder displayToken)405     DisplayModeSpecs getDesiredDisplayModeSpecs(IBinder displayToken);
406 
407     /**
408      * Gets whether brightness operations are supported on a display.
409      *
410      * displayToken
411      *      The token of the display.
412      * outSupport
413      *      An output parameter for whether brightness operations are supported.
414      *
415      * Returns NO_ERROR upon success. Otherwise,
416      *      NAME_NOT_FOUND if the display is invalid, or
417      *      BAD_VALUE      if the output parameter is invalid.
418      */
getDisplayBrightnessSupport(IBinder displayToken)419     boolean getDisplayBrightnessSupport(IBinder displayToken);
420 
421     /**
422      * Sets the brightness of a display.
423      *
424      * displayToken
425      *      The token of the display whose brightness is set.
426      * brightness
427      *      The DisplayBrightness info to set on the desired display.
428      *
429      * Returns NO_ERROR upon success. Otherwise,
430      *      NAME_NOT_FOUND    if the display is invalid, or
431      *      BAD_VALUE         if the brightness is invalid, or
432      *      INVALID_OPERATION if brightness operations are not supported.
433      */
setDisplayBrightness(IBinder displayToken, in DisplayBrightness brightness)434     void setDisplayBrightness(IBinder displayToken, in DisplayBrightness brightness);
435 
436     /**
437      * Adds a listener that receives HDR layer information. This is used in combination
438      * with setDisplayBrightness to adjust the display brightness depending on factors such
439      * as whether or not HDR is in use.
440      *
441      * Returns NO_ERROR upon success or NAME_NOT_FOUND if the display is invalid.
442      */
addHdrLayerInfoListener(IBinder displayToken, IHdrLayerInfoListener listener)443     void addHdrLayerInfoListener(IBinder displayToken, IHdrLayerInfoListener listener);
444 
445     /**
446      * Removes a listener that was added with addHdrLayerInfoListener.
447      *
448      * Returns NO_ERROR upon success, NAME_NOT_FOUND if the display is invalid, and BAD_VALUE if
449      *     the listener wasn't registered.
450      *
451      */
removeHdrLayerInfoListener(IBinder displayToken, IHdrLayerInfoListener listener)452     void removeHdrLayerInfoListener(IBinder displayToken, IHdrLayerInfoListener listener);
453 
454     /**
455      * Sends a power boost to the composer. This function is asynchronous.
456      *
457      * boostId
458      *      boost id according to android::hardware::power::Boost
459      *
460      * Returns NO_ERROR upon success.
461      */
notifyPowerBoost(int boostId)462     oneway void notifyPowerBoost(int boostId);
463 
464     /*
465      * Sets the global configuration for all the shadows drawn by SurfaceFlinger. Shadow follows
466      * material design guidelines.
467      *
468      * ambientColor
469      *      Color to the ambient shadow. The alpha is premultiplied.
470      *
471      * spotColor
472      *      Color to the spot shadow. The alpha is premultiplied. The position of the spot shadow
473      *      depends on the light position.
474      *
475      * lightPosY/lightPosZ
476      *      Position of the light used to cast the spot shadow. The X value is always the display
477      *      width / 2.
478      *
479      * lightRadius
480      *      Radius of the light casting the shadow.
481      */
setGlobalShadowSettings(in Color ambientColor, in Color spotColor, float lightPosY, float lightPosZ, float lightRadius)482     oneway void setGlobalShadowSettings(in Color ambientColor, in Color spotColor, float lightPosY, float lightPosZ, float lightRadius);
483 
484     /**
485      * Gets whether a display supports DISPLAY_DECORATION layers.
486      *
487      * displayToken
488      *      The token of the display.
489      * outSupport
490      *      An output parameter for whether/how the display supports
491      *      DISPLAY_DECORATION layers.
492      *
493      * Returns NO_ERROR upon success. Otherwise,
494      *      NAME_NOT_FOUND if the display is invalid, or
495      *      BAD_VALUE      if the output parameter is invalid.
496      */
getDisplayDecorationSupport(IBinder displayToken)497     @nullable DisplayDecorationSupport getDisplayDecorationSupport(IBinder displayToken);
498 
499     /**
500      * Set the override frame rate for a specified uid by GameManagerService.
501      * This override is controlled by game mode interventions.
502      * Passing the frame rate and uid to SurfaceFlinger to update the override mapping
503      * in the LayerHistory.
504      */
setGameModeFrameRateOverride(int uid, float frameRate)505     void setGameModeFrameRateOverride(int uid, float frameRate);
506 
507     /**
508      * Set the override frame rate for a specified uid by GameManagerService.
509      * This override is controlled by game default frame rate sysprop:
510      * "ro.surface_flinger.game_default_frame_rate_override" holding the override value,
511      * "persisit.graphics.game_default_frame_rate.enabled" to determine if it's enabled.
512      * Passing the frame rate and uid to SurfaceFlinger to update the override mapping
513      * in the scheduler.
514      */
setGameDefaultFrameRateOverride(int uid, float frameRate)515     void setGameDefaultFrameRateOverride(int uid, float frameRate);
516 
updateSmallAreaDetection(in int[] appIds, in float[] thresholds)517     oneway void updateSmallAreaDetection(in int[] appIds, in float[] thresholds);
518 
519     /**
520      * Set the small area detection threshold for a specified appId by SmallAreaDetectionController.
521      * Passing the threshold and appId to SurfaceFlinger to update the appId-threshold mapping
522      * in the scheduler.
523      */
setSmallAreaDetectionThreshold(int appId, float threshold)524     oneway void setSmallAreaDetectionThreshold(int appId, float threshold);
525 
526     /**
527      * Enables or disables the frame rate overlay in the top left corner.
528      * Requires root or android.permission.HARDWARE_TEST
529      */
enableRefreshRateOverlay(boolean active)530     void enableRefreshRateOverlay(boolean active);
531 
532     /**
533      * Enables or disables the debug flash.
534      * Requires root or android.permission.HARDWARE_TEST
535      */
setDebugFlash(int delay)536     void setDebugFlash(int delay);
537 
538     /**
539      * Force composite ahead of next VSYNC.
540      * Requires root or android.permission.HARDWARE_TEST
541      */
scheduleComposite()542     void scheduleComposite();
543 
544     /**
545      * Force commit ahead of next VSYNC.
546      * Requires root or android.permission.HARDWARE_TEST
547      */
scheduleCommit()548     void scheduleCommit();
549 
550     /**
551      * Force all window composition to the GPU (i.e. disable Hardware Overlays).
552      * This can help check if there is a bug in HW Composer.
553      * Requires root or android.permission.HARDWARE_TEST
554      */
forceClientComposition(boolean enabled)555     void forceClientComposition(boolean enabled);
556 
557     /**
558      * Gets priority of the RenderEngine in SurfaceFlinger.
559      */
getGpuContextPriority()560     int getGpuContextPriority();
561 
562     /**
563      * Gets the number of buffers SurfaceFlinger would need acquire. This number
564      * would be propagated to the client via MIN_UNDEQUEUED_BUFFERS so that the
565      * client could allocate enough buffers to match SF expectations of the
566      * pipeline depth. SurfaceFlinger will make sure that it will give the app at
567      * least the time configured as the 'appDuration' before trying to latch
568      * the buffer.
569      *
570      * The total buffers needed for a given configuration is basically the
571      * numbers of vsyncs a single buffer is used across the stack. For the default
572      * configuration a buffer is held ~1 vsync by the app, ~1 vsync by SurfaceFlinger
573      * and 1 vsync by the display. The extra buffers are calculated as the
574      * number of additional buffers on top of the 2 buffers already present
575      * in MIN_UNDEQUEUED_BUFFERS.
576      */
getMaxAcquiredBufferCount()577     int getMaxAcquiredBufferCount();
578 
addWindowInfosListener(IWindowInfosListener windowInfosListener)579     WindowInfosListenerInfo addWindowInfosListener(IWindowInfosListener windowInfosListener);
580 
removeWindowInfosListener(IWindowInfosListener windowInfosListener)581     void removeWindowInfosListener(IWindowInfosListener windowInfosListener);
582 
getOverlaySupport()583     OverlayProperties getOverlaySupport();
584 
585     /**
586      * Returns an instance of StalledTransaction if a transaction from the passed pid has not been
587      * applied in SurfaceFlinger due to an unsignaled fence. Otherwise, null is returned.
588      */
getStalledTransactionInfo(int pid)589     @nullable StalledTransactionInfo getStalledTransactionInfo(int pid);
590 
getSchedulingPolicy()591     SchedulingPolicy getSchedulingPolicy();
592 
593     /**
594      * Notifies the SurfaceFlinger that the ShutdownThread is running. When it is called,
595      * transaction traces will be captured and writted into a file.
596      * This method should not block the ShutdownThread therefore it's handled asynchronously.
597      */
notifyShutdown()598     oneway void notifyShutdown();
599 
600     /**
601      * Registers the jank listener on the given layer to receive jank data of future frames.
602      */
addJankListener(IBinder layer, IJankListener listener)603     void addJankListener(IBinder layer, IJankListener listener);
604 
605     /**
606      * Flushes any pending jank data on the given layer to any registered listeners on that layer.
607      */
flushJankData(int layerId)608     oneway void flushJankData(int layerId);
609 
610     /**
611      * Schedules the removal of the jank listener from the given layer after the VSync with the
612      * specified ID. Use a value <= 0 for afterVsync to remove the listener immediately. The given
613      * listener will not be removed before the given VSync, but may still receive data for frames
614      * past the provided VSync.
615      */
removeJankListener(int layerId, IJankListener listener, long afterVsync)616     oneway void removeJankListener(int layerId, IJankListener listener, long afterVsync);
617 
618     /**
619      * Adds a listener used to monitor visible content that is being processed with picture
620      * profiles.
621      */
addActivePictureListener(IActivePictureListener listener)622     oneway void addActivePictureListener(IActivePictureListener listener);
623 
624     /**
625      * Removes a listener used to monitor visible content that is being processed with picture
626      * profiles.
627      */
removeActivePictureListener(IActivePictureListener listener)628     oneway void removeActivePictureListener(IActivePictureListener listener);
629 }
630