Skip to content

Commit cb60677

Browse files
committed
fix: synchronize HMS Maps ready callbacks with initialization
1 parent f6a532e commit cb60677

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

  • play-services-maps/core/hms/src/main/kotlin/org/microg/gms/maps/hms

play-services-maps/core/hms/src/main/kotlin/org/microg/gms/maps/hms/GoogleMap.kt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,16 +1040,9 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
10401040
Log.d("$TAG:$tag", "Invoking callback now, as map is initialized")
10411041
val wasCallbackActive = isInvokingInitializedCallbacks.getAndSet(true)
10421042
runOnMainLooper(forceQueue = wasCallbackActive) {
1043-
scheduleExecute { runCallbacks() }
1044-
}
1045-
if (!wasCallbackActive) isInvokingInitializedCallbacks.set(false)
1046-
} else if (mapView?.isShown == false) {
1047-
// Match the Mapbox backend: let applications configure the map while the
1048-
// backend is still initializing. Camera updates and other operations that
1049-
// require HuaweiMap are queued by their existing initialization guards.
1050-
runOnMainLooper(forceQueue = true) {
10511043
runCallbacks()
10521044
}
1045+
if (!wasCallbackActive) isInvokingInitializedCallbacks.set(false)
10531046
} else {
10541047
Log.d(
10551048
"$TAG:$tag",
@@ -1067,18 +1060,11 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
10671060
}
10681061

10691062

1070-
private fun scheduleExecute(block:() -> Unit) {
1071-
Handler(Looper.getMainLooper()).postDelayed({
1072-
try { block.invoke() } catch (_: Exception) {}
1073-
}, ON_MAP_CALLBACK_DELAY)
1074-
}
1075-
10761063
companion object {
10771064
private const val TAG = "GmsGoogleMap"
10781065
private const val SNAPSHOT_OLD_VERSION_CODE = 4000000
10791066

10801067
private const val TAG_LOGO = "fakeWatermark"
1081-
private const val ON_MAP_CALLBACK_DELAY = 300L
10821068
private const val ON_MAP_LOADED_CALLBACK_DELAY = 500L
10831069
private const val DEFAULT_LOCATION_INTERVAL_MILLIS = 1000L
10841070
}

0 commit comments

Comments
 (0)