[MOD] Trackpad toggle wake/sleep for Sense ROMs w/ trackpad wake [Upd: Aug 31]

Search This thread

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
This mod is for people that like the original MyTouch 4G trackpad functionality - waking the phone up on the first press, and putting it back to sleep on the second.

This mod overwrites trackpad unlock mod found in various ROMs.

Compatibility
Available versions:
- MT4G_HD (tested) - should be compatible with most 2.2 and 2.2.1 pure Sense ROMs (Desire HD/Z).
- RoyalThunder (untested).
- RoyalMint (tested) - should be compatible with most 2.3.3 Sense ROMs.
- Panache stock (tested) - should be compatible with most 2.3.3 Sense ROMs, including RoyalPanache.
- Kingdom Sense 3.0 lockscreen v0.10 (tested) - for 2.3.3 Sense ROMs using Sense 3.0 elements in mixed framework.
- Virtuous Unity 2.35 (NEW) - for Virtuous Unity 2.35 and above. Reported working on Sense 3.5 ROMs.

This mod is only working for ROMs that have trackpad wake already implemented, and allows the lockscreen to put the phone back to sleep. This mod doesn't include trackpad wake. For this reason it won't work on Gingerbread-based ROMs, Sense or not, that don't include the trackpad wake feature. Some Gingerbread Sense ROMs don't state trackpad wake as one of their features, and I can't check them all. CoreDroid port doesn't have it, Desire S ports by raffyvito don't have it. If you know a ROM that has it, tried RoyalMint and Panache versions and they didn't work - please request support in this thread.
Look here if you have Gingerbread Sense ROM and it doesn't support trackpad wake. Look at this post for Sense 3.5 trackball wake

Instructions
Flash the attached file in recovery. It should work with CWM3.x - it uses Edify scripting.

Known issues
- When the phone is turned on using power button - the first trackpad press won't put it back to sleep, but pressing once again will. I'll try to look into it and solve it, if it's something that can be solved without touching the framework.
- When the phone is turned on from power off, or plugged/unplugged in USB - trackball doesn't put the screen to sleep. Looks like the system doesn't automatically assume sleep mode in this case, and since the trackball doesn't put it to sleep, but only re-engages sleep - it doesn't work. After the default timeout engages, everything works.

Uninstallation
Extract HtcLockScreen.apk (located in /system/app/) from your ROM's ZIP file.
Execute: adb push HtcLockScreen.apk /system/app/

For other Sense ROMs
The mod is quite simple and there are good chances that it can be added to pretty much any Sense ROM. If you want me to add/fix a mod for a specific ROM, you have 2 options:

1) Provide me 2 files from your ROM:
/system/app/HtcLockScreen.apk
/system/framework/com.htc.resources.apk

Instructions for getting those files (you have to have ADB functional):
Open command prompt window (Windows) or terminal (Mac/Linux), connect the phone, execute 2 following lines:
Code:
adb pull /system/app/HtcLockScreen.apk
adb pull /system/framework/com.htc.resources.apk
2) Provide me a link to your ROM.

Of course, 2 files will be taken care of much quicker - I'm not always able to download 200+ MB of ROM.
 

Attachments

  • Wake_Sleep_lockscreen_Glacier_eViL_MT4G_HD.zip
    968.7 KB · Views: 430
  • Wake_Sleep_lockscreen_Glacier_RoyalThunder.zip
    968.7 KB · Views: 101
  • Wake_Sleep_lockscreen_Glacier_RoyalMint.zip
    978 KB · Views: 153
  • Wake_Sleep_lockscreen_Glacier_Panache_Stock.zip
    980.7 KB · Views: 165
  • Wake_Sleep_lockscreen_Glacier_Kingdom_0.10_Lockscreen.zip
    1.1 MB · Views: 195
  • Wake_Sleep_lockscreen_Glacier_VU_2.35.zip
    1.1 MB · Views: 540
Last edited:

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Reserved, with first posts history.



Hi,

I guess that if I open this in Development forum and state the progress so far, I have better chances of someone helping me to achieve the goal.


One of the nice features that original MT3G ROM has, is trackpad wake/sleep - wake on first press, sleep on second. Very useful for checking time and phone state, and putting it back to sleep, eliminating possible accidental unlocks on the way to the pocket (happened to me a couple of times).

Unfortunately, Desire HD ROMs, while being pure and better Sense (and the only fully functional non-stock Sense ROM), don't have that capability. I believe that Desire Z ROMs don't have it either.

