summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2011-02-23 18:35:01 -0800
committerPatrick Dubroy <dubroy@google.com>2011-02-24 10:03:23 -0800
commitece945291e04ea8493895349ed95a2ab46b51c93 (patch)
tree9d5c498ec1530514bfa046f7b2c8097cc848c005 /policy
parent7b76c8d3fc25aedea6edfed9638b008faa2f6ae8 (diff)
downloadframeworks_base-ece945291e04ea8493895349ed95a2ab46b51c93.zip
frameworks_base-ece945291e04ea8493895349ed95a2ab46b51c93.tar.gz
frameworks_base-ece945291e04ea8493895349ed95a2ab46b51c93.tar.bz2
Fix 3272590: Long-press on home & menu should be same as click
Change-Id: I151571900f4bb63910ccfb77fc64c8be9676a224
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java15
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java34
2 files changed, 18 insertions, 31 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 79b5ced..b746c37 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -143,7 +143,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* this is 0, there is no key held down.
*/
private int mPanelChordingKey;
- private boolean mPanelMayLongPress;
private ImageView mLeftIconView;
@@ -658,22 +657,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (event.getRepeatCount() == 0) {
// The panel key was pushed, so set the chording key
mPanelChordingKey = keyCode;
- mPanelMayLongPress = false;
PanelFeatureState st = getPanelState(featureId, true);
if (!st.isOpen) {
- if (getContext().getResources().getConfiguration().keyboard
- == Configuration.KEYBOARD_NOKEYS) {
- mPanelMayLongPress = true;
- }
return preparePanel(st, event);
}
- } else if (mPanelMayLongPress && mPanelChordingKey == keyCode
- && (event.getFlags()&KeyEvent.FLAG_LONG_PRESS) != 0) {
- // We have had a long press while in a state where this
- // should be executed... do it!
- mPanelChordingKey = 0;
- mPanelMayLongPress = false;
}
return false;
@@ -688,7 +676,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// The panel key was released, so clear the chording key
if (mPanelChordingKey != 0) {
mPanelChordingKey = 0;
- mPanelMayLongPress = false;
if (event.isCanceled()) {
return;
@@ -2140,8 +2127,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
- mPanelMayLongPress = false;
-
// If the user is chording a menu shortcut, release the chord since
// this window lost focus
if (!hasWindowFocus && mPanelChordingKey != 0) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index f6649fd..f5f4c6e 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -601,19 +601,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
*/
Runnable mHomeLongPress = new Runnable() {
public void run() {
- /*
- * Eat the longpress so it won't dismiss the recent apps dialog when
- * the user lets go of the home key
- */
- mHomePressed = false;
- showRecentAppsDialog();
+ handleLongPressOnHome();
}
};
- /**
- * Create (if necessary) and launch the recent apps dialog
- */
- void showRecentAppsDialog() {
+ private void handleLongPressOnHome() {
// We can't initialize this in init() since the configuration hasn't been loaded yet.
if (mLongPressOnHomeBehavior < 0) {
mLongPressOnHomeBehavior
@@ -627,14 +619,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mLongPressOnHomeBehavior != LONG_PRESS_HOME_NOTHING) {
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
+
+ // Eat the longpress so it won't dismiss the recent apps dialog when
+ // the user lets go of the home key
+ mHomePressed = false;
}
-
+
if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_DIALOG) {
- // Fallback to dialog if we fail to launch the above.
- if (mRecentAppsDialog == null) {
- mRecentAppsDialog = new RecentApplicationsDialog(mContext);
- }
- mRecentAppsDialog.show();
+ showRecentAppsDialog();
} else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_ACTIVITY) {
try {
Intent intent = new Intent();
@@ -649,6 +641,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
}
+
+ /**
+ * Create (if necessary) and launch the recent apps dialog
+ */
+ void showRecentAppsDialog() {
+ if (mRecentAppsDialog == null) {
+ mRecentAppsDialog = new RecentApplicationsDialog(mContext);
+ }
+ mRecentAppsDialog.show();
+ }
/** {@inheritDoc} */
public void init(Context context, IWindowManager windowManager,