Only request unbuffered touch events on Android 11+

This commit is contained in:
Cameron Gutman
2022-09-08 17:30:19 -05:00
parent aa9ca35115
commit 09f0913974

View File

@@ -1749,9 +1749,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent event) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// Tell the OS not to buffer input events for us
//
// NB: This is still needed even when we call the newer requestUnbufferedDispatch()!
view.requestUnbufferedDispatch(event);
}
}