OSDN Git Service

android-x86/system-bt.git
5 years agoMerge "RootCanal: Add beacons by default"
Treehugger Robot [Wed, 3 Apr 2019 03:40:38 +0000 (03:40 +0000)]
Merge "RootCanal: Add beacons by default"

5 years agoMerge "packet: Add Packet classes and tests"
Treehugger Robot [Wed, 3 Apr 2019 01:01:06 +0000 (01:01 +0000)]
Merge "packet: Add Packet classes and tests"

5 years agopacket: Add Packet classes and tests
Myles Watson [Mon, 1 Apr 2019 20:21:25 +0000 (13:21 -0700)]
packet: Add Packet classes and tests

Test: atest bluetooth_test_gd
Change-Id: I8e124d5123cff3354f5c451b3806904a2d60b38d

5 years agoAdd service change handle for Hearing Aids
weichinweng [Wed, 20 Mar 2019 10:53:11 +0000 (18:53 +0800)]
Add service change handle for Hearing Aids

When receive service changed indication from Hearing Aid (which indicates
Hearing Aid service changed), it will refresh the hearing aid attribute
handle to ensure the attribute handle is correct.

Bug: 122008481
Test: 1.run unit test
2.After Pair old version FW HearingAid, Disconnect/Reconnect new version
FW HearingAId, then check whether HearingAid is working fine.
3.After Pair old version FW HearingAid, Bluetooth off/on to reconnect
new version FW HearingAId, then check whether HearingAid is working
fine.
Change-Id: I48eae10a3016429f35f4f904752be93bb419d515

5 years agoFix for GATT not returning disconnect callback.
Jakub Pawlowski [Tue, 2 Apr 2019 17:21:14 +0000 (19:21 +0200)]
Fix for GATT not returning disconnect callback.

Before recent refactor GATT was using the L2CAP layer to start LE
connections. Since the refactor, GATT talks directly to added
connection_manager, just like L2CAP.
L2CAP does have it's own timer for direct connections, that was
returning conneciton failure after timeout. After switching to
connection_manager, GATT no longer receives those callbacks.

This patch makes the connection_manager send the on_connection_timed_out
callback, and wire it to same handler that L2CAP layer was using before.

Test: unit tests added
Bug: 125553095
Change-Id: Iaf8be46fe8eed49f78ddbc6a2f3516bc8279e91f

5 years agoRootCanal: Add beacons by default
Myles Watson [Tue, 2 Apr 2019 20:57:46 +0000 (13:57 -0700)]
RootCanal: Add beacons by default

Bug: 129546852
Test: Scan for devices using RootCanal as the Bluetooth chip
Change-Id: Ia17535bffbcdde28db5120f99aad45a915f1a7ca

5 years agoMerge "Common: remove GD related stuff from common"
Treehugger Robot [Tue, 2 Apr 2019 20:07:54 +0000 (20:07 +0000)]
Merge "Common: remove GD related stuff from common"

5 years agoCommon: remove GD related stuff from common
Jack He [Mon, 1 Apr 2019 23:20:14 +0000 (16:20 -0700)]
Common: remove GD related stuff from common

* Remove reactor, thread, handler, alarm, repeating alarm from common/
  since they are already copied into gd/os
* Extract thread and alarm benchmarks into gd:bluetooth_benchmark_gd
* Enable host side unit tests for system/bt in TEST_MAPPING

Bug: 129537494
Test: run benchmark, run unit tests
Change-Id: Id5d7592067bab3275976dfc710e4d751c43b9df8

5 years agoAvoid using erase()d iterator
Greg Kaiser [Mon, 1 Apr 2019 13:47:23 +0000 (06:47 -0700)]
Avoid using erase()d iterator

After calling erase(it), 'it' is no longer valid and should not be
used as it was in the 'it++' of the 'for' loop.  We change to
update 'it' to the result of erase(), and only perform 'it++' if
we're not erasing it.

Test: TreeHugger
Change-Id: If7889fdca76a6883aeb4341be1a6fff466585e29

5 years agobtif_storage: Avoid extra std::string copies
Greg Kaiser [Tue, 26 Mar 2019 16:09:28 +0000 (09:09 -0700)]
btif_storage: Avoid extra std::string copies

When a function takes a const std::string reference for an
argument, it's inefficient to pass in std::string::c_str().

Test: TreeHugger
Change-Id: Ibd00c10a08ab853875fd16739bce5851f6b42639

5 years agoMerge "Fix use of uninitialised variable"
Yi Kong [Tue, 2 Apr 2019 08:04:02 +0000 (08:04 +0000)]
Merge "Fix use of uninitialised variable"

5 years agoMerge "Disable Link layer socket device test in rootcanal"
Treehugger Robot [Tue, 2 Apr 2019 04:14:33 +0000 (04:14 +0000)]
Merge "Disable Link layer socket device test in rootcanal"

