yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] crimsondr:
Trackball Wake

Push this to /system/framework/android.policy.jar.

Trackball Wake & Unlock

Push this to /system/framework/android.policy.jar.

Trackball Skip (works with stock music player only, screen must be off)

Push this to /system/framework/android.policy.jar.

Make sure the permissions on the file are the same as the original:

chmod 644 /system/framework/android.policy.jar

After pushing the file, reboot for changes to take affect.

This is not my work, original code pulled from CM5.0.8 and merged in by me.

*Requires rooted and deodexed rom
[Nexus One Android Development] rambolee:
Hope it works, will give a try. Thanks!
[Nexus One Android Development] toyanucci:
It works! But now when I dial *#*#4636#*#* and select phone information it crashes.
[Nexus One Android Development] crimsondr:
I just tried that and it doesn't crash for me...:confused:
[Nexus One Android Development] nicholastam:
this is good news.
[Nexus One Android Development] Autinhyeu:
Its work, thanks you :-)
[Nexus One Android Development] namtrac:
Will this work on stock Froyo FRF85B? Thanks.

Update: Nope.
[Nexus One Android Development] obscure.detour:
This is excellent news.

Curious. Has anyone tried this on Froyo FRF83? And/Or Modaco's r19
[Nexus One Android Development] cdw9800:
good stuff now for trackball skip and ill be in heaven with froyo.

Edit: everytime i try to push says read only....hmm im on MCR20????

Edit2: my pc blocked it for some reason better to be safe than sorry thanks working great.
[Nexus One Android Development] hktony:
it works for me too , no crash on r20
[Nexus One Android Development] viriimind:
Woking on Kang-o-rama 0.9 w/SP2(FRF85), No problem at all..

Thanks.. :)
[Nexus One Android Development] HunGAa:
WORKED!

Confirmed work on Kang-o-rama 0.9 Final. Good job one of the necessities for froyo. Now can anyone get vibrate on answer and hang up like cyanmod on froyo?
[Nexus One Android Development] ihearttreo:
Works great for me too on Kang-o-rama 0.9 Final.
[Nexus One Android Development] wutang01:
I'm sorry to ask this. I don't know how to get this to work.

When I try: adb push android.policy.jar /system/framework/android.policy.jar

I get this error: cannot stat 'android.policy.jar': No such file or directory

When I try: adb push C:/android.policy.jar /system/framework/android.policy.jar

I get this error: failed to copy 'C:/android.policy.jar' to '/system/framework/android.policy.jar': Read-only file system

I have android.policy.jar copied to the AndroidSDK/tools folder as well as C root directory. My device is listed when I type command line "adb devices".

My phone is on, in debugging mode. What am I doing wrong?
[Nexus One Android Development] eViL D::
Nice. Any chance for unlock too?
[Nexus One Android Development] ihearttreo:
edit123456
[Nexus One Android Development] kash521:
Edit: I'm retarded. CM6 comes with trackball unlock/wake.
[Nexus One Android Development] vegetaleb:
Yey! This is the most awaited feature we waited for more than a month!!

:D
[Nexus One Android Development] FormelLMS:
Yes, is it possible to add trackball unlock?
[Nexus One Android Development] badantii:
adb remount then adb push android.policy.jar /system/framework/ :)
[Nexus One Android Development] k3vink3vin:
try press and hold the volume rocker if you are running cyanogenmod...
[Nexus One Android Development] dnichols4:
Would it be possible to have wake work only on single-click and skip only work on double-click?

Finding some way to have both would be great.

Thanks
[Nexus One Android Development] mlevin:
Can anyone point me to the ORIGINAL android.policy.jar for FRF91 that doesn't have trackball wake? I want to go back to that one but I have a modaco rom that has trackball wake baked in.
[Nexus One Android Development] shpongled:
I'm also looking for the original file.. anyone?
[Nexus One Android Development] HTCDevil:
Here you are ;)

i've made an update.zip of trackball wake/unlock but i can't test it because i'm on a stock FRF91 odex.

If someone want to have a try.
[Nexus One Android Development] nuumuun:
you should be able to disable the trackball wake feature in spare parts.
[Nexus One Android Development] jergud:
it do not work....

few minutes later it works again
[Nexus One Android Development] nachod0g:
Hi crimsonr. Any chance you could make this mod and the battery percentage mod for FRG83? Thanks mate.
[Nexus One Android Development] Lamar720:
I'm not running CM6 but, I had it and decided to test other roms out. How can I get the Volume Rocker to skip tracks again. I have pushed the Music.apk and I have the app working but the Volume song skip feature doesn't work.
[Nexus One Android Development] D!T:
FRG83 Works

Power button just died. Not sure if it would have worked, but I downloaded and pushed trackball wake to my FRG83. Works so far. Hope it doesn't break something else...
[Nexus One Android Development] nachod0g:
Yep, I just tested this mod on FRG83 and it's working fine for me as well. I compared the android.policy.jar files from FRF91 and FRG83 and it seems like nothing changed, so I think this patch might still be safe to use without being updated for FRF83, but I can't give any guarantees.
[Nexus One Android Development] BilalBhatti:
Its not working on FRF91. All steps done but the phone don gets awake when trackball is pressed. :/
[Nexus One Android Development] nachod0g:
Worked fine on FRF91 for months for me...
[Nexus One Android Development] clarksonator:
Is there a way to have it so that I press the power button to wake and can then press the trackball to unlock? Running geo's stock Froyo ROM.

Thanks
[Nexus One Android Development] hayden1987:
this patch doesn't seem to work on r24-nexusone-desire-modaco.. does anyone know how to get trackball wake on this ROM without having access to the paid kitchen?
[Nexus One Android Development] FormelLMS:
Is it possible to make it working in the stock MIUI Rom?

Trackball wake is emplemented, but trackball unlock isn't.
[Nexus One Android Development] MicroMod777:
Can you please post the changes made to the android.policy.jar?
[Nexus One Android Development] futurabold:
Is Track Ball Skip still available? I can't get it to download from the original link.
[Nexus One Android Development] ~semsem~:
Hi, is there a way to make it work on Gingerbread ?? thanks in advance
[Nexus One Android Development] seraphimserapis:
Someone needs to modify the PhoneWindowManager to use the trackball - then a new android.policy.jar needs to be created.
[Nexus One Android Development] MicroMod777:
Seems the OP user is long gone! Wish I knew what he changed as he didn't post any of his changes to the android.policy.jar.
[Nexus One Android Development] galaxys:
Did u ever get this? And did the wake/unlock one press ever work for u?
[Nexus One Android Development] dipeshb:
Volume Skip

Anyone know how I can get the long press volume track skip to work (ala cyan).. I guess its the policy.jar that needs to be created. Anyone know how I could do this myself? I change ROMs frequently between MicroMod, Evil, Rod, and Cyan! So would be good to know how to play around with code to get this working on all..

I am a coding super noob, but if someone can let me know where I can start to learn to do this I would be very greatfull
[Nexus One Android Development] ~semsem~:
Pls somebody support the OP or tell us what are the changes to port it to Gingerbread!
[Nexus One Android Development] lauslein:
I'm going to cry if there's no trackball wake for the N1 at any time in the future :(

I'm offering a big cup of coffee to the one who solves this problem :)
[Nexus One Android Development] metalhead8816:
All the code changes for froyo are on my github.
[Nexus One Android Development] MicroMod777:
If I knew how to merge those changes I'd do it in a heart beat. Plus, I don't' know where that's at.
[Nexus One Android Development] galaxys:
github link is in his signature...
[Nexus One Android Development] MicroMod777:
oh yea, just very tired today! LOL Wish I knew how to add that code.

Here's an example of the type of code I can do:

You have to change a line of code in services.jar
Decompile it using baksmali
Then in the folder services open up com/android/server/status/StatusBarService.smali
Then use find to find 'const/4 v5, 0x2'
And simply replace with 'const/4 v5, -0x3'
Then compile with smali
http://code.google.com/p/smali/ link to smali/baksmali
__________________
[Nexus One Android Development] zuberio:
Took some digging (and exploring github), but this is what I came up with.

Under "android_frameworks_base" - "Added string for System setting - Trackball wake"

https://github.com/metalhead8816/an...mmit/26c2ec375283bfa5e8afaef00daa27df09b3dbe5

Under "android_frameworks_policies_base" - "Added logic to detect when trackball is pressed. Wake phone if option is used or skip songs on double-tap"

https://github.com/metalhead8816/an...mmit/e2e45b61d8d2eb70164f362526e6b3199af6bd51

Also under "android_frameworks_policies_base" - "Added long presses for volume buttons to skip songs. Volume changes are now on keyup as that is a requirement. Also fixed bug with trackball skips."

https://github.com/metalhead8816/an...mmit/7504617a9211a65ce767281c59668e8641b8a14d

I'm just looking for a way to replace one or two files on my stock FRG83D Nexus so that I can have trackball wake.
[Nexus One Android Development] ~semsem~:
Thanks! :)
[Nexus One Android Development] lauslein:
I'm really not into Android framework developement and I'm having a hard time trying to understand the linked source codes.

