Compare commits
2 Commits
refactor-e
...
issue1658
Author | SHA1 | Date | |
---|---|---|---|
80a240cbd4 | |||
af8e62fc36 |
@ -55,10 +55,10 @@ public class Controller {
|
|||||||
public void control() throws IOException {
|
public void control() throws IOException {
|
||||||
// on start, power on the device
|
// on start, power on the device
|
||||||
if (!device.isScreenOn()) {
|
if (!device.isScreenOn()) {
|
||||||
device.injectKeycode(KeyEvent.KEYCODE_WAKEUP);
|
device.injectKeycode(KeyEvent.KEYCODE_POWER);
|
||||||
|
|
||||||
// dirty hack
|
// dirty hack
|
||||||
// After the keycode is injected, the device is powered on asynchronously.
|
// After POWER is injected, the device is powered on asynchronously.
|
||||||
// To turn the device screen off while mirroring, the client will send a message that
|
// To turn the device screen off while mirroring, the client will send a message that
|
||||||
// would be handled before the device is actually powered on, so its effect would
|
// would be handled before the device is actually powered on, so its effect would
|
||||||
// be "canceled" once the device is turned back on.
|
// be "canceled" once the device is turned back on.
|
||||||
@ -248,8 +248,8 @@ public class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean pressBackOrTurnScreenOn() {
|
private boolean pressBackOrTurnScreenOn() {
|
||||||
int keycode = device.isScreenOn() ? KeyEvent.KEYCODE_BACK : KeyEvent.KEYCODE_WAKEUP;
|
int keycode = device.isScreenOn() ? KeyEvent.KEYCODE_BACK : KeyEvent.KEYCODE_POWER;
|
||||||
if (keepPowerModeOff && keycode == KeyEvent.KEYCODE_WAKEUP) {
|
if (keepPowerModeOff && keycode == KeyEvent.KEYCODE_POWER) {
|
||||||
schedulePowerModeOff();
|
schedulePowerModeOff();
|
||||||
}
|
}
|
||||||
return device.injectKeycode(keycode);
|
return device.injectKeycode(keycode);
|
||||||
|
@ -223,7 +223,7 @@ public final class Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String currentClipboard = getClipboardText();
|
String currentClipboard = getClipboardText();
|
||||||
if (currentClipboard == null || currentClipboard.equals(text)) {
|
if (currentClipboard != null && currentClipboard.equals(text)) {
|
||||||
// The clipboard already contains the requested text.
|
// The clipboard already contains the requested text.
|
||||||
// Since pasting text from the computer involves setting the device clipboard, it could be set twice on a copy-paste. This would cause
|
// Since pasting text from the computer involves setting the device clipboard, it could be set twice on a copy-paste. This would cause
|
||||||
// the clipboard listeners to be notified twice, and that would flood the Android keyboard clipboard history. To workaround this
|
// the clipboard listeners to be notified twice, and that would flood the Android keyboard clipboard history. To workaround this
|
||||||
|
Reference in New Issue
Block a user