5 years agoMerge "Revert "DO NOT MERGE Hearing Aid: Add JNI API for add/remove whitelist""
Weichin Weng [Tue, 2 Apr 2019 01:48:09 +0000 (01:48 +0000)]
Merge "Revert "DO NOT MERGE Hearing Aid: Add JNI API for add/remove whitelist""

5 years agoDisable Link layer socket device test in rootcanal
Hansong Zhang [Mon, 1 Apr 2019 23:33:52 +0000 (16:33 -0700)]
Disable Link layer socket device test in rootcanal

Test: presubmit
Bug: 129537494
Change-Id: I852da314ab65052a0e1a794f5faa9f21e1249efe

5 years agoMerge "Fix assert macro logical inversion"
Zach Johnson [Mon, 1 Apr 2019 20:12:03 +0000 (20:12 +0000)]
Merge "Fix assert macro logical inversion"

5 years agoFix assert macro logical inversion
Zach Johnson [Fri, 29 Mar 2019 19:45:50 +0000 (12:45 -0700)]
Fix assert macro logical inversion

Rename FATAL_WHEN to ASSERT and LOG_FATAL_WHEN to ASSERT_LOG

Test: atest
Change-Id: I0e6e15ce7cfbb89e76910181f164e8ff32abc033

5 years agoRevert "DO NOT MERGE Hearing Aid: Add JNI API for add/remove whitelist"
weichinweng [Fri, 29 Mar 2019 06:07:52 +0000 (14:07 +0800)]
Revert "DO NOT MERGE Hearing Aid: Add JNI API for add/remove whitelist"

This reverts commit d65f697c011cc6e5eaad767de3ec726cfd25b27f.
This CL is merge into AOSP in error due to the block copy from
pi-dev-plus-aosp

Test: run unit test
Change-Id: I9e206465e832d263084895b7c7b808df4573f986
Merged-In: Iab11567fa326b6837a621c1edc93e0eceb04ec43

5 years agoFix use of uninitialised variable
Yi Kong [Fri, 29 Mar 2019 23:15:50 +0000 (16:15 -0700)]
Fix use of uninitialised variable

The fallthrough code path on L264 does not initialise the type variable
but it is used on L270.

Test: m checkbuild
Bug: 129566813
Change-Id: I18eb3b9be1712bac844aeb804ab76b218580c4b6

5 years agoMerge "Fix potential null point dereference"
Hansong Zhang [Fri, 29 Mar 2019 15:55:25 +0000 (15:55 +0000)]
Merge "Fix potential null point dereference"

5 years agoFix potential null point dereference
Ted Wang [Fri, 29 Mar 2019 08:20:27 +0000 (16:20 +0800)]
Fix potential null point dereference

Use find() to check element in map to avoid unknow element been insert
into map causing null point dereference.

Bug: 121310341
Test: Manual connect/disconnect headset
Change-Id: If127086ec4beb9b735ef3c72456e8e2209826b57

5 years agoMerge changes Ice4cee21,I6e579811,Ieae0cb21
Zach Johnson [Fri, 29 Mar 2019 01:15:40 +0000 (01:15 +0000)]
Merge changes Ice4cee21,I6e579811,Ieae0cb21

* changes:
  RootCanal: Add more scripts
  RootCanal: Desktop simulation envrionment
  RootCanal: New Directory Structure

5 years agoMerge "Get gd os tests running on host"
Zach Johnson [Fri, 29 Mar 2019 00:37:33 +0000 (00:37 +0000)]
Merge "Get gd os tests running on host"

5 years agoRootCanal: Add more scripts
Myles Watson [Thu, 7 Feb 2019 23:21:25 +0000 (15:21 -0800)]
RootCanal: Add more scripts

Test: Connect to HCI sockets and LinkLayer sockets
Change-Id: Ice4cee21f295bbb3a3fe35cfe44073028e65d811

5 years agoRootCanal: Desktop simulation envrionment
Myles Watson [Wed, 13 Feb 2019 20:36:32 +0000 (12:36 -0800)]
RootCanal: Desktop simulation envrionment

Test: nativetest64/root-canal/root-canal [TEST_PORT] [HCI_PORT] [LINK_PORT]
      python scripts/test_channel.py

Change-Id: I6e57981182c392366d7d97249d837694b49dfa4e

5 years agoRootCanal: New Directory Structure
Myles Watson [Fri, 18 Jan 2019 19:42:33 +0000 (11:42 -0800)]
RootCanal: New Directory Structure

model/controller/ contains the simulated chip
model/devices/ contains simulated devices
model/setup/ contains the test model
packets/link_layer/ contains the fake LMP packets

Test: cts-verifier Insecure RFCOMM test
      LinkLayerPacketBuilderTest
      rootcanal-packets_test_host
Change-Id: Ieae0cb21f7d57c03797f800797cedae59dd70e49

5 years agoGet gd os tests running on host
Zach Johnson [Thu, 28 Mar 2019 02:15:38 +0000 (19:15 -0700)]
Get gd os tests running on host