But I compared them to the official Gingerbread files (e.g. the PhoneWindowManager.java where the important parts seem to be located) and they don't seem to have changed that much in the relevant parts… or am I missing something?

I have no plan at all on how to make modifications to source files, compiling them and getting a valid JAR file to flash on a phone, so I have bad chances to try this out… but if srsly nobody is interessted in this – and nobody has any well-founded reasons why I will fail immediately (and I will, I guess) – I think I have to try this on my one at some point in the future (like next year) … but anybody else than me will have more success…
[Nexus One Android Development] cmcdizzle:
HELP!!!!!!!

Hello this is all very interesting but i am very stuck. I have no clue about linux programming commands so this is very confusing to me. How do i push these *.txt files into the *.jar file? please can you write out the exact commands i need to use in order to push these files. Thanks alot in advance.
[Nexus One Android Development] zuberio:
you can't pust .txt files into a .jar file. A .jar file is compiled. Please describe your phone. It may be possible to simply download the .jar files at the beginning of this thread.
[Nexus One Android Development] xdamember123:
Is this still working ?
[Nexus One Android Development] Hollow.Droid:
For FRF91 yup, for GB check out MicroMods v.19 ROM, clarksonator got these working just fine (Apart from skip).
[Nexus One Android Development] kled54:
Can anyone confirm if this still works on FRG83G ???

and how can i tell if my rom is deodexed rom...

i have stock 2.2.2 on a rooted nexus one.

thanks
[Nexus One Android Development] YVG107:
I heard trackball wake doesn't work with the new 2.3.3 GRI40 version. (android.policy.jar was modified in 2.3.3, which was the file that needed changing for trackball)

can you please make it work ? :)
[Nexus One Android Development] rogobono:
+1
[Nexus One Android Development] viasat:
Yes please,badly need it ,it's the only thing keeping me away from update.

Cheers
[Nexus One Android Development] amw_jjj:
Yes please!

Power button is shaking now...
[Nexus One Android Development] ~semsem~:
+1
[Nexus One Android Development] nebg:
Definitely not working on my 2.3.3 GRI40, can anyone upload policy file for 2.3.3 GRI40 ?
[Nexus One Android Development] vegetaleb:
I will not flash any GB rom if it's without Tb wake
[Nexus One Android Development] luminouche:
Trackball Wake for GRI40 not working for me too...
[Nexus One Android Development] daneelgiskaard:
Can you please update android policy jar for 2.3.3?
[Nexus One Android Development] daneelgiskaard:
Someone opened a ticket for this at code.google.com, it gives some information about the situation, a slim chance but if enough people star the issue google might have a look at it in the next build.

Also if it is correct that the volume buttons are able to be used when the screen is locked maybe we could get a "volume up button wake" until the trackball situation is fixed as a temporary measure, certainly beats using the flimsy power button on the N1. (Volume down could stay as the ringtone silencer)

I do have faith in XDA devs to sort this out though, 3 days w/o trackball wake and it is already driving me crazy.

http://code.google.com/p/android/issues/detail?id=15115

by Jeff Brown

(Nexus One and soon more as 2.3.3 gets ported to other devices with hardware buttons aside from volume)

A change was made to the behavior of key events when the screen is off and the keyguard was disabled. Previously events got ACTION_PASS_TO_USER by default, but was overriden by the system keyguard. This meant a button like the trackball could be used to wake and take action. Perhaps trackball click to play/pause music, or turn a flashlight on off, or simply wake the device to the desired screen. In normal situations, when the trackball should not cause any events, the keyguard would be active to block these events. However with this update instead of the keyguard doing the job of blocking keys, the PhoneWindowManager is arbitrarily doing it based on the state of the screen.

Problem can be reproduced by using disableKeyguard() to disable the keyguard, then having an activity monitor key events. On Android < 2.3.3 it will receive any such events regardless of the screen state. On Android 2.3.3 it will receive some events (volume buttons) and not others (trackball) depending on if the screen is on or not.

Behavior should be consistent, send all hardware keys or no hardware keys, depending on the keyguard only, rather than the screen being on or off.
[Nexus One Android Development] damienallen:
Any updates? I'm dieing here without trackball wake on GB.
[Nexus One Android Development] lockab:
Trackball alert and trackball wake works on Superatmel Gingerbread Rom, I hoping MoDaCo can included it soon to his Gingerbread GRI54 Rom which in my opinion is the most stable Gingerbread Rom. Or hope some one can make a app for trackball wake.
[Nexus One Android Development] dryphi:
Is there a new version of this that works with GB 2.3.3?

