OSDN Git Service

android-x86/system-bt.git
8 years agoRewrite btif_get_gatt_db to new style
Jakub Pawlowski [Tue, 3 May 2016 15:55:11 +0000 (08:55 -0700)]
Rewrite btif_get_gatt_db to new style

Bug: 28485365
Change-Id: Iec63e595bfb82a4ac33564f3095cf0e7c4c37e39

8 years agoRewrite btif_gattc_set_scan_parameters to new style
Jakub Pawlowski [Tue, 3 May 2016 01:12:11 +0000 (18:12 -0700)]
Rewrite btif_gattc_set_scan_parameters to new style

Bug: 28485365
Change-Id: I29cb2e11b3e407676e312fe83248fc8b551e60ad

8 years agoRewrite GATT read operations to use new style
Jakub Pawlowski [Tue, 3 May 2016 00:50:25 +0000 (17:50 -0700)]
Rewrite GATT read operations to use new style

Bug: 28485365
Change-Id: I3c5918abdf79da7d6b566506ad53fa38656bcb65

8 years agoUse MessageLoop in bt_jni_workqueue thread
Jakub Pawlowski [Sat, 30 Apr 2016 21:37:40 +0000 (14:37 -0700)]
Use MessageLoop in bt_jni_workqueue thread

Up till now, to execute anyting on bt_jni_workqueue thread, we were
sending events to workqueue associated with this thread. Flow was:
btif_transfer_context -> btif_sendmsg -> thread_post.
Events were containing defined action, i.e. BTIF_GATTC_SCAN_START and
pointer to struct that contained all required data to execute it.
This was very cumbersome - figuring out what is executed when event is
send was hard. Also everything have to be packed into structure which
means that
we have to define lots of structures, or have one big super-structure
holding data for all events (like in btif_gatt_client.cc). Event sending
and receiving
logic is a huge percent of all code.

From now on, there will be a MessageLoop running inside bt_jni_workqueue
that will execute all tasks that will be posted with PostTask. The
benefit of having PostTask method, is that we can simply create Closure
that will be run in bt_jni_workqueue thread. It will take care of
transferring all associated values, and their cleanup. It will also do
compile-time check of all parameters. We no longer have to create
events, structs, and separate call logic from execution logic.

Bug: 28485365
Change-Id: I5014ef680757c0d3c6c69781aadc5139c8e1c3c4

8 years agoAdd additional VW car kits to absolute volume blacklist
Andre Eisenbach [Wed, 11 May 2016 19:20:23 +0000 (12:20 -0700)]
Add additional VW car kits to absolute volume blacklist

Change-Id: I8b0b73595e9183b9c1540b06e9e0378312c6a63d
Fixes: 25613423

8 years agoFix double mutex unlock and if() condition
Andre Eisenbach [Wed, 11 May 2016 03:27:20 +0000 (20:27 -0700)]
Fix double mutex unlock and if() condition

Commit "L2CAP and SDP Search API for BT profiles (2/2)" introduced two
separate issues in btsock_rfc_signaled():

1. The "slot_lock" potentially gets unlocked twice, causing
   undefined behaviour.

2. The call to BTA_JvRfcommWrite() was incorrectly taken outside
   of the conditional if() block that only executes the code if
   data is available.

This patch reverts the relevant locking change and fixes the if()
condition.

Bug: 27204458
Change-Id: I63b1257d21ca7bdd248858ec67e28f64e37a7895

8 years agoMove extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.
Bryce Lee [Wed, 11 May 2016 00:10:09 +0000 (17:10 -0700)]
Move extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.

Previously, extern "C" was placed in various locations within the header
files, sometimes below actual struct declarations. Doing so would lead to
alignment issues between C and C++ code.

tBTA_HF_CLIENT_HDR was removed from bta_hf_client_api since it was
extraneous and empty - leading to alignment issues.

Change-Id: Icdd338f1affe4c3a70c7bbd716249be6a16443d2

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Tue, 10 May 2016 23:43:41 +0000 (16:43 -0700)]
Change initial order of commands after establishing an LE connection

This patch changes order of commands send to LE device after connecting.
This will cause update connection parameters to be send after read
remote version. Having it other way around cause some problems with
broadcom chips, even though it should work both ways.

Bug: 28435172
Change-Id: I8ecf76217b036842e1d9ec7df714da94a99df7d5

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Tue, 10 May 2016 20:29:59 +0000 (13:29 -0700)]
Change initial order of commands after establishing an LE connection

This patch changes order of commands send to LE device after connecting.
This will cause update connection parameters to be send after read
remote features. Having it other way around cause some problems with
broadcom chips, even though it should work both ways.

Bug: 28435172
Change-Id: I280993d40b63d41729f5a8ccf246809c3abf617d

8 years agoA2DP_SINK: create avrcp connection only if a2dp is successful
AnubhavGupta [Thu, 7 Apr 2016 17:35:53 +0000 (23:05 +0530)]
A2DP_SINK: create avrcp connection only if a2dp is successful

 Scenario: Pair and connect carkit to a remote mobile
           Disconnect from carkit
           Initiate connection from carkit and turn BT-OFF
           on remote mobile phone
 Issuses: Even though A2DP connection is unsuccessful we
          try to connect AVRCP connectoin
 Solution:
  - for a2dp sink, we should not send pending play command
  - we should create avrcp connection only if a2dp connection
    is successful

Change-Id: If2c6a3710b6ebdaa382a3d8bcae5c137aaef1f2c

8 years agoPTS: Read SMP pairing options from bt_stack.conf
Nitin Arora [Sat, 12 Mar 2016 00:37:51 +0000 (16:37 -0800)]
PTS: Read SMP pairing options from bt_stack.conf

Use Case:
A number of cenrtification test cases require the host
to change the pairing options including auth request,
I/O capabilities, key distribution mask, key length
and Out of band capability.

Test Case: TP/PKE/BV-02-C

Failure:
Host currently only supports fixed SMP options and only
a few test cases involving pairing, are executed due
to that limitation.

Fix:
Added changes to read the SMP options from the bt_stack.conf
file at run time.
The pairing options are entered as a comma separated list eg:
SMPOptions=0xD,0x4,0xf,0xf,0x10
where the included hex values are in the following order:
\#auth, io, ikey, rkey, ksize
If all 5 options are not present, the host falls back to the
default values

Bug: 27852645
Change-Id: I693b05966695cf4660c5da10249c5f7c0663e53a

