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 <noreply@anthropic.com>
This commit is contained in:
Moritz 2026-02-16 17:22:01 +01:00
parent f4c41b1851
commit 38f9bb2c2a
3 changed files with 15 additions and 22 deletions

View file

@ -1,21 +1,14 @@
# Add project specific ProGuard rules here. # OkHttp
# You can control the set of applied configuration files using the -dontwarn okhttp3.**
# proguardFiles setting in build.gradle. -dontwarn okio.**
# -keep class okhttp3.** { *; }
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following # Coroutines
# and specify the fully qualified class name to the JavaScript interface -dontwarn kotlinx.coroutines.**
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for # Play Services
# debugging stack traces. -keep class com.google.android.gms.** { *; }
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to # WorkManager
# hide the original source file name. -keep class * extends androidx.work.Worker
#-renamesourcefileattribute SourceFile -keep class * extends androidx.work.CoroutineWorker

View file

@ -39,8 +39,10 @@ class ListenerService : Service() {
} }
override fun onDestroy() { override fun onDestroy() {
try {
unregisterReceiver(receiver) unregisterReceiver(receiver)
Log.d(TAG, "Listener service stopped, receiver unregistered") } catch (_: IllegalArgumentException) { }
Log.d(TAG, "Listener service stopped")
super.onDestroy() super.onDestroy()
} }

View file

@ -50,7 +50,6 @@ class MainActivity : ComponentActivity() {
private val foregroundGranted = mutableStateOf(false) private val foregroundGranted = mutableStateOf(false)
private val backgroundGranted = mutableStateOf(false) private val backgroundGranted = mutableStateOf(false)
private val serviceRunning = mutableStateOf(false)
private val foregroundPermissionLauncher = registerForActivityResult( private val foregroundPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions() ActivityResultContracts.RequestMultiplePermissions()
@ -154,7 +153,6 @@ class MainActivity : ComponentActivity() {
} }
} }
ListenerService.start(this) ListenerService.start(this)
serviceRunning.value = true
} }
} }