Commit graph

95 commits

Author SHA1 Message Date
Steven Moreland
0332b06972 Merge "Move bluetooth test to vendor." into oc-dev
am: 411268f5ae

Change-Id: I55ce093525f41a90ce6cfe6b24d1b8391fcaef18
2017-04-14 04:21:16 +00:00
Steven Moreland
2cfae52a2e Move bluetooth test to vendor.
The test is still built in data/nativetest64, but it must be marked as
vendor since it depends on vendor modules.

Also proprietary -> vendor.

Test: build with BOARD_VNDK_VERSION := current
Test: run test on internal marlin, passes
Bug: 33241851
Change-Id: I856838fe208a4cd038ea16d47f03f6278224b2ee
2017-04-13 14:20:18 -07:00
Steven Moreland
85d95ed55f bluetooth: include what you use
Helper libraries also now on vendor partition.

Test: links
Test: bluetooth works on internal Marlin
Bug: 33241851

(cherry picked from commit 96510c80f8)
Merged-In: Ie99faf9146ce2ce3df83a2b46acfaa36a54c16c2
Change-Id: Ie99faf9146ce2ce3df83a2b46acfaa36a54c16c2
2017-04-12 10:12:44 -07:00
Steven Moreland
96510c80f8 bluetooth: include what you use
Helper libraries also now on vendor partition.

Test: links
Test: bluetooth works on internal Marlin
Bug: 33241851

Change-Id: Ie99faf9146ce2ce3df83a2b46acfaa36a54c16c2
2017-04-12 17:12:03 +00:00
Joel Fernandes
cb6f47d0e0 Bluetooth HAL: Add to foreground schedtune group
EAS (Energy-Aware Scheduler) tends to cluster tasks together unless
they're marked to prefer an idle CPU (prefer-idle) during placement.
This is to save energy however it increases latencies. This is
noticeable when the Binder driver demotes the RT task to CFS and when
we try to do load balance in this path, the selection path still selects
a busy CPU. Add Bluetooth HAL service to the foreground schedtune group
to fix this as its critical for tasks like bluetooth audio playback.

Test: Boot and verify bluetooth HAL is in the foreground stune group
Bug: 36867985

Change-Id: Ib3c43cca4a2049af3700978b58a05989cc20b6ac
Signed-off-by: Joel Fernandes <joelaf@google.com>
(cherry picked from commit 1b8f6f7c77)
2017-04-05 09:47:49 -07:00
Joel Fernandes
1b8f6f7c77 Bluetooth HAL: Add to foreground schedtune group
EAS (Energy-Aware Scheduler) tends to cluster tasks together unless
they're marked to prefer an idle CPU (prefer-idle) during placement.
This is to save energy however it increases latencies. This is
noticeable when the Binder driver demotes the RT task to CFS and when
we try to do load balance in this path, the selection path still selects
a busy CPU. Add Bluetooth HAL service to the foreground schedtune group
to fix this as its critical for tasks like bluetooth audio playback.

Test: Boot and verify bluetooth HAL is in the foreground stune group
Bug: 36867985

Change-Id: Ib3c43cca4a2049af3700978b58a05989cc20b6ac
Signed-off-by: Joel Fernandes <joelaf@google.com>
2017-04-04 17:37:43 -07:00
Myles Watson
3561717e09 Bluetooth: Replace assert() with CHECK()
Test: Bluetooth starts/stops, VtsHalBluetoothV1_0TargetTest passes
Change-Id: I1ecdf4ed7507fc8e2f00c35f136cb13e145713e5
2017-03-30 16:25:51 +00:00
Myles Watson
9cec0e331a Bluetooth: Protect pointers and callbacks
Test: kill com.android.bluetooth
Bug: 36150800
Change-Id: I9533731c9ce3776c84e6c1d3fdf3e266b328a084
2017-03-22 21:30:40 +00:00
Treehugger Robot
e5796ef7a6 Merge "Bluetooth: Do not die quietly on binder death" 2017-03-19 23:45:58 +00:00
Andre Eisenbach
8a9efb6e35 Revert "Bluetooth: Don't disable LPM at power off"
Causes power regression on Angler.

This reverts commit 3b2a29676b.

Bug: 36358814
Bug: 36026072
Change-Id: I9bbe218a87c7d092851c400739bc5740bcf13336
2017-03-17 20:32:58 +00:00
Andre Eisenbach
9f8931cf47 Bluetooth: Do not die quietly on binder death
Log if the Bluetooth service has died.
Also check the return status for Bluetooth service binder callbacks to
avoid DEAD_OBJECT exception when com.android.bluetooth crashes.

Bug: 36026072
Test: unit tests; Bluetooth off/on/off; kill -6 com.android.bluetooth
Change-Id: Ia28e6777ee7b78f06db8d5214324e696441d00f7
2017-03-17 10:50:35 -07:00
Zach Johnson
fed25ad256 Fix MCT data transport for the BT HAL
The vendor open interface command returns the total number
of FDs opened. (2 or 4 if the interface is MCT)

However, the list of FDs is always 4 in either case. If the
open command returns 2, the FDs are shared cmd/event and
data in/out.

2 FDs example
[41, 41, 42, 42]

4 FDs example
[41, 42, 43, 44]

If we condition the registration of ACL_IN on the total
number of FDs, then 2 FD MCT interfaces will not get data.

Fixes: 36067612, 36035039, 36188793
Test: manual, pairing is quick and data does transfer
Change-Id: Icc8728239ba81426d5fc0e678c5c5480fd9b5081
2017-03-15 13:50:36 -07:00
Myles Watson
3b2a29676b Bluetooth: Don't disable LPM at power off
The power mode should be unimportant if power off succeeds.

Test: Switch users (Toggles Bluetooth under CPU load)
Bug: 36026072
Change-Id: I09fafe4d4f9a466a7e12e617925f98ef3805c738
2017-03-15 16:01:46 +00:00
Myles Watson
c0aee0ce87 Bluetooth: No power off before power on
Test: Switch users (toggles Bluetooth under load)
Bug: 36026072
Change-Id: I7eef35e19fbb4cf825c2583ec0af573733b24f9d
2017-03-13 20:29:07 +00:00
Myles Watson
66a4ca3c92 Bluetooth: Power off after closing the UART
Bug: 36084266
Test: angler & marlin switch users (Toggle Bluetooth under load)
Change-Id: I1e0c34e334d11b9dcf9df62cbde3d5556c537bd7
2017-03-10 09:27:23 -08:00
Myles Watson
9ef1f71982 Bluetooth: Protect callbacks during shutdown
- Hold the mutex during callbacks
- Disable power mode before deleting hci_

Bug: 36084266
Test: Switch users repeatedly (toggles Bluetooth)
Change-Id: I7e4d405e9028c3363c112a8b09c03b8aea652b7a
2017-03-09 12:12:45 -08:00
Steven Moreland
691a455b9f Add hidl_default and make modules use hidl_default.
find hardware/interfaces -type f -not -path "*/.git/*" \
-exec sed -i -e '/cc_[A-Za-z_]\+/ { N; s/$/\n    defaults:
\["hidl_defaults"\],/ }' {} \;
./hardware/interfaces/update-makefiles.sh

Test: no warnings
Bug: 35840847
Change-Id: I468b76893bf3f4b62ad610d1d9603bcb8797a702
2017-03-08 16:22:00 -08:00
Steven Moreland
90fc274838 bluetooth: remove warnings
Remove unused variables and commented out some unused APIs.

Test: pass
Change-Id: Ic191997d7db25277776417fd0069241ee01529e0
2017-03-08 16:21:35 -08:00
Zach Johnson
917efb1c0e Bring multi-channel transport into the glorious new age
Some devices still use MCT as their UART protocol, so
we need to bring it forward to the fresh new HAL.

Also, adding tests for H4 while I'm here.

