Change the behavior of end call button - HD2 Android Q&A, Help & Troubleshooting and Genera

Hey guys, I need a little help!
There was a way with root explorer to change the behavior of end call button.
There was a directory in which we can change to end the call with hardware button.
Can anyone please tell me which was the directory, and what should I change.
I know that I saw this in one thread, but I can't find it.
Thanks!

Here you go..
http://forum.xda-developers.com/showthread.php?t=695936
You can also get ButtonRemapper from the market.

Related

Pass Arguments for Phone

I am working with Customizing an App and i want to be able to map a button that will open phone app( which i have done) but i wanna be able to pass the argument that will dial a certain number when i press the button, sorta like a speed dial button on HTC HOME. The app has a place for the argument to be entered, but i dont know how to pass arguments. Does anyone know how this would work? Thanks In Advance For Any Help.
Mr. Simpkins
noone know?

Any application/script to "answer call"

Hi Guys,
I'm not a programmer and hope someone can assist. I'm looking for a shortcut, 1-line script, piece of code or something which will perorm the function of "answer call". I don't want the code to "make call" but specifically to "answer".
The reason is that I'm finding I keep dialling people by kistake because when the phoen app is open, the left button (what would hav ebeen green on a hard device) places a call as well as answers. I want to use MobileMagic or AEButtons or something to reprogram that button to ANSWER a call in the Phone app but not to disable its ability to DIAL a call. Maybe there's even a registry hack that will do this but I can't find it.
Any help would be greatly appreciated.
I'm bumping this to see if someone can give me some info. If it can't be done then could someone please let me know why? If I'm overlooking something simple then please point me in the right direction and believe that I have tried first...

Remap Softkeys?

Is it possible to remap our softkeys? I tried following directions I found on Hero and it didnt work. Was wondering if anyone was able to change lets say, the Search button to launch the Camera.
http://forum.xda-developers.com/showthread.php?t=695936
What happens when you LONG press your search button? Mine comes up with 3 different options from various apps i have installed, including voice search. So I would say yes, its def possible.
Handcent
Quick Settings
Voice Search
All 3 of those show up when you long press the search key. So I'm sure you can have it launch the camera, just have to know how to develop it
I wonder if it can maybe be altered with BetterCut.
LexusBrian400 said:
What happens when you LONG press your search button? Mine comes up with 3 different options from various apps i have installed, including voice search. So I would say yes, its def possible.
Handcent
Quick Settings
Voice Search
All 3 of those show up when you long press the search key. So I'm sure you can have it launch the camera, just have to know how to develop it
I wonder if it can maybe be altered with BetterCut.
Click to expand...
Click to collapse
I get 2 diff items when I long press search. Voice Search and Handcent. I tried following the guide listed above and it just made the Search key vibrate and do nothing. Unless I screwed up copy and paste, lol, I dont know. Has anyone successfully changed any of the soft keys?
droidkevlar said:
Is it possible to remap our softkeys? I tried following directions I found on Hero and it didnt work. Was wondering if anyone was able to change lets say, the Search button to launch the Camera.
http://forum.xda-developers.com/showthread.php?t=695936
Click to expand...
Click to collapse
Decad3nce [OP]
Senior Member
id totally ask this dude, if he came up with this than im sure hed know how to revamp for our phone, theres proably honestly little to change in process.lol i wish i knew how or id tell ya....

Handling the genius button press

