FORUMS
Remove All Ads from XDA

[HOWTO] Remap hardware button to ICS recent apps

486 posts
Thanks Meter: 2,355
 
By evilisto, Senior Member on 17th January 2012, 06:46 AM
Post Reply Email Thread
10th April 2012, 10:38 PM |#41  
Iloveyouandroid's Avatar
Member
Flag NYC
Thanks Meter: 20
 
More
Quote:
Originally Posted by MrLuje

Thanks evilisto, love this mod

Here is the smali version for 4.0.4 :

- Open com\android\internal\policy\impl\PhoneWindowManage r.smali :
- Search for .line 1730 (there should be a call to showOrHideRecentAppsDialog 3 or 4 lines below)
(If you can't find it, search for method interceptKeyBeforeDispatching and for the call to showOrHideRecentAppsDialog within it)
- Now replace this

Code:
.line 1730
const/16 v26, 0x0

move-object/from16 v0, p0

move/from16 v1, v26

invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->showOrHideRecentAppsDialog(I)V

.line 1732
:cond_1b5
By this

Code:
.line 1730
if-nez v14, :cond_1b5

:try_start_3d
move-object/from16 v0, p0
iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mStatusBarService:Lcom/android/internal/statusbar/IStatusBarService;
invoke-interface {v1}, Lcom/android/internal/statusbar/IStatusBarService;->toggleRecentApps()V
:try_end_41
.catch Landroid/os/RemoteException; {:try_start_3d .. :try_end_41} :catch_42

# No error, keep going
goto :cond_1b5

:catch_42
# Fetch exception
move-exception v0

# Throws exception
const-string v1, "WindowManager"
const-string v2, "RemoteException when showing recent apps"
invoke-static {v1, v2, v0}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

.line 1732
:cond_1b5

Smart!
 
 
12th April 2012, 10:32 PM |#42  
Member
Thanks Meter: 0
 
More
Is there any way to have the menu button open the recent apps and not the search button? Im running CM9 on my xperia arc and want to remap the menu key to bring up recent apps. any possibility of this happening?
14th April 2012, 12:33 AM |#43  
Member
Thanks Meter: 4
 
More
Quote:
Originally Posted by zakiay

Is there any way to have the menu button open the recent apps and not the search button? Im running CM9 on my xperia arc and want to remap the menu key to bring up recent apps. any possibility of this happening?

You shouldn't. You will lose the ability to open the menu which may be vital for some applications. Since your phone has a physical menu button, even ICS optimized apps will not show you a menu button on the action bar.
14th April 2012, 03:44 PM |#44  
Member
M√ľnster
Thanks Meter: 5
 
More
Quote:
Originally Posted by tylose

You shouldn't. You will lose the ability to open the menu which may be vital for some applications. Since your phone has a physical menu button, even ICS optimized apps will not show you a menu button on the action bar.


Hi!

If you enable the on screen buttons, ics optimized apps will show the "3 dots menu" somewhere in the app. eg the sms/mms app will show it on top, next tpo the phone symbol.

So in important apps you will see a menu....

btw the htc one x has the same keylayout and it works there

greetings matto
15th April 2012, 12:33 AM |#45  
Member
Thanks Meter: 0
 
More
thats correct, ics should give you the 3 dots menu button somewhere on the screen, long pressing the home button and waiting is such a drag. So is there some way to enable in on the xperia arc or is it the same as the process on the first page?
18th April 2012, 06:10 AM |#46  
BoyBawang2's Avatar
Senior Member
Thanks Meter: 21
 
More
If the app is not ICS optimized, the 3 dots should appear along with the recent apps when the key is tapped. That may be an extra step to access the menu but that will slowly change as developers update their apps. I wish the keys can pe MODDED that way.
18th April 2012, 06:42 AM |#47  
Adi_Pat's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 3,585
 
Donate to Me
More
Is there any way to get 'Recent Apps' on GB ?
Either in status bar or with the help of a softkey?
25th April 2012, 12:31 PM |#48  
janeindiran's Avatar
Senior Member
Flag Coimbatore
Thanks Meter: 750
 
More
I am on DEFY CM9, i want to use menu key to launch app drawer. Is it possible??
29th April 2012, 05:17 PM |#49  
Senior Member
Thanks Meter: 88
 
More
can i implement this on the Galaxy S CM9 ?

since the google search menu is done using the long pressed of the menu.

Left soft key. i know this feature is accesible by the long pressed home button.

i figure easier to do it with soft key rather than hw key.

8th May 2012, 06:01 PM |#50  
Member
Thanks Meter: 68
 
More
Thanks for this guide, I've mapped the app switcher to the menu button on my Galaxy S2 with CM9. However, just editing the keylayout file(s) didn't actually make ICS optimised apps display the overflow menu button within their UI. To force them to do that I made a change in:
/frameworks/base/core/java/android/view/ViewConfiguration.java
From:
Code:
         if (!sHasPermanentMenuKeySet) {
             IWindowManager wm = Display.getWindowManager();
             try {
                 sHasPermanentMenuKey = wm.canStatusBarHide() && !wm.hasNavigationBar();
                 sHasPermanentMenuKeySet = true;
             } catch (RemoteException ex) {
                 sHasPermanentMenuKey = false;
             }
         }
To:
Code:
         if (!sHasPermanentMenuKeySet) {
             sHasPermanentMenuKey = false;
             sHasPermanentMenuKeySet = true;
         }
I would like to also make long-pressing the home button show the menu (for compatibility with non-ICS optimised apps), but I'm not sure how to do that.
The Following User Says Thank You to Doopliss For This Useful Post: [ View ] Gift Doopliss Ad-Free
15th May 2012, 04:42 AM |#51  
Senior Member
Thanks Meter: 42
 
More
Talking
Quote:
Originally Posted by Doopliss

Thanks for this guide, I've mapped the app switcher to the menu button on my Galaxy S2 with CM9. However, just editing the keylayout file(s) didn't actually make ICS optimised apps display the overflow menu button within their UI. To force them to do that I made a change in:
/frameworks/base/core/java/android/view/ViewConfiguration.java
From:

Code:
         if (!sHasPermanentMenuKeySet) {
             IWindowManager wm = Display.getWindowManager();
             try {
                 sHasPermanentMenuKey = wm.canStatusBarHide() && !wm.hasNavigationBar();
                 sHasPermanentMenuKeySet = true;
             } catch (RemoteException ex) {
                 sHasPermanentMenuKey = false;
             }
         }
To:
Code:
         if (!sHasPermanentMenuKeySet) {
             sHasPermanentMenuKey = false;
             sHasPermanentMenuKeySet = true;
         }
I would like to also make long-pressing the home button show the menu (for compatibility with non-ICS optimised apps), but I'm not sure how to do that.

would you like provide a guide for smali
Post Reply Subscribe to Thread

Tags
ics button recent multitask swicher

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes