# SDD-trace: SDD-073 item 6 (R8 / ProGuard stance) + SDD-105 AndroidJniBootstrap. # # Release builds run with isMinifyEnabled = true and isShrinkResources = true # (see app/build.gradle.kts). This file lists the minimum keep rules # required so that R8 does not strip symbols reachable only from native # code, JNI, or reflection. # # Scope of keeps: # 1. chanora_bridge / flutter_rust_bridge JNI surface (SDD-105). # 2. Native methods (declared with the `native` keyword) anywhere in # the app module — these are looked up by signature from C/Rust. # 3. The Android voice foreground service (SDD-107) — referenced from # the manifest by FQN and from JNI via static start/stop helpers. # 4. The Android audio mode controller (SDD-108) — referenced from # JNI via GlobalRef. # 5. Kotlin metadata required by FRB-generated bindings (SDD-079). # --- 1. chanora_bridge / flutter_rust_bridge JNI surface (SDD-105) ----------- # JNI surface — these classes are referenced by FQN from AndroidManifest.xml, # from native code (Rust/JNI lookups), or from FRB-generated bindings, so R8 # must NOT rename/remove them. All other app.chanora.** classes are # consumed only from Kotlin and remain eligible for R8 shrink/optimize. -keep class app.chanora.chanora_flutter.MainActivity { *; } -keep class app.chanora.chanora_flutter.ChanoraApplication { *; } -keep class app.chanora.chanora_flutter.AndroidVoiceForegroundService { *; } -keep class app.chanora.chanora_flutter.AndroidPermissionRequester { *; } -keep class app.chanora.chanora_flutter.BackIntentBridge { *; } # SDD-109 / SDD-110 / SDD-111: JNI-referenced voice controllers. # Called from the Rust audio engine via JNI static methods. -keep class app.chanora.chanora_flutter.AndroidAudioFocusController { *; } -keep class app.chanora.chanora_flutter.AndroidBluetoothScoController { *; } -keep class app.chanora.chanora_flutter.AndroidAudioLifecycleController { *; } -keep class io.flutter.plugins.** { *; } # flutter_rust_bridge generated bindings (SDD-079 TypedBridgeFacade) — keep # the public surface so R8 does not rename or remove the symbols invoked # from the native side. -keep class ** implements io.flutter.embedding.engine.plugins.FlutterPlugin { *; } -keepclassmembers class * { @io.flutter.plugin.common.MethodChannel$MethodCallHandler *; } # --- 2. Native methods (declared with `native` in Kotlin/Java) --------------- -keepclasseswithmembernames class * { native ; } # --- 3. AndroidVoiceForegroundService (SDD-107) ------------------------------ # The service is referenced by FQN from AndroidManifest.xml and by JNI from # the Rust audio engine (start/stop helpers per SDD-107 item 10). Keep the # class and its public/static members. -keep class app.chanora.chanora_flutter.AndroidVoiceForegroundService { *; } # --- 4. AndroidAudioModeController (SDD-108) --------------------------------- # Referenced from Rust via GlobalRef + static method invocation. # Wave 2B-2 owns the class; keep rule is forward-looking but harmless if # the class does not yet exist (R8 ignores keep rules for missing classes). -keep class app.chanora.chanora_flutter.AndroidAudioModeController { *; } # --- 5. Kotlin metadata + serialisation (SDD-079) ---------------------------- -keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod -keep class kotlin.Metadata { *; } # Defer to Flutter's own keep rules for the embedding layer; the Flutter # Gradle plugin contributes those automatically. If a future SDD revision # disables R8 entirely, this file can be reduced to a single TODO comment.