Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +13 −15 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class AdapterProperties { private CopyOnWriteArrayList<BluetoothDevice> mBondedDevices = new CopyOnWriteArrayList<BluetoothDevice>(); private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting; private HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState; private final HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState = new HashMap<>(); private volatile int mConnectionState = BluetoothAdapter.STATE_DISCONNECTED; private volatile int mState = BluetoothAdapter.STATE_OFF; Loading Loading @@ -156,11 +156,7 @@ class AdapterProperties { mAdapter = BluetoothAdapter.getDefaultAdapter(); } public void init(RemoteDevices remoteDevices) { if (mProfileConnectionState ==null) { mProfileConnectionState = new HashMap<Integer, Pair<Integer, Integer>>(); } else { mProfileConnectionState.clear(); } mRemoteDevices = remoteDevices; IntentFilter filter = new IntentFilter(); Loading @@ -182,10 +178,7 @@ class AdapterProperties { public void cleanup() { mRemoteDevices = null; if (mProfileConnectionState != null) { mProfileConnectionState.clear(); mProfileConnectionState = null; } if (mReceiverRegistered) { mService.unregisterReceiver(mReceiver); mReceiverRegistered = false; Loading Loading @@ -762,12 +755,17 @@ class AdapterProperties { } void onBluetoothReady() { Log.d(TAG, "ScanMode = " + mScanMode ); Log.d(TAG, "State = " + getState() ); debugLog("onBluetoothReady, state=" + getState() + ", ScanMode=" + mScanMode); synchronized (mObject) { // Reset adapter and profile connection states setConnectionState(BluetoothAdapter.STATE_DISCONNECTED); mProfileConnectionState.clear(); mProfilesConnected = 0; mProfilesConnecting = 0; mProfilesDisconnecting = 0; // When BT is being turned on, all adapter properties will be sent in 1 // callback. At this stage, set the scan mode. synchronized (mObject) { if (getState() == BluetoothAdapter.STATE_TURNING_ON && mScanMode == BluetoothAdapter.SCAN_MODE_NONE) { /* mDiscoverableTimeout is part of the Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +2 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,7 @@ public class AdapterService extends Service { } boolean startDiscovery() { debugLog("startDiscovery"); enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading @@ -1506,6 +1507,7 @@ public class AdapterService extends Service { } boolean cancelDiscovery() { debugLog("cancelDiscovery"); enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +13 −15 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class AdapterProperties { private CopyOnWriteArrayList<BluetoothDevice> mBondedDevices = new CopyOnWriteArrayList<BluetoothDevice>(); private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting; private HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState; private final HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState = new HashMap<>(); private volatile int mConnectionState = BluetoothAdapter.STATE_DISCONNECTED; private volatile int mState = BluetoothAdapter.STATE_OFF; Loading Loading @@ -156,11 +156,7 @@ class AdapterProperties { mAdapter = BluetoothAdapter.getDefaultAdapter(); } public void init(RemoteDevices remoteDevices) { if (mProfileConnectionState ==null) { mProfileConnectionState = new HashMap<Integer, Pair<Integer, Integer>>(); } else { mProfileConnectionState.clear(); } mRemoteDevices = remoteDevices; IntentFilter filter = new IntentFilter(); Loading @@ -182,10 +178,7 @@ class AdapterProperties { public void cleanup() { mRemoteDevices = null; if (mProfileConnectionState != null) { mProfileConnectionState.clear(); mProfileConnectionState = null; } if (mReceiverRegistered) { mService.unregisterReceiver(mReceiver); mReceiverRegistered = false; Loading Loading @@ -762,12 +755,17 @@ class AdapterProperties { } void onBluetoothReady() { Log.d(TAG, "ScanMode = " + mScanMode ); Log.d(TAG, "State = " + getState() ); debugLog("onBluetoothReady, state=" + getState() + ", ScanMode=" + mScanMode); synchronized (mObject) { // Reset adapter and profile connection states setConnectionState(BluetoothAdapter.STATE_DISCONNECTED); mProfileConnectionState.clear(); mProfilesConnected = 0; mProfilesConnecting = 0; mProfilesDisconnecting = 0; // When BT is being turned on, all adapter properties will be sent in 1 // callback. At this stage, set the scan mode. synchronized (mObject) { if (getState() == BluetoothAdapter.STATE_TURNING_ON && mScanMode == BluetoothAdapter.SCAN_MODE_NONE) { /* mDiscoverableTimeout is part of the Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +2 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,7 @@ public class AdapterService extends Service { } boolean startDiscovery() { debugLog("startDiscovery"); enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading @@ -1506,6 +1507,7 @@ public class AdapterService extends Service { } boolean cancelDiscovery() { debugLog("cancelDiscovery"); enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading