OSDN Git Service
Jakub Pawlowski [Thu, 14 Jun 2018 16:03:47 +0000 (09:03 -0700)]
SMP_Encrypt refactor
* key must be 16bit, so no need to pass it's length, and check it's
value
* p_out being null is a bad call that should crash to be catched, not an
error we should handle
* hash computation always succeed, don't return any errors
Test: existing unit tests cover it, i.e. AesCmacTest
Change-Id: Ifba8902f3f1a7be3c54dd7a33d9ff1e52ffd237b
Jakub Pawlowski [Thu, 14 Jun 2018 07:20:13 +0000 (00:20 -0700)]
Add tests for AES_CMAC
Test: added AesCmacTest
Change-Id: I66615e581ee64debc2c25ae03e18decd2f8c8fa8
Jakub Pawlowski [Fri, 8 Jun 2018 16:32:57 +0000 (09:32 -0700)]
GATTC_Discover: pass parameters directly instead of through pointer
Bug:
67057055
Test: manual
Change-Id: I7be853241595b336e2d4b67bc57170ee01ce6e72
Jakub Pawlowski [Wed, 18 Apr 2018 14:31:30 +0000 (07:31 -0700)]
GATT database refactor
Move logic and data responsible for GATT Discovery into separate class.
Create clean representation of GATT database, and attributes for
storage.
Minor service discovery improvements:
* don't send requests to explore services with start handle equal to end handle.
* don't try to discover characteristic if only one handle is left at end
of service - it uses two handles, one for definition, one for value
* if secondary service is defined before service that includes it, it
should now be properly discovered.
Test: Added DatabaseBuilderTest, manual tests with LE HID devices, Daydream
Controller and Clips camera.
Bug:
67057055
Change-Id: I511f4ee7c56c8fa65f012de0b6d1291321840d11
Jacky Cheung [Thu, 29 Jun 2017 22:27:35 +0000 (15:27 -0700)]
Add storage API to get number of bonded devices
Test: manual
Change-Id: Iaded8031bf706d84cff68f78dff8feb887a159a4
Treehugger Robot [Mon, 11 Jun 2018 20:06:20 +0000 (20:06 +0000)]
Merge "Hearing Aid - codec switching"
Jakub Pawlowski [Tue, 10 Apr 2018 07:16:53 +0000 (00:16 -0700)]
Hearing Aid - codec switching
StartSendingAudio internally sets the codec to the HearingAidAudioSource.
OnDeviceAvailable callback triggers audio framework to grab codec
configuration from HearingAidAudioSource. Those calls must be made in proper
order, otherwise audio framework will grab bad codec configuration.
This patch also remove default codec configuration, and crash if codec
configuration is not done correctly.
Test: use hearing aid supporting 24kHz codec
Change-Id: I9419d58fa8728fc8e0f0c2d2ed8d8d741309a9a3
Treehugger Robot [Mon, 11 Jun 2018 07:42:18 +0000 (07:42 +0000)]
Merge "Add documentation for enabling PTS mode"
Treehugger Robot [Mon, 11 Jun 2018 07:27:41 +0000 (07:27 +0000)]
Merge "Use ParcelFileDescriptor implementation in libbinder"
Treehugger Robot [Fri, 8 Jun 2018 05:39:40 +0000 (05:39 +0000)]
Merge "Send ACK for A2DP_CTRL_CMD_SUSPEND even if audio was no streaming"
Ajay Panicker [Thu, 31 May 2018 00:50:39 +0000 (17:50 -0700)]
Run the AVRCP Service interface functions on the BTA thread
Bug:
80416347
Test: Turn off Bluetooth while connected to a device we initiated the
connection to.
Change-Id: I8f10409c495213ef3117aedf66919de7c0b3d164
(cherry picked from commit
95e1a9e65f2d61523753f19d8855144672413506)
Ajay Panicker [Thu, 24 May 2018 18:26:15 +0000 (11:26 -0700)]
AVRCP: Narrow the scope of the lock in Init and Cleanup
Bug:
80227904
Test: Disable Bluetooth while connected to a device
Change-Id: I6c77e38ebaa84e4a075ef4636d6b519d4ccfb8c5
(cherry picked from commit
4369f6f7607c17ef0ab77bb52d23f20dbc54e424)
Ajay Panicker [Tue, 22 May 2018 21:42:16 +0000 (14:42 -0700)]
AVRCP: Cancel all pending messages and prevent future messages after cleanup
Bug:
79859133
Test: Regression test and repeatedly turn Bluetooth off and on
Change-Id: I1aa05cc5430dbda1d4bae6aa9543f655baed77b4
(cherry picked from commit
85624a8015128ec0bb846e539030d11b85952323)
Pavlin Radoslavov [Tue, 5 Jun 2018 05:18:32 +0000 (22:18 -0700)]
Send ACK for A2DP_CTRL_CMD_SUSPEND even if audio was no streaming
The A2DP_CTRL_CMD_SUSPEND command from the Audio HAL could be received
even if audio wasn't streaming before. Therefore, we should always
respond with an ACK once the command processing has been completed.
Bug:
109712592
Test: Manual: (1) Play music to Headset; (2) Select "This device" as output;
(3) Stop playing music; (4) Select Headset as output
Change-Id: I0f5d52d14b50882931b9d19de1a2f25204fce19e
Merged-In: I0f5d52d14b50882931b9d19de1a2f25204fce19e
(cherry picked from commit
3008cfbeb15605adb0c925d394d9e9934f74d6f6)
Jakub Pawlowski [Sat, 2 Jun 2018 06:34:40 +0000 (06:34 +0000)]
Revert "Don't start the authentication when peer device already started it"
This reverts commit
e75bd3aa3588a5616dfad6fe9f253cb58e65e3ed.
Reason for revert: It breaks pairing of Classic HID devices with Phones
Change-Id: I5dd703934c56387d279d350a36c135245a669b29
Test: Pair with Bluetooth Classic HID keyboard
Bug:
79941483
Stanley Tng [Mon, 4 Jun 2018 17:34:45 +0000 (10:34 -0700)]
Do completion callback during failed security authenication
This CL fixes a regression caused by the earlier commit SHA
6269f02 where the
completion callback for this failed security authenication attempt is
rejected incorrectly. The corner case is when the authenication failed
but the bonding address matches the current address.
Test: Run SL4A "BleCocTest:test_coc_secured_connection_throughput"
Change-Id: I68b75b0e96d2762dcd2862787d51aeb90d7b90a0
Hansong Zhang [Wed, 30 May 2018 23:08:28 +0000 (16:08 -0700)]
Add documentation for enabling PTS mode
Test: not needed
Change-Id: I8a65e3a4bac4de72ec20c73e6b553f2565c9e1de
Jakub Pawlowski [Thu, 24 May 2018 21:14:18 +0000 (21:14 +0000)]
Revert "GATT: Fix GATT error response for execute write"
This reverts commit
b8a5b213a63def7c0a0d09d322603ae5a9abd435.
Reason for revert: This patch does not make Fluoride comply with BT Spec,
it just make a false assumption to pass a test case.
Change-Id: I023b7673c52522e7c1a318f5b9596ebb4fbc99ec
Hansong Zhang [Wed, 30 May 2018 21:16:23 +0000 (14:16 -0700)]
AVRCP: Reject invalid PlayItem and SetAddressedPlayer command
* Use CType REJECT to reject invalid PlayItem command
* Reject SetAddressPlayer command as it is not implemented
Bug:
80481276
Bug:
80483247
Test: PTS AVRCP/TG/MCN/NP/BI-01-C
Change-Id: I837f6d2661e94e09afaa72a9c0c77d5c1ffe9e98
(cherry picked from commit
fe5d973670cc6f95d7431f5a0699a326032e8b06)
Treehugger Robot [Wed, 30 May 2018 16:42:33 +0000 (16:42 +0000)]
Merge changes from topic "avrcp-addressed-player-changed"
* changes:
Send addressed and available player change for PTS test
Add respond track not selected interim when register notification
Send UID 0 for track changed if there is no media ID
Ryo Hashimoto [Wed, 30 May 2018 07:34:19 +0000 (16:34 +0900)]
Use ParcelFileDescriptor implementation in libbinder
Bug:
80377815
Test: build
Change-Id: I0a415181827d6c4dc2243cf14b9fb120effce982
tedwang [Fri, 18 May 2018 10:16:40 +0000 (18:16 +0800)]
Send addressed and available player change for PTS test
Implement HandleAddressPlayerUpdate() and HandAvailablePlayerUpdate()
for PTS test.
Bug:
79375787 79376305
Test: PTS Test AVRCPTG/MPS/BV-05-C AVRCP/TG/MPS/BV-07-C
Change-Id: I6b976af8bdd1afcc9799c50c8e558939cf7be187
Merged-In: I6b976af8bdd1afcc9799c50c8e558939cf7be187
(cherry picked from commit
7a3f78eaa6294d5079312dc9f0e5c7d5c6b5e059)
tedwang [Wed, 16 May 2018 11:51:26 +0000 (19:51 +0800)]
Add respond track not selected interim when register notification
Respond interim with Identifier 0xFFFFFFFFFFFFFFFF register
notification for EVENT_TRACK_CHANGE for pts test
Bug:
79378129
Test: PTS AVRCP/TG/NFY/BV-04-C
Change-Id: Ia861bf4682e9daf9c7c3842df9f95381171da574
Merged-In: Ia861bf4682e9daf9c7c3842df9f95381171da574
(cherry picked from commit
a25fca2acb30aafab9cedc521888b794b703eff3)
Ajay Panicker [Tue, 8 May 2018 23:34:04 +0000 (16:34 -0700)]
Send UID 0 for track changed if there is no media ID
Some carkits need the track changed UID to change even though we
explicitly report that UID's are refreshed on any now playing list
change. UID 0 is special since it represents that the song has changed
and forces an update.
Bug:
72824896
Test: Tested with Audi carkit where Spotify wasn't updating past the
first song previously.
Change-Id: I033f9a2f96acfde25922d6912a4927b95fb89596
Merged-In: I033f9a2f96acfde25922d6912a4927b95fb89596
(cherry picked from commit
2789ae2b57085aad446d7e062f66f5d83cf26e0b)
Jakub Pawlowski [Tue, 29 May 2018 22:28:15 +0000 (15:28 -0700)]
LE Create Connection Complete - crash on Command Disallowed
When LE Create Connection Complete is received with status "Command
Disallowed", we can't tell which state we should transition to. This
can be triggered only in case of rare race condition. Crash to recover.
This was introduced in
24adb37e4106bf8544c7729d34451fdf2777c4dc, when
generic handling of all errors to this event was added.
Bug:
77429706
Test: sl4a GattConnectTest
Change-Id: I888861461da296876d97e8784a3dc7c53130fb51
Jakub Pawlowski [Wed, 30 May 2018 02:43:52 +0000 (02:43 +0000)]
Merge "Fix race condition in LE Create Connection Cancel handling"
Hansong Zhang [Tue, 17 Apr 2018 23:00:30 +0000 (16:00 -0700)]
Bluetooth HFP: Use WBS by default (1/5)
Bug:
72624793
Test: compilation
Change-Id: Ia64c49210769581bba5be7354b67fa50d89cfdaa
Pavlin Radoslavov [Mon, 28 May 2018 03:06:20 +0000 (20:06 -0700)]
Explicitly stop streaming when switching streaming to another device
* Explicitly call btif_av_stream_stop() inside
btif_a2dp_source_end_session_delayed() when ending the session.
It should be called regardless whether we are using software
or hardware based encoding.
* Removed extra btif_av_stream_stop() call inside
BtifAvSource::SetActivePeer(), because it is not needed anymore.
It is replaced by the call inside btif_a2dp_source_end_session_delayed()
* Added "peer_address" argument to btif_av_stream_stop()
so it can be used to stop the stream to a specific peer.
* Fix an issue inside bta_av_chk_2nd_start() that was triggering
extra start request to some headsets - the extra start request
was blocking follow-up legitimate requests.
* Simplify the logic inside bta_av_do_start() so it is easier to
identify issues when start streaming. The actual processing logic
itself is not changed.
* Add extra log messages or update existing ones to help debug
similar issues in the future.
Bug:
79909084
Test: Manual: streaming A2DP, connect a new device, change active device
Change-Id: Id583aa44aec7082dc5f94532e6b41a7ea33813a1
Merged-In: Id583aa44aec7082dc5f94532e6b41a7ea33813a1
(cherry picked from commit
7b97d4d4a45d25a4ac80f3b59a40c115f0a03af4)
Jakub Pawlowski [Tue, 29 May 2018 19:52:17 +0000 (12:52 -0700)]
Fix race condition in LE Create Connection Cancel handling
Message with description of the issue being fixed:
https://android-review.googlesource.com/c/platform/system/bt/+/646600#message-
4781dd6e3e74d8b11ef716bbf58edbc64645f18c
Bug:
77429706
Change-Id: I1c076c7f033fc3d1aaf47887ce691b6325721d85
Jakub Pawlowski [Sat, 26 May 2018 04:07:38 +0000 (21:07 -0700)]
Linux build and linking fix
Test: run bluetoothtbd on Linux
Change-Id: Id9d913f8766b71c77696df25f74a8e33ba57523e
Jakub Pawlowski [Tue, 29 May 2018 15:03:54 +0000 (15:03 +0000)]
Merge "Don't refresh GATT database after bonding"
Sunny Kapdi [Fri, 25 May 2018 16:29:16 +0000 (09:29 -0700)]
A2DP Offload: Avoid Offload_start/stop from remote
When DUT is A2DP Source, and remote initiates start
we suspend it immediately. There is no need to do
Offload_start/stop in this case. Also, the offload
start/stop was coming out of sync here.
Bug:
80284000
Test: Manual
Change-Id: If54c28188e7432ebcba639cd2fbfe81536c2f2e6
Joseph Pirozzo [Fri, 25 May 2018 19:31:06 +0000 (12:31 -0700)]
Inform AVRCP Controller before cleaning up.
Move the JNI callback earlier in the procedure before the device info is
zeroed out such that the higher levels know which device disconnected.
Bug:
80265765
Test: Disconnect AVRCP and verify bluetooth_manager reports it is
disconnected.
Change-Id: I1c69341227f4c1c1662022a4a77e1752f6306d2e
Jack He [Thu, 24 May 2018 22:53:27 +0000 (15:53 -0700)]
HFP: Only advance BTIF queue for outgoing connections
* Modify HFP btif layer to only advance queue when there is a
connection outcome for outgoing connections
* During an ACL collision, incoming connection may preempt outgoing
connection and come back to the upper layer in a separate control
block. In this case, we should not advance the btif queue until the
outgoing connection sends callback to the btif layer
* When RFCOMM connection is successful, but SLC connection failed, we
should also send callback to Java layer and advance the queue. We
should only do this when transition from RFCOMM connected to
Disconnected, not from SLC connected to Disconnected
* We should only advance the queue after sending connection state update
to Java layer
* This prevents the crash in connect_int() where we check for any
control block that is left in connecting state
Bug:
80251999
Test: connect HFP devices rapidly to trigger ACL collision
testplans/details/166812/3975
Change-Id: Iba3736c77d8ef4a4701896461042466c26bc4820
Jack He [Fri, 25 May 2018 01:59:13 +0000 (18:59 -0700)]
HFP: Fix ACL collision handling and WBS update
* Correctly set control block handle when passing WBS event data to
upstream
* Correctly reject local outgoing connection when a colliding incoming
connection is connected to RFCOMM
* Add more logging to help with future debugging
Bug:
80251999
Test: connect HFP devices rapidly and toggle Bluetooth rapidly
testplans/details/166812/3975
Change-Id: I90616d70335ca68c40251fb722146924c4801cbe
Jakub Pawlowski [Wed, 16 May 2018 21:46:40 +0000 (14:46 -0700)]
Don't refresh GATT database after bonding
According to the Bluetooth spec: "For a given client, the server shall have
one set of attributes.".
If we discover services before bonding, we should be fine using them
afterwards, without need to refresh whole GATT database.
This change should speed up bonding HOGP devces by around one second.
Refreshment of GATT database was tied to connection parameter
reenabling. Make sure bonding does not disable connection parameter
change.
Bug:
67057055
Test: Bond with HOGP device, verify profile is connected properly
Change-Id: I1e738c56e211cf3d9234b424f354bf3e468227aa
Treehugger Robot [Fri, 25 May 2018 21:09:38 +0000 (21:09 +0000)]
Merge "Linux build fix"
Jakub Pawlowski [Thu, 24 May 2018 19:27:10 +0000 (12:27 -0700)]
Fix log level - requesting MTU is not error
Test: compilation
Change-Id: Idf99af22cf4d29f6fb3da08e86e36b3394617c4f
Jakub Pawlowski [Fri, 25 May 2018 16:31:26 +0000 (09:31 -0700)]
Linux build fix
Test: compile on linux
Change-Id: I831df72da8bdec17c4d9c87ebdfb333024eb964c
Treehugger Robot [Thu, 24 May 2018 22:52:05 +0000 (22:52 +0000)]
Merge "Add separate sniff mode settings for gamepads"
Treehugger Robot [Thu, 24 May 2018 22:52:05 +0000 (22:52 +0000)]
Merge changes from topic "ds4-support"
* changes:
Add UHID GET_REPORT functionality
Option to send data report through BTA_HhSetReport
Kim Low [Wed, 20 Dec 2017 23:11:08 +0000 (15:11 -0800)]
Add separate sniff mode settings for gamepads
For gamepads, the sniff intervals need to be much shorter. The
min is set to 14 slots (8.75ms) and max is set to 18 slots
(11.25ms).
Test: Load >=4.10 hid-sony driver, connect a DualShock4, check its
responsiveness.
Wait for 5 minutes, wake it up (if it went into PARK mode)
and check that it's still as responsive.
Furthermore, use a Bluetooth sniffer to confirm the sniff
interval.
Bug:
38511270
Change-Id: I27e2e0c8e88ab51800c4976e0971c92a3793f8d2
Kim Low [Thu, 6 Apr 2017 20:16:26 +0000 (13:16 -0700)]
Add UHID GET_REPORT functionality
GET_REPORT wasn't supported previously. >=4.10 hid-sony driver
requires this feature to get the calibration data for DualShock4.
To be backwards compatible with kernel 3.10, UHID_FEATURE and
UHID_FEATURE_ANSWER are used instead of UHID_GET_REPORT and
UHID_GET_REPORT_REPLY. Also, UHID_SET_REPORT functionality cannot
be supported since it's not implemented in kernel 3.10.
Test: Load >=4.10 hid-sony driver, connect a DualShock4, and check
that the DualShock4 LED turns blue, which confirms both
get feature report and output data report working.
Bug:
38511270
Change-Id: Ic28760f423cc09754fd32a107a499be6677ca747
Kim Low [Thu, 6 Apr 2017 19:33:14 +0000 (12:33 -0700)]
Option to send data report through BTA_HhSetReport
Drivers may send SET_FEATURE_REPORT by using type UHID_OUTPUT
and output.rtype UHID_FEATURE_REPORT, or send OUTPUT_DATA_REPORT
by using type UHID_OUTPUT and output.rtype UHID_OUTPUT_REPORT.
For type UHID_OUTPUT, the Fluoride stack calls btif_hh_setreport()
which then calls BTA_HhSetReport() correspondingly. Hence it is
necessary for BTA_HhSetReport() to handle both the output.type
UHID_FEATURE_REPORT (BTA_HH_RPTT_FEATURE) and UHID_DATA_REPORT
(BTA_HH_RPTT_OUTPUT).
Test: No stand-alone test.
Bug:
38511270
Change-Id: I210f6338d3152dad100920dc8a1eb69b563b70ae
Sunny Kapdi [Wed, 23 May 2018 22:14:35 +0000 (15:14 -0700)]
A2DP Offload: Don't crash on repeated endSession
AudioOffload endSession is called from multiple places.
Do not crash if session has already ended.
Also, added/enabled extra log messages to help debug similar issues.
Bug:
80148693
Test: Manual
Change-Id: I409c0146f9629cee6bdabf16e52e88201ee02267
Treehugger Robot [Thu, 24 May 2018 03:37:54 +0000 (03:37 +0000)]
Merge "GATT: Fix GATT error response for execute write"
Treehugger Robot [Wed, 23 May 2018 23:59:08 +0000 (23:59 +0000)]
Merge "Increase LE connection interval with bonded Hearing Aids"
Treehugger Robot [Wed, 23 May 2018 23:52:58 +0000 (23:52 +0000)]
Merge "Enable the AVRCP Service by default (2/2)"
Ajay Panicker [Wed, 11 Apr 2018 18:16:26 +0000 (11:16 -0700)]
Enable the AVRCP Service by default (2/2)
Bug:
80188446
Test: Flash a device and see that AvrcpTargetService is enabled
Change-Id: I1ad1fff07b5ee6c553fc89a75e649789d82f85cc
Merged-In: I1ad1fff07b5ee6c553fc89a75e649789d82f85cc
Stanley Tng [Wed, 23 May 2018 01:15:42 +0000 (18:15 -0700)]
Increase LE connection interval with bonded Hearing Aids
When there are bonded Hearing Aids device, increase the minimum LE
Connection Interval to reduce the audio noises on the devices.
Bug:
80079923
Test: Manual test with RAT mouse and HA devices
Change-Id: I589bc574ef7ff3754a149e30fb3c0a685ce27823
Treehugger Robot [Wed, 23 May 2018 20:46:44 +0000 (20:46 +0000)]
Merge "HFP: Ignore DISCONNECTED state in PhoneStateChange"
Jack He [Wed, 23 May 2018 00:35:57 +0000 (17:35 -0700)]
HFP: Ignore DISCONNECTED state in PhoneStateChange
* DISCONNECTED state is a transient state from Telecom service and will
always lead to IDLE state when the call is completely disconnected
* This state should be ignored as HFP specification does not handle
cases when a call is being disconnected
Bug:
78674822
Test: Receive incoming call and hangup
Change-Id: Icebdf9b5fdffad3e2b78645d4f0c69ec13b2604c
Pavlin Radoslavov [Wed, 23 May 2018 14:40:09 +0000 (07:40 -0700)]
Reduce A2DP/AVDTP related dumpsys output
* Don't print control blocks that are not in use
* Print some sections only if the runtime trace level is DEBUG(=5) or above
* Renamed section "A2DP Codecs and Peers State:" to
"A2DP Peers State:"
Bug:
80179152
Test: Manual
Change-Id: I9fcd7387ed469094132d5be989d4976ce103cfc8
Subramanian Srinivasan [Wed, 23 May 2018 02:35:48 +0000 (19:35 -0700)]
GATT: Fix GATT error response for execute write
Usecaes:
Execute GATT/SR/GAW/BI-09C
Expected Result:
Test case passes
Observed Result:
Unable to pass the test cases
Root Cause:
Incorrect error response sent by DUT if there is no pending write request
Fix:
Send GATT_INVALID_OFFSET error when no pending write request
Test: GATT/SR/GAW/BI-09C passes
Bug:
80168519
Change-Id: I74e723ab0e39ce04e21f929a16dffcd996d1d23e
Pavlin Radoslavov [Wed, 23 May 2018 00:56:22 +0000 (17:56 -0700)]
Explicitly stop the stream when the A2DP session ends
Note: this needs to be done only for the A2DP HW offload scenario.
For the software data path, this will be done by the Audio HAL.
Bug:
80117050
Test: Manual
Change-Id: I4397d219d82d779706e946f0c7f833c1e93e91f4
Treehugger Robot [Tue, 22 May 2018 23:01:26 +0000 (23:01 +0000)]
Merge "Update connection parameters just once before GATT discovery"
Joseph Pirozzo [Tue, 22 May 2018 22:20:02 +0000 (22:20 +0000)]
Merge "Support AVRCP Controller on JNI thread"
Jakub Pawlowski [Tue, 22 May 2018 21:15:31 +0000 (14:15 -0700)]
Update connection parameters just once before GATT discovery
Call to L2CA_EnableUpdateBleConnParams is already made just before
call to bta_gattc_set_discover_st
Test: compilation
Change-Id: I30939065b5486e20c2f6f456dde96266e9395690
Treehugger Robot [Tue, 22 May 2018 18:17:38 +0000 (18:17 +0000)]
Merge "HFP: Set audio handle for active device during incoming call"
Treehugger Robot [Tue, 22 May 2018 17:32:18 +0000 (17:32 +0000)]
Merge "Use the effective peer MTU when preparing the codec configuration"
Treehugger Robot [Tue, 22 May 2018 17:25:31 +0000 (17:25 +0000)]
Merge "Don't mix internal AVDTP state when connecting to two devices"
Treehugger Robot [Tue, 22 May 2018 16:28:29 +0000 (16:28 +0000)]
Merge "gatt_api: Avoid possible NULL dereference"
Pavlin Radoslavov [Tue, 22 May 2018 09:03:20 +0000 (02:03 -0700)]
Use the effective peer MTU when preparing the codec configuration
Added new method A2dpCodecConfig::getEffectiveMtu() and use it
to obtain the effective MTU per peer per codec.
The effective peer MTU could be smaller than the one reported
by the peer (e.g., for interoperability reasons).
Bug:
77913350
Test: Manual
Change-Id: Idd5230681ac5856fd18dd33ac48723c6ea609e16
Greg Kaiser [Tue, 22 May 2018 13:59:48 +0000 (06:59 -0700)]
gatt_api: Avoid possible NULL dereference
We move a logging statement which dereferences a NULL pointer
until after the NULL check, and expand the error message for
the NULL check to include the function name.
Test: TreeHugger
Change-Id: Ib5134b0d6b9ec5da95ee62da9412b977925000ee
Pavlin Radoslavov [Fri, 18 May 2018 03:38:44 +0000 (20:38 -0700)]
Don't mix internal AVDTP state when connecting to two devices
There is a race condition when connecting to two devices, and
the connection to one of the devices is not powered on.
Because of the race condition, the wrong tBTA_AV_LCB entry inside
bta_av_sig_chg() might be allocated for the connection to
the device that is powered on. As a result of that, when
the connection attempt to the powered off device times out,
we will use the wrong bta_handle to close the existing AVDTP connection to
the device that is connected.
Also:
- Add a new function BTA_AvObtainPeerChannelIndex() to select the
appropriate AvdtpCcb entry if there an outgoing connection request
while an incoming connection is received.
- Added/updated log messages to help debugging similar issues in the future
- Removed unnecessary SetActivePeer() call inside the BtifAv state
machine for A2DP Source to avoid additional internal/transient glitches
Test: Manual
Bug:
79697137
Change-Id: Ie55e3dcf6c6a15637ce3631f2828548a2423d881
Hemant Gupta [Tue, 22 May 2018 03:55:50 +0000 (09:25 +0530)]
GATT: Fix usage of 16 and 32 bit UUID's in Discover services by UUID
Fix improper usage of 16 and 32 bit UUID's in Disocever services by UUID
Fixes PTS test cases GATT/CL/GAD/BV-08-C and GATT/CL/GAR/BV-03-C.
Test: PTS test cases GATT/CL/GAD/BV-08-C and GATT/CL/GAR/BV-03-C passes
Bug:
80095184
Change-Id: Ia0a26bd20ee68c5c7db0bc00036634f6719f25e9
Jack He [Tue, 22 May 2018 00:09:29 +0000 (17:09 -0700)]
HFP: Set audio handle for active device during incoming call
* Set audio handle for active device during incoming call
* Change debug level logging to warning level when SCO is not allowed to
open or when RING command is not allowed to be sent
Bug:
77949569
Test: connect with HFP devices and receive incoming call
Change-Id: Ibc2caf740f94817ae725786e35e8592390167ce2
Jakub Pawlowski [Fri, 18 May 2018 22:57:01 +0000 (15:57 -0700)]
Simplify bta_gattc_sdp_callback
* join multiple if statements to improve readability
* malloc and free memory just once for tBTA_GATTC_CB_DATA
Test: compilation
Change-Id: I907645ed04ed4b628a3b24785b1ccd16b69d83bb
Treehugger Robot [Mon, 21 May 2018 21:20:07 +0000 (21:20 +0000)]
Merge "HFP: Return SDP status to HFP layer"
Jakub Pawlowski [Mon, 21 May 2018 16:38:48 +0000 (09:38 -0700)]
Unify logging in gatt_api.cc
- always log conn_id as hex value
- use "=" instead of ":" as delimiter between name and value
- get rid of StringPrintf
Test: compilation
Change-Id: Ia35b79c3732b19661e4655d5cf0923b7e701985f
Jack He [Sun, 20 May 2018 03:05:02 +0000 (20:05 -0700)]
HFP: Return SDP status to HFP layer
* Fix an error introduced in change Ic0b4498dd623d0ea31b4513d6b7861cae390bc72
so that SDP status is sent up to the HFP BTA layer
* With SDP status correctly passed up, HFP BTA layer can correctly
determine when to continue SDP search for HSP
* When open connection to HFP or HSP devices, use a control block's
registered services instead of passing in opening services every time
from BTIF layer
* Do not use a control block that are in CONNECTING or DISCONNECTING
state
* Add a crash in btif_hf.cc:connect_int() to gurantee that no control
block is in connecting or disconnecting state when connect_int is
called as it should be guranteed by the btif queue configuration
Bug:
74234576
Test: connect to headset, make calls and hangup
Change-Id: I5e2bce8c2f0f51bd3fd3e85e82827c5fb5e92887
Myles Watson [Fri, 18 May 2018 18:31:33 +0000 (11:31 -0700)]
AVRCP: Route CType NOT_IMPLEMENTED as a response
Bug:
79698590
Test: net_test_avrcp, Connect to the Anker MP140
Change-Id: Ie88dcea949ecb33bc3d76d86b07ab0396a21500d
tedwang [Tue, 15 May 2018 14:21:39 +0000 (22:21 +0800)]
Add General Reject for invalid PDU ID
Add Avrcp Browse General Reject packet
Respond general reject when undefined AVRCP Browsing PDU ID sent from
remote.
Bug:
79376704
Test: run host native test net_test_btpackets
Change-Id: I8a44d8e3f0cc5fac89e23217726c76ede4aff916
(cherry picked from commit
3fbf8b4fff8b52b781fa611e0b62c97bca28d76f)
Pavlin Radoslavov [Wed, 16 May 2018 02:21:03 +0000 (19:21 -0700)]
Don't update the MTU across multiple A2DP connections that are open
Remove function bta_av_chk_mtu() that updates the MTU to the smallest
value across all open A2DP connections, because that function is not needed.
Such MTU update is problematic for Multi-A2DP, because some codecs cannot
be initialized/used if the MTU is too small. E.g., for LDAC the
MTU value used for the codec initialization must be at least 679.
Bug:
79675742
Test: Manual - (1)Connect Bose QC35; (2)Connect Sony SRS-XB2; (3)Play music
Change-Id: I8048a1bf6df6d4d6291bf3570a95b5182af15b6a
Treehugger Robot [Wed, 16 May 2018 00:12:44 +0000 (00:12 +0000)]
Merge "Respond reject with INVALID_PARAMETER when register for invalid event ID"
Treehugger Robot [Tue, 15 May 2018 23:21:27 +0000 (23:21 +0000)]
Merge "Print extra error code if LDAC encoder fails to initialize"
tedwang [Tue, 15 May 2018 07:25:11 +0000 (15:25 +0800)]
Respond reject with INVALID_PARAMETER when register for invalid event ID
It should respond reject with INVALID_PARAMETER instead of
INVALID_COMMAND while remote registering for an invalid event ID
Bug:
79377562
Test: PTS AVRCP/TG/NFY/BI-01-C
Change-Id: Ic006cb2f6584216f9457af5576dd2d39adaa3cf5
(cherry picked from commit
d51c1dc6777eeb4d414c67e38999af436aaf71a8)
Hansong Zhang [Mon, 14 May 2018 18:29:20 +0000 (11:29 -0700)]
AVRCP: Respond UID Changed for invalid Get Item Attributes command
When we receive GetItenAttributes command with an invalid UidCounter
other than 0x0000, we should reply UID Changed (0x05)
Bug:
79270308
Test: PTS AVRCP/TG/MCN/CB/BI-05-C; unit test
Change-Id: I819991d083944de5a08b0cd4fd0fb33c63f0142a
tedwang [Wed, 9 May 2018 06:28:04 +0000 (14:28 +0800)]
Add respond Reject with Invalid parameter for Unknown Capability ID
Add handle Get Capabilities with Unknown Capability ID and unit test
for this.
Bug:
79269978
Test: Run host native test net_test_avrcp
Change-Id: I2cb606bcb6462190354bb471577d9383e43649c1
(cherry picked from commit
5e872794641b89b63176befdb04865d5acf14aa3)
Treehugger Robot [Tue, 15 May 2018 20:13:30 +0000 (20:13 +0000)]
Merge "AVRCP: Verify SetBrowsedPlayer player ID"
Hansong Zhang [Mon, 14 May 2018 23:48:58 +0000 (16:48 -0700)]
AVRCP: Verify SetBrowsedPlayer player ID
IUT should reject the invalid SetBrowsedPlayer command sent from PTS.
Bug:
79377126
Test: PTS AVRCP/TG/MPS/BI-02-C
Change-Id: I2afde442e3b3563f4a1a37e2914c9b16fe07e8fc
Pavlin Radoslavov [Tue, 15 May 2018 10:19:41 +0000 (03:19 -0700)]
Print extra error code if LDAC encoder fails to initialize
Also, add a missing CHECK() assert that the LDAC handle is valid.
Bug:
79675742
Test: Code compilation
Change-Id: I4bd51ed978eadc2aecc27d199e6f01bb31c9a631
Joseph Pirozzo [Tue, 8 May 2018 03:44:23 +0000 (20:44 -0700)]
Support AVRCP Controller on JNI thread
Recent changes to threading of the BTA layer require that all JNI
callbacks are performed on the JNI thread. This change updates the APIs
to ensure that the data passed is thread safe.
Bug:
79145011
Test: Browse and Play music via AVRCP Controller.
Change-Id: I191658ea90c96bcf372e772119db6c31c9010230
(cherry picked from commit
4be70639dd863b8e8949f4db5aa2a332c1510412)
Jakub Pawlowski [Tue, 15 May 2018 02:00:07 +0000 (02:00 +0000)]
Merge "Removed alarm callback execution statistics"
Treehugger Robot [Mon, 14 May 2018 23:28:45 +0000 (23:28 +0000)]
Merge "Mask "LE Enhanced Connection Complete" when BLE_PRIVACY_SPT=FALSE"
Jakub Pawlowski [Thu, 19 Apr 2018 09:32:40 +0000 (02:32 -0700)]
Mask "LE Enhanced Connection Complete" when BLE_PRIVACY_SPT=FALSE
The code which handles this event is protected by an #ifdef. This was
causing connections to be established, but never detected by host.
Bug:
78264903
Test: establish connection to LE device with privacy disabled
Change-Id: Iea35016108bcbda64427250cc06258c422c1fdce
Pavlin Radoslavov [Mon, 8 Jan 2018 19:37:05 +0000 (11:37 -0800)]
Removed alarm callback execution statistics
Updating the alarm state after the callback returns can be problematic
in case the callback itself deleted the alarm.
Bug:
67110137
Test: Manual
Change-Id: Id4de06eebedb792cadd63d09efb68672e9bddc69
Jakub Pawlowski [Mon, 14 May 2018 20:47:52 +0000 (20:47 +0000)]
Merge "Use identity addr in BLE scan filter"
Ajay Panicker [Mon, 14 May 2018 18:26:16 +0000 (18:26 +0000)]
Merge "Use weak pointers for device.cc callbacks to prevent use after delete"
Claire Treyz [Fri, 11 May 2018 15:13:28 +0000 (08:13 -0700)]
Use identity addr in BLE scan filter
For BT controllers with the ability to filter scans and resolve RPAs on
controller, when trying to filter for a Public ID type address the
filter must use the static identity address of the peer device instead
of the random pseudo address.
Bug:
78888800
Test: manually tested filtered scanning for BLE peer with RPA with a
device with both offloaded RPA resolution & controller filtering
supported. Tested on a device with no controller filtering, which has
no changes, as expected.
Change-Id: I1d92e219bdbc9ba2399eae637a1f4623d695a3f8
Treehugger Robot [Fri, 11 May 2018 21:53:02 +0000 (21:53 +0000)]
Merge "HFP: Workaround for car kits that do not send AT+BAC command"
Treehugger Robot [Fri, 11 May 2018 21:06:43 +0000 (21:06 +0000)]
Merge "Explicitly restart audio processing when switching active device"
Pavlin Radoslavov [Thu, 10 May 2018 16:52:58 +0000 (09:52 -0700)]
Explicitly restart audio processing when switching active device
* Add internal APIs to restart A2DP session and use them
when switching the A2DP active device:
btif_a2dp_source_restart_session() and btif_a2dp_sink_restart_session() .
* Removed internal A2DP Source APIs that shouldn't be APIs
* Call immediately btif_a2dp_on_stopped() when processing
BTIF_AV_STOP_STREAM_REQ_EVT event to stop sooner the audio
datapath processing and report back to the Audio HAL call.
This eliminates the need for waiting for the BTA_AV_STOP_EVT
upcall event from the remote device.
* Added extra log information when processing events in the BtifAv
state machine.
Bug:
78360113
Test: Manual: streaming A2DP, change active device, change codec setup.
Change-Id: Icb356587af9cfaee7aea9f3f9bc95a0fe000fc52
Jack He [Tue, 1 May 2018 06:59:40 +0000 (23:59 -0700)]
HFP: Workaround for car kits that do not send AT+BAC command
* Some misbehaving HF devices (e.g. some Hyundai car kits) indicate
their support on Wide Band Speech and Codec Negotiation, but do not
send the required AT+BAC command during Service Level Connection
setup. However, such car kits still expect Fluoride to do codec
negotiation during SCO setup.
* This CL adds a workaround so that when HF indicates support for WBS
and codec negotiation, Fluoride will attempt codec negotiation even
though AT+BAC is never received.
* Store the SDP feature locally. If WBS is supported and no AT+BAC is
received, use the SDP features to set the suported codec.
Bug:
77883405
Test: make, connect SCO to and from Hyundai car kits
Change-Id: I2be6007022183cac5b9006f37089a587b4a67372
Ajay Panicker [Thu, 10 May 2018 19:39:32 +0000 (12:39 -0700)]
Use weak pointers for device.cc callbacks to prevent use after delete
Bug:
79400706
Test: Turn bluetooth off then on while connected to a device and playing
music
Change-Id: I2132bb01796a724fba6a36f4eca4f4795b919864
(cherry picked from commit
497e2833c983377ae501c15d5c66327c9c5dbafa)
Treehugger Robot [Thu, 10 May 2018 22:35:02 +0000 (22:35 +0000)]
Merge "Add helper classes to auto indent newlines for ostreams"
Treehugger Robot [Thu, 10 May 2018 21:23:46 +0000 (21:23 +0000)]
Merge "Hearing Aid: Add dumpsys log for audio packet"
Jakub Pawlowski [Thu, 10 May 2018 13:42:43 +0000 (06:42 -0700)]
HearingAid RemoveDevice - don't crash when profile not enabled
Bug:
79468820
Test: Unbond non-hearing aid device when profile not enabled
Change-Id: I2a87f8725447045e7bc5b2a33facf1ce14b47c54
Hansong Zhang [Wed, 9 May 2018 21:39:56 +0000 (14:39 -0700)]
Hearing Aid: Add dumpsys log for audio packet
Add log for audio drops from audio HAL and buffer overflow
Add log for device capabilities and HiSyncId
Sample output:
Hearing Aid Manager:
<device1> connected
binaural right 0x...
Packet counts (enqueued/flushed) : 73557 / 773
Frame counts (enqueued/flushed) : 73557 / 773
<device2> connected
binaural left 0x...
Packet counts (enqueued/flushed) : 74172 / 886
Frame counts (enqueued/flushed) : 74172 / 886
Hearing Aid Audio HAL:
Counts (underflow) : 0
Bytes (underflow) : 0
Last update time ago in ms (underflow) : 0
Test: manual
Bug:
69623109
Change-Id: I5021b9214828b1846506638000f29af7343a3354
Treehugger Robot [Thu, 10 May 2018 00:58:48 +0000 (00:58 +0000)]
Merge "A2DP: Add logging when A2DP fails to open"