Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -692,7 +692,7 @@ class AdapterProperties { + prevState + " -> " + state); + prevState + " -> " + state); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, 0 /* deprecated */, profile, mService.obfuscateAddress(device), 0 /* deprecated */, profile, mService.obfuscateAddress(device), mService.getMetricId(device)); mService.getMetricId(device), 0); if (!isNormalStateTransition(prevState, state)) { if (!isNormalStateTransition(prevState, state)) { Log.w(TAG, Log.w(TAG, Loading android/app/src/com/android/bluetooth/gatt/GattService.java +35 −3 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProtoEnums; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGattCallback; import android.bluetooth.IBluetoothGattCallback; Loading Loading @@ -70,6 +71,7 @@ import android.text.format.DateUtils; import android.util.Log; import android.util.Log; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothStatsLog; import com.android.bluetooth.R; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.AbstractionLayer; import com.android.bluetooth.btservice.AbstractionLayer; Loading Loading @@ -2005,7 +2007,7 @@ public class GattService extends ProfileService { Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" + address); + address); } } int connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; if (status == 0) { if (status == 0) { mClientMap.addConnection(clientIf, connId, address); mClientMap.addConnection(clientIf, connId, address); Loading @@ -2015,12 +2017,16 @@ public class GattService extends ProfileService { + address); + address); mPermits.putIfAbsent(address, new AtomicBoolean(true)); mPermits.putIfAbsent(address, new AtomicBoolean(true)); } } connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } } ClientMap.App app = mClientMap.getById(clientIf); ClientMap.App app = mClientMap.getById(clientIf); if (app != null) { if (app != null) { app.callback.onClientConnectionState(status, clientIf, app.callback.onClientConnectionState(status, clientIf, (status == BluetoothGatt.GATT_SUCCESS), address); (status == BluetoothGatt.GATT_SUCCESS), address); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, connectionState); } } void onDisconnected(int clientIf, int connId, int status, String address) void onDisconnected(int clientIf, int connId, int status, String address) Loading @@ -2047,6 +2053,9 @@ public class GattService extends ProfileService { if (app != null) { if (app != null) { app.callback.onClientConnectionState(status, clientIf, false, address); 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 { void onClientPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { Loading Loading @@ -3386,6 +3395,9 @@ public class GattService extends ProfileService { Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect + ", opportunistic=" + opportunistic + ", phy=" + phy); + ", opportunistic=" + opportunistic + ", phy=" + phy); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_CONNECTING); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); } } Loading @@ -3400,7 +3412,9 @@ public class GattService extends ProfileService { if (DBG) { if (DBG) { Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); } } Loading Loading @@ -3962,14 +3976,18 @@ public class GattService extends ProfileService { if (app == null) { if (app == null) { return; return; } } int connectionState; if (connected) { if (connected) { mServerMap.addConnection(serverIf, connId, address); mServerMap.addConnection(serverIf, connId, address); connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } else { } else { mServerMap.removeConnection(serverIf, connId); mServerMap.removeConnection(serverIf, connId); connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; } } app.callback.onServerConnectionState((byte) 0, serverIf, connected, address); 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, void onServerReadCharacteristic(String address, int connId, int transId, int handle, int offset, Loading Loading @@ -4643,6 +4661,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 @Override public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { synchronized (mScanEvents) { synchronized (mScanEvents) { Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -692,7 +692,7 @@ class AdapterProperties { + prevState + " -> " + state); + prevState + " -> " + state); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, 0 /* deprecated */, profile, mService.obfuscateAddress(device), 0 /* deprecated */, profile, mService.obfuscateAddress(device), mService.getMetricId(device)); mService.getMetricId(device), 0); if (!isNormalStateTransition(prevState, state)) { if (!isNormalStateTransition(prevState, state)) { Log.w(TAG, Log.w(TAG, Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +35 −3 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProtoEnums; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.BluetoothStatusCodes; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGattCallback; import android.bluetooth.IBluetoothGattCallback; Loading Loading @@ -70,6 +71,7 @@ import android.text.format.DateUtils; import android.util.Log; import android.util.Log; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothMetricsProto; import com.android.bluetooth.BluetoothStatsLog; import com.android.bluetooth.R; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.Utils; import com.android.bluetooth.btservice.AbstractionLayer; import com.android.bluetooth.btservice.AbstractionLayer; Loading Loading @@ -2005,7 +2007,7 @@ public class GattService extends ProfileService { Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" Log.d(TAG, "onConnected() - clientIf=" + clientIf + ", connId=" + connId + ", address=" + address); + address); } } int connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; if (status == 0) { if (status == 0) { mClientMap.addConnection(clientIf, connId, address); mClientMap.addConnection(clientIf, connId, address); Loading @@ -2015,12 +2017,16 @@ public class GattService extends ProfileService { + address); + address); mPermits.putIfAbsent(address, new AtomicBoolean(true)); mPermits.putIfAbsent(address, new AtomicBoolean(true)); } } connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } } ClientMap.App app = mClientMap.getById(clientIf); ClientMap.App app = mClientMap.getById(clientIf); if (app != null) { if (app != null) { app.callback.onClientConnectionState(status, clientIf, app.callback.onClientConnectionState(status, clientIf, (status == BluetoothGatt.GATT_SUCCESS), address); (status == BluetoothGatt.GATT_SUCCESS), address); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, connectionState); } } void onDisconnected(int clientIf, int connId, int status, String address) void onDisconnected(int clientIf, int connId, int status, String address) Loading @@ -2047,6 +2053,9 @@ public class GattService extends ProfileService { if (app != null) { if (app != null) { app.callback.onClientConnectionState(status, clientIf, false, address); 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 { void onClientPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { Loading Loading @@ -3386,6 +3395,9 @@ public class GattService extends ProfileService { Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect Log.d(TAG, "clientConnect() - address=" + address + ", isDirect=" + isDirect + ", opportunistic=" + opportunistic + ", phy=" + phy); + ", opportunistic=" + opportunistic + ", phy=" + phy); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_CONNECTING); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); gattClientConnectNative(clientIf, address, isDirect, transport, opportunistic, phy); } } Loading @@ -3400,7 +3412,9 @@ public class GattService extends ProfileService { if (DBG) { if (DBG) { Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); Log.d(TAG, "clientDisconnect() - address=" + address + ", connId=" + connId); } } statsLogGattConnectionStateChange( BluetoothProfile.GATT, address, clientIf, BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTING); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); gattClientDisconnectNative(clientIf, address, connId != null ? connId : 0); } } Loading Loading @@ -3962,14 +3976,18 @@ public class GattService extends ProfileService { if (app == null) { if (app == null) { return; return; } } int connectionState; if (connected) { if (connected) { mServerMap.addConnection(serverIf, connId, address); mServerMap.addConnection(serverIf, connId, address); connectionState = BluetoothProtoEnums.CONNECTION_STATE_CONNECTED; } else { } else { mServerMap.removeConnection(serverIf, connId); mServerMap.removeConnection(serverIf, connId); connectionState = BluetoothProtoEnums.CONNECTION_STATE_DISCONNECTED; } } app.callback.onServerConnectionState((byte) 0, serverIf, connected, address); 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, void onServerReadCharacteristic(String address, int connId, int transId, int handle, int offset, Loading Loading @@ -4643,6 +4661,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 @Override public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { public void dumpProto(BluetoothMetricsProto.BluetoothLog.Builder builder) { synchronized (mScanEvents) { synchronized (mScanEvents) { Loading