summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-07-30 16:13:46 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2012-08-02 13:44:30 -0700
commit73b9c29b8b856d15e8798a876a85766c263f01f2 (patch)
treebd6dd7e525dfe23b8076c117350e3b2d2e6bcc12 /packages
parenta39fdd11e80618acc046fff65b6549b5c8b5aa8d (diff)
downloadframeworks_base-73b9c29b8b856d15e8798a876a85766c263f01f2.zip
frameworks_base-73b9c29b8b856d15e8798a876a85766c263f01f2.tar.gz
frameworks_base-73b9c29b8b856d15e8798a876a85766c263f01f2.tar.bz2
Notification panel on tablet does not handle back and home key events.
1. Notification panel on tablet does not handle back and home key events and as a result the notification panel stays open. Hence, after opening the notifications panel, pressing the back key on a keyboard will move back in the app instead closing the panel. Same happens for the home key. The expected behavior is if the panel is open the back button will dismiss it and the key should be consumed by the panel. The home key should hide the panel and the key should not be consumed by the panel so the system can do the right thing. bug:6902903 Change-Id: I06e8ceea1f51b998e6703d70dcb3a24128d5a581
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index fdbfb65..c1ea50d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -25,6 +25,7 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Gravity;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -34,7 +35,6 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.RelativeLayout;
-import android.widget.ScrollView;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
@@ -197,6 +197,27 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
return true;
}
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ final int keyCode = event.getKeyCode();
+ switch (keyCode) {
+ // We exclusively handle the back key by hiding this panel.
+ case KeyEvent.KEYCODE_BACK: {
+ if (event.getAction() == KeyEvent.ACTION_UP) {
+ mBar.animateCollapse();
+ }
+ return true;
+ }
+ // We react to the home key but let the system handle it.
+ case KeyEvent.KEYCODE_HOME: {
+ if (event.getAction() == KeyEvent.ACTION_UP) {
+ mBar.animateCollapse();
+ }
+ } break;
+ }
+ return super.dispatchKeyEvent(event);
+ }
+
/*
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {