OSDN Git Service

android-x86/system-bt.git
6 years agoMerge "PAN: Fix issues reported by Static Analysis Tool"
Treehugger Robot [Wed, 29 Nov 2017 00:51:41 +0000 (00:51 +0000)]
Merge "PAN: Fix issues reported by Static Analysis Tool"

6 years agoExport AIDL files as a filegroup framework.jar
Colin Cross [Tue, 14 Nov 2017 21:05:37 +0000 (13:05 -0800)]
Export AIDL files as a filegroup framework.jar

Put AIDL files into a filegroup so they can be imported as sources
for framework.jar.

Test: m checkbuild
Change-Id: Ie3ff041f58fb86c42e5c31b8bed7dfe2c2f9b6f2

6 years agobtif storage: use strings where possible
Jakub Pawlowski [Mon, 27 Nov 2017 19:20:02 +0000 (11:20 -0800)]
btif storage: use strings where possible

btif_config api used to accept "const char*" as parameter. After the
refactoring it started using std::string. Remove unnecessary ".c_str()"

Test: compilation
Bug: 67595284
Change-Id: I173bbffc98f4e1f2dd3db1ff6db5a27db9be8992

6 years agoSaving Bluetooth name to Max 248 character only.
Srinu Jella [Fri, 30 Dec 2016 10:20:48 +0000 (15:50 +0530)]
Saving Bluetooth name to Max 248 character only.

Steps:
1. Set the BT name more than 248 character using SDK API set_name.
2. Check the BT Name on bt_config.
3. Name should be also visible Setting Apps on Bluetooth.

Failure: BluetoothAdapterProperties and stack are not in sync.
Root Cause: No check for the Bluetooth name length.
We can handle in framework layer but now handling in Stack.

Fix: Check the length of Bluetooth Name before writing to the file.

Test: Application and Stack BD Name are in sync
Bug: 35126970

Change-Id: I856a66e863cec68bee38762903a0b762ab0626d2

6 years agoCorrectly handling bdaddr in function btif_storage_load_bonded_hid_info.
Yan Laijun [Wed, 7 Dec 2016 01:49:08 +0000 (09:49 +0800)]
Correctly handling bdaddr in function btif_storage_load_bonded_hid_info.

Correct the bdaddr param passed into function btif_storage_remove_hid_info.

Test: mm -j8
Change-Id: I9b7994982577d68d076a6429f97d66b3ea4c8ce4
Signed-off-by: Yan Laijun <yan-laijun@xiaomi.com>
6 years agoG.722 Codec for Hearing Aid
Jakub Pawlowski [Fri, 24 Nov 2017 23:19:54 +0000 (15:19 -0800)]
G.722 Codec for Hearing Aid

Test: compilation
Bug: 69623109
Change-Id: I4658167f50321b717295f48c8b0b66d50ffabefd

6 years agoPAN: Fix issues reported by Static Analysis Tool
Hemant Gupta [Tue, 28 Feb 2017 17:08:50 +0000 (22:38 +0530)]
PAN: Fix issues reported by Static Analysis Tool

Fix issues reported by Static Analysis Tool.

Test: builds, PAN functionality works fine

Bug: 35013844
Change-Id: I55e75fe5e522ab5c417557d4ef9a11723dfd0c3c

6 years agoBLE: Fix crash while starting advertising
Hemant Gupta [Wed, 22 Nov 2017 09:12:07 +0000 (14:42 +0530)]
BLE: Fix crash while starting advertising

Usecase:
1) BT on
2) Start LE Advertising from APP
3) BT Off
4) Repeat steps 1-3 multiple times

Expected Result:
No crash in BT, and BLE advertising can be started

Observed Result:
Crash in com.android.bluetooth with below signature

pid: 8313, tid: 8313, name: droid.bluetooth  >>> com.android.bluetooth <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:btm_ble_multi_adv.cc(992)] Check failed: instance.
'
    x0   0000000000000000  x1   0000000000002079  x2   0000000000000006  x3   0000000000000008
    x4   623a4c415441465b  x5   623a4c415441465b  x6   623a4c415441465b  x7   6d5f656c625f6d74
    x8   0000000000000083  x9   0823626ef495785d  x10  00000073b7b39a48  x11  0823626ef495785d
    x12  0823626ef495785d  x13  0000000000000020  x14  ffffffffffffffdf  x15  0000000000002079
    x16  00000073b5ce62e8  x17  00000073b5c79970  x18  0000000000004000  x19  0000000000002079
    x20  0000000000002079  x21  0000000000000000  x22  0000007398bde000  x23  0000007fd0809e88
    x24  00000073a3b4c860  x25  00000073a635b578  x26  0000007398e980cc  x27  0000007398e97fd3
    x28  0000007398cb5608  x29  0000007fd0809e30  x30  00000073b5c20594
    sp   0000007fd0809df0  pc   00000073b5c79978  pstate 0000000060000000
    v0   2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e  v1   0000007fd0809be00000676f6c62696c
    v2   00000002b71fc7400000000000000000  v3   80200800000000008020000000000000
    v4   80200800000000008020080280200802  v5   00000000000000000000000000000000
    v6   00000000000000000000000000000000  v7   80200802802008028020080280200802
    v8   00000000000000000000000000000000  v9   00000000000000000000000000000000
    v10  00000000000000000000000000000000  v11  00000000000000000000000000000000
    v12  00000000000000000000000000000000  v13  00000000000000000000000000000000
    v14  00000000000000000000000000000000  v15  00000000000000000000000000000000
    v16  40100401401004014010040140100401  v17  a0080000a00aa00aa800aaaaa800a000
    v18  80200800000000008020080280200802  v19  00000000000000000000000000000000
    v20  00000000000000000000000000000000  v21  00000000000000000000000000000000
    v22  00000000000000000000000000000000  v23  00000000000000000000000000000000
    v24  00000000000000000000000000000000  v25  00000000000000000000000000000000
    v26  00000000000000000000000000000000  v27  00000000000000000000000000000000
    v28  00000000000000000000000000000000  v29  00000000000000000000000000000000
    v30  00000000000000000000000000000000  v31  00000000000000000000000000000000
    fpsr 00000013  fpcr 00000000

backtrace:
    #00 pc 0000000000077978  /system/lib64/libc.so (tgkill+8)
    #01 pc 000000000001e590  /system/lib64/libc.so (abort+88)
    #02 pc 00000000000836dc  /system/lib64/libchrome.so (_ZN4base5debug13BreakDebuggerEv+20)
    #03 pc 000000000009bed0  /system/lib64/libchrome.so (_ZN7logging10LogMessageD2Ev+840)
    #04 pc 000000000015ed7c  /system/lib64/hw/bluetooth.default.so (_ZN21BleAdvertisingManager3GetEv+72)
    #05 pc 00000000000a7754  /system/lib64/hw/bluetooth.default.so (_ZN12_GLOBAL__N_126BleAdvertiserInterf
aceImpl19StartAdvertisingSetEN4base8CallbackIFvhahELNS1_8internal8CopyModeE1EEE19AdvertiseParametersNSt3
__16vectorIhNS8_9allocatorIhEEEESC_29PeriodicAdvertisingParametersSC_thNS2_IFvhhELS5_1EEE+332)
    #06 pc 000000000002a354  /system/lib64/libbluetooth_jni.so (_ZN7androidL25startAdvertisingSetNativeEP7_
JNIEnvP8_jobjectS3_P11_jbyteArrayS5_S3_S5_iii+1276)
    #07 pc 00000000005b2834  /data/dalvik-cache/arm64/system@app@Bluetooth@Bluetooth.apk@classes.dex (offset 0x2cd000)

Root Cause:
API calls in btif_ble_advertiser.cc donot check for initialization status of BleAdvertisingManager leading
to crash in scenarios when the BleAdvertisingManager is cleaned up during BT off and call reaches
btif_ble_advertiser.cc to do one ofadvertising related tasks.

Fix:
Add initialization check in code before call to API's for BleAdvertisingManager

Test: No crash observed after overnight testing with same usecase

Bug: 69692308
Change-Id: I5484734a4cf52858676981808c898ffec11e23f4

6 years agoMerge "Advertising device name truncated"
Treehugger Robot [Tue, 21 Nov 2017 18:34:22 +0000 (18:34 +0000)]
Merge "Advertising device name truncated"

6 years agoMerge "test_vendor: Make BtAddress comparisons const"
Treehugger Robot [Tue, 21 Nov 2017 02:39:34 +0000 (02:39 +0000)]
Merge "test_vendor: Make BtAddress comparisons const"

6 years agoUse -Werror in system/bt/binder
Chih-Hung Hsieh [Mon, 20 Nov 2017 18:25:49 +0000 (10:25 -0800)]
Use -Werror in system/bt/binder

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I68880c0c6d6e886b9d12482e97d35deea61cc5ab

6 years agoMerge "Removed unused or unnecessary defines"
Treehugger Robot [Mon, 20 Nov 2017 17:11:42 +0000 (17:11 +0000)]
Merge "Removed unused or unnecessary defines"

6 years agoFix broken PDK build, by disabling libbluetooth-binder during PDK build.
Daniel Cardenas [Sat, 18 Nov 2017 02:18:28 +0000 (18:18 -0800)]
Fix broken PDK build, by disabling libbluetooth-binder during PDK build.

Fixes: 69479982
Test: Build

Change-Id: Ie05c67e2b22c3f549239be1d7d6e9c3c22543498

6 years agoRemoved unused or unnecessary defines
Pavlin Radoslavov [Sat, 18 Nov 2017 00:23:16 +0000 (16:23 -0800)]
Removed unused or unnecessary defines

Removed the following defines because they are unused or unnecessary:
 - AVDT_REPORTING
 - AVRC_METADATA_INCLUDED
 - BTA_INCLUDED
 - SBC_FOR_EMBEDDED_LINUX
 - BTA_AVRCP_FF_RW_SUPPORT
 - GATT_DB_BUF_SIZE
 - BTM_DEFAULT_SCO_MODE
 - BTM_BLE_ADV_TX_POWER
 - BTM_BLE_ADV_TX_POWER_*
 - ATT_INCLUDED
 - ATT_DEBUG
 - GAP_TRANSPORT_SUPPORTED
 - GATTP_TRANSPORT_SUPPORTED
 - PORT_CREDIT_RX_MAX
 - PORT_CREDIT_RX_LOW
 - AVDT_INCLUDED
 - AVDT_REPORTING
 - HID_DEV_SUBCLASS
 - A2D_INCLUDED

Also:
 - Changed tBTA_AV_SCB field p_cap from dynamically allocated to
   inlined storage, and renamed it to peer_cap.
 - Removed unused typedef tBTM_BLE_ADV_TX_POWER

Test: Manual: streaming to Headset.
Change-Id: I0db18cc7ae3b9e692c71b430436f3170e8e4d65e

6 years agoRemove unnecessery re-defininitions of BTA_AV constants
Pavlin Radoslavov [Fri, 17 Nov 2017 10:31:30 +0000 (02:31 -0800)]
Remove unnecessery re-defininitions of BTA_AV constants

* Remove unused BTA_AV_* re-defenitions
* Replace remaining BTA_AV_* constants with the corresponding
  AVRC_* sonstant

Test: Code compilation
Change-Id: I4c7a04738bf41e661da15f3a86ea36974c391adf

6 years agotest_vendor: Make BtAddress comparisons const
Myles Watson [Wed, 15 Nov 2017 20:45:09 +0000 (12:45 -0800)]
test_vendor: Make BtAddress comparisons const

Test: build
Change-Id: Ifbafdb8792e4101974d01bb86d5c6188a88ef9f3

6 years agoMerge "Protect all SSR code with macro BTM_SSR_INCLUDED"
Treehugger Robot [Wed, 15 Nov 2017 14:18:04 +0000 (14:18 +0000)]
Merge "Protect all SSR code with macro BTM_SSR_INCLUDED"

6 years agoMerge "Change the connecting state to FALSE for BLE devices while releasing LCB"
Treehugger Robot [Wed, 15 Nov 2017 14:14:40 +0000 (14:14 +0000)]
Merge "Change the connecting state to FALSE for BLE devices while releasing LCB"

6 years agoMerge "Update the codec-related JNI calls to contain the remote Device address"
Treehugger Robot [Wed, 15 Nov 2017 03:14:28 +0000 (03:14 +0000)]
Merge "Update the codec-related JNI calls to contain the remote Device address"

6 years agoUpdate the codec-related JNI calls to contain the remote Device address
Pavlin Radoslavov [Fri, 10 Nov 2017 03:30:58 +0000 (19:30 -0800)]
Update the codec-related JNI calls to contain the remote Device address

Also, normalize the order of the A2DP-related JNI callbacks to
list the remote device address first.

Bug: 68993365
Test: Manual - A2DP streaming to headset
Change-Id: I17fc9b0c23d6a1c26c99259bf391ba0a94988dd6

6 years agoChange the connecting state to FALSE for BLE devices while releasing LCB
Albin Joy [Mon, 7 Aug 2017 11:14:30 +0000 (19:14 +0800)]
Change the connecting state to FALSE for BLE devices while releasing LCB

To reconnect a paired BLE device, the connecting stage should change to
FALSE when LCB is releasing. BLE device should be in connectable state to
connect the device next time.

BUG: 64432592
Test: reconnecting a paired BLE mouse failed randomly
Change-Id: I2c9016a267c9f5cd10d1eb05751eceb6046fbdb5

6 years agoAdvertising device name truncated
Dayananda V [Fri, 23 Jun 2017 04:58:01 +0000 (12:58 +0800)]
Advertising device name truncated

Some devices truncated name showing in
search list where name exceed 62 character.
Due to advertising data handle hardcoded
advertise data size.

Bug: 30622771
Test: sl4a FilteringTest
Change-Id: I2742ba2a40fa76fbeb975c29ed6426a0cca4a519

6 years agoBLE: Continue after list_remove in btm_consolidate_dev
Hemant Gupta [Thu, 9 Nov 2017 06:59:10 +0000 (12:29 +0530)]
BLE: Continue after list_remove in btm_consolidate_dev

Since p_dev_rec gets freed in list_remove, it should not be
accessed again in the same iteration.

Test: Code Review

Bug: 69237299
Change-Id: If7b12cb02fed8f03079c77cf9ea7e773c80cb340

6 years agoProtect all SSR code with macro BTM_SSR_INCLUDED
liuchao [Mon, 9 Oct 2017 03:15:26 +0000 (11:15 +0800)]
Protect all SSR code with macro BTM_SSR_INCLUDED

All the source code for Sniff Subrating should be protected
with macro BTM_SSR_INCLUDED to avoid compilation issues.

BUG: 64428859
Test: Compilation
Change-Id: Ic774c8fcab1b6fc08428bc4573314e8895ca1a7d

6 years agoAVRCP: Use avrc_send_continue_frag for continuations
Myles Watson [Mon, 13 Nov 2017 22:21:00 +0000 (14:21 -0800)]
AVRCP: Use avrc_send_continue_frag for continuations

Bug: 36067328
Test: Manual test with Android Auto and long songs
Change-Id: I62059e421046ed94eedc1f2d942a337fb413d6d8

6 years agoMove connectSocket into IBluetoothSocketManager (1/3)
Jakub Pawlowski [Mon, 6 Nov 2017 18:04:53 +0000 (10:04 -0800)]
Move connectSocket into IBluetoothSocketManager (1/3)

Bug: 68359837
Test: none
Change-Id: Ia2825e43036dcd50408987118e41c794f7b38d34
Merged-In: Ia2825e43036dcd50408987118e41c794f7b38d34

6 years agoMove createSocketChannel into IBluetoothSocketManager (1/3)
Jakub Pawlowski [Sat, 4 Nov 2017 02:29:12 +0000 (19:29 -0700)]
Move createSocketChannel into IBluetoothSocketManager (1/3)

Bug: 68359837
Test: none
Change-Id: Id01e194a265633f26b76fcc542223f7caacfc255

6 years agoMerge changes from topics "parcel_uuid_and_fd_native", "bluetooth_socket_manager_native"
Jakub Pawlowski [Thu, 9 Nov 2017 22:11:38 +0000 (22:11 +0000)]
Merge changes from topics "parcel_uuid_and_fd_native", "bluetooth_socket_manager_native"

* changes:
  Make ParcelUuid and ParcelFileDescriptor accesible to native Binder (1/2)
  Add IBluetoothSocketManager (1/3)

6 years agoBT: Use static lock to avoid race while cleanup
Gurpreet Ghai [Sun, 20 Aug 2017 08:52:27 +0000 (14:22 +0530)]
BT: Use static lock to avoid race while cleanup

Problem:
The functions protected by mutex lock are called after cleanup
during shutdown. During this race condition, the structure set does not
exist and cause crash.

Steps:
Bluetooth on/off automation

Failure:
Bluetooth process crashes

RootCause:
Mutex is accessed after it is destroyed because of other thread calling
the function.

Fix:
Changed mutex lock to static type so that it exist and protect
the set structure even after cleanup.

Test: manual

