From 3f50f56235c3f9a025912451d57725db65c7b65a Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 7 Oct 2024 13:10:16 -0700 Subject: [PATCH] [Impeller] disable surface control on API 29. (flutter/engine#55708) Fixes https://github.com/flutter/flutter/issues/155877 Technically SurfaceControl is supported on API 29 but I've observed enough reported bugs that I'm bumping the constraint to 30. If we had more time to test all of these older devices maybe we could figure out if the problem is something that can be worked around. --- .../flutter/impeller/toolkit/android/surface_control.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/impeller/toolkit/android/surface_control.cc b/engine/src/flutter/impeller/toolkit/android/surface_control.cc index 71282e7ccc..b2edd7efd3 100644 --- a/engine/src/flutter/impeller/toolkit/android/surface_control.cc +++ b/engine/src/flutter/impeller/toolkit/android/surface_control.cc @@ -48,7 +48,14 @@ bool SurfaceControl::RemoveFromParent() const { } bool SurfaceControl::IsAvailableOnPlatform() { - return GetProcTable().IsValid() && + auto api_level = android_get_device_api_level(); + + // Technically SurfaceControl is supported on API 29 but I've observed + // enough reported bugs that I'm bumping the constraint to 30. If + // we had more time to test all of these older devices maybe we could + // figure out what the problem is. + // https://github.com/flutter/flutter/issues/155877 + return api_level >= 30 && GetProcTable().IsValid() && GetProcTable().ASurfaceControl_createFromWindow.IsAvailable(); }