A way to detect volume rocker presses on low level - Android Software/Hacking General [Developers Only]

OK, here's the deal: Android services, unlike activities, are unable to capture keypresses via i.e. onKeyDown(). That makes it hard for services that for example play music to detect volume rocker presses. Capturing them is possible, as Voodoo Louder somehow detects it, but unfortunately Voodoo author is not willing to share his secret. So question to you hackers - is there any other way for service to capture volume button presses, beside the one I've posted on stack exchange, the one that employs ContentObserver? Some low level kernel access point? Something in /dev/ ? Note that my device doesn't have /dev/event0, as supposed here:
http://www.kandroid.org/online-pdk/guide/keymaps_keyboard_input.html

Related

Pandora volume issues (too low)? Look no further!

To increase the volume of Pandora on Windows Mobile:
1. Open Pandora
2. Wait for music to start playing
3. Press the OK button (you should now hear an audible increase in the playback volume)
4. Bring Pandora back into focus, repeat steps 1-3 and enjoy your preferred level!
Why this works:
Let's concentrate first on the number of levels of fail in play here...
Level 1:
Windows Mobile utilizes some pretty funky key-mappings. As can be seen here:
http:[slash][slash]msdn.microsoft.com/en-us/library/bb431750.aspx
the key for 'volume +' is actually 'F6'. Since most Windows Mobile phones do not have the F-key row, the only way to do this is if you have a hard button.
Level 2:
The Pandora programmers decided to give Pandora an independent volume control at all based upon the same button configuration used by Windows Mobile to detect hardware button presses.
This also works the same way in the browser-based version at pandora.com! Try using your hardware 'volume -' button (if you have one) on your PC while you have the browser window running Pandora in focus - you'll see what I mean...
Level 3:
The Pandora programmers decided to not expose the above control to the user in the GUI
Level 4:
The Pandora programmers decided to utilize Windows Media Player mobile for their backend. Unfortunately for us who do not have a hardware volume control, they initialize the Windows Media Player ActiveX control's (Those of you who have ever programmed in Visual Basic should know what I mean here) volume value to BFFF (hex) or 49151 (dec) - equaling about 74.6% - every time you start the Pandora player, instead of 100%.
This is a 32-bit value, so the max value is FFFF (hex) or 65535 (dec). It is also written to the registry at the location \HKCU\Software\Microsoft\MediaPlayer\Preferences\Volume and it's horrid results can be observed by starting Media Player after Exiting the Pandora app.
Level 5:
Those of us suffering from a lack of hardware buttons may have thought they were really smart after discovering the above and tried a button re-programming application for Windows Mobile, to attempt to bestow upon ourselves a volume +, volume -, or both hardware buttons. This simply does not work for one reason or another - I am guessing because the programs may only send the key-down event and Pandora may only look for the key up event.
I spent the last two days trying to bring forth fruit from this method.
And the best part...
When you press the 'OK' hard button, it doesn't correspond to just one button in the Operating system. It is actually a combination of WINKEY + F6. Those of you who have hardware button controls can try this, or the rest of us can get the 'cerdisp' program and try this with our Windows computers. It should close whatever program you have in focus. Since Pandora is not really looking for the WIN key, I'm assuming it ignores the WIN key press, instead looking only at the F6 key press alongside it, this time most likely along with it's associated key-up event.
Please let me know your results. This was tested on an HTC PPC-6800 with a cooked WM6.5 rom.
On a side note, it's been a long year of searching for a solution, but at long last I can listen to Pandora at full volume through my Ford SYNC-capable stereo using A2DP!

Volume Control App

Hey. I'm looking for a volume control application that would basically let me control the volume of individual applications.
Reason I'm asking for this is due to the fact I use a GPS navigation application and Winamp at the same time while driving. I'd like Winamp's volume to be slightly lower than the navigation application so I can hear the given directions better. Thanks.

[APP] Volume Locker +

My first personal designed app: Volume Locker +
This is my first designed little app. It may not be great, but it will be a good start.
It's free and ads free. Welcome to play around with it. If you think it is cool, you can leave a good comment. Please also feel free to share any of your opinion or suggestion. Thx~~~ ^_^
Google play store link: https://play.google.com/store/apps/details?id=com.nickyang.volumelockerplus
Music enthusiasts? Ever feel annoying and ear damaged when the volume+ hardware button is accidentally long pressing in your pocket?
Volume Locker+ can help you protect your ear from accidental long pressing on the volume+ hardware button by detecting the sudden volume change, setting a maximum allowed media volume, pause the media and re-adjusting the volume to a reasonable level.
1. Why to use Volume Locker+
Android system does not allow hardware volume button to be overwritten by app running in the background. Current apps in the market with a similar function simply re-adjust volume which will not work effectively if the volume+ button is long pressed by user which is the most common situation during an accidental long press in the pocket. Volume locker+ can help you pause media to prevent ear damage.
2. How to use Volume Locker+?
a. In the main interface
Enable the volume locker and set the maximum allowed media volume by click the check box. Once it is
checked, a service will be created to run at background.
b. In the setting of the menu (Right top corner)
1) user can specify whether media should be paused or not, when volume is detected to be larger than the
threshold.
2) Choose the duration to pause media. Default is 2 seconds.
3) Choose if service is started on boot. This is only effective when the volume locker is enabled before shut down
or reboot.
3. How to report a bug or request a feature?
You can send your question or request to the email at [email protected].
I would appreciate it very much if you can give me some suggestion or feedback. You also welcome to leave a comment and rating.
I know there are so many professional developer, your feedback will mean a lot to me.
Thanks!

Oneplus 6 Pie update Volume Control

Hi all
I saw an earlier thread on this but can't believe that it's not a bug that needs fixed.
My phone has no apps open, I unlock it and press the volume buttons and up pops a little window showing me that I am adjusting the media volume. This functionality used to be context sensitive, ie, in this case it would adjust the ringer, in a call it would adjust the call volume and when playing media it would adjust the media volume.
Now it's just the media volume and a few screen actions to adjust the ringer.
Surely this is a backwards step and a bug?
Does anyone know of a way to change this, or an app that can be associated with the volume controls to make it work properly?
Thanks
Michael
I don't know that there's a way to revert it to a previous Android way of handling it as it's the way Google built Pie's volume control to work.
FWIW, they did it for the millions out there who don't ever want to change the volume for their ringer/notifications once they get it set, especially if they start adjusting volume for something like a call before the context has kicked in, so you inadvertently adjust ringer volume instead of in-call volume. At least, that's what I assume it is because that's what happened with me. I have set my phone to vibrate as soon as it's out of the box, and with the new way of handling volume, I no longer have to deal with changing it off of that setting until I reset the phone. I love it.
Seamonkey79 said:
I don't know that there's a way to revert it to a previous Android way of handling it as it's the way Google built Pie's volume control to work.
FWIW, they did it for the millions out there who don't ever want to change the volume for their ringer/notifications once they get it set, especially if they start adjusting volume for something like a call before the context has kicked in, so you inadvertently adjust ringer volume instead of in-call volume. At least, that's what I assume it is because that's what happened with me. I have set my phone to vibrate as soon as it's out of the box, and with the new way of handling volume, I no longer have to deal with changing it off of that setting until I reset the phone. I love it.
Click to expand...
Click to collapse
Thanks for the reply, and the explanation Seamonkey. I have to say though I still don't get why they didn't just make this a user selectable option. Pick the default volume to adjust or leave it as context sensitive.
For some of us the phone is still a device for phone calls first and everything else second!
All the best
Michael

Xiaomi 10 Pro shortcut swipe from lock screen and Bluetooth volume sync

Hi, been playing this phone for 1 week already.
Which i find it very interesting and useful!
But there are some issues which i find it redundant and would like to see if experts out there can solve it.
1. When i long press the fingerprint in lock screen, it will unlock the phone. but when you press long enough i can access to the Wechat pay, Mi AI, Alipay shortcuts.
I use wechat pay alot, so when i swipe to do payment (the barcode one), it will notify me EVERYTIME Not to send the code to other people unless making payment and i have to press "got it". Is there a way i can bypass this and go directly to the barcode just like when you doing it the longest way where you have to open the wechat > wechat pay > Money.
2. when i connect my bluetooth speakers (my speaker has its own volume control), the volume of my xiaomi phone and speaker volume works separately.
What i mean is when i turn the volume up on the phone only the phone media volume goes up and not the speaker. so i have to turn up the speaker volume again to set the volume i want. Is there a way that could sync both volume at the same level so one volume key can set both phone and speaker.
i found that this is a common case too where many people are searching for solution...
I have tried the enabling/disabling absolute audio which doesn't work
I just found out that the problem will not persist when i am on a call.
So when i press the volume up and down on the bluetooth headset, it will also control the volume on the phone (the volume bar on the phone will go up and down while i am increasing or decreasing the volume on headset)
I've found that the problem is very common with every single phone I had..... probably it depends also from the bluetooth accesories used.

Categories

Resources