* Run os tests on host
* Fix flaky hander clear test
* Move to linux_generic
* Remove dependency on libchrome
* Allow alarms to run on linux host where we can't get CAP_WAKE_ALARM

Test: atest bluetooth_gd_test_os
Change-Id: Ia95ce39169ac8c963052e3252e7b39ef32bd5bb1

5 years agoMerge "Run code coverage only on host target"
Treehugger Robot [Thu, 28 Mar 2019 21:42:33 +0000 (21:42 +0000)]
Merge "Run code coverage only on host target"

5 years agoRun code coverage only on host target
Hansong Zhang [Wed, 27 Mar 2019 22:49:13 +0000 (15:49 -0700)]
Run code coverage only on host target

Bug: 129421924
Test: run code coverage
Change-Id: I1dc681c72d8af29e43ccb1441ffd218059b8056c

5 years agoMerge "BQR: Fix for the issue that Bluetooth keeps on crashing if the controller...
Treehugger Robot [Thu, 28 Mar 2019 16:37:55 +0000 (16:37 +0000)]
Merge "BQR: Fix for the issue that Bluetooth keeps on crashing if the controller firmware does not support the BQR feature."

5 years agoMerge "Only use the new format in gd/"
Zach Johnson [Thu, 28 Mar 2019 03:09:39 +0000 (03:09 +0000)]
Merge "Only use the new format in gd/"

5 years agoMerge "Copy reactor classes to new directory"
Treehugger Robot [Wed, 27 Mar 2019 22:32:09 +0000 (22:32 +0000)]
Merge "Copy reactor classes to new directory"

5 years agoOnly use the new format in gd/
Myles Watson [Wed, 27 Mar 2019 22:26:49 +0000 (15:26 -0700)]
Only use the new format in gd/

Test: Upload a change with long lines
Change-Id: Iba4a08f9556219bfada9a13272463acbf7ddbdce

5 years agoMerge "A2DP: Initialize the UIPC HAL only when those binderized HALs are not enabled"
Treehugger Robot [Wed, 27 Mar 2019 21:07:29 +0000 (21:07 +0000)]
Merge "A2DP: Initialize the UIPC HAL only when those binderized HALs are not enabled"

5 years agoCopy reactor classes to new directory
Hansong Zhang [Tue, 19 Mar 2019 23:17:42 +0000 (16:17 -0700)]
Copy reactor classes to new directory

Test: compile and run unit test
Change-Id: Ie704bf6b80f24bcae86d557ca351a893dcf8bdfa

5 years agoMerge "Hearing aid: use new common/Timer"
Treehugger Robot [Wed, 27 Mar 2019 17:26:06 +0000 (17:26 +0000)]
Merge "Hearing aid: use new common/Timer"

5 years agoA2DP: Initialize the UIPC HAL only when those binderized HALs are not enabled
Cheney Ni [Wed, 27 Mar 2019 12:58:49 +0000 (20:58 +0800)]
A2DP: Initialize the UIPC HAL only when those binderized HALs are not enabled

When using BluetoothA2dp / BluetoothAudio HAL, the UIPC won't be used,
and is no need to do the initialization. If it is up, there will be an
uipc-main thread running, and we have to release by the UIPC_Close API
before the A2DP source restarting. If we are acquiring a new one before
released, some of its resource will be leaked, and causes the stack
abnormal.

Bug: 128256722
Test: Check uipc-main is running when using the legacy HAL only
Change-Id: Icc8ea102d29c92b58c77099979d17e85e5cb9a83

5 years agoAdd test about post/clear task from callback for handler
Chienyuan [Sat, 23 Mar 2019 00:12:52 +0000 (17:12 -0700)]
Add test about post/clear task from callback for handler

Test: sudo ./bluetooth_test_common
Change-Id: Ibbf8622a705d3523638ef6cc9e6a62130b877637

5 years agoHearing aid: use new common/Timer
Hansong Zhang [Thu, 21 Mar 2019 18:21:31 +0000 (11:21 -0700)]
Hearing aid: use new common/Timer

Previously osi/alarm cannot be cancelled or freed while in a callback.
Replace it with common/Timer. It's safe to be cancelled in a callback
and well tested.

Bug: 119533256
Test: manual
Change-Id: I73c7c98d683c85ec8f0f4256c3e4bccf3e11b56a

5 years agoMerge "Fallback to the legacy HAL when IBluetoothAudioProvidersFactory is unsupported"
Treehugger Robot [Fri, 22 Mar 2019 07:46:23 +0000 (07:46 +0000)]
Merge "Fallback to the legacy HAL when IBluetoothAudioProvidersFactory is unsupported"

5 years agoBQR: Fix for the issue that Bluetooth keeps on crashing if the
Ray Kuo [Thu, 21 Mar 2019 09:55:47 +0000 (17:55 +0800)]
BQR: Fix for the issue that Bluetooth keeps on crashing if the
controller firmware does not support the BQR feature.

