summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-05-04 11:55:46 -0400
committerDaniel Sandler <dsandler@android.com>2012-05-04 11:58:01 -0400
commitc4f2a5652dd42fdb43a94e341b7a2034b0211a21 (patch)
tree191d967ed3758537ef99326218db2178d8dc3bb6 /packages
parent5380cdc2e1adc8511b05e7623efb44d67be88418 (diff)
downloadframeworks_base-c4f2a5652dd42fdb43a94e341b7a2034b0211a21.zip
frameworks_base-c4f2a5652dd42fdb43a94e341b7a2034b0211a21.tar.gz
frameworks_base-c4f2a5652dd42fdb43a94e341b7a2034b0211a21.tar.bz2
Back button dismisses notifications again.
Bug: 6441337 Change-Id: Iabc97cd2a3f66ee2af5406807b3023908965b8c8
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout-sw600dp/super_status_bar.xml6
-rw-r--r--packages/SystemUI/res/layout/super_status_bar.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java47
5 files changed, 61 insertions, 6 deletions
diff --git a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml
index 8e86234..b9af3a9 100644
--- a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml
@@ -18,9 +18,11 @@
-->
<!-- This is the combined status bar / notification panel window. -->
-<FrameLayout
+<com.android.systemui.statusbar.phone.StatusBarWindowView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ android:focusable="true"
+ android:descendantFocusability="afterDescendants"
android:fitsSystemWindows="true"
>
@@ -35,4 +37,4 @@
android:layout_height="@*android:dimen/status_bar_height"
/>
-</FrameLayout>
+</com.android.systemui.statusbar.phone.StatusBarWindowView>
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index c094988..6c31ff4 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -18,7 +18,7 @@
-->
<!-- This is the combined status bar / notification panel window. -->
-<FrameLayout
+<com.android.systemui.statusbar.phone.StatusBarWindowView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:focusable="true"
@@ -36,4 +36,4 @@
android:layout_height="@*android:dimen/status_bar_height"
/>
-</FrameLayout>
+</com.android.systemui.statusbar.phone.StatusBarWindowView>
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 db8316f..720be9f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -148,7 +148,7 @@ public class PhoneStatusBar extends BaseStatusBar {
IWindowManager mWindowManager;
- View mStatusBarWindow;
+ StatusBarWindowView mStatusBarWindow;
PhoneStatusBarView mStatusBarView;
int mPixelFormat;
@@ -283,11 +283,12 @@ public class PhoneStatusBar extends BaseStatusBar {
mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
- mStatusBarWindow = View.inflate(context,
+ mStatusBarWindow = (StatusBarWindowView) View.inflate(context,
R.layout.super_status_bar, null);
if (DEBUG) {
mStatusBarWindow.setBackgroundColor(0x6000FF80);
}
+ mStatusBarWindow.mService = this;
mStatusBarWindow.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -1134,10 +1135,13 @@ public class PhoneStatusBar extends BaseStatusBar {
// Expand the window to encompass the full screen in anticipation of the drag.
// This is only possible to do atomically because the status bar is at the top of the screen!
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
+ lp.flags &= (~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
final WindowManager wm = WindowManagerImpl.getDefault();
wm.updateViewLayout(mStatusBarWindow, lp);
+ mStatusBarWindow.requestFocus(View.FOCUS_FORWARD);
+
visibilityChanged(true);
}
@@ -1224,6 +1228,7 @@ public class PhoneStatusBar extends BaseStatusBar {
// Shrink the window to the size of the status bar only
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
lp.height = getStatusBarHeight();
+ lp.flags |= (WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
final WindowManager wm = WindowManagerImpl.getDefault();
wm.updateViewLayout(mStatusBarWindow, lp);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 16071d4..a8f5c64 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -22,6 +22,7 @@ import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.SystemClock;
import android.util.AttributeSet;
+import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
new file mode 100644
index 0000000..0fc5b4d
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.widget.FrameLayout;
+import android.widget.TextSwitcher;
+
+
+public class StatusBarWindowView extends FrameLayout
+{
+ PhoneStatusBar mService;
+
+ public StatusBarWindowView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
+ switch (event.getKeyCode()) {
+ case KeyEvent.KEYCODE_BACK:
+ if (!down) {
+ mService.animateCollapse();
+ }
+ return true;
+ }
+ return super.dispatchKeyEvent(event);
+ }
+}
+