I'd like to integrate this capability into Desire HD port, and open a way to integrate it into other ROM ports and into other phones.


Starting point:
eViL D:'s DesireHD port, v.0.3.2, with trackball wake and unlock.

Done:
Found the trackball unlock in the HtcLockScreen.apk/HtcLockScreen and removed it. Wanted to point it instead to the method that does the opposite (locking the phone), but ran into several problems:

While the called goToDeviceUnlock() is a part of HtcLockScreen, the method I need to use to put the device to sleep can't be found there. I supposed that it would be in the same place as the original wake - in android.policy.jar. Looked there and found some methods - KeyguardScreenCallback has goToLockScreen() method, and KeyguardViewManager has deprecated hide() method - but I'm not sure what to use and where to call it.

I captured logcat from DHD and MT4G ROMs and saw that trackpad press on DHD ROM calls pokeWakeLock(15000) when pressing trackpad, while MT4G invokes the same procedure as for turning the phone off.
I've opened both android.policy.jar and tried to compare the relevant procedures - and didn't found any difference.
After some time, I found that if I modify shouldEventKeepScreenOnWhileKeyguardShowing() in KeyguardViewBase, I can avoid the pokeWakeLock(15000), but it still doesn't put device to sleep, only stops it from reacting on trackball and prolonging the screen on time when locked.

I tried to call goToLockScreen() in HtcLockScreen - but it didn't seem to do anything. Might be the wrong call.
Then I tried to call hide() there - but it crashed, not finding such method. I guess it isn't shared, or I missed something when calling it.

Then I tried to integrate the first method into android.policy.jar, but it didn't work either.

I also tried the "brute force" method of using DPM and declaring Device Policy Manager, calling lockNow(), but didn't complete it - HtcLockScreen doesn't inherit from Activity class, so I'd need to create a separate class and interface it. Quite some work for a very awkward solution.

So, my assumption is - 1) I still didn't find the correct method in the HTC framework that puts the phone to sleep. 2) I couldn't interface the method I hoped would do the trick (even if deprecated).

I'll be glad if one of the Sense devs would share the info I'm lacking to proceed.

Maybe I'm missing something simple like calling pokeWakeLock(0)? But it looks like I'm missing something like "duplicating" the power button functionality by trackpad, somewhere in key mapping - because the frameworks look the same. Or maybe I'm looking in the wrong place.

Ok, I solved it myself :) The solution was just the simple one I tried last - calling pokeWakeLock(0) instead of goToDeviceUnlock(). Works like a charm.

I'll soon recompile proper HtcLockScreen.apk for eViL D:'s DHD ports for MT4G and N1 and post.
 
Last edited:
  • Like
Reactions: DADDYDC650

elry567

Senior Member
Jan 7, 2011
1,195
108
Would this work on the coredroid port or not its 2.3.3 sense2.1

Sent from my HTC Glacier using XDA Premium App
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
It might not work "as is".
I can compile the mod for pretty much any Sense ROM, given 2 files from it - HtcLockScreen.apk and com.htc.resources.apk.
 

elry567

Senior Member
Jan 7, 2011
1,195
108
That would be awsome man

Sent from my HTC Glacier using XDA Premium App
 

s10shane

Senior Member
Jul 30, 2010
2,250
158
37
Victorville, Ca
hey will this mod work on RoyalThunder V1.1? its stock htc sense 2.0 so i figured it might work. cause i do miss this feature.
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Might work, and in any case it can be made to work.

First post updated with the mod description and other info ;)
 
  • Like
Reactions: epsix

epsix

Senior Member
Aug 29, 2010
2,112
334
Nice... will thanks later when I get home.. still at work :)

Sent from my HTC Glacier using XDA Premium App
 

FLYNN2

Senior Member
Aug 11, 2010
333
60
51
Is there any way to just turn the trackpad off so that the only way to open the unlock screen is to push the power button?
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
It's possible, but it requires framework modification in android.policy.jar. I can't disable it in lockscreen mod.
 

ronin178

Senior Member
Apr 4, 2008
371
94
Vancouver
So cleared cache/dalvik and flashed zip, rebooted twice and do not have wake/sleep functionality yet....core droid 2.3.3...is there something I did wrong?
 

elry567

