Flutter Engine
The Flutter Engine
|
This is the Android owner of the core engine Shell. More...
#include <android_shell_holder.h>
Public Member Functions | |
AndroidShellHolder (const flutter::Settings &settings, std::shared_ptr< PlatformViewAndroidJNI > jni_facade) | |
~AndroidShellHolder () | |
bool | IsValid () const |
std::unique_ptr< AndroidShellHolder > | Spawn (std::shared_ptr< PlatformViewAndroidJNI > jni_facade, const std::string &entrypoint, const std::string &libraryUrl, const std::string &initial_route, const std::vector< std::string > &entrypoint_args) const |
This is a factory for a derived AndroidShellHolder from an existing AndroidShellHolder. More... | |
void | Launch (std::unique_ptr< APKAssetProvider > apk_asset_provider, const std::string &entrypoint, const std::string &libraryUrl, const std::vector< std::string > &entrypoint_args) |
const flutter::Settings & | GetSettings () const |
fml::WeakPtr< PlatformViewAndroid > | GetPlatformView () |
Rasterizer::Screenshot | Screenshot (Rasterizer::ScreenshotType type, bool base64_encode) |
void | NotifyLowMemoryWarning () |
const std::shared_ptr< PlatformMessageHandler > & | GetPlatformMessageHandler () const |
void | UpdateDisplayMetrics () |
This is the Android owner of the core engine Shell.
This is the top orchestrator class on the C++ side for the Android embedding. It corresponds to a FlutterEngine on the Java side. This class is in C++ because the Shell is in C++ and an Android orchestrator needs to exist to compose it with other Android specific C++ components such as the PlatformViewAndroid. This composition of many-to-one C++ components would be difficult to do through JNI whereas a FlutterEngine and AndroidShellHolder has a 1:1 relationship.
Technically, the FlutterJNI class owns this AndroidShellHolder class instance, but the FlutterJNI class is meant to be mostly static and has minimal state to perform the C++ pointer <-> Java class instance translation.
Definition at line 42 of file android_shell_holder.h.
flutter::AndroidShellHolder::AndroidShellHolder | ( | const flutter::Settings & | settings, |
std::shared_ptr< PlatformViewAndroidJNI > | jni_facade | ||
) |
Definition at line 85 of file android_shell_holder.cc.
flutter::AndroidShellHolder::~AndroidShellHolder | ( | ) |
Definition at line 199 of file android_shell_holder.cc.
|
inline |
Definition at line 101 of file android_shell_holder.h.
fml::WeakPtr< PlatformViewAndroid > flutter::AndroidShellHolder::GetPlatformView | ( | ) |
Definition at line 304 of file android_shell_holder.cc.
const flutter::Settings & flutter::AndroidShellHolder::GetSettings | ( | ) | const |
Definition at line 208 of file android_shell_holder.cc.
bool flutter::AndroidShellHolder::IsValid | ( | ) | const |
Definition at line 204 of file android_shell_holder.cc.
void flutter::AndroidShellHolder::Launch | ( | std::unique_ptr< APKAssetProvider > | apk_asset_provider, |
const std::string & | entrypoint, | ||
const std::string & | libraryUrl, | ||
const std::vector< std::string > & | entrypoint_args | ||
) |
Definition at line 276 of file android_shell_holder.cc.
void flutter::AndroidShellHolder::NotifyLowMemoryWarning | ( | ) |
Definition at line 309 of file android_shell_holder.cc.
Rasterizer::Screenshot flutter::AndroidShellHolder::Screenshot | ( | Rasterizer::ScreenshotType | type, |
bool | base64_encode | ||
) |
Definition at line 294 of file android_shell_holder.cc.
std::unique_ptr< AndroidShellHolder > flutter::AndroidShellHolder::Spawn | ( | std::shared_ptr< PlatformViewAndroidJNI > | jni_facade, |
const std::string & | entrypoint, | ||
const std::string & | libraryUrl, | ||
const std::string & | initial_route, | ||
const std::vector< std::string > & | entrypoint_args | ||
) | const |
This is a factory for a derived AndroidShellHolder from an existing AndroidShellHolder.
Creates one Shell from another Shell where the created Shell takes the opportunity to share any internal components it can. This results is a Shell that has a smaller startup time cost and a smaller memory footprint than an Shell created with a Create function.
The new Shell is returned in a new AndroidShellHolder instance.
The new Shell's flutter::Settings cannot be changed from that of the initial Shell. The RunConfiguration subcomponent can be changed however in the spawned Shell to run a different entrypoint than the existing shell.
Since the AndroidShellHolder both binds downwards to a Shell and also upwards to JNI callbacks that the PlatformViewAndroid makes, the JNI instance holding this AndroidShellHolder should be created first to supply the jni_facade callback.
[in] | jni_facade | this argument should be the JNI callback facade of a new JNI instance meant to hold this AndroidShellHolder. |
Definition at line 212 of file android_shell_holder.cc.
void flutter::AndroidShellHolder::UpdateDisplayMetrics | ( | ) |
Definition at line 349 of file android_shell_holder.cc.