History log of /packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
099b9449d5c11e26f5dc17bd14170f3fe0a2e412 22-May-2018 Pavlin Radoslavov <pavlin@google.com> Allow outgoing A2DP connection when pairing via NFC

If Bluetooth is disabled, pairing via NFC will start the Bluetooth
Adapter service in Quiet Mode. In such mode only the incoming A2DP
connection requests should be rejected - the outgoing A2DP connection
requests should be allowed.

Bug: 79330878
Test: Manual: (1) Disable Bluetooth; (2) Pair with a Headset via NFC;
(3) Play music. Updated existing unit tests.

Change-Id: I3dd892b963116c8f169f63bb117401a4a078ab9c
Merged-In: I3dd892b963116c8f169f63bb117401a4a078ab9c
(cherry picked from commit c713e54b82851072afdc5fb6bc6decc2f438d81b)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
3f58524aecc03ca63e0a244f3f1857c9b7ba2808 17-May-2018 Ugo Yu <ugoyu@google.com> Update a2dp state to not playing while quitting the state machine

- Fix a race condition for a2dp while turning off Bluetooth.
- Audio state won't be updated if A2dpService stop before stack
report audio state change.
- Update audio state to not playing if it is playing and the
state machine is quitting.

Bug: 79911521
Test: manual test, turn off Bluetooth while a2dp is playing
Change-Id: I09c4e062fd2205abf57c25ca44cba27088ebf5e5
(cherry picked from commit b440ba997894ccc2a62aa09711e55d8f597770e4)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
30f396b583b5eed9d4b014a1c666804a3b545758 14-Mar-2018 Pavlin Radoslavov <pavlin@google.com> Add a missing null pointer check in the codec config comparison logic

Also, rearange the "if" logic into "else if" so it is more natural.

Bug: 74622467
Test: Manual with A2DP Offload enabled and LDAC Headset
Change-Id: I363c7b1aedf5c33f5cdeb56862385969ea8bde1c
(cherry picked from commit d4a798f85529dfe21b7500a4e67e46c633719c0c)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
a781f9faf8e4bd4b207089faba0153ee925421fa 20-Jan-2018 Satish kumar sugasi <ssugas@codeaurora.org> A2DP Offload support

Bug: 63932139
Bug: 72242910
Test: Manual; TestTracker/148125
Change-Id: Iecce1d86d457db7c25c77e43557d255f2898a2d3
(cherry picked from commit 87173c40be4288affe06882d864d23cb1008bd99)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
079a76e32cd030eb864635d2a2bd493283806d8d 27-Feb-2018 Jack He <siyuanh@google.com> A2DP: Make sure CONNECT_TIMEOUT is scheduled in intermediate states

* Always schedule CONNECT_TIMEOUT message when entering Connecting and
Disconnecting state
* Always remove CONNECT_TIMEOUT message when exting Connecting and
Disconnecting state
* Add testIncomingTimeout in A2dpStateMachineTest to verify that an
incoming connecting request could timeout as well

Bug: 73899051
Test: connect and disconnect to A2dp devices
runtest -j32 bluetooth -c com.android.bluetooth.a2dp.A2dpStateMachineTest

Change-Id: I4412c77c8395a1ede12d7c1bd071822e55f5dd9c
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
602fe258758a28d579e6357eca68b634fa6e6897 27-Feb-2018 Jack He <siyuanh@google.com> A2DP: Simplify debug log mechanism

* Override log() method in StateMachine to log messages gated by DBG
flag
* Replace all usages of "if (DBG) Log.d(TAG, msg)" with log(msg)
* Call StateMachine.setDbg(DBG) in the constructor to enable more
logging for StateMachine
* Add null check to getCurrentMessages() in logging to avoid unintended
NPE

Bug: 73899051
Test: connect to and disconnect from A2DP devices
Change-Id: Id89f3ba99c97c62dca74fa3901dc3c6f2c352fc1
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
308c9274fa8e70c498feacc7599435a476689372 15-Feb-2018 Jack He <siyuanh@google.com> A2DP: Dump state machine message verbatim

* Override StateMachine.getLogRecString(Message) method so that state
machine messages are dumped verbatim into dumpsys output
* A2dpStackEvent will be dumped automatically via the toString() method

Bug: 72102258
Test: adb shell dumpsys bluetooth_manager
Change-Id: I12dedb1a6ee790572072e589e7d480198043b2a7
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
7b52eb7550500a570937c6164018005b14ea359b 12-Feb-2018 Pavlin Radoslavov <pavlin@google.com> Update the A2dpService logic for creating/deleting state machine instances

