diff options
author | Mathias Agopian <mathias@google.com> | 2010-04-12 16:22:15 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-04-12 16:29:36 -0700 |
commit | 8b138323d54e36fd66b22a634494648e20c53373 (patch) | |
tree | e403ffb6131b32a5156e5f9868e0ae1408c96128 | |
parent | 5c7a69c3d6f41f60f4bfc3f7e3123941d382f3a7 (diff) | |
download | frameworks_base-8b138323d54e36fd66b22a634494648e20c53373.zip frameworks_base-8b138323d54e36fd66b22a634494648e20c53373.tar.gz frameworks_base-8b138323d54e36fd66b22a634494648e20c53373.tar.bz2 |
don't hardcode "mSurface" throughout our source code
this is used in a few places to get access to the android.view.Surface
native surface. use a macro instead. Also rename the field to mNativeSurface.
Change-Id: I1c6dea14abd6b8b1392c7f97b304115999355094
-rw-r--r-- | core/java/android/view/Surface.java | 10 | ||||
-rw-r--r-- | core/jni/android_hardware_Camera.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_view_Surface.cpp | 3 | ||||
-rw-r--r-- | core/jni/com_google_android_gles_jni_EGLImpl.cpp | 2 | ||||
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 2 | ||||
-rw-r--r-- | include/surfaceflinger/Surface.h | 2 | ||||
-rw-r--r-- | media/jni/android_media_MediaPlayer.cpp | 2 | ||||
-rw-r--r-- | media/jni/android_media_MediaRecorder.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/IOMX.cpp | 2 |
9 files changed, 15 insertions, 12 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 255e317..cde20e4 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -140,13 +140,13 @@ public class Surface implements Parcelable { public static final int FLAGS_ORIENTATION_ANIMATION_DISABLE = 0x000000001; @SuppressWarnings("unused") - private int mSurface; - @SuppressWarnings("unused") private int mSurfaceControl; @SuppressWarnings("unused") private int mSaveCount; @SuppressWarnings("unused") private Canvas mCanvas; + @SuppressWarnings("unused") + private int mNativeSurface; // The display metrics used to provide the pseudo canvas size for applications // running in compatibility mode. This is set to null for non compatibility mode. @@ -420,13 +420,13 @@ public class Surface implements Parcelable { /* no user serviceable parts here ... */ @Override protected void finalize() throws Throwable { - if (mSurface != 0 || mSurfaceControl != 0) { + if (mNativeSurface != 0 || mSurfaceControl != 0) { if (DEBUG_RELEASE) { Log.w(LOG_TAG, "Surface.finalize() has work. You should have called release() (" - + mSurface + ", " + mSurfaceControl + ")", mCreationStack); + + mNativeSurface + ", " + mSurfaceControl + ")", mCreationStack); } else { Log.w(LOG_TAG, "Surface.finalize() has work. You should have called release() (" - + mSurface + ", " + mSurfaceControl + ")"); + + mNativeSurface + ", " + mSurfaceControl + ")"); } } release(); diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index b85466b..6c27841 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -659,7 +659,7 @@ int register_android_hardware_Camera(JNIEnv *env) { field fields_to_find[] = { { "android/hardware/Camera", "mNativeContext", "I", &fields.context }, - { "android/view/Surface", "mSurface", "I", &fields.surface } + { "android/view/Surface", ANDROID_VIEW_SURFACE_JNI_ID, "I", &fields.surface } }; if (find_fields(env, fields_to_find, NELEM(fields_to_find)) < 0) diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index ed26cbe..817f0c5 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -19,6 +19,7 @@ #include "android_util_Binder.h" #include <surfaceflinger/SurfaceComposerClient.h> +#include <surfaceflinger/Surface.h> #include <ui/Region.h> #include <ui/Rect.h> @@ -670,7 +671,7 @@ static JNINativeMethod gSurfaceMethods[] = { void nativeClassInit(JNIEnv* env, jclass clazz) { - so.surface = env->GetFieldID(clazz, "mSurface", "I"); + so.surface = env->GetFieldID(clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I"); so.surfaceControl = env->GetFieldID(clazz, "mSurfaceControl", "I"); so.saveCount = env->GetFieldID(clazz, "mSaveCount", "I"); so.canvas = env->GetFieldID(clazz, "mCanvas", "Landroid/graphics/Canvas;"); diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 6a8c4b9..01a1504 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -96,7 +96,7 @@ static void nativeClassInit(JNIEnv *_env, jclass eglImplClass) gConfig_EGLConfigFieldID = _env->GetFieldID(gConfig_class, "mEGLConfig", "I"); jclass surface_class = _env->FindClass("android/view/Surface"); - gSurface_SurfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I"); + gSurface_SurfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I"); jclass bitmap_class = _env->FindClass("android/graphics/Bitmap"); gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "I"); diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index d8e0393..45cc72e 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -185,7 +185,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, jint width, jint height, jobject } else { jclass surface_class = _env->FindClass("android/view/Surface"); - jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I"); + jfieldID surfaceFieldID = _env->GetFieldID(surface_class, ANDROID_VIEW_SURFACE_JNI_ID, "I"); window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); } diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h index 0279d84..4c8d023 100644 --- a/include/surfaceflinger/Surface.h +++ b/include/surfaceflinger/Surface.h @@ -30,6 +30,8 @@ #include <surfaceflinger/ISurface.h> #include <surfaceflinger/ISurfaceFlingerClient.h> +#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface" + namespace android { // --------------------------------------------------------------------------- diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 8ed3730..60ff264 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -636,7 +636,7 @@ android_media_MediaPlayer_native_init(JNIEnv *env) return; } - fields.surface_native = env->GetFieldID(surface, "mSurface", "I"); + fields.surface_native = env->GetFieldID(surface, ANDROID_VIEW_SURFACE_JNI_ID, "I"); if (fields.surface_native == NULL) { jniThrowException(env, "java/lang/RuntimeException", "Can't find Surface.mSurface"); return; diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp index 00af3a2..8cf2e51 100644 --- a/media/jni/android_media_MediaRecorder.cpp +++ b/media/jni/android_media_MediaRecorder.cpp @@ -403,7 +403,7 @@ android_media_MediaRecorder_native_init(JNIEnv *env) return; } - fields.surface_native = env->GetFieldID(surface, "mSurface", "I"); + fields.surface_native = env->GetFieldID(surface, ANDROID_VIEW_SURFACE_JNI_ID, "I"); if (fields.surface_native == NULL) { jniThrowException(env, "java/lang/RuntimeException", "Can't find Surface.mSurface"); return; diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp index 01b6737..f3804b8 100644 --- a/media/libmedia/IOMX.cpp +++ b/media/libmedia/IOMX.cpp @@ -57,7 +57,7 @@ sp<IOMXRenderer> IOMX::createRendererFromJavaSurface( return NULL; } - jfieldID surfaceID = env->GetFieldID(surfaceClass, "mSurface", "I"); + jfieldID surfaceID = env->GetFieldID(surfaceClass, ANDROID_VIEW_SURFACE_JNI_ID, "I"); if (surfaceID == NULL) { LOGE("Can't find Surface.mSurface"); return NULL; |