summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-07-25 13:03:47 -0400
committerJohn Spurlock <jspurlock@google.com>2013-07-25 14:42:48 -0400
commit9deaa286d8db51cd53118b3c14a418c512cf55db (patch)
treefedb02091a30d1aeb042fd363cf513246f4c3604
parent620e8e5917aa1e60a4ea56c9375557219e6a5edf (diff)
downloadframeworks_base-9deaa286d8db51cd53118b3c14a418c512cf55db.zip
frameworks_base-9deaa286d8db51cd53118b3c14a418c512cf55db.tar.gz
frameworks_base-9deaa286d8db51cd53118b3c14a418c512cf55db.tar.bz2
Dismiss hideybars on touch outside.
When the system bars are revealed in auto-hiding mode, the user should be able to dismiss them before the timeout by interacting with the underlying activity. Bug:8682187 Change-Id: I79169005baafda27fb5ad9c29ab1ec67600b2eb6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 04df2c2..a8cb955 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -341,7 +341,9 @@ public class PhoneStatusBar extends BaseStatusBar {
@Override
public void run() {
int requested = mSystemUiVisibility & ~STATUS_OR_NAV_OVERLAY;
- notifyUiVisibilityChanged(requested);
+ if (mSystemUiVisibility != requested) {
+ notifyUiVisibilityChanged(requested);
+ }
}};
@Override
@@ -379,6 +381,7 @@ public class PhoneStatusBar extends BaseStatusBar {
mStatusBarWindow.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
+ checkUserAutohide(v, event);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mExpandedVisible) {
animateCollapsePanels();
@@ -435,6 +438,12 @@ public class PhoneStatusBar extends BaseStatusBar {
mNavigationBarView.setDisabledFlags(mDisabled);
mNavigationBarView.setBar(this);
+ mNavigationBarView.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ checkUserAutohide(v, event);
+ return false;
+ }});
}
} catch (RemoteException ex) {
// no window manager? good luck with that
@@ -1948,6 +1957,20 @@ public class PhoneStatusBar extends BaseStatusBar {
mHandler.postDelayed(mAutohide, AUTOHIDE_TIMEOUT_MS);
}
+ private void checkUserAutohide(View v, MotionEvent event) {
+ if ((mSystemUiVisibility & STATUS_OR_NAV_OVERLAY) != 0 // an overlay bar is revealed
+ && event.getAction() == MotionEvent.ACTION_OUTSIDE // touch outside the source bar
+ && event.getX() == 0 && event.getY() == 0 // a touch outside both bars
+ ) {
+ userAutohide();
+ }
+ }
+
+ private void userAutohide() {
+ cancelAutohide();
+ mHandler.postDelayed(mAutohide, 25);
+ }
+
private void setTransparent(View view, boolean transparent) {
float alpha = transparent ? TRANSPARENT_ALPHA : 1;
if (DEBUG) Log.d(TAG, "Setting " + (view == mStatusBarView ? "status bar" :
@@ -2216,7 +2239,8 @@ public class PhoneStatusBar extends BaseStatusBar {
WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
+ | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;