Merge "A2DP sink: Set local Bluetooth Address in AudioSystem to decode packet" into q-keystone-qcom-dev
diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java
index 6fe2831..d9e0eb4 100644
--- a/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/src/com/android/bluetooth/btservice/AdapterService.java
@@ -2713,6 +2713,8 @@
}
boolean setPhonebookAccessPermission(BluetoothDevice device, int value) {
+ enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
+ "Need BLUETOOTH PRIVILEGED permission");
SharedPreferences pref = getSharedPreferences(PHONEBOOK_ACCESS_PERMISSION_PREFERENCE_FILE,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 491a0bb..fa5a525 100644
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -2208,6 +2208,37 @@
mNativeInterface.phoneStateChange(mDevice, updateCallState);
mIsCallIndDelay = true;
}
+
+ /* The device is blacklisted for sending incoming call setup
+ * indicator after SCO disconnection and sending active call end
+ * indicator. While the incoming call setup indicator is in queue,
+ * waiting call moved to active state. Send call setup update first
+ * and remove it from queue. Create SCO since SCO might be in
+ * disconnecting/disconnected state */
+ if (mIsBlacklistedDevice &&
+ callState.mNumActive == 1 &&
+ callState.mNumHeld == 0 &&
+ callState.mCallState == HeadsetHalConstants.CALL_STATE_IDLE &&
+ hasMessages(SEND_INCOMING_CALL_IND)) {
+
+ Log.w(TAG, "waiting call moved to active state while incoming call");
+ Log.w(TAG, "setup indicator is in queue. Send it first and create SCO");
+ //remove call setup indicator from queue.
+ removeMessages(SEND_INCOMING_CALL_IND);
+
+ HeadsetCallState incomingCallSetupState =
+ new HeadsetCallState(0, 0, HeadsetHalConstants.CALL_STATE_INCOMING,
+ mSystemInterface.getHeadsetPhoneState().getNumber(),
+ mSystemInterface.getHeadsetPhoneState().getType(),
+ "");
+ mNativeInterface.phoneStateChange(mDevice, incomingCallSetupState);
+
+ if (mDevice.equals(mHeadsetService.getActiveDevice())) {
+ Message m = obtainMessage(CONNECT_AUDIO);
+ m.obj = mDevice;
+ sendMessage(m);
+ }
+ }
}
mStateMachineCallState.mNumActive = callState.mNumActive;
mStateMachineCallState.mNumHeld = callState.mNumHeld;