Bug: 66921327

Change-Id: I8d1f5d5d607100ab73aec722a27688dae45cc323

6 years agoMake ParcelUuid and ParcelFileDescriptor accesible to native Binder (1/2)
Jakub Pawlowski [Wed, 1 Nov 2017 21:31:03 +0000 (14:31 -0700)]
Make ParcelUuid and ParcelFileDescriptor accesible to native Binder (1/2)

Bug: 68359837
Test: compile
Change-Id: I9d5fc0684b0e8aefd3f3c1abe865d0d36cb712fb

6 years agoAdd IBluetoothSocketManager (1/3)
Jakub Pawlowski [Wed, 1 Nov 2017 17:02:28 +0000 (10:02 -0700)]
Add IBluetoothSocketManager (1/3)

Add IBluetoothSocketManager native Binder implementation. Thanks to it
we'll skip jni to native calls, and need to re-serialize data manually.

Bug: 68359837
Test: none
Change-Id: If0270ddc71df724e0ee25d6fb66d89b72aa3b160

6 years agoFix BTM callbacks so callee and caller types match
Vishwath Mohan [Thu, 9 Nov 2017 06:45:47 +0000 (22:45 -0800)]
Fix BTM callbacks so callee and caller types match

This CL fixes inconsistencies between the actual type of a callback
function, and the type assumed at the call site. This respects the
intended function signature.

For P, we plan to enable control-flow integrity (CFI) across multiple
platform components, including BT. This mismatch will break CFI and
cause runtime errors when enabled - so this is also a preemptive
measure to get BT compatible in preparation.

Bug: 30227045
Test: Builds and runs without errors when CFI is enabled.
Change-Id: I8970e6866d8b37a9adf5e040db993d30f1b5103a

6 years agoPrevent deadlock between the Tx and Rx threads in HCI layer
Luke Zhang [Wed, 27 Sep 2017 18:40:22 +0000 (11:40 -0700)]
Prevent deadlock between the Tx and Rx threads in HCI layer

Problem: Deadlock between HCI layer's Tx and Rx threads.

Cause: In HCI layer, both Tx and Rx tried to acquire
commands_pending_response_mutex simultaneously.
Since there may be a handshake between Tx and Rx
in the BT Transport layer, so it caused a deadlock between
HCI layer's Tx and Rx threads.

Fix: Fixed it by decreasing the scope of this mutex in Tx thread

Test: Simulated the deadlock sitaution and ensured RX thread is returned when TX is busy in binder.

Bug: 68305277
Change-Id: I0a2434ec24918b039a6993d57e68ac7495e31cbe

6 years agoRemove executable file mode bit from source code files
Pavlin Radoslavov [Mon, 6 Nov 2017 19:23:05 +0000 (11:23 -0800)]
Remove executable file mode bit from source code files

Test: Code compilation
Change-Id: I0933efbccfb066913eda05daa414a67b4fe3efba

6 years agoAdd libbluetooth-for-tests static library
Pavlin Radoslavov [Thu, 2 Nov 2017 21:27:09 +0000 (14:27 -0700)]
Add libbluetooth-for-tests static library

Add the most common dependencies to a static library
for building tests.

Bug: 68350333
Test: lunch gce_x86_pasan;
      SANITIZE_TARGET="address coverage" mma

Change-Id: I78e65a686873565d292ea0ad89047927ca6efb87

6 years agoRevert "btif: Simplify dependencies for btif_storage_test"
Myles Watson [Thu, 2 Nov 2017 21:47:20 +0000 (21:47 +0000)]
Revert "btif: Simplify dependencies for btif_storage_test"

This reverts commit c9026a03f4bf225ade0cb79e51385acb1201ba07.

Change-Id: Ie7527e8042d13cabd692a6929d902bc1efe009b6

6 years agoDon't notify legacy advertiser in master role.
Jakub Pawlowski [Wed, 1 Nov 2017 21:03:39 +0000 (14:03 -0700)]
Don't notify legacy advertiser in master role.

Legacy advertiser should be notified about connection success only
if we're the slave of connection.

Bug: 68712406
Test: bonding with device while using legacy advertising
Change-Id: I4790fb9c8a4f58ea76f6b28fd5384479f2fee0d8

6 years agoMerge "btif: Simplify dependencies for btif_storage_test"
Treehugger Robot [Tue, 31 Oct 2017 22:12:05 +0000 (22:12 +0000)]
Merge "btif: Simplify dependencies for btif_storage_test"

6 years agoMerge changes I7a3e9ee7,I29702219
Jakub Pawlowski [Tue, 31 Oct 2017 21:01:11 +0000 (21:01 +0000)]
Merge changes I7a3e9ee7,I29702219

* changes:
  Remove dead code - dump_bin
  Assert on null callback in BTA_JvL2capConnect and BTA_JvL2capConnectLE

6 years agobtif: Simplify dependencies for btif_storage_test
Myles Watson [Mon, 30 Oct 2017 23:00:56 +0000 (16:00 -0700)]
btif: Simplify dependencies for btif_storage_test

Bug: 68350333
Test: lunch gce_x86_pasan;
      SANITIZE_TARGET="address coverage" m net_test_btif

Change-Id: Ia87a4e3d224fcd7ddfa55bdcca391f9b262d50e5

6 years agoMerge "Add a workaround to play A2DP SBC Mono"
Treehugger Robot [Tue, 31 Oct 2017 19:25:40 +0000 (19:25 +0000)]
Merge "Add a workaround to play A2DP SBC Mono"

6 years agoAdd a workaround to play A2DP SBC Mono
Pavlin Radoslavov [Sun, 29 Oct 2017 18:35:22 +0000 (11:35 -0700)]
Add a workaround to play A2DP SBC Mono

The PCM audio is pulled as STEREO and mixed into MONO by the
Audio A2DP HAL.

