FORUMS

ZenFone 2 Lolliflash and ZenPower Giveaway!

We recently did an in-depth review of the Asus Zenfone 2 but one of the things people may … more

OnePlus 2 Forums: Discuss Everything About The OP2!

Now that the OnePlus 2 has been officially unveiled and that we have had close-up … more

Intel & Micron Announce “Revolutionary” Storage Tech

Intel & Micron have announced 3D Xpoint technology—”the … more

Google Now Interfaces With Third-Party Messaging Apps

Google has announced that Ok Google voice commands can now be used to send … more

[MOD] Volume Wake

227 posts
Thanks Meter: 325
 
By tombriden, Recognized Developer on 6th April 2012, 02:49 PM
Post Reply Subscribe to Thread Email Thread
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 35 Users Say Thank You to tombriden For This Useful Post: [ View ]
 
 
6th April 2012, 02:59 PM |#2  
Senior Member
Thanks Meter: 96
 
Donate to Me
More
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: 325
 
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: 30
 
More
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: 11,987
 
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: 325
 
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: 429
 
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
 
More
any kind person can help to make it into a flashable zip?
8th April 2012, 07:07 AM |#9  
jonata's Avatar
Senior Member
Flag Casette d'Ete
Thanks Meter: 115
 
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: 89
 
More
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.
9th April 2012, 06:12 AM |#11  
ckpv5's Avatar
Recognized Contributor
Flag Kuala Lumpur
Thanks Meter: 11,987
 
Donate to Me
More
Quote:
Originally Posted by mgmCube

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.

Not possible as the buttons don't work when the screen is off.

And when the phone goes to deep sleep mode, volume button to wake it not really works (tried both on odex and deodex ROMs).
The Following User Says Thank You to ckpv5 For This Useful Post: [ View ]

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

Advanced Search
Display Modes