summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_Surface.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-01-18 18:28:21 -0800
committerRomain Guy <romainguy@google.com>2011-01-18 18:28:21 -0800
commit2a83f001fdb189f945e82e81e717ba204824b112 (patch)
tree120d3f24ea78b1db763452a4975351aa028dc826 /core/jni/android_view_Surface.cpp
parentea6a3c706ada7db1abeda609aa5d1ba9209c7f2b (diff)
downloadframeworks_base-2a83f001fdb189f945e82e81e717ba204824b112.zip
frameworks_base-2a83f001fdb189f945e82e81e717ba204824b112.tar.gz
frameworks_base-2a83f001fdb189f945e82e81e717ba204824b112.tar.bz2
Recreate the EGL surface when ViewRoot's surface changes.
Bug #3306150 Change-Id: Ifbf0ab9deca7a34eff7d844ea7276d12d7284788
Diffstat (limited to 'core/jni/android_view_Surface.cpp')
-rw-r--r--core/jni/android_view_Surface.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 8c30987..e4af33f 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -61,6 +61,7 @@ static sso_t sso;
struct so_t {
jfieldID surfaceControl;
+ jfieldID surfaceGenerationId;
jfieldID surface;
jfieldID saveCount;
jfieldID canvas;
@@ -189,6 +190,12 @@ static void setSurface(JNIEnv* env, jobject clazz, const sp<Surface>& surface)
p->decStrong(clazz);
}
env->SetIntField(clazz, so.surface, (int)surface.get());
+ // This test is conservative and it would be better to compare the ISurfaces
+ if (p && p != surface.get()) {
+ jint generationId = env->GetIntField(clazz, so.surfaceGenerationId);
+ generationId++;
+ env->SetIntField(clazz, so.surfaceGenerationId, generationId);
+ }
}
// ----------------------------------------------------------------------------
@@ -785,6 +792,7 @@ static JNINativeMethod gSurfaceMethods[] = {
void nativeClassInit(JNIEnv* env, jclass clazz)
{
so.surface = env->GetFieldID(clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I");
+ so.surfaceGenerationId = env->GetFieldID(clazz, "mSurfaceGenerationId", "I");
so.surfaceControl = env->GetFieldID(clazz, "mSurfaceControl", "I");
so.saveCount = env->GetFieldID(clazz, "mSaveCount", "I");
so.canvas = env->GetFieldID(clazz, "mCanvas", "Landroid/graphics/Canvas;");