OSDN Git Service
Arman Uguray [Thu, 20 Aug 2015 19:36:20 +0000 (12:36 -0700)]
service: Introduce IBluetoothCallback.h
This CL introduces the native bindings for the IBluetoothCallback
Binder interface and implements the IBluetooth registerCallback and
unregisterCallback methods.
Bug:
23328384
Change-Id: I6fbf72cff7e3f037a412be8678ea97f3a7ada0c8
Arman Uguray [Thu, 20 Aug 2015 19:31:50 +0000 (12:31 -0700)]
service: Add native RemoteCallbackList
This CL introduces a native port of the android.os.RemoteCallbackList
Java class. This is in preparation of the upcoming IBluetoothCallback
implementation.
Bug:
23328384
Change-Id: Icebf5c286ced820fa631da35f50cdf5d244fdded
Arman Uguray [Thu, 20 Aug 2015 19:12:56 +0000 (12:12 -0700)]
service: Add complete IBluetooth transaction enums
This CL completes the IBluetooth transaction codes based on the
latest IBluetooth.aidl file from goog/mnc-dev.
Bug:
23227962
Change-Id: I76d58647a0467cd0eb18f9bd0d3eceb36ce2abcf
Arman Uguray [Thu, 20 Aug 2015 21:06:57 +0000 (21:06 +0000)]
Revert "service: Move UNIX IPC code into ipc/unix/"
It turns out "unix" is defined to be 1 somewhere, which breaks compilation of this CL (since I added "namespace unix").
This reverts commit
93e66a66464aa30ca7184e4a7378c8e8d752cbe1.
Change-Id: I00b0a59a35024ccf78297117916d12031a6346a5
Arman Uguray [Thu, 20 Aug 2015 18:38:49 +0000 (11:38 -0700)]
service: Introduce bluetooth::Adapter::Observer
This CL introduces a new Observer interface for the Adapter class.
This meant to serve as the top-level API for receiving Adapter state
notifications, property updates, etc, in a format that doesn't use
the native HAL types.
Bug:
23328384
Change-Id: Ibf29063a169ad5e986d433d0901b3b973af0aa56
Arman Uguray [Thu, 20 Aug 2015 18:49:00 +0000 (11:49 -0700)]
service: Support base switches::kV
This is a libbase built-in command-line flag to set log verbosity,
so that the VLOG macro does the right thing. This CL enables that for
the daemon. To enable VLOGs with a given verbosity level and below, do
bluetoothtbd --v=<level>
Change-Id: I128a42c52425c37640c016c3c6158419cc1c0f66
Arman Uguray [Thu, 20 Aug 2015 20:07:18 +0000 (13:07 -0700)]
service: Move UNIX IPC code into ipc/unix/
Moved the UNIX IPC related code into a new ipc/unix subdirectory.
Added new namespace levels for unix and binder that mimic the
directory structure.
Change-Id: I58954d0c3dd1a6fe9c141c3122d42530385265f6
Dennis Cheng [Mon, 10 Aug 2015 16:29:41 +0000 (09:29 -0700)]
test_vendor_lib: Read controller properties from file.
This upload lets the controller be configured via a JSON file that
specifies the controller attributes. A default configuration is not
currently provided but will be included in a future upload. Also fixes
a few mistakes in test_channel.py.
Bug:
21586676
Change-Id: I9d0e65a9664e179ddb97664a748c766f4f8a554e
Arman Uguray [Tue, 18 Aug 2015 00:25:04 +0000 (17:25 -0700)]
service/client: Add support for the latest methods
Added support for calling the IBluetooth getAddress, setName,
and getName methods.
Bug:
23227962
Change-Id: Ib8c3f609b02e953a2989c18d614b5f52a56421c2
Arman Uguray [Tue, 18 Aug 2015 00:23:42 +0000 (17:23 -0700)]
service: Implement IBluetooth getAddress, getName, and setName
This CL implements the IBluetooth getAddress, getName, and setName
API methods.
Bug:
23227962
Change-Id: I5ba8395a08bdbcf6a882ea8f413448cf0a1f331a
Miao Chou [Tue, 11 Aug 2015 18:41:58 +0000 (11:41 -0700)]
Fix typo in main/bte_main.c.
Change-Id: If16dd316545b485f3a92c9700f9af35bf97fdd42
Arman Uguray [Sat, 15 Aug 2015 01:32:48 +0000 (18:32 -0700)]
service: Add four more IBluetooth API definitions
Added bindings for the following IBluetooth API methods:
String getAddress();
ParcelUuid[] getUuids();
boolean setName(in String name);
String getName();
Bug:
23227962
Change-Id: Ia5f57056486bb832b2c9e7fc82837626716992ed
Arman Uguray [Sat, 15 Aug 2015 01:28:42 +0000 (18:28 -0700)]
service: Rename Uuid to UUID
This is more consistent with the ancronym naming convention in the
framework code (e.g. java.util.UUID) and elsewhere in the Bluetooth
daemon.
Change-Id: I3461cf12d563e00ba5e0b0b390bd9ef94e6d7418
Arman Uguray [Sat, 15 Aug 2015 00:23:47 +0000 (17:23 -0700)]
service: Implement IBluetooth::GetState
This CL implements the GetState method of the IBluetooth interface:
1. A new file, adapter_state.h has been added, which defines the
STATE_* values from BluetoothAdapter.java in the framework layer.
This is done this way so that a client library can be built with
minimal dependency on core service code (e.g. Adapter).
2. Implemented the GetState method.
3. Refactored the fake BluetoothInterface such that multiple unit
test modules can make use of it by centralizing fake behavior
to hal/.
4. Added new commands to client/.
Bug:
23227962
Change-Id: Id403094f6fe34cd5cef0577f319309169f74ddf3
Arman Uguray [Fri, 14 Aug 2015 00:05:03 +0000 (17:05 -0700)]
service: Implement IBluetooth IsEnabled, Enable, and Disable
Implemented the IsEnabled, Enable, and Disable methods of the IBluetooth
interface. Added a simple REPL logic to client/main.cpp so that these commands
can be tested real-time via command-line.
Bug:
23169366
Change-Id: Id27a82e5cdadc5ea0b6f88d3ab3a6b7882f6212a
Arman Uguray [Fri, 14 Aug 2015 00:01:07 +0000 (17:01 -0700)]
service: Replace CoreStack with Adapter
This CL removes the CoreStack class. Code that depended on a CoreStack instance
now depend on Adapter and hal::BluetoothInterface instead.
Bug:
23169364
Change-Id: Ide008cc7d3f9e74656f6bfa4df2dfee511e55b90
Arman Uguray [Thu, 13 Aug 2015 23:09:35 +0000 (16:09 -0700)]
service: Introduce Adapter
This CL introduces the Adapter class, which is meant to replace the CoreStack
class. Adapter interfaces with hal::BluetoothInterface rather than calling into
libhardware directly.
Bug:
23169364
Change-Id: Id0a19277d55e83ec3bee3653d5d8795efbd5781b
Arman Uguray [Thu, 13 Aug 2015 22:49:47 +0000 (15:49 -0700)]
service: Introduce hal::BluetoothInterface
This CL introduces the bluetooth::hal::BluetoothInterface class. This is meant
to be an abstraction over the underlying bt_interface_t and bt_callbacks_t
interfaces from libhardware. BluetoothInterface is defined as an abstract
singleton that allows a fake/mock implementation to be injected for testing.
Bug:
23169364
Change-Id: Ia6f21f505dca08651b9a83e30287f638e8ec9a8e
Dennis Cheng [Sun, 9 Aug 2015 00:07:50 +0000 (17:07 -0700)]
test_vendor_lib: Remove handlers
This upload removes the HciHandler and TestChannelHandler classes.
Removing these classes simplifies logic and also allows the
controller to do preprocessing before executing commands.
Bug:
21586676
Change-Id: I3f2711349dd2c86794538edc632b4f5f49b5169b
Dennis Cheng [Fri, 7 Aug 2015 23:58:13 +0000 (16:58 -0700)]
test_vnd_lib: Discover devices
This upload allows the user to send fake inquiry responses to the
controller at run-time via the test channel.
Bug:
21586676
Change-Id: Ieae24d496115f19716fcaaffa627a9c22ffade21
Dennis Cheng [Tue, 4 Aug 2015 23:51:59 +0000 (16:51 -0700)]
test_vendor_lib: Add test channel command transport and handler
This upload adds the transport and handler functionality for the test
channel. Test channel commands will be sent by the test channel
program and processed by library objects in a manner analogous to how
packets are received and handled from the HCI. The actual
implementation for the 4 test channel commands included here will be
in the next upload.
Bug:
21586676
Change-Id: I9354baedcbd6e48b8920a3ebf1afa69eb89834d9
Dennis Cheng [Mon, 3 Aug 2015 01:25:17 +0000 (18:25 -0700)]
test_vendor_lib: Add test channel for run-time input
This change adds a test channel for receiving user-specified commands
and data at run-time. Specifically, the channel is intended to be used
for additional debugging capabilities and for fine-tuned control over
the test controller. Implementation-wise, the test channel is simply
another socket that the vendor manager watches on. The handling of test
channel input goes through the pipeline as normal HCI data after it is
received by the HciTransport.
A script for building and running the test vendor library and
(optionally) the test channel has been added in scripts/.
Bug:
21586676
Change-Id: I55bdeedbcd81effbe009aa62a19031637374a1e6
Ian Coolidge [Thu, 13 Aug 2015 19:50:05 +0000 (19:50 +0000)]
Merge "Restore LOG_NDEBUG condition on verbose logging."
Ian Coolidge [Thu, 13 Aug 2015 05:47:45 +0000 (22:47 -0700)]
Restore LOG_NDEBUG condition on verbose logging.
Change-Id: I86c5e03954c5f0a2dad88db5d6fbda3ec9e11e96
Ian Coolidge [Wed, 12 Aug 2015 21:53:15 +0000 (14:53 -0700)]
service: Allow manufacturer data to be set.
Plumbs IPC and stack code for manufacturer data
on advertisement or scan response.
Change-Id: I4b70506e35f51479bdf4073c31e4cb4f88fa2c98
Ian Coolidge [Wed, 12 Aug 2015 22:33:47 +0000 (22:33 +0000)]
Merge "service: Fix permissions/properties argument order."
Ian Coolidge [Wed, 12 Aug 2015 22:19:51 +0000 (15:19 -0700)]
service: Fix permissions/properties argument order.
These were swapped, resulting in a bad configuration
of the control attribute.
Change-Id: I93dd69da1ace70a249d3a8d1856b173a52462a6c
Arman Uguray [Thu, 6 Aug 2015 04:22:39 +0000 (21:22 -0700)]
service: Introduce a command-line client
This CL introduces a CLI for the Bluetooth daemon. The code currently
doesn't do much, other than demonstrate how a native Binder client code
can be placed to the Bluetooth daemon. This objective here is to
extend this with a REPL and send commands to the daemon based on user
input.
Bug:
22743129
Change-Id: I41015e4b639e7099dd9f7086dbe86b01f3a61786
Arman Uguray [Thu, 6 Aug 2015 04:19:02 +0000 (21:19 -0700)]
service: Add IPCHandlerBinder
This CL integrates Binder IPC into the daemon. This introduces
IPCHandlerBinder and BluetoothBinderServer which is the Binder server
proxy for IBluetooth. A new command-line switch is introduced to
optionally disable Binder on platforms that do not use it.
BluetoothBinderServer currently does not fully implement any of the IPC
calls and consists of stubs.
Bug:
22743677
Change-Id: I3e4ba7a3211898bab0c9c8061f4e4db3854711ed
Arman Uguray [Thu, 6 Aug 2015 04:06:17 +0000 (21:06 -0700)]
service: Add IBluetooth interface definition
This CL adds the initial IBluetooth interface definition. Client and server
proxy classes have been added, which would normally be autogenerated in Android
Framework Land. This currently only includes the first five methods from
IBluetooth.aidl but will be extended in the future.
Bug:
22743677
Change-Id: I32be9801e91877c2961e24232cdfaecd80ee2368
Marie Janssen [Fri, 7 Aug 2015 06:29:29 +0000 (23:29 -0700)]
build: fix missing include
fatfingered this needed include out of this file
Change-Id: Id4c8d3223b25d0747a2739891e43652c475d399c
Marie Janssen [Fri, 7 Aug 2015 01:30:45 +0000 (18:30 -0700)]
build: fixes for breakages on tilapia
Only include advertising when we can actually advertise on LE.
Change-Id: I380c67db4391650591b94611c4d522bf49fac750
Marie Janssen [Wed, 8 Jul 2015 18:48:57 +0000 (11:48 -0700)]
build: LOG_TAG consistency, include order, build fixes
Fix the order of includes across a bunch of files, and declare LOG_TAG
at the top of every file in which it is used.
Consistently use bt_ as a LOG_TAG prefix.
Fix issues with LOG macro usage.
Remove unused includes and double-includes (when in related .h)
Add includes as necessary to compile cleanly (problems surfaced by
reordering includes)
Change-Id: Ic55520c8302b06bbc1942c10c448b20844669da6
Dennis Cheng [Thu, 30 Jul 2015 17:06:40 +0000 (10:06 -0700)]
test_vendor_lib: Implement event loop with libbase
Adds event loop functionality by handling IO in the Watcher class,
HciTransport. Also fixes a bug where the vendor's file descriptor was
closed early and another where an object was mistakingly being passed
by value.
Bug:
21586676
Change-Id: I2ec30b68c0ede47bf1ad78ec13beee93d0f8ab9d
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