Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,769,622 Members 44,688 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] Volume Wake

Tip us?
 
tombriden
Old
#1  
Recognized Developer - OP
Thanks Meter 314
Posts: 211
Join Date: Mar 2010
Location: Leighton Buzzard

 
DONATE TO ME
Default [MOD] Volume Wake

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 32 Users Say Thank You to tombriden For This Useful Post: [ Click to Expand ]
 
w1nter456
Old
#2  
Senior Member
Thanks Meter 96
Posts: 527
Join Date: Oct 2010

 
DONATE TO ME
How if I play music in off screen mode adjusting the volume?
 
tombriden
Old
#3  
Recognized Developer - OP
Thanks Meter 314
Posts: 211
Join Date: Mar 2010
Location: Leighton Buzzard

 
DONATE TO ME
Quote:
Originally Posted by w1nter456 View Post
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: [ Click to Expand ]
 
mmx6688
Old
#4  
Senior Member
Thanks Meter 24
Posts: 104
Join Date: Dec 2009
thanks much. I need this feature much.

One question, is this change use up volume or down volume or both will work?
 
ckpv5
Old
#5  
ckpv5's Avatar
Recognized Contributor
Thanks Meter 8640
Posts: 6,620
Join Date: Feb 2008
Location: Kuala Lumpur

 
DONATE TO ME
Am I correct that this mod will work only on deodexed android.policy.jar ?
 
tombriden
Old
#6  
Recognized Developer - OP
Thanks Meter 314
Posts: 211
Join Date: Mar 2010
Location: Leighton Buzzard

 
DONATE TO ME
Quote:
Originally Posted by mmx6688 View Post
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 View Post
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: [ Click to Expand ]
 
leventccc
Old
#7  
Senior Member
Thanks Meter 428
Posts: 776
Join Date: Jan 2011
Location: Istanbul
Thanks it worked on my device. And I have added your mod to my mod pack for easy enabling and disabling
Nexus 4| Nexus 7 | HTC One
HTC Hero > Samsung Galaxy S > HTC One X > Nokia Lumia 920>HTC One X+> Nexus 4 + HTC One
[/CENTER]
 
ck_looi
Old
#8  
Senior Member
Thanks Meter 8
Posts: 150
Join Date: Dec 2008
any kind person can help to make it into a flashable zip?
 
jonata
Old
#9  
jonata's Avatar
Senior Member
Thanks Meter 108
Posts: 2,002
Join Date: Jul 2007
Quote:
Originally Posted by ck_looi View Post
any kind person can help to make it into a flashable zip?
+1 10 chars

APPLE Iphone 5S

MOTO X 16 GB stock rooted BAMBOO Edition
 
mgmCube
Old
#10  
mgmCube's Avatar
Senior Member
Thanks Meter 87
Posts: 589
Join Date: 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.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes