Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +1 −1 Original line number Diff line number Diff line Loading @@ -696,7 +696,7 @@ class AdapterProperties { + prevState + " -> " + state); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, 0 /* deprecated */, profile, mService.obfuscateAddress(device), mService.getMetricId(device)); mService.getMetricId(device), 0); if (!isNormalStateTransition(prevState, state)) { Log.w(TAG, Loading android/app/src/com/android/bluetooth/gatt/GattService.java +35 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProtoEnums; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGattCallback; Loading Loading @@ -69,6 +70,7 @@ import android.text.format.DateUtils; import android.util.Log; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothStatsLog; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.AbstractionLayer; Loading Loading @@ -2003,7 +2005,7 @@ public class GattService extends ProfileService { Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" + address); } int connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; if (status == 0) { mClientMap.addConnection(clientIf, connId, address); Loading @@ -2013,12 +2015,16 @@ public class GattService extends ProfileService { + address); mPermits.putIfAbsent(address, new AtomicBoolean(true)); } connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } ClientMap.App app = mClientMap.getById(clientIf); if (app != null) { app.callback.onClientConnectionState(status, clientIf, (status == BluetoothGatt.GATT_SUCCESS), address); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, connectionState); } void onDisconnected(int clientIf, int connId, int status, String address) Loading @@ -2044,6 +2050,9 @@ public class GattService extends ProfileService { if (app != null) { app.callback.onClientConnectionState(status, clientIf, false, address); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED); } void onClientPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { Loading Loading @@ -3388,6 +3397,9 @@ public class GattService extends ProfileService { Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect + ", opportunistic=" + opportunistic + ", phy=" + phy); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_CONNECTING); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); } Loading @@ -3402,7 +3414,9 @@ public class GattService extends ProfileService { if (DBG) { Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); } Loading Loading @@ -3964,14 +3978,18 @@ public class GattService extends ProfileService { if (app == null) { return; } int connectionState; if (connected) { mServerMap.addConnection(serverIf, connId, address); connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } else { mServerMap.removeConnection(serverIf, connId); connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; } app.callback.onServerConnectionState((byte) 0, serverIf, connected, address); statsLogGattConnectionStateChange( BluetoothProfile.GATT_SERVER, address, serverIf, connectionState); } void onServerReadCharacteristic(String address, int connId, int transId, int handle, int offset, Loading Loading @@ -4645,6 +4663,20 @@ public class GattService extends ProfileService { } } private void statsLogGattConnectionStateChange( int profile, String address, int sessionIndex, int connectionState) { BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address); BluetoothStatsLog.write( BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, connectionState, 0 /* deprecated */, profile, new byte[0], mAdapterService.getMetricId(device), sessionIndex); if (DBG) { Log.d(TAG, "Gatt Logging: metric_id=" + mAdapterService.getMetricId(device) + ", session_index=" + sessionIndex + ", connection state=" + connectionState); } } @Override public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { synchronized (mScanEvents) { Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +1 −1 Original line number Diff line number Diff line Loading @@ -696,7 +696,7 @@ class AdapterProperties { + prevState + " -> " + state); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, 0 /* deprecated */, profile, mService.obfuscateAddress(device), mService.getMetricId(device)); mService.getMetricId(device), 0); if (!isNormalStateTransition(prevState, state)) { Log.w(TAG, Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +35 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProtoEnums; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGattCallback; Loading Loading @@ -69,6 +70,7 @@ import android.text.format.DateUtils; import android.util.Log; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothStatsLog; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.AbstractionLayer; Loading Loading @@ -2003,7 +2005,7 @@ public class GattService extends ProfileService { Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" + address); } int connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; if (status == 0) { mClientMap.addConnection(clientIf, connId, address); Loading @@ -2013,12 +2015,16 @@ public class GattService extends ProfileService { + address); mPermits.putIfAbsent(address, new AtomicBoolean(true)); } connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } ClientMap.App app = mClientMap.getById(clientIf); if (app != null) { app.callback.onClientConnectionState(status, clientIf, (status == BluetoothGatt.GATT_SUCCESS), address); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, connectionState); } void onDisconnected(int clientIf, int connId, int status, String address) Loading @@ -2044,6 +2050,9 @@ public class GattService extends ProfileService { if (app != null) { app.callback.onClientConnectionState(status, clientIf, false, address); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED); } void onClientPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { Loading Loading @@ -3388,6 +3397,9 @@ public class GattService extends ProfileService { Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect + ", opportunistic=" + opportunistic + ", phy=" + phy); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_CONNECTING); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); } Loading @@ -3402,7 +3414,9 @@ public class GattService extends ProfileService { if (DBG) { Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); } Loading Loading @@ -3964,14 +3978,18 @@ public class GattService extends ProfileService { if (app == null) { return; } int connectionState; if (connected) { mServerMap.addConnection(serverIf, connId, address); connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } else { mServerMap.removeConnection(serverIf, connId); connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; } app.callback.onServerConnectionState((byte) 0, serverIf, connected, address); statsLogGattConnectionStateChange( BluetoothProfile.GATT_SERVER, address, serverIf, connectionState); } void onServerReadCharacteristic(String address, int connId, int transId, int handle, int offset, Loading Loading @@ -4645,6 +4663,20 @@ public class GattService extends ProfileService { } } private void statsLogGattConnectionStateChange( int profile, String address, int sessionIndex, int connectionState) { BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address); BluetoothStatsLog.write( BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, connectionState, 0 /* deprecated */, profile, new byte[0], mAdapterService.getMetricId(device), sessionIndex); if (DBG) { Log.d(TAG, "Gatt Logging: metric_id=" + mAdapterService.getMetricId(device) + ", session_index=" + sessionIndex + ", connection state=" + connectionState); } } @Override public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { synchronized (mScanEvents) { Loading