Skip to content

Commit

Permalink
Best-effort-send intent when stopping scrcpy
Browse files Browse the repository at this point in the history
# Conflicts:
#	server/src/main/java/com/genymobile/scrcpy/Intents.java

# Conflicts:
#	server/src/main/java/com/genymobile/scrcpy/Intents.java
  • Loading branch information
brunoais committed Apr 18, 2021
1 parent a26513f commit 5fa9fb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions server/src/main/java/com/genymobile/scrcpy/CleanUp.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.File;
import java.io.IOException;
import java.util.HashMap;

/**
* Handle the cleanup of scrcpy, even if the main process is killed.
Expand Down Expand Up @@ -89,5 +90,9 @@ public static void main(String... args) {
Device.setScreenPowerMode(Device.POWER_MODE_NORMAL);
}
}

HashMap<String, String> intentExtras = new HashMap<>();
intentExtras.put("STOPPING", "true");
Intents.intentAnnounce("CLEANED", "cleaned", intentExtras);
}
}
3 changes: 2 additions & 1 deletion server/src/main/java/com/genymobile/scrcpy/Intents.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static void intentAnnounce(String action,
"am", "broadcast",
"-a", "com.genymobile.scrcpy." + action,
"-d", "scrcpy-status:" + uriContent,
"--ez", "STARTUP", extras.get("STARTUP")
"--ez", "STARTUP", extras.get("STARTUP"),
"--ez", "SHUTDOWN", extras.get("SHUTDOWN")
));

ListIterator<String> iter = list.listIterator(list.size());
Expand Down

0 comments on commit 5fa9fb2

Please sign in to comment.