FORUMS

Galaxy S6 & Edge get €100 Price Cut—New Models Incoming

Samsung has dropped the price of both the Galaxy S6 and S6 Edge by … more

How To Port Fully Featured Sony Xperia Z4 Camera

Xperia Z4’s hardware may not impress, but its software is definitely … more

Experimental TWRP Available For Moto G 2015

XDA Senior Member squid2 has posted experimental builds of TWRP for the Moto G … more

Sunday Debate: How Can We Get a No-Compromise Phone?

Join us in a fun Sunday Debate on Compromises. Come with your opinions and … more

"n" button hacking

2,051 posts
Thanks Meter: 874
 
By Renate NST, Recognized Contributor / Recognized Developer on 25th February 2012, 01:18 AM
Post Reply Subscribe to Thread Email Thread
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: 874
 
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: 874
 
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: 874
 
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: 874
 
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
19th April 2012, 09:16 AM |#11  
Junior Member
Flag Bucharest
Thanks Meter: 5
 
More
Quote:
Originally Posted by Renate NST

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.

Hi,

I, same as you, like to modify my Nook as little as possible. In case of a future software upgrade, I would like to know what to change back before applying it.

Of course, I know I can just save the partitions (internal disk) and restore it as needed, but I would like to not need to do this.

Right now, I modified the gpio file for Search and created my own Launcher (base on Home Sample code in Android SDK).

Still, I don't like the need for Long Press on Search.

Could you please post the links which shows how to hack the android.policy.jar?
Maybe, if I don't ask too much, your edits to it?

Thanks!

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes