5 #ifndef FLUTTER_IMPELLER_TOOLKIT_ANDROID_PROC_TABLE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_ANDROID_PROC_TABLE_H_
9 #define EGL_EGLEXT_PROTOTYPES
10 #include <EGL/eglext.h>
11 #include <android/api-level.h>
13 #include <android/hardware_buffer_jni.h>
15 #include <android/trace.h>
19 #include "flutter/fml/logging.h"
20 #include "flutter/fml/native_library.h"
40 #define FOR_EACH_ANDROID_PROC(INVOKE) \
41 INVOKE(AChoreographer_getInstance, 24) \
42 INVOKE(AChoreographer_postFrameCallback, 24) \
43 INVOKE(AChoreographer_postFrameCallback64, 29) \
44 INVOKE(AHardwareBuffer_acquire, 26) \
45 INVOKE(AHardwareBuffer_allocate, 26) \
46 INVOKE(AHardwareBuffer_describe, 26) \
47 INVOKE(AHardwareBuffer_fromHardwareBuffer, 26) \
48 INVOKE(AHardwareBuffer_getId, 31) \
49 INVOKE(AHardwareBuffer_isSupported, 29) \
50 INVOKE(AHardwareBuffer_lock, 26) \
51 INVOKE(AHardwareBuffer_release, 26) \
52 INVOKE(AHardwareBuffer_unlock, 26) \
53 INVOKE(ANativeWindow_acquire, 0) \
54 INVOKE(ANativeWindow_getHeight, 0) \
55 INVOKE(ANativeWindow_getWidth, 0) \
56 INVOKE(ANativeWindow_release, 0) \
57 INVOKE(ASurfaceControl_createFromWindow, 29) \
58 INVOKE(ASurfaceControl_release, 29) \
59 INVOKE(ASurfaceTransaction_apply, 29) \
60 INVOKE(ASurfaceTransaction_create, 29) \
61 INVOKE(ASurfaceTransaction_delete, 29) \
62 INVOKE(ASurfaceTransaction_reparent, 29) \
63 INVOKE(ASurfaceTransaction_setBuffer, 29) \
64 INVOKE(ASurfaceTransaction_setColor, 29) \
65 INVOKE(ASurfaceTransaction_setOnComplete, 29) \
66 INVOKE(ASurfaceTransactionStats_getPreviousReleaseFenceFd, 29) \
67 INVOKE(ASurfaceTransaction_fromJava, 34) \
68 INVOKE(ATrace_isEnabled, 23) \
69 INVOKE(eglGetNativeClientBufferANDROID, 0)
81 explicit constexpr
operator bool()
const {
return IsAvailable(); }
83 template <
class... Args>
87 <<
" is not available on this device. Missing check.";
88 return proc(std::forward<Args>(args)...);
122 #define DEFINE_PROC(name, api) \
123 AndroidProc<decltype(name)> name = {.proc_name = #name};
128 std::vector<fml::RefPtr<fml::NativeLibrary>> libraries_;
129 bool is_valid_ =
false;
#define DEFINE_PROC(name, api)
const ProcTable & GetProcTable()
ASurfaceTransaction * ASurfaceTransaction_fromJava(JNIEnv *env, jobject transaction)
ProcTable & GetMutableProcTable()
auto operator()(Args &&... args) const
constexpr bool IsAvailable() const
The table of Android procs that are resolved dynamically.
ProcTable(const ProcTable &)=delete
FOR_EACH_ANDROID_PROC(DEFINE_PROC)
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.
bool TraceIsEnabled() const
Check if tracing in enabled in the process. This call can be made at any API level.
ProcTable & operator=(const ProcTable &)=delete