core: Add error reporting for corrupted symbols (#4458)
This commit is contained in:
@@ -62,7 +62,7 @@ class SequentialActivityTest(private val activity: Class<out Activity>) {
|
||||
PackageManager.GET_ACTIVITIES
|
||||
)
|
||||
|
||||
val activities = packageInfo.activities
|
||||
val activities = packageInfo.activities!!
|
||||
.filter { info ->
|
||||
info.name.startsWith("org.maplibre.android.testapp.activity")
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class FeatureOverviewActivity : AppCompatActivity() {
|
||||
val packageName = FeatureOverviewActivity::class.java.`package`!!.name
|
||||
val metaDataKey = getString(R.string.category)
|
||||
if (app != null) {
|
||||
for (info in app.activities) {
|
||||
for (info in app.activities!!) {
|
||||
if (info.labelRes != 0 && info.name.startsWith(packageName) &&
|
||||
info.name != FeatureOverviewActivity::class.java.name
|
||||
) {
|
||||
|
||||
@@ -27,7 +27,8 @@ class ObserverActivity : AppCompatActivity(),
|
||||
MapView.OnGlyphsRequestedListener,
|
||||
MapView.OnSpriteLoadedListener,
|
||||
MapView.OnSpriteRequestedListener,
|
||||
MapView.OnDidFinishRenderingFrameWithStatsListener {
|
||||
MapView.OnDidFinishRenderingFrameWithStatsListener,
|
||||
MapView.OnSymbolErrorListener {
|
||||
// # --8<-- [end:ObserverActivity]
|
||||
|
||||
private lateinit var mapView: MapView
|
||||
@@ -52,6 +53,7 @@ class ObserverActivity : AppCompatActivity(),
|
||||
mapView.addOnSpriteLoadedListener(this)
|
||||
mapView.addOnSpriteRequestedListener(this)
|
||||
mapView.addOnDidFinishRenderingFrameListener(this)
|
||||
mapView.addOnSymbolErrorListener(this)
|
||||
// # --8<-- [end:addListeners]
|
||||
|
||||
// # --8<-- [start:renderStatsTracker]
|
||||
@@ -158,6 +160,10 @@ class ObserverActivity : AppCompatActivity(),
|
||||
override fun onDidFinishRenderingFrame(fully: Boolean, stats: RenderingStats) {
|
||||
renderStatsTracker.addFrame(stats)
|
||||
}
|
||||
|
||||
override fun onSymbolError(message: String) {
|
||||
Logger.i(TAG, "onSymbolError: $message")
|
||||
}
|
||||
// # --8<-- [end:mapEvents]
|
||||
|
||||
override fun onStart() {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.maplibre.android.testapp.activity.stability
|
||||
import android.annotation.SuppressLint
|
||||
import android.location.Location
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.gson.Gson
|
||||
@@ -45,8 +44,9 @@ import org.maplibre.navigation.android.navigation.v5.routeprogress.RouteProgress
|
||||
import java.util.Locale
|
||||
import java.util.logging.Logger
|
||||
import kotlin.random.Random
|
||||
import io.sentry.Sentry
|
||||
|
||||
class NavigationMap : SupportMapFragment(), ProgressChangeListener, MilestoneEventListener {
|
||||
class NavigationMap : SupportMapFragment(), ProgressChangeListener, MilestoneEventListener, MapView.OnSymbolErrorListener {
|
||||
private lateinit var map: MapLibreMap
|
||||
private lateinit var mapView: MapView
|
||||
|
||||
@@ -105,6 +105,7 @@ class NavigationMap : SupportMapFragment(), ProgressChangeListener, MilestoneEve
|
||||
|
||||
this.map = maplibreMap
|
||||
this.mapView = view as MapView
|
||||
this.mapView.addOnSymbolErrorListener(this)
|
||||
|
||||
LOG.info("NavigationMap seed $RANDOM_SEED")
|
||||
run()
|
||||
@@ -357,6 +358,11 @@ class NavigationMap : SupportMapFragment(), ProgressChangeListener, MilestoneEve
|
||||
startNewRoute()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSymbolError(message: String) {
|
||||
Sentry.captureMessage("NavigationMap: $message")
|
||||
//Bugsnag.notify(RuntimeException(message))
|
||||
}
|
||||
}
|
||||
|
||||
class NavigationMapActivity : AppCompatActivity() {
|
||||
|
||||
@@ -27,8 +27,9 @@ import java.lang.reflect.Field
|
||||
import java.util.logging.Logger
|
||||
import kotlin.math.min
|
||||
import kotlin.random.Random
|
||||
import io.sentry.Sentry
|
||||
|
||||
class UserMap : SupportMapFragment() {
|
||||
class UserMap : SupportMapFragment(), MapView.OnSymbolErrorListener {
|
||||
private lateinit var map: MapLibreMap
|
||||
private lateinit var mapView: MapView
|
||||
private lateinit var bitmapDrawables: List<Drawable>
|
||||
@@ -140,6 +141,7 @@ class UserMap : SupportMapFragment() {
|
||||
|
||||
this.map = maplibreMap
|
||||
this.mapView = view as MapView
|
||||
this.mapView.addOnSymbolErrorListener(this)
|
||||
|
||||
LOG.info("UserMap seed $RANDOM_SEED")
|
||||
run()
|
||||
@@ -267,6 +269,11 @@ class UserMap : SupportMapFragment() {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSymbolError(message: String) {
|
||||
Sentry.captureMessage("UserMap: $message")
|
||||
//Bugsnag.notify(RuntimeException(message))
|
||||
}
|
||||
}
|
||||
|
||||
class UserMapActivity : AppCompatActivity() {
|
||||
|
||||
Reference in New Issue
Block a user