We need to figure out a way to customize the genius button. It would be a great service to everyone, especially if it doesn't require root.
I looked at logCat, and I see that the button fires up the following intent:
Code:
{ flg=0x10000000 cmp=com.nuance.android.vsuite.vsuiteapp/.VSuiteStartSession }
I'm not quite sure how to create an intent handler for something that doesn't have an action or a category. I even created a test app that matches the intent above exactly, but only the stock genius app launches, and I'm not given an option to choose my default handler for the action. I don't think there is a key handler to intercept either. Any ideas
You know, I was thinking about this all morning (eventhough I don't have the device). Back in the day we remapped functions for certain keys (as g1 didn not have search key of any kind). Can someone go into /system/usr and look what's in there? I believe we are looking for keylayout folder. In that folder we should have some .kl files. They named different from device to device (using Cliq now and they are all named MorrisonXXXXX.kl). Look through those files and find genious button function. From there it should be very easy to change it to google search (or voice search) but substituting the function and pushing the file back in its location. I would have no problem doing it but as I said, I don't own the device myself.
Couple more option (highly unlikely to work):
Clear defaults in Genious app
Freeze Genious app
I don't see those working but who knows... we may be able to assign new default after doing this.
kl files
Here are the files from /system/usr/keylayout
Looks like the correct entry is in glacier-keypad.kl, but it is mapped to a "search" function.
Not sure it will help, but I'd love to see search there instead.
I don't mind the genius button, it actually works fairly well the more you use it. However, I don't like that it disables the search button.
It should be single press for search, long press for genius.
That would be perfect.
rjgii said:
Here are the files from /system/usr/keylayout
Looks like the correct entry is in glacier-keypad.kl, but it is mapped to a "search" function.
Not sure it will help, but I'd love to see search there instead.
Click to expand...
Click to collapse
Ok, I'm at work so I can't really do anything with this but I will look into into it later, when I get home. You are correct, it's in the glacier-keypad.kl. Unfortunately, it's set to the same thing as regular search i.e. In G1 we used to set it to SEARCH as well but it would bring up regular search.
I will try to PM GeniusDog (the guy who figured out how to remap keys) when I get home to see if he can give me some insight on this.
Did anyone try to freeze (disable) Genious app to see if it releases G key to regular search?
We should also contact ChiefzReloaded, he would know how to do it since they put CM on Slide which did have Genious on it to begin with.
Ok, so I guess this is a little different then the Slide. Slides G key was mapped to FUNC_4. Our G key already mapped to SEARCH, its just that Genious overtakes it. I twitted Eugene_73 to see if he could help, he was the brain behind Slide's development in this area.
If its helpful to anyone, holding down the menu button will bring out search keyboard. I really wish the would give us a option to chose from the voicesearch ¦,/
Sent from my HTC Glacier using XDA App
borodin1 said:
Ok, so I guess this is a little different then the Slide. Slides G key was mapped to FUNC_4. Our G key already mapped to SEARCH, its just that Genious overtakes it. I twitted Eugene_73 to see if he could help, he was the brain behind Slide's development in this area.
Click to expand...
Click to collapse
Hmm...what about mapping it to a function key (like on the G2) and then assign whatever action we want to that function key? I will try that out as soon as I get some free time.
Alright, so I tried modifying the key layout file on my G2 (vision-keypad.kl) just to test the process and I am not allowed to make any changes. Just get a "Read-only file system" response. I'm sure it would be the same for the MT4G. Anyone have ideas on what else to try? I really want to find a solution without rooting, but any solution would be a good start.
root
We have root now, so we should be able to modify the key mapping files.
If I find any time today I'll give it a shot.
rjgii said:
We have root now, so we should be able to modify the key mapping files.
If I find any time today I'll give it a shot.
Click to expand...
Click to collapse
Great. You will probably have to remount the system partition like this before you can write to it:
su
mount -o remount, rw /system
Oh how I hate that genius button..I would absolutely donate immediately for an app to remap it to search. That would be amazing.
Sent from my HTC Glacier using XDA App
Did anyone try to uninstall (disable) Genious app yet? Since the G key mapped to SEARCH already, this may release it to actuall Google search.... just thinking out loud
I froze it last night. No response from the G button after that.
21productionz said:
I froze it last night. No response from the G button after that.
Click to expand...
Click to collapse
LOL...
They really mean "you" in the commercials!
You gotta customize everything..
Sent From The Moon... With a HTC Glacier
I updated my voice search in the market when I first got the phone, and for a time when I pushed the button is would actually give me the option to choose what app handled the action and I could choose voice search. However, after one time choosing the Genius button it never asked again. I wonder if there would be a way to continuously clear the Default so that it always asked.
borodin1 said:
Did anyone try to uninstall (disable) Genious app yet? Since the G key mapped to SEARCH already, this may release it to actuall Google search.... just thinking out loud
Click to expand...
Click to collapse
I disabled dragon dictation and genius, and after holding the button for a couple seconds, my phone crashed and rebooted. Multiple taps on the button seemed to do the same thing. Leaving dragon dictation enabled and genius disabled seemed to be less prone to crashing.
This has been solved in this thread:
http://forum.xda-developers.com/showthread.php?t=836702

How to make headset button control music on the stock ROM

I'm not sure this is the right subforum for this, but I was coming here to ask how to do this before I figured it out for myself. So I figured I should post about it in case I forget what I did.
I just switched to a shiny new G2, and I'm using the one-button earphones that came with my Nexus S 4G. This is actually the third set of such headphones (I keep breaking and replacing them), so I refuse to have them not work on my rooted but otherwise stock G2.
When I first plugged them in to the G2, it was configured so that the button would control the phone function: one press would open my call history, a double press would redial, and a hold would start up voice dialer. On the Nexus S 4G, the buttons controlled my media player, so that's what I want them to do here.
I tried various button remapping tools like the JAYS Headset Control app, but none of them would take precedence over the default LG actions.
Instead, I modified this approach from the Nexus 4, and changed the key code for the button from the one that the voice dialer controls were intercepting (HEADSETHOOK) to something else (MEDIA_NEXT).
What I did:
1. Have root and install Busybox (for vi).
2. Get a root shell on the device.
Code:
$ adb shell
[email protected]:/ $ su
[email protected]:/ #
3. Mount /system as read-write:
Code:
[email protected]:/ # mount -o rw,remount /system
4. Edit the default Android keyboard layout to swap the HEADSETHOOK and MEDIA_NEXT keys.
Code:
[email protected]:/ # vi /system/usr/keylayout/Generic.kl
Press "i" to enter insert mode. Move around with the arrow keys.
Change:
Code:
key 163 MEDIA_NEXT
to:
Code:
key 163 HEADSETHOOK
And also change:
Code:
key 226 HEADSETHOOK
to:
Code:
key 226 MEDIA_NEXT
Press Escape, and then press Shift + Z twice to save and quit.
5. Reboot your device for the changes to take effect.
6. Now the button on your single-button headset is the equivalent of the "down" or "next" button on a three-button headset. To configure it, install JAYS Headset Control or a similar application. Chose the three-button headset instead of the one-button headset, and configure the third button to do everything you want your button to do.
7. Enjoy your customizable button!
Sweet! Not having my headset button work for audio was my biggest issue with the G2.
I followed the instructions above, but instead of swapping "key 163 MEDIA_NEXT" I swapped "key 164 MEDIA_PLAY_PAUSE". This caused the default behavior to be "Play/Pause".
I tried using JAYS Headset Control and it works great. Thanks for the find!
Oh my gosh! I've been looking everywhere for this solution. Thank you so much!
My dilemma was that I want to be able to use the headset buttons because I listen to music and switch tracks frequently while walking around the university. Only the Android KitKat ROMs worked for me, but the problem with those ROMs is that GPS has locking problems and/or doesn't work at all.
Thanks for this, it was helpful for me also. Like Myzur I've also used MEDIA_PLAY_PAUSE instead of MEDIA_NEXT.
I had a quick go with the "Headset Button ControllerTrial" app for some extended functionality, but it kept switching from Rhapsody to LG's music app. This was before I saw the comment about configuring things as if it were a 3 button headset, so I'll play around with this some more (and will probably also try the JAYS app). But even as-is, just the ability to play/pause is a very nice improvement over stock behavior (honestly, who uses their phone more for making calls than listening to music.. ).
doesnt work
For some reason this doesnt work with the LG G2 Sprint version, is there any other solution?
pabel101 said:
For some reason this doesnt work with the LG G2 Sprint version, is there any other solution?
Click to expand...
Click to collapse
My phone is LG G2 on Sprint (LS980), and it actually does work for me.
Since my above post, I have actually changed the mapping again to MEDIA_NEXT, and I'm using the Headset Button Controller app (https://play.google.com/store/apps/details?id=com.kober.headsetbutton). The actions in the controller app are all set under "Right button actions" (so exactly according to step 6 in the OP..).
I think any app that will let you configure things for a 3rd/right button should work. The JAYS one is free, but as I recall it asked for a permission I wasn't comfortable with, and I ended up with Kober's app instead, which I think was $2 and to me well worth it (you can barely get a coffee for that these days..). There is a free trial.
This setup works great for music controls (play/pause, next/previous, volume control), but it doesn't seem call control (answer/hangup, mute etc.) is totally working. For me this is mostly about music controls, so I'm not too worried about the call controls and haven't looked into fixing that so far.
By the way, I found out a modified Generic.kl file is enough to cause updates to fail (for ZVC anyway), so you'll want to keep a copy of the original to restore for cases like that.
If you still can't get it to work, what exactly is happening for you, and what app are you using? Did you map MEDIA_NEXT, or MEDIA_PLAY_PAUSE? The Headset Button Controller app I'm using (free trial also) has a troubleshooting feature where it displays the button presses it sees on screen, whether it takes action on it or not, which could be useful to figure things out.
doesnt work
ChoppedLiver said:
My phone is LG G2 on Sprint (LS980), and it actually does work for me.
Since my above post, I have actually changed the mapping again to MEDIA_NEXT, and I'm using the Headset Button Controller app (https://play.google.com/store/apps/details?id=com.kober.headsetbutton). The actions in the controller app are all set under "Right button actions" (so exactly according to step 6 in the OP..).
I think any app that will let you configure things for a 3rd/right button should work. The JAYS one is free, but as I recall it asked for a permission I wasn't comfortable with, and I ended up with Kober's app instead, which I think was $2 and to me well worth it (you can barely get a coffee for that these days..). There is a free trial.
This setup works great for music controls (play/pause, next/previous, volume control), but it doesn't seem call control (answer/hangup, mute etc.) is totally working. For me this is mostly about music controls, so I'm not too worried about the call controls and haven't looked into fixing that so far.
By the way, I found out a modified Generic.kl file is enough to cause updates to fail (for ZVC anyway), so you'll want to keep a copy of the original to restore for cases like that.
If you still can't get it to work, what exactly is happening for you, and what app are you using? Did you map MEDIA_NEXT, or MEDIA_PLAY_PAUSE? The Headset Button Controller app I'm using (free trial also) has a troubleshooting feature where it displays the button presses it sees on screen, whether it takes action on it or not, which could be useful to figure things out.
Click to expand...
Click to collapse
Im sooooo confused by this but is it possible for you to screen shot your settings for Generic.kl? im sorry for the late reply
pabel101 said:
Im sooooo confused by this but is it possible for you to screen shot your settings for Generic.kl? im sorry for the late reply
Click to expand...
Click to collapse
The whole file is over 400 lines long, so a bit too long to fit in a screenshot. There are only 2 lines that you will need to touch however, and they will look like this when you are done with them:
Code:
key 163 HEADSETHOOK
key 226 MEDIA_NEXT
Note that these lines are not next to each other, but they are easy enough to find as they are pretty much ordered by key "number" as you can see.
Sorry if I made things sound confusing.. the steps in the OP are maybe more clear, and exactly what you need to do to get Generic.kl modified the way mine is. Feel free to ask if you need more help/clarification though.
playpause
ChoppedLiver said:
The whole file is over 400 lines long, so a bit too long to fit in a screenshot. There are only 2 lines that you will need to touch however, and they will look like this when you are done with them:
Code:
key 163 HEADSETHOOK
key 226 MEDIA_NEXT
Note that these lines are not next to each other, but they are easy enough to find as they are pretty much ordered by key "number" as you can see.
Sorry if I made things sound confusing.. the steps in the OP are maybe more clear, and exactly what you need to do to get Generic.kl modified the way mine is. Feel free to ask if you need more help/clarification though.
Click to expand...
Click to collapse
ok i did what you said and now my middle button Just skips to next track is that alright?
pabel101 said:
ok i did what you said and now my middle button Just skips to next track is that alright?
Click to expand...
Click to collapse
Yes, this means the re-mapping of the button worked. Now you can use one of the headset control apps to program the button as you please (remember this button is now acting as the "next" or right button, so program as such).
But, you say "middle button" - do you have a 3 button headset? If yes, I think you could have left the mapping alone, and programmed either of the left/right buttons, or both. Not really sure of the best and most functional approach in this case, I've never had anything other than a single button headset. I would think with 3 buttons, if all 3 are supported, you can have some more flexibility.
If you do have a 3 button headset, but only the middle button is supported by Android at all (apparently YMMV depending on the make/model among other things), then ignore everything I just said, keep the mapping as-is, and just program the one working button as you like - still as if it were the right button.
headset
ChoppedLiver said:
Yes, this means the re-mapping of the button worked. Now you can use one of the headset control apps to program the button as you please (remember this button is now acting as the "next" or right button, so program as such).
But, you say "middle button" - do you have a 3 button headset? If yes, I think you could have left the mapping alone, and programmed either of the left/right buttons, or both. Not really sure of the best and most functional approach in this case, I've never had anything other than a single button headset. I would think with 3 buttons, if all 3 are supported, you can have some more flexibility.
If you do have a 3 button headset, but only the middle button is supported by Android at all (apparently YMMV depending on the make/model among other things), then ignore everything I just said, keep the mapping as-is, and just program the one working button as you like - still as if it were the right button.
Click to expand...
Click to collapse
Just to be more specific these are the headphones im using http://www.amazon.com/Samsung-Repla...m-Headset/dp/B007C5S3AU/ref=pd_bxgy_cps_img_y
Help
I really want to do this but I am clueless on what to do. Where do I input this code? The build prop? I don't usually mess with stuff to much but his has been bugging me for a while. Thanks in advance
Ghost_Killer811 said:
I really want to do this but I am clueless on what to do. Where do I input this code? The build prop? I don't usually mess with stuff to much but his has been bugging me for a while. Thanks in advance
Click to expand...
Click to collapse
The file to edit is /system/usr/keylayout/Generic.kl. Of course you need a rooted device to be able to edit it; also you need to mount the system partition read/write (it is mounted read-only during normal operation).
The first post of this thread has the exact instructions on how to do this. Have you tried to follow those steps?
One thing I might add - you will want to keep a copy of the un-edited, original Generic.kl file, because you will typically need to restore it to the original before applying firmware updates. Make a new copy of the original file after every firmware update, since the firmware update sometimes modifies it.
ChoppedLiver said:
The file to edit is /system/usr/keylayout/Generic.kl. Of course you need a rooted device to be able to edit it; also you need to mount the system partition read/write (it is mounted read-only during normal operation).
The first post of this thread has the exact instructions on how to do this. Have you tried to follow those steps?
One thing I might add - you will want to keep a copy of the un-edited, original Generic.kl file, because you will typically need to restore it to the original before applying firmware updates. Make a new copy of the original file after every firmware update, since the firmware update sometimes modifies it.
Click to expand...
Click to collapse
Thanks for the help. I tried reading the instructions, but I got confused. When it says to make a root shell and then gives the code, do I put it somewhere specific in the file or just anywhere.

Resources