Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
Renate NST
Old
#1  
Renate NST's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 466
Posts: 1,214
Join Date: Feb 2012
Location: Boston
Smile "n" button hacking

I've seen miscellaneous info around on the common task of repurposing the "n" button. I'd like to see a concise rundown of ways to hack it.

The "n" button is a scancode 102 that normally gets mapped to keycode 3 with /system/usr/keylayout/gpio-keys.kl

Keycode 3 in intercepted by the interceptKeyTi method of PhoneWindowManager in /system/framework/android.policy.jar

Keycode 3 is handled directly without using any intents.

It's not easy to hack a key to give an intent. You have CALL_BUTTTON, CAMERA_BUTTON & MEDIA_BUTTON. I haven't managed to catch them. The easy one to hack is SEARCH_LONG_PRESS.

You can easily change gpio-keys.kl to key 102 SEARCH
A normal press will bring up the default Nook search. A long press will generate an intent. All you have to do is insert another intent filter in your favorite app.

Code:
<intent-filter>
    <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
I have this running on my ADW Launcher and I uninstalled Button Savior.

Personally, I prefer hacking to installing yet another app just to do one thing. I would like to come up with a solution for a dedicated action for the "n" key.

Any thoughts?
 
GabrialDestruir
Old
#2  
Senior Member
Thanks Meter 497
Posts: 610
Join Date: Nov 2009
Location: California
If you use NookTouchTools this allows you to remap the buttons/quicknav etc without all the hassle.
Nexus 4 - Paranoid Android
Nexus 7 - Paranoid Android
Nook Glow - Stock
__________________
Support my Gadget Fund - Donate with bitcoin: 1PB8fhWEKRzBeeoud5gKnVqtdtEeSBdazL
TV Shows anywhere with HuluPlus - HuluPlus Referral
File storage anywhere with Dropbox - Dropbox Referral
 
Renate NST
Old
#3  
Renate NST's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 466
Posts: 1,214
Join Date: Feb 2012
Location: Boston
Quote:
Originally Posted by GabrialDestruir View Post
... without all the hassle.
Well, I'd really like to learn things, not just load another app.

So how exactly do the Tools work? Do they need to have another process just to listen for a keycode and translate it to an intent?
 
GabrialDestruir
Old
#4  
Senior Member
Thanks Meter 497
Posts: 610
Join Date: Nov 2009
Location: California
Quote:
Originally Posted by Renate NST View Post
Well, I'd really like to learn things, not just load another app.

So how exactly do the Tools work? Do they need to have another process just to listen for a keycode and translate it to an intent?
It uses modification of various .jar files

Quote:
Originally Posted by XorZone View Post
* Patched android.policy.jar:
*** Injected home button code from AOSP, with configuration check between goto home and b&n quicknav toggle
*** Fixed recent apps dialog with configuration check to launch recent apps dialog or configured app launch
* Patched services.jar
*** "Reading now" button check for configured launch value (possible values: Home, Back, Menu, Search, Long Search, Custom App, B&N default)
*** All quicknav buttons configurable and will load icons (once, onCreate) possible values same as above.
* ActivityPicker - B&N removed default activity (usually in Settings.apk) to serve ACTION_PICK_ACTIVITY requests, so I added it back to the app and now able to add shortcuts/edit doc shortcuts in Launcher Pro...
* Configuration - All above configurable values stored in Settings.System so both system jars and Conf app can access it.
* Clear dalvik-cache button
Nexus 4 - Paranoid Android
Nexus 7 - Paranoid Android
Nook Glow - Stock
__________________
Support my Gadget Fund - Donate with bitcoin: 1PB8fhWEKRzBeeoud5gKnVqtdtEeSBdazL
TV Shows anywhere with HuluPlus - HuluPlus Referral
File storage anywhere with Dropbox - Dropbox Referral
The Following User Says Thank You to GabrialDestruir For This Useful Post: [ Click to Expand ]
 
Renate NST
Old
#5  
Renate NST's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 466
Posts: 1,214
Join Date: Feb 2012
Location: Boston
Thanks, Gabrial. I had read through this entire thread before and it had left me confused. 10 pages of talking about changing the UI and not a single screenshot? I'm still not sure how an activity picker or a recent apps dialog looks like. Heck, I'm not even sure what additional things you get in Settings. Is there even a tree list of what people should have?

Yes, I do have a penchant for doing things the hard way. I like things lean and mean. If I knew how to inject code into jars I would just have fixed android.policy.jar and left it at that. My main need was a way to globally get back to my launcher desktop without onscreen controls (like Button Savior).
 
ApokrifX
Old
#6  
Senior Member
Thanks Meter 32
Posts: 370
Join Date: May 2011
Quote:
Originally Posted by Renate NST View Post
Thanks, Gabrial. I had read through this entire thread before and it had left me confused. 10 pages of talking about changing the UI and not a single screenshot? I'm still not sure how an activity picker or a recent apps dialog looks like. Heck, I'm not even sure what additional things you get in Settings. Is there even a tree list of what people should have?

Yes, I do have a penchant for doing things the hard way. I like things lean and mean. If I knew how to inject code into jars I would just have fixed android.policy.jar and left it at that. My main need was a way to globally get back to my launcher desktop without onscreen controls (like Button Savior).
Well said
I'd try to ask Nook Color forums too...
 
Renate NST
Old
#7  
Renate NST's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 466
Posts: 1,214
Join Date: Feb 2012
Location: Boston
Well, I finally learned how to hack compiled Java code.
Now, I've got a simple press the "n" and it goes directly to your desktop.
It required just a bit of editing of android.policy.jar

Why would anyone want "QuickNav"?
It's not part of Android anywhere, it's just something B&N put in.
 
brendan10211
Old
#8  
brendan10211's Avatar
Senior Member
Thanks Meter 12
Posts: 200
Join Date: Feb 2012
Location: Cary
Sometimes I use library...
Nexus 7 32GB
Nook Simple Touch - Rooted
 
Renate NST
Old
#9  
Renate NST's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 466
Posts: 1,214
Join Date: Feb 2012
Location: Boston
Quote:
Originally Posted by brendan10211 View Post
Sometimes I use library...
You can drag the stock Library icon onto your desktop.
You can even put the stock Home or Shop there also.
 
brendan10211
Old
#10  
brendan10211's Avatar
Senior Member
Thanks Meter 12
Posts: 200
Join Date: Feb 2012
Location: Cary
I also use it to force refresh, but XorZone just made that soo
Nexus 7 32GB
Nook Simple Touch - Rooted

 
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

Preventing App Piracy: Join the Discussion

The topic of piracy is always a touchy subject, but I feel that the grass roots style of Android … more

Jolla Sailfish OS Flagship Device Makes First Appearance

Given the amount of coverage that Android receives around here, you could almost be … more

XDA University: Porting ClockworkMod Recovery to New Devices

Having a good recovery makes the process of modifying, tweaking, maintaining, … more

One Stop Guide Shop for the Newbie and Dev

It’s been well established that XDA-Developers isthedestination for resources relating to … more