Back button dismisses notifications again.

Bug: 6441337
Change-Id: Iabc97cd2a3f66ee2af5406807b3023908965b8c8
This commit is contained in:
Daniel Sandler
2012-05-04 11:55:46 -04:00
parent 5380cdc2e1
commit c4f2a5652d
5 changed files with 61 additions and 6 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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);

View File

@ -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;

View File

@ -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);
}
}