diff options
author | Nitin Srivastava <nitinsr@codeaurora.org> | 2013-04-04 16:53:17 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:25:29 -0700 |
commit | 9681ea520230bb03d4a3d002b3d9284f8bd8bbfa (patch) | |
tree | 579a658b682d2176bbdc892bf68ccf2071c774a4 /jni | |
parent | d68e408a83dd9d60818dd4071ffe5db10726a32d (diff) | |
download | android_packages_apps_Bluetooth-9681ea520230bb03d4a3d002b3d9284f8bd8bbfa.tar.gz android_packages_apps_Bluetooth-9681ea520230bb03d4a3d002b3d9284f8bd8bbfa.tar.bz2 android_packages_apps_Bluetooth-9681ea520230bb03d4a3d002b3d9284f8bd8bbfa.zip |
Bluetooth: Audio Squashed gerrits for propagation
Bluetooth: Query BluetoothPhoneService at BT ON.
This will allow the application to have
updated values of call states.
CRs-fixed: 506853
Change-Id: I0b1e9cdfd7ecac05062c82aa563849f49a5ae520
Bluetooth: Update the roam status.
This change makes sure that roam status
change is updated to headset immediately
instead of updating at network service state
changed.
CRs-Fixed: 503919
Change-Id: Ia5c68e2158241459f48a1718689361ad0cd6fbf8
Bluetooth: Move A2dp State to Disconnected when BT is Turned OFF
Found one timing issue where the A2dp State is Stuck in Connecting
state If User tries to connect to different headset when device is
already connected to headset and does BT ON -> OFF. This change will
allow the state to move properly when BT is turned off if any device
state was connecting previously.
Change-Id: I17bc620551bf735f39327eff59102c14551bcf26
CRs-Fixed: 532903
Properly update profile connection state.
When DUT is toggled between various paired Headsets Connection
state is not updated properly in some scenarios.This is causing
Bluetooth icon to be in connected state even when no Headsets are
connected.Also make sure connected,connecting,disconnecting devices
count is never negative.
Change-Id: Icb1a7215ff6d9491afbb5f7f203ca0a2c6b7f43a
CRs-Fixed: 532783
Check for A2DP UUIDs supported by remote device
Before sending connect request for A2dp check for roles
supported by remote device and proceed accordingly.
Change-Id: I0200582a69b3d4e9b7f92516ba92f34054a1f4dc
CRs-Fixed: 507306
Update UI properly in Connection race Conditions.
Broadcast connection state of incoming device in pending
state and update UI for disconnection of outgoing connection.
Change-Id: Ibd80fc7010613887df74fb1903b16de73c77939a
CRs-Fixed: 531637
Bluetooth: Send proper track number
As per specification
RegisterNotification - If no track is currently selected
then return 0xFFFFFFFFFFFFFFFF in the interim response.
Changes are made to ensure return above value if play state
is not playing.
Change-Id: Ib27eeeb65fe6659178658e58eb8f875168b236df
CRs-Fixed: 519337
Bluetooth: Proper Connection with multiple Headsets
When paired with multiple Headsets,connecting/disconnecting randomly
between them DUT was connecting HS to one device and A2DP to other device.
Change-Id: Ia6152db3fe56b3ede42460e48fc497a640b2ec2a
CRs-Fixed: 465980
Bluetooth:Send Connection request after Connection Failure.
When one of profile is un-checked from setting sub-menu and initial
connection has failed then try to re-connect selected profile.
Change-Id: I67bf658b5b9ce556fc0d54030989e6033651051b
CRs-Fixed: 543050
Bluetooth: Query phone service on Connect request.
This change makes sure that DUT sends proper
CIND values when connected to headset while
BT is turned ON. Headset state machine will
query BluetoothPhoneService when it receives
CONNECT request.
CRs-Fixed: 548493
Change-Id: I54b75f9d440066a9e871a33f7d727bad3c1e70ae
Bluetooth: Handling multiple BLDN commands.
This change will make sure that DUT returns
ERROR for AT+BLDN command if the dialling
process is already initiated, if queued
more than one BLDN command.
CRs-Fixed: 552289
Change-Id: I20c720f56d43777092ca31d6cdd43e3428e97e99
Bluetooth: Delay Auto connect profiles.
This change delays the auto connect of
audio profiles to make sure that all the
clients of the Bluetooth Audio services
are ready. This handles a corner case
of BT OFF-ON and auto connect while in
call and makes sure that call indicators
are updated properly.
Change-Id: I3f2703d9d0ba20676a83b4ba3eef9513b5696998
CRs-Fixed: 548493
Bluetooth: Add NULL check before accessing Profile data
Add NULL check for profile data before accessing them
in case of stopping the profile.
This check is added for A2DP, HDP, HFP-AG and HFP client
profiles.
CRs-Fixed: 597242
Change-Id: I4a1f35842084bc6ae1b496adbe0b20cf7d1d68ef
Bluetooth: update playingdevice after user initiated disconnect
- update playingdevice after user initiated disconnect
CRs-Fixed: 610046
Change-Id: Ie24b6883bb41ed543bc563e0d7b7865b46bcfe26
Bluetooth: Looging for A2DP
- enable logs in statemachine and a2dpservice
Change-Id: I9fc6c06f091544d9cacfc6690c875557c65b1599
CRs-fixed: 601894
CRs-fixed: 601893
Bluetooth: Send AT+CNUM response.
Send ok response to remote when current
number returned by phone proxy is null.
Send ok so that remote initiates command again.
Change-Id: Ibd00fd8d9abbac98d315ed31b7bcd43c2e1389bb
CRs-Fixed: 638779
Bluetooth: Added null check condtion.
Added null check before accessing
mCurrentDevice. Due to delay in broadcasting
A2dp connection states, Bluetooth settings can
query getConnectedDevices when current state is
disconnected causing NPE.
Change-Id: I2a612e05a3c1a830c9f3bda742bff1b32784e51b
CRs-Fixed: 644148
Bluetooth: Query PhoneState on Incoming Connection.
Query current phone state on incoming connection from
remote, to update CIND indicators during SLC connection
set-up for HFP AG.
Change-Id: I6135a5eb683d401351db5060cdf4d886c3619077
CRs-Fixed: 667909
Bluetooth: Initiate SDP after remote disconnect.
Initiate SDP if remote has disconnected just after pairing
and initiated A2dp/HFP connection.
Change-Id: Ia4ab534be1b9813c7147e1b1b037aa8e721ee190
CRs-Fixed: 664310
CRs-Fixed: 667989
Bluetooth: Delay timeout for ConnectOtherProfile.
Some devices reject connection when connection is
initiated after 6 secs, delay connection timeout for
such devices to 10 secs.
Change-Id: I676b98ae64085a45bd6ecb9a6aeac7921a009e84
CRs-Fixed: 671762
Bluetooth: Null check for mCurrentDevice before using it
- Check for Null before using mCurrentDevice variable
Change-Id: I908b1810887df30039d35ae8dabe814a85aede8b
CRs-Fixed: 669280
Bluetooth: Send empty String.
Send empty string instead of null string
as when JNI checks are enabled it will case
exception in JNI.
Change-Id: I1456cae2778ae80233a3f6a4a5ea2e0529a47090
CRs-Fixed: 676866
Bluetooth: Remove Connect time-out in stable state.
Remove connect time-out when moved to
Connected/Disconnected instead of Pending state.
Initiate disconnect on timer expiry.
Change-Id: I687d6916e037c30e6c0619bfe6404ddd4ddfa46a
CRs-Fixed: 678043
Bluetooth: Re-try connection in Quiet Mode.
When pairing and connection is initiated by NFC
and connection for either of A2dp/HFP fails, then
re-try for connection of failed profile.
Change-Id: I5102e3e2468fcbd9bfc28899d4939bc81722b30c
CRs-Fixed: 680489
Bluetooth: Send Response OK to CLCC command
Found one IOT issue where OK response is not sent from DUT for CLCC
AT command which causing the delay while playing the voice mail.
Change-Id: I992d8e36ca888e6f1e3df0241361e7720630391f
CRs-Fixed: 528898
Bluetooth: Synchronize Virtual Call,Voice Call and A2dp
Found some IOT Issues were headsets behave abnormally if there is
START or SUSPEND over AVDTP in between call indicators sent for
Voip calls. This change will make sure A2dp is Suspended before
sending call indicators and Starts once the Virtual call is Ended.
Change-Id: Iaef6c08b593581112519e53a5d73086fd1539b99
CRs-fixed: 503739,516722
Bluetooth: Update speaker ON settings.
When sco is disconnected, check if the preferred
device to use is speaker, enable the same in
audio manager.
CRs-Fixed: 549910
Change-Id: I7781583d20c59f9fde080638cb9a665fc4cf2753
Bluetooth: Added null check condtion.
Added null check for mCurrentDevice to
avoid any null pointer exception due to
invalid access to mCurrentDevice.
CRs-Fixed: 579061
Change-Id: Id03adde6472fa957b9beb198e7f46000e91cb27d
Bluetooth: Update the Remote supported feature
This change will store the Remote Supported features in
Application Layer and provides API to check if voice dialer
is supported by Remote device or not.
CRs-fixed: 594652
Change-Id: Iefa6e91e21f13ae082590961e252516309a60561
BT: HF: Enhance default BT application logging for HF.
Make default logging for HeadsetStateMachine
state transitions, connection state changes etc.
Control verbose logging at runtime from adb shell.
Change-Id: I32c23714e110c0e781af8e650ff5af8b919369f2
CRs-Fixed: 601899
Bluetooth: Delay Phone State change update to Headset
Phone State changed update is delayed when headset is
connected while there is an active call.
CRs-Fixed: 601813
Change-Id: Ibab0e943abc88f169a1b4fe3f749daa09d1727a9
BT: Make DBG flag isLoggable for Handsfree tag.
If logs for "Handsfree" tag are loggable at VERBOSE
level then make DBG flag true else false.
Change-Id: Ib0615a37932e142ff5693f525784c48103a7284b
Bluetooth: Handle CPBS read command properly.
This change makes sure that AT+CPBS?
returns the SIM phonebook details once.
Change-Id: I12675ecb8ed062c06072bef6227cd0a430f6fef5
CRs-Fixed: 606837
BT: HFP: Limit number of profile reconnection attempts.
- In case SLC fails while A2dp connection is success, HF
reconnection is attempted indefinately after every 6secs
from application. In such case some remote devices cannot
initiate connection from their side. Limiting the number
of HF profile reconnection attempts to 1.
- Limits reconnection attempts for multiple hf client
connections also.
Change-Id: Ia5d930b95c8f2d6b92d46eda8cb3e2450559dcf6
CRs-Fixed: 631031
Bluetooth: Check A2dp device priority.
Add support to update stack for A2dp priority
of device.
Change-Id: I65971ffc68e055d68091f73a489a8d8c69c9420b
CRs-Fixed: 510957
Bluetooth: Process AT+BTRH response.
When BTRH is supported by AG process
BTRH+1 and BTRH+2 response from AG.
CRs-Fixed: 606914
Change-Id: Ia84e50812da31213a2407c9ea4e81404cae48478
Bluetooth: Do not delay braodcasting.
Do not delay broadcasting of connecting
or disconnecting state to app.
CRs-Fixed: 623079
Change-Id: I7fb0299aa7bbc7caa7b221412712336402c177e7
Bluetooth: Synchronise Key release command & Key State.
- Changes done to ignore key release command
if Key State is not press.
CRs-Fixed: 597795
Conflicts:
src/com/android/bluetooth/btservice/AdapterService.java
src/com/android/bluetooth/hdp/HealthService.java
src/com/android/bluetooth/hfp/HeadsetStateMachine.java
Conflicts:
src/com/android/bluetooth/hfp/HeadsetStateMachine.java
Change-Id: If25a6f7df4198f290d216aa1344b6d557f5270c6
Diffstat (limited to 'jni')
-rw-r--r-- | jni/com_android_bluetooth_a2dp.cpp | 44 | ||||
-rw-r--r-- | jni/com_android_bluetooth_a2dp_sink.cpp | 28 | ||||
-rw-r--r-- | jni/com_android_bluetooth_hfp.cpp | 21 |
3 files changed, 90 insertions, 3 deletions
diff --git a/jni/com_android_bluetooth_a2dp.cpp b/jni/com_android_bluetooth_a2dp.cpp index 415f6fe91..e7ce226c5 100644 --- a/jni/com_android_bluetooth_a2dp.cpp +++ b/jni/com_android_bluetooth_a2dp.cpp @@ -28,6 +28,7 @@ namespace android { static jmethodID method_onConnectionStateChanged; static jmethodID method_onAudioStateChanged; +static jmethodID method_onCheckConnectionPriority; static const btav_interface_t *sBluetoothA2dpInterface = NULL; static jobject mCallbacksObj = NULL; @@ -93,10 +94,34 @@ static void bta2dp_audio_state_callback(btav_audio_state_t state, bt_bdaddr_t* b sCallbackEnv->DeleteLocalRef(addr); } +static void bta2dp_connection_priority_callback(bt_bdaddr_t* bd_addr) { + jbyteArray addr; + + ALOGI("%s", __FUNCTION__); + + if (!checkCallbackThread()) { \ + ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__); \ + return; \ + } + addr = sCallbackEnv->NewByteArray(sizeof(bt_bdaddr_t)); + if (!addr) { + ALOGE("Fail to new jbyteArray bd addr for connection state"); + checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); + return; + } + + sCallbackEnv->SetByteArrayRegion(addr, 0, sizeof(bt_bdaddr_t), (jbyte*) bd_addr); + sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onCheckConnectionPriority, addr); + checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); + sCallbackEnv->DeleteLocalRef(addr); +} + static btav_callbacks_t sBluetoothA2dpCallbacks = { sizeof(sBluetoothA2dpCallbacks), bta2dp_connection_state_callback, - bta2dp_audio_state_callback + bta2dp_audio_state_callback, + NULL, + bta2dp_connection_priority_callback }; static void classInitNative(JNIEnv* env, jclass clazz) { @@ -109,6 +134,9 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_onAudioStateChanged = env->GetMethodID(clazz, "onAudioStateChanged", "(I[B)V"); + + method_onCheckConnectionPriority = + env->GetMethodID(clazz, "onCheckConnectionPriority", "([B)V"); /* if ( (btInf = getBluetoothInterface()) == NULL) { ALOGE("Bluetooth module is not loaded"); @@ -225,18 +253,30 @@ static jboolean disconnectA2dpNative(JNIEnv *env, jobject object, jbyteArray add } if ( (status = sBluetoothA2dpInterface->disconnect((bt_bdaddr_t *)addr)) != BT_STATUS_SUCCESS) { - ALOGE("Failed HF disconnection, status: %d", status); + ALOGE("Failed A2DP disconnection, status: %d", status); } env->ReleaseByteArrayElements(address, addr, 0); return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } +static void allowConnectionNative(JNIEnv *env, jobject object, int is_valid) { + + if (!sBluetoothA2dpInterface) { + ALOGE("sBluetoothA2dpInterface is NULL "); + return; + } + + sBluetoothA2dpInterface->allow_connection(is_valid); + +} + static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void *) classInitNative}, {"initNative", "()V", (void *) initNative}, {"cleanupNative", "()V", (void *) cleanupNative}, {"connectA2dpNative", "([B)Z", (void *) connectA2dpNative}, {"disconnectA2dpNative", "([B)Z", (void *) disconnectA2dpNative}, + {"allowConnectionNative", "(I)V", (void *) allowConnectionNative}, }; int register_com_android_bluetooth_a2dp(JNIEnv* env) diff --git a/jni/com_android_bluetooth_a2dp_sink.cpp b/jni/com_android_bluetooth_a2dp_sink.cpp index f2bbb1bc2..4bc03125b 100644 --- a/jni/com_android_bluetooth_a2dp_sink.cpp +++ b/jni/com_android_bluetooth_a2dp_sink.cpp @@ -29,6 +29,7 @@ namespace android { static jmethodID method_onConnectionStateChanged; static jmethodID method_onAudioStateChanged; static jmethodID method_onAudioConfigChanged; +static jmethodID method_onCheckConnectionPriority; static const btav_interface_t *sBluetoothA2dpInterface = NULL; static jobject mCallbacksObj = NULL; @@ -116,11 +117,33 @@ static void bta2dp_audio_config_callback(bt_bdaddr_t *bd_addr, uint32_t sample_r sCallbackEnv->DeleteLocalRef(addr); } +static void bta2dp_connection_priority_callback(bt_bdaddr_t* bd_addr) { + jbyteArray addr; + + ALOGI("%s", __FUNCTION__); + + if (!checkCallbackThread()) { \ + ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__); \ + return; \ + } + addr = sCallbackEnv->NewByteArray(sizeof(bt_bdaddr_t)); + if (!addr) { + ALOGE("Fail to new jbyteArray bd addr for connection state"); + checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); + return; + } + + sCallbackEnv->SetByteArrayRegion(addr, 0, sizeof(bt_bdaddr_t), (jbyte*) bd_addr); + sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onCheckConnectionPriority, addr); + checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); + sCallbackEnv->DeleteLocalRef(addr); +} static btav_callbacks_t sBluetoothA2dpCallbacks = { sizeof(sBluetoothA2dpCallbacks), bta2dp_connection_state_callback, bta2dp_audio_state_callback, - bta2dp_audio_config_callback + bta2dp_audio_config_callback, + bta2dp_connection_priority_callback }; static void classInitNative(JNIEnv* env, jclass clazz) { @@ -137,6 +160,9 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_onAudioConfigChanged = env->GetMethodID(clazz, "onAudioConfigChanged", "([BII)V"); + method_onCheckConnectionPriority = + env->GetMethodID(clazz, "onCheckConnectionPriority", "([B)V"); + ALOGI("%s: succeeds", __FUNCTION__); } diff --git a/jni/com_android_bluetooth_hfp.cpp b/jni/com_android_bluetooth_hfp.cpp index d9f7c7823..aebfcbb56 100644 --- a/jni/com_android_bluetooth_hfp.cpp +++ b/jni/com_android_bluetooth_hfp.cpp @@ -1,4 +1,7 @@ /* + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -485,6 +488,7 @@ static void initializeNative(JNIEnv *env, jobject object, jint max_hf_clients) { mCallbacksObj = env->NewGlobalRef(object); } + static void cleanupNative(JNIEnv *env, jobject object) { const bt_interface_t* btInf; bt_status_t status; @@ -819,6 +823,22 @@ static jboolean configureWBSNative(JNIEnv *env, jobject object, jbyteArray addre return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } +static jint getRemoteFeaturesNative(JNIEnv *env, jobject object, jbyteArray address) { + jbyte *addr; + jint ret = 0; + if (!sBluetoothHfpInterface) return ret; + + addr = env->GetByteArrayElements(address, NULL); + if (!addr) { + jniThrowIOException(env, EINVAL); + return ret; + } + + ret = sBluetoothHfpInterface->get_remote_features((bt_bdaddr_t *) addr); + ALOGI (" Remote supported Features : %d", ret); + env->ReleaseByteArrayElements(address, addr, 0); + return ret; +} static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void *) classInitNative}, @@ -839,6 +859,7 @@ static JNINativeMethod sMethods[] = { {"clccResponseNative", "(IIIIZLjava/lang/String;I[B)Z", (void *) clccResponseNative}, {"phoneStateChangeNative", "(IIILjava/lang/String;I)Z", (void *) phoneStateChangeNative}, {"configureWBSNative", "([BI)Z", (void *) configureWBSNative}, + {"getRemoteFeaturesNative", "([B)I", (void *) getRemoteFeaturesNative}, }; int register_com_android_bluetooth_hfp(JNIEnv* env) |