Considering for the Treble case, it might upgrade the system image
only and the BQR feature will be enabled on a device whose Bluetooth
controller firmware does not support the BQR feature. The change is
not to crash the system if the controller firmware does not handle the
BQR VSC.

Bug: 129037162
Test: Enabled the BQR feature on the device whose Bluetooth controller
firmware does not support the BQR feature. The Bluetooth can be turned
on and works normally.

Change-Id: I6e9310a2b604679ba300e558ae4482887501e022

5 years agoMerge "Refine the log messages of audio_bluetooth_hal"
Treehugger Robot [Thu, 21 Mar 2019 02:03:49 +0000 (02:03 +0000)]
Merge "Refine the log messages of audio_bluetooth_hal"

5 years agoMerge "Add a workaround to play A2DP SBC Mono"
Treehugger Robot [Thu, 21 Mar 2019 02:03:11 +0000 (02:03 +0000)]
Merge "Add a workaround to play A2DP SBC Mono"

5 years agoMerge "Add event_value to BluetoothClassicPairingEventReported"
Treehugger Robot [Thu, 21 Mar 2019 00:33:08 +0000 (00:33 +0000)]
Merge "Add event_value to BluetoothClassicPairingEventReported"

5 years agoMerge "Use PLOG rather than LOG strerror(errno)."
Elliott Hughes [Wed, 20 Mar 2019 19:41:28 +0000 (19:41 +0000)]
Merge "Use PLOG rather than LOG strerror(errno)."

5 years agoRefine the log messages of audio_bluetooth_hal
Cheney Ni [Wed, 20 Mar 2019 11:53:35 +0000 (19:53 +0800)]
Refine the log messages of audio_bluetooth_hal

This CL follows the review suggestions at aosp/920718 and aosp/925233 to
refine logs.

Bug: none
Test: check logs manually
Change-Id: I3c57afaf6d416752687a7a697a310fe98c8ee495

5 years agoAdd a workaround to play A2DP SBC Mono
Cheney Ni [Mon, 11 Mar 2019 12:49:11 +0000 (20:49 +0800)]
Add a workaround to play A2DP SBC Mono

There is a similar WAR of aosp/522661 at A2DP legacy HAL. In order to
suport MONO channel mode, the PCM audio is pulled as STEREO and mixed
into MONO by the Bluetooth Audio HAL.

Test: Playing SBC mono with Headset
Bug: 127593318
Change-Id: I78f3973ba6c8c733dc18122288a915daed97be65

5 years agoAdd event_value to BluetoothClassicPairingEventReported
Jack He [Wed, 20 Mar 2019 11:04:36 +0000 (04:04 -0700)]
Add event_value to BluetoothClassicPairingEventReported

* Add an event_value field to log status value such as
 - encryption enabled state
 - simple pairing mode
 - secure connection host support
 - delete all flag
* Use the event_value field to log above information during
  classic pairing process instead

Bug: 128966402
Test: make
Change-Id: I2a87c3837754bfc5bcd55f72325400c428c2ca25

5 years agoFallback to the legacy HAL when IBluetoothAudioProvidersFactory is unsupported
Cheney Ni [Thu, 14 Mar 2019 12:58:59 +0000 (20:58 +0800)]
Fallback to the legacy HAL when IBluetoothAudioProvidersFactory is unsupported

Because the stack may run without the new BluetoothAudio HAL like GSI
under old devices, it will be nullptr to getService from the
IBluetoothAudioProvidersFactory in such condition. We take nullptr as
unsupported, and fallback to the legacy HAL.

Bug: 128419724
Test: Manually running A2DP and hearing aid with / without the HAL
Change-Id: I606abc3e5b63b7857c3307c879fd4cbe46dd05d9

5 years agoAdd Rx RSSI logs for Hearing Aids
Stanley Tng [Mon, 25 Feb 2019 20:05:22 +0000 (12:05 -0800)]
Add Rx RSSI logs for Hearing Aids

When there is a data buffer flush (which indicates data congestion),
the received RSSI will be queried for this connection multiple times and
logged in the dumpsys.

Bug: 124331686
Test: Manual test
Change-Id: I686f4e34bda3f8067b42d6b41ca8bf316a5bf6f1

5 years agoUse PLOG rather than LOG strerror(errno).
Elliott Hughes [Fri, 15 Mar 2019 03:22:17 +0000 (20:22 -0700)]
Use PLOG rather than LOG strerror(errno).

Test: builds
Change-Id: I75c3311ce00fccc79b8efc198ce69ffed96e805a

5 years agoMerge "Allow to disable the rootcanal test console with a property"
Jorge Moreira Broche [Thu, 14 Mar 2019 20:19:03 +0000 (20:19 +0000)]
Merge "Allow to disable the rootcanal test console with a property"

5 years agoMerge "No need to abort the audio HAL / Bluetooth when failed to suspend"
Treehugger Robot [Thu, 14 Mar 2019 18:08:12 +0000 (18:08 +0000)]
Merge "No need to abort the audio HAL / Bluetooth when failed to suspend"