* Create a new state machine instance for native stack events only if the
event is CONNECTION_STATE_CONNECTED or CONNECTION_STATE_CONNECTING
* Add an early check to reject connect() request if there are too many
connected devices.
* Fixed the logic inside updateOptionalCodecsSupport() so it cannot
create a new state machine instance
* Unbonding a device will remove the state machine instance only
if the device is disconnected
* If a device is disconnected, remove the state machine if
the device is already unbond

Also:
* Renamed canConnectToDevice() to connectionAllowedCheckMaxDevices()
* Add new method A2dpService.getDevices() - used only for testing
* Add a missing transition in the A2dpStateMachine from Connected
to Disconnecting on A2dpStackEvent.CONNECTION_STATE_DISCONNECTING
event.
* Fix the logic for checking the maximum number of state machines
to avoid DoS attack
* Add checks that bond state events and native stack events
contain a device
* Change the A2dpServiceTest setting to use MAX_CONNECTED_AUDIO_DEVICES
of 5 by default.
* Add internal mechanism in A2dpServiceTest to
- waitForNoIntent() - Wait and verify that no intent has been received
- verifyNoConnectionStateIntent() - Wait and verify that no connection
state intent has been received
* Add unit tests:
- testOutgoingConnectPriorityOff()
- testMaxConnectDevices()
- testCreateStateMachineStackEvents()
- testDeleteStateMachineUnbondEvents()
- testDeleteStateMachineDisconnectEvents()
* Add a new helper method TestUtils.getTestDevice()
* Minor cleanup: arguments renaming, etc.

Bug: 73212853
Test: Unit tests added:
runtest bluetooth --test-class com.android.bluetooth.a2dp.A2dpServiceTest
Change-Id: I484fcc04b7ce800df1a0e1cf8930816edae6ab91
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
cb20bfd931a9497cfddf47bdd244b7a4fa1a28f7 11-Feb-2018 Pavlin Radoslavov <pavlin@google.com> Moved okToConnect() from A2dpStateMachine to A2dpService

Also:
* Updated the corresponding unit test.
* Removed unnecessary "context" argument to A2dpStateMachine constructor

Bug: 73205770
Test: Unit tests pass
Change-Id: Ideb854bc1b2a3b909d3bf14103f27372949f8e3f
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
c72f1a03add7d6b727fa222cfc1424dfe01ac746 11-Feb-2018 Pavlin Radoslavov <pavlin@google.com> Remove unnecessary null pointer initialization for class variables

In Java, the class variables have default initialization - null
for pointers.

Also, removed unnecessary template arguments when creating templetized
objects:
OLD:
List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>();
NEW:
List<BluetoothDevice> devices = new ArrayList<>();

Test: code compilation
Bug: 73205770
Change-Id: Ib983ee40df6bc5bb250ed23fa05a92c6b0365a5a
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
e0cda4210b51f608a2c18cd1f128757b60e39222 09-Jan-2018 Pavlin Radoslavov <pavlin@google.com> Add support for Multi-A2DP state machines per device

* Remove mStateMachine and use a single A2dpStateMachine instance per device
* Cleanup/simplify A2dpStateMachine internals - the BluetoothDevice per
state machine doesn't change.
* Send the state changed broadcast message on enter() in a new state
This fixes timing ordering issue exposed by some of the unit tests
* Remove a state machine when bonding for a device is removed
* Add a mechanism to set the active device
* Add a mechanism to track the maximum number of connected devices
* Updated the codec-related APIs to take a BluetoothDevice argument:
- getCodecStatus()
- setCodecConfigPrefereice()
- enableOptionalCodecs()
- disableOptionalCodecs()
* Add A2dpServiceTest unit tests for A2dpService
* Add ActiveDeviceManager that is responsible for keeping track of the
connected devices and select which device is active.

Also:
* Updated the JNI codec-related calls to use const reference
instead of a pointer
* Additional cleanup

Bug: 69269748
Test: Manual and unit tests
Change-Id: If379f0aa1403de09c485d4adb0dfdfe73190cbf9
Merged-In: If379f0aa1403de09c485d4adb0dfdfe73190cbf9
(cherry picked from commit 6e5900e06c3f53e41a995137dc37dfcc2711bd34)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
88439fc6f2ca6e779e27069c60aaf0f239169e24 19-Dec-2017 Pavlin Radoslavov <pavlin@google.com> Added internal API to get/set the A2DP Active Device

1. Call BluetoothA2dp.setActiveDevice(BluetoothDevice device) to set
a connected A2DP device as active.
2. Listen for BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED intent
that will contain the latest active device (in EXTRA_DEVICE field).
If the active device could not be changed, the EXTRA_DEVICE
field could be null.
3. If setActiveDevice() is NOT in-progress, BluetoothA2dp.getActiveDevice()
can be used. If setActiveDevice() is in-progress, the result is undefined.
4. BluetoothA2dp.setActiveDevice() could be called by some other parts of
the system, so interested parties should always listen for
BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED intents and prepared
for active device updates.

Bug: 71555243
Test: Manual
Change-Id: I860d1aba716d75856c3e9e022948a1b4b3be18bf
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
1a5532f2043cc2eaf136a35eace240f8bebd9bbe 10-Nov-2017 Pavlin Radoslavov <pavlin@google.com> Update the codec-related JNI calls to contain the remote Device address

Also, normalize the order of the A2DP-related JNI callbacks to
list the remote device address first.

Bug: 68993365
Test: Manual - A2DP streaming to headset
Change-Id: I7a64f6cac4dabfbc2f5c36f96f8c36ba162948ac
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
9bc5f45cf286ad42d48bee2c3f3bfebb859748cf 07-Nov-2017 Pavlin Radoslavov <pavlin@google.com> Clean up A2DP State Machine

* Cleaned up existing A2dpStateMachine class and added extra logs
* Isolated JNI native interface in a separate class A2dpNativeInterface
so it is easier to mock it
* Moved StackEvent related info to a separate class A2dpStackEvent
* Added unit tests for the A2DP State Machine

Bug: 68993365
Test: Unit tests added; Manual: A2DP connect/disconnect/streaming
Change-Id: I6e3441fd4f453f5a200e661461feb407d4d2150e
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
b4db71d3822ccf252fe09a7490f532c3b4fadd0c 06-Nov-2017 Pavlin Radoslavov <pavlin@google.com> Remove executable file mode bit from source code files

Test: Code compilation
Change-Id: I4fb1648607dda9c647ab6cd771a59db0caf9b5b2
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
c4fbd756e2645147470c486ae96f2253f5e13a52 12-Oct-2017 Jack He <siyuanh@google.com> [Script] Fix checkstyle errors (1/2)

Format code using Intellij to conform to CheckStyle requirements

Bug: 63597465
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I70cd2ab8e5e6d5428ab1556658735b0d83f4fb15
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
76a12d7e679ae48f8ab73e01b33fb7c8f077a210 11-Oct-2017 Jack He <siyuanh@google.com> [Manual] Assorted fixes for CheckStyle

* Inner class constructor does not need private modifier to be hidden
* Fixed unused tags or mis-typed tags
* Move comments out from if-else body
* Add spaces between ';' and comments
* Simplified conditionals that were not fixed automatically by scripts

Bug: 63597465
Test: make checkbuild, no functional changes
Change-Id: Iaaebf4ab3840973e44dc3310d39961db89281d5e
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
8bc413b0b749ea9df59e858493273e05087fe887 11-Oct-2017 Jack He <siyuanh@google.com> [Manual] Rename non-public non-static variables to mCamelCase

* Run "instance field naming convention" inspection in Intellij
* Rename variables that are non-public non-static to m + Camel Case
* Renaming is done through refactor tool in Intellij
* Private variables are renamed to m + Camel Case
* Non-private variables are added with public modifier to indicate that
they are accessed externally as well

Bug: 63597465
Test: make checkbuild, no functional changes
Change-Id: I88400ac99fa1ba084cdfa35600bd3c23f1dd1a33
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
32a94e2fdbaa66fb26bd0be2425b55151b5e493b 10-Oct-2017 Jack He <siyuanh@google.com> [Script] Simplify pointless boolean expressions

* Run "Pointless boolean expression inspection" in Intellij
* Fix issues like
a == false -> !a
a == true -> a
a != true -> !a
a != false -> a

Bug: 63597465
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I303e8ee7c1cb0d76ccd86edcb08c6e763e2aa7ea
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
dbf5c4e1c9e57fa6e5cc96ee9f442da8aa391a5d 10-Oct-2017 Jack He <siyuanh@google.com> [Script] Sort modifiers according to JLS

* Correct order is:
1. public
2. protected
3. private
4. abstract
5. default
6. static
7. final
8. transient
9. volatile
10. synchronized
11. native
12. strictfp
* This is achieve through running automatic code cleanup in Intellij
using "Missorted modifiers" inspection

Bug: 63597465
Test: make checkbuild, no manual changes, no functional changes
Change-Id: Id9c8a3c6bf1195b43d986c4324da94ca8c44367f
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
d17bd2d2ba3293a0bb094ec4fc79c65688e88c39 04-Oct-2017 Jack He <siyuanh@google.com> A2DP Revert "Move A2dp State to Disconnected when BT is Turned OFF"

Original change ID: I17bc620551bf735f39327eff59102c14551bcf26

There is a race condition in A2DP state machine where state transition
to Connected state may not complete before doQuit() is called. In this
case, state machine has sent state transition going from CONNECTING to
CONNECTED, whereas doQuit() will see the state as CONNECTING and will
send a state transition intent going from CONNECTING TO DISCONNECTED,
causing a disruption in the state transition.

* This CL reverts and older commit that created this behaviour as no
other profiles send this intent during doQuit. Currently, when
Bluetooth is turned off, the turning OFF intent should supersede all
other profile state change intent until further changes are made to
all profiles.
* That is, if BluetoothAdapter.ACTION_STATE_CHANGED intent's EXTRA_STATE
extra is STATE_OFF, all existing profile states are invalidated and
defaulted to DISCONNECTED
* This is the behaviour for all profiles at this moment until plans are
made to change it

Bug: 67419965
Test: Pair and repeatly toggle Bluetooth
Change-Id: I81b28067af031818c8668c9bd6fd1d807ad7fb8f
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
5e4b34c770e1e4992578dec143005f092f08709b 12-Jun-2014 Ayan Ghosh <abghosh@codeaurora.org> Proper handling of A2DP connetion timeout scenarios

- Remove connect time-out when moved to Connected/Disconnected
instead of Pending state.
- Initiate disconnect on timer expiry.
- When initiating incoming/outgoing connections, there is a
possiblity that CONNECT_TIMEOUT for outgoing connection
happens after successfully connected to other incoming
connection and thus this timeout will be received in Connected
state. We need to clear the target device and update the
connection state to ensure external apps update their states
accordingly.

Test: 1. Initiate outgoing connection to HS1 which is in OFF state
2. Do incoming connection to DUT.

Bug: 35414834
Change-Id: Ie866db651376ae74f3f6c03c204121eff13db89d
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
14e18cdd57fff45a34b83b70ea2162212a58f296 21-Aug-2017 Mallikarjuna GB <gbmalli@codeaurora.org> Merge "Properly update profile connection state"
am: 0b4d65d712

Change-Id: I6560567be184ca4e03f6f8e0ec166ca57ae45a96
921e34fc7ffd18b4f831bbcf0cf38e7268a00613 23-Jun-2015 Mallikarjuna GB <gbmalli@codeaurora.org> Properly update profile connection state

When DUT is toggled between various paired Headsets Connection
state is not updated properly in some scenarios. This is causing
Bluetooth icon to be in connected state even when no Headsets are
connected.

With this patch we will broadcast connection states in case of
failure and will make sure connected, connecting, disconnecting
devices count is never negative.

Test: Toggle between various paired devices in settings
Bug: 35657640
Change-Id: Icb1a7215ff6d9491afbb5f7f203ca0a2c6b7f43a
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
2c2aec2ef9436eb6d7c8ab5628a5dc86e511b52d 01-Jun-2017 Pavlin Radoslavov <pavlin@google.com> Merge "Improve internal state synchronization of the A2dpStateMachine" am: 1de504036f am: 2e5ab36e0d
am: 017346d9d7

Change-Id: I501deaba8e5ec202c9f24acfd52f4c608ab61bc0
459978de76c5d152208538f61180e4a790c6e8d9 01-Jun-2017 Pavlin Radoslavov <pavlin@google.com> Improve internal state synchronization of the A2dpStateMachine

* Don't block entering Disconnected state
If the mCurrentDevice or mTargetDevice or mIncomingDevice
is not null, print an error message and reset the state
* Add consistency checks when entering each state: Disconnected,
Pending, Connected
* Add a missing "synchronized" statement

