diff options
author | Michael Jurka <mikejurka@google.com> | 2012-03-27 07:49:52 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2012-03-29 06:28:42 -0700 |
commit | 7f2668c8469934ce83a5647977f6e74ab782cf07 (patch) | |
tree | 5333c585593c89592aa0fbc48b9adeb8c72883ae /policy | |
parent | f9c1f9935b349fe1a3f27be4462026dd212f8b78 (diff) | |
download | frameworks_base-7f2668c8469934ce83a5647977f6e74ab782cf07.zip frameworks_base-7f2668c8469934ce83a5647977f6e74ab782cf07.tar.gz frameworks_base-7f2668c8469934ce83a5647977f6e74ab782cf07.tar.bz2 |
Preload recents on phones with hard nav keys
Also refactor recents code across Phone/Tablet
Change-Id: Id557c5cb0f7d9378f81c40b20511a5d98bf4078e
Diffstat (limited to 'policy')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index b5dace0..5a11145 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -428,6 +428,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mHideLockScreen; boolean mDismissKeyguard; boolean mHomePressed; + boolean mHomeLongPressed; Intent mHomeIntent; Intent mCarDockIntent; Intent mDeskDockIntent; @@ -725,7 +726,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Eat the longpress so it won't dismiss the recent apps dialog when // the user lets go of the home key - mHomePressed = false; + mHomeLongPressed = true; } if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_DIALOG) { @@ -1601,33 +1602,45 @@ public class PhoneWindowManager implements WindowManagerPolicy { // it handle it, because that gives us the correct 5 second // timeout. if (keyCode == KeyEvent.KEYCODE_HOME) { + // If we have released the home key, and didn't do anything else // while it was pressed, then it is time to go home! - if (mHomePressed && !down) { + if (!down) { + final boolean homeWasLongPressed = mHomeLongPressed; mHomePressed = false; - if (!canceled) { - // If an incoming call is ringing, HOME is totally disabled. - // (The user is already on the InCallScreen at this point, - // and his ONLY options are to answer or reject the call.) - boolean incomingRinging = false; + mHomeLongPressed = false; + if (!homeWasLongPressed) { try { - ITelephony telephonyService = getTelephonyService(); - if (telephonyService != null) { - incomingRinging = telephonyService.isRinging(); - } - } catch (RemoteException ex) { - Log.w(TAG, "RemoteException from getPhoneInterface()", ex); + mStatusBarService.cancelPreloadRecentApps(); + } catch (RemoteException e) { + Slog.e(TAG, "RemoteException when showing recent apps", e); } - if (incomingRinging) { - Log.i(TAG, "Ignoring HOME; there's a ringing incoming call."); + mHomePressed = false; + if (!canceled) { + // If an incoming call is ringing, HOME is totally disabled. + // (The user is already on the InCallScreen at this point, + // and his ONLY options are to answer or reject the call.) + boolean incomingRinging = false; + try { + ITelephony telephonyService = getTelephonyService(); + if (telephonyService != null) { + incomingRinging = telephonyService.isRinging(); + } + } catch (RemoteException ex) { + Log.w(TAG, "RemoteException from getPhoneInterface()", ex); + } + + if (incomingRinging) { + Log.i(TAG, "Ignoring HOME; there's a ringing incoming call."); + } else { + launchHomeFromHotKey(); + } } else { - launchHomeFromHotKey(); + Log.i(TAG, "Ignoring HOME; event canceled."); } - } else { - Log.i(TAG, "Ignoring HOME; event canceled."); + return -1; } - return -1; } // If a system window has focus, then it doesn't make sense @@ -1648,8 +1661,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } - if (down) { + if (!mHomePressed) { + try { + mStatusBarService.preloadRecentApps(); + } catch (RemoteException e) { + Slog.e(TAG, "RemoteException when preloading recent apps", e); + } + } if (repeatCount == 0) { mHomePressed = true; } else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) { |