am 445a9785: Merge "don\'t hardcode "mSurface" throughout our source code" into kraken
This commit is contained in:
@@ -139,14 +139,14 @@ 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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <surfaceflinger/ISurface.h>
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
|
||||
#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface"
|
||||
|
||||
namespace android {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user