Conditionally enable HardwareBuffer backed platform views (flutter/engine#44744)

On Android >= 29 we can use a more efficient platform view render target
This commit is contained in:
John McCutchan
2023-08-16 10:30:32 -07:00
committed by GitHub
parent 4676ed194b
commit 4620733d5c

View File

@@ -968,11 +968,12 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
private static PlatformViewRenderTarget makePlatformViewRenderTarget(
TextureRegistry textureRegistry) {
// TODO(johnmccutchan): Enable ImageReaderPlatformViewRenderTarget for public use.
if (false) {
if (Build.VERSION.SDK_INT >= 29) {
// Prefer ImageReader-based backend on versions >= 29.
final TextureRegistry.ImageTextureEntry textureEntry = textureRegistry.createImageTexture();
return new ImageReaderPlatformViewRenderTarget(textureEntry);
}
// Fallback to SurfaceTexture support on old phones.
final TextureRegistry.SurfaceTextureEntry textureEntry = textureRegistry.createSurfaceTexture();
return new SurfaceTexturePlatformViewRenderTarget(textureEntry);
}