ankidroid / ankidroid/Anki-Android
[BUG] Locale-only {{tts}} selects an unavailable voice instead of an installed voice
- 主要言語
- Kotlin
- スター
- 11.8k
- フォーク
- 2.9k
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 171
説明
### Checked for duplicates?
- [x] This issue is not a duplicate
### Does it also happen in the desktop version?
- [x] This bug does not occur in the latest version of Anki Desktop (26.05)
### What are the steps to reproduce this bug?
1. Use Google as Android's preferred TTS engine, with an installed French voice.
2. Use a locale-only native TTS tag in a card template:
```html
{{tts fr_FR:Front}}
```
3. Review the card.
AnkiDroid reports:
```text
ERROR_NOT_INSTALLED_YET
```
The same failure occurs with `es_ES`, despite installed French and Spanish voices that work in Android's TTS settings.
As a control, pinning an exact installed voice works:
```html
{{tts fr_FR voices=EXACT_INSTALLED_VOICE:Front}}
```
### Expected behaviour
When no voice is explicitly requested, locale-only selection should prefer a matching voice where `unavailable() == false`, and TTS should play normally.
### Actual behaviour
Locale-only selection takes the first matching voice regardless of availability, so it can select a voice marked `KEY_FEATURE_NOT_INSTALLED` and fail with `ERROR_NOT_INSTALLED_YET`.
AnkiDroid detects unavailable voices here:
https://github.com/ankidroid/Anki-Android/blob/ebcf8e0e34921628b9b8a496c66ffd4adbb3705f/AnkiDroid/src/main/java/com/ichi2/anki/TtsVoices.kt#L261-L265
But the locale-only fallback does not check availability here:
https://github.com/ankidroid/Anki-Android/blob/ebcf8e0e34921628b9b8a496c66ffd4adbb3705f/libanki/src/main/java/com/ichi2/anki/libanki/Tts.kt#L95-L101
### Debug info
```text
AnkiDroid Version = 2.24.0 (ebcf8e0e34921628b9b8a496c66ffd4adbb3705f)
Backend Version = 0.1.64-anki25.09.2 (25.09.2 3890e12c9e48c028c3f12aa58cb64bd9f8895e30)
Android Version = 16 (SDK 36)
ProductFlavor = play
Device Info = Google | google | caiman | caiman | Pixel 9 Pro | caiman
WebView Info = [com.google.android.webview | 787104703]: Mozilla/5.0 (Linux; Android 16; Pixel 9 Pro Build/CP1A.260505.005; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/150.0.7871.47 Mobile Safari/537.36
ACRA UUID = 1c121d51-efa4-4c0c-ad22-8a00d342b296
FSRS = 5.1.0 (Enabled: true)
Crash Reports Enabled = true
```
### Research
- [x] I have checked the manual and FAQ and could not find a solution to this issue
- [ ] I have not tested the latest alpha release
コントリビューションガイド
評価
この issue はまだ評価されていません。