Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 291a519

Browse files
committed
Disable partial redraw for older devices
1 parent 6fd53dd commit 291a519

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

shell/platform/android/android_context_gl.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#include <list>
1010
#include <utility>
1111

12+
// required to get API level
13+
#include <sys/system_properties.h>
14+
1215
#include "flutter/fml/trace_event.h"
1316

1417
namespace flutter {
@@ -109,6 +112,14 @@ static bool TeardownContext(EGLDisplay display, EGLContext context) {
109112
class AndroidEGLSurfaceDamage {
110113
public:
111114
void init(EGLDisplay display, EGLContext context) {
115+
if (GetAPILevel() < 29) {
116+
// Disable partial repaint for devices older than Android 10. There
117+
// are old devices that have extensions below available but the
118+
// implementation causes glitches (i.e. Xperia Z3 with Android 6).
119+
partial_redraw_supported_ = false;
120+
return;
121+
}
122+
112123
const char* extensions = eglQueryString(display, EGL_EXTENSIONS);
113124

114125
if (HasExtension(extensions, "EGL_KHR_partial_update")) {
@@ -130,6 +141,15 @@ class AndroidEGLSurfaceDamage {
130141
set_damage_region_ != nullptr && swap_buffers_with_damage_ != nullptr;
131142
}
132143

144+
static int GetAPILevel() {
145+
char sdk_version_string[PROP_VALUE_MAX];
146+
if (__system_property_get("ro.build.version.sdk", sdk_version_string)) {
147+
return atoi(sdk_version_string);
148+
} else {
149+
return -1;
150+
}
151+
}
152+
133153
void SetDamageRegion(EGLDisplay display,
134154
EGLSurface surface,
135155
const std::optional<SkIRect>& region) {

0 commit comments

Comments
 (0)