From 38f9bb2c2af6b772c99ccf16e753317988b2479f Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 16 Feb 2026 17:22:01 +0100 Subject: [PATCH] Release cleanup: remove unused state, harden service, add proguard rules - Remove unused serviceRunning state variable - Guard unregisterReceiver against double-call - Add proguard rules for OkHttp, Coroutines, Play Services, WorkManager - Remove empty drawable directory Co-Authored-By: Claude Opus 4.6 --- app/proguard-rules.pro | 29 +++++++------------ .../helios_location_finder/ListenerService.kt | 6 ++-- .../helios_location_finder/MainActivity.kt | 2 -- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..147b57f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1,14 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +# OkHttp +-dontwarn okhttp3.** +-dontwarn okio.** +-keep class okhttp3.** { *; } -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} +# Coroutines +-dontwarn kotlinx.coroutines.** -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable +# Play Services +-keep class com.google.android.gms.** { *; } -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +# WorkManager +-keep class * extends androidx.work.Worker +-keep class * extends androidx.work.CoroutineWorker diff --git a/app/src/main/java/com/example/helios_location_finder/ListenerService.kt b/app/src/main/java/com/example/helios_location_finder/ListenerService.kt index acafb32..34533a3 100644 --- a/app/src/main/java/com/example/helios_location_finder/ListenerService.kt +++ b/app/src/main/java/com/example/helios_location_finder/ListenerService.kt @@ -39,8 +39,10 @@ class ListenerService : Service() { } override fun onDestroy() { - unregisterReceiver(receiver) - Log.d(TAG, "Listener service stopped, receiver unregistered") + try { + unregisterReceiver(receiver) + } catch (_: IllegalArgumentException) { } + Log.d(TAG, "Listener service stopped") super.onDestroy() } diff --git a/app/src/main/java/com/example/helios_location_finder/MainActivity.kt b/app/src/main/java/com/example/helios_location_finder/MainActivity.kt index 40bdf26..0e0bfae 100644 --- a/app/src/main/java/com/example/helios_location_finder/MainActivity.kt +++ b/app/src/main/java/com/example/helios_location_finder/MainActivity.kt @@ -50,7 +50,6 @@ class MainActivity : ComponentActivity() { private val foregroundGranted = mutableStateOf(false) private val backgroundGranted = mutableStateOf(false) - private val serviceRunning = mutableStateOf(false) private val foregroundPermissionLauncher = registerForActivityResult( ActivityResultContracts.RequestMultiplePermissions() @@ -154,7 +153,6 @@ class MainActivity : ComponentActivity() { } } ListenerService.start(this) - serviceRunning.value = true } }