Add TTS output settings to ZTE u970

Source: Internet
Author: User
Is ZTE u970 Add TTS Output settings

Shanshengsheng@gmail.com (welcome G +, Gtalk)

For a variety of reasons that cannot be expressed, China's mobile phones are basically castrated.TTSOutput settings, maybe not many people care about this setting, so there are not many people concerned about this function on the Internet. After sending a lot of posts, I decided to be self-reliant.

What is the purpose of this setting? Specifically for me, I am a hardcore grain powder and I want to use emailsGmail, Chat to useGtalkOf course you need to navigateGoogle Maps. This is requiredTTSSet. Otherwise, no voice navigation is available during navigation. Many other functions such as the reader's reading function call the system.TTS.

So much nonsense, let's get down to the truth and talk about the modification process.

 
The first step, of course, is to decompileSettings.apkBecauseTTSThe setting is part of the setting. Tools used:Apktool.

The command is as follows:

Apktool if Framework-res.apk

Apktool D settings.apk

DecompiledSettingsFolder. Because the official package isOdexSoAPKNoCodeOnly resource files, so we first find the resource fileResDirectory,TTSThe options are in the sub-options of language and input method.Res/XMLThe followingLanguage_settings.xml, Pass andAndroidSource codeLanguage_settings.xmlComparison, found to beZTEDeletedTTSOption description file, immediately copy and paste it to the corresponding place.

If there are too many codes, you will not post them. The Code that has been destroyed will be pasted:

<Preferencecategory Android: Title = "@ string/voice_category" Android: Key = "voice_category">

<Listpreference Android: Title = "@ string/recognizer_title" Android: Key = "recognizer" Android: dialogtitle = "@ string/recognizer_title"/>

<Preferencescreen Android: Title = "@ string/recognizer_settings_title" Android: Key = "recognizer_settings"/>

<Preferencescreen Android: Title = "@ string/tts_settings_title" Android: Key = "tts_settings" Android: fragment = "com. Android. settings. TTS. texttospeechsettings"/>

</Preferencecategory>

There are three items. We don't care about the two items, as long as there is a third item.

Save and compile backAPK

Apktool B settings

InSettings/DistThe directory appears.Settings.apkFile. However, this file cannot be replaced directly because it is unsigned and cannot be replaced with a signature. It is said that this file is a system file and requires a shared signature.APKGenerated inResources. ARSCAnd the one we modified just nowLanguage_settings.xmlThese two files are dragged back to the originalSettings.apkBag. SpecificallyWinRAROpen twoAPKThe package is dragged from the new one to the old one. However, you need to note that the storage option should be selected in the pop-up dialog box. Otherwise, the package will break down, I did not see this for the first time.

The following is how to copy the phone back and modify the permission.XX-,X --,X --. Restart your phone and click Settings.-The language and input method appeared,

"Text to Speech" appears(TTS)Output ", very excited. ClickSettingsJustFC.

This is requiredAndroidOfLogcatIt seems you can directlyADB logcatBut I am not a hacker. I still like to use the graphic interface to openSDKInsideDdms. batWhy?FCThe main content is as follows:

16:44:53-26. 030: E/androidruntime (3487): Java. lang. runtimeexception: unable to start activity componentinfo {COM. android. settings/COM. android. settings. subsettings}: Android. app. fragment $ instantiationexception: Unable to instantiate fragment COM. android. settings. TTS. texttospeechsettings: Make sure class name exists, is public, and has an empty constructor that is public

Used last timeMotoThey just putXMLThe file is deleted and hidden.ZTEEven worse, I even deleted the class. It seems that I am a local Chinese company, and the execution is very strong. Let's talk about it here. Don't buy it in the future.ZTEMobile phone, poor service,RomUnstable. It's good to caster things. PreviousMotoYou can do this without restarting for a month.ZTERestart in a week. I am sweating. The second step below is to add the castrated class.

Step 2: Add missingTTSRelated Classes. UsedSmail.

This option is available in the simulator, so the simulator must haveTTSSo extract from the simulatorSettings. odex,And mobile phone ExtractionSettings. odexDecompilation. Run the following command:

Java-jar baksmali-1.3.3.jar-a 15-x settings. odex

InOutThe correspondingSmaliFile, simple comparison will find lessTTS, AndNFCTwo folders,NFCThis mobile phone does not support hardware. We only replyTTS, In the simulatorTTSCopy the folder to the mobile phone decompileOutFolder, and execute the following command:

