@@ -316,6 +316,19 @@ static jboolean Surface_isValid(JNIEnv* env, jobject clazz)
316316 return Surface::isValid (surface) ? JNI_TRUE : JNI_FALSE;
317317}
318318
319+ static jboolean Surface_isConsumerRunningBehind (JNIEnv* env, jobject clazz)
320+ {
321+ int value = 0 ;
322+ const sp<Surface>& surface (getSurface (env, clazz));
323+ if (!Surface::isValid (surface)) {
324+ doThrowIAE (env);
325+ return 0 ;
326+ }
327+ ANativeWindow* anw = static_cast <ANativeWindow *>(surface.get ());
328+ anw->query (anw, NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value);
329+ return (jboolean)value;
330+ }
331+
319332static inline SkBitmap::Config convertPixelFormat (PixelFormat format)
320333{
321334 /* note: if PIXEL_FORMAT_RGBX_8888 means that all alpha bytes are 0xFF, then
@@ -875,6 +888,7 @@ static JNINativeMethod gSurfaceMethods[] = {
875888 {" setFreezeTint" , " (I)V" , (void *)Surface_setFreezeTint },
876889 {" readFromParcel" , " (Landroid/os/Parcel;)V" , (void *)Surface_readFromParcel },
877890 {" writeToParcel" , " (Landroid/os/Parcel;I)V" , (void *)Surface_writeToParcel },
891+ {" isConsumerRunningBehind" , " ()Z" , (void *)Surface_isConsumerRunningBehind },
878892};
879893
880894void nativeClassInit (JNIEnv* env, jclass clazz)
0 commit comments