Test: Playing SBC mono with Headset
Bug: 67763743
Change-Id: I2710a6633dd81c6917362ed6dd4af75a8d517b0a

6 years agoFix Bluetooth crash when pairing with 8th HOGP device
Ruina Liu [Mon, 11 Sep 2017 08:28:21 +0000 (16:28 +0800)]
Fix Bluetooth crash when pairing with 8th HOGP device

In function bta_hh_hdl_event, when handling with
the event of BTA_HH_API_GET_DSCP_EVT after bonded
with 8th HOGP device, no correct p_cb will be found,
due to mapping error between the device handle and
dev cb for HOGP. Then NPE happen.
Change to map le_cb_index into the device handle for
HOGP, so that HOGP and HID can be separately maintained
maximum to 14 device

Test: Pair with 14 HOGP devices
Change-Id: I8556f1ffea160862c2e52f874ef334f68c17050e

6 years agoRemove dead code - dump_bin
Jakub Pawlowski [Tue, 31 Oct 2017 05:02:41 +0000 (22:02 -0700)]
Remove dead code - dump_bin

Bug: 68359837
Test: compilation test
Change-Id: I7a3e9ee79da06753b329fcd13c6c8aa76bd6fa8f

6 years agoAssert on null callback in BTA_JvL2capConnect and BTA_JvL2capConnectLE
Jakub Pawlowski [Mon, 30 Oct 2017 19:38:30 +0000 (12:38 -0700)]
Assert on null callback in BTA_JvL2capConnect and BTA_JvL2capConnectLE

Passing null as callback should never happen in any scenario.

Bug: 68359837
Test: compilation test
Change-Id: I29702219183eae9d1782438f99d01534fbe44d73

6 years agoUse LOG macros in BTA JV
Jakub Pawlowski [Mon, 30 Oct 2017 17:41:06 +0000 (10:41 -0700)]
Use LOG macros in BTA JV

Bug: 68359837
Test: compilation test
Change-Id: Ic886f5979c40e49ad870b750dc0650a325153176

6 years agoUse Bind in BTA_JvDeleteRecord
Jakub Pawlowski [Fri, 27 Oct 2017 18:57:24 +0000 (11:57 -0700)]
Use Bind in BTA_JvDeleteRecord

Bug: 68359837
Test: compilation test
Change-Id: I23236fecf21ffb7808cfabef1570add2e07b0920

6 years agoGet rid of BTA_JV specific events
Jakub Pawlowski [Sat, 28 Oct 2017 02:48:25 +0000 (19:48 -0700)]
Get rid of BTA_JV specific events

Bug: 68359837
Test: compilation test
Change-Id: I4273bc1bed2cef676ab1ed026ac8a0fa3ffbada9

6 years agoUse Bind in BTA_JvCreateRecordByUser
Jakub Pawlowski [Fri, 27 Oct 2017 07:09:17 +0000 (00:09 -0700)]
Use Bind in BTA_JvCreateRecordByUser

Bug: 68359837
Test: compilation test
Change-Id: I889467b07694b16485a7541c4d9fdfa38a47e0be

6 years agoUse Bind in BTA_JvStartDiscovery
Jakub Pawlowski [Sat, 28 Oct 2017 02:29:01 +0000 (19:29 -0700)]
Use Bind in BTA_JvStartDiscovery

Bug: 68359837
Test: compilation test
Change-Id: I34279fb831ebc9dcf839f7c7339a50dda57a4246

6 years agoUse Bind in BTA_JvFreeChannel
Jakub Pawlowski [Fri, 27 Oct 2017 07:03:12 +0000 (00:03 -0700)]
Use Bind in BTA_JvFreeChannel

Bug: 68359837
Test: compilation test
Change-Id: I69fdbc9ea8510060736ae522baf865aa2d0c55f2

6 years agoGet rid of BTA_JV_API_PM_STATE_CHANGE_EVT
Jakub Pawlowski [Sat, 28 Oct 2017 02:04:25 +0000 (19:04 -0700)]
Get rid of BTA_JV_API_PM_STATE_CHANGE_EVT

Bug: 68359837
Test: compilation test
Change-Id: I0ad741b7491cbcf95b882d200e008da5026e0f60

6 years agoUse Bind in BTA_JvGetChannelId
Jakub Pawlowski [Fri, 27 Oct 2017 06:53:42 +0000 (23:53 -0700)]
Use Bind in BTA_JvGetChannelId

Bug: 68359837
Test: compilation test
Change-Id: I9da50222561da8410cdffa2e8b4c695cd2488841

6 years agoUse Bind in BTA_JvSetPmProfile
Jakub Pawlowski [Sat, 28 Oct 2017 01:55:48 +0000 (18:55 -0700)]
Use Bind in BTA_JvSetPmProfile

Bug: 68359837
Test: compilation test
Change-Id: I6ac2f5ab8061d7d7c65554172d7c0fc3cb703cc6

6 years agoUse Bind in BTA_JvDisable
Jakub Pawlowski [Fri, 27 Oct 2017 06:45:27 +0000 (23:45 -0700)]
Use Bind in BTA_JvDisable

Bug: 68359837
Test: compilation test
Change-Id: I73470c7a98a36a57d5f44decbbf388f02c6caddd

6 years agoUse Bind in BTA_JvRfcommWrite
Jakub Pawlowski [Sat, 28 Oct 2017 01:36:43 +0000 (18:36 -0700)]
Use Bind in BTA_JvRfcommWrite

Bug: 68359837
Test: compilation test
Change-Id: I73ba3a1c0b6fa3cbde8a4f2c3a4b378d5dcab0fe

6 years agoUse Bind in BTA_JvEnable
Jakub Pawlowski [Fri, 27 Oct 2017 06:32:49 +0000 (23:32 -0700)]
Use Bind in BTA_JvEnable

Bug: 68359837
Test: compilation test
Change-Id: I1913b7763c93932c59fe94c3a40293e02335afa2

6 years agoUse Bind in BTA_JvRfcommStartServer and BTA_JvRfcommStopServer
Jakub Pawlowski [Sat, 28 Oct 2017 01:15:15 +0000 (18:15 -0700)]
Use Bind in BTA_JvRfcommStartServer and BTA_JvRfcommStopServer

Bug: 68359837
Test: compilation test
Change-Id: I81ee51fc9bfce1ffb19621f5b4eab9028d089421

6 years agoUse Bind in BTA_JvRfcommClose
Jakub Pawlowski [Sat, 28 Oct 2017 01:01:54 +0000 (18:01 -0700)]
Use Bind in BTA_JvRfcommClose

Bug: 68359837
Test: compilation test
Change-Id: I867107dbf86a2a0fcb9232ce902d38345d04c444

6 years agoUse Bind in BTA_JvRfcommConnect
Jakub Pawlowski [Sat, 28 Oct 2017 00:52:01 +0000 (17:52 -0700)]
Use Bind in BTA_JvRfcommConnect

Bug: 68359837
Test: compilation test
Change-Id: I0e567cbe573c94574cc5f384cddf697dc2337109

6 years agoUse Bind in BTA_JvL2capRead
Jakub Pawlowski [Sat, 28 Oct 2017 00:39:02 +0000 (17:39 -0700)]
Use Bind in BTA_JvL2capRead

Bug: 68359837
Test: compilation test
Change-Id: I743e655acab6b57bb9d67e75b7a6d54d002568c6

6 years agoUse Bind in BTA_JvL2capWriteFixed
Jakub Pawlowski [Sat, 28 Oct 2017 00:29:04 +0000 (17:29 -0700)]
Use Bind in BTA_JvL2capWriteFixed

Bug: 68359837
Test: compilation testPlease enter the commit message for your changes. Lines starting
Change-Id: I4774fc9e4a7c7776a2d346613d1e0d5ea2e14b04

6 years agoUse Bind in BTA_JvL2capWrite
Jakub Pawlowski [Sat, 28 Oct 2017 00:20:24 +0000 (17:20 -0700)]
Use Bind in BTA_JvL2capWrite

Bug: 68359837
Test: compilation test
Change-Id: Iedd9ebb0f659d85f24ebe83eade50c7944212e7f

6 years agoUse Bind in BTA_JvL2capStopServerLE
Jakub Pawlowski [Fri, 27 Oct 2017 23:59:45 +0000 (16:59 -0700)]
Use Bind in BTA_JvL2capStopServerLE

Bug: 68359837
Test: compilation test
Change-Id: Ibba26fd62571e97f75502cd65240534ff6078e01

6 years agoUse Bind in BTA_JvL2capStopServer
Jakub Pawlowski [Fri, 27 Oct 2017 23:51:52 +0000 (16:51 -0700)]
Use Bind in BTA_JvL2capStopServer

Bug: 68359837
Test: compilation test
Change-Id: I25f718a943aabb5897145ec75a8e2b7b154cc2d4

6 years agoUse Bind in BTA_JvL2capStartServerLE
Jakub Pawlowski [Fri, 27 Oct 2017 23:45:13 +0000 (16:45 -0700)]
Use Bind in BTA_JvL2capStartServerLE

Bug: 68359837
Test: compilation test
Change-Id: I56717075758bc3f0fab5b092bd5fbc60b78a9a83

6 years agoUse Bind in BTA_JvL2capStartServer
Jakub Pawlowski [Fri, 27 Oct 2017 23:29:45 +0000 (16:29 -0700)]
Use Bind in BTA_JvL2capStartServer

Bug: 68359837
Test: compilation test
Change-Id: I0fb574e25c11f46a6fa68bef830a2e9fbcbd2d42

6 years agoUse Bind in BTA_JvL2capCloseLE
Jakub Pawlowski [Fri, 27 Oct 2017 23:09:20 +0000 (16:09 -0700)]
Use Bind in BTA_JvL2capCloseLE

Bug: 68359837
Test: compilation test
Change-Id: Ia9349c4f62fc515864518af3fd05e3f3af611cbf

6 years agoUse Bind in BTA_JvL2capClose
Jakub Pawlowski [Fri, 27 Oct 2017 20:28:23 +0000 (13:28 -0700)]
Use Bind in BTA_JvL2capClose

Bug: 68359837
Test: compilation test
Change-Id: Ia153dab61cb593b4319ffa718c691d5985e529e6

6 years agoUse Bind in BTA_JvL2capConnect
Jakub Pawlowski [Fri, 27 Oct 2017 20:15:47 +0000 (13:15 -0700)]
Use Bind in BTA_JvL2capConnect

Bug: 68359837
Test: compilation test
Change-Id: I0d6efdfefa12551c615bee5dd43a3101a5cac3d2

6 years agoUse Bind in BTA_JvL2capConnectLE
Jakub Pawlowski [Fri, 27 Oct 2017 19:33:58 +0000 (12:33 -0700)]
Use Bind in BTA_JvL2capConnectLE

Bug: 68359837
Test: compilation test
Change-Id: Iaef4695db6b46af59641d5af508b87f20bcf5232

6 years agoCorrect rssi size
Tiansong Cui [Fri, 27 Oct 2017 21:24:15 +0000 (14:24 -0700)]
Correct rssi size

Bug: None
Test: print rssi, size of rssi equals sizeof(int8_t).
Change-Id: I40edb63257618c48b0ab2d0181105c5a2c473ea6

6 years agoMerge "test_vendor: Extract DeviceProperties"
Treehugger Robot [Fri, 27 Oct 2017 16:30:20 +0000 (16:30 +0000)]
Merge "test_vendor: Extract DeviceProperties"

