Skip to content

Commit e1c4732

Browse files
sganovAndroid Git Automerger
authored andcommitted
am 9a59f6e: Merge "Notification panel on tablet does not handle back and home key events." into jb-dev
* commit '9a59f6e02fdcabbf2debd5b836b01f7b22a4b21a': Notification panel on tablet does not handle back and home key events.
2 parents 265eea8 + 9a59f6e commit e1c4732

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.util.AttributeSet;
2626
import android.util.Slog;
2727
import android.view.Gravity;
28+
import android.view.KeyEvent;
2829
import android.view.LayoutInflater;
2930
import android.view.MotionEvent;
3031
import android.view.View;
@@ -34,7 +35,6 @@
3435
import android.view.animation.DecelerateInterpolator;
3536
import android.view.animation.Interpolator;
3637
import android.widget.RelativeLayout;
37-
import android.widget.ScrollView;
3838

3939
import com.android.systemui.ExpandHelper;
4040
import com.android.systemui.R;
@@ -197,6 +197,27 @@ public boolean dispatchHoverEvent(MotionEvent event) {
197197
return true;
198198
}
199199

200+
@Override
201+
public boolean dispatchKeyEvent(KeyEvent event) {
202+
final int keyCode = event.getKeyCode();
203+
switch (keyCode) {
204+
// We exclusively handle the back key by hiding this panel.
205+
case KeyEvent.KEYCODE_BACK: {
206+
if (event.getAction() == KeyEvent.ACTION_UP) {
207+
mBar.animateCollapse();
208+
}
209+
return true;
210+
}
211+
// We react to the home key but let the system handle it.
212+
case KeyEvent.KEYCODE_HOME: {
213+
if (event.getAction() == KeyEvent.ACTION_UP) {
214+
mBar.animateCollapse();
215+
}
216+
} break;
217+
}
218+
return super.dispatchKeyEvent(event);
219+
}
220+
200221
/*
201222
@Override
202223
protected void onLayout(boolean changed, int l, int t, int r, int b) {

0 commit comments

Comments
 (0)