(Q) Change HW Keyboard Layout on 4.0.2.A.0.42 - Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A

Hey Guys,
Im opening this topic here as Im not allowed yet to post in development section.
I recently flashed my SK17i with the newest firmware.
Now the HW keyboard is in qwerty layout.
Anyone knows how to change it back to qwertz?
I tried the terminal tutorial and the Rom Manager app from the thread in development section, but both dont work for me. Even after rebooting layout stays qwerty...
Sent from my SK17i

pal follow this method
h/w keyboard fix
root your phone, mount sys as writable, copy & change the xml file just using the notepad. after this paste it again.
path given in the above thread.

Phone is already rooted.
What exactly do I have to change in the xml file?
I guess it is what the "busybox sed... " command would do?
But what do I change in that file if I do it manually?
I already looked at that file but I dont really get how it works...
Would be great if someone would tell me in more detail.
Thanks
<?xml version="1.0" encoding="qwertz"/>
<Script name="cyrillic" keylayout="cyrillic"/>
<Script name="greek" keylayout="greek"/>
<Script name="hebrew" keylayout="hebrew"/>
<Script name="latin" keylayout="qwertz"/>
<Script name="thai" keylayout="thai"/>
</Keyprint>
This is what is in the file right now. Layout is qwerty.
So what am I to change to get qwertz?
Sent from my SK17i

if you have root explorer, you dont need use command line.
copy keyprint.xml on your sd-card
edit keyprint.xml with notepad++ (or other)
replace qwerty by which you want (azerty, qwertz...)
save file
now, copy keyprint.xml from your sdcard and replace/erase keyprint.xml in system/...
restart your phone
done

I used es file explorer to do this job , thus below mentioned steps are according to that
# root your phone
# open es file explorer & grant root access & mount system as writable from settings menu (see attached screenshot)
# now go to the following path - system/usr/keyboard-config & copy keyprint.xml to your sd card & move it to your desktop for edit (you can edit from your phone also if you have any editor for it) [to go to system folder press the star icon on top left hand side of the window of es file explorer]
# modify the latin line - <Script name="latin" keylayout="your region lang"/>
# save the xml file & put it back to the system folder. restart your phone. & voila!! you got your usual keyboard
I hope it helps

I know how to edit files and use root explorer thats not the problem.
But I dont know what (else) to change in the xml file. I postet its contents in my post above.
As you can see it already states latin = qwertz. still the layout is qwerty.
The term qwerty does not even show up anywhere in that file...
I also rebooted quite some times now
Is there maybe another thing which has to be edited?

upload your original xml file & let us know which firmware you used in your phone

As hotdude said the only thing you needed to change is the latin line
Your xml file is not correct beacause you have "<?xml version="1.0" encoding="qwertz"/>"
instead of <?xml version="1.0" encoding="utf-8"?/>
look mine :
Code:
<?xml version="1.0" encoding="utf-8"?>
<Keyprint>
<Script name="arabic" keylayout="arabic"/>
<Script name="cyrillic" keylayout="cyrillic"/>
<Script name="greek" keylayout="greek"/>
<Script name="hebrew" keylayout="hebrew"/>
<Script name="latin" keylayout="azerty"/>
<Script name="thai" keylayout="thai"/>
</Keyprint>
just replace azerty by qwertz

Still no luck...
The file looks like this now:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Keyprint>
<Script name="cyrillic" keylayout="cyrillic"/>
<Script name="greek" keylayout="greek"/>
<Script name="hebrew" keylayout="hebrew"/>
<Script name="latin" keylayout="qwertz"/>
<Script name="thai" keylayout="thai"/>
</Keyprint>
But still got qwerty layout...
I even tried to backup qwerty-en.xml file and replace it with renamed qwertz.xml but still no change in Layout...
Of course I rebooted after every change I made.
I guess I will have to take a look into the older german firmware how it is done there...
EDIT: Firmware is the Generic Trade United Kingdom 4.0.2.A.0.42 from Wotan Server.

That's weird i have the same firmware (the UK one from wotan)
my physical keyboard is azerty when change the xml file to qwertz it's working
Edit: Your code is still not correct remove the "/" from this line :
<?xml version="1.0" encoding="utf-8"?/>
Hope for you it will work

The "/" was just a typo it is not in the actual file on the phone...
Could you be so kind to upload your complete .xml keyprint.xml file?
Maybe I messed mine up somehow...
Thank you very much.

Yes
I uploaded the keyboard-config folder in attachement

The Arabic line is missing the XML file, perhaps that's the cause that the ycript isn't running properly? I've just changed my layout from qwerty-dk back to qwertz without problems.

Thank you so much peexl
My .xml file was really messed up.
Mine looked like:
<Script name="latin" keylayout="qwertz"/>
And the correct version is:
<Script keylayout="qwertz" name="latin"/>
Dont know how it got that wrong as it was that way for every language, maybe something was not flashed right...
But anyhow IT WORKS NOW
Thanks to everyone who posted to help
and special thanks to peexl for posting your files ^^

Related

[GUIDE] Wrong hardware keyboard layout

Okay. Since a lot of people are starting to link to this thread when people have problems with the hardware keyboard, I thought I would change this post to a guide instead
This guide is using ADB. Guide to root explorer method: http://forum.xda-developers.com/showpost.php?p=8971685&postcount=33 (Credits to the original poster).
1. Paste the following lines in a CMD (windows) or Terminal (mac) and it's assumed that you have root
Code:
adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
cp /system/usr/keyboard-config/keyprint.xml /sdcard/keyprint.xml
Now you have the keyprint.xml on your SD Card. Open it with your favorite text editor (On your computer).
You will get a file looking like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
*********************************************************************
* ____ _____ _ *
* / ___| ___ _ __ _ _ | ____|_ __(_) ___ ___ ___ ___ _ __ *
* \___ \ / _ \| '_ \| | | | | _| | '__| |/ __/ __/ __|/ _ \| '_ \ *
* ___) | (_) | | | | |_| | | |___| | | | (__\__ \__ \ (_) | | | | *
* |____/ \___/|_| |_|\__, | |_____|_| |_|\___|___/___/\___/|_| |_| *
* |___/ *
* *
*********************************************************************
* Copyright 2010 Sony Ericsson Mobile Communications AB. *
* All rights, including trade secret rights, reserved. *
*********************************************************************
-->
<!--
Keyprint name: QWERTY Swedish/Finnish
-->
<keyprint>
<script name="cyrillic" keylayout="cyrillic"/>
<script name="greek" keylayout="greek"/>
<script name="latin" keylayout="qwerty-no-dk"/>
</keyprint>
It's the line
Code:
<script name="latin" keylayout="qwerty-no-dk"/>
We're interested in. "qwerty-no-dk" represents your hardware keyboard layout.
This can be changed to anything found in the layouts folder.
You can see the avaliable languages by typing the following commands (I assume you started a new CMD or terminal)
Code:
adb shell
su
cd /system/usr/keyboard-config/layouts
ls
Now you get a list of all the avaliable languages in your firmware. And can change the keyprint.xml file accordingly.
When you're done, save the file. It's now time to upload it again.
And again, type the following commands, in a new CMD or Terminal.
Code:
adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
cd /system/usr/keyboard-config/
rm -r keyprint.xml
cp /sdcard/keyprint.xml /system/usr/keyboard-config/keyprint.xml
Now you need to reboot your phone, and you'll have the new hardware layout
ENJOY!
(Oh, and if there's any errors in this guide, please tell me. This is done out of my memory.)
Original post said:
Hey!
I've changed my build.prop file to a NG2 code yesterday, and got the 1.2 update for my X10 mini pro.
However, now the keyboard layout of the hardware keyboard is swedish or something. I want it to be danish!
Æ becomes ä
Ø becomes ö
But å is right.
What file/files should I look in for the config?
I've got danish language on the phone, it's just the layout for the hardware keyboard that's wrong.
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=7827223&postcount=88
vlissine said:
http://forum.xda-developers.com/showpost.php?p=7827223&postcount=88
Click to expand...
Click to collapse
hmm thanks. but it didn't work
I've got the file, and as I thought it said swedish / finish layout.
It looked like this:
Code:
<keyprint>
<script name="cyrillic" keylayout="cyrillic"/>
<script name="greek" keylayout="greek"/>
<script name="latin" keylayout="qwerty-se-fi"/>
</keyprint>
I've tried changing it to:
Code:
<keyprint>
<script name="cyrillic" keylayout="cyrillic"/>
<script name="greek" keylayout="greek"/>
<script name="latin" keylayout="qwerty-dk"/>
</keyprint>
didn't work.
Then I tried:
Code:
<keyprint>
<script name="cyrillic" keylayout="cyrillic"/>
<script name="greek" keylayout="greek"/>
<script name="latin" keylayout="qwerty-dan"/>
</keyprint>
And still no luck
Any ideas?
How about qwerty-da?
thekindladies said:
How about qwerty-da?
Click to expand...
Click to collapse
nope
Checked the folder Layouts inside the keyboard-config folder. And in there there's a layout called qwerty-se-fi (like it was when I pulled the keyprint.xml the first time), and there's one called qwerty-no-dk and i've tried changing the keyprint file to qwerty-no-dk, but still no luck :S
nevermind.. played around with the files, and now it works.. don't know what I did
But thanks for your help!
and I was just about to tell you I was going to try it out on my phone. I might do it anyway. I might be asking for your help
thekindladies said:
and I was just about to tell you I was going to try it out on my phone. I might do it anyway. I might be asking for your help
Click to expand...
Click to collapse
hehe.. You just do that
think the trick is to delete the original keymap file from the phone before copying. and not just overwriting.
And maybe to do a restart immediatly after, and selecting the right language (again) in the settings..
That's what I did when it worked
I simply moved my modified file to the keyboard-config folder with root explorer and it got overwritten. I now definitively have a qwerty keyboard. Tell me, where are those elusive Danish letters supposed to be?
ok, found them. though i didn't need to change the language in settings. lovely. i shall certainly not be keeping azerty =D
thekindladies said:
ok, found them. though i didn't need to change the language in settings. lovely. i shall certainly not be keeping azerty =D
Click to expand...
Click to collapse
haha
maybe that's not what did the trick then.. As said, I don't know what I did
change in the last of the 3 lines the "qwerty-se-fs" value to any name found in ./layout/ (without .xml added to the name of course)
(change description as well if you like)
delete keyprint.xml before copying modified keyprint.xml
don't know if deleting is necessary, but works definately
good work guys!
greets Mo
Mooozer said:
change in the last of the 3 lines the "qwerty-se-fs" value to any name found in ./layout/ (without .xml added to the name of course)
(change description as well if you like)
delete keyprint.xml before copying modified keyprint.xml
don't know if deleting is necessary, but works definately
good work guys!
greets Mo
Click to expand...
Click to collapse
can you please be a bit clearer?
which files do we change?
he is talking about the keyprint.xml in system/usr/keyboard-config folder and the keyboard layout file (e.g. qwerty-se-fi.xml) in the system/usr/keyboard-config/layouts folder.
check the layouts that are already present in the layouts subfolder. if the one you need is already there, simply edit the keyprint.xml file to change the line before last to match the layout you need.
i have an azerty keyprint but if i needed the qwerty-se-fi layout, then i'd change the line <script name="latin" keylayout="azerty"/> to <script name="latin" keylayout="qwerty-se-fi"/>. there is another line where AZERTY comes up, but you don't actually need to edit that one, since it is only a comment and not a proper code.
now, if you need a layout that is not already present on the phone, you can edit a copy of an existing one in the layout subfolder.
i in the end kept my azerty keyboard with some modifications to suit my needs, like
<key id="16"
primaryNormal="a" primaryShifted="A"/>
associatedNormal=""" associatedShifted="""
<key id="17"
primaryNormal="z" primaryShifted="Z"
associatedNormal="ž" associatedShifted="Ž"/>
and so on.
it is fairly simple but make sure you overwrite the original keyprint.xml file with the modified one otherwise the system will still be reading that one instead of the new file.
i am still on android 1.6. i don't know if the paths are the same in 2.1.
this trick doesnt work for me
at default i get the swedish on the keyprint, it messed up with the hardware keyboard espesially with the comma, dot, ? and so on. and then i modified the keyprint
from qwerty-se-fi to qwerty-en
reboot
hey its still like that....didn't work HELP
casablank0,
check the file again to verify that the changes were saved. i did exactly the same thing using root explorer and it works.
i did, in fact i've tried many times, reboot many times....
didn't work....
totally confused
maybe you could attached or paste the content of the file here so others can help out
thekindladies said:
he is talking about the keyprint.xml in system/usr/keyboard-config folder and the keyboard layout file (e.g. qwerty-se-fi.xml) in the system/usr/keyboard-config/layouts folder.
check the layouts that are already present in the layouts subfolder. if the one you need is already there, simply edit the keyprint.xml file to change the line before last to match the layout you need.
i have an azerty keyprint but if i needed the qwerty-se-fi layout, then i'd change the line <script name="latin" keylayout="azerty"/> to <script name="latin" keylayout="qwerty-se-fi"/>. there is another line where AZERTY comes up, but you don't actually need to edit that one, since it is only a comment and not a proper code.
now, if you need a layout that is not already present on the phone, you can edit a copy of an existing one in the layout subfolder.
i in the end kept my azerty keyboard with some modifications to suit my needs, like
<key id="16"
primaryNormal="a" primaryShifted="A"/>
associatedNormal=""" associatedShifted="""
<key id="17"
primaryNormal="z" primaryShifted="Z"
associatedNormal="ž" associatedShifted="Ž"/>
and so on.
it is fairly simple but make sure you overwrite the original keyprint.xml file with the modified one otherwise the system will still be reading that one instead of the new file.
Click to expand...
Click to collapse
that was very clear...thank you man.
but still no success here...
keyprint already says qwerty-en and that xml is in my layouts folder but its like the system is still reading the qwerty-se-fi layout!
i'm gonna try editing the qwerty-se-fi.xml to reflect the qwerty-en layout and see if it works...
*no go...
it's as if it's reading another keyprint.xml somewhere...
are all the ones editing the keyprint.xml here on 2.1?

Fixing the mini pro keyboard layout in2.1

First root the phone.
http://forum.xda-developers.com/showthread.php?t=824788
Then fix the layout.
http://forum.xda-developers.com/showpost.php?p=7827223&postcount=88
That´s all, folks!
I can't change my layout.
My layout code is: <script name="latin" keylayout="qwerty-se-fi" />
Any ideas to change it?
I'm from portugal...
EDIT
Forget it, just needed to restart the phone

[Q]how to add lines to xml

in order to get a mod to work in my theme i need to add a couple strings to my public.xml thats found in my framework-res.apk. i used ultracompare to compare 2 different xml files and i know what needs to be added to my xml file. i use notepad ++ to edit values but never added strings.
1. can i use notepad++ to add the strings to my public.xml?
2. does it matter what line they end up on?
I use Open XML Editor, but I am sure you can use whatever works best for you. Notepad would hurt my brain though.
As far as the Public.XML, I don't think you can just remove and add lines to it...
The way it was explained to me was that any extra or new pngs added to a theme will be added into the Public.xml by way of "aapt". So there is no need to add. As far as removing items... well the entries are all coded a specific way so if you remove line 100... then everything from 101 to the end will be off by 1 and cause a lot of problems. An example...
<public type="attr" name="exported" id="0x01010010" />
<public type="attr" name="process" id="0x01010011" />
<public type="attr" name="taskAffinity" id="0x01010012" />
<public type="attr" name="multiprocess" id="0x01010013" />
<public type="attr" name="finishOnTaskLaunch" id="0x01010014" />
So as you can see the id used increases and then is associated with a specific item from within your apk. So as far as I know the best way to modify something (like a theme or etc) is to work with a Public.XML that has less in it so you can add to it... or just keep all those items in there (pngs, etc) and just make them a 1x1 image. Not the best way... but from what I have seen it has been done by many a theme maker and ROM builder.
Hope that answers your question.
** edit **
I just realized that I may had confused you (not knowing your knowledge level) so... The items are added to the Public.XML when you build the APK back together after editing it. This can be done with the apktool, which uses the aapt to do it's job. At least that is how it has all been explained to me so far. I also need to modify a Public.XML for my framework-res.apk and ran into problems here.
You don't need to worry about adding pngs to the public.xml. just put the pngs in place in the decompiled apk along with the xml that's using the pngs. You can't add pngs that aren't being used, which is the only requirement.
Run 'apktool b' to rebuild the apk and the pngs should be added to the public.xml. that data will be in the resources.arsc file in the new apk if you had no errors. Copy that to your original apk and you're set.
You can decompile your recompiled apk if you want to see the newly added entries to the public xml. But that's just for fun.
Note; I found in the framework 21 for backflip that there was no more room for draw9.png images, just regular pngs.
Also, if you copy any1 else draw9.pngs from their apk make sure you copy the png from an unzipped apk and not a decompiled apk. Decompiles adds the 1 pixel ring around the image that wont go away unless recompiled. And you can't replace draw9 images to recompile or apktool will try to add it as a new draw9.png to public xml and error out. Just insert to your original apk.
That should cover all bases.
Im sorry, the second post threw me off. You said strings specifically. I would think the rule should apply the same. Use the string in an xml and the string is declared in another xml in the values folder, I think its strings xml. The compiled string resources will be in the resources.arsc file in the new apk.
djstaid said:
I use Open XML Editor, but I am sure you can use whatever works best for you. Notepad would hurt my brain though.
As far as the Public.XML, I don't think you can just remove and add lines to it...
The way it was explained to me was that any extra or new pngs added to a theme will be added into the Public.xml by way of "aapt". So there is no need to add. As far as removing items... well the entries are all coded a specific way so if you remove line 100... then everything from 101 to the end will be off by 1 and cause a lot of problems. An example...
<public type="attr" name="exported" id="0x01010010" />
<public type="attr" name="process" id="0x01010011" />
<public type="attr" name="taskAffinity" id="0x01010012" />
<public type="attr" name="multiprocess" id="0x01010013" />
<public type="attr" name="finishOnTaskLaunch" id="0x01010014" />
So as you can see the id used increases and then is associated with a specific item from within your apk. So as far as I know the best way to modify something (like a theme or etc) is to work with a Public.XML that has less in it so you can add to it... or just keep all those items in there (pngs, etc) and just make them a 1x1 image. Not the best way... but from what I have seen it has been done by many a theme maker and ROM builder.
Hope that answers your question.
** edit **
I just realized that I may had confused you (not knowing your knowledge level) so... The items are added to the Public.XML when you build the APK back together after editing it. This can be done with the apktool, which uses the aapt to do it's job. At least that is how it has all been explained to me so far. I also need to modify a Public.XML for my framework-res.apk and ran into problems here.
Click to expand...
Click to collapse
I am getting same problem as OP. You said that new PNGs or something are automatically added in public.xml right? But I am not able to see them. Actually, i added 5 more indeterminate progress bars and edited the animator xml for it too. The app compiled with apkmanager, but after decompiling the same, I don't see the new indeterminate PNGs declared in the public.xml.!! Plz. help me! I can't just flash and test immediately!! cause i don't have that phone!!
No they are not added automatically you have to add it yourself.
Only add or change lines don't remove.
For public.xml
Everything is grouped
Each group has an order
Drawable will be
0x7......00
0x7......01
................
0x7......ff
Remember they use letters also
You can add a new item
0x7.......g0
They have to be in order by resource type
String would start with ex...
0x6......00
Find the last string id that was used and add the next id.
Remember they are not always in order so actually use the text search to be sure.
Not sure if you already added the string to the strings.xml
That has to be done also.
For that open strings.xml
Copy the last line
Paste it to next line
Change string name (must match public.xml) and than value (what text is displayed)
Let me know if you need more help.
Sent from my PG86100 using Tapatalk
Here is a write up i was planning on doing for my site
decided to start it now.
Add resources to an android apk
Its just a start but should be able to do it with out problems
wes342 said:
Here is a write up i was planning on doing for my site
decided to start it now.
Add resources to an android apk
Its just a start but should be able to do it with out problems
Click to expand...
Click to collapse
Oh mahhnn!! Thanks a lot for that!! Now I don't need to depend on crappy tools for adding resources any more!!!
Once again, thanks a lot for that!!
So when i understand it right i made it like that.
I wanna add "ab_bottom_solid_dark_holo.9.png" to mms.apk.
I copy it to "drawable-xhdpi". I open "public.xml" and scroll to the end of "<public type="drawable" ". Last string is:
"<public type="drawable" name="stat_notify_sms_9" id="0x7f020254" />"
Click to expand...
Click to collapse
So i make a line under that and that would be that:
<public type="drawable" name="ab_bottom_solid_dark_holo" id="0x7f020255" />
Click to expand...
Click to collapse
In the whole xml is no other "7f020255". So that would be all? No other changes to do?
Basian Mile said:
So when i understand it right i made it like that.
I wanna add "ab_bottom_solid_dark_holo.9.png" to mms.apk.
I copy it to "drawable-xhdpi". I open "public.xml" and scroll to the end of "<public type="drawable" ". Last string is:
So i make a line under that and that would be that:
In the whole xml is no other "7f020255". So that would be all? No other changes to do?
Click to expand...
Click to collapse
Everytime I've added a drawable, or a string, to my apps, I've never had to put them into public.xml
All I do is compile and they're added automatically. The only time I need to touch public.xml is if I want to remove something.
That would be nice. iam on JellyBean on my Galaxy Nexus and use apktool cmd. And it just gave me errors.
What do u use to compile. Maybe its a nice Tool with more Functions.

[RESOURCES] - Theming the TF201: tools, processes, locations, etc.

Ok, so we have a couple of threads in the Atrix Forums, that have helped us themers along, and with the custom Roms coming along for the Prime, I have started to see a need for this type of thread here.
The goal of this thread is to have a place for us to discus themeing questions, locations, problems, etc.; that way we are not cluttering up the individual theme or rom threads with questions or problems.
As we are unable to let successively recompile the stock Asus TF201 SystemUI.apk, this thread is primarily intended for custom roms like AOKP, CM9, etc.
If you are looking to theme your stock SyetemUI, you can simply copy the apk to your computer, open the .apk file with a zip program (like Winrar) pull out the following folder: /res/drawable-mdpi
Look through the folder, find .png files that you would like to replace, and then add your new .png files to the .apk (using Winrar or other) in the same location the original one is at. ---> Read the following rules first! <---
- Make sure to select "store" for the compression method, when replacing/adding the .png files.
- The new .png file you are using should roughly be the same dimensions as the original you are replacing.
- Leave .9.png files alone. .9.png files have to be decompiled/recompiled for them to work properly. Since, you can not successfully recompile the stock Asus systemui.apk, you can not replace .9.pngs!!!!
All that being said, lets move on to the Roms we can actually theme...
Below, I have quoted the OP from two Atrix threads that have always helped me.
*Note: These locations are for Gingerbread, however, there is some continuity between Gingerbread & ICS; although it seems a lot of the stuff that was in the framework-res for Gingerbread, it now in the systemui for ICS.
Also, if you change something in a xml file and it doesn't change, you may want to see if the same xml line is in the same file & folder in both the framework-res & systemui, and change both.
Things you should know before you get started:
- If you are replacing a 9.png or editing a xml, you will have to deompile your apk, edit, and then recompile it.
- Recompiling the camera.apk seems to break the camcorder function, and will result in a FC.
Besides the Post Below this one, here is another up-to-date guide on using APK Tools, specifically for ICS:
http://forum.xda-developers.com/showthread.php?t=1511752
Use this web page to get your custom Hex Colors:
http://www.colorpicker.com/
Main XDA General Theme Thread (get more exposure/help for your question):
http://forum.xda-developers.com/showthread.php?t=468254
***If you have any other helpful guides, webpages, etc. that you think will help us, post them, and I'll add them to the OP.***
(This quote is from: http://forum.xda-developers.com/showthread.php?t=1060199 and thanks should go to that OP).
jimbush3 said:
I know that there are a good number of Atrix users who are new to android, new to theming with android, or like me - both. It can take hours to find the right information to make the changes that you want to make, only to find out that those types of changes are phone specific and that guide that you finally found after hours of searching doesn't even apply. I ask that all Atrix themers contribute to this thread with their knowledge, processes, and best practices for theming the Atrix. This way, we can share knowledge amongst each other as well as set up some accurate guide for other Atrix themers just getting started.
Contents:
Post 1 of this thread:
apk Manager Guide
Framework Assistant - tool to push/pull framework-res.apk
Editing OR removing the status bar clock color in services.jar
Post 2 of this thread:
Setting the notification dropdown shade to transparent
I'll start off with a post that I made yesterday in response to someone's question about apk Manager.
1. apk Manager Atrix Guide
The file I am going to discuss here is /system/framework/framework-res.apk. This file contains most of the elements involved in theming your phone. There are many other smaller locations to edit, but this file contains the bulk.
Before we get started on using apk Manager, we should understand a few things about framework-res apk. This file consists of a few important elements:
regular png image files - these are standard png images and can be edited with your image editing program and saved without any problems.
draw-9 png image files - these are special types of png images denoted by a .9.png in the filename. The android system reads these filenames and recognizes the image as a stretchable image. The system knows how to stretch the image based on a 1px wide border that the image has. This border contains black dots/lines along each of the four edges that tell the system how to stretch it - if you mess with this border then the way the image stretches will changes and you may not be able to decompile/recompile the apk. The following link provides info on editing draw-9s, but I found it easiest to extract them with apk Manager, edit in gimp without touching the border, and then recompiling with apk M. More info on draw-9 pngs
xml files - these files are in binary code in the framework-res.apk. The apk needs to be decompiled in order to return these to human readable code. Also, many of your xml files are hidden within the resources.arsc file in the framework-res.apk and cannot be accessed unless you decompile.
In order to make any changes to the xml files or the draw-9 pngs within framework-res.apk you need to decompile it rather than extract it. Extracting the framework-res.apk with a program like winzip simply unzips the file and does not break the code back down to an editable format. Decompiling the framework-res.apk with a program like apk Manager will actually break down the resources.arsc file into the sepereate xmls folders (values, etc.) and also restore the instructions border to draw-9 pngs.
Draw-9 images not edited correctly will not stretch properly in the system and may cause decompilation/recompilation errors. XML files not edited correctly may also cause recompilation errors. It is very important to pay attention to the log.txt file for any errors that may be occurring during your decompilation/recompilation process.
Download apk Manager
Now here is what I've learned about apk Manager:
put framework-res.apk in the place-apk-here-for-modding folder
run the script
enter 22 to select an apk, then 1 to select your apk
press 9 to decompile the apk
go into the projects/framework-res.apk/res/drawable-hdpi folder and edit your pngs or xmls (maintain the border)
go back to the script once your done editing and enter 11 to compile
when asked if it is a system apk enter y
when asked if you want to extract other files too enter y Do not skip this step, apk Manager will seem to produce a working framework-res.apk if you skip this step but when I did it soft bricked my phone
go into the keep folder that was created and delete any pngs that you changed in the projects folder
if you change any xml files, you will also need to delete the resources.arsc file from the keep folder (this is because mane of the xml files are compiled into this resources.arsc, so to tell apk manager to rebuild it with the new xml, we need to delete the original)
go back to the script and press any key to continue
your recompiled framework-res will be in the place-apk-here-for-modding as unsigned-framework-res.apk
extract unsigned-framework-res.apk using winzip, or similar program (this is being it is compressed incorrectly)
go into the folder where you just unzipped the framework and zip it up with the compression mode set to Store - call it framework-res.apk
you are ready to go with a properly editing framework-res.apk, put it on your phone any way you like
Make sure that you have no errors when de-compiling or re-compiling. It might seem like everything is going ok, but you could end up soft bricking your phone if you don't check the log.txt in the apk Manager main folder. Check the log.txt after every decompile and recompile to ensure that you don't have a damaged framework-res.apk.
The output in log.txt should like like this for a proper decompile:
Code:
--------------------------------------------------------------------------
|Sun 05/01/2011 -- 20:11:47.57|
--------------------------------------------------------------------------
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
Could Not Find C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
And like this for a proper recompile:
Code:
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
(skipping index file 'C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\other\..\projects\framework-res.apk\assets\images\Thumbs.db')
(skipping index file 'C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\other\..\projects\framework-res.apk\assets\webkit\Thumbs.db')
The system cannot find the file specified.
If you get any errors about your images or xml then you need to fix them before you can recompile.
#framework-assistant2. Framework-res.apk Assistant
Here is a tool which I use regularly to pull the current framework-res.apk from my phone, as well as to push any updated framework-res.apk to my phone. To use this batch program you need to:
Download the View attachment 584667
Extract the zip to whereever you want the program to reside
To pull your current framework-res.apk - run the Framework-Assistant.bat and tell it to pull
To push an updated framework-res.apk - place the updated framework-res.apk in the bin/push folder, run the Framework-Assistant.bat and tell it to push the updated framework-res.apk
It is always a good idea to tell it to back up the current before pushing a new
As with any and all framework-res.apk pushes, this has the ability to soft brick your phone depending on the framework-res.apk you push, or anything else for that matter. Use at your own risk.
Here are my steps to edit framework-res.apk from start to finish which might help those unfamiliar with the process:
Run Framework-Assistant.bat and answer y to pull the current framework-res.apk from the phone, but n to push the latest version (this will simply retrieve the current framework-res.apk from your phone)
Copy that framework-res.apk from the Framework Assistant/bin/pull fodler into the place-apk-here-for-modding folder of apk Manager
rename framework-res.apk to something distinguishable, I add the current time (ex: framework-res-1016.apk). Trust me, things can get messy if you end up making a few passes with different edits, you need to keep your stuff straight.
Run Script.bat in the apk Manager folder, 22 to select which apk to use, then 9 to decompile
Go into the projects/framework-res-1016.apk folder and make any changes you wish. Most png changes will be in drawable-hdpi, xmls are pimarily located in the values and layout folders.
Once I've finished making updates, run Script.bat again, 22 to select the proper apk, then compile with 11 - follow all compilation steps above all the way through zipping it as store.
Place the new framework-res.apk in the Framework Assistant/bin/push folder and run Framework-Assistant.bat
Choose y to both pull and push the framework-res.apk (I find its always a good idea to pull your latest working framework-res.apk from the phone before dropping a new one in)
If you anticipate more edits, go back to apk Manager and paste the new framework-res.apk in the place-apk-here-for-modding fodler of apk Manager and rename it with the current time attached (ex: framework-res-1023.apk)
Delete the unsignedframework-res-1016.apk and the unsignedframework-res.apk fodler (just to keep things clean)
You now have an edited framework-res.apk on your phone and are set to fix this little issues you missed on this pass, just run the apk Manager Script.bat again, enter 22 to access your latest framework-res.apk (framework-res-1023.apk) and repeat the process.
#framework-assistant3. Editing OR removing the status bar clock in services.jar
You will need:
Some zip program, I use winrar
JDK - Java Development Kit Get the JDK
baksmali to decompile and recompile the classes.dex file - View attachment 587999
Notepad++ free editor for code editing (I recommend this program for any/all code editing, apart from hex)
Here is how to change the status bar clock color:
Install the JDK
Extract baksmali to your computer
Retrieve services.jar from the /system/framework folder
Extract services.jar using your zip program (right click on the file and choose to extract)
One of the extracted files is classes.dex, copy it into the baksmali folder
Run decompile.bat in the baksmali folder - this will decompile classes.dex and place the contents in a new folder called classout
Navigate to classout\com\android\server\status
The next step involves changing clock color:
open StatusBarIcon.smali with Notepadd++ and find this entry
Code:
.line 61
const v6, -0x1
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextColor(I)V
const v6, -0x1 identifies the color of the status bar clock. I changed this value to "const v6, -0xff000000 to set my clock to black. Essentially the last 6 digits of this entry will determine the color of the clock. Set the last six to any html color code (google it) to set your clock color. I have only tried black here as it is all I needed, so I can't personally guarantee that anything else will work.
The next step involves removing the clock:
open StatusBarPolicy.smali with Notepadd++ and find this entry
Code:
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
It should be under ".line 592", now add this line underneath the line just mentioned:
Code:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Once your done editing, save the file
Navigate back to the baksmali folder and run recompile.bat - this will rename the original classes.dex file to orig-classes.dex, and the recompiled file is saved as classes.dex
Zip up the new classes.dex along with the META-INF folder that was extracted from services.jar as, you guessed it, services.jar Leave the compression setting on Normal
Put services.jar back in your system/framework folder
This is all that I know how to do with servies.jar right now, if anyone has some additional good info please post it to this thread and I will add it on.
Can't believe I forgot to thank all those who have contributed both directly and indirectly to my knowledge thus far: Nottach, NyugenHuu, KennethPenn, riral, tonecreationz, gera4eva, HFHimself, and many random threads I found on the wonderful xda forums.
Click to expand...
Click to collapse
(This quote is from: http://forum.xda-developers.com/newreply.php?do=newreply&p=16008460 and thanks should go to that OP).
*Again, these are from Gingerbread, but may be in the same xml/location as ICS (haven't checked them all yet).
Nottach said:
Editing the status bar.
Now that you can see what needs fixing in the status bar we will decompile your original (backup) systemui.apk and edit the xmls. I will assume you have apkmanager and know how to use it. There are other guides for that so I won't go to deep into it. Look here for a video tutorial on apkmanager.
1. Decompile systemui.apk
2. Make edits to XMLs.
These are the edits I make most often.
/res/layout/status_bar.xml -
Code:
<TextView android:textSize="16.0sp" android:textStyle="bold" android:gravity="left|center" android:id="@id/onsText" android:paddingLeft="6.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:maxLength="0" /> ///HIDES CARRIER TEXT
/res/layout/status_bar_expanded.xml -
Code:
<com.android.systemui.statusbar.DateView android:textAppearance="?android:textAppearanceLarge" android:textColor="[color="Red"]#ffffffff[/color]" android:layout_gravity="center_vertical" android:id="@id/dateLabel" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" /> [color="red"]///DATE TEXT COLOR[/color]
/res/values/drawable.xml -
Code:
<item type="drawable" name="shade_bgcolor">[color="Red"]#ff162939[/color]</item> [color="red"]///NOTIFICATION TITLE BACKGROUND (eg. Ongoing)[/color]
/res/values/style.xml -
Code:
<style name="TextAppearance.StatusBar.Title" parent="@android:style/TextAppearance.StatusBar">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">[color="red"]#ffffffff[/color]</item> [color="red"]///NOTIFICATION TITLE TEXT (eg. No Notifications)[/color]
After making your xml edits recompile, be sure to delete the edited files and resources.arsc from the keep folder during recompiling. If you don't you won't see any changes.
If you compiled with no errors you're good to go. If you have errors then you have a mistake in your code. You can check the apkmanager log for line number errors.
Once recompiled you will have unsignedSystemUI.apk in your place_here_for_modding folder. Open it in winRAR along with your previous version of SystemUI.apk from the first draft and drag the images from the first draft drawable-hdpi folder into the new unsignedSysemUI.apk's corresponding folder, overwriting the images there. Now rename unsignedSystemUI.apk to SystemUI.apk and overwrite your first draft version. This is your second draft SystemUI.apk and we will create a second draft framework-res.apk in the next step using these same steps.
Click to expand...
Click to collapse
Nottach said:
Editing the framework.
We will now decompile your original (backup) framework-res.apk and edit the xmls. Again using apkmanager.
1. Decompile systemui.apk
2. Make edits to XMLs.
These are the edits I make most often.
/res/drawable/progress_horizontal.xml -
Code:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@id/background">
<shape>
<corners android:radius="5.0dip" />
<gradient android:startColor="#ff262223" android:endColor="#ff414042" android:angle="270.0" android:centerY="0.13" android:centerColor="#ff262223" />
<stroke android:width="2.0px" android:color="#ff999999" />
</shape>
</item>
<item android:id="@id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5.0dip" />
<gradient android:startColor="#80[color="red"]547f8c[/color]" android:endColor="#a0[color="red"]87cce2[/color]" android:angle="-90.0" android:centerY="0.13" android:centerColor="#80[color="red"]547f8c[/color]" />
<stroke android:width="2.0px" android:color="#ff999999" />
</shape>
</clip>
</item>
<item android:id="@id/progress">
<clip>
<shape>
<corners android:radius="5.0dip" />
<gradient android:startColor="#ff[color="red"]547f8c[/color]" android:endColor="#ff[color="red"]87cce2[/color]" android:angle="-90.0" android:centerY="0.13" android:centerColor="#ff[color="Red"]547f8c[/color]" />
<stroke android:width="2.0px" android:color="#ff999999" />
</shape>
</clip>
</item>
</layer-list>
/res/values/styles.xml - text colors
Code:
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">[color="red"]#ff555555[/color]</item> [color="red"]///POP UP MENU TEXT COLOR[/color]
</style>
Code:
<style name="Theme.ExpandedMenu" parent="@style/Theme">
<item name="listViewStyle">@style/Widget.ListView.Menu</item>
<item name="textColor">[color="red"]#ff555555[/color]</item> [color="red"]///SECONDARY MENU TEXT COLOR[/color]
<item name="windowAnimationStyle">@style/Animation.OptionsPanel</item>
<item name="background">@null</item>
[color="red"]///DELETED LINE[/color]
</style>
Code:
<style name="TextAppearance.WindowTitle" parent="@style/TextAppearance">
<item name="textSize">14.0sp</item>
<item name="textStyle">bold</item>
<item name="textColor">[color="Red">#ffffffff[/color]</item> [color="red"]///WINDOW TITLE TEXT (App Title Bar)[/color]
</style>
Code:
<style name="TextAppearance.StatusBar.Title" parent="@style/TextAppearance.StatusBar">
<item name="textStyle">bold</item>
<item name="textColor">[color="red"]#ffffffff[/color]</item> [color="red"]///STATUS BAR TITLE (May be same as SystemUI?)[/color]
</style>
Code:
<style name="TextAppearance.StatusBar.EventContent.Title" parent="@style/TextAppearance.StatusBar.EventContent">
<item name="textSize">16.0sp</item>
<item name="textStyle">bold</item>
<item name="textColor">[color="red"]#ffffffff[/color]</item> [color="red"]///FIRST LINE OF NOTIFICATION[/color]
</style>
Code:
<style name="TextAppearance.StatusBar.EventContent" parent="@style/TextAppearance.StatusBar">
<item name="textColor">[color="red"]#ffffffff[/color]</item> [color="red"]///2ND LINE OF NOTIFICATION[/color]
</style>
Code:
<style name="Widget.Button" parent="@style/Widget">
<item name="textAppearance">?textAppearanceSmallInverse</item>
<item name="textColor">[color="red"]#ffffffff[/color]</item> [color="red"]///BUTTON TEXT COLOR[/color]
<item name="gravity">center</item>
<item name="background">@drawable/btn_default</item>
<item name="focusable">true</item>
<item name="clickable">true</item>
</style>
After making your xml edits recompile, be sure to delete the edited files and resources.arsc from the keep folder during recompiling. If you don't you won't see any changes.
If you compiled with no errors you're good to go. If you have errors then you have a mistake in your code. You can check the apkmanager log for line number errors.
Now following the same steps as we did for SystemUI we will overwrite the images in the new unsignedframework-res.apk with those from the first draft framework-res.apk. By dragging from one winRAR window to the other. Once you've done that rename the new apk and overwrite the first draft version. Create a new update zip, using "store" or "none" and flash it. You should now see the text edits you just made.
Click to expand...
Click to collapse
Nottach said:
Advanced Tips
.9 Images.
--If a .9.png is all (every pixel) one color then the .9 patch does not matter.
Hex editing.
--It is not always necessary to decompile to make text color or slider edits. Instead if know what color you're looking for you can use a hex editor to make the edits.
--For instance, to change text colors without decompiling you would.
Open framework-res.apk in winRAR.
Extract resources.arsc
Open resources.arsc in a hex editor.
Search for the color in this format BB GG RR AA, as opposed to usual aarrggbb. (Red = ffff0000 = 00 00 FF FF)
Replace with desired color following same format.
Save and overwrite original by dragging new version into winRAR.
--To change slider colors without decompiling you would.
Open framework-res.apk in winRAR.
Extract /res/drawable/progress_horizontal.xml
Open progress_horizontal.xml in a hex editor.
Search for 08 00 00 1C.
After each instance examine the next four pairs.
The first few will be grey but eventually youll come to a color.
That's where you start editing. (6 total)
Replace with desired color following same format.
Save and overwrite original by dragging new version into winRAR.
Click to expand...
Click to collapse
Reserved!!
Awesome. Thanks!
Great guides for the noobies Swiftks =) Also i think i might have a work around for the patch9 pngs, Ill msg you on GChat
great stuff, thanks for sharing mate.
Sent from my TF201

[Q] Need advice on creating script

I need help on creating an app which requires root access.
Purpose of this app
1) Able to access a file in root/data/data/*APP XYZ*/*THIS FILE*
2) Generate a random string of number
3) Replace the specific string in *THIS FILE* with the randomly generated number
4) Saves *This File*
Right now I can do it manually but it is rather tedious. Was thinking if it would be possible to create an app to do this automatically with one click.
__________________________________________________________________________
After typing the above, I was thinking that maybe a shell script would do just fine.
Yeah a script would simply be more than enough !
#!/system/bin/sh
set number=$RANDOM
echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
*random unimportant stuff*
<string name="uuid">302$number-abcdefghijk</string>
</map>
" > /data/data/com.app/shared_prefs/app.xml
For some reason this script fails to run.
I want to change the uuid string but it doesnt seem to want to run.

Categories

Resources