summaryrefslogtreecommitdiff
path: root/core/jni/include
diff options
context:
space:
mode:
authorJiwen 'Steve' Cai <jwcai@google.com>2017-03-31 11:19:50 -0700
committerJiwen 'Steve' Cai <jwcai@google.com>2017-04-03 19:13:31 -0700
commitd28e8283d39e7eb6c714511a0430d4cc836298cb (patch)
treee83bd8cf3a0f4d3d4eef9aa10d978b783b22414c /core/jni/include
parentb43a5305bddb81881992819a40846b52e72afd3e (diff)
ANativeWindow_toSurface implementation
This enables the conversion from an ANativeWindow (created by NDK API such as: AImageReader_create) to a Java Surface, so that developers can hookup a Java Producer to a native buffer consumer. This CL also introduces android_view_Surface_createFromSurface helper function in libandroid_runtime to convert a C++ sp<Surface> to a Java Surface object. Bug: 36862948 Test: android.media.cts.NativeImageReaderTest Change-Id: Ia99adb654da505ac117a8e58153ac800df23a650
Diffstat (limited to 'core/jni/include')
-rw-r--r--core/jni/include/android_runtime/android_view_Surface.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/jni/include/android_runtime/android_view_Surface.h b/core/jni/include/android_runtime/android_view_Surface.h
index 3f1bdff81aef..2641ab8f0337 100644
--- a/core/jni/include/android_runtime/android_view_Surface.h
+++ b/core/jni/include/android_runtime/android_view_Surface.h
@@ -69,6 +69,10 @@ extern bool android_view_Surface_isInstanceOf(JNIEnv* env, jobject obj);
/* Gets the underlying Surface from a Surface Java object. */
extern sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj);
+/* Creates a Surface from an android::Surface. */
+extern jobject android_view_Surface_createFromSurface(JNIEnv* env,
+ const sp<Surface>& surface);
+
/* Creates a Surface from an IGraphicBufferProducer. */
extern jobject android_view_Surface_createFromIGraphicBufferProducer(JNIEnv* env,
const sp<IGraphicBufferProducer>& bufferProducer);