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

Commit 82cb029e authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Get At command count from Bluetooth headset.

Pass in the BT headset object when available to the BatteryStats.
parent 54ba86f0
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -978,10 +978,13 @@ public final class BatteryStatsImpl extends BatteryStats {
        } else if (mBtHeadset != null) {
        } else if (mBtHeadset != null) {
            return getCurrentBluetoothPingCount() - mBluetoothPingStart;
            return getCurrentBluetoothPingCount() - mBluetoothPingStart;
        }
        }
        return -1;
        return 0;
    }
    }


    public void setBtHeadset(BluetoothHeadset headset) {
    public void setBtHeadset(BluetoothHeadset headset) {
        if (headset != null && mBtHeadset == null && isOnBattery() && mBluetoothPingStart == -1) {
            mBluetoothPingStart = getCurrentBluetoothPingCount();
        }
        mBtHeadset = headset;
        mBtHeadset = headset;
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -260,6 +260,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
        enforceCallingPermission();
        enforceCallingPermission();
        synchronized (mStats) {
        synchronized (mStats) {
            mStats.noteBluetoothOnLocked();
            mStats.noteBluetoothOnLocked();
            mStats.setBtHeadset(new android.bluetooth.BluetoothHeadset(mContext, null));
        }
        }
    }
    }