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
Snooze and mute buttons on phone alert notifications; ticking ADS-B or P25 no longer unticks the sweep; sweep settings show only when the sweep is ticked; empty-state help points to the current settings
CIS-C01cbceec82d08
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xmlindex 9d01d85..7d07632 100644--- a/app/src/main/AndroidManifest.xml+++ b/app/src/main/AndroidManifest.xml@@ -218,7 +218,7 @@</intent-filter></receiver>- <!-- "Mute 30 min" / "Ignore" buttons on alerts shown on the car screen. -->+ <!-- Alert buttons: snooze / mute this on the phone, "Mute N min" / "Ignore" on the car screen. --><receiverandroid:name=".receiver.AlertActionReceiver"android:exported="false" />diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.ktindex e7446bd..ba3653f 100644--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt@@ -798,16 +798,16 @@ class MainActivity : AppCompatActivity() {binding.showAllButton.visibility =if (filter != com.rfsentinel.app.ui.DeviceFilter.ALL && all.isNotEmpty()) View.VISIBLE else View.GONEbinding.emptyText.text = when {- all.isEmpty() && !ScanForegroundService.isRunning -> "Not scanning.\nTap Start scanning to begin."+ all.isEmpty() && !ScanForegroundService.isRunning -> "Not scanning.\nTap Start to begin."all.isEmpty() -> "Listening... no devices heard yet."filter == com.rfsentinel.app.ui.DeviceFilter.WAZE ->"No Waze reports in range.\nTurn on Waze police reports in Settings and keep scanning."filter == com.rfsentinel.app.ui.DeviceFilter.RADIO ->- "No radio transmissions heard in the last 5 minutes.\nNeeds an RTL-SDR on USB and the Police radio category on in Settings."+ "No radio transmissions heard in the last 5 minutes.\nNeeds an RTL-SDR on USB, Two-way radio on in Settings › What to detect, and Radio activity sweep ticked in Settings › RTL-SDR radio."filter == com.rfsentinel.app.ui.DeviceFilter.AIRCRAFT ->- "No aircraft yet.\nThey come from an RTL-SDR on USB set to ADS-B, or from the online feeds when that's on in Settings."+ "No aircraft yet.\nThey come from an RTL-SDR on USB (tick ADS-B aircraft receiver in Settings › RTL-SDR radio), or from the online feeds when that's on in Settings."filter == com.rfsentinel.app.ui.DeviceFilter.CELLS ->- "No cell towers yet - they're read every 15 s while scanning\n(needs the Fake cell tower category on in Settings)."+ "No cell towers yet - they're read every 15 s while scanning\n(needs Fake cell tower signs on in Settings › What to detect)."else -> "No devices match this filter."}}diff --git a/app/src/main/java/com/rfsentinel/app/receiver/AlertActionReceiver.kt b/app/src/main/java/com/rfsentinel/app/receiver/AlertActionReceiver.ktindex 19103ed..4ec92e9 100644--- a/app/src/main/java/com/rfsentinel/app/receiver/AlertActionReceiver.kt+++ b/app/src/main/java/com/rfsentinel/app/receiver/AlertActionReceiver.kt@@ -20,9 +20,9 @@ import kotlinx.coroutines.SupervisorJobimport kotlinx.coroutines.launch/**- * The buttons on an alert shown on the car screen: "Mute N min" silences alert- * sound and voice for the snooze length set under Alerts; "Ignore" stops alerting about that device- * (a rotating tracker until its address changes, anything else via the+ * The buttons on an alert: "Mute N min" (car) / "Snooze all N min" (phone) silences alert sound and voice for the+ * snooze length set under Alerts; "Mute this 30 min" (phone) mutes that one device, like its row's mute button; "Ignore"+ * (car) stops alerting about that device (a rotating tracker until its address changes, anything else via the* whitelist - undo from the device's details).*/class AlertActionReceiver : BroadcastReceiver() {@@ -31,6 +31,7 @@ class AlertActionReceiver : BroadcastReceiver() {val app = context.applicationContextwhen (intent.action) {ACTION_SNOOZE -> snooze(app)+ ACTION_MUTE -> intent.getStringExtra(EXTRA_MAC)?.let { com.rfsentinel.app.data.AlertMutes.mute(app, it, System.currentTimeMillis() + com.rfsentinel.app.data.AlertMutes.TAP_MS) } ?: returnACTION_IGNORE -> {val mac = intent.getStringExtra(EXTRA_MAC) ?: returnval pending = goAsync()@@ -47,6 +48,7 @@ class AlertActionReceiver : BroadcastReceiver() {companion object {const val ACTION_SNOOZE = "com.rfsentinel.app.action.SNOOZE_ALERTS"const val ACTION_IGNORE = "com.rfsentinel.app.action.IGNORE_DEVICE"+ const val ACTION_MUTE = "com.rfsentinel.app.action.MUTE_DEVICE"private const val EXTRA_MAC = "mac"private const val EXTRA_NOTIFICATION = "notification"@@ -66,6 +68,13 @@ class AlertActionReceiver : BroadcastReceiver() {PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)+ fun muteIntent(context: Context, mac: String, notificationId: Int): PendingIntent = PendingIntent.getBroadcast(+ context, mac.hashCode() + 1,+ Intent(context, AlertActionReceiver::class.java).setAction(ACTION_MUTE)+ .putExtra(EXTRA_MAC, mac).putExtra(EXTRA_NOTIFICATION, notificationId),+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+/** Silences alert sound and voice for [minutes] (the snooze length set under Alerts unless given). */fun snooze(context: Context, now: Long = System.currentTimeMillis(), minutes: Int = Prefs.snoozeMinutes(context)) {Prefs.setAlertsSnoozedUntil(context, now + minutes * 60_000L)diff --git a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.ktindex 1a83075..e9768db 100644--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt@@ -633,7 +633,7 @@ class SettingsActivity : AppCompatActivity() {"and no Android Bluetooth pairing."),Section("radio", binding.headerRadio, binding.sectionRadio,"An RTL-SDR dongle or a HackRF on USB notices two-way radios transmitting nearby, from signal strength only - nothing is " +- "decoded or recorded. Needs the Police radio category on (What to detect).\n\n" ++ "decoded or recorded. Needs Two-way radio on (What to detect).\n\n" +"Sensitivity: how far above the noise a burst must be to count. Lower hears farther radios, and more false alarms.\n\n" +"Bands: the built-in North American public-safety bands, your own bands (one per line, \"380-400 TETRA\"), " +"ranges never to report (\"462-469 business band\"), and frequencies to watch (\"154.4300 County fire\"), " +@@ -1286,12 +1286,14 @@ class SettingsActivity : AppCompatActivity() {"P25: alerts when a call starts on one of them, and names them on the P25 talkgroups screen. One per line: the " +"talkgroup number, with an optional name.") { Prefs.setP25Talkgroups(this, it) }val talkgroupViews = listOf(box.getChildAt(box.childCount - 2), box.getChildAt(box.childCount - 1))+ var sweepViews = emptyList<View>() // the sweep's own settings, belowshowSdrOptions = {val ticked = listOf(sweepBox, adsbBox, p25Box).count { it.isChecked }- turnViews.forEach { it.visibility = if (ticked > 1) View.VISIBLE else View.GONE }- talkgroupViews.forEach { it.visibility = if (p25Box.isChecked) View.VISIBLE else View.GONE }+ turnViews.forEach { it.shownIf(ticked > 1) }+ talkgroupViews.forEach { it.shownIf(p25Box.isChecked) }+ sweepViews.forEach { it.shownIf(sweepBox.isChecked) }}- showSdrOptions()+ val sweepFrom = box.childCountslider(com.rfsentinel.app.sdr.RadioWatch.MIN_SNR_SETTING, com.rfsentinel.app.sdr.RadioWatch.MAX_SNR_SETTING, Prefs.radioMinSnr(this),{ "Sensitivity: $it dB above the noise" }) {Prefs.setRadioMinSnr(this, it)@@ -1328,6 +1330,8 @@ class SettingsActivity : AppCompatActivity() {Prefs.setRadioTrendDb(this, it)}slider(1, 50, Prefs.radioMatchKhz(this), { "A hit takes a frequency's name within ± $it kHz" }) { Prefs.setRadioMatchKhz(this, it) }+ sweepViews = (sweepFrom until box.childCount).map(box::getChildAt)+ showSdrOptions()label("Frequency names")freqListText = label("", small = true)diff --git a/app/src/main/java/com/rfsentinel/app/ui/AircraftActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/AircraftActivity.ktindex 44afe6d..9cf6859 100644--- a/app/src/main/java/com/rfsentinel/app/ui/AircraftActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/AircraftActivity.kt@@ -183,7 +183,7 @@ class AircraftActivity : AppCompatActivity() {val empty = when {rows.isNotEmpty() -> null!ScanForegroundService.isRunning && !demo -> "Not scanning.\nAircraft come from an RTL-SDR on USB (ADS-B) or the online feeds, while scanning."- else -> "No aircraft heard yet.\nThey come from an RTL-SDR on USB set to ADS-B, or from the online feeds when that's on in Settings."+ else -> "No aircraft heard yet.\nThey come from an RTL-SDR on USB (tick ADS-B aircraft receiver in Settings › RTL-SDR radio), or from the online feeds when that's on in Settings."}visual.root.visibility = if (visualOn && empty == null) View.VISIBLE else View.GONEbinding.recyclerView.visibility = if (!visualOn && empty == null) View.VISIBLE else View.GONEdiff --git a/app/src/main/java/com/rfsentinel/app/util/NotificationHelper.kt b/app/src/main/java/com/rfsentinel/app/util/NotificationHelper.ktindex 6f164be..dbfc185 100644--- a/app/src/main/java/com/rfsentinel/app/util/NotificationHelper.kt+++ b/app/src/main/java/com/rfsentinel/app/util/NotificationHelper.kt@@ -208,6 +208,8 @@ object NotificationHelper {.setSilent(true).setContentIntent(open).setVisibility(if (discreet) NotificationCompat.VISIBILITY_SECRET else NotificationCompat.VISIBILITY_PRIVATE)+ .addAction(0, "Snooze all ${Prefs.snoozeMinutes(context)} min",+ com.rfsentinel.app.receiver.AlertActionReceiver.snoozeIntent(context, ALERT_NOTIFICATION_ID_BASE + key.hashCode())).extend(CarAppExtender.Builder().setContentTitle(if (discreet) "RF Sentinel" else hit.label)@@ -337,6 +339,11 @@ object NotificationHelper {.setContentIntent(detail).setVisibility(if (discreet) NotificationCompat.VISIBILITY_SECRET else NotificationCompat.VISIBILITY_PRIVATE).setPublicVersion(publicVersion)+ // From the notification shade, without opening the app (the car has its own buttons below).+ .addAction(0, "Snooze all ${Prefs.snoozeMinutes(context)} min",+ com.rfsentinel.app.receiver.AlertActionReceiver.snoozeIntent(context, ALERT_NOTIFICATION_ID_BASE + mac.hashCode()))+ .addAction(0, "Mute this ${com.rfsentinel.app.data.AlertMutes.TAP_MS / 60_000} min",+ com.rfsentinel.app.receiver.AlertActionReceiver.muteIntent(context, mac, ALERT_NOTIFICATION_ID_BASE + mac.hashCode()))// Android Auto: show as a heads-up on the car screen; tapping it opens// this device in the car app. (The tone/voice come from AlertPlayer.).extend(diff --git a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt b/app/src/main/java/com/rfsentinel/app/util/Prefs.ktindex 37ce0d1..69d91f7 100644--- a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt+++ b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt@@ -573,16 +573,18 @@ object Prefs {/** A hit matches a named frequency within ± this many kHz. */fun radioMatchKhz(context: Context): Int = int(context, "radio_match_khz", 7).coerceIn(1, 50)fun setRadioMatchKhz(context: Context, v: Int) = setInt(context, "radio_match_khz", v.coerceIn(1, 50))- /** The RTL-SDR as an ADS-B aircraft receiver on 1090 MHz instead of the radio sweep (off by default). */+ /** The RTL-SDR as an ADS-B aircraft receiver on 1090 MHz (off by default). */fun sdrAdsb(context: Context): Boolean = bool(context, "sdr_adsb", false)- fun setSdrAdsb(context: Context, v: Boolean) = setBool(context, "sdr_adsb", v)+ fun setSdrAdsb(context: Context, v: Boolean) { keepSdrSweep(context); setBool(context, "sdr_adsb", v) }/** The SDR's radio-activity sweep: on by default, unless ADS-B or P25 was switched on when they replaced it. */fun sdrSweep(context: Context): Boolean = bool(context, "sdr_sweep", !sdrAdsb(context) && !bool(context, "sdr_p25", false))fun setSdrSweep(context: Context, v: Boolean) = setBool(context, "sdr_sweep", v)/** The SDR follows a P25 control channel: on by default where P25 is used (the United States or Canada region picked). */fun sdrP25(context: Context): Boolean = bool(context, "sdr_p25",com.rfsentinel.app.oui.OuiWatchlist.getEnabledPresets(context).any { it == "us" || it == "canada" })- fun setSdrP25(context: Context, v: Boolean) = setBool(context, "sdr_p25", v)+ fun setSdrP25(context: Context, v: Boolean) { keepSdrSweep(context); setBool(context, "sdr_p25", v) }+ /** The sweep's default follows the ADS-B and P25 settings: store it before they change, or ticking one would untick it. */+ private fun keepSdrSweep(context: Context) { if (!sp(context).contains("sdr_sweep")) setSdrSweep(context, sdrSweep(context)) }/** P25 talkgroups to alert on, "1234 Name" a line ([com.rfsentinel.app.sdr.P25Log.watched]). */fun p25Talkgroups(context: Context) = str(context, "p25_talkgroups")fun setP25Talkgroups(context: Context, v: String) = setStr(context, "p25_talkgroups", v)