mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-03 11:49:03 +00:00
android: fix head gestures not working
This commit is contained in:
@@ -87,13 +87,13 @@ fun startDetection(doNotStop: Boolean = false, onGestureDetected: (Boolean) -> U
|
|||||||
isRunning = true
|
isRunning = true
|
||||||
gestureDetectedCallback = onGestureDetected
|
gestureDetectedCallback = onGestureDetected
|
||||||
|
|
||||||
|
Log.d(TAG, "started: ${airPodsService.startHeadTracking()}")
|
||||||
|
|
||||||
clearData()
|
clearData()
|
||||||
|
|
||||||
prevHorizontal = 0.0
|
prevHorizontal = 0.0
|
||||||
prevVertical = 0.0
|
prevVertical = 0.0
|
||||||
|
|
||||||
airPodsService.aacpManager.sendStartHeadTracking()
|
|
||||||
|
|
||||||
detectionJob = CoroutineScope(Dispatchers.Default).launch {
|
detectionJob = CoroutineScope(Dispatchers.Default).launch {
|
||||||
while (isRunning) {
|
while (isRunning) {
|
||||||
delay(50)
|
delay(50)
|
||||||
@@ -117,7 +117,7 @@ fun startDetection(doNotStop: Boolean = false, onGestureDetected: (Boolean) -> U
|
|||||||
Log.d(TAG, "Stopping gesture detection")
|
Log.d(TAG, "Stopping gesture detection")
|
||||||
isRunning = false
|
isRunning = false
|
||||||
|
|
||||||
if (!doNotStop) airPodsService.aacpManager.sendStopHeadTracking()
|
if (!doNotStop) airPodsService.stopHeadTracking()
|
||||||
|
|
||||||
detectionJob?.cancel()
|
detectionJob?.cancel()
|
||||||
detectionJob = null
|
detectionJob = null
|
||||||
|
|||||||
Reference in New Issue
Block a user