# 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) — audio mode is # managed in Rust via direct JNI (engine.rs), not a Kotlin class. # 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) ------------------------------ # Covered by the JNI-surface keep block above. # --- 4. Android Audio Mode Controller (SDD-108) ------------------------- # SDD-108 in-call audio mode (AudioManager.setMode) is implemented in the # Rust audio engine (crates/chanora_audio/src/engine.rs) via direct JNI, # not through a Kotlin controller class. No keep rule is needed; the # engine.rs android_set_audio_mode / android_get_audio_mode helpers # resolve AudioManager at runtime via ndk_context. # --- 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.