summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkateshwarlu Domakonda <vdomak@codeaurora.org>2015-09-16 14:53:40 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-15 02:22:47 -0700
commitcc4890f7b794fee37d89f05a06b85e92dc89c2c4 (patch)
tree8ab9150de383adbcffef80097b662c89b550d368
parentcb05a3a7d551491c6f2cda0643c52e29a7c6b19f (diff)
downloadandroid_packages_apps_Bluetooth-cc4890f7b794fee37d89f05a06b85e92dc89c2c4.tar.gz
android_packages_apps_Bluetooth-cc4890f7b794fee37d89f05a06b85e92dc89c2c4.tar.bz2
android_packages_apps_Bluetooth-cc4890f7b794fee37d89f05a06b85e92dc89c2c4.zip
A2DP Sink: Fix the issue with A2DP connection
Incoming A2DP connection accepted even though blocked. Check the priority to accept the incoming A2DP connection. Change-Id: I6aad2419f8fb9c94f246b3c7423bd9cf010eab42 CRs-Fixed: 909136
-rw-r--r--src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
index db4ef5ba8..d470aeb20 100644
--- a/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
+++ b/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
@@ -849,13 +849,22 @@ final class A2dpSinkStateMachine extends StateMachine {
boolean okToConnect(BluetoothDevice device) {
AdapterService adapterService = AdapterService.getAdapterService();
- boolean ret = true;
+ int priority = mService.getPriority(device);
+ boolean ret = false;
//check if this is an incoming connection in Quiet mode.
if((adapterService == null) ||
((adapterService.isQuietModeEnabled() == true) &&
(mTargetDevice == null))){
ret = false;
}
+ // check priority and accept or reject the connection. if priority is undefined
+ // it is likely that our SDP has not completed and peer is initiating the
+ // connection. Allow this connection, provided the device is bonded
+ else if((BluetoothProfile.PRIORITY_OFF < priority) ||
+ ((BluetoothProfile.PRIORITY_UNDEFINED == priority) &&
+ (device.getBondState() != BluetoothDevice.BOND_NONE))){
+ ret= true;
+ }
return ret;
}