OSDN Git Service

android-x86/system-bt.git
5 years agoMerge "Flush buffer to filesystem before fsync"
Joseph Pirozzo [Wed, 13 Feb 2019 20:07:41 +0000 (20:07 +0000)]
Merge "Flush buffer to filesystem before fsync"

5 years agoFlush buffer to filesystem before fsync
Joseph Pirozzo [Fri, 8 Feb 2019 21:38:27 +0000 (13:38 -0800)]
Flush buffer to filesystem before fsync

If power is lost immediately after updating a config file it is possible
to save an empty file in its place.  By flushing the stream buffer to
the filesystem before flushing the filesystem to the disk this risk is
mitigated;

Bug: 122607444
Test: Update Bluetooth Device name and interrupt power to device.
Change-Id: Iaf89c4d9c594e925507e713a9febbf23a7cdae43

5 years agoMerge "Metrics: Log manfuacturer information from Device ID profile to statsd"
Treehugger Robot [Sat, 9 Feb 2019 09:29:24 +0000 (09:29 +0000)]
Merge "Metrics: Log manfuacturer information from Device ID profile to statsd"

5 years agoMerge "Metrics: Log L2CAP and RFCOMM socket connection state changes to statsd"
Treehugger Robot [Sat, 9 Feb 2019 04:09:45 +0000 (04:09 +0000)]
Merge "Metrics: Log L2CAP and RFCOMM socket connection state changes to statsd"

5 years agoMetrics: Log manfuacturer information from Device ID profile to statsd
Jack He [Thu, 7 Feb 2019 05:53:41 +0000 (21:53 -0800)]
Metrics: Log manfuacturer information from Device ID profile to statsd

Bug: 112969790
Test: make, test drive with statsd
Change-Id: Ie22aaad07037f97017186ad1f1d9ad124e4756c0

5 years agoMetrics: Log L2CAP and RFCOMM socket connection state changes to statsd
Jack He [Thu, 7 Feb 2019 04:24:24 +0000 (20:24 -0800)]
Metrics: Log L2CAP and RFCOMM socket connection state changes to statsd

* Log L2CAP LE Coc, L2CAP BREDR, and RFCOMM socket connection state
  changes, including port number, socket type, connection states,
  number of bytes sent and received, server port number, uid of socket
  owner
* Address is empty if this is a server port

Bug: 112969790
Test: make, test drive with statsd
Change-Id: Ic0ee93a6d9e4fa4109ddb89dea5e92907c49f2fc

5 years agoUpdate owners
Zach Johnson [Thu, 7 Feb 2019 23:08:57 +0000 (15:08 -0800)]
Update owners

remove folks not on team anymore, add new folks

Change-Id: Ib5834ecb068b8149b8b8f53373100786d4533ea0

5 years agoMerge "Add a ClassOfDevice type"
Treehugger Robot [Thu, 7 Feb 2019 04:04:02 +0000 (04:04 +0000)]
Merge "Add a ClassOfDevice type"

5 years agoMerge "Add audio channel of Bluetooth Audio Hal v2 for Hearing Aid"
Treehugger Robot [Thu, 7 Feb 2019 03:39:00 +0000 (03:39 +0000)]
Merge "Add audio channel of Bluetooth Audio Hal v2 for Hearing Aid"

5 years agoMerge "Metrics: Log SDP attributes to statsd"
Treehugger Robot [Thu, 7 Feb 2019 03:35:01 +0000 (03:35 +0000)]
Merge "Metrics: Log SDP attributes to statsd"

5 years agoMetrics: Log SDP attributes to statsd
Jack He [Sat, 2 Feb 2019 02:30:21 +0000 (18:30 -0800)]
Metrics: Log SDP attributes to statsd

* Log ProtocolDescriptorList's protocol version field to statsd
* Log BluetoothProfileDescriptorList's profile version field to statsd
* Log SupportedFeatures for A2DP, HFP, AVRCP, PBAP, MAP to statsd
* Log SDP metrics before we disconnect from L2CAP during SDP discovery
* Values are logged in small endian array
* Do this logging before we declare an SDP search is done

Bug: 112969790
Test: make, test drive with statsd
Change-Id: Idd340e495ecb85abc27de2b2d71305ee5218b43c

5 years agoAdd audio channel of Bluetooth Audio Hal v2 for Hearing Aid
Cheney Ni [Wed, 12 Dec 2018 12:20:28 +0000 (20:20 +0800)]
Add audio channel of Bluetooth Audio Hal v2 for Hearing Aid

This brings a new interface for Hearing Aid to communicate with audio.
Both audio control and data path go through the new Bluetooth audio
HAL and is similar to A2DP usecase. It initials this interface of client
side and get audio provider at setup and manage session with audio hal.

There is a system property to switch between the UIPC socket and the
Bluetooth Audio Hal v2 interface:
    persist.bluetooth.bluetooth_audio_hal.enabled

Bug: 111519504
Bug: 120222104
Test: manual test with Hearing Aid
TODO: Pass audio matadata into Hearing Aid service

Change-Id: I648775d61a8a4fe4fa680dd31ffc39fc89267c06

5 years agoMerge "Add stack side interface for Bluetooth audio HAL V2"
Treehugger Robot [Thu, 7 Feb 2019 00:00:28 +0000 (00:00 +0000)]
Merge "Add stack side interface for Bluetooth audio HAL V2"

5 years agoAdd stack side interface for Bluetooth audio HAL V2
Cheney Ni [Thu, 8 Nov 2018 08:41:02 +0000 (16:41 +0800)]
Add stack side interface for Bluetooth audio HAL V2

This bases on the new Bluetooth Audio HAL V2 to provide a HIDL based
interface for the stack. There will be a common interface named
BluetoothAudioClientInterface that the stack can register its session for
stream of A2DP or Hearing Aid. When the stack registers to this
pre-implemented BluetoothAudioClientInterface, the audio HAL can control
the stream state and the stack can report results to the audio HAL.
When running for software encoding, there will also data path via FMQ to
provide the bridge between audio HAL and the stack. This change contains
A2DP software encoding (legacy) only.

