Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
staunty
Old
#1  
Senior Member - OP
Thanks Meter 0
Posts: 211
Join Date: Nov 2009
Default Re-mapping keys / Creating or re-assigning keyevent

OK, I've looked around but can't find an answer. Or at least an answer that I can understand. Basically what I'm trying to do is add the ability to quit/exit an app. I've read all about the differing opinions on quitting an app versus pressing back. However, just for my own self-teaching purposes, I want to learn how to do this. I'd like to be able to long-press or double tap a key to either immediately exit an app, or bring up an alternate pop-up menu that allows you to choose an action.

I am thinking specifically in relation to the Browser. The quit option was more necessary pre-CM6 because often times, it would take forever to load the home screen after pressing "home" in order to stop using the browser. A simple exit/quit option that some apps have, usually acts much quicker. Everyone knows that if you've been browsing through a bunch of webpages, hitting the back button repeatedly is a pain in the ass. The other option is to hit menu-->windows-->then close all the open windows-->then hitting the back button once the new window pops up because browser automatically opens a new page once all open windows have been closed.

Another annoyance is not being able to quickly get to your home page. Is there a way to remap/reassign/whatever, keys so that on long-press or double-tap of say, menu, or trackball, a menu pops up which has a "exit/quit" option and a "home page" option?
Another option is to add to the menu (when you hit menu), a "quit/exit" or "homepage" option.
Any help would be appreciated.
 
bubonik
Old
#2  
Senior Member
Thanks Meter 6
Posts: 344
Join Date: Apr 2006
Location: Portland
So much for a "supporting community". Way to help each other out.

What your trying to do should be located in the /system/usr folder. It has the key information you are trying to edit.
 
staunty
Old
#3  
Senior Member - OP
Thanks Meter 0
Posts: 211
Join Date: Nov 2009
Quote:
Originally Posted by bubonik View Post
So much for a "supporting community". Way to help each other out.

What your trying to do should be located in the /system/usr folder. It has the key information you are trying to edit.
Yeah, most people are probably trying to figure out a way to tell me I posted in the wrong section or that I need to use the search function. Thanks for your answer but I am familiar with the /system/usr files...I don't see anything in there relating to an action that quits/exits an app. Is there a specific action that is called when someone presses menu while using an app, and the menu brings up options including quit/exit?
 
staunty
Old
#4  
Senior Member - OP
Thanks Meter 0
Posts: 211
Join Date: Nov 2009
Really? Nobody?
 
Super Jamie
Old
#5  
Senior Member
Thanks Meter 5
Posts: 177
Join Date: Oct 2009
The keymap files are stored in /system/usr/keylayout, open them up and have a look at the things you can assign to keys.

Pull-edit-push the correct version for your handset hardware and reboot, changes will take effect. Obviously Magics are sapphire-keypad.kl and G1s are one of the trout files. Most G1s are trout-keypad-v3.kl though you can confirm your specific hardware version with getprop.

Have a search for "keymap" and "keylayout", you'll find there's already a bit of work been done of this, for example this auto key-changer.
Current: Samsung Galaxy S2 I9100 + CM7 Nightly
Current: Samsung Galaxy Tab 10.1 P7510 + root
Previous: T-Mobile G1, HTC Magic 32B, Google Nexus S I9023
 
staunty
Old
#6  
Senior Member - OP
Thanks Meter 0
Posts: 211
Join Date: Nov 2009
I appreciate the help but I guess I'm not explaining myself properly. I have looked at the files in /system/usr/. I know how to remap a key so that, say...volume down = pause music, or change the menu key to have it end a call if I wanted...I know I'm not using the correct terminology all the time but when looking at the various .kl files, there are various "actions" that can be attributed to a particular key. For instance, keys 107 & 62 = Endcall, key 158 = Back, key 10 = the number 9.
In the column next to the numerical keycode in each of the .kl files, there is an "action" that results from pressing the particular key. The action I am looking for is a "quit" and/or "exit" action to apply to a particular key. Let's say I wanted to have key 231 in the sapphire keypad, kill the app I am using. Right now, pressing key 231 = CALL button. Is there a keyevent such as Kill_app or something to that affect that I could put in place of the CALL action so that key 231 = Kill app?
 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Boot Animation Paradise for your Android Device

The default boot animations on any device, no matter whichmanufacturer, are generally pretty … more

Flash Custom ROM and Recovery to Samsung Galaxy S 4

After reading about Dan Rosenberg’s bootloader exploit for the Samsung Galaxy S 4,I … more

Windows-Based Multi-Tool for the Sony Xperia U

If you are a flashaholic and an owner of the Sony Xperia U, you may be interested in the … more