History log of /system/bt/btif/src/bluetooth.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
04442a41e9d7efd32c1acda5cae60509535b2cc6 13-May-2017 Jack He <siyuanh@google.com> MCAP: Add test interface for PTS test (2/2)

* PTS tests requires MCAP APIs to be called at protocol level
* This CL creates a test interface to enable the above functionality

Bug: 37867299
Test: make, no user visible effect
Change-Id: I15cc6cc613ce8f7c57564296e45077ab877c269b
(cherry picked from commit 722ce12babbd3d1e814f6e704860699a0b726e4f)
/system/bt/btif/src/bluetooth.cc
21ae30a6e5512cc454aec823efbf445ed5e1e238 18-Apr-2017 Ajay Panicker <apanicke@google.com> Limit btsnoop file size (5/9)

Limit btsnoop file size by rotating between snoop files. The rotation occurrs
when a fixed number of packets have been logged and will start overwriting
the older file.

Bug: 35998031
Test: Enable snoop logs from developer options and let logs get large
Merged-In: Ia8741223cb31b2c20d9ef5607e9204cc3946b165
Change-Id: Ia8741223cb31b2c20d9ef5607e9204cc3946b165
/system/bt/btif/src/bluetooth.cc
0b4f3f7efb2b64e931cea7460c742628b8d0b8c0 01-Feb-2017 Pavlin Radoslavov <pavlin@google.com> Add memory allocation statistics to the Bluetooth dumpsys output

The following memory allocation statistics are added to
the "dumpsys bluetooth_manager" output.
Those are tracking the allocations that are using the OSI malloc mechanism:
osi_strdup() / osi_strndup() / osi_malloc() / osi_calloc() / osi_free()

Bluetooth Memory Allocation Statistics:
Total allocated/free/used counts : 4063 / 3323 / 740
Total allocated/free/used octets : 922460 / 607941 / 314519

Test: Running "adb shell dumpsys bluetooth_manager"
Change-Id: Ibe1d28ec3a2acfd87cfaa10e5902ef3b596e64a8
/system/bt/btif/src/bluetooth.cc
f3175629208a64b190dde4dcf5f92cacef70d3e9 09-Dec-2016 Jack He <siyuanh@google.com> Fix A2DP metrics session duration

* Fixed A2DP duration counting. It is now counting from music play start
to music play end.
* Start logging a2dp connection as Bluetooth sessions. Currently, only
A2DP connections are logged. Thus the bluetooth session length will be
the total connection length and the length within A2DP session message
will be the audio connection length.
* Add a audio_duration_millis field in A2DPSession to record audio duration
* Add bonded memory constraint for metrics entries
* Use a builder mechanism to only build metrics upon dumping
* Refactor metrics module into BluetoothMetricsLogger class
* Created unit test for BluetoothMetricsLogger

Bug: 33694310
Test: Code compilation, Unit test, BtFunhausMetricsTest
Change-Id: Iea2a997c4ea074687a5d50860e9229f0e1b82659
/system/bt/btif/src/bluetooth.cc
5ce0116fbf5b530d5b93f11312096eade1021c1e 05-Dec-2016 Pavlin Radoslavov <pavlin@google.com> Add a mechanism for configuring the A2DP Source codecs

* Codec config internal abstraction:
- Add new classes A2dpCodecConfig and A2dpCodecs that (will)
encapsulate all codec-related APIs
- Add unit tests for the above two classes
- Add method A2dpCodecConfig.buildCodecConfig(), and use it when
creating the codec configuration instead of A2DP_InitSource2SinkCodec().
The new method can build the codec config by taking into account
optional user codec-related configuration preferences.
- Use the A2DP codec config API from the hardware/libhardware bt_av.h API
- Replace enum tA2DP_CODEC_SEP_INDEX with btav_a2dp_codec_index_t
from the bt_av.h API
- Move codec-specific functions from stack/include/a2dp_api.h
and stack/a2dp/a2dp_api.cc to stack/include/a2dp_codec_api.h
and stack/a2dp/a2dp_codec_config.cc
- Create a new base class A2dpCodecConfig() to hold some of the
codec-related state, and implement the corresponding A2dpCodecConfigSbc
and A2dpCodecConfigSbcSink derived classes.
- Move A2DP spec-related constants from stack/include/a2dp_api.h
to stack/include/a2dp_constants.h
- Move A2DP-related error codes from stack/include/a2dp_api.h
to stack/include/a2dp_error_codes.h
- Move A2DP SBC spec-related constants from stack/include/a2dp_sbc.h to
stack/include/a2dp_sbc_constants.h