5 years agoMerge "Move controller_properties.json to the vendor image"
Treehugger Robot [Thu, 14 Mar 2019 03:51:30 +0000 (03:51 +0000)]
Merge "Move controller_properties.json to the vendor image"

5 years agoMerge "compiler based array initialization"
Nick Kralevich [Wed, 13 Mar 2019 18:24:59 +0000 (18:24 +0000)]
Merge "compiler based array initialization"

5 years agoMerge "Recover from HandsFree client connection collision"
Joseph Pirozzo [Wed, 13 Mar 2019 16:04:19 +0000 (16:04 +0000)]
Merge "Recover from HandsFree client connection collision"

5 years agoNo need to abort the audio HAL / Bluetooth when failed to suspend
Cheney Ni [Thu, 7 Mar 2019 06:15:27 +0000 (14:15 +0800)]
No need to abort the audio HAL / Bluetooth when failed to suspend

When the headset was disconnecting, the audio HAL may not be able to
suspend the stream successfully, and it is no need to abort the process
for such acceptable failure. This change also adds extra log messages
about HIDL status.

Bug: 127654107
Test: Play / pause music via the Bluetooth manually
Change-Id: I335fcf75708343c7971ebd97514fea5db50f17a0

5 years agoMerge "Release encoder state when cleaning up the hearing aids instance"
Treehugger Robot [Wed, 13 Mar 2019 02:43:26 +0000 (02:43 +0000)]
Merge "Release encoder state when cleaning up the hearing aids instance"

5 years agoMerge "DO NOT MERGE - Merge PPRL.190305.001 into master"
Xin Li [Wed, 13 Mar 2019 02:26:03 +0000 (02:26 +0000)]
Merge "DO NOT MERGE - Merge PPRL.190305.001 into master"

5 years agoAllow to disable the rootcanal test console with a property
Jorge E. Moreira [Wed, 13 Mar 2019 00:41:11 +0000 (17:41 -0700)]
Allow to disable the rootcanal test console with a property

Rootcanal's test console is in a tcp socket which is forbiden for HALs
by the Android security policy.

Bug: 128355308
Test: run in cuttlefish, ensure no 'avc: denied' messages show up
Change-Id: I74bf07c34166d2df399f33194cbb41e57178edc2

5 years agoMove controller_properties.json to the vendor image
Jorge E. Moreira [Tue, 12 Mar 2019 22:16:42 +0000 (15:16 -0700)]
Move controller_properties.json to the vendor image

Bug: 128355308
Test: build
Change-Id: I3cb9140b34af18569a983122eef3bd642516440c

5 years agocompiler based array initialization
Nick Kralevich [Tue, 12 Mar 2019 20:19:02 +0000 (13:19 -0700)]
compiler based array initialization

Have the caller null out the array rather than rely on the callee
performing a memset.

Bug: 121194976
Test: compiles. No runtime tests performed.
Change-Id: I1ce3f0530080769b97be0af313e822b74fd375ce

5 years agoRecover from HandsFree client connection collision
Joseph Pirozzo [Tue, 12 Mar 2019 19:30:19 +0000 (12:30 -0700)]
Recover from HandsFree client connection collision

If a HF client fails to connect (due to collision), clean up state such
that subsequent connection attempts will pass.

Bug: 118422992
Test: Connect HF client to AG
Change-Id: I093cf3d229956c66d9e8501eb882071600321555

5 years agoRelease encoder state when cleaning up the hearing aids instance
Cheney Ni [Fri, 8 Mar 2019 15:41:42 +0000 (23:41 +0800)]
Release encoder state when cleaning up the hearing aids instance

When the Bluetooth state changes from ON to BLE_ON, the hearing aid
instance was cleaned up, but not encoder state. Since the Bluetooth
process is kept at BLE_ON but not exited, the new instance of the
hearing aids would see the encoder as initialized without starting a new
Bluetooth audio session, and caused the audio HAL to be unable to talk
to the stack. We now reset the encoder state when cleaning up the
instance, so it will start a session next time during the first
connection of a new hearing aid instance.

Bug: 127610666
Test: ON / OFF BT with BLE_ON and switch active device manually
Change-Id: I426fed4ea22c0b858bee273727fca6e2e7481e84

5 years agoMerge "Hearing Aid Dump Audio Tool: Add No Start Cmd feature"
Weichin Weng [Tue, 12 Mar 2019 06:12:19 +0000 (06:12 +0000)]
Merge "Hearing Aid Dump Audio Tool: Add No Start Cmd feature"

5 years agoDO NOT MERGE - Merge PPRL.190305.001 into master
The Android Open Source Project [Mon, 11 Mar 2019 18:55:08 +0000 (11:55 -0700)]
DO NOT MERGE - Merge PPRL.190305.001 into master

