Official TWRP Recovery Lands on Micromax Canvas Magnus

With the recent release of Android One, Micromax and MediaTek released fully buildable … more

Update Overload: SuperSU Heavily Updated

There are apps and apps out there. Very few can reach the level of popularity required to stay at … more

Lollipop Leak Available for the Sprint Galaxy S5

Since the Android 5.0Lollipop’s official release not too long ago, we’ve seen … more

CPU Spy Gets an Android Lollipop Makeover

At some point in the distant past, you probably heard of CPU Spy for Android by XDARetired … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

"n" button hacking

OP Renate NST

25th February 2012, 02:18 AM   |  #1  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 814
 
1,999 posts
Join Date:Joined: Feb 2012
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, 03:11 AM   |  #2  
Senior Member
Flag California
Thanks Meter: 512
 
643 posts
Join Date:Joined: Nov 2009
More
If you use NookTouchTools this allows you to remap the buttons/quicknav etc without all the hassle.
26th February 2012, 08:30 AM   |  #3  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 814
 
1,999 posts
Join Date:Joined: Feb 2012
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, 12:06 PM   |  #4  
Senior Member
Flag California
Thanks Meter: 512
 
643 posts
Join Date:Joined: Nov 2009
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, 03:07 PM   |  #5  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 814
 
1,999 posts
Join Date:Joined: Feb 2012
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, 07:59 PM   |  #6  
Senior Member
Thanks Meter: 47
 
419 posts
Join Date:Joined: May 2011
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, 05:14 PM   |  #7  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 814
 
1,999 posts
Join Date:Joined: Feb 2012
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, 05:59 PM   |  #8  
brendan10211's Avatar
Senior Member
Flag Cary
Thanks Meter: 12
 
200 posts
Join Date:Joined: Feb 2012
More
Sometimes I use library...
17th April 2012, 08:36 PM   |  #9  
Renate NST's Avatar
OP Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 814
 
1,999 posts
Join Date:Joined: Feb 2012
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, 08:47 PM   |  #10  
brendan10211's Avatar
Senior Member
Flag Cary
Thanks Meter: 12
 
200 posts
Join Date:Joined: Feb 2012
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