* Implement the backend mechanism for handling user (re)configuration of
A2DP Source codecs as requested via the JNI API calls.
Also, any codec changes are reported back via JNI API callbacks.
The current audio parameter selection (sample rate, bits per
sample, channel mode - mono/stereo) is as follows:
- If the user selected parameters are acceptable (based on
local codec capability and the remote Sink capability),
those parameters are used.
- Else if the Audio HAL's requested parameters are acceptable,
those are used.
- Else if the default settings are acceptable, those are used.
- Else use the best match among the local and the remote device's
capabilities.

* Update the mechanism for handling OTA configuration requests from the
remote Sink device.
- The OTA prefered codec configuration is ignored if the current
codec configuration contains explicit user configuration, or if the
codec configuration for the same codec contains explicit user
configuration.

* Refactor the Audio HAL <-> Bluetooth audio parameter negotiation
mechanism:
The new mechanism gives some flexibility to the Media Framework to
choose the appropriate audio format (sample rate, bits per sample,
and channel mode - mono/stereo), and at the same time allows
the Bluetooth stack to double-check / overwrite the choice.
- out_get_parameters() on the Audio HAL side asks the Bluetooth stack
for all currently supported formats (for the current codec),
and returns them to the Media Framework: sample rate, bits per sample,
and channel mode (mono/stereo).
- The first time adev_open_output_stream() is called on the Audio HAL,
it asks the Bluetooth stack about the audio format currently selected
by the Bluetooth stack (based on codec negotiation with the Sink device,
and User Configuration).
- The second time adev_open_output_stream() is called on the Audio HAL,
its "config" will eventually contain the audio format selected
internally by the Media Framework. That audio format is sent to the
Bluetooth stack.
If that format is acceptable to the Bluetooth stack, the Bluetooth
stack will reconfigure itself internally, and will respond back with
those values. Otherwise, it will respond back with the values that
should be used instead.

* Misc other fixes and refactoring:
- Fix the BTA handling of A2DP codec reconfiguration
- Fix a bug in the implementation of A2DP_BitsSet(), and add the
approriate unit test. Also, fix the code that was using this function
incorrectly.
- The SBC encoder is compiled as a separate library
- Replace leftover usage of "false" with "FALSE" for macros, and
vice-versa for variable values.

Test: A2DP streaming to headsets, TestPlans/71390
Bug: 30958229
Change-Id: I440b6126e2250e33b0075f9789dd93154c007c2b
/system/bt/btif/src/bluetooth.cc
8843cc830b522cfe6f1e361297fc28fd331a1378 17-Apr-2014 Hemant Gupta <hemantg@codeaurora.org> HIDD: Add support for HID Device Role

This patch adds support for HID Device role in bluedroid stack allowing
DUT to be used as Keyboard or Mouse.

Bug: 33011576
Change-Id: I45b581a54f6c7bbc1f25226715a7ea23e34255c0
/system/bt/btif/src/bluetooth.cc
f2af1c42ccb2f642b241c2261b42d0be61d45438 13-Dec-2016 Jack He <siyuanh@google.com> Replace assert with CHECK from base/logging.h

* Replace assert with CHECK
* Remove all NDEBUG definitions
* Remove hacks for BT_LIBCHROME_NDEBUG
* Removed some removed directories from Makefile such as hcis, brcm, rpc

Coccinelle-assisted:

@@
@@

- #include "base/logging.h"
+ #include <base/logging.h>

@ assert_included @
@@

@ base_logging_included @
@@

@ depends on (assert_included && !(base_logging_included)) @
@@

- #include <assert.h>
+ #include <base/logging.h>

@ depends on (assert_included && base_logging_included) @
@@

- #include <assert.h>

@@
expression E;
@@

- assert(E);
+ CHECK(E);

And a bash script:

for file in $(find . -name "*.cc"); do
spatch --sp-file replace_assert_with_CHECK.cocci --in-place $file
done