Bug: 111519504
Test: manual with A2DP software encoding (legacy)

Change-Id: Iac5a43c929d4036fa86e2b0c2c2920ca2b9dfa50

5 years agoMerge "PBAP Client SDP record"
Joseph Pirozzo [Wed, 6 Feb 2019 21:10:24 +0000 (21:10 +0000)]
Merge "PBAP Client SDP record"

5 years agoAdd generic audio HW module for Bluetooth audio HAL V2
Cheney Ni [Wed, 7 Nov 2018 00:41:55 +0000 (08:41 +0800)]
Add generic audio HW module for Bluetooth audio HAL V2

This is loaded from audio HAL when initials the audio HW module,
bluetooth_audio, and uses Bluetooth audio HAL V2 to provide stream APIs
for control and data path. When the audio framework opens different
input or output streams, it uses the audio device type to choose which
SessionType is and pass to Bluetooth audio HAL so associates with the
Provider / Port pair and communicate with the Bluetooth stack.

* Audio contrl path uses IBluetoothAudioPort interface to interact with
  the Bluetooth stack.
* Audio data path uses HIDL Fast Message Queue that is maintained within
  IBluetoothAudioProvider HIDL and is ready after session started.

Bug: 111519504
Bug: 122503379
Test: manual

Change-Id: Ie668456179357c26397f5c6234ff46b5308dfe24

5 years agoMetrics: Add classic pairing metrics
Jack He [Fri, 1 Feb 2019 01:44:46 +0000 (17:44 -0800)]
Metrics: Add classic pairing metrics

* Log HCI commands and events related to classic pairing
* Move all metrics logging for sending HCI command into a single
  function
* Move all metrics logging for HCI command status into a single function
* Move all metrics logging for HCI Command complete into a single
  function
* Move all metrics logging for HCI events into a single function
* Make sure we log all instances of HCI command sending methods,
  including those with desinated callbacks

Bug: 112969790
Test: make, testdrive with statsd
Change-Id: I4b1ca4ee814096d84bcd93c8d7206b0a771a3210

5 years agoMerge "Metrics: Log SMP pairing commands"
Treehugger Robot [Fri, 1 Feb 2019 01:57:35 +0000 (01:57 +0000)]
Merge "Metrics: Log SMP pairing commands"

5 years agoPBAP Client SDP record
Joseph Pirozzo [Thu, 17 Jan 2019 00:50:10 +0000 (16:50 -0800)]
PBAP Client SDP record

Add registration for PBAP Client SDP record when service is available.

Bug: 113505152
Test: Check SDP record via "sdptool browse"
Change-Id: I067eccbe0db17e32d0fc57ed57813fe1e63536d1

5 years agoMetrics: Log SMP pairing commands
Jack He [Thu, 31 Jan 2019 23:17:08 +0000 (15:17 -0800)]
Metrics: Log SMP pairing commands

* Log SMP pairing commands and pairing failure reasons

Bug: 112969790
Test: make, testdrive with statsd
Change-Id: I51ae2af981a687954f7de3cee3caacce43d782b6

5 years agoMerge "Hearing Aid: Removes all registrations for connection when disconnect HA"
Treehugger Robot [Thu, 31 Jan 2019 22:15:48 +0000 (22:15 +0000)]
Merge "Hearing Aid: Removes all registrations for connection when disconnect HA"

5 years agoFix race condition during LE device remove bond.
Jakub Pawlowski [Thu, 17 Jan 2019 21:31:39 +0000 (22:31 +0100)]
Fix race condition during LE device remove bond.

BTA_GATTC_CancelOpen doesn't execute immediately, but rather schedule
operation for execution later. During bond removal, we must make sure
that device is removed from white list before it's removed from
resolving list. Calling GATT_CancelConnect directly fixes this issue.

Additionally, after checking the logic, unconditional remove should
remove all connection attempts, including direct connections, rather
than just background connections.

Bug: 122918938
Bug: 112827989
Test: re-bond hearing aids
Change-Id: I9d861b7d83ea4da9c2a278eea2e34f2b7aca2417

5 years agoMerge "Hearing Aid: Add python script to dump audio data to file"
Weichin Weng [Thu, 31 Jan 2019 05:39:08 +0000 (05:39 +0000)]
Merge "Hearing Aid: Add python script to dump audio data to file"

5 years agoMerge "Metrics: Log A2DP playback related atoms to StatsLog"
Treehugger Robot [Thu, 31 Jan 2019 00:14:09 +0000 (00:14 +0000)]
Merge "Metrics: Log A2DP playback related atoms to StatsLog"

5 years agoMetrics: Log A2DP playback related atoms to StatsLog
Jack He [Mon, 21 Jan 2019 05:31:12 +0000 (21:31 -0800)]
Metrics: Log A2DP playback related atoms to StatsLog

* BluetoothA2dpAudioOverrunReported
  - Logs when A2DP failed send encoded data to the remote device fast
    enough such that the transmit buffer queue is full and we have to
    drop data
* BluetoothA2dpAudioUnderrunReported
  - Logs when A2DP failed to read from PCM source
* BluetoothDeviceRssiReported
  - Logged when remote device's RSSI level is reported by the controller
* BluetoothDeviceFailedContactCounterReported
  - Logged when ACL transmit queue was flushed by the controller
  - This is normally disabled unless we set automatic flush timeout was
    set to a non-zero value
  - However, when this event is reported, the connection quality must
    be very bad
* BluetoothDeviceTxPowerLevelReported
  - Logged when transmit power level is reported for a particular
    connection

Note on num_dropped_nanoseconds entry:
  - This is the duration of audio dropped and is calculated by
    multiplying the number of encoding actions with length of encoding
    interval

Bug: 112969790
Test: make, testdrive with statsd
Change-Id: Ie6aa5ee71dea213e452497dd181fee91eea8f7b4

5 years agoFix for infinite loop in gatt_enc_cmpl_cback
Jakub Pawlowski [Wed, 30 Jan 2019 15:39:22 +0000 (16:39 +0100)]
Fix for infinite loop in gatt_enc_cmpl_cback

Bug: 123574849
Change-Id: Id680cc794326b5d00c28dadf0d7aad98c0e4a5f2

5 years agoMetrics: Add Bluetooth quality report to statsd
Jack He [Tue, 29 Jan 2019 22:51:46 +0000 (14:51 -0800)]
Metrics: Add Bluetooth quality report to statsd

Bug: 112969790
Test: make, test drive with statsd
Change-Id: I20232facbd40f7f49bf574f47754ba5222a2aa34

5 years agoMerge changes I79037ddb,I9bab0078
Treehugger Robot [Wed, 30 Jan 2019 04:57:36 +0000 (04:57 +0000)]
Merge changes I79037ddb,I9bab0078

* changes:
  Metrics: add remote version info log to statsd
  Metrics: Log HCI timeout event over stats log

5 years agoMetrics: add remote version info log to statsd
Jack He [Tue, 29 Jan 2019 22:49:34 +0000 (14:49 -0800)]
Metrics: add remote version info log to statsd

Bug: 112969790
Test: make, test drive with statsd
Change-Id: I79037ddb6c4af3bf3e5cc8a890c8ee66652b8a81

5 years agoMetrics: Log HCI timeout event over stats log
Jack He [Mon, 21 Jan 2019 07:16:45 +0000 (23:16 -0800)]
Metrics: Log HCI timeout event over stats log

Fixes: 121213292
Bug: 111812273
Test: make, test drive with statsd
Change-Id: I9bab0078a1e45c9811fd63f4c5aef9f4704ac555

5 years agoUsing std::promise and std::future to block till A2DP device activated
Cheney Ni [Wed, 19 Dec 2018 10:46:18 +0000 (18:46 +0800)]
Using std::promise and std::future to block till A2DP device activated

There is a new interface to replace UIPC with Blueototh Audio Hal v2 and
synchronization issues between BT Stack and Audio Hal was found when
activating a new A2DP device. Because the API to activate an A2DP device
was non-blocking, it was possilbe that there was a race condition when
BT Stack starting A2DP session and Audio Hal was opening A2DP output.
There was a chance that the output was opened before session started and
causing A2DP to have no sound.

This CL uses std::promise and std::future are able to achieve the
serialize of starting session and opening output for A2DP.

Bug: 111519504
Bug: 122505783
Test: A2DP reconnection and switching

Change-Id: I88c42ea1eb5f8def2345dbfaab26c6d1a91c54cc

5 years agoHearing Aid: Add python script to dump audio data to file
weichinweng [Thu, 20 Dec 2018 07:03:37 +0000 (15:03 +0800)]
Hearing Aid: Add python script to dump audio data to file

Bug: 121005659
Test: ./dump_hearingaid_audio.py btsnoop_hci.log
      ./dump_hearingaid_audio.py -f folder btsnoop_hci.log
      ./dump_hearingaid_audio.py -f folder -c1 1 -c2 3 btsnoop_hci.log
      ./dump_hearingaid_audio.py -f folder -a 121 btsnoop_hci.log
Change-Id: I304531ecb5c5bd6cfc264130176d26acc60a64c2

5 years agoHearing Aid: Removes all registrations for connection when disconnect HA
weichinweng [Mon, 21 Jan 2019 11:22:33 +0000 (19:22 +0800)]
Hearing Aid: Removes all registrations for connection when disconnect HA

* On the current design, when the disconnect Hearing Aid is triggered
from UI. It will Cancel autoconnect by gatt_if first. It will cause the
fixed_chnl_idle_tout isn't set. On the condition, it will cause the
disconnect isn't finished.
* The fix is change the behavior. Directly remove all registrations for
connection when disconnect HA.

Bug: 122264537
Bug: 123214035
Test: make, BT off/on when connected HA,
Toggle disconnect/connect HA from Bluetooth UI,
Turn off/onn HA after Connected HA.

Change-Id: If011c1ab632e1fcb51a68b3c122743534b5f6c63

5 years agoAdd IdGenerator
Jakub Pawlowski [Wed, 8 Aug 2018 14:32:44 +0000 (16:32 +0200)]
Add IdGenerator

Test: added unit test
Bug: 67058417
Change-Id: I41a9200cbf703f5404f312e4cb1199b640e86270

5 years agoBQR: Cleanup BQR header definititon
Jack He [Fri, 25 Jan 2019 21:45:16 +0000 (13:45 -0800)]
BQR: Cleanup BQR header definititon

* Rename persist.bluetooth.bqr.eventmask to persist.bluetooth.bqr.event_mask
* Rename persist.bluetooth.bqr.interval to
  persist.bluetooth.bqr.min_interval_ms
* Rename all instances of reporting interval to minimum report interval
  milliseconds
* Add zero initialization to all event values
* Add comment on the unit of timestamp and piconet clock

Bug: 111384296
Test: make, no functional change
Change-Id: I5174297ec314a862da7591bcf3aefea9b6778f1a

5 years agoDO NOT MERGE: Revert "Revert "Add libprocessgroup dependency and fix sched_policy...
Suren Baghdasaryan [Fri, 25 Jan 2019 05:34:11 +0000 (05:34 +0000)]
DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency and fix sched_policy include""

This reverts commit e5751caf675fc0bee229f8c427564c2e927184fd.

Reason for revert: AOSP is fixed with new vendor image

Change-Id: I96db6ffe9cce3d5158b96c171026839d62ec3756
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
5 years agoBQR: Add Bluetooth Quality Report feature
Ray [Thu, 3 Jan 2019 13:19:16 +0000 (21:19 +0800)]
BQR: Add Bluetooth Quality Report feature

Bluetooth disconnects, voice and audio quality issues are sometimes hard
to debug without an OTA (Over The Air) log.
For debugging this kind of issue we would need to identify it belongs to
the host, Bluetooth controller/firmware, environment or the remote
Bluetooth device.
This feature would route the link and firmware/controller stats (ex: TX
power level, RSSI, Unused AFH channel count...) to the host when quality
events happen.

Quality Monitoring Mode:
The controller will periodically send Bluetooth Quality VSE sub-event to
the host.

Approaching LSTO:
Once no packets are received from the connected Bluetooth device for a
duration longer than the half of LSTO (Link Supervision Timeout) value,
the controller will report Approaching LSTO event to the host.

A2DP Audio Choppy:
When audio stall, the controller will report A2DP Audio Choppy event to
the host.

(e)SCO Voice Choppy:
The controller will report (e)SCO Voice Choppy event to the host if the
voice quality might be bad.

Bug: 111384296
Test: - Verified that all functionalites with the Bluetooth controller /
        firmware which supports Bluetooth Quality Report VSC
(OpCode: 0xFD5E) and Bluetooth Quality Report (Sub-event code:
0x58) of VSE.
      - Verified that this feature could work on both the A2DP HW
        offload and non-offload modes.

Change-Id: I3fd3000bace7606855cac3b9b87134499c0ca891

5 years agoConvert Android.mk file to Android.bp
Sasha Smundak [Tue, 22 Jan 2019 21:46:37 +0000 (13:46 -0800)]
Convert Android.mk file to Android.bp

See build/soong/README.md for more information.

Change-Id: Ida03ab11c7fa6148fa5711ce1770b6951e831412
Fixes: 122332236
Test: treehugger

5 years agoSDP: Remove SDP_DEBUG_RAW flag
Jack He [Fri, 25 Jan 2019 00:59:52 +0000 (16:59 -0800)]
SDP: Remove SDP_DEBUG_RAW flag

* This flag is almost always set to false, making blocks of code
  unreachable

Test: make
Change-Id: Ie5ceafa7ae02ccbfec537a5d3960e617b746ecdf

5 years agoMerge "Disable AVRCP position change in silence mode"
Treehugger Robot [Thu, 24 Jan 2019 18:08:05 +0000 (18:08 +0000)]
Merge "Disable AVRCP position change in silence mode"

5 years agoMerge "DO NOT MERGE: Revert "Add libprocessgroup dependency and fix sched_policy...
Suren Baghdasaryan [Thu, 24 Jan 2019 06:57:55 +0000 (06:57 +0000)]
Merge "DO NOT MERGE: Revert "Add libprocessgroup dependency and fix sched_policy include""

5 years agoMerge "GATT connection_manager: Fix logic to remove white list device"
Treehugger Robot [Thu, 24 Jan 2019 06:26:29 +0000 (06:26 +0000)]
Merge "GATT connection_manager: Fix logic to remove white list device"

5 years agoDO NOT MERGE: Revert "Add libprocessgroup dependency and fix sched_policy include"
Suren Baghdasaryan [Thu, 24 Jan 2019 04:54:50 +0000 (20:54 -0800)]
DO NOT MERGE: Revert "Add libprocessgroup dependency and fix sched_policy include"

This reverts commit 8ef9dc6f3f334b444bbfffae18185a36d6a1f5b5.

Reason for revert: Broke AOSP

Change-Id: If6b0121b5ce60915accf705dbbba268cc4a96203
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
5 years agoMerge "Add a new isAshaHearingAidSupported method to Bluetooth Manager"
Treehugger Robot [Thu, 24 Jan 2019 01:34:25 +0000 (01:34 +0000)]
Merge "Add a new isAshaHearingAidSupported method to Bluetooth Manager"

5 years agoDisable AVRCP position change in silence mode
Ugo Yu [Sat, 12 Jan 2019 19:12:30 +0000 (03:12 +0800)]
Disable AVRCP position change in silence mode

* Save the silence mode information in BtifAvPeer send from
  JAVA, which helps AVRCP devices to check whether device
  silence mode is enabled or not.
* Stop sending AVRCP position change event to remote when
  silence mode is enabled.

Bug: 112323989
Test: Manual
Change-Id: I99d88a31caea062790c4ff0dc9199ed82f058067

5 years agoGATT connection_manager: Fix logic to remove white list device
Hansong Zhang [Wed, 23 Jan 2019 22:03:24 +0000 (14:03 -0800)]
GATT connection_manager: Fix logic to remove white list device

Device in bgconn_dev will be removed when no app is using it. Fix the
logic to prevent from use after free.

Bug: 123297334
Test: Manual
Change-Id: I35a0191ba48fabbcf28525388dfa63b93b20c96d

5 years agoMerge "Add binder interfaces for metadata APIs"
Treehugger Robot [Wed, 23 Jan 2019 07:38:06 +0000 (07:38 +0000)]
Merge "Add binder interfaces for metadata APIs"

5 years agoAdd a new isAshaHearingAidSupported method to Bluetooth Manager
Stanley Tng [Mon, 14 Jan 2019 00:13:09 +0000 (16:13 -0800)]
Add a new isAshaHearingAidSupported method to Bluetooth Manager

As part of adding isHearingAidsProfileSupported method to
BluetoothAdapter, this new method is added to query the support state.

Test: Manual testing with configuration enabled and disabled.
Bug: 119617521
Change-Id: I97151443c6a5bd459a7c73c61f7fa7d5a386909a
(cherry picked from commit 7d51ff78280a9e03949ffed8f7f61d5226c3a27b)

5 years agoAdd binder interfaces for metadata APIs
Ugo Yu [Sat, 12 Jan 2019 00:13:16 +0000 (08:13 +0800)]
Add binder interfaces for metadata APIs

Bug: 121051445
Test: build pass

Change-Id: Icd51b7cc0a4dec5a2bffec4ded67caffeedb126b

5 years agoFix the LE CoC SL4A Test failure due to length check
Stanley Tng [Tue, 11 Dec 2018 22:45:13 +0000 (14:45 -0800)]
Fix the LE CoC SL4A Test failure due to length check

Fix a regression from the previous CL that checks the buffer length
before doing a memcpy. The previous check is too strict causing valid
sized buffers to be rejected. The length check is incorrect and off by the header size.

Bug: 117306992
Bug: 112321180
Test: Run the LE CoC SL4A Tests
Change-Id: I9bbcd58460a02394010f74a18e9ebdbcd546d43d
Merged-In: I9bbcd58460a02394010f74a18e9ebdbcd546d43d
(cherry picked from commit fcb1994de1f6ee34b8dc6804a2b32e20bf138073)

5 years agoAdd libprocessgroup dependency and fix sched_policy include
Suren Baghdasaryan [Thu, 20 Dec 2018 01:36:37 +0000 (17:36 -0800)]
Add libprocessgroup dependency and fix sched_policy include

libbt-utils uses set_sched_policy which is now implemented inside
libprocessgroup. Add required dependency and header file include.

Exempt-From-Owner-Approval: janitorial

Bug: 111307099
Test: builds, boots

Merged-In: I4d0dcfad22b30ac249a7874b42a7121e2ffedadb
Change-Id: I4d0dcfad22b30ac249a7874b42a7121e2ffedadb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
5 years agoAdd a ClassOfDevice type
Myles Watson [Thu, 22 Nov 2018 00:24:52 +0000 (16:24 -0800)]
Add a ClassOfDevice type

Test: net_test_types
Change-Id: If1f2e294ba46e39219e0c60dd1795d34123714c8

5 years agoMerge "Metric: Add logging for link layer connection events"
Treehugger Robot [Thu, 17 Jan 2019 22:30:43 +0000 (22:30 +0000)]
Merge "Metric: Add logging for link layer connection events"

5 years agoMerge "DO NOT MERGE - Merge pie-platform-release (PPRL.190105.001) into master"
Xin Li [Thu, 17 Jan 2019 21:19:42 +0000 (21:19 +0000)]
Merge "DO NOT MERGE - Merge pie-platform-release (PPRL.190105.001) into master"

5 years agoMerge "Add new Hearing Aids commands to improve L/R Sync"
Treehugger Robot [Thu, 17 Jan 2019 18:27:10 +0000 (18:27 +0000)]
Merge "Add new Hearing Aids commands to improve L/R Sync"

5 years agoMerge "Wait for Notifications before sending audio data"
Treehugger Robot [Thu, 17 Jan 2019 15:25:39 +0000 (15:25 +0000)]
Merge "Wait for Notifications before sending audio data"

5 years agoAdd new Hearing Aids commands to improve L/R Sync
Stanley Tng [Tue, 1 Jan 2019 22:52:07 +0000 (14:52 -0800)]
Add new Hearing Aids commands to improve L/R Sync

Prototyping new commands to the Hearing Aids devices to improve the
Left/Right Sync issues. The new commands are:
1. Add a new byte parameter to the START command that indicates the
other side device is actively streaming or disconnected,
2. Whenever there is an LE Connection Update event from the phone BT
controller, send a new Status Update command to all connected devices,
3. Whenever one side gets disconnected or starts streaming, send a new
Status Update command to the other side to inform about this change.

Bug: 117778955
Bug: 120921220
Test: Manual Testing with Hearing Aids
Change-Id: I5c94867d4574802025e3b433573e52d3c40c9828

5 years agoWait for Notifications before sending audio data
Stanley Tng [Wed, 26 Dec 2018 02:12:51 +0000 (18:12 -0800)]
Wait for Notifications before sending audio data

For the Hearing Aids Profile, wait for the notification status from the
devices after sending the Start command. The reason is that the devices
may be in low power mode and the phone should not start streaming audio
data to these devices until it is fully awake.

Test: Manual testing with Hearing Aids devices
Bug: 117778955
Bug: 120921220
Change-Id: I28b79e7e284d5e75864c0b12315fbb8bd47acf74

5 years agoMetric: Add logging for link layer connection events
Jack He [Thu, 20 Dec 2018 23:46:17 +0000 (15:46 -0800)]
Metric: Add logging for link layer connection events

* Logs when there is an event affecting Bluetooth device's link
  layer connection. Triggerred when there is a related HCI command
  or event
* Users of this metrics can deduce Bluetooth device's connection state
  from these events
* HCI commands are logged before the command is sent, after receiving,
  command status, and after receiving command complete
  event comes back
* HCI events are logged when they arrive
* Simplifies logic in btu_hcif_hdl_command_status() since p_cmd is never
  null and we always ignore parameter total length field
* Call btm_identity_addr_to_random_pseudo() when parsing command status
  packet for LE create connection, extended create connection,
  add/remove/clear whitelist commands

DETAILS:

* Bluetooth classic commands:
  - CMD_CREATE_CONNECTION
  - CMD_DISCONNECT
  - CMD_CREATE_CONNECTION_CANCEL
  - CMD_ACCEPT_CONNECTION_REQUEST
  - CMD_REJECT_CONNECTION_REQUEST
  - CMD_SETUP_ESCO_CONNECTION
  - CMD_ACCEPT_ESCO_CONNECTION
  - CMD_REJECT_ESCO_CONNECTION
  - CMD_ENH_SETUP_ESCO_CONNECTION
  - CMD_ENH_ACCEPT_ESCO_CONNECTION
* Bluetooth low energy commands:
  - CMD_BLE_CREATE_LL_CONN [Only logged when there is an error or initiator filter policy is 0x00]
  - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
  - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
  - CMD_BLE_CLEAR_WHITE_LIST
  - CMD_BLE_ADD_WHITE_LIST
  - CMD_BLE_REMOVE_WHITE_LIST
* Bluetooth classic events:
  - EVT_CONNECTION_COMP
  - EVT_CONNECTION_REQUEST
  - EVT_DISCONNECTION_COMP
  - EVT_ESCO_CONNECTION_COMP
  - EVT_ESCO_CONNECTION_CHANGED
* Bluetooth low energy meta events:
  - BLE_EVT_CONN_COMPLETE_EVT
  - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT

Bug: 112969790
Test: make and test drive statsd
Change-Id: Ib843dfa95bb6448c41dac261dabcf17947efda06

5 years agoAllow bond request from devices with BTM_IO_CAP_NONE
Tiansong Cui [Tue, 15 Jan 2019 21:22:46 +0000 (13:22 -0800)]
Allow bond request from devices with BTM_IO_CAP_NONE

Devices with BTM_IO_CAP_NONE should still be able to create
(although unauthenticated) bond with other devices.

Bug: internal 122119496
Test: manual
Change-Id: Iac008d0199ca11d06db8c91cda821f992ba3d4ee

5 years agoDO NOT MERGE - Merge pie-platform-release (PPRL.190105.001) into master
Xin Li [Tue, 15 Jan 2019 18:17:12 +0000 (10:17 -0800)]
DO NOT MERGE - Merge pie-platform-release (PPRL.190105.001) into master

Bug: 122685541
Change-Id: Iafca519871aab60f057bb7f6abc1bcf2f0394ba2

5 years agoSnap for 5230900 from aa9c1b4abdb2ca7beea467f7be82e83363a32b11 to pi-platform-release
android-build-team Robot [Mon, 14 Jan 2019 22:03:03 +0000 (22:03 +0000)]
Snap for 5230900 from aa9c1b4abdb2ca7beea467f7be82e83363a32b11 to pi-platform-release

Change-Id: I50623117c36dbe20a0c8d120a7115628a2f53566

5 years agoMerge "Fix BT a bad/ out of bounds array read"
Sal Savage [Mon, 14 Jan 2019 21:43:55 +0000 (21:43 +0000)]
Merge "Fix BT a bad/ out of bounds array read"

5 years agoMerge "SMP: Fix invalid auth_req in LE Security Request handler"
Treehugger Robot [Mon, 14 Jan 2019 14:23:01 +0000 (14:23 +0000)]
Merge "SMP: Fix invalid auth_req in LE Security Request handler"

5 years agoDo not crash on LE Create Connection "Command Disallowed"
Jakub Pawlowski [Thu, 3 Jan 2019 14:13:11 +0000 (15:13 +0100)]
Do not crash on LE Create Connection "Command Disallowed"

Being in "Connecting" used to mean we are either doing direct
connection, or background connection procedure. Now we have just one
connection procedure. This means there is no ambiguity when the
controller responds with "Command Disallowed" - we know exactly which
state to go back to.

Bug: 110412113
Bug: 112827989
Test: there is no test, or reproduction scenarion to verify that
      Ran GattConnectTest for sanity

Change-Id: I9ed1cdc7ae4032cda4e8a166310eca0004c7f9dc

5 years agoSMP: Fix invalid auth_req in LE Security Request handler
Manoj Babulal [Thu, 27 Dec 2018 10:43:19 +0000 (02:43 -0800)]
SMP: Fix invalid auth_req in LE Security Request handler

Due to wrong pointer de-reference, auth_req value read
in smp_proc_sec_req (LE Security Request packet handler)
was invalid.

Logcat trace shows invalid auth_req value:
.. bt_smp  : smp_proc_sec_req: auth_req=0xf9
   ....
.. bt_smp  : smp_proc_sec_req: auth_req=0xe9

After the fix, auth_req value is correct:
.. bt_smp  : smp_proc_sec_req: auth_req=0x1
   ....
.. bt_smp  : smp_proc_sec_req: auth_req=0x5

This data flow can be traced in code on this path:
smp_data_received -> smp_sm_event -> smp_proc_sec_req

Issue seen after following change:
https://android-review.googlesource.com/c/platform/system/bt/+/492442

Issue was discovered during execution of PTS test
cases GAP/SEC/AUT/BV-13-C and GAP/SEC/AUT/BV-14-C.

Fixes: 122066779

Test: Verified logcat trace shows valid auth_req
value prints from smp_proc_sec_req() function

Change-Id: I072b4794fb56a05b7ac7f2f4ca606514d7524550

5 years agoJanuary Pi-platform-release merges
Adam Seaton [Fri, 11 Jan 2019 22:55:24 +0000 (22:55 +0000)]
January Pi-platform-release merges

Change-Id: Id66375f8b1f3329e82df3d0fdb06917c065209de

5 years agoFix BT a bad/ out of bounds array read
Sal Savage [Wed, 9 Jan 2019 20:50:07 +0000 (12:50 -0800)]
Fix BT a bad/ out of bounds array read

Bug: 121375525
Test: Used automotive hardware and verified that pairing and media
      streaming and control still work and crashes no longer happen.
Change-Id: I3476425131718aded980f57a8b9be92a8e9f9d3b

5 years agoFix potential NULL dereference in smp_proc_confirm
Jakub Pawlowski [Fri, 11 Jan 2019 12:43:33 +0000 (13:43 +0100)]
Fix potential NULL dereference in smp_proc_confirm

Bug: 122102910
Test: compilation
Change-Id: Idd16e1c1924165924847f1aad64ddd44a8a1b8ab

5 years agoMerge "Fix bt_trace.h #define"
Treehugger Robot [Fri, 11 Jan 2019 00:21:24 +0000 (00:21 +0000)]
Merge "Fix bt_trace.h #define"

5 years agoAdd host tests to TEST_MAPPING
Dan Shi [Thu, 10 Jan 2019 18:55:23 +0000 (10:55 -0800)]
Add host tests to TEST_MAPPING

Also added some missing test_suites setting.

Following tests don't have host_supported set to true in Android.bp:
net_test_audio_a2dp_hw
net_test_btif
net_test_btif_profile_queue
net_test_device
net_test_hci
net_test_stack
net_test_stack_ad_parser
net_test_stack_smp

Following tests failed to run in host with error "did not report any run":
net_test_performance
net_test_stack_rfcomm

Bug: 111921389
Test: system/bt$ atest --host :postsubmit
Change-Id: I5f55cead7a2ad1cadea48220f45781f4f74949dd

5 years agoFix bt_trace.h #define
Jack He [Thu, 10 Jan 2019 04:47:57 +0000 (20:47 -0800)]
Fix bt_trace.h #define

Test: make
Change-Id: Ie1177f2311db0b7b5dfb440f3f982d4a79aa460d

5 years agoRemove code related to Health Device Profile and MCAP Protocol
Jack He [Fri, 4 Jan 2019 01:11:24 +0000 (17:11 -0800)]
Remove code related to Health Device Profile and MCAP Protocol

* Health Device Profile (HDP) and MCAP protocol has been largely
  replaced by BLE. New applications should use Bluetooth Low Energy
  instead of legacy Bluetooth Health Device Profile

Bug: 111562841
Test: make, unit test, use Bluetooth
Change-Id: I3da1173a8a928af4b26a29e71746241c22af2236
Merged-In: I3da1173a8a928af4b26a29e71746241c22af2236
(cherry picked from commit dc13609b58b2f6c6185951f650036f5098e19e92)

5 years agoMerge "HCI: Simplify btu_hcif_hdl_command_status()"
Treehugger Robot [Wed, 9 Jan 2019 21:59:39 +0000 (21:59 +0000)]
Merge "HCI: Simplify btu_hcif_hdl_command_status()"

5 years agoMerge "Group all Hearing Aids device information together"
Treehugger Robot [Wed, 9 Jan 2019 17:36:40 +0000 (17:36 +0000)]
Merge "Group all Hearing Aids device information together"

5 years agoHCI: Simplify btu_hcif_hdl_command_status()
Jack He [Wed, 9 Jan 2019 01:48:20 +0000 (17:48 -0800)]
HCI: Simplify btu_hcif_hdl_command_status()

* Move 2nd layer switch statements into top layer
* Check if p_cmd is nullptr at the beginning of the function so
  that each case does not need to check it individually. p_cmd
  is never null.
* Skip parameter total length at beginning of the function

Test: make, unit test, use Bluetooth for music and calls
Change-Id: I23cf983a1ade44bcea0b1009860efdfaf3b8bca8

5 years agoHCI: Fix command status handling of HCI_QOS_SETUP
Jack He [Wed, 9 Jan 2019 01:53:31 +0000 (17:53 -0800)]
HCI: Fix command status handling of HCI_QOS_SETUP

* QOS setup complete event was handled instead of QOS setup command

Test: make
Change-Id: I894099f369675bd25397ee0005c6838f39220eed

5 years agoGroup all Hearing Aids device information together
Stanley Tng [Fri, 21 Dec 2018 00:44:15 +0000 (16:44 -0800)]
Group all Hearing Aids device information together

A small refactor where the various information about a Hearing Aids
device is gathered into a class. Instead of passing a long list
of function parameters, it is cleaner to group them inside a single
class. It also makes it easier to add new elements in the future.

Test: Manual pair and audio stream with Hearing Aids
Bug: 119617521
Change-Id: I193b5cc915a6c36e7e36d1f06a5adcda7c17ab1c

5 years agoRemove BTM_SCO_WAKE_PARKED_LINK flag
Jack He [Sat, 5 Jan 2019 00:18:12 +0000 (16:18 -0800)]
Remove BTM_SCO_WAKE_PARKED_LINK flag

* Under majority of configurations, SCO connection can only be created
  if in non-parked mode since SCO is a circuit switch link

Bug: 122375953
Test: make
Change-Id: I58569025b435953b964e5aded64b3ace27d4e73c

5 years agoClean up BLE connection state state machine
Jakub Pawlowski [Wed, 2 Jan 2019 23:41:53 +0000 (00:41 +0100)]
Clean up BLE connection state state machine

* get rid of BLE_DIR_CONN - we never go into this state any more
* BLE_BG_CONN -> BLE_CONNECTING
* use btm_ble_get_conn_st instead of directly accessing control block

Test: compilation
Bug: 112827989
Change-Id: I4aa09a8b558c6f2161806a6d27bee0560fd19fd8

5 years agoMove all HCI LE Create Connection management into single file
Jakub Pawlowski [Mon, 31 Dec 2018 11:54:04 +0000 (12:54 +0100)]
Move all HCI LE Create Connection management into single file

Currently handling of LE Create Connection, LE Create Connection
Cancel, LE Connection Complete and other HCI commands related to LE
connection establishment is in two separate files.
Move all this code into single file.

Bug: 112827989
Test: compilation
Change-Id: Ibc2f6ca2324f4df8a23c2722762d0e5297782b33

5 years agoRemove BTM_SCO_INCLUDED flag
Jack He [Thu, 3 Jan 2019 01:38:53 +0000 (17:38 -0800)]
Remove BTM_SCO_INCLUDED flag

* Instead of removing SCO related code during compilation, platforms
  should chose not to call SCO related methods when SCO is not supported
* For example, platforms can choose to not initialize HFP to avoid using
  SCO commands
* This CL removes BTM_SCO_INCLUDED compile time flag to simplify code
  flow and improve readability

Bug: 122279647
Test: mm -j40; run Bluetooth stack and make phone call
Change-Id: I67d290839091f66c289a428496304c8b3e1dbe21

5 years agoRemove connection_manager from gatt namespace
Jakub Pawlowski [Fri, 28 Dec 2018 18:03:09 +0000 (19:03 +0100)]
Remove connection_manager from gatt namespace

connection_manager handles more than GATT. Celanup naming.

Bug: 112827989
Test: compilation
Change-Id: Id5fdfacb12921cff04204cf2589f73a7c6a0d01f

5 years agoGet rid of is_ble_connecting and ble_connecting_bda
Jakub Pawlowski [Thu, 27 Dec 2018 20:02:13 +0000 (21:02 +0100)]
Get rid of is_ble_connecting and ble_connecting_bda

These variables make no sense any more, as we might be attempting
multiple connections at the same time.

Test: sl4a GattConnectTest, manual bonding test
Bug: 112827989
Change-Id: I7e1d01e8d80383b49ff9c20fb3758cef03c52882

5 years agoUse conneciton_manager for all LE connection establishment
Jakub Pawlowski [Wed, 19 Dec 2018 21:23:47 +0000 (22:23 +0100)]
Use conneciton_manager for all LE connection establishment

Test: sl4a GattConnectTest, manual bonding test
Bug: 112827989
Change-Id: I55878e03d268c43002e22ce4ebfbf0e334523882

5 years agoGet rid of direct connect queueing logic
Jakub Pawlowski [Mon, 17 Dec 2018 12:59:54 +0000 (13:59 +0100)]
Get rid of direct connect queueing logic

Instead of queueing requests, we should use whitelist to process the
requests simulteanously.
This patch does remove the queueing logic, succeeding patch will add the
logic to schedule through whitelist.

Test: compilation
Bug: 112827989
Change-Id: Ia7132812f704658ecb6919e52c70b291e6874660

5 years agoCall btm_ble_set_conn_st before on_connection_complete
Jakub Pawlowski [Fri, 21 Dec 2018 16:16:01 +0000 (17:16 +0100)]
Call btm_ble_set_conn_st before on_connection_complete

on_connection_complete can trigger BTM_WhiteListRemove, which sends
"LE Create Connection Cancel" if the connection is pending.

Make sure connection state is updated before calling on_connection_complete.
Otherwise we send an unnecessary "LE Create Connection Cancel" request.

Bug: 112827989
Test: establish Direct connection with at least one device in the
      background connection procedure. Verify HCI snoop log content

Change-Id: I1b8532f4e58d5ab62b471ce0bde6c48640c83ff7

5 years agoMerge code in scanner/advertiser connection complete handler
Jakub Pawlowski [Fri, 14 Dec 2018 18:53:59 +0000 (19:53 +0100)]
Merge code in scanner/advertiser connection complete handler

Test: sl4a GattConnectTest
Bug: 112827989
Change-Id: I860693c11c263643858cfa0b4e4deb6a9f231cdd

5 years agoUnify code in scanner/advertiser connection complete handler.
Jakub Pawlowski [Fri, 14 Dec 2018 18:38:44 +0000 (19:38 +0100)]
Unify code in scanner/advertiser connection complete handler.

btm_ble_set_conn_st is called in every possible scenario of
l2cble_scanner_conn_comp. Call it at start, instead of before each
return.

Test: sl4a GattConnectTest
Bug: 112827989
Change-Id: I969fc59b934dc1c7a52be00741fdf38402545b26

5 years agoSplit l2cu_create_conn into two separate, transport-specific functions
Jakub Pawlowski [Fri, 14 Dec 2018 14:15:54 +0000 (15:15 +0100)]
Split l2cu_create_conn into two separate, transport-specific functions

There is no common logic between LE and BR/EDR paths.

Test: compilation
Bug: 112827989
Change-Id: I507d3a0d8efa0e4936b22722a9c1cc846e0be3bd

5 years agoMerge "Fix mtu assignment with correct value"
Ted Wang [Thu, 20 Dec 2018 06:16:47 +0000 (06:16 +0000)]
Merge "Fix mtu assignment with correct value"

5 years agoMerge "use epoll_create1"
Treehugger Robot [Wed, 19 Dec 2018 23:51:28 +0000 (23:51 +0000)]
Merge "use epoll_create1"

5 years agoEnable BLE background connection when stack is started
Hansong Zhang [Tue, 17 Jul 2018 23:24:24 +0000 (16:24 -0700)]
Enable BLE background connection when stack is started

Remove variable btm_cb.ble_ctr_cb.bg_conn_type. We can enable the
background mode when the Bluetooth stack is started and don't have
to wait until the first background connection request from HID
Device/Hearing Aid/GATT. As soon as we add the first device to white
list, the stack will send HCI Create Connection (White List) command.

Test: manual. Bond to a BLE mouse and turn off/on Bluetooth. Also test
with initiating another direct/white list connection while another white
list connection is pending
Bug: 111562702
Bug: 112827989
Change-Id: I82a476489d181d17aa1c1da8202df1be76928d77

5 years agoRevert "Remove redundant GATT_StartIf"
Jakub Pawlowski [Wed, 19 Dec 2018 12:43:03 +0000 (13:43 +0100)]
Revert "Remove redundant GATT_StartIf"

This change broke initial HID connection.

This reverts commit cb45b1e380126f300d9f7d89a8382438c5d06cd3.

5 years agoMerge "Add stng@google.com to the OWNERS list"
Treehugger Robot [Tue, 18 Dec 2018 21:11:28 +0000 (21:11 +0000)]
Merge "Add stng@google.com to the OWNERS list"

5 years agoMerge "Add a host test for net_test_avrcp"
Treehugger Robot [Tue, 18 Dec 2018 19:05:15 +0000 (19:05 +0000)]
Merge "Add a host test for net_test_avrcp"

5 years agoMerge "Make sure Hearing Aids' Connection Intervals is unchanged"
Treehugger Robot [Tue, 18 Dec 2018 17:04:26 +0000 (17:04 +0000)]
Merge "Make sure Hearing Aids' Connection Intervals is unchanged"

5 years agoFix mtu assignment with correct value
Ted Wang [Tue, 18 Dec 2018 02:31:06 +0000 (10:31 +0800)]
Fix mtu assignment with correct value

Assigned mtu value with correspond avct channel configuration

Bug: 120524683
Test: manual
Change-Id: Idb70c678cef1d704e232aef8706082a48b073ef8

5 years agoAdd stng@google.com to the OWNERS list
Stanley Tng [Tue, 28 Aug 2018 23:06:55 +0000 (16:06 -0700)]
Add stng@google.com to the OWNERS list

Test: N/A
Change-Id: Ic164086fc97fa72aa68ad751b35f339fa71233bb

5 years agouse epoll_create1
Nick Kralevich [Mon, 17 Dec 2018 17:09:43 +0000 (09:09 -0800)]
use epoll_create1

epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC)
instead.

Bug: 120983106
Test: compiles and boots
Change-Id: I40abaaea6dad641dc03d141adb29e963e853edc4