diff options
author | tedbo <tedbo@google.com> | 2011-06-06 16:02:47 -0700 |
---|---|---|
committer | tedbo <tedbo@google.com> | 2011-06-09 11:59:23 -0700 |
commit | 050316184b01c0d1a01c46afae7429b89a27c31b (patch) | |
tree | b21b202cd5345f3989b512b74b227f3fc910383a /native | |
parent | 890e013c05ed62bea9781168f3f65efebcbac4d5 (diff) | |
download | frameworks_base-050316184b01c0d1a01c46afae7429b89a27c31b.zip frameworks_base-050316184b01c0d1a01c46afae7429b89a27c31b.tar.gz frameworks_base-050316184b01c0d1a01c46afae7429b89a27c31b.tar.bz2 |
Add ParcelSurfaceTexture Java class to enable ISurfaceTexture sharing via Binder.
This adds a new ParcelSurfaceTexture.java class that can be instantiated with
a SurfaceTexture and used to send the corresponding ISurfaceTexture interface
to another process via Binder. The ParcelSurfaceTexture java object can then
be used to create an ANativeWindow based on the SurfaceTextureClient interface.
Change-Id: Ie38ea948b866e52f36a6d0f6cde19b54a8546817
Diffstat (limited to 'native')
-rw-r--r-- | native/android/native_window.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/native/android/native_window.cpp b/native/android/native_window.cpp index 8d42edb..2c0e88e 100644 --- a/native/android/native_window.cpp +++ b/native/android/native_window.cpp @@ -20,12 +20,20 @@ #include <android/native_window_jni.h> #include <surfaceflinger/Surface.h> #include <android_runtime/android_view_Surface.h> +#include <android_runtime/android_graphics_ParcelSurfaceTexture.h> #include <android_runtime/android_graphics_SurfaceTexture.h> using namespace android; ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface) { - sp<ANativeWindow> win = android_Surface_getNativeWindow(env, surface); + sp<ANativeWindow> win; + if (android_Surface_isInstanceOf(env, surface)) { + win = android_Surface_getNativeWindow(env, surface); + } else if (android_SurfaceTexture_isInstanceOf(env, surface)) { + win = android_SurfaceTexture_getNativeWindow(env, surface); + } else if (android_ParcelSurfaceTexture_isInstanceOf(env, surface)) { + win = android_ParcelSurfaceTexture_getNativeWindow(env, surface); + } if (win != NULL) { win->incStrong((void*)ANativeWindow_acquire); } |