Loading core/java/android/view/Surface.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; } } /** /** Loading Loading @@ -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 { Loading Loading @@ -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(); } } core/jni/android_view_Surface.cpp +41 −31 Original line number Original line Diff line number Diff line Loading @@ -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)); Loading Loading @@ -640,6 +649,7 @@ 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 }, Loading Loading
core/java/android/view/Surface.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; } } /** /** Loading Loading @@ -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 { Loading Loading @@ -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(); } }
core/jni/android_view_Surface.cpp +41 −31 Original line number Original line Diff line number Diff line Loading @@ -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)); Loading Loading @@ -640,6 +649,7 @@ 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 }, Loading