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
Small polish: sentence-case buttons, rounded tags, readable alert rows, SDR subheadings
CIS-C0705d007ca4d0
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.ktindex c5e2124..527787b 100644--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt@@ -61,7 +61,7 @@ class MainActivity : AppCompatActivity() {/** Radio transmissions stay on the radar this long after they were last heard (the list keeps 5 minutes). */private const val RADIO_RADAR_MS = 60_000L/** Location off: Android gives the app no Bluetooth or WiFi results. Tapping the warning opens the setting. */- private const val LOCATION_OFF = "Location is off - no devices can be seen. Tap to turn it on"+ private const val LOCATION_OFF = "Location is off, so no devices can be seen. Tap to turn it on"private const val REFRESH_MS = 1_000Lprivate const val WEAK_COLOR = 0xFFB26A00.toInt()private const val WHITELIST_COLOR = 0xFF6B7B80.toInt()@@ -505,7 +505,7 @@ class MainActivity : AppCompatActivity() {val locationOff = running && !locationOn() && !demoModeval warning = when {locationOff -> LOCATION_OFF- running && !bluetoothOn() && !demoMode -> "Scanning WiFi only - turn on Bluetooth for BLE (picked up automatically)"+ running && !bluetoothOn() && !demoMode -> "Scanning WiFi only. Turn on Bluetooth to add BLE"else -> listOfNotNull(com.rfsentinel.app.service.CellMonitor.lastAnomaly?.takeIf { now - it.first < 15 * 60_000L }?.second?.title,ScanForegroundService.lastWatchdogRestart?.takeIf { now - it.first < 10 * 60_000L }?.let {@@ -554,9 +554,9 @@ class MainActivity : AppCompatActivity() {else -> { binding.statusText.setOnClickListener(null); binding.statusText.isClickable = false }}val line: CharSequence = when {- !running -> "Idle - tap Start to listen for nearby devices"+ !running -> "Idle. Tap Start to listen for nearby devices"locationOff -> "⚠ $LOCATION_OFF"- !bluetoothOn() && !demoMode -> "Scanning WiFi only - turn on Bluetooth for BLE (picked up automatically)"+ !bluetoothOn() && !demoMode -> "Scanning WiFi only. Turn on Bluetooth to add BLE"else -> "Scanning · $deviceCount ${plural(deviceCount, "device", "devices")} nearby" +(if (flaggedCount > 0) " · $flaggedCount flagged" else "") +(com.rfsentinel.app.service.CellMonitor.lastAnomaly@@ -868,7 +868,7 @@ class MainActivity : AppCompatActivity() {filter == com.rfsentinel.app.ui.DeviceFilter.AIRCRAFT ->"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 Fake cell tower signs on in Settings › What to detect)."+ "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."}}@@ -1389,7 +1389,7 @@ class MainActivity : AppCompatActivity() {}val (color, text) = when {following != null -> 0xFFB3261E.toInt() to "⚠ ${following.best!!.label} may be following you"- top == null -> 0xFF2E7D32.toInt() to "✓ All clear - no flagged equipment nearby"+ top == null -> 0xFF2E7D32.toInt() to "✓ All clear: no flagged equipment nearby"top.best!!.tier == Tier.STRONG -> 0xFFB3261E.toInt() to "⚠ Strong match nearby: ${top.best!!.label}"top.best!!.confidence >= Prefs.alertThreshold(this, top.best!!.category) -> 0xFFC8431A.toInt() to "Probable match nearby: ${top.best!!.label}"else -> WEAK_COLOR to "Weak match only (verify): ${top.best!!.label}"@@ -1471,8 +1471,8 @@ class MainActivity : AppCompatActivity() {menu.findItem(R.id.action_mute)?.apply {setIcon(when { muted -> R.drawable.ic_car_volume_off; left > 0 -> R.drawable.ic_car_snooze; else -> R.drawable.ic_car_volume })title = when {- muted -> "Alerts muted - tap for sound"- left > 0 -> "Alerts snoozed, $left min left - tap for sound"+ muted -> "Alerts muted. Tap for sound"+ left > 0 -> "Alerts snoozed, $left min left. Tap for sound"else -> "Snooze alerts ${Prefs.snoozeMinutes(this@MainActivity)} min"}}diff --git a/app/src/main/java/com/rfsentinel/app/car/CarUi.kt b/app/src/main/java/com/rfsentinel/app/car/CarUi.ktindex c4fd6d1..7a58d23 100644--- a/app/src/main/java/com/rfsentinel/app/car/CarUi.kt+++ b/app/src/main/java/com/rfsentinel/app/car/CarUi.kt@@ -157,7 +157,7 @@ object CarUi {}return when {following != null -> DANGER_COLOR to "${following.best!!.label} may be following you"- top == null -> CLEAR_COLOR to "All clear - no flagged equipment"+ top == null -> CLEAR_COLOR to "All clear: no flagged equipment"top.best!!.tier == Tier.STRONG -> DANGER_COLOR to "Strong match: ${top.best!!.label}"top.best!!.confidence >= threshold -> Category.BODY_CAM.colorArgb to "Probable: ${top.best!!.label}"else -> WEAK_COLOR to "Weak match (verify): ${top.best!!.label}"diff --git a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.ktindex f100367..97b40e7 100644--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt@@ -1529,6 +1529,14 @@ class SettingsActivity : AppCompatActivity() {}.also { box.addView(it) }}+ // Subheadings: the section is long, and only some of its groups apply at a time.+ fun heading(title: String) = box.label(title).apply {+ setTypeface(typeface, android.graphics.Typeface.BOLD)+ setTextColor(com.rfsentinel.app.ui.ChipStyle.accent(context).first)+ setPadding(0, dp(18), 0, dp(2))+ }++ heading("Connection")info(box.label("Network SDR"), "Uses an RTL-SDR on another device over WiFi, such as an ESP32 board or a computer running " +"rtl_tcp. Enter its address and port; the port is ${com.rfsentinel.app.sdr.RtlTcp.DEFAULT_PORT} if left out. A plugged-in " +"USB SDR is used first. Streaming takes about 5 MB/s of WiFi.", "Network SDR")@@ -1549,7 +1557,7 @@ class SettingsActivity : AppCompatActivity() {// What the SDR does: any mix; with more than one ticked it takes turns.var showSdrOptions: () -> Unit = {}- info(box.label("Scan with the SDR"), "Tick what the RTL-SDR or HackRF does while scanning. One SDR hears one thing at a time: " ++ info(heading("Scan with the SDR"), "Tick what the RTL-SDR or HackRF does while scanning. One SDR hears one thing at a time: " +"with more than one ticked it takes turns, and each scan hears nothing while another has its turn. " +"Tick only one to give it all the time.", "Scan with the SDR")fun scan(t: String, on: Boolean, details: String, save: (Boolean) -> Unit) = android.widget.CheckBox(this).apply {@@ -1587,10 +1595,13 @@ class SettingsActivity : AppCompatActivity() {ticked to listOf(box.getChildAt(box.childCount - 2), box.getChildAt(box.childCount - 1))}val pagerFrom = box.childCount+ heading("Pagers")lines("Pager frequencies", "466.075", Prefs.pagerFreqs(this),"Leave empty to scan for paging channels. If you know yours, enter it in MHz, one per line: the SDR listens there and " +"doesn't scan, so a quiet channel isn't missed.") { Prefs.setPagerFreqs(this, it) }val pagerViews = (pagerFrom until box.childCount).map { box.getChildAt(it) }+ val p25From = box.childCount+ heading("P25")lines("Watch these talkgroups", "1234 Sheriff dispatch\n2001", Prefs.p25Talkgroups(this),"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. 23* watches every talkgroup starting with 23 (2300, 2301, 2307...), and * every " +@@ -1633,7 +1644,7 @@ class SettingsActivity : AppCompatActivity() {"2 minutes each. Watched talkgroups: only those in Watch these talkgroups. Mute on the P25 talkgroups screen pauses it; Hold there (or tapping a talkgroup) plays only that talkgroup and keeps the SDR on P25 until Release. " +"Encrypted calls can't be played. Listening to radio calls is not allowed everywhere, and some places forbid it in " +"a vehicle: check the law where you are.", "Listen to P25 voice"))- val talkgroupViews = (box.childCount - 11 until box.childCount).map { box.getChildAt(it) }+ val talkgroupViews = (p25From until box.childCount).map { box.getChildAt(it) }var sweepViews = emptyList<View>() // the sweep's own settings, belowshowSdrOptions = {val ticked = listOf(sweepBox, adsbBox, p25Box, pagerBox).count { it.isChecked }@@ -1643,6 +1654,7 @@ class SettingsActivity : AppCompatActivity() {sweepViews.forEach { it.shownIf(sweepBox.isChecked) }}val sweepFrom = box.childCount+ heading("Radio sweep")slider(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)@@ -1682,7 +1694,7 @@ class SettingsActivity : AppCompatActivity() {sweepViews = (sweepFrom until box.childCount).map(box::getChildAt)showSdrOptions()- box.label("Frequency names")+ heading("Frequency names")freqListText = box.label("", small = true)com.rfsentinel.app.sdr.FreqNames.load(this)updateFreqListText()@@ -1714,6 +1726,7 @@ class SettingsActivity : AppCompatActivity() {}}, android.widget.LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT))+ heading("RadioReference")val rrSwitch = box.toggle("Name hits from RadioReference", Prefs.radioReferenceOn(this),"Names a hit from RadioReference's database. Needs your own RadioReference Premium login and developer key, stored encrypted on this phone.") {Prefs.setRadioReferenceOn(this, it)diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.ktindex bb1ce7f..b3cd8df 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt@@ -101,6 +101,7 @@ class DeviceAdapter(inner class VH(val binding: ItemDeviceBinding) : RecyclerView.ViewHolder(binding.root) {private var animator: ValueAnimator? = nullprivate var animColor = 0+ val metaColors = binding.metaText.textColorsinit {binding.root.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {@@ -164,7 +165,7 @@ class DeviceAdapter(if (row.tag != null) {b.tagText.visibility = View.VISIBLEb.tagText.text = row.tag- b.tagText.setBackgroundColor(row.tagColor)+ b.tagText.background.mutate().setTint(row.tagColor)} else {b.tagText.visibility = View.GONE}@@ -172,6 +173,8 @@ class DeviceAdapter(b.titleText.setTypeface(b.titleText.typeface, if (row.bold) Typeface.BOLD else Typeface.NORMAL)b.macText.text = row.subtitleb.metaText.text = metaWithBadges(row)+ // Grey is hard to read on an alert's colour.+ b.metaText.setTextColor(if (row.highlight != null) b.macText.textColors else holder.metaColors)val conf = row.confidenceb.confidenceBar.visibility = if (visual && conf != null) View.VISIBLE else View.GONEif (visual && conf != null) b.confidenceBar.set(conf / 100f, row.tagColor)diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.ktindex 1bbf4c8..817de04 100644--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceDetailActivity.kt@@ -174,17 +174,17 @@ class DeviceDetailActivity : AppCompatActivity() {// Headerif (whitelisted) {binding.tagText.visibility = View.VISIBLE- binding.tagText.text = "WHITELISTED - trusted"- binding.tagText.setBackgroundColor(0xFF6B7B80.toInt())+ binding.tagText.text = "WHITELISTED · trusted"+ binding.tagText.background.mutate().setTint(0xFF6B7B80.toInt())} else if (best != null) {binding.tagText.visibility = View.VISIBLEbinding.tagText.text = "${best.category.shortTag} · ${best.tier.label} ${best.confidence}%"- binding.tagText.setBackgroundColor(ThemeManager.ink(this, if (best.tier == Tier.WEAK) 0xFFB26A00.toInt() else best.category.colorArgb))+ binding.tagText.background.mutate().setTint(ThemeManager.ink(this, if (best.tier == Tier.WEAK) 0xFFB26A00.toInt() else best.category.colorArgb))} else if (s == null && pastBest != null) {val h = pastBestbinding.tagText.visibility = View.VISIBLEbinding.tagText.text = "${h.category.shortTag} · ${h.tier.label} ${h.confidence}%"- binding.tagText.setBackgroundColor(ThemeManager.ink(this, if (h.tier == Tier.WEAK) 0xFFB26A00.toInt() else h.category.colorArgb))+ binding.tagText.background.mutate().setTint(ThemeManager.ink(this, if (h.tier == Tier.WEAK) 0xFFB26A00.toInt() else h.category.colorArgb))} else {binding.tagText.visibility = View.GONE}diff --git a/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt b/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.ktindex e80492f..13622fa 100644--- a/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt@@ -38,7 +38,7 @@ object ThemeManager {R.style.Theme_RFSentinel_DedSec, true, ThemeHeaderView.Style.GLITCH, "[email protected]:~$", R.drawable.dedsec_header),FSOCIETY("fsociety", "Mr. Robot homage: black & blood red, fsociety poster, a terminal full of quotes from the show",R.style.Theme_RFSentinel_Fsociety, true, ThemeHeaderView.Style.FSOCIETY, "root@fsociety:~#", R.drawable.fsociety_header),- SYSTEM("System default", "Teal - follows your phone's light / dark setting"),+ SYSTEM("System default", "Teal, follows your phone's light / dark setting"),LIGHT("Light", "Always light", night = false),DARK("Dark", "Always dark", night = true),MATERIAL_YOU("Material You", "Material 3, coloured from your wallpaper (Android 12+)", R.style.Theme_RFSentinel_MaterialYou),@@ -54,7 +54,7 @@ object ThemeManager {R.style.Theme_RFSentinel_Tactical, true, ThemeHeaderView.Style.STENCIL, "RF-SENTINEL"),BLUEPRINT("Blueprint", "White technical drawing on drafting blue, with dimension lines",R.style.Theme_RFSentinel_Blueprint, true, ThemeHeaderView.Style.BLUEPRINT, "RF SENTINEL // DWG-001"),- PAPER("Paper", "Newspaper ink on newsprint - the most readable theme in bright sunlight",+ PAPER("Paper", "Newspaper ink on newsprint, the most readable theme in bright sunlight",R.style.Theme_RFSentinel_Paper, false, ThemeHeaderView.Style.MASTHEAD, "Front Page"),/** A theme made in the theme maker (which one: [custom]); not in the built-in lists. */CUSTOM("Custom theme", "Made in the theme maker", R.style.Theme_RFSentinel_Custom)diff --git a/app/src/main/res/drawable/tag_bg.xml b/app/src/main/res/drawable/tag_bg.xmlnew file mode 100644index 0000000..f8b7e5f--- /dev/null+++ b/app/src/main/res/drawable/tag_bg.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">+ <solid android:color="@color/match_tag_bg" />+ <corners android:radius="4dp" />+</shape>diff --git a/app/src/main/res/layout/activity_device_detail.xml b/app/src/main/res/layout/activity_device_detail.xmlindex c5ba18f..7142c1f 100644--- a/app/src/main/res/layout/activity_device_detail.xml+++ b/app/src/main/res/layout/activity_device_detail.xml@@ -14,6 +14,7 @@android:id="@+id/tagText"android:layout_width="wrap_content"android:layout_height="wrap_content"+ android:background="@drawable/tag_bg"android:layout_marginBottom="6dp"android:paddingStart="8dp"android:paddingTop="2dp"diff --git a/app/src/main/res/layout/item_device.xml b/app/src/main/res/layout/item_device.xmlindex e7663bb..0b87693 100644--- a/app/src/main/res/layout/item_device.xml+++ b/app/src/main/res/layout/item_device.xml@@ -25,7 +25,7 @@android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginBottom="4dp"- android:background="@color/match_tag_bg"+ android:background="@drawable/tag_bg"android:paddingStart="6dp"android:paddingEnd="6dp"android:paddingTop="1dp"diff --git a/app/src/main/res/layout/view_live_read.xml b/app/src/main/res/layout/view_live_read.xmlindex 6d68217..cd6eecf 100644--- a/app/src/main/res/layout/view_live_read.xml+++ b/app/src/main/res/layout/view_live_read.xml@@ -82,6 +82,7 @@<ImageButtonandroid:id="@+id/liveClose"+ android:contentDescription="Close"android:layout_width="40dp"android:layout_height="40dp"android:layout_marginStart="4dp"diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xmlindex cc96b8b..c444943 100644--- a/app/src/main/res/values/themes.xml+++ b/app/src/main/res/values/themes.xml@@ -3,6 +3,7 @@for their titles and MainActivity's overflow menu.Light / Dark / System all use this theme; ThemeManager forces the night mode. --><style name="Theme.RFSentinel" parent="Theme.MaterialComponents.DayNight.DarkActionBar">+ <item name="textAppearanceButton">@style/TextAppearance.RFSentinel.Button</item><item name="colorPrimary">@color/brand_primary</item><item name="colorPrimaryVariant">@color/brand_primary_dark</item><item name="colorOnPrimary">@android:color/white</item>@@ -402,6 +403,11 @@<item name="android:layout_height">wrap_content</item></style>+ <style name="TextAppearance.RFSentinel.Button" parent="TextAppearance.MaterialComponents.Button">+ <item name="android:textAllCaps">false</item>+ <item name="android:letterSpacing">0</item>+ </style>+<style name="SettingsHeader" parent="SettingsControl"><item name="android:paddingTop">20dp</item><item name="android:paddingBottom">4dp</item>