Java-jar smali-1.3.3.jar out/-O classes. Dex

Generate the modified FileClasses. Dex.

Currently, I have not found how to directly generateOdexTherefore, the generatedClasses. DexCopySettings.apkAnd put thisAPKAndDexopt-wrapperCopyTo the mobile phoneSystem/binDirectory and grant permissionsXxx X-X. I did not need to study these permissions, But I copied them on the Internet. Then enable debugging on the mobile phone.PCEnd-to-end execution:

ADB Shell

Su

CD system/bin

Dexopt-wrapper settings.apk settings. odex

In this way,TTSRelated classOdexFile, copy itSystem/APPAnd grant permissions and restart. I'm so excited again. I'm confident, but I'mFCCrash, huh, huh.

LogcatThe information is as follows:

07-26 19:48:10. 890: E/androidruntime (3067): At com. Android. settings. TTS. texttospeechsettings. oncreate (texttospeechsettings. Java: 131).

Find the source code to view131Line, the Code is as follows:

Mplayexample.Setonpreferenceclicklistener(This);

Combined with the entireOncreateCode:

 
123@Override
 
124Public Void Oncreate(Bundle Savedinstancestate){
125Super.Oncreate(Savedinstancestate);
 
126Addpreferencesfromresource(R.XML.Tts_settings);
 
127
128Getactivity().Setvolumecontrolstream(Texttospeech.Engine.Default_stream);
 
129
 
130Mplayexample=Findpreference(Key_play_example);
131Mplayexample.Setonpreferenceclicklistener(This);
 
132
 
133Menginepreferencecategory= (Preferencecategory)Findpreference(
134Key_engine_preference_section);
 
135Mdefaultratepref= (Listpreference)Findpreference(Key_default_rate);
 
136
137MTTS=New Texttospeech(Getactivity().Getapplicationcontext(),Minitlistener);
 
138Mengineshelper=New Ttsengines(Getactivity().Getapplicationcontext());
 
139
140Initsettings();
 
141}

Not foundR. xml. tts_settingsFile orAndroidmanifest. xmlThe difference between decompiled resource files and decompiled resource files is not found.

I think of all the methods I can think of, but I still can't. No one asked for help from major forums. Today finallyGfanSomeone replied to the Forum and gave me the motivation to continue my research. AndGtalkDeveloped by anzhiRomMasterGBig, engagingDroidboxOfKun Yang. I saw it yesterday.SmaliSeeMiuiPosts written in the Forum about porting to the Forum (which will be written in the reference list below). When you see a post that translates resources into a corresponding hexadecimal integer, you can open it.

 
Step 3: Adjust the resource ID

The source code is the first126The row referencesR. xml. tts_settings, FindSmaliFile, search. Line 126The Code is as follows:

. Line 126

Const v0, 0x7f05002d

 

Invoke-virtual {P0, V0}, lcom/Android/settings/TTS/texttospeechsettings;-> addpreferencesfromresource (I) V

 

WhilePublic. xmlInsideTts_settingsThe corresponding number is:

<Public type = "XML" name = "tts_settings" id = "0x7f050036"/>

 

SetSmaliIn0x7f05002dReplace0x7f050036.

There are many other things that need to be replaced, so we need to patiently replace them.FCContinue to follow upLogcatFind the resource that has no matched pair. The best thing to do is to celebrate the success.

Busy for this interface for many days.

 
Thanks:

Android APK decompilation and odex to Dex:

Http://www.cnblogs.com/wanqieddy/archive/2012/03/01/2375424.html

How to Use APK to generate odex:

Http://www.cnblogs.com/dongzhiquan/archive/2011/08/18/2143924.html

Miui RomAdaptation tour: 

Http://www.miui.com/thread-402302-1-1.html

Anexcellence TechnologyOfDeng9song

Http://bbs.gfan.com/android-4709421-1-1.html

GLarge:Https://plus.google.com/u/0/111829074553801826123/about

Kun Yang:Https://plus.google.com/u/0/109637943394058791672/about

WhereAaptSomeone from a forum could not package the package, but the source has been lost. Thank you.

Thank you for your posting.

And thanksZTEGive me the opportunity to learnAndroid!

Provide files modified based on b04, replace the files in the system/app, and change the permission to XX-X --

/files/SSS/settings.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.