Bug: 62164051
Test: Manual
Change-Id: I5856a88e58b42aa55d9075aa507bfa706ea52512
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
75ddeb7d0efdaac8407af59d1df1d79ac653c895 11-May-2017 Ajay Panicker <apanicke@google.com> Merge "Remove delay received from audio layer for A2DP state changes" am: fa31e9b594 am: 2959cd2704
am: 3ec66a3406

Change-Id: I9fed9792bab69879e9969bce7e88897094491dcc
895d2fc990ef39441731af44b3603355ddb05a46 08-May-2017 Ajay Panicker <apanicke@google.com> Remove delay received from audio layer for A2DP state changes

Due to changes in the audio layer, the
setBluetoothA2dpDeviceConnectionState() function now returns a
delay of 0 on a state change from disconnecting to disconnected.
After a discussion with the audio team, the delay returned by
this function isn't actually relevant to the A2DP state machine
so instead remove the dependency on the delay returned.

Bug: 37906688
Test: Disconnect from headset multiple times and see that it is
not stuck disconnecting.

Change-Id: I108cc5230a571edbd26fcb1f985a0b14cb7123b6
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
4981ddba0b7d0b1fb95fab66d9f38f9bc92b1bc0 30-Mar-2017 Pavlin Radoslavov <pavlin@google.com> Merge "Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()" am: 5d6dc68180 am: 7024a64f0d
am: 02de9e25ca

Change-Id: I5d07416b1014d7bba42c3f58c2672977a4804011
7aec8406176f8cef0b608c22b6e631df71ccd363 24-Feb-2017 Pavlin Radoslavov <pavlin@google.com> Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()

This API can be used to enable the optional codecs, or disable them
and use only the mandatory SBC.
Internally, it is implemented by raising the SBC priority to
highest (so SBC will be used/selected), or reducing the SBC priority
to its default value (lowest).

Test: A2DP streaming and enabling/disabling/selecting optional codecs
Bug: 35873828
Change-Id: I3f0dfc2e965e89647c03d032089dcccbd5fb8ffc
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
90ecb737f15de886ec646e66f5099d608b87d418 09-Feb-2017 Christopher Tate <ctate@google.com> Send Bt connection-state-changed broadcasts to manifest receivers

Connection-state notifications are intentionally allowed to launch apps
that have subscribed to them.

Bug 35207510

Change-Id: I8d2c9ff53f7338e3f7f43cdde9419cc29aaaab22
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
8a9f762c80d436719375de5d5f83c1c11e9f5723 02-Feb-2017 Pavlin Radoslavov <pavlin@google.com> Add a mechanism to configure the default A2DP codec priorities

Previously, the relative codec priorities were hard-codec internally.
The new mechanism uses the following configurable resources in
packages/apps/Bluetooth/res/values/config.xml to re-assign the
default codec priorities per device, or to explicitly disable a codec.

- a2dp_source_codec_priority_sbc
- a2dp_source_codec_priority_aac
- a2dp_source_codec_priority_aptx
- a2dp_source_codec_priority_aptx_hd
- a2dp_source_codec_priority_ldac

Those values are assigned on startup.
Also, they can be changed per device by using an overlay:
device/<VENDOR>/<DEVICE>/overlay/packages/apps/Bluetooth/res/values/config.xml

Test: Manually streaming to a headset
Change-Id: Ic3cf8549b46547dbeba93632c3178c6b7f2b810d
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
08d3925d3d72837e6f86c9e0beaed5f7b813ea37 26-Jan-2017 Pavlin Radoslavov <pavlin@google.com> Update the A2DP Codec Config API

Previously, the JNI upcall would contain only the current codec config.
In the new API, the upcall contains:
1. The current codec config
2. The list of codecs containing the local codecs capabilities
3. The list of codecs containing the selectable codecs capabilities.
This list is the intersection of the local codecs capabilities
and the capabilities of the paired device.

Also, refactored the Java internals to accomodate the extra information:
* Added new class BluetoothCodecStatus that contains the extra info:
current codec config, local codecs capabilities and selectable
codecs capabilities
* Renamed method getCodecConfig() to getCodecStatus() and return the
corresponding BluetoothCodecStatus object.
* Updates to class BluetoothCodecConfig:
new methods isValid(), getCodecName(), and updated toString()
so it is more user friendly
* Removed BluetoothCodecConfig.EXTRA_CODEC_CONFIG and
EXTRA_PREVIOUS_CODEC_CONFIG.
The former is superseded by BluetoothCodecStatus.EXTRA_CODEC_STATUS;
the latter is not really used.

Test: A2DP streaming with headsets and switching the codecs
Change-Id: I18536cffc5c73abc31c3d6afa54f9d3c3b1d577e
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
86c29fe88456bdcfbd4334647b04ef81ff384a06 22-Dec-2016 Sanket Agarwal <sanketa@google.com> Separate Phone Policy from mechanism

Create a new policy file which interacts using either public APIs (such
as Intents) or uses equivalent functions which are exposed by the
binder. This is an attempt to be able to separate policy such that
different devices can have different policies.

Bug: b/33079907
Test: JUnit tests
Change-Id: I6c5a7ee9eb4e10f5f649794546acde5ec4b297aa
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
33b6b7d2b08dcd7ced1809e2ac653c5e8c2514af 21-Dec-2016 Pavlin Radoslavov <pavlin@google.com> Add a mechanism for configuring the A2DP Source codecs

* Extended the Bluetooth A2DP AIDL interface to get/set the current
codec configuration

* If the current codec config is changed such that the audio feeding
parameters have changed, then inform the Audio Manager so it can
reset accordingly the audio feeding parameters in the Audio HAL to
the Bluetooth stack.

Also, fix the BT_BOND_STATE_* values (unused) in the
AbstractionLayer.java class so they match the corresponding
BT_BOND_STATE_* values in
hardware/libhardware/include/hardware/bluetooth.h

Test: A2DP streaming to headsets, TestPlans/71390
Bug: 30958229
Change-Id: Ic3e35154d9dbc32b66522322cd5d2a96bc5a977c
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
eb7b90f5b93db1230a5b64caa3d8d05a642e33a6 10-May-2016 Marie Janssen <jamuraa@google.com> Cleanup unused requires in java files

Change-Id: I7b055c1d3d3f6a69e9f49c077853ab45fcad7106
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
9135d866b12ff019a4eae37e7a8c0df56a4383f2 26-Aug-2015 Ajay Panicker <apanicke@google.com> HFP/A2DP: Remove pending auto-connect messages when connected

Fixes a bug in which being paired with multiple headsets causes
previously connected headsets to disconnect. This fix removes
pending connect attemps once one device is successfully connected.

Bug: 23111466
Change-Id: Id471189d92643b9626e63197c00e76defd0a72bf
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
391be75c27b6d36930a5645925ed7ab118fa634a 04-Sep-2013 Anubhav Gupta <anubhavg@codeaurora.org> Update UI properly in Connection race Conditions.

Broadcast connection state of incoming device in pending
state and update UI for disconnection of outgoing connection.
This change in conjunction with bluedroid change handles
race condition scenarios when incoming and outgoing A2dp
connections collides.

Bug: 22028876
Change-Id: Ibd80fc7010613887df74fb1903b16de73c77939a
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
6ddb5d5b31b3e4e21b57bbe0457692fdbcc97eba 05-Sep-2013 Anubhav Gupta <anubhavg@codeaurora.org> Move A2dp State to Disconnected when BT is Turned OFF

A2dp State gets Stuck in Connecting state If User tries to connect to
other paired device when device is already connected to one, and before
connection swap succeeds, power-cycles BT.
This change allows the state to move properly to disconnected for the
device pending connect when BT is turned off.

Change-Id: I17bc620551bf735f39327eff59102c14551bcf26

(cherry picked from commit 0ce6816d43761b838b65adbf1e636630e1047fcf)
(cherry picked from commit 51c4d0f1df682f3874915f99ef49ec5c3d9e74ed)
(cherry picked from commit 6583fca29318b3c8bc0b16d588fc939ffdde6142)
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
838949d46a4cc054985a8cfd682004f8dd6d3bbb 28-Oct-2014 Mike Lockwood <lockwood@google.com> Add dumpsys support for bluetooth

Bug: 18159457
Change-Id: I807a7d921b6e5baf111d0f0e3e182c6633a93b7c
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
c030f08f419d596c4aa216c9cca9867e7b5486f0 07-Jun-2014 Mike Lockwood <lockwood@google.com> A2DP Sink: Add support for BluetoothA2dpSink profile

Change-Id: If2c1b9b919c90e65a3808c9a55b554c0e899a9c2
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
9537b0e4648a0c197392d3276b46681523d5f0bc 29-May-2014 Mike Lockwood <lockwood@google.com> Fix arguments to AudioManager.setBluetoothA2dpDeviceConnectionState()

