Post Reply

[MOD] Volume Wake

OP tombriden

6th April 2012, 02:49 PM   |  #1  
OP Recognized Developer
Flag Leighton Buzzard
Thanks Meter: 317
 
211 posts
Join Date:Joined: Mar 2010
Donate to Me
More
I got so used to using the volume rocker to wake my DHD and show the lockscreen instead of the power button that i decided to try and add the same functionality to the OneX. The only caveat with this is that sometimes the volume slider shows up when it wakes, but i can live with that

Hopefully, in time, the ROM devs will add this in by default or as an option. Until then it'll require these manual mods...


Don't try the following if you're unsure what you're doing as you could potentially break the ROM if not done correctly. I recommend backing up first in Clockwork Recovery in case things go wrong.
I accept no responsibility for any issues encountered making these changes!




Requirements
Rooted phone
Android-SDK
baksmali/smali from here

Step 1 - Update android.policy.jar

1. Do the following to get the android.policy.jar from your phone and disassemble it
Code:
adb pull /system/framework/android.policy.jar .
baksmali -x android.policy.jar -o classout
2. Open the following file in a text editor
Code:
classout/com/android/internal/policy/impl/KeyguardViewMediator.smali
3. Find the method "isWakeKeyWhenKeyguardShowing(IZ)Z"
4. At the bottom of the method, there's a switch statement. Remove the following 2 lines from it:
Code:
        0x18 -> :sswitch_5
        0x19 -> :sswitch_5
5. Save the file and close it.
6. Run the following commmand to re-assemble classes.dex
Code:
smali classout -o classes.dex
7. Drag the classes.dex into the android.policy.jar file to update the file in there.
8. Push the updated android.policy.jar back to the phone
Code:
adb push android.policy.jar /sdcard/
adb shell
su
sysrw
cp /sdcard/android.policy.jar /system/framework/
chmod 644 /system/framework/android.policy.jar

Step 2 - Update Generic.kl

1. Pull the file from your phone
Code:
adb pull /system/usr/keylayout/Generic.kl
2. Open it in a text editor and change the lines
Code:
key 114   VOLUME_DOWN
key 115   VOLUME_UP
to
Code:
key 114   VOLUME_DOWN	WAKE_DROPPED
key 115   VOLUME_UP	WAKE_DROPPED
3. Push the file back to your phone
Code:
adb push Generic.kl /sdcard/
adb shell
su
sysrw
cp /sdcard/Generic.kl /system/usr/keylayout/
chmod 644 /system/usr/keylayout/Generic.kl
(of course, you could also make those changes to the file directly using a root file explorer app and text editor.)


Step 3
Reboot the phone.

Note: The first time it boots after changing android.policy.jar, there'll be an 'Android is upgrading' dialog. This is normal and it won't happen on subsequent reboots.
The Following 34 Users Say Thank You to tombriden For This Useful Post: [ View ]
6th April 2012, 02:59 PM   |  #2  
Senior Member
Thanks Meter: 96
 
527 posts
Join Date:Joined: Oct 2010
Donate to Me
How if I play music in off screen mode adjusting the volume?
6th April 2012, 03:01 PM   |  #3  
OP Recognized Developer
Flag Leighton Buzzard
Thanks Meter: 317
 
211 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by w1nter456

How if I play music in off screen mode adjusting the volume?

It'll still work, but the screen will wake too.
The Following User Says Thank You to tombriden For This Useful Post: [ View ]
6th April 2012, 05:27 PM   |  #4  
Senior Member
Thanks Meter: 26
 
155 posts
Join Date:Joined: Dec 2009
thanks much. I need this feature much.

One question, is this change use up volume or down volume or both will work?
6th April 2012, 05:37 PM   |  #5  
ckpv5's Avatar
Recognized Contributor
Flag Kuala Lumpur
Thanks Meter: 8,995
 
6,961 posts
Join Date:Joined: Feb 2008
Donate to Me
More
Am I correct that this mod will work only on deodexed android.policy.jar ?
6th April 2012, 05:47 PM   |  #6  
OP Recognized Developer
Flag Leighton Buzzard
Thanks Meter: 317
 
211 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by mmx6688

thanks much. I need this feature much.

One question, is this change use up volume or down volume or both will work?

Yep, it'll work for both.


Quote:
Originally Posted by ckpv5

Am I correct that this mod will work only on deodexed android.policy.jar ?

Yep, the above steps are for de-odexed ROMs, but you may still be able to disassemble if you pull the jar and odex and run baksmali on android.policy.odex. If you get errors trying that then pull everything from the /system/framework folder and try it again


Annoyingly, i've just noticed that once the phone goes into a 'deep sleep', the volume buttons don't always wake it. Sometimes they'll work after a double press sometimes it needs to be the power button :-\
The Following 2 Users Say Thank You to tombriden For This Useful Post: [ View ]
6th April 2012, 08:56 PM   |  #7  
Senior Member
Flag Istanbul
Thanks Meter: 428
 
776 posts
Join Date:Joined: Jan 2011
More
Thanks it worked on my device. And I have added your mod to my mod pack for easy enabling and disabling
6th April 2012, 09:57 PM   |  #8  
Senior Member
Thanks Meter: 8
 
150 posts
Join Date:Joined: Dec 2008
any kind person can help to make it into a flashable zip?
8th April 2012, 07:07 AM   |  #9  
jonata's Avatar
Senior Member
Thanks Meter: 109
 
2,019 posts
Join Date:Joined: Jul 2007
More
Quote:
Originally Posted by ck_looi

any kind person can help to make it into a flashable zip?

+1 10 chars
8th April 2012, 06:26 PM   |  #10  
mgmCube's Avatar
Senior Member
Thanks Meter: 87
 
589 posts
Join Date:Joined: Dec 2010
Would it in theory be possible to use the home button to wake the phone or is that impossible because the buttons don't work when the screen is off?
I have wake on TP on my Desire now.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in One X Android Development by ThreadRank