Track skipping using Volume Up-Down Buttons

Preamble
You will need write permissions to the filesystem on your pre to apply this patch.

To get write persmissions execute:

To remount the filesystem as read-only:

Motivation
A headset with in-lined track skip buttons is nice, but when you're using headphones not created for a phone, or you're in a car with the phone connected to the vehicle's sound system, it's nice to be able to skip to the next or previous track with a simple button press. The Blackberry Curve (user FXDemolisher's old phone) had this ability by holding down the volume up/down buttons for a second or so. The track would skip and the volume would be restored to normal. This patch aims to add the same functionality to the Pre.

Procedure
This is one long patch that adds several sections to the following file:


 * Please back up this file before trying this patch.

Track skip at start up issue
The first volume up/down press in the app causes the track to skip. I am not sure why, it may have to do with the amount of time it takes for the bar assistant to come up and does not give enough time for the volume key up event to propagate. ~ FXDemolisher

Timeouts
There are two main timeout values in the code. One controls the amount of time the button has to be held down to skip: The other controls the amount of time the user has to lift the finger off the key before the volume is restored to normal:

I kept the skip timeout at 1200 so that the volume doesn't have enough time to go too high when you are wearing headphones but is not short enough to cause random skips. The restore timeout is at 1000 and seems to work fine. If you shorten the second timeout the volume may not restore right since the user is still pressing the button when the setVolume call is made.

~ FXDemolisher