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

Commit e95bc124 authored by Clark Scheff's avatar Clark Scheff Committed by d34d
Browse files

SysUI: Don't recreate controllers.

The various controllers, such as mLocationController, get recreated
every time the status bar is recreated due to a theme change.  We
should only need to create these if they are null, otherwise use
the controller as is.  Also, each of these controlers registers
themselves as a broadcast receiver and are never unregistered before
recreating them.

Change-Id: I6215aae5a82b7ced8f0f25cf592a804d38825260
parent 0ed2b5d0
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -190,7 +190,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    DockBatteryController mDockBatteryController;
    LocationController mLocationController;
    NetworkController mNetworkController;
    RotationLockController mRotationLockController;
    MSimNetworkController mMSimNetworkController;

    int mNaturalBarHeight = -1;
@@ -516,6 +515,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            mCurrentTheme = (CustomTheme)currentTheme.clone();
        }

        mLocationController = new LocationController(mContext);
        mBatteryController = new BatteryController(mContext);
        mDockBatteryController = new DockBatteryController(mContext);
        mBluetoothController = new BluetoothController(mContext);

        super.start(); // calls createAndAddWindows()

        addNavigationBar();
@@ -766,12 +770,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        setAreThereNotifications();

        // Other icons
        mLocationController = new LocationController(mContext); // will post a notification
        mBatteryController = new BatteryController(mContext);
        mDockBatteryController = new DockBatteryController(mContext);
        mBluetoothController = new BluetoothController(mContext);
        mRotationLockController = new RotationLockController(mContext);

        mBatteryView = (BatteryMeterView) mStatusBarView.findViewById(R.id.battery);
        mDockBatteryView = (DockBatteryMeterView) mStatusBarView.findViewById(R.id.dock_battery);