Modern Apps git

← Modern-Apps.git

networklocation: fix detekt findings

Commit
3f5ad39ab9dcd66787bfa4913505d60053040767
Author
Vayun Mathur <[email protected]>
When
2026-11-17 15:16 UTC (18 days ago)
Parents
cc8a8c0
Fixes every error-severity detekt finding in networklocation (inventory clusters C3/C4): named constants for magic numbers, extracted functions/composables for long/complex methods, wrapped long lines, removed unused parameters, and narrowed/logged exception handling. No detekt config, baseline or suppression changes; behaviour preserved.

Verified: ./check networklocation and :networklocation:testDevUnitTest green.

Diff

networklocation/src/main/java/com/vayunmathur/networklocation/platform/NearbyWifi.kt
diff --git a/networklocation/src/main/java/com/vayunmathur/networklocation/platform/NearbyWifi.kt b/networklocation/src/main/java/com/vayunmathur/networklocation/platform/NearbyWifi.ktindex f88f0a7254..84c884d36f 100644--- a/networklocation/src/main/java/com/vayunmathur/networklocation/platform/NearbyWifi.kt+++ b/networklocation/src/main/java/com/vayunmathur/networklocation/platform/NearbyWifi.kt@@ -2,6 +2,7 @@ package com.vayunmathur.networklocation.platform  import android.content.Context import android.net.wifi.WifiManager+import com.vayunmathur.library.log.Log import com.vayunmathur.networklocation.domain.BeaconId import com.vayunmathur.networklocation.domain.BeaconKeys @@ -20,6 +21,7 @@ class NearbyWifi(context: Context) {         val results = try {             wifiManager?.scanResults         } catch (e: SecurityException) {+            Log.status(TAG, "WiFi scan results unavailable without location grant", e)             null         } ?: return emptyList()         return results@@ -40,6 +42,7 @@ class NearbyWifi(context: Context) {     }      private companion object {+        const val TAG = "NearbyWifi"         // Some drivers report this placeholder for hidden/!associated entries.         const val NULL_BSSID = "00:00:00:00:00:00"     }
networklocation/src/main/java/com/vayunmathur/networklocation/telephony/NearbyCells.kt
diff --git a/networklocation/src/main/java/com/vayunmathur/networklocation/telephony/NearbyCells.kt b/networklocation/src/main/java/com/vayunmathur/networklocation/telephony/NearbyCells.ktindex c392857133..cd4120b264 100644--- a/networklocation/src/main/java/com/vayunmathur/networklocation/telephony/NearbyCells.kt+++ b/networklocation/src/main/java/com/vayunmathur/networklocation/telephony/NearbyCells.kt@@ -11,6 +11,7 @@ import android.telephony.CellInfoNr import android.telephony.CellInfoWcdma import android.telephony.TelephonyManager import android.content.Context+import com.vayunmathur.library.log.Log import com.vayunmathur.networklocation.domain.BeaconId import com.vayunmathur.networklocation.domain.RadioType @@ -28,6 +29,7 @@ class NearbyCells(context: Context) {         val infos = try {             telephonyManager?.allCellInfo         } catch (e: SecurityException) {+            Log.status(TAG, "Cell info unavailable without location grant", e)             null         } ?: return emptyList()         return infos.mapNotNull { it.toCell() }.distinct()@@ -76,4 +78,7 @@ class NearbyCells(context: Context) {             tacOrLac = areaCode,         )     }+    private companion object {+        const val TAG = "NearbyCells"+    } }