Loading play-services-location/core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt +26 −24 Original line number Diff line number Diff line Loading @@ -82,14 +82,19 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi } } requests.add(request) lifecycleScope.launchWhenStarted { updateConnection() } } fun removeRequest(request: LocationRequestHelper) { Log.d(TAG, "unified network: removeRequest $request") requests.remove(request) lifecycleScope.launchWhenStarted { updateConnection() } } fun getLastLocation(): Location? { if (lastLocation == null) { Loading @@ -98,9 +103,7 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi return lastLocation } @Synchronized private fun updateConnection() { lifecycleScope.launchWhenStarted { private suspend fun updateConnection() { activeRequestMutex.withLock { if (activeRequestIds.isNotEmpty() && requests.isEmpty()) { Log.d(TAG, "unified network: no longer requesting location update") Loading @@ -123,7 +126,6 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi } } } } override fun getLifecycle(): Lifecycle = lifecycle Loading Loading
play-services-location/core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt +26 −24 Original line number Diff line number Diff line Loading @@ -82,14 +82,19 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi } } requests.add(request) lifecycleScope.launchWhenStarted { updateConnection() } } fun removeRequest(request: LocationRequestHelper) { Log.d(TAG, "unified network: removeRequest $request") requests.remove(request) lifecycleScope.launchWhenStarted { updateConnection() } } fun getLastLocation(): Location? { if (lastLocation == null) { Loading @@ -98,9 +103,7 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi return lastLocation } @Synchronized private fun updateConnection() { lifecycleScope.launchWhenStarted { private suspend fun updateConnection() { activeRequestMutex.withLock { if (activeRequestIds.isNotEmpty() && requests.isEmpty()) { Log.d(TAG, "unified network: no longer requesting location update") Loading @@ -123,7 +126,6 @@ class UnifiedLocationProvider(private val context: Context, private val changeLi } } } } override fun getLifecycle(): Lifecycle = lifecycle Loading