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

Commit dd8877bc authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Tear down bars on destroy() and avoid null pointers."

parents 3242f4fb ab847cf1
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -1432,6 +1432,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
    }
    }


    private void releaseFocus() {
    private void releaseFocus() {
        if (mStatusBarWindow == null) return;
        WindowManager.LayoutParams lp =
        WindowManager.LayoutParams lp =
                (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
                (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
        lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
        lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
@@ -1463,9 +1464,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
            mHandler.sendEmptyMessage(MSG_CLOSE_SEARCH_PANEL);
            mHandler.sendEmptyMessage(MSG_CLOSE_SEARCH_PANEL);
        }
        }


        if (mStatusBarWindow != null) {
            mStatusBarWindow.cancelExpandHelper();
            mStatusBarWindow.cancelExpandHelper();
            mStatusBarView.collapseAllPanels(true);
            mStatusBarView.collapseAllPanels(true);
        }
        }
    }


    public ViewPropertyAnimator setVisibilityWhenDone(
    public ViewPropertyAnimator setVisibilityWhenDone(
            final ViewPropertyAnimator a, final View v, final int vis) {
            final ViewPropertyAnimator a, final View v, final int vis) {
@@ -1673,7 +1676,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        if (SPEW) Log.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible
        if (SPEW) Log.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible
                + " mExpandedVisible=" + mExpandedVisible);
                + " mExpandedVisible=" + mExpandedVisible);


        if (!mExpandedVisible) {
        if (!mExpandedVisible || mStatusBarWindow == null) {
            return;
            return;
        }
        }


@@ -2076,7 +2079,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        // until status bar window is attached to the window manager,
        // until status bar window is attached to the window manager,
        // because...  well, what's the point otherwise?  And trying to
        // because...  well, what's the point otherwise?  And trying to
        // run a ticker without being attached will crash!
        // run a ticker without being attached will crash!
        if (n.getNotification().tickerText != null && mStatusBarWindow.getWindowToken() != null) {
        if (n.getNotification().tickerText != null && mStatusBarWindow != null
                && mStatusBarWindow.getWindowToken() != null) {
            if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
            if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
                            | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
                            | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
                mTicker.addEntry(n);
                mTicker.addEntry(n);
@@ -2726,9 +2730,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        super.destroy();
        super.destroy();
        if (mStatusBarWindow != null) {
        if (mStatusBarWindow != null) {
            mWindowManager.removeViewImmediate(mStatusBarWindow);
            mWindowManager.removeViewImmediate(mStatusBarWindow);
            mStatusBarWindow = null;
        }
        }
        if (mNavigationBarView != null) {
        if (mNavigationBarView != null) {
            mWindowManager.removeViewImmediate(mNavigationBarView);
            mWindowManager.removeViewImmediate(mNavigationBarView);
            mNavigationBarView = null;
        }
        }
        mContext.unregisterReceiver(mBroadcastReceiver);
        mContext.unregisterReceiver(mBroadcastReceiver);
    }
    }
+3 −2
Original line number Original line Diff line number Diff line
@@ -170,7 +170,7 @@ public class PhoneStatusBarView extends PanelBar {
        mBar.makeExpandedInvisibleSoon();
        mBar.makeExpandedInvisibleSoon();
        mFadingPanel = null;
        mFadingPanel = null;
        mLastFullyOpenedPanel = null;
        mLastFullyOpenedPanel = null;
        if (mScrimColor != 0 && ActivityManager.isHighEndGfx()) {
        if (mScrimColor != 0 && ActivityManager.isHighEndGfx() && mBar.mStatusBarWindow != null) {
            mBar.mStatusBarWindow.setBackgroundColor(0);
            mBar.mStatusBarWindow.setBackgroundColor(0);
        }
        }
    }
    }
@@ -214,7 +214,8 @@ public class PhoneStatusBarView extends PanelBar {
            Log.v(TAG, "panelExpansionChanged: f=" + frac);
            Log.v(TAG, "panelExpansionChanged: f=" + frac);
        }
        }


        if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()) {
        if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()
                && mBar.mStatusBarWindow != null) {
            if (mShouldFade) {
            if (mShouldFade) {
                frac = mPanelExpandedFractionSum; // don't judge me
                frac = mPanelExpandedFractionSum; // don't judge me
                // let's start this 20% of the way down the screen
                // let's start this 20% of the way down the screen