Change-Id: I2a9742bc2e1127f56fafed574794f81578872681
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
188f205b5f093850d4cc627917a21204be36c56a 08-Jan-2014 Zhihai Xu <zhihaixu@google.com> update play status based on A2dp audio state from stack.

this is to work around the problem:some video/audio player didn't
update the play status by calling setPlaybackState.
The headset(HBS730) register the play status update on the phone.
It will depend the play status reported from the phone to send
play or pause command.

bug:11325212
Change-Id: I7fde5960edd4a5b3474fa17456aacd5b4b432d4d
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
fe32e48d4129a3950f3a33f0ab443649b29205fb 07-Jan-2014 Zhihai Xu <zhihaixu@google.com> isA2dpPlaying() reports wrong playing state when suspended

bug:12412483
Change-Id: I1cf209479581bf28fc1ebdc462f552b8ec270520
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
522d3b2b0a69c0157ca87995d92bb712f6102c1a 28-Jan-2013 Wink Saville <wink@google.com> Add protected log methods to StateMachine

This allow child classes to Override the logging and
have consistent behavior across StateMachines.

Change-Id: I7e23a44d08ca304ade2d7830fd0e307f63f1879e
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
ede67c26e7b2564ea35db6d9b3027a269c150e13 24-Oct-2012 Zhihai Xu <zhihaixu@google.com> License of files Bluetooth package is not updated to ASL2

bug 7385618

Change-Id: I338fd87083387706f3b5f410c9592219bb8a1acb
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
fd1da115cbf09b7dd9bca3c7d3a4fb816a835dc5 08-Oct-2012 Matthew Xie <mattx@google.com> Turn off dbg messages, be prepared for production build

bug 7174712

Change-Id: I58747ec6507da8ea8ae27a182b601aaf626ede42
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
6893668d1ccf0cc6361ef31ace52fedc2e37e35a 15-Sep-2012 Wink Saville <wink@google.com> Add StateMachine make methods.

StateMachines must be started before any messages are sent to them
otherwise an exception is thrown.

Bug: 7091976
Change-Id: I05315d45d4d6db42843442b7feb37c665cfabcab
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
ca6110d57998fee7c7b572ca29061ee99a82ba37 09-Aug-2012 Ganesh Ganapathi Batta <ganeshg@broadcom.com> Implement enableNoAutoconnect() for NFC handover

Implementation of BT enable in Quiet mode without initiating auto connect and not allowing
Incoming HFP, A2DP and HID connections.

Change-Id: I857aea8d95677f8287df4641ec0aeae58a9f7a99
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
73d192095093759688cccc896714f71fcee218d8 08-Aug-2012 Matthew Xie <mattx@google.com> Merge "Fix for BT turn on/off issues: NPE, FD/thread leaks, ANR." into jb-mr1-dev
15d36984a79d6e35c659edb0efdf929f0b526bd5 01-Aug-2012 Fred <fredc@broadcom.com> Fix for BT turn on/off issues: NPE, FD/thread leaks, ANR.

This fix addresses numerous BT on/off issues found from the CTS test.
Fixed fD/pipe leak in various state machine Looper objects by calling quit() function.
Fixed cursor leak in AtPhonebook.
Change Pbap to stop the RFCOMM listener on the STATE_TURNING_OFF instead of STATE_OFF.
Removed several cleanup() methods causing NPE.
Reduced RFCOMM listener timeout from 3 seconds to 300ms between retry.
bug 6834336

Change-Id: I52423343d8f52f65294af0143f373871a9874d77
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
4f5430babbc5a8f870e5a578a4ea3452f41dd97a 01-Aug-2012 Ganesh Ganapathi Batta <ganeshg@broadcom.com> Implement Profile Auto connection logic

Implement Profile Auto connection logic (moved from Settings App )in Bluetooth APK
to avoid Auto connection not happening if the Settings App is not running
As part of this implementation following features are implemented
1. Auto connection initiation during BT on OFF
2. Profile Auto connection priority management
3. Connecting Missing profile logic
4. Initialize Profile Priorities on Bond State Change

Change-Id: I12b7c190e28f043b4b008c9b48ac7e13aaf178e6
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
15d72a0c3338645bcc409023150aec40b08aadc1 29-Jun-2012 Ravi Nagarajan <nravi@broadcom.com> Resolve incoming pairing and connection issue

