[MOD] Wake on Volume Keys via android.policy.jar - Atrix 4G Android Development

This has been bothering me for awhile now. I set the phone on the table and browse or read on it. The screen goes off and now I have to pick the phone up to wake it back up. Very irritating! I'd rather be able to press the volume keys and use the pattern lock than use the fingerprint reader, when I'm not holding the phone.
I decided I'd look into this tonight and actually it turns out it's very easy. The script took longer than figuring the mod itself. Surprise, surprise, the solution is in android.policy.jar again.
This mod will make pressing the volume keys wake the phone first, then subsequent presses will change volume as usual. I won't bother with a detailed how-to this time since I put some time into a fairly complete script, but for people who are curious, here are the details:
File: KeyguardViewMediator.smali
Method: private isWakeKeyWhenKeyguardShowing(I)Z
How: Delete cases 0x18 and 0x19 in the switch statement at the bottom of the method. These tell it to return true for volume up and down keys. Careful about changing the others. Some refer to non-existent buttons on the Atrix, but others (as I found out) affect your headset mic button and other events. For a detailed how-to on taking apart and putting together the android.policy.jar, please see this thread
The script is now universal, for all ROMs. OS X, Linux, Windows.
How does it do that? Like this:
1. It takes android.policy.jar directly from your phone.
2. Decompiles the jar.
3. Patches it.
4. Recompiles it.
5. Pushes the jar back onto your phone.
6. Cleans up and reboots the phone.
Some prerequisites before you run the script:
1. Obviously make sure you're backed up. You can't hard brick with this, but there is a possibility of soft brick if there's a bug. It should be safe because it checks for errors at nearly every command, but nevertheless have CWM ready. I have tested this on OS X and Windows. Linux users, you will need to test this yourself. It should be fine though, because you use the same script as OS X, but with a different adb. Just verify that the script and adb have the correct executable permissions, or chmod as necessary.
2. You must have java installed on your computer because it needs that to compile the android.policy.jar file. To check, you can type, "java" in a command line window. If you get a "no java command" type message, then java isn't installed correctly on your machine, or you need to add the path to java.exe to your path environment variable.
3. You must be deodexed.
4. Make sure to set your USB connection to "None" on your phone.
5. On your phone, go to Settings > Applications > Development and make sure USB debugging is turned on.
6. Plug your phone into your PC and let it install any necessary drivers. (OS X users ignore this, Linux users... You're on your own )
7. Then you can run wakeonvolume.sh for OS X/Linux and wakeonvolume.bat for windows.
* Thanks to natboy for solving the script issue for XP users!

I appreciate you and your work in the development of the atrix

xredjokerx said:
I appreciate you and your work in the development of the atrix
Click to expand...
Click to collapse
I'm happy to help out my fellow Atrix users

nice work, although you could have just installed nolock from the market and be done with it don't need root and a a risky mod for it
I hate the sliding finger lock screen.. it's worthless... Yet if you disable the screen lock it doesn't go away. i consider that a bug.

maledyris said:
2. You must have java installed on your computer because it needs that to compile the android.policy.jar file. To check, you can type, "java" in a command line window. If you get a "no java command" type message, then java isn't installed correctly on your machine, or you need to add the path to java.exe to your path environment variable.
Click to expand...
Click to collapse
You need a java compiler (javac) or just the java virtual machine (java) ?
If you need a compiler then you need the java sdk not just the j2se

No error msgs, phone rebooted but mod doesn't seem to work, phone doesn't wake up.

booting up my virtual machine as we speak
i'll report results soon.

-----------------------------------------
Pick your ROM:
1) Bell
2) Stock ATT 1.83
3) GingerBlur v4
4) Gladiatrix
-----------------------------------------
'choice' is not recognized as an internal or external command,
operable program or batch file.
Copying system files...
135 File(s) copied
-----------------------------------------
Do you want the "No Hardkey Vibrations" mod?
'choice' is not recognized as an internal or external command,
operable program or batch file.
-----------------------------------------
Do you want the "Volume Keys Wake" mod?
'choice' is not recognized as an internal or external command,
operable program or batch file.
-----------------------------------------
Compiling classes.dex...
-----------------------------------------
Packaging android.policy.jar...
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Updating archive .\android.policy.jar
Compressing classes.dex
Compressing META-INF\MANIFEST.MF
Everything is Ok
-----------------------------------------
Cleaning up work directory...
now i believe i have the standard services.jar, because hard key vibes are back.

n1ckr0th said:
-----------------------------------------
Pick your ROM:
1) Bell
2) Stock ATT 1.83
3) GingerBlur v4
4) Gladiatrix
-----------------------------------------
'choice' is not recognized as an internal or external command,
operable program or batch file.
Copying system files...
135 File(s) copied
-----------------------------------------
Do you want the "No Hardkey Vibrations" mod?
'choice' is not recognized as an internal or external command,
operable program or batch file.
-----------------------------------------
Do you want the "Volume Keys Wake" mod?
'choice' is not recognized as an internal or external command,
operable program or batch file.
-----------------------------------------
Compiling classes.dex...
-----------------------------------------
Packaging android.policy.jar...
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Updating archive .\android.policy.jar
Compressing classes.dex
Compressing META-INF\MANIFEST.MF
Everything is Ok
-----------------------------------------
Cleaning up work directory...
now i believe i have the standard services.jar, because hard key vibes are back.
Click to expand...
Click to collapse
same here, no errors, but no choices

stevendeb25 said:
same here, no errors, but no choices
Click to expand...
Click to collapse
Worked for me, just make sure you run batch as admin and put it on the root of the C drive.

