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

Commit b2550f96 authored by Chen Chen's avatar Chen Chen Committed by Automerger Merge Worker
Browse files

Merge "BluetoothMetrics: Upload user reported device names to extract...

Merge "BluetoothMetrics: Upload user reported device names to extract manufacturer and model information" into tm-dev am: ffee5d1c

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/18918960



Change-Id: Ifa3fa14ed33feedc987c9e8d3a0d89f88a494ac9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f2494019 ffee5d1c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -691,6 +691,10 @@ class AdapterProperties {
        BluetoothDevice device = connIntent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        int prevState = connIntent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, -1);
        int state = connIntent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1);
        if (state == BluetoothProfile.STATE_CONNECTING) {
            BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_NAME_REPORTED,
                    mService.getMetricId(device), device.getName());
        }
        Log.d(TAG,
                "PROFILE_CONNECTION_STATE_CHANGE: profile=" + profile + ", device=" + device + ", "
                        + prevState + " -> " + state);
+2 −0
Original line number Diff line number Diff line
@@ -331,6 +331,8 @@ final class BondStateMachine extends StateMachine {
            } else {
                result = mAdapterService.createBondNative(addr, transport);
            }
            BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_NAME_REPORTED,
                    mAdapterService.getMetricId(dev), dev.getName());
            BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_BOND_STATE_CHANGED,
                    mAdapterService.obfuscateAddress(dev), transport, dev.getType(),
                    BluetoothDevice.BOND_BONDING,
+13 −0
Original line number Diff line number Diff line
@@ -3397,6 +3397,7 @@ public class GattService extends ProfileService {
            Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect
                    + ", opportunistic=" + opportunistic + ", phy=" + phy);
        }
        statsLogAppPackage(address, attributionSource.getPackageName());
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT, address, clientIf,
                BluetoothProtoEnums.CONNECTION_STATE_CONNECTING);
@@ -3988,6 +3989,7 @@ public class GattService extends ProfileService {
        }

        app.callback.onServerConnectionState((byte) 0, serverIf, connected, address);
        statsLogAppPackage(address, app.name);
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT_SERVER, address, serverIf, connectionState);
    }
@@ -4663,6 +4665,17 @@ public class GattService extends ProfileService {
        }
    }

    private void statsLogAppPackage(String address, String app) {
        BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address);
        BluetoothStatsLog.write(
                BluetoothStatsLog.BLUETOOTH_DEVICE_NAME_REPORTED,
                mAdapterService.getMetricId(device), app);
        if (DBG) {
            Log.d(TAG, "Gatt Logging: metric_id=" + mAdapterService.getMetricId(device)
                    + ", app=" + app);
        }
    }

    private void statsLogGattConnectionStateChange(
            int profile, String address, int sessionIndex, int connectionState) {
        BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address);