Extract setting display power to a separate method
For consistency with the other actions.
This commit is contained in:
parent
e26bdb07a2
commit
c7378f4dc8
@ -272,16 +272,7 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
|||||||
break;
|
break;
|
||||||
case ControlMessage.TYPE_SET_DISPLAY_POWER:
|
case ControlMessage.TYPE_SET_DISPLAY_POWER:
|
||||||
if (supportsInputEvents && displayId != Device.DISPLAY_ID_NONE) {
|
if (supportsInputEvents && displayId != Device.DISPLAY_ID_NONE) {
|
||||||
boolean on = msg.getOn();
|
setDisplayPower(msg.getOn());
|
||||||
boolean setDisplayPowerOk = Device.setDisplayPower(displayId, on);
|
|
||||||
if (setDisplayPowerOk) {
|
|
||||||
keepDisplayPowerOff = !on;
|
|
||||||
Ln.i("Device display turned " + (on ? "on" : "off"));
|
|
||||||
if (cleanUp != null) {
|
|
||||||
boolean mustRestoreOnExit = !on;
|
|
||||||
cleanUp.setRestoreDisplayPower(mustRestoreOnExit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ControlMessage.TYPE_ROTATE_DEVICE:
|
case ControlMessage.TYPE_ROTATE_DEVICE:
|
||||||
@ -677,4 +668,16 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDisplayPower(boolean on) {
|
||||||
|
boolean setDisplayPowerOk = Device.setDisplayPower(displayId, on);
|
||||||
|
if (setDisplayPowerOk) {
|
||||||
|
keepDisplayPowerOff = !on;
|
||||||
|
Ln.i("Device display turned " + (on ? "on" : "off"));
|
||||||
|
if (cleanUp != null) {
|
||||||
|
boolean mustRestoreOnExit = !on;
|
||||||
|
cleanUp.setRestoreDisplayPower(mustRestoreOnExit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user