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 
11 namespace flutter {
12 
13 //------------------------------------------------------------------------------
14 /// @brief Concrete implementation of `PlatformViewAndroidJNI` that is
15 /// compiled with the Android toolchain.
16 ///
18  public:
20 
21  ~PlatformViewAndroidJNIImpl() override;
22 
24  std::unique_ptr<flutter::PlatformMessage> message,
25  int responseId) override;
26 
28  int responseId,
29  std::unique_ptr<fml::Mapping> data) override;
30 
32  std::vector<uint8_t> buffer,
33  std::vector<std::string> strings,
34  std::vector<std::vector<uint8_t>> string_attribute_args) override;
35 
37  std::vector<uint8_t> actions_buffer,
38  std::vector<std::string> strings) override;
39 
40  void FlutterViewOnFirstFrame() override;
41 
42  void FlutterViewOnPreEngineRestart() override;
43 
44  void SurfaceTextureAttachToGLContext(JavaLocalRef surface_texture,
45  int textureId) override;
46 
47  void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override;
48 
50  SkMatrix& transform) override;
51 
52  void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override;
53 
54  void FlutterViewOnDisplayPlatformView(int view_id,
55  int x,
56  int y,
57  int width,
58  int height,
59  int viewWidth,
60  int viewHeight,
61  MutatorsStack mutators_stack) override;
62 
63  void FlutterViewDisplayOverlaySurface(int surface_id,
64  int x,
65  int y,
66  int width,
67  int height) override;
68 
69  void FlutterViewBeginFrame() override;
70 
71  void FlutterViewEndFrame() override;
72 
73  std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
75 
76  void FlutterViewDestroyOverlaySurfaces() override;
77 
78  std::unique_ptr<std::vector<std::string>>
80  std::vector<std::string> supported_locales_data) override;
81 
82  double GetDisplayRefreshRate() override;
83 
84  bool RequestDartDeferredLibrary(int loading_unit_id) override;
85 
86  private:
87  // Reference to FlutterJNI object.
88  const fml::jni::JavaObjectWeakGlobalRef java_object_;
89 
90  FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroidJNIImpl);
91 };
92 
93 } // namespace flutter
94 
95 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_IMPL_H_
void FlutterViewBeginFrame() override
Initiates a frame if using hybrid composition.
Concrete implementation of PlatformViewAndroidJNI that is compiled with the Android toolchain...
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 FlutterViewUpdateCustomAccessibilityActions(std::vector< uint8_t > actions_buffer, std::vector< std::string > strings) override
Sends new custom accessibility events.
void FlutterViewEndFrame() override
Indicates that the current frame ended. It&#39;s used to clean up state.
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.
void FlutterViewOnPreEngineRestart() override
Indicates that a hot restart is about to happen.
void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture) override
Updates the texture image to the most recent frame from the image stream.
PlatformViewAndroidJNIImpl(fml::jni::JavaObjectWeakGlobalRef java_object)
void SurfaceTextureAttachToGLContext(JavaLocalRef surface_texture, int textureId) override
Attach the SurfaceTexture to the OpenGL ES context that is current on the calling thread...
void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture) override
Detaches a SurfaceTexture from the OpenGL ES context.
void FlutterViewDisplayOverlaySurface(int surface_id, int x, int y, int width, int height) override
Positions and sizes an overlay surface in hybrid composition.
std::unique_ptr< std::vector< std::string > > FlutterViewComputePlatformResolvedLocale(std::vector< std::string > supported_locales_data) override
Computes the locale Android would select.
int32_t width
int32_t height
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 FlutterViewOnFirstFrame() override
Indicates that FlutterView should start painting pixels.
static const uint8_t buffer[]
void FlutterViewHandlePlatformMessage(std::unique_ptr< flutter::PlatformMessage > message, int responseId) override
Sends a platform message. The message may be empty.
void FlutterViewDestroyOverlaySurfaces() override
Destroys the overlay surfaces.
std::nullptr_t JavaLocalRef
void FlutterViewHandlePlatformMessageResponse(int responseId, std::unique_ptr< fml::Mapping > data) override
Responds to a platform message. The data may be a nullptr.
bool RequestDartDeferredLibrary(int loading_unit_id) override