When the remote side initiates pairing & connection, occassionally
connection is made before the phone has had a chance to do SDP.
In this case, the profile priorities are not initialized, which caused
us to incorrectly reject the incoming connection. Allow connection
if priority is undefined, but device is not unpaired

Change-Id: Icd8257adea19fc9a4d3853cd85da9bd791cfe505

Conflicts:

src/com/android/bluetooth/a2dp/A2dpStateMachine.java
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
10bab53713ca13b3ccdaac5286c9b576e577be5e 25-Jun-2012 Swaminatha Balaji <swbalaji@broadcom.com> Fix for When Hf is rejected the device should initiate A2dp if a2dp is enabled

Change-Id: I15d3d6c8456e94553f479009c600dca1cd2361ac
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
fe0ac5b0476b628be11c93a818f342db90332ea8 20-Jun-2012 Matthew Xie <mattx@google.com> Notify Connection state chnage to AudioManager via an API call

bug 6834913
Change-Id: I58af46710320f3debee1780aeaea7f5548233604
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
a25e9c65c2a0192b7b3d819e2b87704f1942aa2f 21-May-2012 Sreenidhi T <nidhit@broadcom.com> Changing the order of notification of connection state change, as it was causing a race condition, with the UI not being updated with the correct connection state.

Change-Id: I6f4c75e4eac4ae798cb7918a4f1b7458e1eaa4b0
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
75e9fd59f4d4011ba7155732a41b06f0df40bada 15-May-2012 Swaminatha Balaji <swbalaji@broadcom.com> Fix for A2dp/hf connection happening even when profile is disabled in Settings

Change-Id: I32145db12e0107b858e2e25ad1ae6cba6eadb55d
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
74ae04c73312403e89db0f8e9bd9601d403b4783 07-May-2012 fredc <fredc@broadcom.com> Fixed memory leak in Binder objects from repeatedly turning on/off Bluetooth

Change-Id: Ibee5382816d47b1e9b846461942a9daccc4210a7
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
b5cc776c9353a203cdde97e62b25f05d9633d14c 19-Apr-2012 fredc <fredc@broadcom.com> Fixed BT on/off issue

Change-Id: I47cbac9fc694d5604a664f20170eeed90eeee8e6

Conflicts:

jni/com_android_bluetooth_btservice_AdapterService.cpp
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
3fafe61ef25c1899fdc817c52163aec16c31055c 19-Apr-2012 Ravi Nagarajan <nravi@broadcom.com> Memory profiling changes : Updated the Bluetooth code to handle cleaning up of object references (context, handlers, and collection objects ) during service cleanup.Memory profiling changes : Updated the Bluetooth code to handle cleaning up of object references (context, handlers, and collection objects ) during service cleanup.

Change-Id: I2b0235f71c1feaf32215b2aaf89a2e06d8fa7d73
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
ac234ef0ddd67471d82f77c41535a5ea1b68b443 19-Apr-2012 Kausik Sinnaswamy <kausik@broadcom.com> Added support to handle A2DP audio state changed events and broadcast
A2dp API intents

Change-Id: I1938e5e0acbbaf602239e14e1dfd3c890712930a
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
9a0efb0ee8c63797280b3b9309782541134e9205 16-Apr-2012 fredc <fredc@broadcom.com> adapter non persistent service. Fixed null exception when profile services connect/disconnect

Change-Id: Iefafd1115471256d3107f039897e2af16077cdae
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
6654f5c903de510a70f9e72cd5ad7837b615d93f 12-Apr-2012 fredc <fredc@broadcom.com> Non persistent adapter service

Change-Id: I65e1c18e2899cea0a1e5c0102c4d24d39dce0249

Conflicts:

jni/com_android_bluetooth_hdp.cpp
jni/com_android_bluetooth_hid.cpp

Conflicts:

jni/com_android_bluetooth_hid.cpp
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
25ec7de5ff422f50f3dbfd0822423c85b47f4794 09-Apr-2012 Ravi Nagarajan <nravi@broadcom.com> Implement the getDevicesMatchingConnectionStates for A2DP

Change-Id: Icf5b14d13c4ee6564876aac529e992a22747ac41
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
6c91bc0a163cc7600c40d7fb979777fd911d1ef1 17-Feb-2012 Matthew Xie <mattx@google.com> Initial implementation of HFP and A2DP profile/service/statemachine.

Change-Id: Ic6e6d358b94313f237b7be61b70dcc6f4f7902e7
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpStateMachine.java