Test: new unit tests pass and a device using MCT now
boots BT again \o/
Fixes: 34992730
Change-Id: Idb8e536a2779929ad8a0d4bac492c3011995cd79
2017-03-07 22:16:24 +00:00
Myles Watson
f3a3cb7a60 Bluetooth: Watch multiple FDs with AsyncFdWatcher
Test: AsyncFdWatcherSocketTest.WatchTwoFileDescriptors
Change-Id: I2444515541e9be01720341c693012a580b3cb04f
2017-03-04 00:40:14 +00:00
Steven Moreland
6ca34f1bf5 Bluetooth: move to vendor partition.
Bug: 35328775
Test: works in both binderized and passthrough modes
Merged-In: I18f21b53c2282e27342a58716475ae213a2837d4
Change-Id: I18f21b53c2282e27342a58716475ae213a2837d4
2017-02-28 01:34:46 +00:00
Steven Moreland
d28a3dce40 Remove viral dependency on libhwbinder.
find hardware/interfaces -name Android.mk -exec sed -i -e '/libhwbinder
\\/d' {} \;
find hardware/interfaces -name Android.bp -exec sed -i -e
'/"libhwbinder"/d' {} \;
./hardware/interfaces/update-makefiles.sh

Test: everything links
Test: (sanity) booted marlin on internal master with these changes
Bug: 35710429
Change-Id: I6b0b5ae318422b7a9be17a19a79e039ffc0f9272
2017-02-24 12:01:06 -08:00
Treehugger Robot
c4c2793b01 Merge "Bluetooth: Make HciPacketizer reusable" 2017-02-24 01:44:16 +00:00
Myles Watson
274a381d76 Bluetooth: Make HciPacketizer reusable
Test: VtsHalBluetoothV1_0TargetTest passes
Change-Id: I480d156225af2a5dd879f47a897af0b01dab5663
2017-02-23 15:54:21 -08:00
Martijn Coenen
09e49b0871 Merge "Bluetooth: deal with framework going away." 2017-02-23 19:35:30 +00:00
Martijn Coenen
678af7f5f8 Bluetooth: deal with framework going away.
Bug: 35624326
Test: Bluetooth HAL stays alive and works after com.android.bluetooth
is killed.

Change-Id: Id5b5a5b88cd35202e5737a0c99d28db9bebb4250
2017-02-23 18:49:39 +01:00
Myles Watson
5ea487bdce Bluetooth: Simplify started check
Test: Bluetooth starts/stops
Change-Id: Ib1777ac31d4a13d4221045fa3fa7d817a795f6f9
2017-02-22 14:46:14 +00:00
Myles Watson
be6176dded Bluetooth: Export AsyncFdWatcher for reuse
Test: Bluetooth starts/stops
Change-Id: I1dcd8684fd150b5eb27c75e5d7803070009e0bf5
2017-02-22 00:23:09 +00:00
Myles Watson
dbbdf3e5bc Bluetooth: Add CHECK and move ASSERT
Test: bluetooth_hidl_hal_test passes
Change-Id: Ib857265204d39ffb54afc6f589fdc1b852362a97
2017-02-13 19:54:54 +00:00
Andre Eisenbach
f60aeb4462 Bluetooth: Disable low power managerment on Hal->close()
This ensures the vendor library can release any wakelocks held and
perform any additional cleanup steps as necessary.

Change-Id: Ibfeac161109162ac375eef9c20f147f0506de602
Fixes: 35097918
Test: manual; disable Bluetooth, monitor wakelocks
2017-02-07 20:48:21 -08:00
Myles Watson
11f10baefe Bluetooth: Generate a random address
If a device does not have a factory address set, generate one.

Since this is a bug, add a warning.

Bug: 34952761
Test: Pixel C Bluetooth turns on and off
Change-Id: Icd2ef5c40f0ef6ad93effd9dd662b4b79d3eb0f6
2017-02-06 14:37:51 +00:00
Myles Watson
beb13b45c0 Bluetooth: Use AsyncFdWatcher for power management
Implement low power mode using timeouts from the interface.

