Thumbs up [HOWTO] Remap hardware button to ICS recent apps

[HOWTO] Remap hardware button to ICS recent apps


this is simple howto about this mod.. : [MOD] Search key to ICS recent apps


1) change source code related to APP_SWITCH keycode.

platform/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

from :
Code:
} else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
if (down && repeatCount == 0) {
showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SH OW_OR_DISMISS);
}
return -1;
}

to :
Code:
} else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
if (down && repeatCount == 0 && !keyguardOn) {
try {
mStatusBarService.toggleRecentApps();
} catch (RemoteException e) {
Slog.e(TAG, "RemoteException when showing recent apps", e);
}
}
return -1;
}

2) edit your keylayout files..

/system/usr/keylayout/

for example, if you want to use search key to recent apps on nexus s...

cypress-touchkey.kl
Code:
key 139 MENU VIRTUAL
key 102 HOME VIRTUAL
key 158 BACK VIRTUAL
key 217 APP_SWITCH VIRTUAL
and mxt224_ts_input.kl (it would be better to edit both files..)
Code:
key 158 BACK WAKE
key 139 MENU WAKE
key 217 APP_SWITCH WAKE
key 102 HOME WAKE

3) done

---------------------------------------------------------------------------------------------------

- and if you cannot compile android.policy.jar for some reason, try with my files instead.
you can find my files in these thread :
[MOD] Search key to ICS recent apps
[MOD] Add ICS 'Recent Apps' button to Status bar
and be careful. you should use suitable version to your rom. so if your cm9 rom was built few weeks ago, do not try with latest version of my mod.



Thanks To - evilisto