mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-30 23:30:32 +01:00
Merge Stop screen sharing at once when the car leaves (#134)
This commit is contained in:
commit
980cf53794
3 files changed
+20
-1
No files matched your search
@@ -373,6 +373,8 @@ class GearslipRunner(
|
||||
drainWriterOnExit = true
|
||||
running = false
|
||||
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) {
|
||||
|
||||
@@ -167,6 +167,20 @@ object CarAudio {
|
||||
_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() {
|
||||
_capture.value = Capture.DENIED
|
||||
}
|
||||
|
||||
@@ -11,5 +11,8 @@ class CarPresenceService : CompanionDeviceService() {
|
||||
}
|
||||
|
||||
@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