Senior Member
Jan 7, 2011
1,195
108
Awsome wich one could I use for coredroid port its 2.3.3 sense2.1
Nevermind got it thnx alot
Sent from my HTC Glacier using XDA Premium App
 
Last edited:

Julianmgn

Senior Member
@Flynn, I would like to see that also I don't like the track wake feature and so far the only sense rom without it that I know of is leedroid and its extremely buggy

So if the OP could add this feature or even as another mod it would be awesome! Lol
Sent from my HTC Glacier using XDA Premium App
 
Last edited:

elry567

Senior Member
Jan 7, 2011
1,195
108
I wasn't able to get it to work

Sent from my HTC Glacier using XDA Premium App
 

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
So cleared cache/dalvik and flashed zip, rebooted twice and do not have wake/sleep functionality yet....core droid 2.3.3...is there something I did wrong?

You don't need to clear caches, flashing is enough. If it doesn't work - please do the following: connect the phone by USB to PC, open Command prompt in Windows, run "adb logcat > logcat.log", put the phone to sleep, press trackball to wake, press trackball fast several times (10 at least), press "Ctrl-C" in PC, post the logcat file here.

As I wrote, I didn't test the 2.3.3 version, since I didn't want to install such a ROM on my phone. If anyone can provide me a logcat - I might be able to debug it.

Removing trackball wake completely is NOT an option, as it's done in system framework, needs to be possibly done for each ROM version, and I won't be able to keep up with it.
 
Last edited:

Jack_R1

Senior Member
Aug 9, 2009
4,362
964
Fast & overkill way:
reflash your ROM.

