Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[MOD] Wake on Volume Keys via android.policy.jar

OP maledyris

2nd June 2011, 10:06 AM   |  #1  
OP Senior Member
Flag Burnaby
Thanks Meter: 58
 
170 posts
Join Date:Joined: Mar 2011
Donate to Me
More
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!
Attached Files
File Type: zip wakeonvolume_v1.1.zip - [Click for QR Code] (5.56 MB, 2443 views)
Last edited by maledyris; 7th August 2011 at 11:51 AM.
The Following 28 Users Say Thank You to maledyris For This Useful Post: [ View ]
2nd June 2011, 10:23 AM   |  #2  
Senior Member
Thanks Meter: 157
 
963 posts
Join Date:Joined: Nov 2009
More
I appreciate you and your work in the development of the atrix
2nd June 2011, 10:49 AM   |  #3  
OP Senior Member
Flag Burnaby
Thanks Meter: 58
 
170 posts
Join Date:Joined: Mar 2011
Donate to Me
More
Quote:
Originally Posted by xredjokerx

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

I'm happy to help out my fellow Atrix users
2nd June 2011, 02:05 PM   |  #4  
Senior Member
Flag Maracaibo
Thanks Meter: 38
 
430 posts
Join Date:Joined: Jul 2010
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.
2nd June 2011, 02:08 PM   |  #5  
Senior Member
Flag Maracaibo
Thanks Meter: 38
 
430 posts
Join Date:Joined: Jul 2010
Quote:
Originally Posted by maledyris

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.

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
2nd June 2011, 02:13 PM   |  #6  
Senior Member
Thanks Meter: 52
 
514 posts
Join Date:Joined: Jan 2008
More
No error msgs, phone rebooted but mod doesn't seem to work, phone doesn't wake up.
2nd June 2011, 04:16 PM   |  #7  
n1ckr0th's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 89
 
214 posts
Join Date:Joined: Jun 2010
More
booting up my virtual machine as we speak
i'll report results soon.
2nd June 2011, 04:43 PM   |  #8  
n1ckr0th's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 89
 
214 posts
Join Date:Joined: Jun 2010
More
-----------------------------------------
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.
2nd June 2011, 05:25 PM   |  #9  
Senior Member
Flag england
Thanks Meter: 1,135
 
1,420 posts
Join Date:Joined: May 2010
Donate to Me
More
Quote:
Originally Posted by n1ckr0th

-----------------------------------------
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.

same here, no errors, but no choices
2nd June 2011, 05:59 PM   |  #10  
Senior Member
Thanks Meter: 2
 
153 posts
Join Date:Joined: May 2010
Quote:
Originally Posted by stevendeb25

same here, no errors, but no choices

Worked for me, just make sure you run batch as admin and put it on the root of the C drive.

Post Reply Subscribe to Thread

Tags
volume keys, wake
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes