OSDN Git Service
Dennis Cheng [Wed, 29 Jul 2015 18:47:55 +0000 (11:47 -0700)]
test_vendor_lib: Use base::Thread
This upload starts the replacement of the event loop in HciTransport
with libbase's MessageLoopForIO. A global instance of the new
VendorManager class now manages the trio of previously global objects
(i.e. HciTransport, HciHandler, and BREDRController). Note that the new
libbase event loop structure doesn't actually handle anything right now
and the functionality will come in a future change.
Bug:
21586676
Change-Id: Id74392e2a566e06445eb65269f0142265087d47d
Arman Uguray [Thu, 6 Aug 2015 03:54:44 +0000 (03:54 +0000)]
Merge "service: Clean up IPC shutdown and add unit tests"
Dennis Cheng [Mon, 27 Jul 2015 22:55:15 +0000 (15:55 -0700)]
test_vendor_lib: Use libbase's CHECK/DCHECK
This upload pulls in libchrome to the test vendor library and uses CHECK
and DCHECK from base/logging.h.
Bug:
21586676
Change-Id: Ia88b4aa3728493d798e8d36076a351a00fad7c6b
Dennis Cheng [Thu, 23 Jul 2015 22:22:50 +0000 (15:22 -0700)]
test_vendor_lib: Dummy inquiry result
This upload mainly consists of stub command implementations to get
Bluetooth into the enabled state. The last command handled is the
inquiry command. Upon inquiry, the controller currently sends back a
dummy inquiry result for a fake device. This fake device appears under
the "Available devices" list in the UI. Bluetooth is able to be toggled
off and on from the UI as well (i.e. it doesn't crash after switching to
on for a few seconds).
Bug:
21586676
Change-Id: Ifd42a6ab4b9338afd461d2ef4f809bdd62fcf79f
Arman Uguray [Wed, 5 Aug 2015 01:59:27 +0000 (18:59 -0700)]
service: Clean up IPC shutdown and add unit tests
This CL reworks the IPCHandlerUnix shutdown routine to be more robust
and adds a test suite for the basic thread creation and shutdown sanity.
Bug:
22532180
Change-Id: I22d119d6514f2ceb1460c0925b4e92b71ec87e06
Arman Uguray [Tue, 4 Aug 2015 19:56:56 +0000 (12:56 -0700)]
service: Add Mock support for Daemon and CoreStack
This patch turns the Daemon and CoreStack classes into abstract
interfaces. Mock and real implementations are implemented in special
subclasses and obtained via a factory method. Other test implementations
(e.g. stub) can be provided in the future.
Bug:
22532180
Change-Id: Ic3000518e5cef1c867dd803cd0bba6aab49dc596
Ian Coolidge [Fri, 31 Jul 2015 23:18:18 +0000 (16:18 -0700)]
Drop obsolete libpower dependency.
Wakelock activity is delegated to depending module.
Change-Id: I368bb9287f208fed3a674423e82fb2a8cb9e8268
Arman Uguray [Sat, 1 Aug 2015 02:14:39 +0000 (19:14 -0700)]
Compile libbtcore and libosi for host
The static libraries now also compile for a Linux host as libbtcore-host and
libosi-host. The unittests are compiled for the target against Bionic libc and
for the host against glibc.
Bug:
22884515
Change-Id: Iac1310a48cfd2ff43c356cb31165fd176d0e1d39
Dennis Cheng [Tue, 16 Jun 2015 19:44:55 +0000 (12:44 -0700)]
test_vendor_lib: Use EPOLLOUT
HciTransport checks for write-readiness before sending any packets
back to the HCI. Packets are maintained on a queue and only written
when the EPOLLOUT flag is set in the epoll_event.
Bug:
21586676
Change-Id: Iebd9599286b62746e2be7e424c522058ae978bb1
Ian Coolidge [Mon, 3 Aug 2015 20:45:39 +0000 (20:45 +0000)]
Merge "bluedroidtest: drop obsolete libhardware_legacy dependency."
Ian Coolidge [Fri, 31 Jul 2015 22:36:07 +0000 (15:36 -0700)]
bluedroidtest: drop obsolete libhardware_legacy dependency.
Change-Id: Iecd7839aa52debb14c6fc10da2d7f838f8d05327
Dennis Cheng [Tue, 16 Jun 2015 19:44:55 +0000 (12:44 -0700)]
test_vendor_lib: Initial commit
Basic vendor library for a test Bluetooth controller. Currently consists
of mostly stub functions and objects and can only handle the reset
command (by immediately responding with a command complete event).
Implemented through a global EventDispatcher object which waits for data
from the HCI and directly returns the appropriate response.
Eventually, the dispatcher will manage a fake controller object that
will provide callbacks to be executed whenever events are processed by
the dispatcher. Unit tests are still in progress and will be in the next
upload.
Bug:
21586676
Change-Id: I1c6746f8b0f1732b89a1da13facecdd49b5ac1b6
Ian Coolidge [Fri, 31 Jul 2015 03:51:47 +0000 (20:51 -0700)]
Provide --android-ipc-socket-suffix.
This allows Android init to create a socket
for the service, and have consolidated access control.
Android init creates the socket and passes the FD through
an environment variable, so we must use OSI to decode it.
Bug:
22807533
Change-Id: I7ec0a14b8f3b44277ce99faad68623d6691f7863
Arman Uguray [Sat, 25 Jul 2015 02:14:42 +0000 (19:14 -0700)]
service: Refactor IPC and singletons
This CL makes the following major refactors to the system service code:
1. A new global Daemon object is introduced, which manages the main event
loop and all other subsystems of the Bluetooth daemon. This object is the only
singleton class and initializes and owns everything else.
2. Everything that was a singleton and/or was initialized directly in main.cpp
is now a) no longer a singleton; b) now initialized and owned by the global
Daemon instance.
3. All of the Chromecast specific IPC code has been moved into the ipc/
subdirectory. This directory is meant for everything that is IPC related,
paving the way for enabling multiple IPC systems (domain-socket based, Binder
based, etc) simultaneously in the future. Main changes to the Chromecast IPC
code are:
a. All files and classes have been renamed to reflect the
UNIX-domain-socket-specific nature of the IPC mechanism.
b. The code no longer hogs up the main thread while listening for
connections. All of this logic has been moved to a dedicated thread with
its own MessageLoopForIO, so that it can use the built-in mechanisms for
polling on client sockets in the future.
Bug:
22532180
Change-Id: I42db06dba6cff3bc8f8101a1ea2b6787a69409fd
Ian Coolidge [Thu, 11 Jun 2015 03:34:43 +0000 (20:34 -0700)]
service: Add null initialization for new scan cb.
scan_parameter_setup_completed_cb was added to
btgatt_client_callbacks_t.
Change-Id: If0aa113df7cf3db742fa64244bbb7a849c877525
Miao-chen Chou [Tue, 28 Jul 2015 23:55:28 +0000 (23:55 +0000)]
Merge "build: Eliminate cutils/str_parms dependency from system/bt"
Arman Uguray [Tue, 28 Jul 2015 01:32:05 +0000 (18:32 -0700)]
Add GN files for vendor_libs
Added BUILD.gn files for vendor_libs and vendor_libs/linux.
Bug:
21585592
Change-Id: I33f98421a94a4b4f530e48c94711775d776d02d7
Miao Chou [Wed, 8 Jul 2015 21:50:32 +0000 (14:50 -0700)]
build: Eliminate cutils/str_parms dependency from system/bt
Eliminate cutils/str_parmss dependency from system/bt by adding osi_str_parms:
- Added hash_map_utils which implements partial functions of cutils/str_parms
and uses osi/hash_map instead of cutils/hashmap.
- Updated osi/Android.mk, osi/BUILD.gn and the includes in audio_a2dp to use
osi_str_parms.
- Added unittest for hash_map_utils.
Bug:
21957864
Change-Id: I8458d9e45df6cab2b71840d24d17b9d75de9842c
Christopher Wiley [Mon, 27 Jul 2015 00:31:00 +0000 (17:31 -0700)]
Only build bt_service_unittests for linux
libchrome-host doesn't build on Mac, and while we get that sorted out,
let us not try and build this for Mac either.
Change-Id: I01d27391539d5c345d29a4ce949d0c3bcc931a7f
Samuel Ortiz [Fri, 24 Jul 2015 21:05:27 +0000 (14:05 -0700)]
Add HCI user channel based bluedroid vendor adaptation
This libbt vendor library creates and binds an HCI user channel
instead of talking to a serial port file descriptor. HCI frames
generated by the Android Bluetooth HAL are passed down as is to the
Linux kernel Bluetooth drivers through those sockets.
By pushing all the hardware dependencies down to the kernel, this
architecture supports all existing Linux Bluetooth drivers with
one single AOSP Bluetooth HAL implementation, Bluedroid.
Change-Id: I7197016b556e5d985843dd4f626db5d0f596f996
Arman Uguray [Fri, 17 Jul 2015 01:12:13 +0000 (18:12 -0700)]
service: Introduce a global Settings object
Introduced a global Settings object that will store all runtime properties that
would be associated with a config file, Android system properties, etc. Added a
mechanism to parse command-line options which can be used to pass paths to
configuration files, file path for UNIX domain socket based IPC mechanism, and
any other property that is dynamic in nature. This will help us remove hardcoded
paths, strings, and other such values in the future.
Bug:
22532366
Change-Id: I8e790363ed31d44369f7991a8ea7132d1cace70b
Arman Uguray [Wed, 8 Jul 2015 22:47:39 +0000 (15:47 -0700)]
gn-build: Add bluetooth-service target
This patch makes the Bluetooth system service (service/) buildable using GN:
1. Added new BUILD.gn file for service/
2. Added conditional compilation for global config paths, with TODOs for
generalizing them later.
3. Added a shim for loading the Bluetooth library that calls hw_get_module on
Android and explicitly calls dlopen on OS_GENERIC.
4. Fixed compile warnings and errors.
5. Did some minor clean up in gatt_server.cpp for better readability.
Bug:
22124644
Change-Id: I3226537a3a5211a6762651a35707638df29956b0
Ian Coolidge [Tue, 14 Jul 2015 01:22:46 +0000 (18:22 -0700)]
service: Some fixes from end-to-end/user testing.
* Send responses to ExecWrite requests.
* Provide valid data on write responses.
* Properly destruct Gatt::Server objects.
* Synchronize CoreStack 'enable' calls properly.
Change-Id: I4e9eed1979b10abccc7ae487e2c7d90d491e38d9
Arman Uguray [Wed, 8 Jul 2015 22:33:05 +0000 (15:33 -0700)]
service: Remove local copies of base and modp_b64
Since libbase is now available on AOSP (under libchrome) Bluetooth code can
depend on it rather than maintain its own copy a subset of base sources (and
modp_b64 dependencies).
Dependent CL: http://r.android.com/158335
Bug:
22175181
Change-Id: I3a301e49353598633ad857ac4345d0361c273beb
Arman Uguray [Wed, 8 Jul 2015 00:00:09 +0000 (17:00 -0700)]
gn-build: Add BUILD files for libchrome
This CL adds GN build files for libchrome, which is the ChromeOS/Brillo library
for many C++ tools, include libbase. I added a new GN build target for "base"
under secondary sources with a GN build file for libchrome which currently lives
in platform/external/libchrome in AOSP.
To build, clone libchrome into third_party/libchrome and remove
third_party/libchrome/base/BUILD.gn. Also clone external/modp_b64 into
third_party/modp_b64. Eventually I will have scripts set up to do
this automatically.
This means that we can start developing against libbase while running GN builds
on Goobuntu but this would break the tree until libchrome is buildable within
the Android build system (http://r.android.com/158392). So Brillo/Android builds
will depend on libchrome using the conventional Android.mk means.
Bug:
22175181
Change-Id: I9a737aa785488e5bc0ca1adc087d1d5dfcdf3bea
Marie Janssen [Tue, 7 Jul 2015 23:47:20 +0000 (16:47 -0700)]
build: Fix LOG_TAG define breakage, macro usage
Fixes build breakages related to r.android.com/156982
Change-Id: Ib1143c41fe05a17c296226998afdb41a8cb6294a
Marie Janssen [Fri, 26 Jun 2015 21:53:46 +0000 (14:53 -0700)]
build: Update osi log functions, use consistently
Update the LOG_* functions to take a tag argument which makes them more
consistent with the Android Log.*(TAG, s) common syntax and removes
some #define-dependency with osi/include/log.h.
Also update to never use Android log functions directly.
Also contains minor cleanup of some header includes.
Bug:
21569831
Change-Id: If07385cafbea062232ecdbc7c673f908d5ef8921
Evgenii Stepanov [Mon, 29 Jun 2015 20:59:44 +0000 (13:59 -0700)]
Add missing library dependency.
Fixes the following link error in SANITIZE_TARGET=address build for
hammerhead:
system/bt/audio_a2dp_hw/audio_a2dp_hw.c:208: error: undefined reference
to 'osi_socket_local_client_connect'
Bug:
21785137
Change-Id: Ie29a2772e7f1a4f697d895eb29b01d39d6f9c651
Miao Chou [Wed, 10 Jun 2015 00:39:46 +0000 (17:39 -0700)]
build: Eliminate cutils/sockets dependencies from system/bt
Eliminate cutils/sockets dependencies by pulling sources files from
core/libcutils into osi/.
- Pulled source files from cutils/ into osi/ and modified GN files and
Android.mk
- Updated includes to use the headers in osi/ and removed unused/duplicated
headers.
- Renamed the functions of osi/sockets and updated wherever they are called
to avoid usign symbols from cutils/sockets, since other cutils
dependencies have not been eliminated yet.
Bug:
21667795
Change-Id: I3dd4371d585f120d97ac0433ab1f35edb820dbb9
Sharvil Nanavati [Sat, 13 Jun 2015 09:12:08 +0000 (02:12 -0700)]
Reduce CPU utilization from ~60% to ~10% on busy HCI reads.
This patch improves RFCOMM throughput and reduces CPU utilization.
Instead of using a counting semaphore to measure bytes and reading
one at a time from the eager reader's buffer, read in bulk based
on the incoming read request size.
Change-Id: I17046bfbc3ca49576a9c82b38911aeb84234881a
Sharvil Nanavati [Sun, 14 Jun 2015 23:02:08 +0000 (23:02 +0000)]
Merge "Rename alarm->creation to alarm->creation_time for readability."
Arman Uguray [Sat, 13 Jun 2015 00:33:34 +0000 (17:33 -0700)]
service: Fix clang warnings in uuid_test.cpp
This CL fixes some clang compile warnings and errors and style issues in
service/uuid_test.cpp
Bug: none
Change-Id: I2d1ecf6e21fe4d6b1741f2a113ed5834518a29c6
Ian Coolidge [Fri, 12 Jun 2015 22:50:56 +0000 (22:50 +0000)]
Merge "Add bthost, a simple BLE GATT server."
Ian Coolidge [Thu, 4 Jun 2015 00:20:30 +0000 (17:20 -0700)]
Add bthost, a simple BLE GATT server.
This is accessible via Unix socket.
It only has a couple of interesting features:
* Built in support for large blob attributes (>512 octets)
* Attribute caching (avoid frame-level IO for IPC clients)
Some string utilies are taken from modp_b64 and Chromium base.
Bug:
21076037
Change-Id: I6a29959159de76f8dd68d6bbaabe2100daabb6fa
Arman Uguray [Wed, 3 Jun 2015 04:11:07 +0000 (21:11 -0700)]
build: Fix ptr <-> integer cast warnings
This CL removes the -Wno-pointer-to-integer-cast and
-Wno-integer-to-pointer-cast flags from GN build files. The resulting errors
were fixed using the following:
1. All ptr <-> integer casts are now done by using the new
PTR_TO_INT/INT_TO_PTR macros defined in osi.h
2. The TIMER_PARAM_TYPE macro, defined in gki/common/gki.h and
include/bt_target.h have been redefined as void* rather than UINT32. This
is better, since "void*" can act as a simple container without any
precision loss that would be caused by a type such as UINT32 on 64-bit
systems. void* inherently is a safer container for all pointer types but
UINT32 isn't.
BUG=
21570302
Change-Id: I4a82c4a40c91caa31e372382c40d424be220cbe3
Arman Uguray [Wed, 3 Jun 2015 02:48:51 +0000 (19:48 -0700)]
osi: Introduce ptr <-> integer conversion macros
This CL introduces macros for safe pointer to integer conversion (and vice
versa). Also fixed a small style issue in log.h
Bug:
21570302
Change-Id: If76bf5e35970f9b33f9bef53fbd03a7effae08dc
Arman Uguray [Tue, 2 Jun 2015 21:56:45 +0000 (14:56 -0700)]
gn-build: Remove all -Wno-unused-* flags from build files
This CL removes the -Wno-unused-variable, -Wno-unused-value, and
-Wno-unused-function flags from all GN build and Android.mk files
(except in test/ & tools/, which are not built using GN yet). Compile
warnings, caused by the newly enabled flags, have been fixed throughout
the code base.
Bug:
21570302
Change-Id: I1c128b62256faa17668124798341005bcd0f7315
Evgenii Stepanov [Thu, 11 Jun 2015 22:34:12 +0000 (15:34 -0700)]
Revert previous commit and disable net_test_hci under sanitizers.
Change-Id: Ifd544ef241f622c647ecea1026025049a470bd16
Evgenii Stepanov [Thu, 11 Jun 2015 21:30:41 +0000 (14:30 -0700)]
Fix ASan build.
Not sure why, but with ASan I get missing symbol GKI_freebuf.
Indeed, it is defined in a library that's not in the target's deps.
Bug:
21785137
Change-Id: I595f3e3df6ad5dde3f4f8570426479050b1552fa
Sharvil Nanavati [Thu, 11 Jun 2015 05:00:16 +0000 (22:00 -0700)]
Rename alarm->creation to alarm->creation_time for readability.
Change-Id: I007b2211d9b52422b4442765bb97c0ba90613c50
Arman Uguray [Wed, 10 Jun 2015 23:21:12 +0000 (16:21 -0700)]
gn-build: Fix GN build after the merges
This CL fixes the GN build after the recent merges to aosp/master.
Change-Id: I0c9d8178986165d5a4a67261532e8a08b6923d22
Andre Eisenbach [Wed, 10 Jun 2015 23:37:05 +0000 (16:37 -0700)]
Fix more BLE_INCLUDED == FALSE build breakage
Change-Id: I2da6dcdaced78d3a3bce6002fc3885c7480fba82
Dan Albert [Tue, 9 Jun 2015 23:53:45 +0000 (16:53 -0700)]
Add missing include.
osi_malloc was never included, so it was implicitly defined as
returning an integer (thank you, C). Clang caught the int to pointer
conversion error.
Change-Id: I0d8a3363d92cb72a22780d049a53e193d2e50ec5
Andre Eisenbach [Fri, 29 May 2015 21:05:30 +0000 (14:05 -0700)]
Check transport before subscribing for service changes
Don't subscribe to the service changed characteristic if SMP pairing
was a result of cross-key pairing.
Change-Id: Ieb4901e82060e2fa2d9d0e909e384de5f6890222
Author: Chaojing Sun <cjsun@broadcom.com>
Bug:
20894154
Hemant Gupta [Wed, 15 Oct 2014 14:29:23 +0000 (19:59 +0530)]
Add proper checks for PAN & BNEP in BD stack
This patch fixes issues for PAN & BNEP in BD stack identified
by static analysis tool.
Change-Id: I29417dae982abb5cef11379f8d03baad11ffde8b
Mallikarjuna GB [Fri, 7 Nov 2014 11:22:25 +0000 (16:52 +0530)]
Fix issues in A2dp, Avrcp, HF and AG reported by static analysis tool
- Fixes to validate Array Index Value and Null Pointer
Dereference reported by static analysis tool.
Change-Id: Id1492315f68378fdcfa517bd0a5cacefc8ebfddb
Anubhav Gupta [Mon, 17 Nov 2014 01:02:45 +0000 (17:02 -0800)]
Ignore STOP command if A2DP stream is suspended
Ignore STOP command if A2DP stream is already suspended.
Some carkits send STOP command before VOIP call initiation
but don't send PLAY when call ends which hinders DUT to resume
audio playback after call termination.
Change-Id: I41cc1fc6f4b6cfaa1560d729baa0ca27f6dfe8c8
Anubhav Gupta [Tue, 7 Oct 2014 12:58:19 +0000 (18:28 +0530)]
Remove check for stream type in a2dp hal_callbacks.
Stream type is invalid till signalling channel
connection establishment is completed. Do not
check stream type while calling HAL callback.
Change-Id: I69fb19636f3e9bb72202c450dcef9e7bc2e53731
Mallikarjuna GB [Mon, 22 Sep 2014 04:30:36 +0000 (10:00 +0530)]
Clear remote BD address information.
This change makes sure that when RFCOMM
connection fails for HFP, AG control block
clears the remote bd address. This will prevent
the misuse of remote bd address.
Change-Id: I9b14cfe7ae18e72f0972704ac3aa5e915f70ddb3
Mallikarjuna GB [Fri, 22 May 2015 09:44:25 +0000 (15:14 +0530)]
Don't stop sniff timer before checking for service ID entry
- Avoid stopping sniff timer before checking for service
ID entry for which bta_sys_conn_close is called since if
entry is not present we return without re-starting timer
and ACL doesn't go into sniff.
Change-Id: I063da8e58e067ade5d646debf086bb443066106c
Mallikarjuna GB [Thu, 21 May 2015 13:37:30 +0000 (19:07 +0530)]
Don't initiate sniff in sniff mode
This change makes sure that AG does not retry
to intiate sniff if device is already in remote
initiated sniff mode.
Change-Id: I77a0c4c0aaf2e93e3168f49998fe22a971d46212
Mallikarjuna GB [Thu, 21 May 2015 13:47:06 +0000 (19:17 +0530)]
Updated ATD string parsing
This change makes sure that the Dial string
parsing accepts 'pause' and 'wait' characters
too.
Change-Id: Ie56b355199a3d4292d0ee9913852292147ccf55f
Mallikarjuna GB [Wed, 22 Oct 2014 13:56:41 +0000 (19:26 +0530)]
Stop AG collision timer.
This change makes sure to stop collision
timer of AG when cleanup is happening
while BT turn off.
Change-Id: Ia877f98ba3136ec3278cbec5ab0d7ef2abfc6ed5
Mallikarjuna GB [Thu, 21 May 2015 13:32:39 +0000 (19:02 +0530)]
Return ERROR for invalid CHLD command arguments
Return ERROR for invalid chld commands like "AT+CHLD=!"
or "AT+CHLD=0a" etc. In such cases, held call was getting
terminated.
Change-Id: I93d159b20da7086fac3374ce2e163d1309680045
Anubhav Gupta [Thu, 13 Mar 2014 13:46:29 +0000 (19:16 +0530)]
Reject second AVRCP connection.
This change rejects the RC connection from
second device if the DUT is already connected
to RC of first device.
This addresses the problem of improper closure
of Uinput device on disconnection of Avrcp
to make sure Avrcp passthrough commands work
as desired.
Change-Id: If2e39cd90575baffd0e4442b8e7cd2a91eebdf56
Anubhav Gupta [Thu, 19 Jun 2014 11:20:11 +0000 (16:50 +0530)]
Disable SCMST feature for A2DP Sink
Do not send SCMST enabled in GetCapabilities
for A2dp sink role.
Change-Id: I2bff7e04d852c6d3c8c1b7e1c41ae50ef3ff0543
Mallikarjuna GB [Fri, 22 May 2015 08:31:19 +0000 (14:01 +0530)]
Restarting PM timer for AG while reading OR writing
- Once AG receives any data(eg. AT commands) from
remote device(HF) and sending the response to remote
device, PM(Bluedroid power Manager) timer should be restarted
(stop & start) for AG.
- Increased the sniff timer value to 7 seconds for AV & AG
profiles to avoid sniff related IOT issues.
Change-Id: I8c1b79d272391b3fa34b193477a34d561f4c508d
Mallikarjuna GB [Thu, 21 May 2015 08:54:05 +0000 (14:24 +0530)]
Initialize btif_max_hf_clients with proper value
btif_max_hf_clients which is an unsigned 16bit integer is
initialized with -1(0xFFFF) in btif_hf.c. Later on, when
application calls init with max_hf_clients as 1, btif_max_hf_clients
will be set to 1. But, before this happens, context switch happened
from application context to btif context with btif_max_hf_clients as -1.
In the btif context, BTA_AgRegister gets called in for loop for 0xFFFF
times. We are running out of scbs due to this.
Initialize btif_max_hf_clients with 1. Assign it to max_hf_clients
before context switch happens.
Change-Id: Ibde1bebbab2eb64442027164236f1d82e4269d23
Anubhav Gupta [Mon, 14 Jul 2014 13:23:37 +0000 (18:53 +0530)]
Set the proper authentication level for AvOpen
During Avopen security was made none hence A2DP
connection was happening without bonding when
DUT is paired with DUT and then pairing entry
is deleted from remote and then only A2dp is
tried to be reconnected from DUT. A2dp appears
to be connected in this usecase but the device
entry is shown in available devices list instead
of paired one.
Changes made from No security to SEC Authenticate
Change-Id: I7fc39fe8acef874f0031c9b78d4269a62b94e4b0
Mallikarjuna GB [Fri, 19 Sep 2014 14:57:17 +0000 (20:27 +0530)]
Don't open SCO for 2nd MO call if a call is active
When user dials a 2nd call, do not open SCO if 1st call was
active on DUT earpiece or speaker.
Change-Id: I974f5bcf917e6972705e60cf1da195eae23f885a
Mallikarjuna GB [Tue, 28 Oct 2014 17:43:51 +0000 (23:13 +0530)]
Don't close SCO for MO calls
This change removes condition to disconnect SCO
when MO call process is started.
Change-Id: I2af4ab82c097c7d9ce1bc892bdf40cc09ff6d97e
Mallikarjuna GB [Wed, 8 Oct 2014 08:31:16 +0000 (14:01 +0530)]
SCO connection should happen after SLC.
This change makes sure that SCO audio
connection request is not processed until
HFP SLC connection is done.
Change-Id: Ia2fcad49882deaaf049ae190d90442e5ca7ad71b
Andre Eisenbach [Thu, 4 Jun 2015 18:43:57 +0000 (11:43 -0700)]
Fix compile error in bta_ag_sco.c
Change-Id: I8839ba732560a31a5e8a2351ea4bfb16999cf5ea
Mallikarjuna GB [Thu, 21 May 2015 14:34:46 +0000 (20:04 +0530)]
Create listen SCO for HS1 if HS2 disconnects during SCO xfer
During SCO transfer process from HS1 to HS2, firstly active SCO for
HS1 is disconnected. However, if suddenly HS2 disconnects even
before SCO transfer is complete, listen SCO for HS1 is not created.
This causes further incoming SCO connections from HS1 to be rejected.
The change creates listen SCO for HS1 and moves SCO state properly
to LISTEN.
Change-Id: I0993c1ba1c24b3b7e9c243d179a913d7a0c40446
Mallikarjuna GB [Thu, 21 May 2015 14:20:27 +0000 (19:50 +0530)]
Don't open SCO on state change for multi party call on DUT.
When multi party calls(1 active, 1 held) are ongoing on phone
speaker and any of these call drops, do not open SCO for
other call since user expects call to still remain on phone
speaker.
Change-Id: I9079c809ac665fc1c6e890302e37d23a12f8d4f4
Mallikarjuna GB [Thu, 21 May 2015 13:11:03 +0000 (18:41 +0530)]
Reset sniff subrating while in SCO
Sniff subrating should not be used when link is
in SCO connection. Since the subrating value is
higher, the link would take more time to process
ACL data while in SCO connection causing unwanted
results like delay in SCO disconnects.
Change-Id: I7b964faa397624b65e0158209b8743efe13a6075
Mallikarjuna GB [Sat, 30 May 2015 17:25:18 +0000 (22:55 +0530)]
Open SCO for held call.
Use case:
1. Connect to headset/carkit
2. Make an outgoing call from AG
3. Turn off BT on AG
4. Hold the call from AG
5. Turn on BT on AG (No SCO link is established here)
6. Unhold call from AG (still no SCO link is established)
Failure:
No SCO connection established when held call is there
during headset connection.
Root cause:
SCO is not initiated when SLC is done during held call.
Fix:
AG opens SCO connection when HF connected while in call and
the call was in held state.
Change-Id: I63d7655d26ddbf68cbf94c745df745cffa917b5e
Mallikarjuna GB [Fri, 28 Nov 2014 04:51:15 +0000 (10:21 +0530)]
Update call state before opening SCO.
This change makes sure to update the current
call state before opening SCO connection when
incoming call is answered. Some car kits are
strict in checking this sequence and go in
bad state if not done this way.
Change-Id: Ie744dc26c02d897eaf016ee73022bfc2a0db067e
Mallikarjuna GB [Fri, 22 May 2015 06:26:48 +0000 (11:56 +0530)]
Handle multi party call states
UseCase:
1. Set up Bluetooth connection between phone and remote device.
2. Disconnect BT link by turning off remote device.
3. Start Mo call from phone.
4. Receive MT call from far end.
5. Turn on remote device.
6. BT connection gets established successfully, but audio
doesn't get transferred to headset.
Failure:
Call audio not routed to BT HS. SCO not established.
Root cause:
When a HS connects while in an active call and 2nd call
(incoming/outgoing/alerting) setup ongoing, incorrect post SLC
call setup updates might cause HS to get confused as phone had
already updated correct call states in CIND response during SLC.
This may cause HS to behave abnormally like delayed response to
BCS as seen with jabra wave +.
Fix:
Avoid sending incorrect call updates post SLC since we already
have sent correct updates during SLC as reponse to CIND.
Change-Id: I53e57baf7cca782af6f374a043667971c66a956d
Mallikarjuna GB [Thu, 21 May 2015 12:28:12 +0000 (17:58 +0530)]
Update held call state to connected headset
In a three way call scenario, when an active
call is dropped by remote, the single held call
state is not updated to the connected headset.
This change will make sure that it is updated
properly.
Change-Id: I558602e791279d510edb23989b125cd8f7a7ebde
Pavlin Radoslavov [Tue, 2 Jun 2015 20:54:58 +0000 (13:54 -0700)]
Replace malloc/calloc/free with osi_malloc/osi_calloc/osi_free
There were several leftover places that were still using
malloc/calloc/free .
Those are replaced to use osi_malloc/osi_calloc/osi_free like
majority of the rest of the code.
Note: There are few remaining places that are still using
malloc/calloc/free:
* Some of the unit tests
* audio_a2dp_hw/audio_a2dp_hw.c
It is used as part of the audio.a2dp.default.so library,
and the bluetooth.default.so library
Its usage of malloc/calloc/free should be refactored
independently.
Change-Id: Iafbed996e5f1ae8eb1343fb2acfadf32e515e419
Sunny Kapdi [Tue, 2 Jun 2015 05:21:28 +0000 (22:21 -0700)]
Fix memory corruption due to BLE multi-adv macro
INST_ID_IDX_MAX macro was not protected with parenthesis, resulting
in incorrect calculation of the size needed to allocate memory for
the client_if map.
Change-Id: Ib3591f4f9ac7288f2191e9078a71aab431ca7130
Hemant Gupta [Wed, 19 Nov 2014 13:39:54 +0000 (19:09 +0530)]
HID: Handle closing of uhid driver in case failure
This patch handles closure of the uhid driver in case of following:
- Due to concurrency of disconnection from a conencted device
and an incoming connection request from another device, the error
code for the ACL disconnection becomes HCI_ERR_HOST_REJECT_SECURITY
in the stack.
- On reception of disconnection with that error codes, the uhid driver
was not closed from the btif layer leading to issues in reconnection
with same device that got disconnected.
Change-Id: I13c83757051850cc631aa1c24a036a2e1a4d0087
Srinu Jella [Thu, 13 Nov 2014 11:52:28 +0000 (17:22 +0530)]
Reset pairing state to idle only for the current device
Reset the pair state during auth complete for the BD_ADDR of the pairing
device only. The authentication complete event may come for profile level
authetication also. In such cases, if device already in paired state,
there is no need to reset the pairing state.
Change-Id: Id0ef9127895177527a6d4559ad873aa1c62a56bb
Pavlin Radoslavov [Mon, 1 Jun 2015 23:08:18 +0000 (16:08 -0700)]
Moved the OSI alarm_shutdown() operations to alarm_cleanup()
Also, removed the OSI module's start_up and shut_down steps,
because now they are no-op.
Bug:
21558791
Change-Id: I24259b327f399af57c37937111158baa9704f644
Pavlin Radoslavov [Mon, 1 Jun 2015 18:42:39 +0000 (11:42 -0700)]
Disable the OSI allocation tracker.
Temporary disable the allocation tracker initialization
(even for BLUEDROID_DEBUG) when initializing Bluetooth.
This is a short-term workaround solution for several issues related to
the usage of the allocation tracker.
* Inconsistent usage of osi_malloc()/osi_calloc() and osi_free()
- Within some of the Bluetooth-related unit tests we have two copies
of the same libosi library: one copy statically linked against the
unit test, and another dlopen() at runtime as part of bluetooth.default.so
Each of those copy has its own static variables.
- For the dlopen() copy we do call allocation_tracker_init(), while for the
static copy within the unit test we don't call allocation_tracker_init()
- Occasionally, there is a memory allocation via osi_calloc()
within the dlopen()-ed library, and then it is osi_free()-ed
within the statically linked library.
Such (mis)usage creates issues in two ways: (1) free()-ing incorrect
pointer, and (2) the osi hash_map() in the dlopen()-ed library still considers
the osi-tracked memory as allocated.
NOTE: (1) could trigger random crashes, while (2) is the reason the unit
test triggers an assert
* Avoid potential issues that could result from the fact that calling
allocation_tracker_init() is not mandatory; i.e., the same
issue described above could be triggered if osi_malloc()/osi_callod()
was called before the call to allocation_tracker_init()
* There is still code that uses malloc(3)/calloc(3) and free(3) instead
of osi_malloc()/osi_calloc() and osi_free()
Also, add missing pthread_mutex_lock()/pthread_mutex_unlock() guards,
and fix the allocation_tracker_uninit() implementation so it works
properly even if void allocation_tracker_init() wasn't called.
Bug:
21561735
Change-Id: Ic83d6cd40af1189c4ee9c1dbfd0ad8e4666e1502
Srinu Jella [Wed, 8 Oct 2014 11:06:43 +0000 (16:36 +0530)]
Handle pairing timeout during remote name request
If a remote name request is in progress and a pairing timeout is
triggered, the host needs to post the bond failure to the UI and
needs to reset the pairing cb state, otherwise the UI will be stuck
in pairing mode and scanning won't work until Bluetooth is cycled
OFF->ON.
Change-Id: I76d9a83b1db7236db51617da998b5857b0de39f0
Andre Eisenbach [Thu, 28 May 2015 18:16:52 +0000 (11:16 -0700)]
Reduce GATT log verbosity
Change-Id: I55e6ec1afdd8a13f4401809ef89ef2d80efb7f66
Srinu Jella [Fri, 30 May 2014 15:45:01 +0000 (21:15 +0530)]
Avoid null pointer exception for invalid L2CAP channels
Change-Id: I8ac40e9cfe6dd015f40c6f493727e123a0d247e6
Pavlin Radoslavov [Sat, 23 May 2015 02:47:49 +0000 (19:47 -0700)]
Add missing clean_up step for the OSI module.
Now the OSI module's shut_down processing is split into "shut_down"
and "clean_up".
Previously, there was an ordering issue manipulating some of the
internal state during graceful shutdown/cleanup. Some of the modules
had two steps: shut_down, followed by clean_up, while other had only
shut_down step. This triggered the following assert in file alarm.c
alarm_cancel: assertion "alarms != NULL" failed
Bug:
21406940
Change-Id: Iab1f033a69cbff646a6b0f346760ae82f8b00b8f
Hemant Gupta [Thu, 15 Jan 2015 14:45:07 +0000 (20:15 +0530)]
Sniff: Use correct sniff configuration for PAN & HS
Change-Id: I95c302dd46cdcc63058c9cb3de17fdfd6ffe8d2e
Andre Eisenbach [Wed, 27 May 2015 00:40:12 +0000 (17:40 -0700)]
Make secure connections mode configurable
Change-Id: Id6101abc1fc339147c8b55023c7426ec1c807ee6
Prerepa Viswanadham [Wed, 27 May 2015 00:25:38 +0000 (17:25 -0700)]
Increase the min LE connection interval to 11.25ms
To reduce audio choppiness, increase the min LE connection interval
to 11.25ms from 7.5ms
Bug:
18776956
Change-Id: I8404ebe2f9562d555a2131ae30dd63b74bb362a4
Satya Calloji [Thu, 21 May 2015 23:44:06 +0000 (16:44 -0700)]
Pairing is prompted with a wrong bd-address
Slave initiated encryption was not being notified on the correct
address and causes the key to be lost on slave device triggering
new pairing once in a while.
Change-Id: I5441a9e0bcf8ba45199483ccd02f207892ec296e
Andre Eisenbach [Fri, 22 May 2015 23:38:54 +0000 (16:38 -0700)]
Fix problem where multi-adv instances cannot be re-used
After using all multi-adv instances and stopping them, the instance ID
for each instance is incorrectly reset, causing the instance to be not
usable anymore.
Bug:
21404808
Change-Id: Ie3a3f07bc2204c7268567cb56248cd3eb7751742
Nitin Arora [Fri, 22 May 2015 00:58:36 +0000 (17:58 -0700)]
Recitfy condition when removing device from IRK resolving list
This patch corrects the conditional logic before sending HCI
command to remove the IRK list entry from the IRK resolving
list based on the max size of resolving list
Change-Id: I9adc933f0988ae907b3e218ba63814d106784787
Andre Eisenbach [Thu, 21 May 2015 06:55:13 +0000 (23:55 -0700)]
Fix build after cross-key issues broke non privacy enabled builds
Change-Id: Idef7239b07115be9290d7cca6610c603ffb3afa5
Satya Calloji [Tue, 19 May 2015 23:08:40 +0000 (16:08 -0700)]
Fix device/address types and IRK value handling
Handles the device and address types based on BD address
and provides the IRK values as available.
Change-Id: I351e0aea7f5e55caefa405b34261c75e78306552
Satya Calloji [Thu, 30 Apr 2015 20:58:59 +0000 (13:58 -0700)]
Fixed cross key for LE when paired over BR-EDR
SMP state machine was resending security request and waiting for a response
when paired over BR-EDR. The state machine state timed out due to this and
SMP failed while doing cross key pairing. Thus, user was asked for pairing
again.
Original author: Priti Aghera <paghera@broadcom.com>
Change-Id: I568f936bb7bee21fb78e8454469ecad3445f026f
Satya Calloji [Wed, 6 May 2015 16:24:06 +0000 (09:24 -0700)]
Fix SMP pairing request issue on LE
The cause of the failure:
- the master device sent the three keys to slave, but slave only receive
two and got the link drop before the third key is received.
- the slave device treats it as pairing failure due to the key missing.
SMP should wait for all keys been sent to controller before dropping the link.
Implement L2CAP fix channel tx_complete callback for this reason,
and it has been applied on the channel 6 (SMP).
Channel 7 (BR_SMP channel) was not keeping track of total_tx_unacked
number and closed the link too early. Added check in the
smp_br_key_distribution() and the ACL data tracking there before
posting SMP_BR_AUTH_CMPL_EVT.
Original author: Chaojing Sun <cjsun@broadcom.com>
Change-Id: If48a4c5e28b1d177f14ff089e8dfa3ace41eba83
Satya Calloji [Tue, 21 Apr 2015 23:34:54 +0000 (16:34 -0700)]
Unpair the other transport on a device paired
When unpair is initiated for LE or BR-EDR transport for a device,
close the link for other transport and unpair the device on
both transports, since both transports on a device are paired
due to cross key.
Original author: Priti Aghera <paghera@broadcom.com>
Change-Id: I13d4757eb056c4bd4c7cc0699ec61a28852702c5
Satya Calloji [Fri, 24 Apr 2015 06:39:49 +0000 (23:39 -0700)]
Static address is seen on scanner after unpairing
Fix for bonded devices that cannot be removed from resolving list when
scanning, advertising or when a connection is being initiated.
Suspend all active adv, scanning or connection initiation upon
completion of any resolving list operation.
Original author: Chaojing Sun <cjsun@broadcom.com>
Change-Id: Id104dace2944b1878eaf65b93aba3d01e477191d
Satya Calloji [Thu, 7 May 2015 21:06:37 +0000 (14:06 -0700)]
Fix for chip capability version check
Fixes the issue of extended scan command being sent out
for non-capable chipsets
Bug:
20916419
Change-Id: Ib5d848f49c34a3fc9c053a7488e12fb0c252587c
Satya Calloji [Tue, 31 Mar 2015 20:24:32 +0000 (13:24 -0700)]
LE low power scan feature
LE low power extended scan feature stack changes
based on Google BLE spec v0.95
Bug:
20029342
Change-Id: I1db2d9bb648295340d0e93ca89d27e1b938d33d3
Nitin Arora [Fri, 12 Sep 2014 01:35:55 +0000 (18:35 -0700)]
Fix allocation for LE scan filter parameters
This change allocates memory for LE scan filter parameters
to copy filter params set by btif inquiry process initiated
using Settings UI
Change-Id: I56ed33b80af3f26ddc8a83edb807f88048503fa7
Nitin Arora [Wed, 11 Mar 2015 17:40:59 +0000 (10:40 -0700)]
Fix for premature BLE RPA timeout
RPA timeout expires prematurely when multiple FindMe server
instances start and stop advertisiment continuously. During start
adv TIMER3 is started using oneshot timer and during stop adv
same TIMER0 is stopped, so the TIMER3 is still running and expires
prematurely. This fix stops TIMER3 during disable adv and when RPA
is sent to controller.
Change-Id: I336f84043e5e0e8a833cc6080f8bcc0c1665893e
Satya Calloji [Thu, 7 May 2015 16:45:00 +0000 (09:45 -0700)]
Fix GATT connection failure after BT reset
Handles the address type incorrect value storage issue
and removes usage of DMT supported flag which was based
on legacy code
Bug:
20912064
Change-Id: I5bd20dc9cd0997ac3dbd4b346cc0513f1809f241
Nitin Arora [Thu, 31 Jul 2014 20:00:21 +0000 (13:00 -0700)]
Use correct structure to read LE connection handle
This patch corrects the retrieval of the connection handle
after the gatt write operation has succeeded successfully.
Change-Id: Iac79a64d6c626c2349b6f1a3744ea49a521a45f4
Zach Johnson [Tue, 19 May 2015 21:49:37 +0000 (14:49 -0700)]
Build the shared library with --whole-archive
For stack static libraries, use LOCAL_WHOLE_STATIC_LIBRARIES
to ensure they get --whole-archive applied to them.
This means module symbols in static libraries won't be
removed by the linker and dlsym will find them.
This patch also removes the code hacks we needed to
trick the linker into including the module symbols in
the final shared library.
Change-Id: I2463d0e6fb38f1e75c8293179cf9d4ca33eda84e
Satya Calloji [Tue, 19 May 2015 21:42:32 +0000 (14:42 -0700)]
Fix for IRK and IR key write issue
Fixes the incorrect flipping of values
for IRK and IR keys in bt_config.conf file
Change-Id: Ia4f9c274b6a3f7594ec31d8bd89b27d1ae54ac78