From 393a4c9c8aab8c597ba01b97070f1673d2458814 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 16 May 2019 21:26:38 -0700 Subject: [PATCH] Fix pointer capture on Android Q Beta 3 --- app/src/main/java/com/limelight/Game.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 78913b4b..fdffae67 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -1382,10 +1382,18 @@ public class Game extends Activity implements SurfaceHolder.Callback, connected = true; connecting = false; - // Hide the mouse cursor now. Doing it before - // dismissing the spinner seems to be undone - // when the spinner gets displayed. - inputCaptureProvider.enableCapture(); + // Hide the mouse cursor now after a short delay. + // Doing it before dismissing the spinner seems to be undone + // when the spinner gets displayed. On Android Q, even now + // is too early to capture. We will delay a second to allow + // the spinner to dismiss before capturing. + Handler h = new Handler(); + h.postDelayed(new Runnable() { + @Override + public void run() { + inputCaptureProvider.enableCapture(); + } + }, 1000); // Keep the display on getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);