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

Commit ce211ca9 authored by Jack He's avatar Jack He
Browse files

Metrics: Log class of device

* Log class of device during bond and connection state change

Bug: 112969790
Test: testdrive with statsd
Change-Id: Ibf42ecf131d8b5865c48487fed49981b996d8c9d
parent 24a342da
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -389,6 +389,10 @@ final class BondStateMachine extends StateMachine {
        StatsLog.write(StatsLog.BLUETOOTH_BOND_STATE_CHANGED,
                mAdapterService.obfuscateAddress(device), 0, device.getType(),
                newState, BluetoothProtoEnums.BOND_SUB_STATE_UNKNOWN, reason);
        BluetoothClass deviceClass = device.getBluetoothClass();
        int classOfDevice = deviceClass == null ? 0 : deviceClass.getClassOfDevice();
        StatsLog.write(StatsLog.BLUETOOTH_CLASS_OF_DEVICE_REPORTED,
                mAdapterService.obfuscateAddress(device), classOfDevice);
        mAdapterProperties.onBondStateChanged(device, newState);

        if ((devProp.getDeviceType() == BluetoothDevice.DEVICE_TYPE_CLASSIC
+4 −0
Original line number Diff line number Diff line
@@ -643,6 +643,10 @@ final class RemoteDevices {
                ? BluetoothAdapter.STATE_CONNECTED : BluetoothAdapter.STATE_DISCONNECTED;
        StatsLog.write(StatsLog.BLUETOOTH_ACL_CONNECTION_STATE_CHANGED,
                sAdapterService.obfuscateAddress(device), connectionState);
        BluetoothClass deviceClass = device.getBluetoothClass();
        int classOfDevice = deviceClass == null ? 0 : deviceClass.getClassOfDevice();
        StatsLog.write(StatsLog.BLUETOOTH_CLASS_OF_DEVICE_REPORTED,
                sAdapterService.obfuscateAddress(device), classOfDevice);

        if (intent != null) {
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+1 −1
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ public class RemoteDevicesTest {
        // Verify ACTION_ACL_DISCONNECTED and BATTERY_LEVEL_CHANGED intent are sent
        verify(mAdapterService, times(3)).sendBroadcast(mIntentArgument.capture(),
                mStringArgument.capture());
        verify(mAdapterService).obfuscateAddress(mDevice1);
        verify(mAdapterService, times(2)).obfuscateAddress(mDevice1);
        verifyBatteryLevelChangedIntent(mDevice1, BluetoothDevice.BATTERY_LEVEL_UNKNOWN,
                mIntentArgument.getAllValues().get(mIntentArgument.getAllValues().size() - 2));
        Assert.assertEquals(AdapterService.BLUETOOTH_PERM,