The following files are maually edited:
btif/src/btif_config.cc
btif/src/btif_avrcp_audio_track.cc
btif/src/btif_gatt_client.cc
osi/src/data_dispatcher.cc
osi/src/reactor.cc
osi/src/thread.cc
osi/src/fixed_queue.cc
osi/src/list.cc
osi/src/allocation_tracker.cc
osi/src/alarm.cc
osi/test/wakelock_test.cc

Bug: 31781465
Test: Code compilation, Unit Tests, BtStressTest, BtFunhausMetricsTest
Change-Id: I21dc10a45be31665e41441b75b0515ed87523988
/system/bt/btif/src/bluetooth.cc
5eccd90936d606e0070872b247fd3462e9c9c19b 01-Dec-2016 Sanket Agarwal <sanketa@google.com> Implement multiple control blocks for HF Client in BTA/BTIF

Test: Manual test for multiple incoming/outgoing HF connections

Bug: b/30984220
Change-Id: If66cad7c9bbc92051ebb7efb2b352c10e7514af3
/system/bt/btif/src/bluetooth.cc
ee96a3c60fca590d38025925c072d264e06493c4 23-Nov-2016 Myles Watson <mylesgw@google.com> Fix asterisks in block quotes

Remove double asterisks from block quotes.

git grep -lP '^[*][*]' | xargs sed 's/^[*][*]/ \*/' -i

Fix asterisk line lengths

git grep -l '^[ /][*]\{79,\}[*/]' | \
xargs sed -i s,"^\([ /]\)[*]\([*]\{78\}\)[*]*\([*/]\)","\1\2\3",

Test: mma -j32
Change-Id: Ie3fd375ac2f804cb0f53bf1314a005e85973b3d7
/system/bt/btif/src/bluetooth.cc
9008888d24407541aa383aa4bd363a40abbf954b 16-Nov-2016 Myles Watson <mylesgw@google.com> Fix formatting after removing defines

clang-format -i --style=file bta/*/* btif/*/* include/*

Test: mma -j32
Change-Id: I9ebb32f0cc5bd24a7cb2ae25699999aab5036b13
/system/bt/btif/src/bluetooth.cc
9979121f0865e07432215529f9b157792ae3ef21 18-Nov-2016 Myles Watson <mylesgw@google.com> Remove BTA_GATT_INCLUDED

Test: Connect to a BLE Keyboard
Change-Id: I00393e2bf09fb65533e953896563e69aab5a22dc
/system/bt/btif/src/bluetooth.cc
84baa7f16e830394408278dbb8c508dd9fa02887 14-Nov-2016 Myles Watson <mylesgw@google.com> Remove BLE_INCLUDED define

Test: Connect to a BLE Keyboard
Change-Id: I5f8f4017c90c3c404004632fd10e6c2b93bd7783
/system/bt/btif/src/bluetooth.cc
d35a648d39710bbc5ac59f8add85166455af5af7 27-Oct-2016 Myles Watson <mylesgw@google.com> Remove deprecated UNUSED macro (1/5)

Generated automatically with coccinelle

/* This rule matches functions with arguments
* that have an UNUSED(arg) in the body.
*/
@r1@
identifier arg;
identifier fn;
type t;
parameter list[n] P;
@@

fn(P, const t arg) { ...
UNUSED(arg);
...
}

/* This rule removes the UNUSED line, and adds
* UNUSED_ATTR to the parameter list.
*/
@depends on r1@
identifier r1.arg;
identifier r1.fn;
type r1.t;
parameter list[r1.n] r1.P;
typedef UNUSED_ATTR;
@@

fn(P,
- const t arg
+ UNUSED_ATTR GETRIDOFTHISCOMMA, const t arg
) { ...
-UNUSED(arg);
...
}

Test: mma -j32

Change-Id: Idcaadd688d669d484e557becd050e69454508f3c
/system/bt/btif/src/bluetooth.cc
9a24711fd21b2bcab7d3ae67d0f34599f1eae4b1 26-Oct-2016 Colin Cross <ccross@android.com> Replace bluetooth protos with protobuf-lite

Use lite protobufs for bluetooth to remove dependency on
libprotobuf-cpp-full, which will be removed from the platform.

Requires dropping support for
adb shell dumpsys bluetooth_manager --proto-text
which requires full protobufs to call TextToString. The functionality
can be restored without adding a dependency on full protobufs with a
host protobuf decoder.

