FORUMS

Nexus & Cookies: A More Focused Direction?

It is that time of the year again, and we are approaching the day where Android fans all over … more

LG G4 US Carrier Release Dates

The LG G4 was announced on April 29th with its Snapdragon 808 SoC, a welcomed change from its higher-end … more

Microsoft Reaches Pre-Install Agreement With New OEMs

As of late, Microsoft has been making a subtle but widespread play into the … more

Discover XDA: Discover Greater

We’ve all been there at some point in our XDA lives; we used to spend hours browsing over the … more
Post Reply Subscribe to Thread Email Thread

"n" button hacking

25th February 2012, 01:18 AM |#1  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 860
 
More
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?
 
 
26th February 2012, 02:11 AM |#2  
Senior Member
Flag California
Thanks Meter: 515
 
More
If you use NookTouchTools this allows you to remap the buttons/quicknav etc without all the hassle.
26th February 2012, 07:30 AM |#3  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 860
 
More
Quote:
Originally Posted by GabrialDestruir

... 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?
26th February 2012, 11:06 AM |#4  
Senior Member
Flag California
Thanks Meter: 515
 
More
Quote:
Originally Posted by Renate NST

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

* 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

The Following User Says Thank You to GabrialDestruir For This Useful Post: [ View ]
26th February 2012, 02:07 PM |#5  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 860
 
More
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).
26th February 2012, 06:59 PM |#6  
Senior Member
Thanks Meter: 47
 
More
Quote:
Originally Posted by Renate NST

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...
17th April 2012, 04:14 PM |#7  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 860
 
More
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.
17th April 2012, 04:59 PM |#8  
brendan10211's Avatar
Senior Member
Flag Cary
Thanks Meter: 12
 
More
Sometimes I use library...
17th April 2012, 07:36 PM |#9  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 860
 
More
Quote:
Originally Posted by brendan10211

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.
17th April 2012, 07:47 PM |#10  
brendan10211's Avatar
Senior Member
Flag Cary
Thanks Meter: 12
 
More
I also use it to force refresh, but XorZone just made that soo
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Nook Touch General by ThreadRank