Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
platform_view_android_jni_impl.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_IMPL_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_IMPL_H_
7
10
11namespace flutter {
12
13//------------------------------------------------------------------------------
14/// @brief Concrete implementation of `PlatformViewAndroidJNI` that is
15/// compiled with the Android toolchain.
16///
18 public:
20 const fml::jni::JavaObjectWeakGlobalRef& java_object);
21
23
25 std::unique_ptr<flutter::PlatformMessage> message,
26 int responseId) override;
27
29 int responseId,
30 std::unique_ptr<fml::Mapping> data) override;
31
33 std::vector<uint8_t> buffer,
34 std::vector<std::string> strings,
35 std::vector<std::vector<uint8_t>> string_attribute_args) override;
36
37 void FlutterViewSetApplicationLocale(std::string locale) override;
38
40 std::vector<uint8_t> actions_buffer,
41 std::vector<std::string> strings) override;
42
43 void FlutterViewOnFirstFrame() override;
44
45 void FlutterViewOnPreEngineRestart() override;
46
47 void FlutterViewSetSemanticsTreeEnabled(bool enabled) override;
48
50 int textureId) override;
51
52 bool SurfaceTextureShouldUpdate(JavaLocalRef surface_texture) override;
53
54 void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override;
55
56 SkM44 SurfaceTextureGetTransformMatrix(JavaLocalRef surface_texture) override;
57
58 void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override;
59
61 JavaLocalRef image_texture_entry) override;
62
64
65 void ImageClose(JavaLocalRef image) override;
66
67 void HardwareBufferClose(JavaLocalRef hardware_buffer) override;
68
70 int x,
71 int y,
72 int width,
73 int height,
74 int viewWidth,
75 int viewHeight,
76 MutatorsStack mutators_stack) override;
77
78 void FlutterViewDisplayOverlaySurface(int surface_id,
79 int x,
80 int y,
81 int width,
82 int height) override;
83
84 void FlutterViewBeginFrame() override;
85
86 void FlutterViewEndFrame() override;
87
88 std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
90
92
93 std::unique_ptr<std::vector<std::string>>
95 std::vector<std::string> supported_locales_data) override;
96
97 double GetDisplayRefreshRate() override;
98
99 double GetDisplayWidth() override;
100
101 double GetDisplayHeight() override;
102
103 double GetDisplayDensity() override;
104
105 bool RequestDartDeferredLibrary(int loading_unit_id) override;
106
107 double FlutterViewGetScaledFontSize(double unscaled_font_size,
108 int configuration_id) const override;
109
110 // New Platform View Support.
111 ASurfaceTransaction* createTransaction() override;
112
113 void swapTransaction() override;
114
115 void applyTransaction() override;
116
117 std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
118 createOverlaySurface2() override;
119
120 void destroyOverlaySurface2() override;
121
122 void onDisplayPlatformView2(int32_t view_id,
123 int32_t x,
124 int32_t y,
125 int32_t width,
126 int32_t height,
127 int32_t viewWidth,
128 int32_t viewHeight,
129 MutatorsStack mutators_stack) override;
130
131 void hidePlatformView2(int32_t view_id) override;
132
133 void showOverlaySurface2() override;
134
135 void hideOverlaySurface2() override;
136
137 void onEndFrame2() override;
138
139 void MaybeResizeSurfaceView(int32_t width, int32_t height) const override;
140
141 private:
142 // Reference to FlutterJNI object.
143 const fml::jni::JavaObjectWeakGlobalRef java_object_;
144
146};
147
148} // namespace flutter
149
150#endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_IMPL_H_
Concrete implementation of PlatformViewAndroidJNI that is compiled with the Android toolchain.
void HardwareBufferClose(JavaLocalRef hardware_buffer) override
Call close on hardware_buffer.
bool RequestDartDeferredLibrary(int loading_unit_id) override
SkM44 SurfaceTextureGetTransformMatrix(JavaLocalRef surface_texture) override
Gets the transform matrix from the SurfaceTexture. Then, it updates the transform matrix,...
void MaybeResizeSurfaceView(int32_t width, int32_t height) const override
void FlutterViewDisplayOverlaySurface(int surface_id, int x, int y, int width, int height) override
Positions and sizes an overlay surface in hybrid composition.
void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override
Updates the texture image to the most recent frame from the image stream.
void FlutterViewEndFrame() override
Indicates that the current frame ended. It's used to clean up state.
void SurfaceTextureAttachToGLContext(JavaLocalRef surface_texture, int textureId) override
Attach the SurfaceTexture to the OpenGL ES context that is current on the calling thread.
void FlutterViewOnFirstFrame() override
Indicates that FlutterView should start painting pixels.
void FlutterViewSetApplicationLocale(std::string locale) override
Set application locale to a given language.
void FlutterViewUpdateCustomAccessibilityActions(std::vector< uint8_t > actions_buffer, std::vector< std::string > strings) override
Sends new custom accessibility events.
void FlutterViewBeginFrame() override
Initiates a frame if using hybrid composition.
void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override
Detaches a SurfaceTexture from the OpenGL ES context.
std::unique_ptr< PlatformViewAndroidJNI::OverlayMetadata > createOverlaySurface2() override
void onDisplayPlatformView2(int32_t view_id, int32_t x, int32_t y, int32_t width, int32_t height, int32_t viewWidth, int32_t viewHeight, MutatorsStack mutators_stack) override
bool SurfaceTextureShouldUpdate(JavaLocalRef surface_texture) override
Returns true if surface_texture should be updated.
void FlutterViewDestroyOverlaySurfaces() override
Destroys the overlay surfaces.
void FlutterViewOnDisplayPlatformView(int view_id, int x, int y, int width, int height, int viewWidth, int viewHeight, MutatorsStack mutators_stack) override
Positions and sizes a platform view if using hybrid composition.
void FlutterViewHandlePlatformMessageResponse(int responseId, std::unique_ptr< fml::Mapping > data) override
Responds to a platform message. The data may be a nullptr.
double FlutterViewGetScaledFontSize(double unscaled_font_size, int configuration_id) const override
JavaLocalRef ImageGetHardwareBuffer(JavaLocalRef image) override
Grab the HardwareBuffer from image.
std::unique_ptr< PlatformViewAndroidJNI::OverlayMetadata > FlutterViewCreateOverlaySurface() override
Instantiates an overlay surface in hybrid composition and provides the necessary metadata to operate ...
void FlutterViewSetSemanticsTreeEnabled(bool enabled) override
Enables or disables the semantics tree.
void FlutterViewUpdateSemantics(std::vector< uint8_t > buffer, std::vector< std::string > strings, std::vector< std::vector< uint8_t > > string_attribute_args) override
Sends semantics tree updates.
JavaLocalRef ImageProducerTextureEntryAcquireLatestImage(JavaLocalRef image_texture_entry) override
Acquire the latest image available.
void FlutterViewHandlePlatformMessage(std::unique_ptr< flutter::PlatformMessage > message, int responseId) override
Sends a platform message. The message may be empty.
void ImageClose(JavaLocalRef image) override
Call close on image.
void FlutterViewOnPreEngineRestart() override
Indicates that a hot restart is about to happen.
std::unique_ptr< std::vector< std::string > > FlutterViewComputePlatformResolvedLocale(std::vector< std::string > supported_locales_data) override
Computes the locale Android would select.
int32_t x
FlutterVulkanImage * image
const char * message
G_BEGIN_DECLS FlutterViewId view_id
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
double y
std::nullptr_t JavaLocalRef
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switch_defs.h:36
int32_t height
int32_t width