mirror of
https://github.com/Genymobile/scrcpy
synced 2024-11-15 06:12:53 +00:00
Log actions on the caller side
Some actions are exposed by the Device class, but logging success should be done by the caller.
This commit is contained in:
parent
81573d81a0
commit
c7a33fac36
@ -110,11 +110,18 @@ public class Controller {
|
||||
sender.pushClipboardText(clipboardText);
|
||||
break;
|
||||
case ControlMessage.TYPE_SET_CLIPBOARD:
|
||||
device.setClipboardText(msg.getText());
|
||||
boolean setClipboardOk = device.setClipboardText(msg.getText());
|
||||
if (setClipboardOk) {
|
||||
Ln.i("Device clipboard set");
|
||||
}
|
||||
break;
|
||||
case ControlMessage.TYPE_SET_SCREEN_POWER_MODE:
|
||||
if (device.supportsInputEvents()) {
|
||||
device.setScreenPowerMode(msg.getAction());
|
||||
int mode = msg.getAction();
|
||||
boolean setPowerModeOk = device.setScreenPowerMode(mode);
|
||||
if (setPowerModeOk) {
|
||||
Ln.i("Device screen turned " + (mode == Device.POWER_MODE_OFF ? "off" : "on"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ControlMessage.TYPE_ROTATE_DEVICE:
|
||||
|
@ -180,26 +180,20 @@ public final class Device {
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public void setClipboardText(String text) {
|
||||
boolean ok = serviceManager.getClipboardManager().setText(text);
|
||||
if (ok) {
|
||||
Ln.i("Device clipboard set");
|
||||
}
|
||||
public boolean setClipboardText(String text) {
|
||||
return serviceManager.getClipboardManager().setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mode one of the {@code SCREEN_POWER_MODE_*} constants
|
||||
*/
|
||||
public void setScreenPowerMode(int mode) {
|
||||
public boolean setScreenPowerMode(int mode) {
|
||||
IBinder d = SurfaceControl.getBuiltInDisplay();
|
||||
if (d == null) {
|
||||
Ln.e("Could not get built-in display");
|
||||
return;
|
||||
}
|
||||
boolean ok = SurfaceControl.setDisplayPowerMode(d, mode);
|
||||
if (ok) {
|
||||
Ln.i("Device screen turned " + (mode == Device.POWER_MODE_OFF ? "off" : "on"));
|
||||
return false;
|
||||
}
|
||||
return SurfaceControl.setDisplayPowerMode(d, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user