8 years agoPTS: Avoid BR SDP after LE pairing
Nitin Arora [Fri, 11 Mar 2016 02:27:24 +0000 (18:27 -0800)]
PTS: Avoid BR SDP after LE pairing

Use Case: Certification test case requiring LE secure pairing
with PTS.

Test Case: TP/SCJW/BV-01-C

Failure:
While pairing with PTS for certification test cases, LE secure
pairing followed by BR/EDR cross key derivation results in the
host initiating the SDP to gather the remote BR/EDR services.
PTS considers it as a test failure.

Fix: Added run time flag in bt_stack.conf file
"PTS_DisableSDPOnLEPair" to disable the SDP immidiately after
LE pairing followed by cross key derivation.

Bug: 27852645
Change-Id: Ib5a05c47b99c2ef8256967a608ae9ebbdfba60ee

8 years agoPTS: Allow disabling connection updates
Nitin Arora [Thu, 11 Jun 2015 00:10:57 +0000 (17:10 -0700)]
PTS: Allow disabling connection updates

Use Case: Certification test case requiring LE secure pairing
with PTS.

Failure:
LE pairing test cases follow the host behavior where
connection parameters are switched to fast parameters
for SMP and service discovery and switched back to the
default values after SMP/LE discovery is complete.
PTS disconnects to these series of connection updates.

Fix:
This change disables connection updates based on run time
flag "PTS_DisableConnUpdates" fetched from bt_stack.conf

Bug: 27852645
Change-Id: I1da213fd143ccfcb0ac82c7049a94094d2716ff1

8 years agoPTS: Add a Secure Only mode.
Nitin Arora [Fri, 11 Mar 2016 20:26:51 +0000 (12:26 -0800)]
PTS: Add a Secure Only mode.

Use Case:
Certification test cases require BLE to be in secure only
mode and reject legacy pairing requests.

Test Case: TP/SEC/SEM/BV-28-C

Failure:
Currently the host doesn't have a method of putting host into
a mode where it can only perform secure pairing.
This prevents execution of certification test cases
requiring Secure Only mode.

Fix:
Made changes to read the value of a tag "PTS_SecurePairOnly"
at runtime from the file "bt_stack.conf".

Bug: 27852645
Change-Id: I32cd6412621efeed2cb31c760a031762d9f369f9

8 years agoChanges to allow LE key upgrade
Nitin Arora [Tue, 30 Jun 2015 22:04:23 +0000 (15:04 -0700)]
Changes to allow LE key upgrade

Use Case: Certifiation test cases require the LE key upgrade
to happen when the current MITM level of the device has
been upgraded. In that case, a repairing is performed,
leading to more authenticated LTK.

Test Case: TP/SEC/AUT/BV-17-C

Steps:
1. Perform LE pairing between two devices using no MITM.
2. Change the IO capability of the devices, so that a
repair would involve authentication.
3. Reconnect the devices and expect key upgrade.

Failure:
No key upgrade is seen at reconnection and the devices
continue to use the old key.

Fix:
Added changes to re-calulate the requirement of key
upgrade when the LE channel is already encrypted.

Bug: 27852645
Change-Id: If62f334dcf298b2ce9840e95035b4398cb951c84

8 years agoFix undefined usage of snprintf
Ajay Panicker [Thu, 5 May 2016 21:51:34 +0000 (14:51 -0700)]
Fix undefined usage of snprintf

Using a buffer as both the format and output for snprintf could
cause undefinied behaviour on certain platforms. Instead just
use a temporary variable.

Bug: 27882028
Change-Id: If9f96fba4b3447b3248917ab9fb994bd80cbca0f

8 years agoRemove redefine of ARRAY_SIZE
Ajay Panicker [Fri, 6 May 2016 21:01:24 +0000 (14:01 -0700)]
Remove redefine of ARRAY_SIZE

Bug: 28621069
Change-Id: Ie3db0ff733052113493d0e53bb35e2d617c31bff

8 years agoUpdate l2c_fcr_clone_buf() to allocate large enough buffer
Pavlin Radoslavov [Mon, 9 May 2016 02:12:53 +0000 (19:12 -0700)]
Update l2c_fcr_clone_buf() to allocate large enough buffer

Apparently, in some parts of the code we assumed the original
buffer size is large enough and we can extend it and write
few more octets at the end.

Bug: 28351270
Change-Id: Idc53d8f68e55808c9f6bf7f18568288304a9bfb9

8 years agoLower unnecesary high log level
Jakub Pawlowski [Fri, 6 May 2016 20:26:45 +0000 (13:26 -0700)]
Lower unnecesary high log level

Change-Id: Id4d255d79c844cd8dbf044e5bda073b8f5d784e7

8 years agoCall BTA_VendorCleanup() during actual cleanup of the stack
Pavlin Radoslavov [Thu, 5 May 2016 23:20:15 +0000 (16:20 -0700)]
Call BTA_VendorCleanup() during actual cleanup of the stack

Previously, BTA_VendorCleanup() was called during the shutdown
process, and this created race condition crashing the stack.

Bug: 28450506
Change-Id: Ibee90d406036862b95d18e2ef00b08b820c70f68

8 years agoMerge "Return handle if an RFCOMM port is already open"
Treehugger Robot [Thu, 5 May 2016 23:29:24 +0000 (23:29 +0000)]
Merge "Return handle if an RFCOMM port is already open"

8 years agoMerge "Fix size of SDP black list array"
Treehugger Robot [Thu, 5 May 2016 22:31:40 +0000 (22:31 +0000)]
Merge "Fix size of SDP black list array"

8 years agoReturn handle if an RFCOMM port is already open
Andre Eisenbach [Thu, 5 May 2016 17:57:44 +0000 (10:57 -0700)]
Return handle if an RFCOMM port is already open

By returning the handle, the upper layer (BTA) will attempt to
disconnect on failure to connect. Thus the attempt to open the port will
still fail, but any subsequent attempts will be able to recover.

Bug: 27204458
Change-Id: I0f8489b98adeb7f5e217201ffbbb35132a66f210

8 years agoFix size of SDP black list array
Ajay Panicker [Thu, 5 May 2016 19:51:49 +0000 (12:51 -0700)]
Fix size of SDP black list array

Bug: 28617843
Change-Id: Iff5690e3aae42d9907ed9351f1059461985c8a20

8 years agoAllow C++ code to check bt_stack_config options
Myles Watson [Thu, 5 May 2016 18:57:54 +0000 (11:57 -0700)]
Allow C++ code to check bt_stack_config options

Stack configuration options are parsed in C.

Bug: 28485365
Change-Id: I046ef5c676256a8da23bf8c0a7d1eeb1e9603c05

8 years agoFixed test_periodic_unregister_processing_queue unit test
Pavlin Radoslavov [Wed, 4 May 2016 06:00:15 +0000 (23:00 -0700)]
Fixed test_periodic_unregister_processing_queue unit test

Removed a copy-and-paste check in the
test_periodic_unregister_processing_queue unit test.
The removed check adds little value - it has time-dependency,
and is not robust.

Bug: 26982349
Change-Id: I4adb948713b9946b5eb821d6fe52b7ada1400182

8 years agoAvoid NULL pointer usage of startup_future in case of HCI startup timeout
Pavlin Radoslavov [Wed, 4 May 2016 03:20:06 +0000 (20:20 -0700)]
Avoid NULL pointer usage of startup_future in case of HCI startup timeout

Previously, the startup_timer was created within the HCI layer start_up()
function, and after several vendor calls, we created the startup_future
that is used elsewhere. However, if any of the vendor calls blocks for
very long time, the startup_timer will timeout.
The startup_timer_expired() callback will try to use startup_future
that is still NULL, and that will trigger an assert.

The issue is avoided by creating the startup_future right before
the startup_timer is scheduled.

Bug: 28528815
Change-Id: Ib9f2c6581a86d3df0fd4d02d0b4c290663b5cfa1

8 years agoMerge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"
Treehugger Robot [Tue, 3 May 2016 23:57:18 +0000 (23:57 +0000)]
Merge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"

8 years agoUpdate alarm_unregister_processing_queue() to cancel scheduled alarms
Pavlin Radoslavov [Mon, 2 May 2016 17:52:07 +0000 (10:52 -0700)]
Update alarm_unregister_processing_queue() to cancel scheduled alarms

Update the alarm_unregister_processing_queue() implementation
so it cancels all alarms that are scheduled on the corresponding
queue.
This fixes a race condition during Bluetooth shutdown: if an alarm
expires right after an alarm processing queue is invalidated,
the alarm processing would try to use the invalidated queue.

Added the corresponding unit tests.

Also, added a missing call to alarm_unregister_processing_queue().

Bug: 26982349
Change-Id: I09a111e8080b6dbc354dffa03a487f7a8c578ce6

8 years agoSimplify btif multi adv data handling
Jakub Pawlowski [Tue, 3 May 2016 16:42:34 +0000 (09:42 -0700)]
Simplify btif multi adv data handling

Use static fixed size arrays to transport advertisement data instead of
dynamically allocated ones. This simplifies memory allocation and
cleanup handling.

Bug: 28485365
Change-Id: I3a2642e3b11a272eeec50fd959e10820ea3de74f

8 years agoFix google-explicit-constructor warnings.
Chih-Hung Hsieh [Tue, 3 May 2016 17:23:34 +0000 (10:23 -0700)]
Fix google-explicit-constructor warnings.

Bug: 28341362
Change-Id: I7ed9eb20b9b378a25a5454ce2ebfa113428baaf4

8 years agoBuild fix
Jakub Pawlowski [Tue, 3 May 2016 04:06:16 +0000 (21:06 -0700)]
Build fix

Change-Id: I6fd0ebe5e1d650ef307b22f96869c0004f6c956f

8 years agoAdd read/write timeout to the audio sockets
Pavlin Radoslavov [Mon, 2 May 2016 20:40:26 +0000 (13:40 -0700)]
Add read/write timeout to the audio sockets

Add read/write timeout of 2 seconds when reading/writing
from/to the audio-related control and data sockets.
Also, removed unnecessary poll(POLLOUT), because it is not needed anymore.

Bug: 27996931
Change-Id: Ib214a85f4837760b17cded155464957f56806bd3

8 years agoFix test_set_zero_periodic unit test failure
Pavlin Radoslavov [Mon, 2 May 2016 22:53:22 +0000 (15:53 -0700)]
Fix test_set_zero_periodic unit test failure

Removed an "EXPECT_EQ(cb_counter, 0)" statement
right after a timer of value 0 is scheduled.
The EXPECT_EQ statement shouldn't be there,
because by the time it is reached, the callback might
have been called already.

Change-Id: I61fbec96c436787321c6b36006a2bc1c0e627667

8 years agoConvert BTIF code from C to C++
Jakub Pawlowski [Thu, 21 Apr 2016 20:16:45 +0000 (13:16 -0700)]
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

8 years agoFix issues during cleanup stage of the Bluetooth stack
Pavlin Radoslavov [Tue, 26 Apr 2016 19:18:36 +0000 (12:18 -0700)]
Fix issues during cleanup stage of the Bluetooth stack

 * Moved free-ing of bta_av_cb timers from the init function
   to the cleanup stage.
 * Changed the usage of btif_jni_disassociate() so it is called
   synchronously. Its previous usage was complicated -
   the function was called asynchronously on a different thread,
   and we had to wait on a future for its completion.
 * Renamed function btif_shutdown_bluetooth() to
   btif_cleanup_bluetooth() to represent better its purpose.
   Similarly, bte_main_shutdown() is renamed to bte_main_cleanup()

Also:
 * Removed function btif_init_fail(), because it is not used.
 * Updated an error log message inside function
   btif_in_execute_service_request() so the log information
   is accurate and more useful.
 * Updated the log messages related to the lifecycle of a module
   in btcore/src/module.c

Bug: 26982349
Change-Id: Icd6f159d993bdb9c8ef09bfb5b1386b3d6ea4ff2

8 years agoHID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0
Hemant Gupta [Fri, 22 Apr 2016 07:11:39 +0000 (12:41 +0530)]
HID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0

Update invalid function call to hidh_process_repage_process with
valid function call hidh_try_repage as this was leading to compilation
error when HID_HOST_REPAGE_WIN is set to 0

Change-Id: Ib94233ec83ac30dcae701a16c588a2e2a63cac99

8 years agoDo not log unsolicited NOOP command complete events
Andre Eisenbach [Tue, 26 Apr 2016 16:51:06 +0000 (09:51 -0700)]
Do not log unsolicited NOOP command complete events

Bug: 27744135
Change-Id: I683e3a9f0a116f83763ebcf4d0583ea1c89ef5b2

8 years agoFix a race condition during alarm_cleanup()
Pavlin Radoslavov [Mon, 25 Apr 2016 19:29:29 +0000 (12:29 -0700)]
Fix a race condition during alarm_cleanup()

Fix a race condition inside function alarm_cleanup() that
could be triggered during shutdown.

Also, fix few other issues:
 * Add missing "timer_delete(akeup_timer)" statement inside
   alarm_cleanup()
 * Fix the argument when calling "timer_delete(timer)"
 * Call "semaphore_free(alarm_expired)" inside alarm_cleanup()
   after the corresponding "timer" and "wakeup_timer" have
   been deleted.
 * Fix the argument type when calling eventfd_read() inside
   semaphore_wait()

Bug: 26982349
Change-Id: I2b00cd7ee7f56f755775f8e7b370006e31c6eb08

8 years agoUse audio_session_t consistently
Glenn Kasten [Tue, 8 Mar 2016 20:12:33 +0000 (12:12 -0800)]
Use audio_session_t consistently

Bug: 27562099
Change-Id: I10780c8bfc84af568795a2c15557020fbe89a1c4

8 years agoAdd const guarantees
Jakub Pawlowski [Mon, 25 Apr 2016 17:43:02 +0000 (10:43 -0700)]
Add const guarantees

This patch adds const qualifiers to parameter of some methods.
It adds no value right now, but will make conversion of btif to C++
much easier.

Change-Id: I380a63484230f92aedfd4ff5e1ee72f30307d9d9

8 years agoFix a Floating point exception for periodic timers
Pavlin Radoslavov [Wed, 20 Apr 2016 00:30:19 +0000 (17:30 -0700)]
Fix a Floating point exception for periodic timers

Fix a Floating point exception for periodic timers that are
scheduled with interval of 0ms, and add a corresponding unit test.
Also, fix a typo when printing "Action counts" statistics.

Bug: 28278593
Change-Id: Ic381efc573ed9954c36980c26a89318d2de40b29

8 years agoImprove debug-ability of the stack manager
Pavlin Radoslavov [Wed, 20 Apr 2016 02:20:01 +0000 (19:20 -0700)]
Improve debug-ability of the stack manager

Add or update existing log messages in the stack manager,
so it is clear when each of the init/startup/shutdown/cleanup
steps is executed and completed.
The added/updated log messages are at INFO level.

Bug: 26982349
Change-Id: Ie84aa8e96133999eb76c5b351ddd4fea56404ef0

8 years agoAdd missing mutex lock/unlock inside alarm_cleanup()
Pavlin Radoslavov [Wed, 20 Apr 2016 02:16:26 +0000 (19:16 -0700)]
Add missing mutex lock/unlock inside alarm_cleanup()

Bug: 26982349
Change-Id: I32f4e6450491adcc1e12e71fb8bb582d6397a91a

8 years agoFix FD leak caused by module wrapper thread
Manu Viswanadhan [Tue, 19 Apr 2016 09:28:40 +0000 (14:58 +0530)]
Fix FD leak caused by module wrapper thread

Use Case: Repeated BT ON/OFF

Failure: FD leak is observed with ON/OFF stress test
which eventually leads to crash due to unavailability
of FDs.

Steps:
BT ON/OFF.

Root Cause: During cleanup the module wrapper thread is
stopped but the resources are not freed, leading to FD leak.

Fix: Cleanup the module wrapper thread properly so that there
are no resource leaks.

Bug: 28312228
Change-Id: I4de2fba9c98a0e4ae73315759ec6bc8bf273948e

8 years agoFix 64-bit build break.
Dan Albert [Fri, 22 Apr 2016 18:24:14 +0000 (11:24 -0700)]
Fix 64-bit build break.

Master (aosp and internal) has been broken for nearly two days now.

Was broken by https://android-review.googlesource.com/#/c/212244/
because no one checked 64-bit before merging.

No one noticed post-submit because the build servers aren't
checkbuilding any 64-bit targets (aside from mips64, which is broken
for other reasons).