Bug: 32417805
Test: builds
Change-Id: Ifc9ee23264b1bfff3ad1f85ef4914f788028971a
/system/bt/btif/src/bluetooth.cc
6bd442f543972b072ef2cbbcf2f7c91202de1045 19-Oct-2016 Myles Watson <mylesgw@google.com> btif: Apply clang-format

clang-format doesn't understand block quotes of this form:

/* This is not handled well
** because there are two asterisks
**/

cd btif/

# Replace '**' at the beginning of the line with ' *'

sed 's/^[*][*]/ \*/' -i include/* src/* test/* co/*
clang-format --style=file -i src/* include/* test/* co/*

Test: mma -j32
Change-Id: I2477eae5480602d5b2fee5ec89c9ed7888022341
/system/bt/btif/src/bluetooth.cc
08406e93e6027082f8102df21f7e59f27c502c18 24-Sep-2016 Pavlin Radoslavov <pavlin@google.com> Split btif_media_task into Source, Sink and Control

* btif/include/btif_a2dp.h and btif/src/btif_a2dp.cc implement
the entry points for the BTIF A2DP module.

* btif/include/btif_a2dp_source.h and btif/src/btif_a2dp_source.cc implement
the BTIF A2DP Source component.

* btif/include/btif_a2dp_sink.h and btif/src/btif_a2dp_sink.cc implement
the BTIF A2DP Sink component.

* btif/include/btif_a2dp_control.h and btif/src/btif_a2dp_control.cc
implement the A2DP control mechanism for the audio channel from the
Media Framework.

Also:
* Removed BTA_AV_SBC_HDR_SIZE and used A2D_SBC_MPL_HDR_LEN instead.
* Removed BTIF_AV_SINK_FOCUS_REQ_EVT, because it is not used.
* Removed many of the "#if (BTA_AV_SINK_INCLUDED == TRUE)" guards.
* Removed "#ifdef USE_AUDIO_TRACK" guard, and always compile the
corresponding code.
* Removed tBTIF_AV_MEDIA_FEEDINGS_PCM_STATE and moved its state
to tBTIF_AV_MEDIA_FEEDINGS_STATE .

Bug: 30958229
Test: TestTracker/65192
Change-Id: I20bc52a1d7a7f03c92628a1562f14b7df3ebb445
/system/bt/btif/src/bluetooth.cc
cd03b046aa5b9aeff92b4eec2fb175c6551654f1 07-Oct-2016 Andre Eisenbach <eisenbach@google.com> Revert "Add dumpsys support for LE connection parameter updates"

Reverting for now after talking to Jacky because this causes circular dependencies as lower layer (stack/) functions are calling higher layer APIs (btif/) directly.

To restore a change like this, the data should be collected at a lower layer in the stack and reported through polling or a callback.

This reverts commit 8ec8ca4a875eed8b28e6714899f49781537411ae.

Change-Id: I748843864ae7198ea021fe70d2643a62097ab029
/system/bt/btif/src/bluetooth.cc
8ec8ca4a875eed8b28e6714899f49781537411ae 04-Aug-2016 Jacky Cheung <jackyc@google.com> Add dumpsys support for LE connection parameter updates

Change-Id: Ie203eec9d8efec0d55b1b10208c64a98449044a2
(cherry picked from commit 4e5514b69b95ee1416fb0d0b5e7783bcfe1612ab)
/system/bt/btif/src/bluetooth.cc
b7f64bc45dec7f7fec74ceb04874f322b9434bbf 22-Jun-2016 Marie Janssen <jamuraa@google.com> btif: standardize types, #ifs

Use standard types everywhere.
Use standard style for #if statements:
- #if (VAR_NAME == TRUE)
- #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__

Change-Id: Ic29d1d0b32c3ca9953752a4e5da6c28f45ec8895
/system/bt/btif/src/bluetooth.cc
713993d1784ab7c23aee1fa3cf1ab8676cc0aa69 21-Apr-2016 Jakub Pawlowski <jpawlowski@google.com> Convert BTIF code from C to C++

Modifications required:
* added proper casting
* moved variable definitions before goto statements
* added 'extern "C"' markers where needed
* renamed 'operator' to 'operator_name'

Bug: 28485365
Change-Id: I903357967387207e678866c02e008f047f8263f6
/system/bt/btif/src/bluetooth.cc