summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_Surface.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-12-02 23:31:52 -0800
committerDianne Hackborn <hackbod@google.com>2011-12-03 11:16:49 -0800
commit61566cc1932468720a831ad5cbc68ee080d613c9 (patch)
treed0626fc87db6c487b77361cf9b2abd4a5f5a9957 /core/jni/android_view_Surface.cpp
parentf57c1388860486a70cc773f2cfeaa3ea3b38a473 (diff)
downloadframeworks_base-61566cc1932468720a831ad5cbc68ee080d613c9.zip
frameworks_base-61566cc1932468720a831ad5cbc68ee080d613c9.tar.gz
frameworks_base-61566cc1932468720a831ad5cbc68ee080d613c9.tar.bz2
Fix issue #5614559: Registering surface error in...
...Background Replacement on Stingray This is how I should have done it in the first place. We get the new surface from the window manager, and then just copy it in to the constant Surface object we have for the holder. Change-Id: I537a9e413829a18f689dfb46687014676b27156e
Diffstat (limited to 'core/jni/android_view_Surface.cpp')
-rw-r--r--core/jni/android_view_Surface.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 49441eb..bba4b47 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -752,6 +752,25 @@ static void Surface_copyFrom(
}
}
+static void Surface_transferFrom(
+ JNIEnv* env, jobject clazz, jobject other)
+{
+ if (clazz == other)
+ return;
+
+ if (other == NULL) {
+ doThrowNPE(env);
+ return;
+ }
+
+ sp<SurfaceControl> control(getSurfaceControl(env, other));
+ sp<Surface> surface(Surface_getSurface(env, other));
+ setSurfaceControl(env, clazz, control);
+ setSurface(env, clazz, surface);
+ setSurfaceControl(env, other, 0);
+ setSurface(env, other, 0);
+}
+
static void Surface_readFromParcel(
JNIEnv* env, jobject clazz, jobject argParcel)
{
@@ -820,6 +839,7 @@ static JNINativeMethod gSurfaceMethods[] = {
{"destroy", "()V", (void*)Surface_destroy },
{"release", "()V", (void*)Surface_release },
{"copyFrom", "(Landroid/view/Surface;)V", (void*)Surface_copyFrom },
+ {"transferFrom", "(Landroid/view/Surface;)V", (void*)Surface_transferFrom },
{"isValid", "()Z", (void*)Surface_isValid },
{"lockCanvasNative", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", (void*)Surface_lockCanvas },
{"unlockCanvasAndPost", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvasAndPost },