Flutter Engine
The Flutter Engine
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
8#include "flutter/fml/platform/android/jni_weak_ref.h"
9#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
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
38 std::vector<uint8_t> actions_buffer,
39 std::vector<std::string> strings) override;
40
41 void FlutterViewOnFirstFrame() override;
42
43 void FlutterViewOnPreEngineRestart() override;
44
46 int textureId) override;
47
48 bool SurfaceTextureShouldUpdate(JavaLocalRef surface_texture) override;
49
50 void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override;
51
53 SkMatrix& transform) override;
54
55 void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override;
56
58 JavaLocalRef image_texture_entry) override;
59
61
62 void ImageClose(JavaLocalRef image) override;
63
64 void HardwareBufferClose(JavaLocalRef hardware_buffer) override;
65
66 void FlutterViewOnDisplayPlatformView(int view_id,
67 int x,
68 int y,
69 int width,
70 int height,
71 int viewWidth,
72 int viewHeight,
73 MutatorsStack mutators_stack) override;
74
75 void FlutterViewDisplayOverlaySurface(int surface_id,
76 int x,
77 int y,
78 int width,
79 int height) override;
80
81 void FlutterViewBeginFrame() override;
82
83 void FlutterViewEndFrame() override;
84
85 std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
87
89
90 std::unique_ptr<std::vector<std::string>>
92 std::vector<std::string> supported_locales_data) override;
93
94 double GetDisplayRefreshRate() override;
95
96 double GetDisplayWidth() override;
97
98 double GetDisplayHeight() override;
99
100 double GetDisplayDensity() override;
101
102 bool RequestDartDeferredLibrary(int loading_unit_id) override;
103
104 double FlutterViewGetScaledFontSize(double unscaled_font_size,
105 int configuration_id) const override;
106
107 private:
108 // Reference to FlutterJNI object.
109 const fml::jni::JavaObjectWeakGlobalRef java_object_;
110
111 FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroidJNIImpl);
112};
113
114} // namespace flutter
115
116#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
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.
PlatformViewAndroidJNIImpl(const fml::jni::JavaObjectWeakGlobalRef &java_object)
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.
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.
void SurfaceTextureGetTransformMatrix(JavaLocalRef surface_texture, SkMatrix &transform) override
Gets the transform matrix from the SurfaceTexture. Then, it updates the transform matrix,...
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.
Win32Message message
double y
double x
sk_sp< const SkImage > image
Definition: SkRecords.h:269
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: switches.h:41
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
int32_t height
int32_t width