android 12系统加上TTS引擎

系统层修改:

1.frameworks/base/packages/SettingsProvider/res/values/defaults.xml

2.frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

   loadStringSetting(stmt, Settings.Secure.TTS_DEFAULT_SYNTH,
                        R.string.def_tts);

3.vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/tts/TextToSpeechSettings.java

private void checkDefaultLocale() {
        Locale defaultLocale = mTts.getDefaultLanguage();
        if (defaultLocale == null) {
            Log.e(TAG, "Failed to get default language from engine " + mCurrentEngine);
            updateWidgetState(false);
            return;
            //Log.e(TAG, "Failed to get default language from engine " + mCurrentEngine);
            //updateWidgetState(false);
            //return;
			defaultLocale =Locale.getDefault();
        }

        // ISO-3166 alpha 3 country codes are out of spec. If we won't normalize,
        }
        mLocalePreference.setSummary(mLocalePreference.getEntries()[selectedLocaleIndex]);
        mSelectedLocaleIndex = selectedLocaleIndex;
		
		if(mTts==null){
            final TextToSpeechViewModel ttsViewModel =ViewModelProviders.of(this).get(TextToSpeechViewModel.class);
            final Pair ttsAndNew = ttsViewModel.getTtsAndWhetherNew(mInitListener);
            mTts = ttsAndNew.first;
        }

更多了解请连续作者!

android 12系统加上TTS引擎_第1张图片

 

 

你可能感兴趣的:(JAVA(安卓),开发语言,java,android,studio)