Fix setting the dequeueBuffer timeout to -1
ANativeWindow::perform() is a variadic function. When passing -1 as the variadic argument, it gets written as a 32-bit int. But it gets read in Surface::dispatchSetDequeueTimeout() using va_arg(args, int64_t), leaving the upper 32-bit undefined. Typically this is 0, and the value becomes 4294967295. This gets interpreted as a finite timeout of ~4 seconds, instead of the intended infinite timeout represented by negative values such as -1. This change preserves the -1 value by casting it nsecs_t (an alias of int64_t) prior to passing it to the variadic function. This makes android.graphics.cts.BitmapTest#testDrawingHardwareBitmapNotLeaking pass on Cuttlefish with SwANGLE, without the workaround of disabling EGL_EXT_buffer_age support in ANGLE. Note the test typically passes in less than 4 seconds, so it's not entirely clear why we were previously observing timeouts (perhaps it does not represent wall clock time), but the -1 value causes different code paths to be used in various places. Bug: b/182521420 Test: android.view.inputmethod.cts.FocusHandlingTest#testNonFocusablePopupWindowDoesNotAffectImeVisibilityandroid.graphics.cts.BitmapTest#testDrawingHardwareBitmapNotLeaking Change-Id: I94f83bb55e79799306b6e352d60a9ca9314bec20
Loading
Please register or sign in to comment