am 8138cb49: Make Surface.toString() show more useful info to help debug bug 2594388.
Merge commit '8138cb49e47f9a9905a316a217757710185c66aa' into froyo-plus-aosp * commit '8138cb49e47f9a9905a316a217757710185c66aa': Make Surface.toString() show more useful info to help debug bug 2594388.
This commit is contained in:
@@ -147,6 +147,7 @@ public class Surface implements Parcelable {
|
|||||||
private int mSaveCount;
|
private int mSaveCount;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private Canvas mCanvas;
|
private Canvas mCanvas;
|
||||||
|
private String mName;
|
||||||
|
|
||||||
// The display metrics used to provide the pseudo canvas size for applications
|
// 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.
|
// running in compatibility mode. This is set to null for non compatibility mode.
|
||||||
@@ -204,6 +205,7 @@ public class Surface implements Parcelable {
|
|||||||
}
|
}
|
||||||
mCanvas = new CompatibleCanvas();
|
mCanvas = new CompatibleCanvas();
|
||||||
init(s,pid,name,display,w,h,format,flags);
|
init(s,pid,name,display,w,h,format,flags);
|
||||||
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -386,7 +388,7 @@ public class Surface implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Surface(native-token=" + mSurface + ")";
|
return "Surface(name=" + mName + ", identity=" + getIdentity() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
private Surface(Parcel source) throws OutOfResourcesException {
|
private Surface(Parcel source) throws OutOfResourcesException {
|
||||||
@@ -437,4 +439,6 @@ public class Surface implements Parcelable {
|
|||||||
throws OutOfResourcesException;
|
throws OutOfResourcesException;
|
||||||
|
|
||||||
private native void init(Parcel source);
|
private native void init(Parcel source);
|
||||||
|
|
||||||
|
private native int getIdentity();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,15 @@ static void Surface_initParcel(JNIEnv* env, jobject clazz, jobject argParcel)
|
|||||||
setSurface(env, clazz, rhs);
|
setSurface(env, clazz, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jint Surface_getIdentity(JNIEnv* env, jobject clazz)
|
||||||
|
{
|
||||||
|
const sp<SurfaceControl>& control(getSurfaceControl(env, clazz));
|
||||||
|
if (control != 0) return (jint) control->getIdentity();
|
||||||
|
const sp<Surface>& surface(getSurface(env, clazz));
|
||||||
|
if (surface != 0) return (jint) surface->getIdentity();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static void Surface_destroy(JNIEnv* env, jobject clazz, uintptr_t *ostack)
|
static void Surface_destroy(JNIEnv* env, jobject clazz, uintptr_t *ostack)
|
||||||
{
|
{
|
||||||
const sp<SurfaceControl>& surface(getSurfaceControl(env, clazz));
|
const sp<SurfaceControl>& surface(getSurfaceControl(env, clazz));
|
||||||
@@ -261,14 +270,14 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format)
|
|||||||
we can map to SkBitmap::kARGB_8888_Config, and optionally call
|
we can map to SkBitmap::kARGB_8888_Config, and optionally call
|
||||||
bitmap.setIsOpaque(true) on the resulting SkBitmap (as an accelerator)
|
bitmap.setIsOpaque(true) on the resulting SkBitmap (as an accelerator)
|
||||||
*/
|
*/
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case PIXEL_FORMAT_RGBX_8888: return SkBitmap::kARGB_8888_Config;
|
case PIXEL_FORMAT_RGBX_8888: return SkBitmap::kARGB_8888_Config;
|
||||||
case PIXEL_FORMAT_RGBA_8888: return SkBitmap::kARGB_8888_Config;
|
case PIXEL_FORMAT_RGBA_8888: return SkBitmap::kARGB_8888_Config;
|
||||||
case PIXEL_FORMAT_RGBA_4444: return SkBitmap::kARGB_4444_Config;
|
case PIXEL_FORMAT_RGBA_4444: return SkBitmap::kARGB_4444_Config;
|
||||||
case PIXEL_FORMAT_RGB_565: return SkBitmap::kRGB_565_Config;
|
case PIXEL_FORMAT_RGB_565: return SkBitmap::kRGB_565_Config;
|
||||||
case PIXEL_FORMAT_A_8: return SkBitmap::kA8_Config;
|
case PIXEL_FORMAT_A_8: return SkBitmap::kA8_Config;
|
||||||
default: return SkBitmap::kNo_Config;
|
default: return SkBitmap::kNo_Config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
|
static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
|
||||||
@@ -347,7 +356,7 @@ static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
|
|||||||
env->SetIntField(dirtyRect, ro.b, bounds.bottom);
|
env->SetIntField(dirtyRect, ro.b, bounds.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Surface_unlockCanvasAndPost(
|
static void Surface_unlockCanvasAndPost(
|
||||||
@@ -631,8 +640,8 @@ const char* const kSurfaceClassPathName = "android/view/Surface";
|
|||||||
static void nativeClassInit(JNIEnv* env, jclass clazz);
|
static void nativeClassInit(JNIEnv* env, jclass clazz);
|
||||||
|
|
||||||
static JNINativeMethod gSurfaceSessionMethods[] = {
|
static JNINativeMethod gSurfaceSessionMethods[] = {
|
||||||
{"init", "()V", (void*)SurfaceSession_init },
|
{"init", "()V", (void*)SurfaceSession_init },
|
||||||
{"destroy", "()V", (void*)SurfaceSession_destroy },
|
{"destroy", "()V", (void*)SurfaceSession_destroy },
|
||||||
{"kill", "()V", (void*)SurfaceSession_kill },
|
{"kill", "()V", (void*)SurfaceSession_kill },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -640,43 +649,44 @@ static JNINativeMethod gSurfaceMethods[] = {
|
|||||||
{"nativeClassInit", "()V", (void*)nativeClassInit },
|
{"nativeClassInit", "()V", (void*)nativeClassInit },
|
||||||
{"init", "(Landroid/view/SurfaceSession;ILjava/lang/String;IIIII)V", (void*)Surface_init },
|
{"init", "(Landroid/view/SurfaceSession;ILjava/lang/String;IIIII)V", (void*)Surface_init },
|
||||||
{"init", "(Landroid/os/Parcel;)V", (void*)Surface_initParcel },
|
{"init", "(Landroid/os/Parcel;)V", (void*)Surface_initParcel },
|
||||||
|
{"getIdentity", "()I", (void*)Surface_getIdentity },
|
||||||
{"destroy", "()V", (void*)Surface_destroy },
|
{"destroy", "()V", (void*)Surface_destroy },
|
||||||
{"release", "()V", (void*)Surface_release },
|
{"release", "()V", (void*)Surface_release },
|
||||||
{"copyFrom", "(Landroid/view/Surface;)V", (void*)Surface_copyFrom },
|
{"copyFrom", "(Landroid/view/Surface;)V", (void*)Surface_copyFrom },
|
||||||
{"isValid", "()Z", (void*)Surface_isValid },
|
{"isValid", "()Z", (void*)Surface_isValid },
|
||||||
{"lockCanvasNative", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", (void*)Surface_lockCanvas },
|
{"lockCanvasNative", "(Landroid/graphics/Rect;)Landroid/graphics/Canvas;", (void*)Surface_lockCanvas },
|
||||||
{"unlockCanvasAndPost", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvasAndPost },
|
{"unlockCanvasAndPost", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvasAndPost },
|
||||||
{"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas },
|
{"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas },
|
||||||
{"openTransaction", "()V", (void*)Surface_openTransaction },
|
{"openTransaction", "()V", (void*)Surface_openTransaction },
|
||||||
{"closeTransaction", "()V", (void*)Surface_closeTransaction },
|
{"closeTransaction", "()V", (void*)Surface_closeTransaction },
|
||||||
{"setOrientation", "(III)V", (void*)Surface_setOrientation },
|
{"setOrientation", "(III)V", (void*)Surface_setOrientation },
|
||||||
{"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay },
|
{"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay },
|
||||||
{"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay },
|
{"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay },
|
||||||
{"setLayer", "(I)V", (void*)Surface_setLayer },
|
{"setLayer", "(I)V", (void*)Surface_setLayer },
|
||||||
{"setPosition", "(II)V",(void*)Surface_setPosition },
|
{"setPosition", "(II)V",(void*)Surface_setPosition },
|
||||||
{"setSize", "(II)V",(void*)Surface_setSize },
|
{"setSize", "(II)V",(void*)Surface_setSize },
|
||||||
{"hide", "()V", (void*)Surface_hide },
|
{"hide", "()V", (void*)Surface_hide },
|
||||||
{"show", "()V", (void*)Surface_show },
|
{"show", "()V", (void*)Surface_show },
|
||||||
{"freeze", "()V", (void*)Surface_freeze },
|
{"freeze", "()V", (void*)Surface_freeze },
|
||||||
{"unfreeze", "()V", (void*)Surface_unfreeze },
|
{"unfreeze", "()V", (void*)Surface_unfreeze },
|
||||||
{"setFlags", "(II)V",(void*)Surface_setFlags },
|
{"setFlags", "(II)V",(void*)Surface_setFlags },
|
||||||
{"setTransparentRegionHint","(Landroid/graphics/Region;)V", (void*)Surface_setTransparentRegion },
|
{"setTransparentRegionHint","(Landroid/graphics/Region;)V", (void*)Surface_setTransparentRegion },
|
||||||
{"setAlpha", "(F)V", (void*)Surface_setAlpha },
|
{"setAlpha", "(F)V", (void*)Surface_setAlpha },
|
||||||
{"setMatrix", "(FFFF)V", (void*)Surface_setMatrix },
|
{"setMatrix", "(FFFF)V", (void*)Surface_setMatrix },
|
||||||
{"setFreezeTint", "(I)V", (void*)Surface_setFreezeTint },
|
{"setFreezeTint", "(I)V", (void*)Surface_setFreezeTint },
|
||||||
{"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel },
|
{"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel },
|
||||||
{"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel },
|
{"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel },
|
||||||
};
|
};
|
||||||
|
|
||||||
void nativeClassInit(JNIEnv* env, jclass clazz)
|
void nativeClassInit(JNIEnv* env, jclass clazz)
|
||||||
{
|
{
|
||||||
so.surface = env->GetFieldID(clazz, "mSurface", "I");
|
so.surface = env->GetFieldID(clazz, "mSurface", "I");
|
||||||
so.surfaceControl = env->GetFieldID(clazz, "mSurfaceControl", "I");
|
so.surfaceControl = env->GetFieldID(clazz, "mSurfaceControl", "I");
|
||||||
so.saveCount = env->GetFieldID(clazz, "mSaveCount", "I");
|
so.saveCount = env->GetFieldID(clazz, "mSaveCount", "I");
|
||||||
so.canvas = env->GetFieldID(clazz, "mCanvas", "Landroid/graphics/Canvas;");
|
so.canvas = env->GetFieldID(clazz, "mCanvas", "Landroid/graphics/Canvas;");
|
||||||
|
|
||||||
jclass surfaceSession = env->FindClass("android/view/SurfaceSession");
|
jclass surfaceSession = env->FindClass("android/view/SurfaceSession");
|
||||||
sso.client = env->GetFieldID(surfaceSession, "mClient", "I");
|
sso.client = env->GetFieldID(surfaceSession, "mClient", "I");
|
||||||
|
|
||||||
jclass canvas = env->FindClass("android/graphics/Canvas");
|
jclass canvas = env->FindClass("android/graphics/Canvas");
|
||||||
no.native_canvas = env->GetFieldID(canvas, "mNativeCanvas", "I");
|
no.native_canvas = env->GetFieldID(canvas, "mNativeCanvas", "I");
|
||||||
|
|||||||
Reference in New Issue
Block a user