Looks like for one thing the script is using CHOICE which isn't available in Windows XP/NT. It was in MS-DOS and in Vista/Win 7.
I'm supplying the CHOICE.COM that came with the MSDOS supplement disks. You can google it and download it straight from Microsoft, so there shouldn't be any problems here. Unzip it and put it in the same directory the batch file is in. Also modify the batch file on the 12th line instead of choice /c 1234 put:
choice /C:1234
Edit: I haven't actually tried this yet, but that should get it going. Will try in a few..
Edit 2: This should only be needed if you're running WinXP/NT. I'm assuming it works under Win7 already.
Edit 3: It works! Once I added the choice.com file and modified the script as stated above, it worked on my XP box. Thanks for the mods OP! FYI, I'm on Gladiatrix v3.
Edit 4: Sorry for keep editing this post I must be bored at work today. With this latest edit, I'm uploading a zip for XP that has the choice.com file in it and the script modified to work with it. I'd think it'd work in Win7 also, but someone should test it to try it out.

natboy said:
Looks like for one thing the script is using CHOICE which isn't available in Windows XP/NT. It was in MS-DOS and in Vista/Win 7.
I'm supplying the CHOICE.COM that came with the MSDOS supplement disks. You can google it and download it straight from Microsoft, so there shouldn't be any problems here. Unzip it and put it in the same directory the batch file is in. Also modify the batch file on the 12th line instead of choice /c 1234 put:
choice /C:1234
Edit: I haven't actually tried this yet, but that should get it going. Will try in a few..
Edit 2: This should only be needed if you're running WinXP/NT. I'm assuming it works under Win7 already.
Edit 3: It works! Once I added the choice.com file and modified the script as stated above, it worked on my XP box. Thanks for the mods OP! FYI, I'm on Gladiatrix v3.
Edit 4: Sorry for keep editing this post I must be bored at work today. With this latest edit, I'm uploading a zip for XP that has the choice.com file in it and the script modified to work with it. I'd think it'd work in Win7 also, but someone should test it to try it out.
Click to expand...
Click to collapse
thank you so much natboy!
worked for me!
maleydris i love your mods, if i had a way of donating i would.

natboy said:
Looks like for one thing the script is using CHOICE which isn't available in Windows XP/NT. It was in MS-DOS and in Vista/Win 7.
I'm supplying the CHOICE.COM that came with the MSDOS supplement disks. You can google it and download it straight from Microsoft, so there shouldn't be any problems here. Unzip it and put it in the same directory the batch file is in. Also modify the batch file on the 12th line instead of choice /c 1234 put:
choice /C:1234
Edit: I haven't actually tried this yet, but that should get it going. Will try in a few..
Edit 2: This should only be needed if you're running WinXP/NT. I'm assuming it works under Win7 already.
Edit 3: It works! Once I added the choice.com file and modified the script as stated above, it worked on my XP box. Thanks for the mods OP! FYI, I'm on Gladiatrix v3.
Edit 4: Sorry for keep editing this post I must be bored at work today. With this latest edit, I'm uploading a zip for XP that has the choice.com file in it and the script modified to work with it. I'd think it'd work in Win7 also, but someone should test it to try it out.
Click to expand...
Click to collapse
Ah, sorry guys! I didn't realize that wasn't part of XP!
And thank you natboy! I'll update the OP when i'm home from work
Sent from my MB860 using XDA Premium App

franciscojavierleon said:
You need a java compiler (javac) or just the java virtual machine (java) ?
If you need a compiler then you need the java sdk not just the j2se
Click to expand...
Click to collapse
No, you don't need the compiler, just the vm.
Sent from my MB860 using XDA Premium App

franciscojavierleon said:
nice work, although you could have just installed nolock from the market and be done with it don't need root and a a risky mod for it
I hate the sliding finger lock screen.. it's worthless... Yet if you disable the screen lock it doesn't go away. i consider that a bug.
Click to expand...
Click to collapse
Nah, why would I want to completely get rid of lock? It's useful to me. I also like the fingerprint reader. I just want to be able to wake the phone's screen without resorting to the recessed power button. I'm generally satisfied with the locking mechanism as it is.
Granted, the script is risky as we've found the mod itself though is very clean and it's very clear cut what the code is doing there.
Sent from my MB860 using XDA Premium App

The command to remount system should be
Code:
mount -o rw,remount /dev/block/mmcblk0p12 /system

maledyris said:
Ah, sorry guys! I didn't realize that wasn't part of XP!
And thank you natboy! I'll update the OP when i'm home from work
Sent from my MB860 using XDA Premium App
Click to expand...
Click to collapse
Glad to help, thanks for the mod. I find it easier to unlock the phone now, by pushing the volume key with my thumb and swiping with my finger. Pushing the back button with the finger and sliding seemed to herky jerky to me.

thanks natboy modphone.zip working on xp
thanks maledyris for the original mod
great mod love it guys

You guys should try out no lock. It gets rid of the lock screen and allows you to wake up the phone with the volume keys.

rdubyah said:
You guys should try out no lock. It gets rid of the lock screen and allows you to wake up the phone with the volume keys.
Click to expand...
Click to collapse
yeah, but then it gets rid of the lock screen, which defeats the purpose of what the OP wanted.

Related

creating personalized roms

my question is this, say for example I have my phone setup just as I like with the theme of my choosing, htc music app instead of the stock android app in the cyanogen mod. i would like to be able to create a rom from this setup that I could then just load on my phone as oppsed to loading a cm mod, then installing music player, then installing the theme. before the flaming begins, i tried the search to no avail. i am aware of how to sign the zip and all of that. just a point in the right direction would be MUCH appreciated.
Its something I would like to be able to do as well. According to Haykuros twitter hes going to be making a video about android rom cooking soon so that should help
jholt0130 said:
my question is this, say for example I have my phone setup just as I like with the theme of my choosing, htc music app instead of the stock android app in the cyanogen mod. i would like to be able to create a rom from this setup that I could then just load on my phone as oppsed to loading a cm mod, then installing music player, then installing the theme. before the flaming begins, i tried the search to no avail. i am aware of how to sign the zip and all of that. just a point in the right direction would be MUCH appreciated.
Click to expand...
Click to collapse
This should've gone in the Q&A section. Will probably get locked soon.
But in response to your question, I guess you could grab the CM rom, then grab the theme you use and overwrite the files in the rom, and then overwrite the music app with the HTC music. Resign and you got your update.zip customized how you want it.
xidominicanoix said:
This should've gone in the Q&A section. Will probably get locked soon.
But in response to your question, I guess you could grab the CM rom, then grab the theme you use and overwrite the files in the rom, and then overwrite the music app with the HTC music. Resign and you got your update.zip customized how you want it.
Click to expand...
Click to collapse
Thanks for the help and my apologies for the wrong section
how do you resign it?
joey3002 said:
how do you resign it?
Click to expand...
Click to collapse
by searching.
Stericson said:
Automatic version!
Do not use this to sign APK files in Vista or windows 7! It will cause your theme to loop phones when placed on a device. Only use this to sign update files if your using those O/S's
Note, this will not work if your SDK or the path that you place this in has any spaces in the dir name!
An Example of this is c:\users\Nikki and Stephen\sdk\tools
Try to put the SDK and the contents of the zip in a dir where the names are all together and not like the one above.
I have made a batch file that will automate the entire process of setting up to use the signing tool made by JF. This batch file will set the CLASSPATH, set the PATH, install the registries, and will even allow you to sign files manually if you wish. I plan on building onto this batch file to include other things. However, for the moment, it will only include what you see here.
In order to use this you should have downloaded the sdk already. Simply extract all of the files into the tools dir of your sdk, and run autosign.bat follow the instructions and go through the options one by one, starting with 1 working through 4. You can however, put the contents of this zip anywhere on your computer and it will work. It is just better to put them into the tools dir of your SDK. Especially for the consideration of future versions.
Autosign .zip: http://www.fightforthepits.com/Androidstuff/signing.zip
Want to set up the signing tool manually?
Here is the link for the signing tool: Http://www.FightForthePits.com/testsign(2).zip
Before using this you need to know how to set this up:
Now you will need to add the tools dir of your sdk to the environment variable CLASSPATH.
FOR XP:
Right click on My Computer click properties, then choose the tab that says advanced.
Click the button that says environmental variables.
Go to system variables find the one that says CLASSPATH
double click it
go to the end of variable value.
There should be a semicolon ; at the end, type in the path to the testsign.jar located in the tools directory of your SDK
for example the path to my testsign.jar was c:\sdk\android-sdk-windows-1.0_r1\tools\testsign.jar
If CLASSPATH is not in your system variables then create it.
Secondly, Find the system variable called PATH and add to the end of it, the full path to your sdk directory.
For example, mine was c:\sdk\android-sdk-windows-1.0_r2\tools
FOR VISTA:
Open a cmd prompt.
Replace THEEXACTPATHTO-TESTSIGN with the path to the dir that holds the file testsign.jar.
Type:
echo %CLASSPATH%
If it is returns %CLASSPATH%
Type the following:
set CLASSPATH=THEXACTPATHTO-TESTSIGN\testsign.jar
If it comes back with something else then
Type the following:
set CLASSPATH=%CLASSPATH%;.;THEXACTPATHTO-TESTSIGN\testsign.jar
For Example, when I type this it looks like:
set CLASSPATH=%CLASSPATH%;.;c:\Android\SDK\tools\tests ign.jar
To set the PATH
Replace THEEXACTPATHTO-SDK with the path to the tools dir of your SDK.
Now type:
set PATH=%PATH%;.;THEXACTPATHTO-SDK\tools
For example, when I type this out it looks like this:
path-%PATH%;.;c:\Android\SDK\tools
Now through doing this you have done two things, first off you have made the resigning process extremely easy, secondly you will not have to cd to the tools dir of the sdk to use adb or any other tool in the sdk.
Signing the Files:
Now right click the reg file that you extracted and choose to install it, or merge.
Now, right click an apk, do you see an option that says ResignApk? That's how you will resign your .apks and .zips.
When you choose it a cmd window should open for a few seconds and then close. the file you signed will be overwritten with the new resigned file.
If you find the right click menu not working for some reason you can type the following in cmd to sign your files: java testsign whateverfiletosign
Click to expand...
Click to collapse
.apk's not showing up after flash in resigned .zip
Ok, so I've created a ROM to my liking. All the .apk's I normally use and got rid of the ones I don't. My problem is after I customized the ROM and flashed it none of the .apk's I added showed up. The only ones that showed up were the paid apps. I never opened the .apk's and made changes. I assume I don't need to change them to .zip resign and back to apk. Do I? I am using Windows 7 though and am able to resign no problem. Thanks to anyone who replies.

.png question

