Decouple SurfaceTexture from HWUI
Remove all Skia and HWUI types from SurfaceTexture
implementation.
Move SurfaceTexture to libgui (ag/9578265).
Define private C++ API for SurfaceTexture, which is consumed
by DeferredLayerUpdater.
Move AutoBackendTextureRelease/Skia code from SurfaceTexture
to HWUI.
Test: pass CtsUiRenderingTestCases and CtsViewTestCases
Bug: 136263580
Change-Id: I3f971bb490f64a3ac0b2a66a89ba935bf7f08213
diff --git a/native/android/surface_texture.cpp b/native/android/surface_texture.cpp
index ced279277..3049ec1 100644
--- a/native/android/surface_texture.cpp
+++ b/native/android/surface_texture.cpp
@@ -23,25 +23,19 @@
#include <gui/Surface.h>
+#include <gui/surfacetexture/surface_texture_platform.h>
+
#include <android_runtime/android_graphics_SurfaceTexture.h>
-#include "surfacetexture/SurfaceTexture.h"
-
using namespace android;
-struct ASurfaceTexture {
- sp<SurfaceTexture> consumer;
- sp<IGraphicBufferProducer> producer;
-};
-
ASurfaceTexture* ASurfaceTexture_fromSurfaceTexture(JNIEnv* env, jobject surfacetexture) {
if (!surfacetexture || !android_SurfaceTexture_isInstanceOf(env, surfacetexture)) {
return nullptr;
}
- ASurfaceTexture* ast = new ASurfaceTexture;
- ast->consumer = SurfaceTexture_getSurfaceTexture(env, surfacetexture);
- ast->producer = SurfaceTexture_getProducer(env, surfacetexture);
- return ast;
+ auto consumer = SurfaceTexture_getSurfaceTexture(env, surfacetexture);
+ auto producer = SurfaceTexture_getProducer(env, surfacetexture);
+ return ASurfaceTexture_create(consumer, producer);
}
ANativeWindow* ASurfaceTexture_acquireANativeWindow(ASurfaceTexture* st) {