Loading android/app/src/com/android/bluetooth/mapclient/MapClientService.java +11 −33 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ public class MapClientService extends ProfileService { static final int MAXIMUM_CONNECTED_DEVICES = 4; private Map<BluetoothDevice, MceStateMachine> mMapInstanceMap = new ConcurrentHashMap<>(1); private final Map<BluetoothDevice, MceStateMachine> mMapInstanceMap = new ConcurrentHashMap<>(1); private MnsService mMnsServer; private AdapterService mAdapterService; Loading Loading @@ -123,10 +124,7 @@ public class MapClientService extends ProfileService { throw new IllegalArgumentException("Null device"); } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP connect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "connect(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { Log.w(TAG, "Connection not allowed: <" + device.getAddress() Loading Loading @@ -172,10 +170,7 @@ public class MapClientService extends ProfileService { addDeviceToMapAndConnect(device); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP connect device: " + device + ", InstanceMap end state: " + sb.toString()); Log.d(TAG, "connect(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } return true; } Loading @@ -194,10 +189,7 @@ public class MapClientService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP disconnect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "disconnect(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } MceStateMachine mapStateMachine = mMapInstanceMap.get(device); // a map state machine instance doesn't exist. maybe it is already gone? Loading @@ -211,10 +203,8 @@ public class MapClientService extends ProfileService { } mapStateMachine.disconnect(); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP disconnect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "disconnect(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } return true; } Loading Loading @@ -381,10 +371,7 @@ public class MapClientService extends ProfileService { @VisibleForTesting public void cleanupDevice(BluetoothDevice device, MceStateMachine sm) { if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "Cleanup device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "cleanup(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } synchronized (mMapInstanceMap) { MceStateMachine stateMachine = mMapInstanceMap.get(device); Loading @@ -398,20 +385,14 @@ public class MapClientService extends ProfileService { } } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "Cleanup device: " + device + ", InstanceMap end state: " + sb.toString()); Log.d(TAG, "cleanup(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } } @VisibleForTesting void removeUncleanAccounts() { if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "removeUncleanAccounts:InstanceMap end state: " + sb.toString()); Log.d(TAG, "removeUncleanAccounts(): devices=" + mMapInstanceMap.keySet()); } Iterator iterator = mMapInstanceMap.entrySet().iterator(); while (iterator.hasNext()) { Loading @@ -422,10 +403,7 @@ public class MapClientService extends ProfileService { } } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "removeUncleanAccounts:InstanceMap end state: " + sb.toString()); Log.d(TAG, "removeUncleanAccounts(): end devices=" + mMapInstanceMap.keySet()); } } Loading Loading
android/app/src/com/android/bluetooth/mapclient/MapClientService.java +11 −33 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ public class MapClientService extends ProfileService { static final int MAXIMUM_CONNECTED_DEVICES = 4; private Map<BluetoothDevice, MceStateMachine> mMapInstanceMap = new ConcurrentHashMap<>(1); private final Map<BluetoothDevice, MceStateMachine> mMapInstanceMap = new ConcurrentHashMap<>(1); private MnsService mMnsServer; private AdapterService mAdapterService; Loading Loading @@ -123,10 +124,7 @@ public class MapClientService extends ProfileService { throw new IllegalArgumentException("Null device"); } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP connect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "connect(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { Log.w(TAG, "Connection not allowed: <" + device.getAddress() Loading Loading @@ -172,10 +170,7 @@ public class MapClientService extends ProfileService { addDeviceToMapAndConnect(device); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP connect device: " + device + ", InstanceMap end state: " + sb.toString()); Log.d(TAG, "connect(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } return true; } Loading @@ -194,10 +189,7 @@ public class MapClientService extends ProfileService { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP disconnect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "disconnect(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } MceStateMachine mapStateMachine = mMapInstanceMap.get(device); // a map state machine instance doesn't exist. maybe it is already gone? Loading @@ -211,10 +203,8 @@ public class MapClientService extends ProfileService { } mapStateMachine.disconnect(); if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "MAP disconnect device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "disconnect(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } return true; } Loading Loading @@ -381,10 +371,7 @@ public class MapClientService extends ProfileService { @VisibleForTesting public void cleanupDevice(BluetoothDevice device, MceStateMachine sm) { if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "Cleanup device: " + device + ", InstanceMap start state: " + sb.toString()); Log.d(TAG, "cleanup(device= " + device + "): devices=" + mMapInstanceMap.keySet()); } synchronized (mMapInstanceMap) { MceStateMachine stateMachine = mMapInstanceMap.get(device); Loading @@ -398,20 +385,14 @@ public class MapClientService extends ProfileService { } } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "Cleanup device: " + device + ", InstanceMap end state: " + sb.toString()); Log.d(TAG, "cleanup(device= " + device + "): end devices=" + mMapInstanceMap.keySet()); } } @VisibleForTesting void removeUncleanAccounts() { if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "removeUncleanAccounts:InstanceMap end state: " + sb.toString()); Log.d(TAG, "removeUncleanAccounts(): devices=" + mMapInstanceMap.keySet()); } Iterator iterator = mMapInstanceMap.entrySet().iterator(); while (iterator.hasNext()) { Loading @@ -422,10 +403,7 @@ public class MapClientService extends ProfileService { } } if (DBG) { StringBuilder sb = new StringBuilder(); dump(sb); Log.d(TAG, "removeUncleanAccounts:InstanceMap end state: " + sb.toString()); Log.d(TAG, "removeUncleanAccounts(): end devices=" + mMapInstanceMap.keySet()); } } Loading