Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::android::SurfaceControl Class Referenceabstract

A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asurfacecontrol. More...

#include <surface_control.h>

Inheritance diagram for impeller::android::SurfaceControl:
impeller::android::SurfaceControlImpl impeller::android::testing::FakeSurfaceControl

Public Member Functions

virtual ~SurfaceControl ()=default
 Removes the surface control from the presentation hierarchy managed by the system compositor and release the client side reference to the control. At this point, it may be collected when the compositor is also done using it.
 
virtual bool IsValid () const =0
 
virtual ASurfaceControl * GetHandle () const =0
 
virtual bool RemoveFromParent () const =0
 Remove the surface control from the hierarchy of nodes presented by the system compositor.
 

Static Public Member Functions

static bool IsAvailableOnPlatform ()
 
static std::unique_ptr< SurfaceControlCreate (ANativeWindow *window, const char *debug_name=nullptr)
 Creates a new surface control and adds it as a child of the given window.
 

Detailed Description

A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asurfacecontrol.

Instances of this class represent a node in the hierarchy of surfaces sent to the system compositor for final composition.

This wrapper is only available on Android API 29 and above.

Definition at line 23 of file surface_control.h.

Constructor & Destructor Documentation

◆ ~SurfaceControl()

virtual impeller::android::SurfaceControl::~SurfaceControl ( )
virtualdefault

Removes the surface control from the presentation hierarchy managed by the system compositor and release the client side reference to the control. At this point, it may be collected when the compositor is also done using it.

Member Function Documentation

◆ Create()

std::unique_ptr< SurfaceControl > impeller::android::SurfaceControl::Create ( ANativeWindow window,
const char *  debug_name = nullptr 
)
static

Creates a new surface control and adds it as a child of the given window.

Parameters
windowThe window
[in]debug_nameA debug name. See it using adb shell dumpsys SurfaceFlinger along with other control properties. If no debug name is specified, the value "Impeller Layer" is used.

Definition at line 13 of file surface_control.cc.

14 {
15 return std::unique_ptr<SurfaceControl>(
16 new SurfaceControlImpl(window, debug_name));
17}
GLFWwindow * window
Definition main.cc:60

References window.

◆ GetHandle()

◆ IsAvailableOnPlatform()

bool impeller::android::SurfaceControl::IsAvailableOnPlatform ( )
static
Returns
true if any surface controls can be created on this platform.

Definition at line 19 of file surface_control.cc.

19 {
20 auto api_level = android_get_device_api_level();
21
22 // Technically SurfaceControl is supported on API 29 but I've observed
23 // enough reported bugs that I'm bumping the constraint to 30. If
24 // we had more time to test all of these older devices maybe we could
25 // figure out what the problem is.
26 // https://github.com/flutter/flutter/issues/155877
27 return api_level >= 29 && GetProcTable().IsValid() &&
28 GetProcTable().ASurfaceControl_createFromWindow.IsAvailable();
29}
const ProcTable & GetProcTable()
Definition proc_table.cc:12
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.
Definition proc_table.cc:65

References impeller::android::GetProcTable(), and impeller::android::ProcTable::IsValid().

Referenced by impeller::AHBSwapchainVK::IsAvailableOnPlatform(), and impeller::android::testing::TEST().

◆ IsValid()

◆ RemoveFromParent()

virtual bool impeller::android::SurfaceControl::RemoveFromParent ( ) const
pure virtual

Remove the surface control from the hierarchy of nodes presented by the system compositor.

This is called implicitly when the surface control is collected.

Returns
true If the control will be removed from the hierarchy of nodes presented by the system compositor.

Implemented in impeller::android::testing::FakeSurfaceControl, and impeller::android::SurfaceControlImpl.


The documentation for this class was generated from the following files: