Flutter Engine
 
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
48 int textureId) override;
49
50 bool SurfaceTextureShouldUpdate(JavaLocalRef surface_texture) override;
51
52 void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override;
53
54 SkM44 SurfaceTextureGetTransformMatrix(JavaLocalRef surface_texture) override;
55
56 void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override;
57
59 JavaLocalRef image_texture_entry) override;
60
62
63 void ImageClose(JavaLocalRef image) override;
64
65 void HardwareBufferClose(JavaLocalRef hardware_buffer) override;
66
68 int x,
69 int y,
70 int width,
71 int height,
72 int viewWidth,
73 int viewHeight,
74 MutatorsStack mutators_stack) override;
75
76 void FlutterViewDisplayOverlaySurface(int surface_id,
77 int x,
78 int y,
79 int width,
80 int height) override;
81
82 void FlutterViewBeginFrame() override;
83
84 void FlutterViewEndFrame() override;
85
86 std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
88
90
91 std::unique_ptr<std::vector<std::string>>
93 std::vector<std::string> supported_locales_data) override;
94
95 double GetDisplayRefreshRate() override;
96
97 double GetDisplayWidth() override;
98
99 double GetDisplayHeight() override;
100
101 double GetDisplayDensity() override;
102
103 bool RequestDartDeferredLibrary(int loading_unit_id) override;
104
105 double FlutterViewGetScaledFontSize(double unscaled_font_size,
106 int configuration_id) const override;
107
108 // New Platform View Support.
109 ASurfaceTransaction* createTransaction() override;
110
111 void swapTransaction() override;
112
113 void applyTransaction() override;
114
115 std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
116 createOverlaySurface2() override;
117
118 void destroyOverlaySurface2() override;
119
120 void onDisplayPlatformView2(int32_t view_id,
121 int32_t x,
122 int32_t y,
123 int32_t width,
124 int32_t height,
125 int32_t viewWidth,
126 int32_t viewHeight,
127 MutatorsStack mutators_stack) override;
128
129 void hidePlatformView2(int32_t view_id) override;
130
131 void showOverlaySurface2() override;
132
133 void hideOverlaySurface2() override;
134
135 void onEndFrame2() override;
136
137 private:
138 // Reference to FlutterJNI object.
139 const fml::jni::JavaObjectWeakGlobalRef java_object_;
140
142};
143
144} // namespace flutter
145
146#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 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 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
G_BEGIN_DECLS GBytes * 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