Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e825b3e3 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Back button dismisses notifications again." into jb-dev

parents 0008f736 c4f2a565
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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>
+2 −2
Original line number Diff line number Diff line
@@ -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>
+7 −2
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class PhoneStatusBar extends BaseStatusBar {

    IWindowManager mWindowManager;

    View mStatusBarWindow;
    StatusBarWindowView mStatusBarWindow;
    PhoneStatusBarView mStatusBarView;

    int mPixelFormat;
@@ -280,11 +280,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) {
@@ -1141,10 +1142,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);
    }

@@ -1231,6 +1235,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);

+1 −0
Original line number Diff line number Diff line
@@ -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;
+47 −0
Original line number Diff line number Diff line
/*
 * 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);
    }
}