mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-12-01 07:40:31 +01:00
When the car leaves for good, the phone stops sharing its screen and gets its speaker back at once
The capture waits 30 seconds after the car goes, so a cable that slips or a wireless link that drops and comes back doesn't ask the driver to share the screen again. It waited after every drive too: a SOOEMAKA said goodbye at 12:15:40 and the phone stayed muted and sharing its screen until 12:16:10. A car that says goodbye, or whose Bluetooth goes with it, isn't coming back in a moment, so the capture now stops then. A drop with the car's Bluetooth still there keeps the 30 seconds. The music is paused first, so the phone's speaker comes back only after it has stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e3f8e6657
commit
c7ba9506df
3 files changed
+20
-1
No files matched your search
@@ -355,6 +355,8 @@ class GearslipRunner(
|
|||||||
drainWriterOnExit = true
|
drainWriterOnExit = true
|
||||||
running = false
|
running = false
|
||||||
SessionStatus.disconnected()
|
SessionStatus.disconnected()
|
||||||
|
// The car said goodbye, so it isn't coming back in a moment: see CarAudio.carLeft.
|
||||||
|
app.seb3thehacker.gearslip.audio.CarAudio.carLeft("the car said goodbye")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onVersionRequest(body: ByteArray) {
|
private fun onVersionRequest(body: ByteArray) {
|
||||||
|
|||||||
@@ -152,6 +152,20 @@ object CarAudio {
|
|||||||
_capture.value = Capture.OFF
|
_capture.value = Capture.OFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The car has gone for good, not dropped for a moment: it said goodbye, or its Bluetooth went
|
||||||
|
* with it. The capture, and the phone's muted speaker with it, stop now rather than after
|
||||||
|
* [CAR_GONE_MS]: a SOOEMAKA's goodbye left the phone silent and sharing its screen for 30 s.
|
||||||
|
*/
|
||||||
|
fun carLeft(why: String) {
|
||||||
|
if (!wanted && _capture.value == Capture.OFF) return
|
||||||
|
GearslipLog.i("audio: $why - stopping the capture now")
|
||||||
|
// The music stops first: giving the speaker back before the pause reached the app
|
||||||
|
// could let a moment of it play from the phone.
|
||||||
|
runCatching { app.seb3thehacker.gearslip.car.CarServices.pausePhoneMedia(why) }
|
||||||
|
main.post { release() }
|
||||||
|
}
|
||||||
|
|
||||||
fun denied() {
|
fun denied() {
|
||||||
_capture.value = Capture.DENIED
|
_capture.value = Capture.DENIED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,8 @@ class CarPresenceService : CompanionDeviceService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Deprecated in Java")
|
@Deprecated("Deprecated in Java")
|
||||||
override fun onDeviceDisappeared(address: String) {}
|
override fun onDeviceDisappeared(address: String) {
|
||||||
|
// The car's Bluetooth went with it, so it isn't coming back in a moment: see CarAudio.carLeft.
|
||||||
|
app.seb3thehacker.gearslip.audio.CarAudio.carLeft("the car's Bluetooth went")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user