summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/jni/android/graphics/ParcelSurfaceTexture.cpp19
-rw-r--r--core/jni/android_view_Surface.cpp7
2 files changed, 22 insertions, 4 deletions
diff --git a/core/jni/android/graphics/ParcelSurfaceTexture.cpp b/core/jni/android/graphics/ParcelSurfaceTexture.cpp
index 40966e1..754485f 100644
--- a/core/jni/android/graphics/ParcelSurfaceTexture.cpp
+++ b/core/jni/android/graphics/ParcelSurfaceTexture.cpp
@@ -17,9 +17,11 @@
#define LOG_TAG "ParcelSurfaceTexture"
#include <gui/SurfaceTextureClient.h>
+#include <surfaceflinger/Surface.h>
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
+#include <android_runtime/android_view_Surface.h>
#include <utils/Log.h>
@@ -96,7 +98,16 @@ static void ParcelSurfaceTexture_classInit(JNIEnv* env, jclass clazz)
}
}
-static void ParcelSurfaceTexture_init(JNIEnv* env, jobject thiz, jobject jSurfaceTexture)
+static void ParcelSurfaceTexture_initFromSurface(
+ JNIEnv* env, jobject thiz, jobject jSurface)
+{
+ sp<Surface> surface(Surface_getSurface(env, jSurface));
+ sp<ISurfaceTexture> iSurfaceTexture(surface->getSurfaceTexture());
+ ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture);
+}
+
+static void ParcelSurfaceTexture_initFromSurfaceTexture(
+ JNIEnv* env, jobject thiz, jobject jSurfaceTexture)
{
sp<ISurfaceTexture> iSurfaceTexture(
SurfaceTexture_getSurfaceTexture(env, jSurfaceTexture));
@@ -131,8 +142,10 @@ static void ParcelSurfaceTexture_readFromParcel(
static JNINativeMethod gParcelSurfaceTextureMethods[] = {
{"nativeClassInit", "()V", (void*)ParcelSurfaceTexture_classInit },
- {"nativeInit", "(Landroid/graphics/SurfaceTexture;)V",
- (void *)ParcelSurfaceTexture_init },
+ {"nativeInitFromSurface", "(Landroid/view/Surface;)V",
+ (void *)ParcelSurfaceTexture_initFromSurface },
+ {"nativeInitFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)V",
+ (void *)ParcelSurfaceTexture_initFromSurfaceTexture },
{ "nativeFinalize", "()V", (void *)ParcelSurfaceTexture_finalize },
{ "nativeWriteToParcel", "(Landroid/os/Parcel;I)V",
(void *)ParcelSurfaceTexture_writeToParcel },
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 70c2f7b..0dc9293 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -156,7 +156,7 @@ static void setSurfaceControl(JNIEnv* env, jobject clazz,
static sp<Surface> getSurface(JNIEnv* env, jobject clazz)
{
- sp<Surface> result((Surface*)env->GetIntField(clazz, so.surface));
+ sp<Surface> result(Surface_getSurface(env, clazz));
if (result == 0) {
/*
* if this method is called from the WindowManager's process, it means
@@ -189,6 +189,11 @@ bool android_Surface_isInstanceOf(JNIEnv* env, jobject obj) {
return env->IsInstanceOf(obj, surfaceClass);
}
+sp<Surface> Surface_getSurface(JNIEnv* env, jobject clazz) {
+ sp<Surface> surface((Surface*)env->GetIntField(clazz, so.surface));
+ return surface;
+}
+
static void setSurface(JNIEnv* env, jobject clazz, const sp<Surface>& surface)
{
Surface* const p = (Surface*)env->GetIntField(clazz, so.surface);