Bug: 127812889
Change-Id: I733a17b7dd1e24a6f4a19aac2d45e312b15e0199

5 years agoHearing Aid Dump Audio Tool: Add No Start Cmd feature
weichinweng [Thu, 7 Mar 2019 07:25:43 +0000 (15:25 +0800)]
Hearing Aid Dump Audio Tool: Add No Start Cmd feature

When the HCI Snoop logs wraparound, the Hearing Aid Audio Control
Command "Start" is lost. For the case, we can enable No Start Cmd
feature to set a fake "Start" to extract audio data.

Bug: 127745964
Test: ./dump_hearingaid_audio.py -c1 1 -c2 3 -ns true btsnoop_hci.log
Change-Id: Id7f67da0d5476faf38352ab57339fed8e358bac6

5 years agoMerge "Use a weak pointer to deliver updates to AVRCP devices."
Treehugger Robot [Sat, 9 Mar 2019 00:18:09 +0000 (00:18 +0000)]
Merge "Use a weak pointer to deliver updates to AVRCP devices."

5 years agoMerge "osi: explicitly release wakelock during turn off"
Treehugger Robot [Fri, 8 Mar 2019 22:11:05 +0000 (22:11 +0000)]
Merge "osi: explicitly release wakelock during turn off"

5 years agoSnap for 5240760 from b9dd3863033facdd8608904e4dd59ff3cc52871b to pi-platform-release
android-build-team Robot [Fri, 8 Mar 2019 18:50:37 +0000 (18:50 +0000)]
Snap for 5240760 from b9dd3863033facdd8608904e4dd59ff3cc52871b to pi-platform-release

Change-Id: I8098c6f610e684be5b84a984b163088d255420b8

5 years agoUse a weak pointer to deliver updates to AVRCP devices.
Ajay Panicker [Fri, 14 Dec 2018 22:55:02 +0000 (14:55 -0800)]
Use a weak pointer to deliver updates to AVRCP devices.

If a device disconnects right before a update message gets queued, the
device becomes null and there is a crash when the callback for the
update executes on the disconnected device. This patch switches the
device reference from being Unretained to using a weak pointer so that
the callback just doesn't execute if the device is disconnected.

Bug: 120431125
Test: Use the same test as b/120477414 as that bug causes a disconnect
at the same time as a media update.

Change-Id: I1dcc08e5c9866106e7ec0dad52505e34b42da600

5 years agoosi: explicitly release wakelock during turn off
Martin Brabham [Tue, 26 Feb 2019 22:54:58 +0000 (14:54 -0800)]
osi: explicitly release wakelock during turn off

Ensures we release the wakelock when turning off if any module hasn't stopped timers properly

Bug: 123289721
Test: atest net_test_bluetooth
Change-Id: Ibec5c262d2ec33ce22f2c8bb2a9b838e8d6b90a7

5 years agoAVRCP Controller Play Position Changed
Joseph Pirozzo [Thu, 7 Mar 2019 00:00:21 +0000 (16:00 -0800)]
AVRCP Controller Play Position Changed

Implement code to register for the AVRCP notification
EVENT_PLAYBACK_POS_CHANGED such that playback position gets update on
skip to beginning, and during audio scrubbing from phone.

Bug: 119119967
Test: Play music, scrub audio to another position on phone, observe
playback position is in sync.

Change-Id: Ib8459dece7629622649ba6ed340dcd697c700b09

5 years agoFix for connection attempt after connection cancel
Jakub Pawlowski [Wed, 6 Mar 2019 11:47:59 +0000 (12:47 +0100)]
Fix for connection attempt after connection cancel

When connection attempt is canceled, we put the transport control block
(p_tcb) into CLOSING state, but we never close or free it.
For LE devices that have not established the connection, it's safe to
go straight to CLOSED state and free the p_tcb.

This issue was introduced during connection manager refactor.

Bug: 127242749
Test: GattConnectTest
Change-Id: I8e45ead9b071c60e95d2e60dcea8afdbaefb92b1

5 years agoMerge "Clear the link key when releasing security records"
Jakub Pawlowski [Wed, 6 Mar 2019 06:40:54 +0000 (06:40 +0000)]
Merge "Clear the link key when releasing security records"

5 years agoMerge "Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails"
Treehugger Robot [Tue, 5 Mar 2019 20:57:51 +0000 (20:57 +0000)]
Merge "Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails"

5 years agoClear the link key when releasing security records
Jakub Pawlowski [Tue, 5 Mar 2019 11:10:02 +0000 (12:10 +0100)]
Clear the link key when releasing security records

Test: compilation
Bug: 127479372
Change-Id: Ia571a2048fa5ca85c45b03b39d398e480aadb55a

5 years agoAdd btm_free() to clean up btm properly
Fukai Wang [Wed, 26 Jul 2017 01:35:21 +0000 (09:35 +0800)]
Add btm_free() to clean up btm properly

Test: Run AdapterRepeatedEnableDisable in system/bt/test with
kTestRepeatCount set to 1000.

