Loading core/java/android/view/Surface.java +9 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,15 @@ public class Surface implements Parcelable { return mSurfaceGenerationId; } /** * Whether the consumer of this Surface is running behind the producer; * that is, isConsumerRunningBehind() returns true if the consumer is more * than one buffer ahead of the producer. * @hide */ public native boolean isConsumerRunningBehind(); /** * A Canvas class that can handle the compatibility mode. This does two * things differently. Loading core/jni/android_view_Surface.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,19 @@ static jboolean Surface_isValid(JNIEnv* env, jobject clazz) return Surface::isValid(surface) ? JNI_TRUE : JNI_FALSE; } static jboolean Surface_isConsumerRunningBehind(JNIEnv* env, jobject clazz) { int value = 0; const sp<Surface>& surface(getSurface(env, clazz)); if (!Surface::isValid(surface)) { doThrowIAE(env); return 0; } ANativeWindow* anw = static_cast<ANativeWindow *>(surface.get()); anw->query(anw, NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value); return (jboolean)value; } static inline SkBitmap::Config convertPixelFormat(PixelFormat format) { /* note: if PIXEL_FORMAT_RGBX_8888 means that all alpha bytes are 0xFF, then Loading Loading @@ -875,6 +888,7 @@ static JNINativeMethod gSurfaceMethods[] = { {"setFreezeTint", "(I)V", (void*)Surface_setFreezeTint }, {"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel }, {"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel }, {"isConsumerRunningBehind", "()Z", (void*)Surface_isConsumerRunningBehind }, }; void nativeClassInit(JNIEnv* env, jclass clazz) Loading Loading
core/java/android/view/Surface.java +9 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,15 @@ public class Surface implements Parcelable { return mSurfaceGenerationId; } /** * Whether the consumer of this Surface is running behind the producer; * that is, isConsumerRunningBehind() returns true if the consumer is more * than one buffer ahead of the producer. * @hide */ public native boolean isConsumerRunningBehind(); /** * A Canvas class that can handle the compatibility mode. This does two * things differently. Loading
core/jni/android_view_Surface.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,19 @@ static jboolean Surface_isValid(JNIEnv* env, jobject clazz) return Surface::isValid(surface) ? JNI_TRUE : JNI_FALSE; } static jboolean Surface_isConsumerRunningBehind(JNIEnv* env, jobject clazz) { int value = 0; const sp<Surface>& surface(getSurface(env, clazz)); if (!Surface::isValid(surface)) { doThrowIAE(env); return 0; } ANativeWindow* anw = static_cast<ANativeWindow *>(surface.get()); anw->query(anw, NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value); return (jboolean)value; } static inline SkBitmap::Config convertPixelFormat(PixelFormat format) { /* note: if PIXEL_FORMAT_RGBX_8888 means that all alpha bytes are 0xFF, then Loading Loading @@ -875,6 +888,7 @@ static JNINativeMethod gSurfaceMethods[] = { {"setFreezeTint", "(I)V", (void*)Surface_setFreezeTint }, {"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel }, {"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel }, {"isConsumerRunningBehind", "()Z", (void*)Surface_isConsumerRunningBehind }, }; void nativeClassInit(JNIEnv* env, jclass clazz) Loading