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

Commit 481069bd authored by ahujapalash's avatar ahujapalash Committed by Palash Ahuja
Browse files

BluetoothMetrics: Status field to upload for GATT connection

Test: m statsd_testdrive
Change-Id: Ic8ac2788c8772562b9bd6dfd7ac13f0f8ace6b2a
PDD: https://eldar.corp.google.com/assessments/150656741
MDR: https://eldar.corp.google.com/assessments/152668825
Bug: 251543813
(cherry picked from commit on googleplex-android-review.googlesource.com host: 373cdbc4)
Merged-In: Ic8ac2788c8772562b9bd6dfd7ac13f0f8ace6b2a
parent ed2dd384
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ class AdapterProperties {
                        + prevState + " -> " + state);
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state,
                0 /* deprecated */, profile, mService.obfuscateAddress(device),
                mService.getMetricId(device), 0);
                mService.getMetricId(device), 0, -1);

        if (!isNormalStateTransition(prevState, state)) {
            Log.w(TAG,
+10 −8
Original line number Diff line number Diff line
@@ -2054,7 +2054,7 @@ public class GattService extends ProfileService {
                    (status == BluetoothGatt.GATT_SUCCESS), address);
        }
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT, address, clientIf, connectionState);
                BluetoothProfile.GATT, address, clientIf, connectionState, status);
    }

    void onDisconnected(int clientIf, int connId, int status, String address)
@@ -2089,7 +2089,7 @@ public class GattService extends ProfileService {
        }
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT, address, clientIf,
                BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED);
                BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED, status);
    }

    void onClientPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException {
@@ -3437,7 +3437,7 @@ public class GattService extends ProfileService {
        statsLogAppPackage(address, attributionSource.getUid(), clientIf);
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT, address, clientIf,
                BluetoothProtoEnums.CONNECTION_STATE_CONNECTING);
                BluetoothProtoEnums.CONNECTION_STATE_CONNECTING, -1);
        gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy);
    }

@@ -3454,7 +3454,7 @@ public class GattService extends ProfileService {
        }
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT, address, clientIf,
                BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING);
                BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING, -1);
        gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0);
    }

@@ -4022,7 +4022,7 @@ public class GattService extends ProfileService {
        app.callback.onServerConnectionState((byte) 0, serverIf, connected, address);
        statsLogAppPackage(address, applicationUid, serverIf);
        statsLogGattConnectionStateChange(
                BluetoothProfile.GATT_SERVER, address, serverIf, connectionState);
                BluetoothProfile.GATT_SERVER, address, serverIf, connectionState, -1);
    }

    void onServerReadCharacteristic(String address, int connId, int transId, int handle, int offset,
@@ -4712,16 +4712,18 @@ public class GattService extends ProfileService {
    }

    private void statsLogGattConnectionStateChange(
            int profile, String address, int sessionIndex, int connectionState) {
            int profile, String address, int sessionIndex, int connectionState,
            int connectionStatus) {
        BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address);
        BluetoothStatsLog.write(
                BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, connectionState,
                0 /* deprecated */, profile, new byte[0],
                mAdapterService.getMetricId(device), sessionIndex);
                mAdapterService.getMetricId(device), sessionIndex, connectionStatus);
        if (DBG) {
            Log.d(TAG, "Gatt Logging: metric_id=" + mAdapterService.getMetricId(device)
                    + ", session_index=" + sessionIndex
                    + ", connection state=" + connectionState);
                    + ", connection state=" + connectionState
                    + ", connection status=" + connectionStatus);
        }
    }