Files
chanora/apps/chanora_flutter/android/app/proguard-rules.pro
T
EdisonJwa 0dc8297568 feat(android,p0): foreground service, permission requester, application class, build automation
Android P0 platform shell:

- ChanoraApplication: early System.loadLibrary("c++_shared") +
  System.loadLibrary("chanora_bridge") so JNI is hot before
  MainActivity.onCreate.
- MainActivity: configureFlutterEngine + onResume/onDestroy wiring
  for BackIntentBridge and AndroidPermissionRequester; publishes
  permission-state changes through both the MethodChannel (Dart UI)
  and the JNI hook (Rust audio engine).
- AndroidVoiceForegroundService: microphone-type foreground service
  with notification channel chanora.voice.session per SDD-107.
- AndroidPermissionRequester: RECORD_AUDIO state machine with
  persisted "has-ever-requested" flag so PermanentlyDenied is
  correctly distinguished from never-asked across cold launches.
- BackIntentBridge: API 33+ OnBackInvokedCallback + pre-33
  OnBackPressedDispatcher with deterministic Dart-side policy.
- MethodChannels: centralized constants for app.chanora/*.
- build.gradle.kts: SDD-118 Gradle automation that auto-builds the
  Rust cdylib via cargo-ndk with per-ABI Exec tasks, minimal-env
  isolation, CMAKE_TOOLCHAIN_FILE pinning, libc++_shared.so staging,
  release-inspection assertion. abiFilters temporarily reduced to
  arm64-v8a only per DEC-032 (multi-ABI restoration pending).
- AndroidManifest.xml: INTERNET, RECORD_AUDIO, FOREGROUND_SERVICE,
  FOREGROUND_SERVICE_MICROPHONE, POST_NOTIFICATIONS,
  MODIFY_AUDIO_SETTINGS, BLUETOOTH_CONNECT permissions; service
  declaration with foregroundServiceType=microphone.
- proguard-rules.pro: keep rules for JNI native methods + Flutter
  plugin entry points + FRB bindings.

Trace: SDD-073, SDD-105, SDD-106, SDD-107, SDD-108, SDD-110, SDD-118,
SRS-111, SRS-119, SRS-163, SRS-187, SRS-209, SRS-215.
2026-05-18 12:35:19 +08:00

62 lines
3.2 KiB
Prolog

# 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 { *; }
-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 <methods>;
}
# --- 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.