6 years agoFix addr_type overriding by btm_ble_process_adv_addr().
Jacky Cheung [Thu, 26 Oct 2017 23:07:36 +0000 (16:07 -0700)]
Fix addr_type overriding by btm_ble_process_adv_addr().

Bug: 67042709
Test: manual

Change-Id: Iedffe2fa3dcb3f4e600626490b95c27d1535a737

6 years agoMerge "Revert "Build only for current architecture by default""
Treehugger Robot [Fri, 27 Oct 2017 01:12:39 +0000 (01:12 +0000)]
Merge "Revert "Build only for current architecture by default""

6 years agoMerge "Respect AVRCP versions in SDP records"
Treehugger Robot [Fri, 27 Oct 2017 00:08:34 +0000 (00:08 +0000)]
Merge "Respect AVRCP versions in SDP records"

6 years agoRevert "Build only for current architecture by default"
Pavlin Radoslavov [Thu, 26 Oct 2017 23:36:30 +0000 (23:36 +0000)]
Revert "Build only for current architecture by default"

This reverts commit 862095819ffac9e5e543c114b6f0d4a7d89f6938.

The result audio.a2dp.default.so shared library is only 64-bit,
and it can't be used by the audioserver which is still 32-bit only

Bug: 68127690
Change-Id: I60b15c32425db3b2ada687fa8d0dcb728cf1812f
Test: A2DP streaming

6 years agoRespect AVRCP versions in SDP records
Zach Johnson [Wed, 18 Oct 2017 22:39:51 +0000 (15:39 -0700)]
Respect AVRCP versions in SDP records

It's all wrong. All wrong.

In the protocol descriptor list in SDP:
1.3 reports 1.2
1.4 reports 1.3
1.5 reports 1.4
1.6 reports 1.4
1.6.1 reports 1.4

wtf

Simplify as:
  1.3 to 1.5 report (version - 1),
  everything else reports 1.4

Bug: 66842069
Test: inspect SDP records with tool
Change-Id: I8c3912281a7c01b9f43be1a2c2cc59263e98a0a6

6 years agoTypes should always be a static library
Jakub Pawlowski [Wed, 25 Oct 2017 22:30:54 +0000 (15:30 -0700)]
Types should always be a static library

Test: compilation
Change-Id: I524ef23963f68573352fc5ae8c610a12fc65c822

6 years agoMerge "AAC support for A2DP sink"
Treehugger Robot [Thu, 26 Oct 2017 06:05:23 +0000 (06:05 +0000)]
Merge "AAC support for A2DP sink"

6 years agoMerge "Use C++11 static assert instead of macro"
Treehugger Robot [Thu, 26 Oct 2017 05:52:41 +0000 (05:52 +0000)]
Merge "Use C++11 static assert instead of macro"

6 years agoAAC support for A2DP sink
Bailey Forrest [Fri, 16 Jun 2017 22:38:03 +0000 (15:38 -0700)]
AAC support for A2DP sink

Bug: 37562860
Test: Test on device.
Change-Id: Ic8699e5ffa5f97e102ec4b9fc63ce5afd3382c5d

6 years agoDon't print error message when rename operation is successful
Tobias Melin [Fri, 18 Aug 2017 11:18:54 +0000 (13:18 +0200)]
Don't print error message when rename operation is successful

Bug: 65355196
Change-Id: I34504175a58d93f0dd71a8a51275818ebace4b6a

6 years agoUse C++11 static assert instead of macro
Jack He [Wed, 25 Oct 2017 23:46:42 +0000 (16:46 -0700)]
Use C++11 static assert instead of macro

Test: host and device unit tests
Change-Id: Iab56242aff6e427124c1ce3f6218ba81c2f95f7c

6 years agoMerge "Don't use a pointer for the A2DP Sink static mutex"
Treehugger Robot [Wed, 25 Oct 2017 21:00:48 +0000 (21:00 +0000)]
Merge "Don't use a pointer for the A2DP Sink static mutex"

6 years agoDon't use a pointer for the A2DP Sink static mutex
Pavlin Radoslavov [Wed, 25 Oct 2017 18:40:27 +0000 (11:40 -0700)]
Don't use a pointer for the A2DP Sink static mutex

The A2DP Sink cleanup might be called even if A2DP Sink init wasn't called
before, hence the g_mutex local pointer might be null.
We cannot check whether the pointer is null, because the A2DP Sink init
and cleanup operations are not executed on the same thread.

Bug: 68255348
Test: Manual
Change-Id: I9881ada0c4d01192352621ca5fe024f0e8b0ef76

6 years agoHost test script should return 1 when build fails or test is missing
Jack He [Wed, 25 Oct 2017 17:14:53 +0000 (10:14 -0700)]
Host test script should return 1 when build fails or test is missing

* test/run_host_unit_tests.py returns 1 when
  - Build environement could not be setup
  - Build fails
  - Test could not be found
* It returns 0 when
  - Test exists, but failed
  - All tests pass

Bug: 64687730
Test: ./test/run_host_unit_tests.py -j40
Change-Id: Idbff0c73a219b5ce7b640f44f41caf43030e2b51

6 years agoFix race conditions in a2dp sink
Bailey Forrest [Wed, 7 Jun 2017 21:55:37 +0000 (14:55 -0700)]
Fix race conditions in a2dp sink

- Use std::atomic for btif_a2dp_sink_state variable
- Add a lock for other static members

Explanation:
- There's the main thread that things on this file should run on:
  btif_a2dp_sink_cb.worker_thread
- External callers may call from any thread.
- fixed_queue_t is a thread safe queue which uses locking.

Many of the functions just append commands to cmd_msg_queue which are
commands which are processed by btif_a2dp_sink_command_ready. Operations
on this queue can be done without locking.

