未验证 提交 7004e065 编写于 作者: J Jason Simmons 提交者: GitHub

Re-land "Hold a global reference to the AssetManager Java object backing the...

Re-land "Hold a global reference to the AssetManager Java object backing the APKAssetProvider" (#5132)

Fixes https://github.com/flutter/flutter/issues/16222
上级 3ff14445
......@@ -10,7 +10,8 @@ namespace blink {
APKAssetProvider::APKAssetProvider(JNIEnv* env,
jobject jassetManager,
std::string directory)
: directory_(std::move(directory)) {
: java_asset_manager_(env, jassetManager),
directory_(std::move(directory)) {
assetManager_ = AAssetManager_fromJava(env, jassetManager);
}
......
......@@ -9,6 +9,7 @@
#include <jni.h>
#include "flutter/assets/asset_resolver.h"
#include "flutter/fml/platform/android/scoped_java_ref.h"
#include "lib/fxl/memory/ref_counted.h"
namespace blink {
......@@ -21,6 +22,7 @@ class APKAssetProvider final : public AssetResolver {
virtual ~APKAssetProvider();
private:
fml::jni::ScopedJavaGlobalRef<jobject> java_asset_manager_;
AAssetManager* assetManager_;
const std::string directory_;
......@@ -36,4 +38,4 @@ class APKAssetProvider final : public AssetResolver {
} // namespace blink
#endif // FLUTTER_ASSETS_APK_ASSET_PROVIDER_H
\ No newline at end of file
#endif // FLUTTER_ASSETS_APK_ASSET_PROVIDER_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册