Refactor TextureLayer JNI to use only APEX APIs

Move ASurfaceTexture JNI implementation from libandroid to
libnativedisplay.
TextureLayer uses ASurfaceTexture_fromSurfaceTexture from
libnativedisplay instead of libandroid_runtime code.
libgui is no longer leaked through surface_texture_platform.h.
DeferredLayerUpdater uses ASurfaceTexture_release instead of
private ASurfaceTexture dtor.

Test: pass CtsUiRenderingTestCases and CtsViewTestCases
Bug: 147060713
Exempt-From-Owner-Approval: Changed only a header path in android_hardware_camera2_legacy_LegacyCameraDevice.cpp
Change-Id: I9720d9c383f8120f9db116fd2b74fc241af84396
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index 289f65c..c44c0d5 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -21,8 +21,7 @@
 #include <SkMatrix.h>
 #include <android/hardware_buffer.h>
 #include <cutils/compiler.h>
-// TODO: Use public SurfaceTexture APIs once available and include public NDK header file instead.
-#include <gui/surfacetexture/surface_texture_platform.h>
+#include <android/surface_texture.h>
 
 #include <map>
 #include <memory>
@@ -37,7 +36,7 @@
 class AutoBackendTextureRelease;
 class RenderState;
 
-typedef std::unique_ptr<ASurfaceTexture> AutoTextureRelease;
+typedef std::unique_ptr<ASurfaceTexture, decltype(&ASurfaceTexture_release)> AutoTextureRelease;
 
 // Container to hold the properties a layer should be set to at the start
 // of a render pass