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
Match history keeps the radio side (WiFi band, channel, security, standard; Bluetooth address type, connectable, PHY, TX power) and shows the device or network name
CIS-C02bab7908bbde
diff --git a/app/src/main/java/com/rfsentinel/app/data/AppDatabase.kt b/app/src/main/java/com/rfsentinel/app/data/AppDatabase.ktindex 82c3451..8c79d2d 100644--- a/app/src/main/java/com/rfsentinel/app/data/AppDatabase.kt+++ b/app/src/main/java/com/rfsentinel/app/data/AppDatabase.kt@@ -12,7 +12,7 @@ import androidx.sqlite.db.SupportSQLiteDatabaseDetectionEntity::class, WhitelistEntity::class, KnownDeviceEntity::class,TripEntity::class, TripPointEntity::class, TripDeviceEntity::class],- version = 6,+ version = 7,exportSchema = false)abstract class AppDatabase : RoomDatabase() {@@ -92,13 +92,20 @@ abstract class AppDatabase : RoomDatabase() {}}+ /** v2.30: the match history keeps the radio side (WiFi band, channel, security; Bluetooth address type...). */+ val MIGRATION_6_7 = object : Migration(6, 7) {+ override fun migrate(db: SupportSQLiteDatabase) {+ db.execSQL("ALTER TABLE detections ADD COLUMN radio TEXT")+ }+ }+fun getInstance(context: Context): AppDatabase {return INSTANCE ?: synchronized(this) {INSTANCE ?: Room.databaseBuilder(context.applicationContext,AppDatabase::class.java,"rfsentinel.db"- ).addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6).build().also { INSTANCE = it }+ ).addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7).build().also { INSTANCE = it }}}}diff --git a/app/src/main/java/com/rfsentinel/app/data/DetectionEntity.kt b/app/src/main/java/com/rfsentinel/app/data/DetectionEntity.ktindex 3fb24ca..f75f335 100644--- a/app/src/main/java/com/rfsentinel/app/data/DetectionEntity.kt+++ b/app/src/main/java/com/rfsentinel/app/data/DetectionEntity.kt@@ -21,5 +21,7 @@ data class DetectionEntity(@ColumnInfo(defaultValue = "0") val confidence: Int = 0,@ColumnInfo(defaultValue = "") val evidence: String = "",val vendor: String? = null,- val deviceName: String? = null+ val deviceName: String? = null,+ /** The radio side in words ("5 GHz · channel 36 · WPA2"), from v2.30 ([com.rfsentinel.app.detect.DeviceIntel.radioSummary]). */+ val radio: String? = null)diff --git a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.ktindex 6c331b8..bcfdc57 100644--- a/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt+++ b/app/src/main/java/com/rfsentinel/app/detect/DeviceIntel.kt@@ -679,6 +679,35 @@ object DeviceIntel {else -> "Open (no password)"}+ /** "2.4 GHz", "5 GHz" or "6 GHz" for a WiFi frequency, or null when unknown. */+ fun wifiBand(mhz: Int): String? = when {+ mhz in 2400..2500 -> "2.4 GHz"+ mhz in 4900..5925 -> "5 GHz"+ mhz in 5925..7125 -> "6 GHz"+ else -> null+ }++ /**+ * The radio side of a sighting in a few words, for the match history: WiFi "5 GHz · channel 36 · WPA2 · 802.11ax",+ * Bluetooth "BLE · Random static · connectable · LE 1M · TX 4 dBm". Null when there is nothing to say.+ */+ fun radioSummary(a: Advert): String? {+ val w = a.wifi+ val parts = if (a.isWifi && w != null) listOfNotNull(+ wifiBand(w.frequencyMhz),+ channelOf(w.frequencyMhz).takeIf { it > 0 }?.let { "channel $it" },+ if (w.client) "client device" else w.capabilities.takeIf { it.isNotBlank() }?.let { security(it) },+ w.standard?.takeIf { it != WIFI_AWARE }+ ) else if (a.isBle) listOfNotNull(+ "BLE",+ a.addressType.takeIf { it != AddressType.UNKNOWN }?.label,+ if (a.connectable == true) "connectable" else null,+ a.phy,+ a.txPower?.let { "TX $it dBm" }+ ) else emptyList()+ return parts.takeIf { it.size > 1 || (it.isNotEmpty() && !a.isBle) }?.joinToString(" · ")+ }+fun channelOf(mhz: Int): Int = when {mhz == 2484 -> 14mhz in 2412..2472 -> (mhz - 2407) / 5diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.ktindex c1f9774..78d313b 100644--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt@@ -998,7 +998,8 @@ class ScanForegroundService : Service() {confidence = best.confidence,evidence = best.evidence,vendor = vendor,- deviceName = a.name+ deviceName = a.name,+ radio = com.rfsentinel.app.detect.DeviceIntel.radioSummary(a)))}diff --git a/app/src/main/java/com/rfsentinel/app/ui/DetectionAdapter.kt b/app/src/main/java/com/rfsentinel/app/ui/DetectionAdapter.ktindex a19e9f5..4f2fb11 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DetectionAdapter.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DetectionAdapter.kt@@ -54,11 +54,13 @@ class DetectionAdapter(else 0xFFB26A00.toInt()))- holder.binding.macText.text = item.mac + (item.vendor?.let { " · $it" } ?: "")+ // Its name or network (SSID) first when it had one: easier to recognise than the address.+ holder.binding.macText.text = listOfNotNull(item.deviceName?.takeIf { it.isNotBlank() }, item.mac, item.vendor).joinToString(" · ")val parts = mutableListOf<String>()category?.let { parts += it.shortTag }if (item.confidence > 0) parts += "${Tier.of(item.confidence).label} ${item.confidence}%"parts += "${item.source} ${ProximityUtil.band(item.rssi)} ${item.rssi} dBm"+ item.radio?.let { parts += it }parts += fmt.format(Date(item.timestamp))if (item.latitude != null) parts += String.format(Locale.US, "📍 %.4f, %.4f", item.latitude, item.longitude)holder.binding.metaText.text = parts.joinToString(" · ")diff --git a/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt b/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.ktindex 9629d38..dfcb388 100644--- a/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt+++ b/app/src/test/java/com/rfsentinel/app/detect/IdentifyMoreTest.kt@@ -425,4 +425,17 @@ class IdentifyMoreTest {assertEquals(null, DeviceIntel.automotiveMaker("DENSO WAVE INC."))assertEquals("Denso", DeviceIntel.automotiveMaker("DENSO Co.,Ltd"))}++ @Test+ fun theMatchHistoryKeepsTheRadioSide() {+ val ap = Advert("02:00:00:00:00:C1", Advert.Source.WIFI, -60, "Cafe",+ wifi = Advert.WifiInfo(5180, "[WPA2-PSK-CCMP][ESS]", "802.11ax", emptyList()))+ assertEquals("5 GHz · channel 36 · WPA2 · 802.11ax", DeviceIntel.radioSummary(ap))+ val six = Advert("02:00:00:00:00:C2", Advert.Source.WIFI, -60, "x", wifi = Advert.WifiInfo(5975, "[SAE]", null, emptyList()))+ assertEquals("6 GHz · channel 5 · WPA3", DeviceIntel.radioSummary(six))+ val tag = Advert("C2:00:00:00:00:C3", Advert.Source.BLE, -60, addressType = AddressType.RANDOM_STATIC,+ connectable = true, phy = "LE 1M", txPower = 4)+ assertEquals("BLE · Random static · connectable · LE 1M · TX 4 dBm", DeviceIntel.radioSummary(tag))+ assertNull(DeviceIntel.radioSummary(Advert("C2:00:00:00:00:C4", Advert.Source.BLE, -60)))+ }}