I've uploaded a build change to get treehugger building a 64-bit
target (http://cr/120564724), and also to make all the targets
checkbuilds again (http://cr/120568746).

Change-Id: I195000284de5b52a539a47ad8b308990e72eea96

8 years agoProtect config module init and add date to config file
Ajay Panicker [Mon, 18 Apr 2016 18:31:48 +0000 (11:31 -0700)]
Protect config module init and add date to config file

Bug: 27354612
Change-Id: I45c3c46cf9be81b9d235cfef68343413c98b6d4a

8 years agoMerge "Fix assertion failure in btif_sock_rfc"
Sharvil Nanavati [Thu, 21 Apr 2016 21:54:55 +0000 (21:54 +0000)]
Merge "Fix assertion failure in btif_sock_rfc"

8 years agoAdd missing init/destroy of state_lock mutex
Pavlin Radoslavov [Wed, 20 Apr 2016 19:06:08 +0000 (12:06 -0700)]
Add missing init/destroy of state_lock mutex

Add missing init/destroy of state_lock mutex inside file
btif_sock_l2cap.c.
Also, add a missing unlock for the same mutex.

Bug: 28296454
Change-Id: I48b8deb911d29e8dcc6b7243fd61fc3ba69046dd

8 years agoFix assertion failure in btif_sock_rfc
Sharvil Nanavati [Wed, 20 Apr 2016 17:49:10 +0000 (10:49 -0700)]
Fix assertion failure in btif_sock_rfc

The BTIF RFCOMM code was ignoring the status code on RFCOMM writes. In
the failure case, the slot id is 0 which is invalid. But the slot id
shouldn't even be referenced since the result was failure.

Stack trace:

__assert2+20               bionic/libc/bionic/assert.cpp:40
find_rfc_slot_by_id+18     system/bt/main/../btif/src/btif_sock_rfc.c:144
on_rfc_write_done          system/bt/main/../btif/src/btif_sock_rfc.c:537
rfcomm_cback+632           system/bt/main/../btif/src/btif_sock_rfc.c:585
bta_jv_rfcomm_write+74     system/bt/bta/./jv/bta_jv_act.c:2121
bta_jv_sm_execute+18       system/bt/bta/./jv/bta_jv_main.c:93
bta_sys_event+56           system/bt/bta/./sys/bta_sys_main.c:523
run_reactor+254            system/bt/osi/./src/reactor.c:278
run_thread+142             system/bt/osi/./src/thread.c:209
__pthread_start(void*)+30  bionic/libc/bionic/pthread_create.cpp:199
__start_thread+6           bionic/libc/bionic/clone.cpp:41

Bug: 27819511
Change-Id: Ifcd19fdfb214559f345567f04db8146b30037363

8 years agoFix sluggish HID devices
Bluetooth Build Test [Wed, 13 Apr 2016 14:39:53 +0000 (16:39 +0200)]
Fix sluggish HID devices

Right now, when connecting to HID devices, preferred connection
parameters are not being used. This is because of bug in GAP profile.
This make all HID devices use default connection parameters, which
mean that they behave sluggish. This patch fixes that by forcing
HID devices to re-read connection parameters on each reconnection.

This is a temporary workaround until GAP is rewritten.

Change-Id: I74b70ad8e96c29517cace808632fe4d8e0251994

8 years agoEnable test_vendor_lib compilation on Linux
Bluetooth Build Test [Wed, 20 Apr 2016 19:35:28 +0000 (12:35 -0700)]
Enable test_vendor_lib compilation on Linux

8 years agovendor_libs: create Android.mk
Cristian Iorga [Tue, 15 Mar 2016 14:33:08 +0000 (16:33 +0200)]
vendor_libs: create Android.mk

all-subdir-makefiles call works for only one
nested sublevels, so we need to add a default
Android.mk in order to be able to build libbt-vendor module.

BUG=28014054

Change-Id: I7cc004d2a4dd6216a80d13c6384d9dcde328323e
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
8 years agoMerge "vendor_libs: test_vendor_lib: fix build"
Jakub Pawlowski [Wed, 20 Apr 2016 15:51:39 +0000 (15:51 +0000)]
Merge "vendor_libs: test_vendor_lib: fix build"

8 years agovendor_libs: test_vendor_lib: fix build
Cristian Iorga [Mon, 18 Apr 2016 13:09:31 +0000 (16:09 +0300)]
vendor_libs: test_vendor_lib: fix build

Change-Id: I1ba531c5289adea3fa5d6f9e0f68cf241a127219
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
8 years agoAdd guest mode functionality (2/4)
Ajay Panicker [Fri, 18 Mar 2016 00:09:24 +0000 (17:09 -0700)]
Add guest mode functionality (2/4)

Add a flag to enable() to start Bluetooth in restricted
mode. In restricted mode, all devices that are paired during
restricted mode are deleted upon leaving restricted mode.
Right now restricted mode is only entered while a guest
user is active.

Bug: 27410683
Change-Id: I19ff91d1d7fb8c60230fee7a05d32574b5b2aeda

8 years agoUse base from libchrome
Jakub Pawlowski [Mon, 18 Apr 2016 17:00:26 +0000 (10:00 -0700)]
Use base from libchrome

Change-Id: I57230618ef8653a168d69f871f88714ab339408a

8 years agoFix Linux libbt-vendor build
Cristian Iorga [Wed, 30 Mar 2016 17:14:36 +0000 (20:14 +0300)]
Fix Linux libbt-vendor build

Fix enumeration values not explicitly handled in switch;
Fix the undefined reference to functions from libosi.

Change-Id: I64ab3d57d1c4879ad47ae1a03f8996287877535d
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
8 years agoAllow A2DP SNK audio track focus gain interface.
Sanket Agarwal [Fri, 8 Apr 2016 18:26:04 +0000 (11:26 -0700)]
Allow A2DP SNK audio track focus gain interface.

In order to duck music we need to adjust the gain of the audio track
handled by A2DP SNK. Since SNK is implemented in native we need to add
interface to adjust the gain.

Bug: b/28065071

Change-Id: I60634cfadb502e276596bcb3aafc62ef81d9023a

8 years agoFix LE central device not being able to disconnect
Jakub Pawlowski [Thu, 14 Apr 2016 10:06:54 +0000 (03:06 -0700)]
Fix LE central device not being able to disconnect

This fixes issue introduced in
https://android-review.googlesource.com/#/c/202278

Bug: 28211048
Change-Id: I08e62149358f1c1fc1759a4ca9eb375cb0ad8230

8 years agoAVRCP: Update sdp record correctly for CT or TG.
AnubhavGupta [Tue, 22 Mar 2016 18:03:33 +0000 (23:33 +0530)]
AVRCP: Update sdp record correctly for CT or TG.

 -Issuses: SDP records are faulty
  - AVRCP versions are faulty
  - Nexus configuration shows browsing supported
  - Both Cat-1 and Cat-2 is supported for Nexus CT

 -Solution
  - pass sdp version as parameter
  - update sdp records for avrcp controller in case of client
    profiles being enabled
  - BTA_AV_FEAT_BROWSE flag was incorrecly set during AV registration
    causing AVRCP TG version to upgrade to 1.4 even though browsing
    feature is not supported.
  - Use AVRC_CTLR_INCLUDED feature flag instead of AVRC_ADV_CTRL_INCLUDED
    for guarding Avrcp controller code in build/parse apis for
    command/response
  - update categories supported for CT properly for mobile phone config

Bug: b/28149547

Change-Id: I3ff4082453a2624a72d8f152d75af83a8efb4937

8 years agovendor_libs: linux: Fix build
Cristian Iorga [Thu, 14 Apr 2016 08:00:28 +0000 (11:00 +0300)]
vendor_libs: linux: Fix build

LOG_DEBUG, LOG_VERBOSE definition changed in libosi.
This triggers:
"error: use of undeclared identifier 'true'" at
build time. Fixed by the inclusion of stdbool.h.

Change-Id: Ie2ed0d6b07bc28c26669b19a2584ea248e2782a9
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
8 years agoMerge "HID: Fix regression caused by commit "3a2c2d61""
Treehugger Robot [Thu, 14 Apr 2016 20:27:53 +0000 (20:27 +0000)]
Merge "HID: Fix regression caused by commit "3a2c2d61""

8 years agoAllow unused private field
Christopher Wiley [Thu, 14 Apr 2016 17:32:56 +0000 (10:32 -0700)]
Allow unused private field

This field is unused when we build unittests for OSX.

Bug: 28117776
Test: Compiles

Change-Id: I6add6946896a8cc2838309e6188812d4c7c497cb

8 years agoEnsure PIN code dialog is shown after remote name request
Andre Eisenbach [Wed, 13 Apr 2016 16:44:00 +0000 (09:44 -0700)]
Ensure PIN code dialog is shown after remote name request

If pairing is locally initiated and results in a remote name request
being performed before the PIN code is requested, then the PIN code
dialog will not be shown correctly.

This patch removes the check for locally initated pairing to ensure the
dialog is shown in all cases.

Bug: 27347017
Change-Id: I607c1c071af502fb2990b14cce676590e577b4c2

8 years agoMove autopair blacklist to interop database
Andre Eisenbach [Mon, 11 Apr 2016 21:50:41 +0000 (14:50 -0700)]
Move autopair blacklist to interop database

Blacklist by partial name etc. was not working and had no effect; all
BDAs in the config file start with 00:, which is implausible at best, so
deleted...

Added new mechanism to blacklist by BDA only initially and added Subaru
car kit to blacklist.

Bug: 27347017
Change-Id: Ie2941cb1ab663b5444b02c44f85032f13be4ab46

8 years agobtif: add count of devices loaded on startup
Marie Janssen [Wed, 13 Apr 2016 19:43:03 +0000 (12:43 -0700)]
btif: add count of devices loaded on startup

Report devices initially loaded from the config file.

Also removes the config mutex from btif_debug_config_dump as the config
is not modified.

Bug: 27354612
Change-Id: I25033ce28744051412f0d2bd554f0651e807ba7c

8 years agoMerge "Fix use of uninitialized value in btm_acl_update_busy_level"
Sharvil Nanavati [Wed, 13 Apr 2016 18:53:16 +0000 (18:53 +0000)]
Merge "Fix use of uninitialized value in btm_acl_update_busy_level"

8 years agoMerge "Fix use of uninitialized value in BTA_PanSetRole"
Sharvil Nanavati [Wed, 13 Apr 2016 18:53:12 +0000 (18:53 +0000)]
Merge "Fix use of uninitialized value in BTA_PanSetRole"

8 years agoFix use of uninitialized value in btm_acl_update_busy_level
Sharvil Nanavati [Mon, 11 Apr 2016 00:29:11 +0000 (17:29 -0700)]
Fix use of uninitialized value in btm_acl_update_busy_level

Caught by valgrind:

Thread 7 bt_jni_workqueue:
Conditional jump or move depends on uninitialised value(s)
   at 0x5682870: btif_dm_upstreams_evt (btif_dm.c:1800)
   by 0x56817EF: btif_context_switched (btif_core.c:180)
   by 0x56817EF: bt_jni_msg_ready (btif_core.c:290)
   by 0x571D1D7: work_queue_read_cb (thread.c:233)
   by 0x571C1F9: run_reactor (reactor.c:275)
   by 0x571CF3D: run_thread (thread.c:206)
   by 0x4A5B7B3: __pthread_start(void*) (in /system/lib/libc.so)
 Uninitialised value was created by a stack allocation
   at 0x56D9CC6: btm_acl_update_busy_level (btm_acl.c:503)

Bug: 28113318
Change-Id: I21ffa2f6c48d3bb96dcdc71fee6ab74634e57333

8 years agoHID: Fix regression caused by commit "3a2c2d61"
Hemant Gupta [Wed, 13 Apr 2016 11:12:18 +0000 (16:42 +0530)]
HID: Fix regression caused by commit "3a2c2d61"

uhid_event function returned 0 in normal case and with below
commit polling thread was being exited resulting in user space
not able to read the events sent by uhid kernel driver leading
to IOT issues with HID devices using the vendor hid usb drivers.
Eg: Apple Magic Mouse scroll functionality was not working as
for normal functionality of Apple Magic mouse, output report
needs to be sent to hid device, which was not being sent with
current implemenation.

commit 3a2c2d61f4c8769ea9c1615208a6daf2fa162084
Author: Myles Watson <mylesgw@google.com>
Date:   Tue Nov 10 14:35:57 2015 -0800

    Retry HID Polling when EINTR is returned

    While I'm here
     - use __func__ consistently in btif_hh_poll_event_thread.
     - remove braces around a single line

    BUG: 24647083
    Change-Id: I80b99ff0d3ba6336f5ab7a517269fdf63df59b37
Signed-off-by: Myles Watson <mylesgw@google.com>
Change-Id: If1f69c8d024fd7d03e2d79f19b962653fe2dd8b9

8 years agoMerge "Pull in libmedia's exported headers in libbtif"
Treehugger Robot [Tue, 12 Apr 2016 21:14:33 +0000 (21:14 +0000)]
Merge "Pull in libmedia's exported headers in libbtif"

8 years agoFix use of uninitialized value in BTA_PanSetRole
Sharvil Nanavati [Mon, 11 Apr 2016 00:15:29 +0000 (17:15 -0700)]
Fix use of uninitialized value in BTA_PanSetRole

Caught by valgrind:

Conditional jump or move depends on uninitialised value(s)
   at 0x57616E8: PAN_SetRole (pan_api.c:170)
   by 0x56C0193: bta_pan_set_role (bta_pan_act.c:370)
   by 0x56BFD65: bta_pan_hdl_event (bta_pan_main.c:387)
   by 0x56D24DD: bta_sys_event (bta_sys_main.c:495)
   by 0x5777029: run_reactor (reactor.c:275)
   by 0x5777D6D: run_thread (thread.c:206)
   by 0x49A77B3: __pthread_start(void*) (in /system/lib/libc.so)
 Uninitialised value was created by a heap allocation
   at 0x495883C: malloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
   by 0x5774857: osi_malloc (allocator.c:67)
   by 0x56C07A9: BTA_PanSetRole (bta_pan_api.c:107)
   by 0x56FBF31: btpan_enable (btif_pan.c:226)
   by 0x56DB3AB: btif_enable_bluetooth_evt (btif_core.c:524)
   by 0x56DE3EB: btif_dm_upstreams_evt (btif_dm.c:1742)
   by 0x56DC60F: btif_context_switched (btif_core.c:180)
   by 0x56DC60F: bt_jni_msg_ready (btif_core.c:290)
   by 0x5778007: work_queue_read_cb (thread.c:233)
   by 0x5777029: run_reactor (reactor.c:275)
   by 0x5777D6D: run_thread (thread.c:206)
   by 0x49A77B3: __pthread_start(void*) (in /system/lib/libc.so)

Bug: 28113318
Change-Id: Icdba2b7a557254d29f8c3a62c6d1a7aafa4fdde4

8 years agoRemoved unused functions
Pavlin Radoslavov [Thu, 7 Apr 2016 18:47:48 +0000 (11:47 -0700)]
Removed unused functions

Removed unused functions and defines that are not needed:
 - l2c_bcst_msg()
 - GAP_ConnBTWrite()
 - gap_proc_btu_event()
 - AVDT_WriteDataReq()
 - L2CAP_BCST_MIN_OFFSET
 - L2CAP_BCST_OVERHEAD
 - AVDT_MAX_MEDIA_SIZE
 - LOG_NDDEBUG in btif/src/bluetooth.c

Bug: 28068134
Change-Id: If0edda2bf86caf83027db2c897537c82a0d80667

8 years agoPull in libmedia's exported headers in libbtif
Christopher Wiley [Mon, 11 Apr 2016 22:14:23 +0000 (15:14 -0700)]
Pull in libmedia's exported headers in libbtif

Do this by listing libmedia as a shared library linked by libbtif.
We won't actually be able to link against libmedia because static
libraries don't work like that, but surrounding logic about headers
is triggered.

Bug: 27804373
Test: libbtif compiles in the presence of a new exported header path
      in libmedia.

Change-Id: Ic1e776966daaf70b7b9ae6ea99af89bc9a0b3885

8 years agoFix ambiguous base::TimeDelta reference
Christopher Wiley [Mon, 11 Apr 2016 22:18:14 +0000 (15:18 -0700)]
Fix ambiguous base::TimeDelta reference

base::TimeDelta cannot be resolved when both libbase's
android::base namespace and libchrome's base:: namespace
are included via transitive header dependencies.

Bug: 27804373
Test: Compiles.

Change-Id: I9854c92763728fb85ad21183f37c94a4d7bd61a5

8 years agoTrigger a compilation error when LOG_TAG is not provided
Jakub Pawlowski [Mon, 11 Apr 2016 08:54:54 +0000 (01:54 -0700)]
Trigger a compilation error when LOG_TAG is not provided

When compiling for OS_GENERIC, lack of LOG_TAG causes a compilation error.
Most developement happens on Android, which compiles this without an
error. This patch triggers a compilation failure on Android when LOG_TAG is not
provided.

Bug: 28118588
Change-Id: I316aa01952fb88d77bbabb197c77e4287a3fc39b

8 years agoLinux build fix
Bluetooth Build Test [Thu, 7 Apr 2016 12:10:40 +0000 (14:10 +0200)]
Linux build fix

* add missing LOG_TAG definition
* add missing LOG_TAG inside LOG statements
* remove unnecessary includes of cutils/*.h files
* update libchrome/BUILD.gn to be on par with latest version of
  library used in Android

Bug: 28094186
Change-Id: I19a07afac20789b42a070995f6aa9da68b1bb940

8 years agoFix valgrind error
Jakub Pawlowski [Tue, 12 Apr 2016 13:44:52 +0000 (06:44 -0700)]
Fix valgrind error

This patch fixes following valgrind error message:
==5000== Thread 6 bt_jni_workqueue:
==5000== Conditional jump or move depends on uninitialised value(s)
==5000==    at 0x4353C7:
bluetooth::LowEnergyClient::ScanResultCallback(bluetooth::hal::BluetoothGattInterface*,
bt_bdaddr_t const&, int, unsigned char*) (low_energy_client.cpp:573)
==5000==    by 0x443BBB: bluetooth::hal::(anonymous
namespace)::ScanResultCallback(bt_bdaddr_t*, int, unsigned char*)
(bluetooth_gatt_interface.cpp:91)

Bug: 28113318
Change-Id: Ide82c6a7f68f6bbe427f12ca353d62f1d999d0ae

8 years agoCleanup unnecessary logs
Jakub Pawlowski [Tue, 12 Apr 2016 12:50:49 +0000 (05:50 -0700)]
Cleanup unnecessary logs

Bug: 27698756
Change-Id: I30b5e4b45d4b06e0264415e85949c7bf828f28c0

8 years agoDo not update sco_state when no matching peer_addr is found
Lianchao Song [Wed, 23 Mar 2016 03:03:19 +0000 (11:03 +0800)]
Do not update sco_state when no matching peer_addr is found

In the bta_hf_client_sco_conn_cback function, sco_state should not be set to
BTA_HF_CLIENT_SCO_SHUTDOWN_ST when no matched peer_addr found, so that it
can handle BTA_HF_CLIENT_SCO_OPEN_E event later.

Bug: 26416310
Change-Id: I4540230c792490f79e4cca24cb4b34a1c383422f
Signed-off-by: m00230717 <m00230717@notesmail.huawei.com>
8 years agoDisable the Java subsystem when RFCOMM sockets are cleaned up
Sharvil Nanavati [Wed, 6 Apr 2016 23:08:38 +0000 (16:08 -0700)]
Disable the Java subsystem when RFCOMM sockets are cleaned up

Change-Id: I33dfd2aa01d6f496bee151d5994872e04d25e469

8 years agoDelete unused JV code
Sharvil Nanavati [Wed, 6 Apr 2016 21:46:49 +0000 (14:46 -0700)]
Delete unused JV code

Change-Id: I16d017ef90269a435b8f66a58ed06d2fc89d407f

8 years agoFix for issue introduced due to rebase of LE L2CAP COC
Navin Kochar [Fri, 18 Mar 2016 06:34:30 +0000 (12:04 +0530)]
Fix for issue introduced due to rebase of LE L2CAP COC

During 6721232 patch, some code got missed while doing manual rebase.
This patch is adding that missing code.

Change-Id: I2525908c29e3288e0ace1ee26c5f2aa6cfd59d68
Signed-off-by: Navin Kochar <navin.kochar@intel.com>
8 years agoUpdated the A2DP statistics
Pavlin Radoslavov [Tue, 5 Apr 2016 18:45:30 +0000 (11:45 -0700)]
Updated the A2DP statistics

 * Added "Frame expected" and "Frames limited" statistics in the
   bugreport about expected and limited number of frames per tick.
   Also, added corresponding "Counts (expected/limited)":

A2DP State:
  TxQueue:
  Counts (enqueue/dequeue/readbuf)                        : 386 / 386 / 768
  Last update time ago in ms (enqueue/dequeue/readbuf)    : 12644 / 12643 / 12600
  Frames expected (total/max/ave)                         : 2632 / 8 / 6
  Frames limited (total/max/ave)                          : 0 / 0 / 0
  Counts (expected/limited)                               : 382 / 0
  Frames per packet (total/max/ave)                       : 2618 / 7 / 6
  ...

 * Renamed "tx_queue_max_frames" to "tx_queue_max_frames_per_packet"

 * Fixed the computation of actual transmitted frames:
   tx_queue_total_frames, tx_queue_max_frames_per_packet

 * Computed / added buffer_overruns_max_count and
   buffer_underruns_average to the Protobuf stats.

Bug: 27500656
Change-Id: Id58cfb0b5de2296742c84aa0b743e0eed398f41f

8 years agoFix memory leak when saving paired devices
Marie Janssen [Tue, 5 Apr 2016 18:36:15 +0000 (11:36 -0700)]
Fix memory leak when saving paired devices

Followup from r.android.com/210955

Minor style fixes for osi/config also included.

Bug: 26071376
Change-Id: I26563b75a59a6f0ae074676754889cb988a69358

8 years agobtif: Don't persist remote devices to the config
Marie Janssen [Fri, 25 Mar 2016 20:37:13 +0000 (13:37 -0700)]
btif: Don't persist remote devices to the config

We don't need to persist the unpaired devices to NVRAM
so skip saving them.

This fixes a regression in a previous patch where the most recent
instead of the least recent devices would be removed, making some
devices unpairable in extremely busy environments.

Bug: 26071376

Change-Id: If7ee9d960f70c836bf08b78da5f3fc852ba60a85

8 years agoBring back support for legacy bt_config.xml
Alain Vongsouvanh [Wed, 30 Mar 2016 00:33:55 +0000 (17:33 -0700)]
Bring back support for legacy bt_config.xml

If a device migrates directly from L or earlier to a version using this
new implementation, all bt_config will be lost, requiring to repair to
the devices.

Change-Id: Ifdca0d8cad8efaa9f503ca40ac0725547a06f15c

8 years agoA2DP_SINK: initialize track handle to null
Sanket Agarwal [Wed, 30 Mar 2016 13:31:16 +0000 (19:01 +0530)]
A2DP_SINK: initialize track handle to null

- initialize track handle to null
- prevent invoking audiotrack API in case handle is null

Bug: 27613411

Change-Id: I1a8637fd2cbb3012b29c1930f978100e7f0c58d8

8 years agoFix line wrapping for btsnooz
Ajay Panicker [Fri, 1 Apr 2016 21:02:06 +0000 (14:02 -0700)]
Fix line wrapping for btsnooz

Change-Id: I4558c652577ffeb3f1ac4f273472ccf98d70924b

8 years agoFix btsnooz.py multi-line base64 decoding
Andre Eisenbach [Sat, 2 Apr 2016 00:47:54 +0000 (17:47 -0700)]
Fix btsnooz.py multi-line base64 decoding

Change-Id: Ie915c52d8a7eada10f68999c40a2b50b35f640e2

8 years agoMerge "Allow factory reset when bluetooth is off (2/2)"
Ajay Panicker [Fri, 1 Apr 2016 23:46:33 +0000 (23:46 +0000)]
Merge "Allow factory reset when bluetooth is off (2/2)"

8 years agoAdd a log message to capture empty queue in l2c_enqueue_peer_data()
Pavlin Radoslavov [Fri, 1 Apr 2016 03:22:29 +0000 (20:22 -0700)]
Add a log message to capture empty queue in l2c_enqueue_peer_data()

Add a log message in l2c_enqueue_peer_data() to help capture
an empty queue p_ccb->xmit_hold_q that is triggering an assert.

Also:
 * Fix a memory leak inside l2cu_initialize_fixed_ccb()
   p_ccb queues have been allocated again even though
   they have been allocated previously within l2cu_allocate_ccb()
 * Fix a typo in a comment: clodes -> closed
 * Removed repeated function declarations in file l2c_int.h

Bug: 27821847
Change-Id: I2df2843710310acf5a46c6fa5b302cf7390bc1b4

8 years agoAllow factory reset when bluetooth is off (2/2)
Ajay Panicker [Tue, 1 Mar 2016 00:18:12 +0000 (16:18 -0800)]
Allow factory reset when bluetooth is off (2/2)

Bug: 27348444
Change-Id: Idf0c0bda892c76be037fd28ed352237d4c5b8263

8 years agoBUILD FIX: BTIF_MEDIA_FOCUS_NOT_GRANTED should be complied only for SINK
Sanket Agarwal [Wed, 30 Mar 2016 19:21:30 +0000 (12:21 -0700)]
BUILD FIX: BTIF_MEDIA_FOCUS_NOT_GRANTED should be complied only for SINK

Since BTIF_MEDIA_FOCUS_NOT_GRANTED is only applicable for focus handling
in A2DP SINK scenario it is only defined and protected by
USE_AUDIO_TRACK.

BUG: 26928143
Change-Id: I414bda160270838c9bc911fef9798a95e1f34ec8

8 years agoMove focus handling entirely to component calling fluoride.
Sanket Agarwal [Wed, 10 Feb 2016 23:24:09 +0000 (15:24 -0800)]
Move focus handling entirely to component calling fluoride.

Audio focus handling for A2DP sink currently split between Fluoride and
the component sitting on top of it. Since this is not the best place to
decide policies, we move all such decisions to the upper layer.

Bug: b/26928143

Change-Id: I67a1a2a50782289e7e31447b01ee29a21bc8dac2

8 years agoRemove %s from Log message.
Sanket Agarwal [Sat, 13 Feb 2016 18:19:45 +0000 (10:19 -0800)]
Remove %s from Log message.

This crashes when A2DP SNK role is executed in print statement.

Change-Id: Iceca09ecc5977a5379d7f98f265fc2d52332c6e4

8 years agoAvoid using alarm APIs for LPM when Idle timeout is zero
Jaganath Kanakkassery [Fri, 12 Feb 2016 15:03:06 +0000 (20:33 +0530)]
Avoid using alarm APIs for LPM when Idle timeout is zero

For some vendors the idle timer value is configured to zero. But with
the current LPM timer implementation it will use the alarm APIs to
schedule wake_deassert(), which introduces context switch overhead.
The code is modified to trigger the wake_deassert immediately if the
idle timeout value is configured to zero. These changes improve OPP
throughput.

Change-Id: Ic48e7b990ccf55525a0d15b65c03daedfe03c582
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
8 years agoRemove unused p_db for A2DP service discovery
Andre Eisenbach [Fri, 25 Mar 2016 23:48:44 +0000 (16:48 -0700)]
Remove unused p_db for A2DP service discovery

This fixes a crash (SIGSEGV) when re-connecting A2DP devices where the
SDP pointer was incorrectly reset to 0.

Bug: 27852645
Change-Id: Ie40b7e57fc117c6fe7a42020600745ef348b503c

8 years agoDon't destroy BTIF Device Management state during shutdown
Pavlin Radoslavov [Sat, 26 Mar 2016 01:55:30 +0000 (18:55 -0700)]
Don't destroy BTIF Device Management state during shutdown

Don't call btif_dm_cleanup() during stack shutdown stage,
because it will destroy/free internal state that might be used
later in the shutdown process.
Instead, btif_dm_cleanup() should happen during the stack
cleanup stage.

Also, added an unit test to capture the original issue.

Bug: 27856457
Change-Id: I8575537ad744cf4e6770046b779b6a53de93d66e