FORUMS

PSA: You Can Optimize Your Note 4’s Recents Menu & RAM

The Note 4 never had the fastest Recents Menu, and despite its 3GB of RAM, … more

XDA Picks: Best Apps of the Week (July 25 – Aug 1)

Apps are at the front and center of any smartphone experience, and with over a … more

Voices Of XDA: Orbiting The Earth With Android

Editor’s note: This week’s feature has been written by forum … more

CloudPlayer: DIY HiFi Music Streaming Solution

In our Helpful Guide to Music Streaming Services, we mentioned several different services … more

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

170 posts
Thanks Meter: 59
 
By maledyris, Senior Member on 2nd June 2011, 09:06 AM
Post Reply Subscribe to Thread Email Thread
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, 2491 views)
Last edited by maledyris; 7th August 2011 at 10:51 AM.
The Following 29 Users Say Thank You to maledyris For This Useful Post: [ View ]
 
 
2nd June 2011, 09:23 AM |#2  
Senior Member
Thanks Meter: 160
 
More
I appreciate you and your work in the development of the atrix
2nd June 2011, 09:49 AM |#3  
OP Senior Member
Flag Burnaby
Thanks Meter: 59
 
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, 01:05 PM |#4  
Senior Member
Flag Maracaibo
Thanks Meter: 38
 
More
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, 01:08 PM |#5  
Senior Member
Flag Maracaibo
Thanks Meter: 38
 
More
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, 01:13 PM |#6  
Senior Member
Thanks Meter: 57
 
More
No error msgs, phone rebooted but mod doesn't seem to work, phone doesn't wake up.
2nd June 2011, 03:16 PM |#7  
n1ckr0th's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 89
 
More
booting up my virtual machine as we speak
i'll report results soon.
2nd June 2011, 03:43 PM |#8  
n1ckr0th's Avatar
Senior Member
Flag Atlanta
Thanks Meter: 89
 
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, 04:25 PM |#9  
Senior Member
Flag england
Thanks Meter: 1,532
 
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, 04:59 PM |#10  
Senior Member
Thanks Meter: 2
 
More
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.
2nd June 2011, 07:55 PM |#11  
Senior Member
Flag Anchorage, AK
Thanks Meter: 26
 
More
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.
Attached Files
File Type: zip CHOICE.zip - [Click for QR Code] (1.1 KB, 60 views)
File Type: zip modphone for xp.zip - [Click for QR Code] (3.50 MB, 114 views)
Last edited by natboy; 2nd June 2011 at 08:33 PM.
The Following 2 Users Say Thank You to natboy For This Useful Post: [ View ]

Read More
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