Test: Boots, Bluetooth turns on/off,
      Instrumented bt_vendor library shows power management
      calls.
Change-Id: Ic4fcbb222f24b66c13f3797b14475d278c49fbc6
2017-02-02 22:15:56 +00:00
Myles Watson
eba1312c86 Bluetooth: AsyncFdWatcher: Refactor timeout lock
Allow timeouts to change the timeout.
Add a unit test for this.

Test: Unit tests pass, Bluetooth starts and stops.
Change-Id: I1be8a18dd74a312175ec9c27de37213272650e8e
2017-02-02 22:15:49 +00:00
Myles Watson
4e2e8ec4e0 Bluetooth: Free memory from transmit_cb commands
Test: Bluetooth starts and stops
Change-Id: I540fcc77f9bae0178db325b7014f2b839d4ad77d
2017-02-02 22:15:33 +00:00
Myles Watson
b43a5b2435 Bluetooth: Move AsyncFdWatcher tests to the device
Darwin builds were breaking.

Test: compile, unit tests pass
Change-Id: Ia00f590fe56211e25dff8d3138ebd93a306cf2c6
2017-01-31 12:20:44 -08:00
Myles Watson
7d42dcad6e Bluetooth: Add a timeout in async_fd_watcher
Add a timeout to the select call and a callback.
Add unit tests for async_fd_watcher.

Test: unit tests pass
Change-Id: I0076fd52e79aac0d2a9fcceb90aae318d5f0757b
2017-01-31 04:32:16 +00:00
Myles Watson
df765eab60 Bluetooth: Make Send() send a complete packet
Add the packet type to Send() so that it is called once per packet.

Test: Bluetooth starts/stops and scans
Change-Id: I2ef9c5f9a85d3227d4ff181b6a6931f239f75049
2017-01-31 00:36:48 +00:00
Myles Watson
a7d33b3636 Bluetooth: Check for waiting HAL callbacks
Test: Bluetooth boots, turns on/off
Change-Id: Iad2f359a78c9acbf0fe44740ed0813de462ce57c
2017-01-30 19:29:25 +00:00
Myles Watson
71390182c6 Bluetooth: Use fixed-size preambles
Test: Bluetooth turns on/off finds devices in Settings
Change-Id: Id640f3dbde3f53b31ce62eccf59bbc8d25130388
2017-01-30 19:27:40 +00:00
Myles Watson
8ffcbc7797 Bluetooth: Clean up some messages
Use Info for low-frequency messages.
Print hex for characters.

Test: Bluetooth turns on/off
Change-Id: If1fe20a71287cc91c2a7225488e5d44c7ee4ecee
2017-01-30 19:19:17 +00:00
Dan Albert
3d0263f0eb Include what you use.
Test: mm
Bug: http://b/34740564
Change-Id: I75cf88b79faf68764f1223e39595d0320d7b682a
2017-01-26 15:33:15 -08:00
Chris Phoenix
b5558e3de1 Bluetooth HAL uses "default" service name
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: builds; verify HAL still works

In support of b/33844934

Change-Id: Icc006a71b41bcd03fe4a04ee92503e76ff07cd77
2017-01-18 21:29:50 +00:00
Andre Eisenbach
9041d97812 bluetooth: Add initialization completed callback
Test: bluetooth_hidl_hal_test
Bug: 31972505
Change-Id: I64c19a7fe7299079c5daf74e7b238b0d71d65db2
2017-01-18 19:38:57 +00:00
Myles Watson
6a7d622264 bluetooth: Find the device's Bluetooth address
Test: bluetooth_hidl_hal_test
Change-Id: I5353aaef3f8c5db75e424a8e1b242b08d5a96c6e
2016-12-30 01:35:04 +00:00
Andre Eisenbach
89ba5284e3 Add default Bluetooth HAL implementation
Also added initial target-side functional test.

Test: bluetooth_hidl_hal_test
Bug: 31972505
Change-Id: I1f574a5b2b53d7fbf65dbb4e1aaa5f8b6c5a9448
2016-12-29 19:17:28 +00:00