The main bug is a TOCTOU bug on 'rx_audio_queue'.

btif_a2dp_sink_avk_handle_timer preforms a fixed_queue_try_peek_first
operation and modifies the pointer without dequing it. This causes a
race when other operations cause a dequeue on rx_audio_queue.

I have added locks on all functions which modify the static data except:
- Helpers which are only called while locked
- Functions which only modify cmd_msg_queue or access
  btif_a2dp_sink_state

Bug: 35807779
Test: Test on device.
Change-Id: I289e23213426dbc182ca4a3fca26bc5658299381

6 years agotest_vendor: Extract DeviceProperties
Myles Watson [Fri, 20 Oct 2017 16:46:59 +0000 (09:46 -0700)]
test_vendor: Extract DeviceProperties

Test: start/stop Bluetooth with rootcanal loaded
Change-Id: Ic3dd1c87df9583c4b5957592bca3332f2daaa3da

6 years agoRemove aliase name while removing bonded device
liuchao [Tue, 24 Oct 2017 17:51:31 +0000 (17:51 +0000)]
Remove aliase name while removing bonded device
am: ce7c3c045f

Change-Id: I705eaaed0caaa82671c57d624932110eb4262cc0

6 years agoRemove aliase name while removing bonded device
liuchao [Wed, 12 Apr 2017 02:23:00 +0000 (10:23 +0800)]
Remove aliase name while removing bonded device

when remove a bonded device, the date in bt_config.conf
is deleted but only removed linkey in the global cache.
The user set alise name is left there

When comes to next time search ,the linkey is set to
config and write to bt_config.conf, before OFF/ON BT
operation, the cached alse name is reported unexceptedly

After remove,the remote device is expected to be brand
new to the phone in the 2nd time they see each other.

Test: mm -j8
Change-Id: I005a6487c546e2639e3180e8a6e181c4d3c1d4ac

6 years agoGet Bluetooth Class of Device
Pulkit Bhuwalka [Tue, 24 Oct 2017 06:27:46 +0000 (06:27 +0000)]
Get Bluetooth Class of Device
am: c5ed99ea41

Change-Id: I116fd9e1e74f10d8b51d41a058982add301c289e

6 years agoGet Bluetooth Class of Device
Pulkit Bhuwalka [Wed, 20 Sep 2017 22:11:01 +0000 (15:11 -0700)]
Get Bluetooth Class of Device

Modifies the native Bluetooth stack to
 1) return default value from BTA_DM_COD configuration when not set, and
 2) return adapter COD value even before stack start for Java Android
 stack.

Bug: 36015415
Test: Verified fetching of COD both before and after modification of
CoD value and restart of machine.

Change-Id: Ibcf726dcd7bea5d7e27c7a775f8cf7ea3f9e4107

6 years agoTEST: Fix host native test script
Jack He [Tue, 24 Oct 2017 03:29:10 +0000 (03:29 +0000)]
TEST: Fix host native test script
am: 39555a3f0a

Change-Id: I71ad38d426e69e6ff7edead0ea9f08db9d2da8fe

6 years agoTEST: Fix host native test script
Jack He [Mon, 23 Oct 2017 20:28:59 +0000 (13:28 -0700)]
TEST: Fix host native test script

* Use build/soong/soong_ui.bash to get needed environment variables
  instead of getting them directly from the parent shell
* Simplify the build command use to 'soong_ui.bash' directly so that
  we can remove the call to envsetup
* When ANDROID_BUILD_TOP is not set, try finding it by looking for
  build/soong/soong_ui.bash in all parent directories until found,
  and get TOP variable from it
* Similarly, for ANDROID_HOST_OUT, use the same soong_ui.bash script to
  get it, instead of relying on the environment variable
* Also fixed a bug in test log output by prepending DIST_DIR to the
  output file path so that it can be grabbed by the server

Bug: 64687730
Test: run run_host_unit_tests script in both
        1) vanilla environment without envsetup and lunch
        2) fulled setup and lunched environemt
      to verify
        1) If nothing is setup, the script picks a default environment
2) If envirnoment is already setup, use existing environment
   instead of creating new one

Change-Id: Ife28db509fe9af55cef26c7b480196efae39d3aa

6 years agoMake copyright headers consistent with Google template; remove "(C)"
Jakub Pawlowski [Tue, 24 Oct 2017 00:47:17 +0000 (00:47 +0000)]
Make copyright headers consistent with Google template; remove "(C)"
am: 5b790feeeb

Change-Id: I2caaf1d1455140ff0e2439584f2275c5ad0bb6e3

6 years agoMake copyright headers consistent with Google template; remove "(C)"
Jakub Pawlowski [Mon, 18 Sep 2017 16:00:20 +0000 (09:00 -0700)]
Make copyright headers consistent with Google template; remove "(C)"

Test: Comment changes only; still compiles...
Change-Id: Id699a8170112f06e4a2c9f2e0f0834d1817ace4e

6 years agoMerge "GATT discovery refactor"
Jakub Pawlowski [Mon, 23 Oct 2017 22:43:21 +0000 (22:43 +0000)]
Merge "GATT discovery refactor"
am: ac1f273024

Change-Id: Idbf9d442d70b5a4676a9bdc313b1c48ba5d0d648

6 years agoMerge "GATT discovery refactor"
Treehugger Robot [Mon, 23 Oct 2017 22:36:34 +0000 (22:36 +0000)]
Merge "GATT discovery refactor"

6 years agoChange Bluetooth HID Profile Name (3/6)
Hansong Zhang [Mon, 23 Oct 2017 22:35:06 +0000 (22:35 +0000)]
Change Bluetooth HID Profile Name (3/6)
am: bb3d9f7e92

Change-Id: I51e348da5f5aa2beb8be001c39c52c3b9f5eae0a