diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 3e464c61665ff..73dc65643a8bd 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -131,13 +131,6 @@ sp SurfaceTexture_getProducer(JNIEnv* env, jobject thiz) return (IGraphicBufferProducer*)env->GetLongField(thiz, fields.producer); } -sp android_SurfaceTexture_getNativeWindow(JNIEnv* env, jobject thiz) { - sp surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); - sp producer(SurfaceTexture_getProducer(env, thiz)); - sp surfaceTextureClient(surfaceTexture != NULL ? new Surface(producer) : NULL); - return surfaceTextureClient; -} - bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz) { jclass surfaceTextureClass = env->FindClass(kSurfaceTextureClassPathName); return env->IsInstanceOf(thiz, surfaceTextureClass); diff --git a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp index 719cf74a451de..87adbe8102c64 100644 --- a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp +++ b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp @@ -26,6 +26,7 @@ #include "core_jni_helpers.h" #include "android_runtime/android_view_Surface.h" #include "android_runtime/android_graphics_SurfaceTexture.h" +#include "surfacetexture/SurfaceTexture.h" #include #include @@ -394,10 +395,17 @@ static sp getNativeWindow(JNIEnv* env, jobject surface) { return anw; } +static sp getSurfaceTextureNativeWindow(JNIEnv* env, jobject thiz) { + sp surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp producer(SurfaceTexture_getProducer(env, thiz)); + sp surfaceTextureClient(surfaceTexture != NULL ? new Surface(producer) : NULL); + return surfaceTextureClient; +} + static sp getNativeWindowFromTexture(JNIEnv* env, jobject surfaceTexture) { sp anw; if (surfaceTexture) { - anw = android_SurfaceTexture_getNativeWindow(env, surfaceTexture); + anw = getSurfaceTextureNativeWindow(env, surfaceTexture); if (env->ExceptionCheck()) { return NULL; } diff --git a/core/jni/include/android_runtime/android_graphics_SurfaceTexture.h b/core/jni/include/android_runtime/android_graphics_SurfaceTexture.h index 0ad25876a0085..d3ff959e3ba79 100644 --- a/core/jni/include/android_runtime/android_graphics_SurfaceTexture.h +++ b/core/jni/include/android_runtime/android_graphics_SurfaceTexture.h @@ -17,8 +17,6 @@ #ifndef _ANDROID_GRAPHICS_SURFACETEXTURE_H #define _ANDROID_GRAPHICS_SURFACETEXTURE_H -#include - #include "jni.h" namespace android { @@ -26,7 +24,6 @@ namespace android { class IGraphicBufferProducer; class SurfaceTexture; -extern sp android_SurfaceTexture_getNativeWindow(JNIEnv* env, jobject thiz); extern bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz); /* Gets the underlying C++ SurfaceTexture object from a SurfaceTexture Java object. */