diff options
author | Phil Tunstall <ptunstall@gmail.com> | 2012-05-16 01:33:55 +0100 |
---|---|---|
committer | Phil Tunstall <ptunstall@gmail.com> | 2012-05-24 14:57:28 +0100 |
commit | 76d2ceabb551830e0c81349309e1de03b7ec7bb9 (patch) | |
tree | 9f5c280710043edd1834dc1f60c0a212d2b4154e /policy | |
parent | f305d1a2b3d130e10886f49b24e9da4464fe5ba0 (diff) | |
download | frameworks_base-76d2ceabb551830e0c81349309e1de03b7ec7bb9.zip frameworks_base-76d2ceabb551830e0c81349309e1de03b7ec7bb9.tar.gz frameworks_base-76d2ceabb551830e0c81349309e1de03b7ec7bb9.tar.bz2 |
Change APP_SWITCH key event to open Android 4.0 recent apps switcher
Without this patch it opens the old Gingerbread-style recent apps.
Thanks to XDA forum member evilisto for demonstrating how to make this change:
http://forum.xda-developers.com/showthread.php?t=1450138
Patch Set 2: Fixed commit dependencies
Patch Set 3: Open app switcher when key is released rather than when it is
first pressed, to conform with the behaviour of other keys.
Change-Id: Iea04c3015b773b5f375a01a9ee30c5130de13dff
Diffstat (limited to 'policy')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index ff7ccf6..61c6fce 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -434,6 +434,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mHideLockScreen; boolean mDismissKeyguard; boolean mHomePressed; + boolean mAppSwitchPressed; Intent mHomeIntent; Intent mCarDockIntent; Intent mDeskDockIntent; @@ -1760,8 +1761,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return 0; } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) { + if (mAppSwitchPressed && !down) { + mAppSwitchPressed = false; + if (!canceled && !keyguardOn) { + sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS); + try { + mStatusBarService.toggleRecentApps(); + } catch (RemoteException e) { + } + } + return -1; + } + if (down && repeatCount == 0) { - showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS); + mAppSwitchPressed = true; } return -1; } else if (keyCode == KeyEvent.KEYCODE_BACK) { |