Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6ec7d4

Browse files
author
Jonah Williams
authored
[android] only release background image readers on Android 14. (#165942)
Fixes#163561Fixes#156488Fixes#156489Fixes#163520Forked from#163692Only release background image readers on Android 14. I believe readerdisposal is the ultimate cause of#162147 , where older androiddevices don't seem to handle backgrounding the same way we expect onnewer devices. The result of this is a crash in HWUI, which isunexpected.Since we only ever did the background release to work around an ANdroid14 bug, and because it breaks other functionality like backgroundplayback - we should remove it for all targets besides 14.
1 parenta59795e commitd6ec7d4

19 files changed

+141
-76
lines changed

‎engine/src/flutter/shell/platform/android/image_external_texture.cc‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ namespace flutter {
1616
ImageExternalTexture::ImageExternalTexture(
1717
int64_t id,
1818
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
19-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
19+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
20+
ImageLifecycle lifecycle)
2021
: Texture(id),
2122
image_texture_entry_(image_texture_entry),
22-
jni_facade_(jni_facade) {}
23+
jni_facade_(jni_facade),
24+
texture_lifecycle_(lifecycle) {}
2325

2426
ImageExternalTexture::~ImageExternalTexture() =default;
2527

@@ -66,8 +68,19 @@ void ImageExternalTexture::OnGrContextCreated() {
6668
// Implementing flutter::ContextListener.
6769
voidImageExternalTexture::OnGrContextDestroyed() {
6870
if (state_ == AttachmentState::kAttached) {
69-
dl_image_.reset();
70-
image_lru_.Clear();
71+
switch (texture_lifecycle_) {
72+
case ImageLifecycle::kReset: {
73+
dl_image_.reset();
74+
image_lru_.Clear();
75+
}break;
76+
case ImageLifecycle::kKeepAlive:
77+
// Intentionally do nothing.
78+
///
79+
// If we reset the image, we are not able to re-acquire it, but the
80+
// producer of the image will not know to reproduce it, resulting in a
81+
// blank image. See https://github.com/flutter/flutter/issues/163561.
82+
break;
83+
}
7184
Detach();
7285
}
7386
state_ = AttachmentState::kDetached;

‎engine/src/flutter/shell/platform/android/image_external_texture.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ namespace flutter {
3535
///
3636
classImageExternalTexture :publicflutter::Texture {
3737
public:
38+
/// Whether the last image should be reset when the context is destroyed.
39+
enumclassImageLifecycle {kReset,kKeepAlive };
40+
3841
explicitImageExternalTexture(
3942
int64_t id,
4043
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
41-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
44+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
45+
ImageLifecycle lifecycle);
4246

4347
// |flutter::Texture|
4448
virtual~ImageExternalTexture();
@@ -100,6 +104,7 @@ class ImageExternalTexture : public flutter::Texture {
100104
// |flutter::ContextListener|
101105
voidOnGrContextDestroyed()override;
102106

107+
const ImageLifecycle texture_lifecycle_;
103108
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTexture);
104109
};
105110

‎engine/src/flutter/shell/platform/android/image_external_texture_gl.cc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ namespace flutter {
2424
ImageExternalTextureGL::ImageExternalTextureGL(
2525
int64_t id,
2626
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
27-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
28-
: ImageExternalTexture(id, image_texture_entry, jni_facade) {}
27+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
28+
ImageExternalTexture::ImageLifecycle lifecycle)
29+
: ImageExternalTexture(id, image_texture_entry, jni_facade, lifecycle) {}
2930

3031
voidImageExternalTextureGL::Attach(PaintContext& context) {
3132
if (state_ == AttachmentState::kUninitialized) {

‎engine/src/flutter/shell/platform/android/image_external_texture_gl.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class ImageExternalTextureGL : public ImageExternalTexture {
2020
ImageExternalTextureGL(
2121
int64_t id,
2222
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
23-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
23+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
24+
ImageExternalTexture::ImageLifecycle lifecycle);
2425

2526
protected:
2627
// |ImageExternalTexture|

‎engine/src/flutter/shell/platform/android/image_external_texture_gl_impeller.cc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ ImageExternalTextureGLImpeller::ImageExternalTextureGLImpeller(
1313
const std::shared_ptr<impeller::ContextGLES>& context,
1414
int64_t id,
1515
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
16-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
17-
: ImageExternalTextureGL(id, image_textury_entry, jni_facade),
16+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
17+
ImageExternalTexture::ImageLifecycle lifecycle)
18+
: ImageExternalTextureGL(id, image_textury_entry, jni_facade, lifecycle),
1819
impeller_context_(context) {}
1920

2021
voidImageExternalTextureGLImpeller::Detach() {}

‎engine/src/flutter/shell/platform/android/image_external_texture_gl_impeller.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class ImageExternalTextureGLImpeller : public ImageExternalTextureGL {
2222
int64_t id,
2323
const fml::jni::ScopedJavaGlobalRef<jobject>&
2424
hardware_buffer_texture_entry,
25-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
25+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
26+
ImageExternalTexture::ImageLifecycle lifecycle);
2627

2728
private:
2829
// |ImageExternalTexture|

‎engine/src/flutter/shell/platform/android/image_external_texture_gl_skia.cc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ ImageExternalTextureGLSkia::ImageExternalTextureGLSkia(
1313
const std::shared_ptr<AndroidContextGLSkia>& context,
1414
int64_t id,
1515
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
16-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
17-
: ImageExternalTextureGL(id, image_texture_entry, jni_facade) {}
16+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
17+
ImageExternalTexture::ImageLifecycle lifecycle)
18+
: ImageExternalTextureGL(id, image_texture_entry, jni_facade, lifecycle) {}
1819

1920
voidImageExternalTextureGLSkia::Attach(PaintContext& context) {
2021
if (state_ == AttachmentState::kUninitialized) {

‎engine/src/flutter/shell/platform/android/image_external_texture_gl_skia.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class ImageExternalTextureGLSkia : public ImageExternalTextureGL {
1919
const std::shared_ptr<AndroidContextGLSkia>& context,
2020
int64_t id,
2121
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
22-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
22+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
23+
ImageExternalTexture::ImageLifecycle lifecycle);
2324

2425
private:
2526
// |ImageExternalTexture|

‎engine/src/flutter/shell/platform/android/image_external_texture_vk_impeller.cc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ ImageExternalTextureVKImpeller::ImageExternalTextureVKImpeller(
2020
const std::shared_ptr<impeller::ContextVK>& impeller_context,
2121
int64_t id,
2222
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
23-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
24-
: ImageExternalTexture(id, image_texture_entry, jni_facade),
23+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
24+
ImageExternalTexture::ImageLifecycle lifecycle)
25+
: ImageExternalTexture(id, image_texture_entry, jni_facade, lifecycle),
2526
impeller_context_(impeller_context) {}
2627

2728
ImageExternalTextureVKImpeller::~ImageExternalTextureVKImpeller() {}

‎engine/src/flutter/shell/platform/android/image_external_texture_vk_impeller.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class ImageExternalTextureVKImpeller : public ImageExternalTexture {
2323
int64_t id,
2424
const fml::jni::ScopedJavaGlobalRef<jobject>&
2525
hardware_buffer_texture_entry,
26-
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
26+
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
27+
ImageExternalTexture::ImageLifecycle lifecycle);
2728

2829
~ImageExternalTextureVKImpeller()override;
2930

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp