routeBluetoothHeadset() method was executed when incoming connection was found even though it wasn't a headset. This caused sometimes a disconnect of the headset.

This commit is contained in:
Jimmie Matsson 2019-07-05 16:14:38 +02:00
parent 0d2c1ee0ba
commit a6f248b868
3 changed files with 20 additions and 18 deletions

View file

@ -16,7 +16,7 @@ android {
minSdkVersion 17
targetSdkVersion 25
VERSION = "4.2.3.500"
VERSION = "4.2.3.501"
}
def props = new Properties()

View file

@ -1,6 +1,6 @@
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.

View file

@ -97,7 +97,6 @@ public class BluetoothSCOManager extends BroadcastReceiver {
case BluetoothDevice.ACTION_ACL_CONNECTED: {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
mService.getAudioSystem().routeSoundBluetooth();
deviceConnected(device);
}
break;
@ -471,25 +470,28 @@ public class BluetoothSCOManager extends BroadcastReceiver {
Log.i(TAG, "eml: isHeadset: " + isHeadset);
Log.i(TAG, "eml: MACs : " + mConnectedMAC + " <--> " + btDevice.getAddress());
if (isHeadset && (mResuming
|| ((mStarted || mPaused) && mConnectedMAC != null && mConnectedMAC.equals(btDevice.getAddress())))) {
if (isHeadset) {
if (mResuming
|| ((mStarted || mPaused) && mConnectedMAC != null && mConnectedMAC.equals(btDevice.getAddress()))) {
// Log.i(TAG, "eml: request connect to headset !!! ");
// connectHeadset(mConnectedMAC);
Log.i(TAG, "eml: resuming: " + mResuming);
mResuming = false;
Log.i(TAG, "eml: resuming: " + mResuming);
mResuming = false;
if (mReconnectSCO != null) {
mReconnectSCO.interrupt();
try {
Thread.sleep(313);
} catch (Exception e) {
// empty by design
if (mReconnectSCO != null) {
mReconnectSCO.interrupt();
try {
Thread.sleep(313);
} catch (Exception e) {
// empty by design
}
}
}
mReconnectSCO = new Thread(new SCOReconnect(false));
mReconnectSCO.start();
mReconnectSCO = new Thread(new SCOReconnect(false));
mReconnectSCO.start();
} else {
mService.getAudioSystem().routeSoundBluetooth();
}
}
mConnectedMAC = null;