Files
Yu-gaandClaude Sonnet 4.6 eff8784bd6 feat(tts): add multi-provider TTS support (OpenAI, ElevenLabs, VOICEVOX) (#164)
* feat: add multi-provider TTS support and build flavor split

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tts): code review fixes - i18n, bugs, copyright compliance

- Move all hardcoded Japanese UI strings to strings.xml (~35 entries)
  for proper i18n across TTS providers, CreditsScreen, SettingsActivity,
  and VoiceVoxModelManager
- Fix TTSManager.reinitialize(): add missing BuildConfig.FLAVOR guard
  so VoiceVoxProvider is only instantiated in 'full' flavor builds
- Fix VoiceVoxProvider: remove duplicate VVM_FILE_MAPPING; delegate to
  VoiceVoxCharacterData as single source of truth
- Fix VoiceVoxCharacterData: align style IDs with SettingsActivity
  CHARACTERS (official VOICEVOX style IDs) and add missing characters
  (玄野武宏, 白上虎太郎, 青山龍星) for correct copyright display
- Fix VoiceVoxProvider.speak(): call synthesizer.metas() as method
- Fix OpenAIProvider: use prepareAsync() instead of blocking prepare()
- Fix ElevenLabsProvider, OpenAIProvider: delete temp files in speak()
  (speakWithProgress already did cleanup; speak() did not)
- Fix CreditsScreen: wrap all startActivity() calls in
  ActivityNotFoundException handler; add character credit fallback
  when styleId is unregistered (copyright compliance)
- Add ProGuard rules for new TTS provider interface and classes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tts): address code review findings

- VoiceVoxProvider: remove debug metas() enumeration loop that ran on
  every speak() call (overhead + unnecessary logging in production)
- ElevenLabsProvider, OpenAIProvider: replace hardcoded English fallback
  string "Not configured" in speakWithProgress() with string resource
- .gitignore: add *.vvm to prevent accidental commit of large model
  files (50-75 MB each, downloaded at runtime from GitHub releases)
- Remove erroneously committed placeholder app/src/full/assets/0.vvm
  (contained "Invalid username or password." — not a real VVM model)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(voicevox): implement actual VVM download and add setup code to settings

- Fix VoiceVoxSetupDialog: replace fake progress simulation with real
  downloads via VoiceVoxModelManager.copyDictionaryFromAssets() and
  downloadVvmModel(). Dialog now moves inside VoiceVoxSettingsCard so
  refreshStatus() is called immediately on completion.
- Fix VoiceVoxModelManager stub (standard flavor): align sealed class
  API (CopyProgress/DownloadProgress) with full flavor so SettingsActivity
  compiles against the same interface on both flavors.
- Add setup code input to Gateway tab in SettingsActivity: paste a code
  from `openclaw qr --setup-code-only` and tap Apply to auto-fill host,
  port, TLS, and token — matching the SetupGuideScreen behaviour.
- Remove spurious debug metas() logging from VoiceVoxProvider.speak().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(voicevox): correct official style IDs and VVM file mappings

- VoiceVoxCharacterData: rewrite all style IDs to match official VOICEVOX
  Core API (voicevox_vvm 0.16.x) per README
- SettingsActivity.VoiceVoxCharacters: sync CHARACTERS list and
  VVM_FILE_MAPPING with corrected IDs
- VoiceVoxModelManager: drop unused 1.vvm/2.vvm, add 9.vvm/10.vvm/15.vvm
  for 白上虎太郎, 玄野武宏 extra styles, 青山龍星

Key corrections (old → new):
  ずんだもん ヒソヒソ: ID 11/0.vvm → 38/5.vvm
  ずんだもん ノーマル: ID 7       → 3
  白上虎太郎 ふつう:  ID 20/3.vvm → 12/9.vvm
  青山龍星 ノーマル:  ID 27/4.vvm → 13/15.vvm
  玄野武宏 ノーマル:  ID 16/2.vvm → 11/4.vvm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(credits): add Credits navigation from Settings TopAppBar

- SettingsActivity: toggle between SettingsScreen and CreditsScreen
  using showCredits state
- SettingsScreen: add onCredits callback parameter
- TopAppBar: add Info icon button that opens CreditsScreen

CreditsScreen already shows VOICEVOX credit notation
(e.g. "VOICEVOX:白上虎太郎") but had no entry point in the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* TTS再生タイミング修正、ウェイクワード後の連続会話改善、VOICEVOX設定画面にクレジット追加

* CI: standardは元の名前を維持、fullのビルド名に-in-VOICEVOXを付加

* fix

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 00:20:15 -08:00

70 lines
2.5 KiB
Prolog

# Add project specific ProGuard rules here.
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# OkHttp
-dontwarn okhttp3.**
-dontwarn okio.**
-keep class okhttp3.** { *; }
# Gson
-keepattributes Signature
-keep class com.google.gson.** { *; }
-keep class com.openclaw.assistant.api.** { *; }
# UpdateChecker uses Gson to deserialize GitHub API response.
# Without this rule, R8 renames GithubRelease fields in release builds,
# causing Gson deserialization to fail silently and return null.
-keep class com.openclaw.assistant.utils.GithubRelease { *; }
# Google Error Prone Annotations
-dontwarn com.google.errorprone.annotations.**
# Tink (Security Crypto)
-dontwarn com.google.crypto.tink.**
# Vosk speech recognition
-keep class org.vosk.** { *; }
-dontwarn org.vosk.**
# JNA (used by Vosk) JNA uses reflection to access the 'peer' field
# in com.sun.jna.Pointer and native method registration in com.sun.jna.Native.
# Without these rules, R8 strips/renames fields causing UnsatisfiedLinkError.
-keep class com.sun.jna.** { *; }
-dontwarn com.sun.jna.**
# Markdown renderer (JetBrains markdown parser)
-keep class org.intellij.markdown.** { *; }
-dontwarn org.intellij.markdown.**
# dnsjava uses Java SE / Sun APIs not available on Android
-dontwarn javax.naming.**
-dontwarn sun.net.spi.nameservice.**
-dontwarn lombok.**
-dontwarn org.slf4j.impl.**
-dontwarn org.xbill.DNS.spi.**
-keep class org.xbill.DNS.** { *; }
# BouncyCastle required for BKS KeyStore provider registration.
# Without these rules, R8 strips the security provider registration code,
# causing java.security.KeyStoreException: BKS not found at runtime.
-keep class org.bouncycastle.** { *; }
-dontwarn org.bouncycastle.**
# VOICEVOX Core
-keep class jp.hiroshiba.voicevoxcore.** { *; }
-dontwarn jp.hiroshiba.voicevoxcore.**
-dontwarn jakarta.annotation.**
# TTS Providers (multi-provider architecture)
# These classes are instantiated directly (not via reflection), but keeping them
# ensures their inner classes and data classes survive R8 in release builds.
-keep interface com.openclaw.assistant.speech.TTSProvider { *; }
-keep class com.openclaw.assistant.speech.TTSState { *; }
-keep class com.openclaw.assistant.speech.TTSState$* { *; }
-keep class com.openclaw.assistant.speech.ElevenLabsProvider { *; }
-keep class com.openclaw.assistant.speech.ElevenLabsProvider$* { *; }
-keep class com.openclaw.assistant.speech.OpenAIProvider { *; }
-keep class com.openclaw.assistant.speech.OpenAIProvider$* { *; }
-keep class com.openclaw.assistant.speech.AndroidTTSProvider { *; }