Is there a way i can change png files on my phone from my phone? I want to change the calling icon in the framework-res.apk. i found out a way to change it with an app in the market. But i dont know how to put it back in the apk. Help please.
find the picture --> backup it --> put in your picture with the same name and exactly the same bigness (pixels) --> bingo
cheers, stephan1
its not that easy. any other ideas anybody please.
Well if the file is a .9.png then it won't be that easy because these files are compiled to binary. (correct me if I'm wrong devs) You will need to do a little more reading to figure this one out. Also, you can't just "unzip" an apk and mess around with the pics and think that it's going to work when you zip it backup. My understanding is that you have to place the file that you are replacing into the compressed(i.e. zipped) apk.
Once again, Devs, correct me if I am wrong but all my info comes straight from using the search button...Try it out
jballz0682 said:
Well if the file is a .9.png then it won't be that easy because these files are compiled to binary. (correct me if I'm wrong devs) You will need to do a little more reading to figure this one out. Also, you can't just "unzip" an apk and mess around with the pics and think that it's going to work when you zip it backup. My understanding is that you have to place the file that you are replacing into the compressed(i.e. zipped) apk.
Once again, Devs, correct me if I am wrong but all my info comes straight from using the search button...Try it out
Click to expand...
Click to collapse
You're right, and wrong. You can unzip an .apk and mess with the images, then rezip it back up and rename it to (yourapk).apk from (yourapk).zip, you just need to sign it when you're done.
I haven't messed with anything entitled ".9.png", but if it's binary then hex editing it is probably the quickest way to edit it, otherwise there is a program called 'apktool' that can decompile apk's and is pretty effective, I've used it a few times
dmullins80 said:
its not that easy. any other ideas anybody please.
Click to expand...
Click to collapse
Pull framework-res.apk from your phone, to your computer's desktop. Use Winrar, or a similar archive extracting program, to open the file, then click Extract -> (some folder on your desktop that has nothing else in it)
Find the picture you want to change, make sure your new picture is the same dimensions (e.g; 320x480) and is the same type of file (e.g; .png) and replace the stock image with your custom image.
Once that's done, highlight all files and folders in the root of the folder you extracted framework-res.apk to -> (if using Winrar) Right-Click -> Add to archive -> Change archive type to .zip and click OK -> Right click on your newly created framework-res.zip and change the extension to .apk (you might need to open a windows explorer window and select tools->folder options->view tab->uncheck 'hide extensions for known filetypes).
Once that's done, you'll need to sign your new framework-res.apk. You can do that with EasySign. Download EasySign to your desktop, extract the archive and open a Windows Command Prompt (Start->All Programs->Accessories->Command Prompt). You'll need the Java JDK installed.
Drag your newly created framework-res.apk file into your EasySign folder on your desktop and down the following;
Type the following, assuming you have Windows 7 or Vista:
Code:
cd C:\Users\(your username on your PC)\Desktop\EasySign
You should now see the following;
Code:
C:\Users\(your username on your PC)\Desktop\EasySign>
You should now type the following;
Code:
java -jar signapk.jar testkey.x509.pem testkey.pk8 framework-res.apk framework-res_signed.apk
It'll take a moment, then you'll see;
Code:
C:\Users\(your username on your PC)\Desktop\EasySign>java -jar signapk.jar testkey.x509.pem testkey.pk8 framework-res.apk framework-res_signed.apk
C:\Users\(your username on your PC)\Desktop\EasySign>
...and you should now have framework-res_signed.apk in your EasySign folder on your desktop.
Pull it to your desktop and rename it framework-res.apk and put it back where you got it, most likely using adb (if using adb, put it in C:\(your androidsdk folder)\tools and type the following;
Code:
adb remount
adb push framework-res.apk /system/framework
adb reboot
Alternatively, you can place it on your sdcard and use a program like Astro to move it to /system/framework and immediately reboot your phone for the changes to take effect.
Enjoy, it took me like 10 minutes to type this
-mak
Thanks for the wirte up, (i've been try to do something simaler to this for a while). I got to the end but then I get this error in the cmd window. Any thoughts?
'java' is not recognized as an internal or external command,
operable program or batch file.
jadesdan said:
Thanks for the wirte up, (i've been try to do something simaler to this for a while). I got to the end but then I get this error in the cmd window. Any thoughts?
'java' is not recognized as an internal or external command,
operable program or batch file.
Click to expand...
Click to collapse
Sorry, I should have mentioned you'll need the Java JDK installed.
.mak is that the same one by Stericson?
here
sorry if that is slightly OT, just rebuilding the PC setup and need the files, so not sure which one I want to use - his worked last time for me well.
thanks~
dianeofarcadia said:
.mak is that the same one by Stericson?
here
sorry if that is slightly OT, just rebuilding the PC setup and need the files, so not sure which one I want to use - his worked last time for me well.
thanks~
Click to expand...
Click to collapse
EasySign? I'm not sure, I've only downloaded it from grdlock's site. The one you linked to actually looks easier to use..
when you re-zip the file after editing do you use normal compression or store?
Magnum72 said:
when you re-zip the file after editing do you use normal compression or store?
Click to expand...
Click to collapse
Normal if you're in Windows, otherwise .gz (most compatible) under linux.
.mak said:
Sorry, I should have mentioned you'll need the Java JDK installed.
Click to expand...
Click to collapse
I've installed it, but I still get the same error. Do I need to set a system path within java?
If I get this working it will solve many of my 'problems' Thank you!
I used ubuntu... what I did was change the default unknown call icon... I opened the Phone.apk in ubuntu and replaced the pic with another icon from another rom of my choice making sure it had the exact same name.. then went back to windows, pushed phone.apk and got it no problem... ubuntu opens the apk's without having to unzip them...
droidfreak said:
I used ubuntu... what I did was change the default unknown call icon... I opened the Phone.apk in ubuntu and replaced the pic with another icon from another rom of my choice making sure it had the exact same name.. then went back to windows, pushed phone.apk and got it no problem... ubuntu opens the apk's without having to unzip them...
Click to expand...
Click to collapse
I did that with the numbers on the dialer and the home launcher icon in the Tainted Vanilla thread. But there are other apk's that are a bit touchy. Once I learn how to sign them, I think it might open up a whole new world of skinning for me.
Yeh it would be good to get that down... it would open a huge door.. make things easier..
Question; in order for the above process to work, must you be rooted? I would love to change icons...unfortunately my naive-impatient self flashed the leak when it was first brought public.
Ngmanis said:
Question; in order for the above process to work, must you be rooted? I would love to change icons...unfortunately my naive-impatient self flashed the leak when it was first brought public.
Click to expand...
Click to collapse
Unfortunately you do need to be rooted for these changes to occur, however you can still do some customization with apps like Bettercut or ones similar.
jadesdan said:
I've installed it, but I still get the same error. Do I need to set a system path within java?
If I get this working it will solve many of my 'problems' Thank you!
Click to expand...
Click to collapse
I didn't, and it works for me. Are you using the proper commands, exactly as shown in my tutorial?
.mak said:
I didn't, and it works for me. Are you using the proper commands, exactly as shown in my tutorial?
Click to expand...
Click to collapse
Yes! Even coy and paste (except for changing the name of the apk I'm trying to sign).
I've downloaded the java link that you provided and installed, redownloaded and installed the JRE, rebooted. THe java site tells me I have the latest and greatest of everything.
I know it's got to be something I'm doing wrong, I get the same error with Autosign and other batch signing tools. I just don't know what my problem is.
jadesdan said:
I've installed it, but I still get the same error. Do I need to set a system path within java?
If I get this working it will solve many of my 'problems' Thank you!
Click to expand...
Click to collapse
jadesdan said:
Yes! Even coy and paste (except for changing the name of the apk I'm trying to sign).
I've downloaded the java link that you provided and installed, redownloaded and installed the JRE, rebooted. THe java site tells me I have the latest and greatest of everything.
I know it's got to be something I'm doing wrong, I get the same error with Autosign and other batch signing tools. I just don't know what my problem is.
Click to expand...
Click to collapse
Did you make sure to cd into the proper folder from command prompt? I've made this mistake a time or two;
Code:
cd C:\Users\(your username on your PC)\Desktop\EasySign>
^^ assuming you have EasySign in a folder called EasySign on your desktop, and that you change (your username on your PC) to your actual username.

[script] Generic, fully automated Deodexer (OS X, Linux... Cygwin)

This is a script that I made for my own use awhile ago because I couldn't find an OS X deodexer. I recently modified it for use with Linux, and if you're on Windows and have Cygwin, well, it works with that too.
What is it:
It's a generic deodexer, for any ROM, and theoretically for any recent phone. What do I mean by theoretically? Well, the Atrix is my first and only Android so far, but I expect to be able to use it when I get others It should work with any phone that has all its framework in /system/framework and all its apps in /system/app. Any phone that doesn't have that doesn't qualify.
How does it do it:
It uses the phone's own BOOTCLASSPATH and patches together any additional necessary dependencies from /system/framework. It then uses the phone's own files to create the deodexed frameworks and apps (via JesusFreke's baksmali/smali). All the other deodexers I've seen use canned files that have been created ahead of time, or require you to specify the proper dependencies for your phone. This is fully automated and requires almost no intervention on your part. This means you don't have to go looking for "the right" deodexed files for the new stock ROM you just flashed, or know anything about dependencies. All it asks for is Super User permission at the very start (which you need to allow and check "remember", because it will need it later).
When will it be done:
In about a half hour from when you start. At least that's how long it takes on my Core2Duo 2.53Ghz, 4GB RAM MB Pro. There are 250+ files to decompile and recompile. It's a lengthy process.
Prerequisites:
1. You must be rooted with Super User installed.
2. USB Debugging must be turned on on your phone. Settings > Applications > Development > USB Debugging.
3. You need Java on your computer, and it has to be in your path (you can test by opening a terminal (or cmd for win) and typing 'java' on the command line. If you see help for that command, you're good).
There are 3 scripts:
1. deodex.sh: This is the main deodexer script. Run this to deodex a ROM for the first time. It will do its thing, and once it tells you it's rebooting, you should be deodexed.
2. postcompile.sh: If you restore to a non-deodexed state somehow and you have run deodex.sh previously on the same ROM, you can use this to skip the lengthy compiling and just deodex with the files you already created (they will be in framework.out and app.out on your computer).
3. restore.sh: Use this to return your phone to an odexed state. Obviously, you have to have used deodex.sh to deodex first.
After running deodex.sh, you may want to zip up and save framework.out, app.out, and the system folder in the deodex folder. These contain the deodexed files and your original files for the current ROM. If you ever want to use the restore or postcompile scripts, you need these.
please help
line 15: ./bin/osx/adb: No such file or directory
Error in previous command above line 18.
Exiting.
logout
cyrux said:
please help
line 15: ./bin/osx/adb: No such file or directory
Error in previous command above line 18.
Exiting.
logout
Click to expand...
Click to collapse
Interesting, either it's saying you have no /data/tmp folder on your phone, or you're missing ./bin/predeodex.sh.
Are you able to check if your phone has a /data/tmp folder? Also, a step I forgot in the OP. Do you have USB Debugging turned on?
*edit* Okay, so I downloaded my zip from here just to be sure, and tested only the section you're having trouble on by making it quit out right after the part you error'd out on. I've verified that predeodex.sh is working, so /data/tmp must be missing on your phone?

Awake screen using volume rocker

i researched this method because i noticed that i'm constantly using the power button (for screen on and off) and didn't want to wear it down prematurely. cm7/miui has this functionality built in but sense roms do not. for those of you wanting this capability on sense roms, i thought i'd share this.
before you begin, ensure that you have java installed on your pc (i'm sure most of you do). fyi, i used my windows xp pc, wordpad, and 7zip for this. i'm currently using the vu 2.39 rom.
1. Download baksmali and smali (both baksmali-1.2.8 & smali-1.2.8 jars and scripts, total 4 files) to the desktop from here (on the left, you will see the 4 links under "downloads")
2. Copy and transfer android.policy.jar (system\framework folder) from your phone to the desktop. it's also a good idea to backup the file just in case something goes wrong and you need to revert back.
3. Unzip android.policy.jar and extract classes.dex file to the desktop.
4. From the command line, navigate to the desktop and type "java -jar baksmali-1.2.8.jar classes.dex". It will create a directory named "out".
7. Open KeyguardViewMediator.smali (found in out/com/android/internal/policy/impl/) with wordpad.
8. Scroll down and find ".method private isWakeKeyWhenKeyguardShowing(I)Z".
9. Delete cases 0x18 and 0x19 in the switch statement towards the bottom of the method. Save.
10. From the command line, type "java -jar smali-1.2.8.jar -o classes.dex out". You now have a new classes.dex that has your modification.
11. Open android.policy.jar file on your desktop with 7zip and insert the new classes.dex file.
12. Copy the new file to your phone (system\framework folder, ensure that you set proper permissions) and reboot.
please note that i am not responsible if you mess anything up (although, the steps are pretty brick-proof). hack away at your own risk.
ps if you want to turn the screen off without using the power button, download "screen off and lock" from the market. awesome free app. shut down the screen by long pressing the search button.
Thanks SO much. I've been wanting something like this FOREVER. Don't like having to use widgetlocker! Appreciate the guide, I did this on my HTC Sensation and worked great. Thank you!
no problem. glad i can help.
just tried this.. perfrect on my IS
baste07 said:
just tried this.. perfrect on my IS
Click to expand...
Click to collapse
i'm glad it worked out for ya.
syc7090 said:
i researched this method because i noticed that i'm constantly using the power button (for screen on and off) and didn't want to wear it down prematurely. i think the cm7 rom has this functionality built in but i primarily use sense roms. for those of you on the same boat, i thought i'd share this.
before you begin, ensure that you have java installed on your pc (i'm sure most of you do). fyi, i used my windows xp pc, wordpad, and 7zip for this. also, i didn't connect the phone to the pc. i transferred the files manually (via microsd card). i'm currently using the vu 2.39 rom.
1. Download baksmali and smali (both baksmali-1.2.8 & smali-1.2.8 jars and scripts, total 4 files) to the desktop from here (on the left, you will see the 4 links under "downloads")
2. Copy and transfer android.policy.jar (system\framework folder) from your phone to the desktop. it's also a good idea to backup the file just in case something goes wrong and you need to revert back.
3. Unzip android.policy.jar and extract classes.dex file to the desktop.
4. From the command line, navigate to the desktop and type "java -jar baksmali-1.2.8.jar classes.dex". It will create a directory named "out".
7. Open KeyguardViewMediator.smali (found in out/com/android/internal/policy/impl/) with wordpad.
8. Scroll down and find ".method private isWakeKeyWhenKeyguardShowing(I)Z".
9. Delete cases 0x18 and 0x19 in the switch statement towards the bottom of the method. Save.
10. From the command line, type "java -jar smali-1.2.8.jar -o classes.dex out". You now have a new classes.dex that has your modification.
11. Open android.policy.jar file on your desktop with 7zip and insert the new classes.dex file.
12. Copy the new file to your phone (system\framework folder, ensure that you set proper permissions) and reboot.
please note that i am not responsible if you mess anything up (although, the steps are pretty brick-proof). hack away at your own risk.
ps if you want to turn the screen off without using the power button, download "screen off and lock" from the market. awesome free app. shut down the screen by long pressing the search button.
Click to expand...
Click to collapse
So I assume the downside isbyou lose one direction of volume change during screen off or is the missing volume link changed to the power button?
You can do the same with programs No lock, or Ripple lock.
With no lock, volume key gets you directly to launcher, and with ripple lock you have extra step to unlock screen.
I use Ripple lock and Screen off and lock on wildfire s.
Sent from my HTC Wildfire S A510e using XDA App
@nestorkg
this is a way to do it without installing and running an extra app. i guess it's more geared towards those who like to keep running apps to a minimum.
@beertime
yes, you do lose the ability to change volume while the screen is off (i.e. there is no keymap switching involved).
Or you can just go into settings > cyanogenmod settings > input then tick volume rocker.
no apps, no mods, nothing
jakeyo said:
Or you can just go into settings > cyanogenmod settings > input then tick volume rocker.
no apps, no mods, nothing
Click to expand...
Click to collapse
yes, if you are on cm7. sense roms don't have this option.
jakeyo said:
Or you can just go into settings > cyanogenmod settings > input then tick volume rocker.
no apps, no mods, nothing
Click to expand...
Click to collapse
^ lmao
syc7090 said:
yes, if you are on cm7. sense roms don't have this option.
Click to expand...
Click to collapse
You sir, I love you still for your work!
there is an app in market that goes by name no lock which does just d same
mandeep294 said:
there is an app in market that goes by name no lock which does just d same
Click to expand...
Click to collapse
again, some people want this functionality without having to install and run an app. this guide is aimed at those people. we are well aware that there are apps for this. thanks.
mandeep294 said:
there is an app in market that goes by name no lock which does just d same
Click to expand...
Click to collapse
yeah no ****! another member before you posted the exact same thing and it was explained as well, go a page back
nestorkg said:
You can do the same with programs No lock, or Ripple lock.
With no lock, volume key gets you directly to launcher, and with ripple lock you have extra step to unlock screen.
I use Ripple lock and Screen off and lock on wildfire s.
Sent from my HTC Wildfire S A510e using XDA App
Click to expand...
Click to collapse
Awesome guide. Thanks you very much
you're welcome
Thanks for this! I just tried it and it works on my Inspire running Android Revolution. So awesome!
sharksfan7 said:
Thanks for this! I just tried it and it works on my Inspire running Android Revolution. So awesome!
Click to expand...
Click to collapse
np. this method should work on most htc/sense phones.
nice, i didn't know all that stuff
@syc7090 do you know wich lines should i modify to get the volume buttons to change songs feature?
qelavidamelleve said:
nice, i didn't know all that stuff
@syc7090 do you know wich lines should i modify to get the volume buttons to change songs feature?
Click to expand...
Click to collapse
no idea. i tried to figure that out but didn't have any luck.

[MOD] Lower Auto-Brightness levels to save battery

This is best done after you flash a ROM as you might lose some settings.
(I noticed my wall paper changed and i had to sign back into Google account)
---This framework-res.apk file is different for every ROM---
Hi,
I wanted to share a little mod that could help in extending battery life - lowering default auto-brightness levels. As all of You know our big, bright SuperLCD is an excelent display but for that it uses most of our battery:/
I like the idea of auto-brightness but I find it too bright for most of the time. Setting brightness manualy to one level makes it either too dim or it uses too much battery and switching it all the time that You go outside or turn on the light is a little bit inconvenient.
In order to lower auto-brightness levels You have to change values in framework-res.apk/res/values/arrays.xml and here is how (read whole post first )
These are stock HTC Raider values:
Click to expand...
Click to collapse
Code:
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>75</item>
<item>75</item>
<item>75</item>
<item>97</item>
<item>120</item>
<item>142</item>
<item>170</item>
<item>198</item>
<item>227</item>
<item>255</item>
</integer-array>
These are values that I use and found best for me:
Code:
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>20</item>
<item>40</item>
<item>50</item>
<item>70</item>
<item>90</item>
<item>100</item>
<item>130</item>
<item>155</item>
<item>180</item>
<item>225</item>
</integer-array>
These brightness levels are corresponding to the amount of light that light sensor is getting - the lowest value is while in the low light the highest when for example your phone is in direct sunlight. Brightness values are defined by numbers 1 is the lowest possible setting and 255 is the maximum brightness that can be set.
As You can see I was pretty aggressive with lowering these values and yet the screen is still bright in every situation. You can set them a little bit higher or lower in order to suit your preferences.
Here is a guide on how to perform this mod on any framework-res.apk using apk manager (thanks for the guide goes to desean):
1. Download APK manager and unpack somewhere
2. Grab framework-res.apk from your phone under \system\framework\ (e.g. adb pull) and place it in the "place-apk-here-for-modding" folder
3. Run Script.bat and select option 9
4. Once done, go to projects\framework-res.apk\res\values\arrays.xml and edit your values as per first post.
5. Once edited, compile the apk using option 11
6. Qn: Is this a system apk. Ans: y
7. Qn: Aside from the signatures, would .... least. Ans: y
8. Prompt: In the apk manager folder u'll find a keep folder..... done then press enter on this script. Press any key to continue . . . You have to go to "keep" folder and delete resources.arsc because arrays.xml have been changed. After this You can press any key in apk manager window.
9. Once done, input 25 in apk manager and select "unsignedframework-res.apk" by entering the number that stands for it. After selecting it You should see in apk main window in the top right corner "Current-App: unsignedframework-res.apk".
10. Now press 5 to zipalign apk. You will find your completed, zipaligned apk under place-apk-here-for-modding\unsignedframework-res.apk.
11.Rename it back to framework-res.apk and adb push the file back to your phone
Click to expand...
Click to collapse
To send it back to your phone
Prerequisites have...
The file you are pushing must be placed in the platform-tools folder of adb so if you are pushing file "framework-res.apk" this needs to be downloaded/copy and pasted in C:\android-sdk-windows\platform-tools
1: go to run and type cmd (or just open your command prompt)
2: cd C:\android-sdk-windows\platform-tools
3: adb remount
4: adb devices *if everything is set up right this should output a serial number*
5: adb push FFFFFFF.FFF /#####/###### *i hope my notes help here you need to put the file name in for the F(s) and in the pound signs you put the destination on the devices:
Code:
adb push framework-res.apk /system/framework
7. adb reboot this is how you finish
Click to expand...
Click to collapse
You have to copy the file to your phone with ADB or you will get a boot loop and have to re install your ROM.
Link for APK Manager HERE
If you have problems with apk manager showing java error (like it did) this post helped me fix that
Sources:
http://forum.xda-developers.com/showthread.php?t=1235212
http://forum.xda-developers.com/showthread.php?t=695701
http://forum.xda-developers.com/showthread.php?t=642437
APK Manager 4.9 download link (currently original thread link down)
http://www.zshare.net/download/99034654c32618ba/
WOW! I was just about to ask if anyone knew how to accomplish this! Thanks dude!
Edit: Er..phone just went into a bootloop. Lemme try again..
Edit2: I first replaced the framework-res.apk using root explorer...big mistake, phone went into a bootloop and I couldnt adb to it to push the apk correctly, whoops. Just reinstalled the ROM I was using and pushed the apk using adb and all is well.
I noticed two other very similar looking values: config_autoBrightnessLcdBacklightValuesUp and config_autoBrightnessLcdBacklightValuesDown. Is it necessary to change these as well?
m0biusace said:
WOW! I was just about to ask if anyone knew how to accomplish this! Thanks dude!
Edit: Er..phone just went into a bootloop. Lemme try again..
Edit2: I first replaced the framework-res.apk using root explorer...big mistake, phone went into a bootloop and I couldnt adb to it to push the apk correctly, whoops. Just reinstalled the ROM I was using and pushed the apk using adb and all is well.
I noticed two other very similar looking values: config_autoBrightnessLcdBacklightValuesUp and config_autoBrightnessLcdBacklightValuesDown. Is it necessary to change these as well?
Click to expand...
Click to collapse
Yes you have to use adb ill put that in the first post,
to be honest i am not entirely sure what that is for i assume, that it is when you move the slider what values it displays when you slide it, i noticed a change without changing those values.
also i changed the button back lights to 200, i find it more than enough for me.
Is there a working mirror to APK manager? The link in the thread is down.
uploaded
sbddude said:
Is there a working mirror to APK manager? The link in the thread is down.
Click to expand...
Click to collapse
uploaded here
http://www.zshare.net/download/99034654c32618ba/
Serious props to you jul644 for detailing this process! I've always hated how the Hero, Evo, & now Vivid I've had never got dark enough in pitch black rooms, and now I'm excited to fix that problem. I was curious though since I just modded my battery meter using UOT Kitchen, if I could drop in the backlight-modded framework-res.apk via 7-zip replacing the UOT framework-res.apk file then flash it via recovery. I wonder if that would make me sign into Google and mess with settings like you mentioned. Thanks.
How-To with UOT
jul644 said:
You have to copy the file to your phone with ADB or you will get a boot loop and have to re install your ROM.
Click to expand...
Click to collapse
How, if it's possible, do we integrate this modded framework-res.apk into a UOT Kitchen zip flash file? I want to mod my battery icons and would like to install at the same time so one doesn't interfere with the other. Should I upload the framework-res.apk from this to UOT Kitchen (with my original SystemUI.apk) and then change the battery icons, then download and flash?
Thanks for your help!
*****EDIT - 2/15/2011*****
Ok so I did the framework-res.apk edits by decompiling/recompiling per jul644, uploaded that into UOT Kitchen along with original SystemUI.apk and com.htc.resources.apk. I chose my battery icon mod, downloaded, cleared all the caches and flashed in recovery with no problems ) Just wanted to let you guys know how to make it a recovery flashable zip instead of pushing via ADB.
ICS?
So can anyone confirm or deny if this still works wit ICS will be trying it myself, when I get a chance, but would rather not waste time if it wont work!
It does work, I have done it. ICS it's just more difficult to decompile & recompile. I added it & 1% stock-style battery icons into Pirateghost's CWM .56 flashable ROM.
Keep getting errors when recompiling using stock telstra ICS+ root
error on 1st line after selecting option 11 ie. step 5 above
could not find sources????
Any suggestions what I am doing wrong????
---------- Post added at 09:37 PM ---------- Previous post was at 09:24 PM ----------
okay also getting this error twice before it de-compiles
the system cannot find the path specified
then seems to decompile happily???????????
Any suggestions?
I'm getting an 'Operation not permitted' when I try to remount before pushing the file back. Anyone else having this problem? I'm running a WCX GB ROM (no ICS, I'm on Rogers).
formicae said:
I'm getting an 'Operation not permitted' when I try to remount before pushing the file back. Anyone else having this problem? I'm running a WCX GB ROM (no ICS, I'm on Rogers).
Click to expand...
Click to collapse
are you trying to remount your sd card? if so do not, just select charge only
No, just trying to remount as per the instructions in the first post, so /system is R/W. Setting it to charge only. No dice.
I tried doing it in recovery (by mounting /system, then going through the ADB commands, all of which are successful), but the result is a bootloop once I'm done.
Edit: It's also worth noting that newer versions of APK Manager/Multi-tool seem to have different numbering for the operations. In step 9, number 22 sets the compression level, whereas I think it used to set the active APK (which I think is 25 now).
I ended up taking the stock framework-res from the ROM, modifying the arrays.xml values as per the OP instructions, then going through the UOT Kitchen (I had a battery mod anyway). Worked perfectly.
Thanks to pauley for reporting success earlier, which provided me with the workaround.
Has anyone done this that could possibly create a flashable zipped version of it? I tried to do it myself but with the new APK Multi Tool things were different to the instructions of OP and I couldn't get it to work
Edit: Nvm managed to fix it and make my own flashable zip. Thanks for the effort OP
I have tried to do this... And I keep getting an error on the recompile side...
Just wondering... Does apkmanager require windows 7 or something... Or is there some reason it wouldn't work on windows xp?
Sent from my HTC PH39100 using Tapatalk 2
rignfool said:
I have tried to do this... And I keep getting an error on the recompile side...
Just wondering... Does apkmanager require windows 7 or something... Or is there some reason it wouldn't work on windows xp?
Sent from my HTC PH39100 using Tapatalk 2
Click to expand...
Click to collapse
The errors I encountered when compiling were solved by:
1) Putting Java in the windows path
2) Putting ADB in the windows path
3) Not having any spaces in the APK Manager file path
There are no OS dependencies that I'm aware of. Just open the log from within the APK manager and you should be able to identify the error.
The problem is I don't really speak java all that well...
Could I just move the java executable to the working directory?
Sent from my HTC PH39100 using Tapatalk 2
rignfool said:
The problem is I don't really speak java all that well...
Could I just move the java executable to the working directory?
Sent from my HTC PH39100 using Tapatalk 2
Click to expand...
Click to collapse
For java, all you have to do is download the JDK (i got the 32 bit version), and then add 'C:\Program Files (x86)\Java\jdk1.7.0_03\bin' to the windows path so it becomes something like:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MATLAB\R2011a\runtime\win64;C:\Program Files\MATLAB\R2011a\bin;C:\Program Files (x86)\MKVToolNix;C:\Program Files (x86)\Java\jdk1.7.0_03\bin;C:\Android\android-sdk\platform-tools\;C:\Android\APKMultiTools\
For Windows XP, you'd probably be running 32 bit and so it would be installed in the regular program files.
pod0087 said:
For java, all you have to do is download the JDK (i got the 32 bit version), and then add 'C:\Program Files (x86)\Java\jdk1.7.0_03\bin' to the windows path so it becomes something like:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MATLAB\R2011a\runtime\win64;C:\Program Files\MATLAB\R2011a\bin;C:\Program Files (x86)\MKVToolNix;C:\Program Files (x86)\Java\jdk1.7.0_03\bin;C:\Android\android-sdk\platform-tools\;C:\Android\APKMultiTools\
For Windows XP, you'd probably be running 32 bit and so it would be installed in the regular program files.
Click to expand...
Click to collapse
thanks for the help! can you tell me the new number system with apk manager?

Categories

Resources