RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.
Kotlin airtagalprandroidandroid-autoanti-surveillancebluetooth-low-energybody-cameracounter-surveillancedrone-detectionflock-safetyimsi-catcher-detectorpolice-detectorpolice-scannerprivacyremote-idrtl-sdrsdrsurveillance-detectiontracker-detectionwifi
OpenFreeMap map: start on OpenGL on phones without Vulkan
CIS-C03f4f46115e7b
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapSafety.kt b/app/src/main/java/com/rfsentinel/app/ui/MapSafety.ktindex ab759a9..950c97e 100644--- a/app/src/main/java/com/rfsentinel/app/ui/MapSafety.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/MapSafety.kt@@ -1,6 +1,7 @@package com.rfsentinel.app.uiimport android.content.Context+import android.content.pm.PackageManagerimport com.rfsentinel.app.util.Prefsimport org.maplibre.android.RenderingEngine@@ -53,8 +54,15 @@ internal object MapSafety {/** The OpenFreeMap map has been told to use OpenGL, not Vulkan. */fun openGl(context: Context): Boolean = sp(context).getBoolean(OPENGL, false)- /** The renderer MapLibre must use, or null to let it choose (Vulkan where the phone has it, else OpenGL). */- fun renderer(context: Context): RenderingEngine.Type? = if (openGl(context)) RenderingEngine.Type.OPENGL else null+ /**+ * The renderer MapLibre must use, or null to let it choose (Vulkan). A phone without Vulkan gets OpenGL from the+ * start: MapLibre does not fall back by itself, it throws "No Vulkan compatible GPU found" and the app closes once.+ */+ fun renderer(context: Context): RenderingEngine.Type? =+ if (openGl(context) || !hasVulkan(context)) RenderingEngine.Type.OPENGL else null++ private fun hasVulkan(context: Context): Boolean =+ context.packageManager.hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_LEVEL)/*** If the last start-up never finished: forgets the mark and counts it. The first time for the OpenFreeMap mapdiff --git a/app/src/test/java/com/rfsentinel/app/ui/MapSafetyTest.kt b/app/src/test/java/com/rfsentinel/app/ui/MapSafetyTest.ktindex 672af25..0d1656f 100644--- a/app/src/test/java/com/rfsentinel/app/ui/MapSafetyTest.kt+++ b/app/src/test/java/com/rfsentinel/app/ui/MapSafetyTest.kt@@ -2,6 +2,7 @@ package com.rfsentinel.app.uiimport android.app.Applicationimport android.content.Context+import android.content.pm.PackageManagerimport androidx.test.core.app.ApplicationProviderimport com.rfsentinel.app.util.Prefsimport org.junit.Assert.assertEquals@@ -13,6 +14,7 @@ import org.junit.Testimport org.junit.runner.RunWithimport org.maplibre.android.RenderingEngineimport org.robolectric.RobolectricTestRunner+import org.robolectric.Shadows.shadowOfimport org.robolectric.annotation.Config/**@@ -30,6 +32,16 @@ class MapSafetyTest {ctx.getSharedPreferences("map_safety", Context.MODE_PRIVATE).edit().clear().commit()MapSafety.live = falsePrefs.setViewPanes(ctx, setOf("map", "list"))+ vulkan(true)+ }++ private fun vulkan(has: Boolean) = shadowOf(ctx.packageManager).setSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_LEVEL, has)++ @Test+ fun aPhoneWithoutVulkanStartsOnOpenGl() {+ vulkan(false)+ assertEquals("no crash first: MapLibre would not fall back by itself", RenderingEngine.Type.OPENGL, MapSafety.renderer(ctx))+ assertEquals(MapSafety.Recovery.NONE, MapSafety.recover(ctx))}/** The app starts again after dying: nothing is live in the new process. */