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

Commit f4085829 authored by Scott Randolph's avatar Scott Randolph
Browse files

Add getNavigationBarWindow override to CarStatusBar

This fixes the CarStatusBar to work with new code in the framework which
relies on getting the status bar window.  Prior to this, the base class
function was called, but returned null since the base classes' objects
are not used by the derived class.

Test:  Run systemUi on Mojave
Bug: 62948289
Change-Id: Ic3357a7bb61f1a4f4fdfd626d91f611bcad9893e
parent 1d9ce667
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class CarStatusBar extends StatusBar implements
    private Drawable mNotificationPanelBackground;

    private ConnectedDeviceSignalController mConnectedDeviceSignalController;
    private ViewGroup mNavigationBarWindow;
    private CarNavigationBarView mNavigationBarView;

    private final Object mQueueLock = new Object();
@@ -97,6 +98,11 @@ public class CarStatusBar extends StatusBar implements
        mCarBatteryController.stopListening();
        mConnectedDeviceSignalController.stopListening();

        if (mNavigationBarWindow != null) {
            mWindowManager.removeViewImmediate(mNavigationBarWindow);
            mNavigationBarView = null;
        }

        super.destroy();
    }

@@ -153,10 +159,19 @@ public class CarStatusBar extends StatusBar implements
        // SystemUI requires that the navigation bar view have a parent. Since the regular
        // StatusBar inflates navigation_bar_window as this parent view, use the same view for the
        // CarNavigationBarView.
        ViewGroup navigationBarWindow = (ViewGroup) View.inflate(mContext,
        mNavigationBarWindow = (ViewGroup) View.inflate(mContext,
                R.layout.navigation_bar_window, null);
        View.inflate(mContext, R.layout.car_navigation_bar, navigationBarWindow);
        mNavigationBarView = (CarNavigationBarView) navigationBarWindow.getChildAt(0);
        if (mNavigationBarWindow == null) {
            Log.e(TAG, "CarStatusBar failed inflate for R.layout.navigation_bar_window");
        }


        View.inflate(mContext, R.layout.car_navigation_bar, mNavigationBarWindow);
        mNavigationBarView = (CarNavigationBarView) mNavigationBarWindow.getChildAt(0);
        if (mNavigationBarView == null) {
            Log.e(TAG, "CarStatusBar failed inflate for R.layout.car_navigation_bar");
        }


        mController = new CarNavigationBarController(mContext, mNavigationBarView,
                this /* ActivityStarter*/);
@@ -173,7 +188,7 @@ public class CarStatusBar extends StatusBar implements
        lp.setTitle("CarNavigationBar");
        lp.windowAnimations = 0;

        mWindowManager.addView(navigationBarWindow, lp);
        mWindowManager.addView(mNavigationBarWindow, lp);
    }

    @Override
@@ -218,6 +233,11 @@ public class CarStatusBar extends StatusBar implements
        return mNavigationBarView;
    }

    @Override
    public View getNavigationBarWindow() {
        return mNavigationBarWindow;
    }

    @Override
    protected View.OnTouchListener getStatusBarWindowTouchListener() {
        // Usually, a touch on the background window will dismiss the notification shade. However,