Accurate way:
take your ROM's ZIP file
extract HtcLockScreen.apk (resides under /system/app/)
execute ADB command:
Code:
adb push HtcLockScreen.apk /system/app/
reboot the phone
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    This mod is for people that like the original MyTouch 4G trackpad functionality - waking the phone up on the first press, and putting it back to sleep on the second.

    This mod overwrites trackpad unlock mod found in various ROMs.

    Compatibility
    Available versions:
    - MT4G_HD (tested) - should be compatible with most 2.2 and 2.2.1 pure Sense ROMs (Desire HD/Z).
    - RoyalThunder (untested).
    - RoyalMint (tested) - should be compatible with most 2.3.3 Sense ROMs.
    - Panache stock (tested) - should be compatible with most 2.3.3 Sense ROMs, including RoyalPanache.
    - Kingdom Sense 3.0 lockscreen v0.10 (tested) - for 2.3.3 Sense ROMs using Sense 3.0 elements in mixed framework.
    - Virtuous Unity 2.35 (NEW) - for Virtuous Unity 2.35 and above. Reported working on Sense 3.5 ROMs.

    This mod is only working for ROMs that have trackpad wake already implemented, and allows the lockscreen to put the phone back to sleep. This mod doesn't include trackpad wake. For this reason it won't work on Gingerbread-based ROMs, Sense or not, that don't include the trackpad wake feature. Some Gingerbread Sense ROMs don't state trackpad wake as one of their features, and I can't check them all. CoreDroid port doesn't have it, Desire S ports by raffyvito don't have it. If you know a ROM that has it, tried RoyalMint and Panache versions and they didn't work - please request support in this thread.
    Look here if you have Gingerbread Sense ROM and it doesn't support trackpad wake. Look at this post for Sense 3.5 trackball wake

    Instructions
    Flash the attached file in recovery. It should work with CWM3.x - it uses Edify scripting.

    Known issues
    - When the phone is turned on using power button - the first trackpad press won't put it back to sleep, but pressing once again will. I'll try to look into it and solve it, if it's something that can be solved without touching the framework.
    - When the phone is turned on from power off, or plugged/unplugged in USB - trackball doesn't put the screen to sleep. Looks like the system doesn't automatically assume sleep mode in this case, and since the trackball doesn't put it to sleep, but only re-engages sleep - it doesn't work. After the default timeout engages, everything works.

    Uninstallation
    Extract HtcLockScreen.apk (located in /system/app/) from your ROM's ZIP file.
    Execute: adb push HtcLockScreen.apk /system/app/

    For other Sense ROMs
    The mod is quite simple and there are good chances that it can be added to pretty much any Sense ROM. If you want me to add/fix a mod for a specific ROM, you have 2 options:

    1) Provide me 2 files from your ROM:
    /system/app/HtcLockScreen.apk
    /system/framework/com.htc.resources.apk

    Instructions for getting those files (you have to have ADB functional):
    Open command prompt window (Windows) or terminal (Mac/Linux), connect the phone, execute 2 following lines:
    Code:
    adb pull /system/app/HtcLockScreen.apk
    adb pull /system/framework/com.htc.resources.apk
    2) Provide me a link to your ROM.

    Of course, 2 files will be taken care of much quicker - I'm not always able to download 200+ MB of ROM.
    2
    Added lockscreen for Virtuous Unity 2.35.
    2
    Sleep ONLY works in the lockscreen... Just like the stock rom.

    Sent from my HTC Glacier using Tapatalk

    You have to flash both this mod and the one posted on dark sense thread.
    This mod makes it trackpad sleep and the one in dark sense makes it wake.

    Now all some one needs to do is put both into one flashable zip. :)

    Sent from my HTC Glacier using xda premium
    1
    Reserved, with first posts history.



    Hi,

    I guess that if I open this in Development forum and state the progress so far, I have better chances of someone helping me to achieve the goal.


    One of the nice features that original MT3G ROM has, is trackpad wake/sleep - wake on first press, sleep on second. Very useful for checking time and phone state, and putting it back to sleep, eliminating possible accidental unlocks on the way to the pocket (happened to me a couple of times).

    Unfortunately, Desire HD ROMs, while being pure and better Sense (and the only fully functional non-stock Sense ROM), don't have that capability. I believe that Desire Z ROMs don't have it either.

    I'd like to integrate this capability into Desire HD port, and open a way to integrate it into other ROM ports and into other phones.


    Starting point:
    eViL D:'s DesireHD port, v.0.3.2, with trackball wake and unlock.

    Done:
    Found the trackball unlock in the HtcLockScreen.apk/HtcLockScreen and removed it. Wanted to point it instead to the method that does the opposite (locking the phone), but ran into several problems:

    While the called goToDeviceUnlock() is a part of HtcLockScreen, the method I need to use to put the device to sleep can't be found there. I supposed that it would be in the same place as the original wake - in android.policy.jar. Looked there and found some methods - KeyguardScreenCallback has goToLockScreen() method, and KeyguardViewManager has deprecated hide() method - but I'm not sure what to use and where to call it.

    I captured logcat from DHD and MT4G ROMs and saw that trackpad press on DHD ROM calls pokeWakeLock(15000) when pressing trackpad, while MT4G invokes the same procedure as for turning the phone off.
    I've opened both android.policy.jar and tried to compare the relevant procedures - and didn't found any difference.
    After some time, I found that if I modify shouldEventKeepScreenOnWhileKeyguardShowing() in KeyguardViewBase, I can avoid the pokeWakeLock(15000), but it still doesn't put device to sleep, only stops it from reacting on trackball and prolonging the screen on time when locked.

    I tried to call goToLockScreen() in HtcLockScreen - but it didn't seem to do anything. Might be the wrong call.
    Then I tried to call hide() there - but it crashed, not finding such method. I guess it isn't shared, or I missed something when calling it.

    Then I tried to integrate the first method into android.policy.jar, but it didn't work either.

    I also tried the "brute force" method of using DPM and declaring Device Policy Manager, calling lockNow(), but didn't complete it - HtcLockScreen doesn't inherit from Activity class, so I'd need to create a separate class and interface it. Quite some work for a very awkward solution.

    So, my assumption is - 1) I still didn't find the correct method in the HTC framework that puts the phone to sleep. 2) I couldn't interface the method I hoped would do the trick (even if deprecated).

    I'll be glad if one of the Sense devs would share the info I'm lacking to proceed.

    Maybe I'm missing something simple like calling pokeWakeLock(0)? But it looks like I'm missing something like "duplicating" the power button functionality by trackpad, somewhere in key mapping - because the frameworks look the same. Or maybe I'm looking in the wrong place.

    Ok, I solved it myself :) The solution was just the simple one I tried last - calling pokeWakeLock(0) instead of goToDeviceUnlock(). Works like a charm.

    I'll soon recompile proper HtcLockScreen.apk for eViL D:'s DHD ports for MT4G and N1 and post.
    1
    What do we flash on vu 2.3.9 to add track pad sleep ? A bit confused...

    Glacier-Rooted/OC'd/ Demonsped VU 2.39 w/Beats Audio

    For vu just flash the mod on the op of this thread

    Sent from my HTC Glacier using xda premium