How to log button presses in android - Android Q&A, Help & Troubleshooting

Hey i am suspecting a hardware bug on my Samsung Galaxy S Plus.
Im writing this in the general forums since it doesnt seem to be a bug specific to the phone (no reports anywhere online) and the question itself is therefore not device specific.
So i have a hardware home button on the phone which sometimes registers two clicks instead of one.
On a 1sec press this would mean the following events:
- button down event
1sec pause
- button up event
- button down event
- button up event
So since this doesn't occur regularly and i want to somehow log presses of the home button and i dont know any way to do that in android.
Could there be an app for that?
It doesnt need to run in the background but could be for example be openend specifically to test the button.
Is there any way you can help me out?

bump

Related

Home Key lag

I dont know if anyone of you noticed but when i press the home key on the sgs2, it takes a second or two to respond. I HATE IT. I know samsung did that so it can make sure that we are not pressing it twice for voice control activation.
But I don't care abt voice navigation control. is there anyway to speed the home key action? I need instantaneous jump to home screen as soon as I press the home key. Please help.
Thanks
already resolved in most custom roms
there is also a thread in original development (found via searching) that details how to do it manually

[Q] Long press headset does not start Google Now when screen locked

Galaxy Nexus
Android Version: 4.2.2
Steps to reproduce the problem:
- plug in headset
- lock screen
- press headset button for several seconds
What happened:
- No reaction, Google Now / Voice Actions not launched
- Manually unlock screen
- Long press with unlocked screen correctly launches Voice Search
What you think the correct behaviour should be:
Long press of headset button should launch Google Now / Voice Actions even with locked screen. Having to dig the phone out of your pocket in order to launch Voice Actions with a headset e.g. to place a call kinda defeats the purpose of using Voice Actions in the first place.
Adding insult to injury: long press is not broadcast to other applications because of Google Now, so it can't even be put to good use e.g. as volume control.
This was open and ignored by code.google.com Issue 48616
I also have the same problem. The restriction is not due to the lockscreen, apparently. If you disable the option "Power button immediately locks screen" and set "Automatically lock screen after sleep" time to a long enough time, still the long press doesn't work.
It works fine only when screen is on and unlocked. Weird. There is no point of this shortcut if our phone is unlocked and on, because in such a scenario, if headset is connected and phone is awake and unlocked, it means the phone is in our hands. And if it is in our hands, we can just press the button on the Search widget instead of long pressing the headset button. This is pathetic.
rhoadster91 said:
I also have the same problem. The restriction is not due to the lockscreen, apparently. If you disable the option "Power button immediately locks screen" and set "Automatically lock screen after sleep" time to a long enough time, still the long press doesn't work.
It works fine only when screen is on and unlocked. Weird. There is no point of this shortcut if our phone is unlocked and on, because in such a scenario, if headset is connected and phone is awake and unlocked, it means the phone is in our hands. And if it is in our hands, we can just press the button on the Search widget instead of long pressing the headset button. This is pathetic.
Click to expand...
Click to collapse
I'm affected by this as well.. I love calling upon Google Now from the headset, but sucks that I have to first unlock the screen on the Nexus 4 to do this. I'm OK with this being off by default, but users should be offered an option to turn this on while screen is locked.
Levistras said:
I'm affected by this as well.. I love calling upon Google Now from the headset, but sucks that I have to first unlock the screen on the Nexus 4 to do this. I'm OK with this being off by default, but users should be offered an option to turn this on while screen is locked.
Click to expand...
Click to collapse
Android apparently wants you looking at the screen so you can see the advertisements, so much for being the "open" OS.
So, guys, still no solution to fix this???
Darksydecad said:
Galaxy Nexus
Android Version: 4.2.2
Steps to reproduce the problem:
- plug in headset
- lock screen
- press headset button for several seconds
What happened:
- No reaction, Google Now / Voice Actions not launched
- Manually unlock screen
- Long press with unlocked screen correctly launches Voice Search
What you think the correct behaviour should be:
Long press of headset button should launch Google Now / Voice Actions even with locked screen. Having to dig the phone out of your pocket in order to launch Voice Actions with a headset e.g. to place a call kinda defeats the purpose of using Voice Actions in the first place.
Adding insult to injury: long press is not broadcast to other applications because of Google Now, so it can't even be put to good use e.g. as volume control.
This was open and ignored by code.google.com Issue 48616
Click to expand...
Click to collapse
Levistras said:
I'm affected by this as well.. I love calling upon Google Now from the headset, but sucks that I have to first unlock the screen on the Nexus 4 to do this. I'm OK with this being off by default, but users should be offered an option to turn this on while screen is locked.
Click to expand...
Click to collapse
vivekiny2k said:
Android apparently wants you looking at the screen so you can see the advertisements, so much for being the "open" OS.
Click to expand...
Click to collapse
Elastep said:
So, guys, still no solution to fix this???
Click to expand...
Click to collapse
Please check this link
rhoadster91 said:
Please check this link
Click to expand...
Click to collapse
I got so fed up I wrote my own app. If you have s voice, the phone wakes up on long press and My app takes over. I an releasing another version tomorrow. I still have to update the video demo.
http://forum.xda-developers.com/showthread.php?t=2289104
There's a solution
Darksydecad said:
Galaxy Nexus
Android Version: 4.2.2
Steps to reproduce the problem:
- plug in headset
- lock screen
- press headset button for several seconds
What happened:
- No reaction, Google Now / Voice Actions not launched
- Manually unlock screen
- Long press with unlocked screen correctly launches Voice Search
What you think the correct behaviour should be:
Long press of headset button should launch Google Now / Voice Actions even with locked screen. Having to dig the phone out of your pocket in order to launch Voice Actions with a headset e.g. to place a call kinda defeats the purpose of using Voice Actions in the first place.
Adding insult to injury: long press is not broadcast to other applications because of Google Now, so it can't even be put to good use e.g. as volume control.
This was open and ignored by code.google.com Issue 48616
Click to expand...
Click to collapse
You can enable it by, either
1) setting the unlock pattern to none(that will completely disable locksreen, and you can use the google now feature even in screen off)
2) setting the unlock to any pattern and uncheck the "power button instantly locks screen" - in this way you can use the the feature withing the time you specify in the lock screen
CellSmart! said:
You can enable it by, either
1) setting the unlock pattern to none(that will completely disable locksreen, and you can use the google now feature even in screen off)
2) setting the unlock to any pattern and uncheck the "power button instantly locks screen" - in this way you can use the the feature withing the time you specify in the lock screen
Click to expand...
Click to collapse
Sorry, I have the same problem, I tried this, but this doesn't work...
Any ideas?
Cheers,
--
Steph
Me too
I'm also in the boat of wanting to access Google now while the phone sits in my pocket and I'm wearing headphones. I can kinda understand why they disallow this (so a thief can't make calls on your dime), but it'd be very nice to at least launch apps.
Even xposed's app settings, with Google search allowed to show on the lock screen, doesn't make it happen. I just get a message saying I need to unlock my phone.
The only idea I currently have to launch it over the lock screen is to use auto voice with Tasker. Perhaps I could get it to launch/listen with a triple tap (because long press is locked up by Google now) via degauss. I just hope it all works over the lock screen. I'll update if/when it happens.
tcg-2 said:
I'm also in the boat of wanting to access Google now while the phone sits in my pocket and I'm wearing headphones. I can kinda understand why they disallow this (so a thief can't make calls on your dime), but it'd be very nice to at least launch apps.
Even xposed's app settings, with Google search allowed to show on the lock screen, doesn't make it happen. I just get a message saying I need to unlock my phone.
The only idea I currently have to launch it over the lock screen is to use auto voice with Tasker. Perhaps I could get it to launch/listen with a triple tap (because long press is locked up by Google now) via degauss. I just hope it all works over the lock screen. I'll update if/when it happens.
Click to expand...
Click to collapse
I found a fix for this (yes I know this is old but anyway). You have to install the xposed module "xposed additions" and set the long press headset button to unlock the phone. when the phone is unlocked you can simply long press the button again and google voice search will come up. this way you have to long press the button twice but at least it works
spiderflash said:
I found a fix for this (yes I know this is old but anyway). You have to install the xposed module "xposed additions" and set the long press headset button to unlock the phone. when the phone is unlocked you can simply long press the button again and google voice search will come up. this way you have to long press the button twice but at least it works
Click to expand...
Click to collapse
thanks spiderflash, this would work but fully unlocks the phone instead of just the Google now search, guess we have to wait for google to fix it.
I've got it
I've developed a good way to do this now. I've had it for the past 2 months or so, but I was waiting until I could go 2 weeks without a hitch.
You need 4 apps: tasker, secure settings, headset button controller and (if you don't for some reason have it) Google Now.
1. Tell hbc to perform a Tasker task (whatever you want to name it, e.g. 'launch voice search') for 3 clicks
2. Task should do the following: turn screen on, keep screen on at least 15 seconds, launch Google voice search [this is where you say your command, e.g. 'play some music'], lock screen, turn screen off.*
If you want to make this slightly less complex, you can simply have it turn the screen on, then you have to manually say 'OK Google,' then say your voice command (as long as you have Google Now available from the lock screen), but I'm trying to get directly to voice search, which won't launch directly if the screen is locked.
For some reason clicking the headset button 3 times sometimes doesn't trigger the first time after you plug in your headset (but works fine once it's triggered the first time until you unplug and re plug). Sometimes you need to do it twice if you don't hear the little Google Now voice beep.
So I hope this helps, but if you develop a better way to do this, please let me know.
* This is because, before I added this, motion in my pocket with the screen on caused it to swipe to the camera, where it will not turn off by itself. It stayed on for a good half hour in my pocket that day.
I have found the solution.
I had three Assist Apps . When I long pressed headset button while screen unlocked, it asked me to choose between Google, Autovoice and Tasker Secondary. I chose Google. From there on Assistant wakes up on long press headset button when screen is on.
When the screen is off, and you long press the headset button the same options popup but you don't see because screen is locked. Now Assistant can't run untill you set the default assist app on lockscreen.
Solution:
Lock your screen.
Long press headset button.
Within 3 sec pressing quickly unlock the phone.
You will see the dialogue asking to choose assist app.
Choose google.
Solved.

[Q]Long Press/2 Quick-Press Home behavior - Responsible file?

Hey all...
So, with latest 6.1.B.1.96 update for Sony Xperia S, the home button behavior has changed...
Previously, to go to home, you just had to press once, and to open Recent Apps list, long press home button. Now, though, it has changed to:
Single Press: Home
Long Press: Google Now
Douple Press: Recent Apps
I've been looking forward onto how to trade the Long press and douple press behaviors (Long Press: Recent Apps, and Douple Press: Google Now), but I have no idea how. I know it is coded in some file (obviously), but I have no idea where.
So, my question is: Which file, and where is generally responsible for button behavior?
I think I can progress further without any more help, but if I can't, I will ask again here...
Thanks everyone for help

Disabled Hardware Buttons or double used

Hey there,
i cant get it to work. Please help me.
My phone (goophone i5s with MTK 6572) doesn´t come with the possibility to use a backbutton. (Key no. 158) As i use the app which shows which buttons are pressed, there is for the home button Key no. 0. No matter i thougth. give it a try with LMT-Launcher which emulates a softkeypress.
But what can i say. There is also only the key no. 0 if i use softkeyBACK.
So please answer me the following questions:
in the keyboard.kl there is 158 BACK and WAKE_Dropped. As i read: this is normal.
1. But where is it handled, that the HOME and BACK button is in this stupid use.
(sometimes i think, the HOMEbutton is double mapped -> especially when i´m in the internetbrowser and press HOME-Button then it shows first the previos page i watched and then go to homescreen.
2. If you don`t know the solution please help me otherwise:
is it possible to take anything from other phone, working just fine with virtual back buttons (especially the KOphone i5s (Mtk 6577)
OR
3. many Apps does have a backfunktion built in. is there a possibility to arrage that into the apps, that there is always a button which shows previous page.
Please help me. Getting crazy about that.
Siarolex
nktion built in. is there a possibility to arrage that into the apps, that there is always a button which shows previous page.
Please help me. Getting crazy about that.
Siarolex[/QUOTE]
Nobody any Idea?
Nobody any idea?

[Q] detect phone-call button pressed in android

Hi everyone,
I am developing a program for android. I need to detect when the button for phone-call (the green one usually in the down-left of the home screen). There is an api that does something similar for the back button (onBackPressed()), which can be used to customize the pressing of the back button with some action. I am wandering if there is something similar to onBackPressed() for the phone-call button, the one that opens the activity with keypad, logs, favorites, contacts...
Thanks for any help!

Categories

Resources