Change-Id: I6d6650e735697bf97098827b5a9d39552c6616d8

5 years agoFall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails
Alistair Strachan [Sat, 2 Mar 2019 01:45:09 +0000 (17:45 -0800)]
Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails

If the cuttlefish device does not have an rtc device (such as the crosvm
VMM) the bt osi layer can promote crashes due to it not being able to
create a CLOCK_BOOTTIME_ALARM timer. Bring back a fallback but enable it
at runtime instead of compile time.

Bug: 126955943
Test: run with cuttlefish
Change-Id: I3ab0282b3e8fde776aa7b37d5772c8f62cf957bf

5 years agoMerge "bta_jv_act: Avoid writing through NULL/freed pointer"
Treehugger Robot [Mon, 4 Mar 2019 18:49:24 +0000 (18:49 +0000)]
Merge "bta_jv_act: Avoid writing through NULL/freed pointer"

5 years agoMerge "bta_jv_act: Avoid potential NULL dereference"
Treehugger Robot [Mon, 4 Mar 2019 18:45:11 +0000 (18:45 +0000)]
Merge "bta_jv_act: Avoid potential NULL dereference"

5 years agoMerge "When stopping Hearing Aids, send Stop cmd to devices"
Treehugger Robot [Mon, 4 Mar 2019 16:20:17 +0000 (16:20 +0000)]
Merge "When stopping Hearing Aids, send Stop cmd to devices"

5 years agoWhen stopping Hearing Aids, send Stop cmd to devices
Stanley Tng [Sat, 2 Mar 2019 00:54:11 +0000 (16:54 -0800)]
When stopping Hearing Aids, send Stop cmd to devices

This fixes the bug where the Stop command is not send to the Hearing
Aids devices which switching audio away from Hearing Aid.

Bug: 126465843
Test: Manual switching between A2DP and Hearing Aids while
playing audio.

Change-Id: Ifd8eaed7496e7e16c3948683c518d7627824d3e8

5 years agoMerge "Reland BluetoothAudio HAL: flip to be enabled by default"
Treehugger Robot [Sat, 2 Mar 2019 00:37:41 +0000 (00:37 +0000)]
Merge "Reland BluetoothAudio HAL: flip to be enabled by default"

5 years agobta_jv_act: Avoid writing through NULL/freed pointer
Greg Kaiser [Fri, 1 Mar 2019 13:54:56 +0000 (05:54 -0800)]
bta_jv_act: Avoid writing through NULL/freed pointer

