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

Commit de27fa37 authored by Vairavan Srinivasan's avatar Vairavan Srinivasan
Browse files

Fix to unbind BluetoothHeadset service

Connections to BluetoothHeadset service isn't unbound when
bluetooth is disabled and this adds to the number of active
connections in system_server and avoids garbage collection
of death monitors. Fix is to unbind when bluetooth is
disabled.

Change-Id: Iaa406146096a4d92b3704c2b53a23d27f4878a03
parent f82fa927
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1184,6 +1184,10 @@ public final class BatteryStatsImpl extends BatteryStats {
        mBtHeadset = headset;
    }

    public BluetoothHeadset getBtHeadset() {
        return mBtHeadset;
    }

    int mChangedStates = 0;

    void addHistoryRecordLocked(long curTime) {
+5 −0
Original line number Diff line number Diff line
@@ -296,8 +296,13 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
    
    public void noteBluetoothOff() {
        enforceCallingPermission();
        BluetoothHeadset headset = null;
        synchronized (mStats) {
            mStats.noteBluetoothOffLocked();
            headset = mStats.getBtHeadset();
        }
        if (headset != null) {
            headset.close();
        }
    }