Skip to content

Commit 790ec8d

Browse files
kufikugelcodex-corp
authored andcommitted
Slim Heads up: change behaviour of back key
Currently back key hides the heads up. We change it that the back key is still working for the app which has focus and not for the heads up at all. Reasons: 1. A lot user requested this due that they often hide the heads up during they work on the phone, simply due that the back button is often pressed on a normal workflow. The results is indeed that a lot heads up windows are missed excidentaly. 2. First I thought to make it optional. But there is another big reason to do it this way. Current behaviour is that the heads up view gets focus...and that we dispatch the back key only. Thing is that other key events are still rooted to the heads up window. Well most things a user will not see. But eg on apps with input field some keys on the IME keyboard do not work during the heads up is showing which is a big no go when we assume that heads up needs to be as much non intrusive as possible. That being said we remove the dispatch override and give the heads up window FLAG_NOT_FOCUSABLE flag which will bypass any key events to the window behind which had focus before the heads up showed up. FLAG_NOT_TOUCH_MODAL we can remove due that FLAG_NOT_FOCUSABLE automatically enables the FLAG_NOT_TOUCH_MODAL flag. Change-Id: Ied4c7d2dd5b99f89af958f01db980a36d431bbc3
1 parent f7f1d32 commit 790ec8d

2 files changed

Lines changed: 1 addition & 15 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ private void addHeadsUpView() {
15971597
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
15981598
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
15991599
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, // above the status bar!
1600-
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
1600+
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
16011601
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
16021602
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
16031603
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,

packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import android.graphics.Rect;
2323
import android.util.AttributeSet;
2424
import android.util.Log;
25-
import android.view.KeyEvent;
2625
import android.view.MotionEvent;
2726
import android.view.View;
2827
import android.view.ViewConfiguration;
@@ -174,19 +173,6 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
174173
|| super.onInterceptTouchEvent(ev);
175174
}
176175

177-
@Override
178-
public boolean dispatchKeyEvent(KeyEvent event) {
179-
boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
180-
switch (event.getKeyCode()) {
181-
case KeyEvent.KEYCODE_BACK:
182-
if (!down) {
183-
mBar.hideHeadsUp();
184-
}
185-
return true;
186-
}
187-
return super.dispatchKeyEvent(event);
188-
}
189-
190176
// View methods
191177

192178
@Override

0 commit comments

Comments
 (0)