I am rooted but have the stock rom. Need trackball wake because my power button is starting to fail.

Stupid developer idea in the first place to make you use the power button over and over again, with the flimsy circuit board wiring being the only thing holding it in place. The whole power-button fail problem could have been avoided altogether if the devs would have included a trackball wake option (for phones that supported it), or a volume wake option (for phones that do not) from the get-go.
[Nexus One Android Development] luminouche:
Everything's fine on r20 !

No crashes for me !

Thx a lot !
[Nexus One Android Development] watercool:
perfect thx! got a fc for the genie widget on first boot.. but still works fine :)
[Nexus One Android Development] funkyfr:
Works fine with leofroyo 1.0.1 :)
[Nexus One Android Development] wutang01:
Ok, so I connected my phone (debugging on)

- adb remount (adb mount doesn't work)

- adb push android.policy.jar /system/framework/

I see: 991KB/s (89345 bytes in 0.088s)

I'm assuming it's complete? Yet, trackball wake isn't exactly working on my phone. Or do I have to enable it first or something?

Edit: I'm an idiot. I think restarting the phone enabled it for me?
[Nexus One Android Development] jin1207:
It works on my phone. BTW, could somebody tell me where is the option is ?
[Nexus One Android Development] antiochasylum:
S*&%, I just got to work and saw this. Is there anyway this can be pushed through terminal on the phone or do I have to do adb push method?

If in terminal anyone care to enlighten me how to, cause everything I try doesnt seem to work.
[Nexus One Android Development] gcgspain:
Perfect on MCR r20. I used Root Explorer and pasted over the old file. MANY THANKS!!
[Nexus One Android Development] antiochasylum:
Did what he did, root explorer was worth the 2.83$ lol now just need the unlock and my phone is complete again. I love this forum, I'd be lost with out a nexus lol

Oh and kang 0.9sp2 (frf85b) working like a champ.
[Nexus One Android Development] Dextrosan:
Well done, thx
[Nexus One Android Development] shiznt:
Confirmed working on LeoFroyo 1.0.3! Awesome! :D
[Nexus One Android Development] badantii:
Yep a reboot is required. :-)
[Nexus One Android Development] jdoo:
Works but the placement of my 1x1 widgets is offset/too low :)

Edit: second reboot fixed it, thanks!
[Nexus One Android Development] ranblv:
Great work, makes my N1 even more useful...
[Nexus One Android Development] leonnib4:
+42
[Nexus One Android Development] mardox:
adb cannot find my device, it is turned on and i have usb debugging enabled. what could be wrong? i am pretty new to this
[Nexus One Android Development] leonnib4:
Under linux?

Run adb server as root.

Search xda
[Nexus One Android Development] fabioccoelho:
Nice :D Works fine for me :p I´m using r20 with JupIterDroid mod :)

Thanks ;)
[Nexus One Android Development] crimsondr:
Added trackball unlock. Check OP for links.
[Nexus One Android Development] leonnib4:
Very good!

But why tell it's MoDaCo specific as it works on all FRF85B roms?

MoDaCo did not alter android.policy.jar

thx again
[Nexus One Android Development] crimsondr:
I pulled the original from MoDaCo... Never checked if it was unmodified... I will update.
[Nexus One Android Development] www1:
I have just it by directly compiling cyanogen source.

Now I want to try trackball unlock.

edit.

working perfect in r20 Modaco
[Nexus One Android Development] FormelLMS:
Wow! Thanks! That was quick!!
[Nexus One Android Development] donutman:
How do I do this via terminal on my phone?
[Nexus One Android Development] leonnib4:
man... search a little...

$ adb remount ; adb push file /system/framework/
[Nexus One Android Development] leonnib4:
download and move"

- download

- remount read-write

- busybox mv /sdcard/Downloads/file.jar /system/framework/

;)
[Nexus One Android Development] donutman:
Sorry I'm a linux noob. What is the command for remount read-write?
[Nexus One Android Development] leonnib4:
$ su

# mount -o rw,remount /system /system

remount read-only after:

# mount -o ro,remount /system /system

You could have searched also... those command must have been posted 1000 times on XDA...
[Nexus One Android Development] danimar1:
Does this open the door for trackball skip too? or is it a totally different thing due to it being related to the music app...
[Nexus One Android Development] leonnib4:
Is it really necessary with FroYo ?

Just asking..
[Nexus One Android Development] danimar1:
Is there another way in Froyo to skip songs without waking and unlocking the phone? if there is sorry for asking but I didn't know it.
[Nexus One Android Development] AllanJacques:
skip

Not to be ungrateful and nothing but I was wondering if is there a version of trackball skip for froyo... Any ideas?

Thanks in advance!
[Nexus One Android Development] christiankk:
thaaaaaannkkkksss!!!!
[Nexus One Android Development] torchedlh:
Thank you so much!!! I wanted this app soo bad. I didnt have my USB cable and I didnt want to mess around with ADB in terminal so this convinced me to immediately buy Root Explorer haha. Im sure it will come in handy later anyway.
[Nexus One Android Development] vegetaleb:
Since I installed this file I am having FC on BT sending files :eek:
[Nexus One Android Development] jdmarko:
I've noticed some odd FC behavior on a few things... WhitePages CallerID, and the *#*#4636#*#* feature gives a FC that goes away when I revert to the not-modified version. Anyone else getting this behavior?

Using Paul's r20.
[Nexus One Android Development] torchedlh:
Yup, I am getting FC's with *#*#4636#*#* as well as when I click Status in Settings/About Phone...

How would i go about restoring the original?? Running the kang's small kernel with SP2. I know I should have nandroided or backed up. If I can't restore the original, could I just reflash the ROM on top without wiping?
[Nexus One Android Development] Bronyr:
As I posted in the 'latest' CM6 is up with trackball wake. Not working in conjunction with trackball alert app though.

http://forum.cyanogenmod.com/topic/1934-cm-6-n1-disccussion/
[Nexus One Android Development] vegetaleb:
So it seems we wouldn't have Tracball wake with no bugs before CM6 Test1 (not the buggy alpha1)
[Nexus One Android Development] 4runnin1285:
Me too. Didn't see any song skipping functionality in the froyo changes.
[Nexus One Android Development] stevekc40v:
Trying to download from my N1. Keep getting download unsuccessful error. It can't determine the file size. Am I missing something?
[Nexus One Android Development] Geo411m:
I have zero FC on my custom ROM while using this mod. Maybe you guys should try wiping caches.
[Nexus One Android Development] Snoopy997s:
hi,

can you give me exact instructions on how to use root explorer to enable this feature?

thanks!
[Nexus One Android Development] crimsondr:
What method did you use to push the file to your phone?
[Nexus One Android Development] malevolent000:
Works perfectly:D One of the only reasons i would load CM6. Nice job!!!!
[Nexus One Android Development] crimsondr:
If you're getting FCs then most likely the permissions on android.policy.jar are incorrect.

Do this:

chmod 644 /system/framework/android.policy.jar

Then reboot and your FCs should be gone.
[Nexus One Android Development] FormelLMS:
Can you please explain short, how to do this?
[Nexus One Android Development] crimsondr:
You can use adb shell from your computer and then type the command or use terminal on your phone. You could also use something like root explorer to change the permissions.
[Nexus One Android Development] futango:
got it working on stock FRF85 stock with root.
[Nexus One Android Development] jdmarko:
I used root explorer, then a reboot... nothing fancy. I can try an adb push if that makes a difference, but I don't see how it would. I'll try a different kernel as well and see if that makes a difference.
[Nexus One Android Development] Bakano:
so here's what you do:

1) open root explorer and find the file, make sure it is named android.policy.jar

2) copy android.policy.jar

3) go up to the root and then drill down to system>framework

4) at the top of the window, click on "Mount R/W"

5) paste the file (replace)

6) reboot... IMMEDIATELY

so the immediately is just added for dramatic effect =)
[Nexus One Android Development] crimsondr:
The difference can be that if you push the file over the original using adb, the permissions will remain the same. If you copy the file to /system/framework, rename the old, then rename the new, the permissions will be wrong.

I was only able to reproduce your error when the permissions were incorrect, so I assume that is the problem.
[Nexus One Android Development] jdmarko:
Quick chmod via adb shell... and everything is fine now! Great work, and thanks for catching the permissions error!!
[Nexus One Android Development] jdmarko:
I would add an additional step after the paste (and before reboot) to change permissions.

To do this, long-press on the android.policy.jar, and copy the same permissions (-rw-r--r--) as the rest of the files. This is user read-write, and read-only for everyone else. (This is the same as "chmod 644" but you don't really need to use that with Root Explorer.)
[Nexus One Android Development] athome93:
it's necessary to be root to put this file ?

thank
[Nexus One Android Development] THATTON:
Yes it is. And THANK YOU to the OP and Cyanogen!!!!!!!!! I have been waiting for this for what seems like forever! (Doing backflips)