mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 14:49:29 +00:00
Adding starting and stopping intents to the server
This commit is contained in:
parent
fc97b00ac8
commit
f29baa77f4
1 changed files with 26 additions and 0 deletions
|
@ -79,6 +79,10 @@ public final class Server {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(options.getBroadcastIntents().contains(Intents.START)){
|
||||||
|
announceScrcpyStarting();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// synchronous
|
// synchronous
|
||||||
screenEncoder.streamScreen(device, connection.getVideoFd());
|
screenEncoder.streamScreen(device, connection.getVideoFd());
|
||||||
|
@ -92,9 +96,31 @@ public final class Server {
|
||||||
if (deviceMessageSenderThread != null) {
|
if (deviceMessageSenderThread != null) {
|
||||||
deviceMessageSenderThread.interrupt();
|
deviceMessageSenderThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(options.getBroadcastIntents().contains(Intents.STOP)){
|
||||||
|
Ln.i("Announcing stopped");
|
||||||
|
announceScrcpyStopping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void announceScrcpyStarting() {
|
||||||
|
|
||||||
|
Intent starting = new Intent(Intents.scrcpyPrefix("START"));
|
||||||
|
starting.setData(Uri.parse("scrcpy-status:start"));
|
||||||
|
starting.putExtra(Intents.scrcpyPrefix("STARTUP"), true);
|
||||||
|
starting.putExtra(Intents.scrcpyPrefix("SHUTDOWN"), false);
|
||||||
|
Device.sendBroadcast(starting);
|
||||||
|
}
|
||||||
|
private static void announceScrcpyStopping() {
|
||||||
|
|
||||||
|
Intent stopping = new Intent(Intents.scrcpyPrefix("STOP"));
|
||||||
|
stopping.setData(Uri.parse("scrcpy-status:stop"));
|
||||||
|
stopping.putExtra(Intents.scrcpyPrefix("STARTUP"), false);
|
||||||
|
stopping.putExtra(Intents.scrcpyPrefix("SHUTDOWN"), true);
|
||||||
|
Device.sendBroadcast(stopping);
|
||||||
|
}
|
||||||
|
|
||||||
private static Thread startController(final Controller controller) {
|
private static Thread startController(final Controller controller) {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue