fixup executor
This commit is contained in:
parent
2a7f3d70d7
commit
e31b13b0b2
@ -8,13 +8,16 @@ import android.view.KeyEvent;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Timer;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.TimerTask;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class Controller {
|
public class Controller {
|
||||||
|
|
||||||
private static final int DEVICE_ID_VIRTUAL = -1;
|
private static final int DEVICE_ID_VIRTUAL = -1;
|
||||||
|
|
||||||
|
private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
private final Device device;
|
private final Device device;
|
||||||
private final DesktopConnection connection;
|
private final DesktopConnection connection;
|
||||||
private final DeviceMessageSender sender;
|
private final DeviceMessageSender sender;
|
||||||
@ -27,7 +30,6 @@ public class Controller {
|
|||||||
private final MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[PointersState.MAX_POINTERS];
|
private final MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[PointersState.MAX_POINTERS];
|
||||||
|
|
||||||
private boolean screenStayOff;
|
private boolean screenStayOff;
|
||||||
private static final Timer keepScreenOffTimer = new Timer("KeepScreenOff", true);
|
|
||||||
|
|
||||||
public Controller(Device device, DesktopConnection connection) {
|
public Controller(Device device, DesktopConnection connection) {
|
||||||
this.device = device;
|
this.device = device;
|
||||||
@ -236,13 +238,13 @@ public class Controller {
|
|||||||
* Schedule a call to turn the screen off after a small delay.
|
* Schedule a call to turn the screen off after a small delay.
|
||||||
*/
|
*/
|
||||||
private static void scheduleScreenOff() {
|
private static void scheduleScreenOff() {
|
||||||
keepScreenOffTimer.schedule(new TimerTask() {
|
EXECUTOR.schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Ln.i("Forcing screen off");
|
Ln.i("Forcing screen off");
|
||||||
Device.setScreenPowerMode(Device.POWER_MODE_OFF);
|
Device.setScreenPowerMode(Device.POWER_MODE_OFF);
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean pressBackOrTurnScreenOn() {
|
private boolean pressBackOrTurnScreenOn() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user