diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-04 16:22:51 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-05 08:57:57 -0700 |
commit | a8d076f716bca609b7e740cd888177fbc589a521 (patch) | |
tree | ae314548cd0613131a3fb0bdce29366b7f20263e /pico/src | |
parent | 40a6eb8ef562424f4dc2324b50e1b00d58ec3c30 (diff) | |
download | external_svox-a8d076f716bca609b7e740cd888177fbc589a521.zip external_svox-a8d076f716bca609b7e740cd888177fbc589a521.tar.gz external_svox-a8d076f716bca609b7e740cd888177fbc589a521.tar.bz2 |
Fix bug 2022411.
Added support for TTS language files to be loaded from the system partition if
they are not available on the regular path (sdcard). This involves changing
the check for the availability of a language (first check in the system path,
then check the sdcard), and the language switch code (try to load from the
system path if cannot load from sdcard).
Modified the CheckVoiceData activity (which checks for the installation of
all language files) to check on both the sdcard and the system path.
Added makefiles for copying language files to the system image,
PicoLangDefaultInSystem.mk will be used in another CL to copy a default language
to the system.
Diffstat (limited to 'pico/src')
-rwxr-xr-x | pico/src/com/svox/pico/CheckVoiceData.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pico/src/com/svox/pico/CheckVoiceData.java b/pico/src/com/svox/pico/CheckVoiceData.java index 6e6e59f..036be3b 100755 --- a/pico/src/com/svox/pico/CheckVoiceData.java +++ b/pico/src/com/svox/pico/CheckVoiceData.java @@ -28,7 +28,11 @@ import android.speech.tts.TextToSpeech; * sd card. */ public class CheckVoiceData extends Activity { - private final static String dataDir = "/sdcard/svox/"; + + // The following constants are the same path constants as the ones defined + // in external/svox/pico/tts/com_svox_picottsengine.cpp + private final static String PICO_LINGWARE_PATH = "/sdcard/svox/"; + private final static String PICO_SYSTEM_LINGWARE_PATH = "/system/tts/lang_pico/"; private final static String[] dataFiles = { "de-DE_gl0_sg.bin", "de-DE_ta.bin", "en-GB_kh0_sg.bin", "en-GB_ta.bin", @@ -47,22 +51,18 @@ public class CheckVoiceData extends Activity { int result = TextToSpeech.Engine.CHECK_VOICE_DATA_PASS; - // Make sure the SD card is accessible - if (!new File("/sdcard/").canRead()) { - result = TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_VOLUME; - } - // Check for files for (int i = 0; i < dataFiles.length; i++) { - File tempFile = new File(dataDir + dataFiles[i]); - if (!tempFile.exists()) { + File tempFile = new File(PICO_LINGWARE_PATH + dataFiles[i]); + File tempFileSys = new File(PICO_SYSTEM_LINGWARE_PATH + dataFiles[i]); + if ((!tempFile.exists()) && (!tempFileSys.exists())) { result = TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA; } } // Put the root directory for the sd card data + the data filenames Intent returnData = new Intent(); - returnData.putExtra(TextToSpeech.Engine.EXTRA_VOICE_DATA_ROOT_DIRECTORY, dataDir); + returnData.putExtra(TextToSpeech.Engine.EXTRA_VOICE_DATA_ROOT_DIRECTORY, PICO_LINGWARE_PATH); returnData.putExtra(TextToSpeech.Engine.EXTRA_VOICE_DATA_FILES, dataFiles); returnData.putExtra(TextToSpeech.Engine.EXTRA_VOICE_DATA_FILES_INFO, dataFilesInfo); |