Before writing to 't->init_called', we know that 't' might be
NULL (there's an explicit check), so we add another check here
to assure it's not NULL.  Furthermore, we're possibly freeing
't' prior to writing to 't->init_called'.  So we set 't' NULL
in that case, so our new NULL check will let us avoid corrupting
memory we no longer own.

Test: TreeHugger
Change-Id: Iaa246d5190f5f99610dace24707e74a846df3cf3

5 years agobta_jv_act: Avoid potential NULL dereference
Greg Kaiser [Fri, 1 Mar 2019 13:34:26 +0000 (05:34 -0800)]
bta_jv_act: Avoid potential NULL dereference

When 'tc' is NULL (a condition we check for), 't' is never
set to a non-NULL value, yet is still dereferenced.  We move
our NULL check of 't' to make this code safe.

Test: TreeHugger
Change-Id: Ibfea74963dd763401ea18ccdd24a51ecd0baefc5

5 years agoMerge "Reland Start the media encoder for a successful BTA_AV_START_EVT"
Treehugger Robot [Fri, 1 Mar 2019 02:33:47 +0000 (02:33 +0000)]
Merge "Reland Start the media encoder for a successful BTA_AV_START_EVT"

5 years agoReland BluetoothAudio HAL: flip to be enabled by default
Cheney Ni [Sat, 23 Feb 2019 18:14:20 +0000 (02:14 +0800)]
Reland BluetoothAudio HAL: flip to be enabled by default

Bug: 126304229
Test: Switch BluetoothAudio HAL and A2DP offload manully
Change-Id: I936e6c9e9fa3e35508ec435dcff8fa54b3f4d883
Merged-In: I936e6c9e9fa3e35508ec435dcff8fa54b3f4d883

5 years agoReland Start the media encoder for a successful BTA_AV_START_EVT
Cheney Ni [Tue, 26 Feb 2019 03:56:25 +0000 (11:56 +0800)]
Reland Start the media encoder for a successful BTA_AV_START_EVT

When phone is A2DP source and receives BTA_AV_START_EVT, we need to
proceed to start the encoder of software or offload, and ack back to
audio HAL. When issue happened, the remote as the AVDTP_START initiator
triggered BTA_AV_START_EVT, and caused we did not start the encoder to
stream the audio. This change simplified the handler of BTA_AV_START_EVT
to always start the encoder for a successful event, and ack to audio HAL
if we are AVDTP initiator.

Bug: 126136429
Test: A2DP play and paused manually on Pixel 2 and Pixel 3
Change-Id: Ieb479fd6f42da1bf37f8f32af7794d86e04cac1b
Merged-In: Ieb479fd6f42da1bf37f8f32af7794d86e04cac1b

5 years agoMerge "Fix a bunch of incorrect syntax statements"
Yi Kong [Fri, 1 Mar 2019 00:30:53 +0000 (00:30 +0000)]
Merge "Fix a bunch of incorrect syntax statements"

5 years agoFix a bunch of incorrect syntax statements
Yi Kong [Fri, 1 Mar 2019 00:05:09 +0000 (16:05 -0800)]
Fix a bunch of incorrect syntax statements

Found by the upcoming compiler update.

Test: m checkbuild
Change-Id: Ieafcddde7c91de990aaf7bf42de58039ba5555cd

5 years agoMerge "Audio HAL: Check if ProviderFactory is null before printing debugging"
Sal Savage [Thu, 28 Feb 2019 19:09:49 +0000 (19:09 +0000)]
Merge "Audio HAL: Check if ProviderFactory is null before printing debugging"

5 years agoAudio HAL: Check if ProviderFactory is null before printing debugging
Sal Savage [Wed, 27 Feb 2019 20:23:07 +0000 (12:23 -0800)]
Audio HAL: Check if ProviderFactory is null before printing debugging

Test: Build and flash on auto hardware to make sure the error went away
Change-Id: I90a8f3a0e0cbc23e7e4a2edcead46402f44ef3a4

5 years agoReactor-based alarm implementation
Hansong Zhang [Wed, 12 Dec 2018 22:52:00 +0000 (14:52 -0800)]
Reactor-based alarm implementation

* Use Reactor+Thread (common/thread.h) to replace existing
  libchrome-based message_loop_thread
* Use Alarm/RepeatingAlarm to replace existing Timer, by using
  kernel-based timerfd, to make all components unified

Bug: 110303473
Test: run unit test, and run benchmark
Change-Id: I6d6bc8dc3897649d0f6cc00ce0aa7054a3ddc09d

5 years agoReactor-based threading model
Hansong Zhang [Wed, 12 Dec 2018 22:52:00 +0000 (14:52 -0800)]
Reactor-based threading model

* Use Reactor+Thread (common/thread.h) to replace existing
  libchrome-based message_loop_thread
* Use Handler to implement multiple message queue per thread, by using
  kernel-based eventfd

Test: run unit test, and run benchmark
Change-Id: Idd2e4ef99fb9a7b2c0956de0e372c67a1098f1b6

5 years agoMerge "clang: Set to 120 characters per line"
Treehugger Robot [Fri, 22 Feb 2019 06:41:12 +0000 (06:41 +0000)]
Merge "clang: Set to 120 characters per line"

5 years agoclang: Set to 120 characters per line
Hansong Zhang [Wed, 9 Jan 2019 03:39:22 +0000 (19:39 -0800)]
clang: Set to 120 characters per line

Modern terminals and text editors can display 120 characters

Test: compile
Change-Id: I799de73e622d045ba997e749eb15d5f786764fdd

5 years agoDon't require A2DP codec information when initialize audio_hal_interface
Cheney Ni [Thu, 21 Feb 2019 11:54:10 +0000 (19:54 +0800)]
Don't require A2DP codec information when initialize audio_hal_interface

Before set active device, it is normal that can't get the current codec
information, and will be setup later. If we query the codec and break
the init, it will cause the stack can't use Bluetooth Audio HAL for
A2DP, so remove here.

Bug: 125245738
Test: Connect / disconnect multiple A2DP manually when playing
Change-Id: Ic5493141cfba60115783c03fac4faf56a7a64b07

5 years agoFix crash when more than 2 PHYs specified for connection
Kim Schulz [Wed, 20 Feb 2019 15:33:38 +0000 (16:33 +0100)]
Fix crash when more than 2 PHYs specified for connection

Bug: 124793834
Change-Id: Ide304e22d4b390f252ba9577aeb5d9a67fa1a1cd

5 years agoMerge changes I58ceea50,I73319018
Treehugger Robot [Wed, 20 Feb 2019 17:30:52 +0000 (17:30 +0000)]
Merge changes I58ceea50,I73319018

* changes:
  Check A2DP UIPC state before feeding data
  Break the control early when the stream state of Bluetooth Audio changed

5 years agoCheck A2DP UIPC state before feeding data
Cheney Ni [Wed, 20 Feb 2019 13:41:33 +0000 (21:41 +0800)]
Check A2DP UIPC state before feeding data

When using the new Bluetooth Audio HAL, A2DP UIPC won't be initialized
and can't be accessed. This change checks the UIPC is valid before
accessing, and prevents unexpected SIGSEGV.

Bug: 124645960
Test: Start / pause A2DP manually
Change-Id: I58ceea503d0c159817167bb3ca3b99b6f933bf23