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

Commit cf336e10 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Forcibly recalculate size of the notification expanded view.

This helps avoid a race condition that can sometimes leave
the status bar handle untouchable (read: hiding behind the
expanded view's transparent window, which is too large
because the close handle's height has not yet been
calculated) on first boot.

Bug: 5122306
Change-Id: I5fa2595798a66289c2c33d7c78dd16f9db066ede
parent d309056d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -103,9 +103,9 @@
                <TextView android:id="@+id/noNotificationsTitle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/title_bar_portrait"
                    android:paddingLeft="5dp"
                    android:textAppearance="@style/TextAppearance.StatusBar.Title"
                    android:textAppearance="@android:style/TextAppearance.Large"
                    android:padding="8dp"
                    android:gravity="center"
                    android:text="@string/status_bar_no_notifications_title"
                    />

+5 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Slog;
import android.widget.LinearLayout;

public class ExpandedView extends LinearLayout {
@@ -44,8 +45,10 @@ public class ExpandedView extends LinearLayout {
         super.onLayout(changed, left, top, right, bottom);
         int height = bottom - top;
         if (height != mPrevHeight) {
             //Slog.d(StatusBar.TAG, "height changed old=" + mPrevHeight
             //     + " new=" + height);
             if (PhoneStatusBar.DEBUG) {
                 Slog.d(PhoneStatusBar.TAG, "ExpandedView height changed old=" + mPrevHeight
                      + " new=" + height);
             }
             mPrevHeight = height;
             mService.updateExpandedViewPos(PhoneStatusBar.EXPANDED_LEAVE_ALONE);
         }
+29 −1
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ public class PhoneStatusBar extends StatusBar {

        ExpandedView expanded = (ExpandedView)View.inflate(context,
                R.layout.status_bar_expanded, null);
        if (DEBUG) {
            expanded.setBackgroundColor(0x6000FF80);
        }
        expanded.mService = this;

        mIntruderAlertView = View.inflate(context, R.layout.intruder_alert, null);
@@ -1267,6 +1270,10 @@ public class PhoneStatusBar extends StatusBar {
            Slog.d(TAG, "panel: beginning to track the user's touch, y=" + y + " opening=" + opening);
        }

        // there are some race conditions that cause this to be inaccurate; let's recalculate it any
        // time we're about to drag the panel
        updateExpandedSize();

        mTracking = true;
        mVelocityTracker = VelocityTracker.obtain();
        if (opening) {
@@ -1780,7 +1787,7 @@ public class PhoneStatusBar extends StatusBar {
    void updateExpandedViewPos(int expandedPosition) {
        if (SPEW) {
            Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
                    + " mTrackingParams.y=" + mTrackingParams.y
                    + " mTrackingParams.y=" + ((mTrackingParams == null) ? "?" : mTrackingParams.y)
                    + " mTrackingPosition=" + mTrackingPosition);
        }

@@ -1824,6 +1831,16 @@ public class PhoneStatusBar extends StatusBar {

                mExpandedParams.y = pos + mTrackingView.getHeight()
                        - (mTrackingParams.height-closePos) - contentsBottom;

                if (SPEW) {
                    Slog.d(PhoneStatusBar.TAG, 
                            "pos=" + pos +
                            " trackingHeight=" + mTrackingView.getHeight() +
                            " (trackingParams.height - closePos)=" + 
                                (mTrackingParams.height - closePos) +
                            " contentsBottom=" + contentsBottom);
                }

            } else {
                // If the tracking view is not yet visible, then we can't have
                // a good value of the close view location.  We need to wait for
@@ -1866,6 +1883,10 @@ public class PhoneStatusBar extends StatusBar {
    }

    int getExpandedHeight(int disph) {
        if (DEBUG) {
            Slog.d(TAG, "getExpandedHeight(" + disph + "): sbView="
                    + mStatusBarView.getHeight() + " closeView=" + mCloseView.getHeight());
        }
        return disph - mStatusBarView.getHeight() - mCloseView.getHeight();
    }

@@ -1875,6 +1896,9 @@ public class PhoneStatusBar extends StatusBar {
    }

    void updateExpandedSize() {
        if (DEBUG) {
            Slog.d(TAG, "updateExpandedSize()");
        }
        if (mExpandedDialog != null && mExpandedParams != null && mDisplaySize != null) {
            mExpandedParams.width = mDisplaySize.x;
            mExpandedParams.height = getExpandedHeight(mDisplaySize.y);
@@ -1883,6 +1907,10 @@ public class PhoneStatusBar extends StatusBar {
            } else {
                mExpandedDialog.getWindow().setAttributes(mExpandedParams);
            }
            if (DEBUG) {
                Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + 
                    (mExpandedVisible ? "VISIBLE":"INVISIBLE"));
            }
        }
    }