History log of /packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0c3e89e90ff670dd4356e9e31565e15aaea3abc9 22-May-2018 Jack He <siyuanh@google.com> PhonePolicy: Only auto connect to the last active A2DP device

* Only auto connect to the last device indicated by
BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED intent
* Ignore the intent when EXTRA_DEVICE is null since we cannot tell
if setting active device to null is due to user action or due to
device disconnection. Consider revising this policy in future
revisions of phone policy

Bug: 79995170
Test: PhonePolicyTest, connect and toggle Bluetooth
Change-Id: I0a0b34e69c6db206fcb6ca67e7edd6421a61f586
(cherry picked from commit f3bff5dcae6cd8f7571d23ed06d8d59207434f1b)
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
3cc3ca76069837340db03751e64b6df230e5d8cc 18-May-2018 Jack He <siyuanh@google.com> PhonyPolicy: Don't connect other profiles if all profiles are disconnected

* When the delayed CONNECT_OTHER_PROFILES method is triggered,
PhonePolicy should not auto connect other profiles for a device if all
profiles are disconnected for THAT device
* Remove device from retry set when all its profiles are disconnected
* Clean up retry set if all profiles are disconnected for all devices

Bug: 79938868
Test: PhonePolicyTest
Change-Id: I37b6828797dd659ac0d1cf1784e903148c1749df
(cherry picked from commit d3ed2838205aeb4087e4ab9269a73cf790f312bf)
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
d8ae37693406af4fa2633092ec9500a484933a9e 18-May-2018 Jack He <siyuanh@google.com> PhonePolicy: Stop auto connecting to devices that failed to connect

* Set priority from AUTO_CONNECT to ON when device failed to connect
as indicated by transition from CONNECTING TO DISCONNECTED state
* Set priority from AUTO_CONNECT to ON for all disconnected devices
when a device is connected

Bug: 79956685
Test: runtest -j40 bluetooth -c
com.android.bluetooth.btservice.PhonePolicyTest
Change-Id: I319ee174fa5f32630418c40f8372e30d41ae8871
(cherry picked from commit d5fcc13ca66d1eabeee0e6f9a6daeabbdc6b7573)
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
d617142a6e7567c6ae46fbbbebb58e14900cb3a1 18-May-2018 Jack He <siyuanh@google.com> PhonePolicy: Gate CONNECT_OTHER_PROFILE per device

* When A2DP or HFP is connected for a device, PhonePolicy will try to
connect to other profiles such as HFP, A2DP and PAN in case the remote
device did not connect these profiles themselves.
* De-duping this effort by checking if PhonePolicy handler already has
the CONNECT_OTHER_PROFILES message works for a single device but
won't work when multiple devices are connecting at the same time
from the remote side. Only the first connected device's connection
request with be honored and other devices' connection request might be
dropped if the first device's connection request is still in progress
* Therefore, we need to create a HashSet to gate this message per
BluetoothDevice

Bug: 79938868
Test: runtest -j40 bluetooth
Change-Id: I3865404c16b0243e610c8a94e3d32459107581a8
(cherry picked from commit a5e75bcd70bba16b7701ea5f08ac3816d82d318a)
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
09e97f4cfcca3564c8daa864ede0eee172e9d5aa 03-Mar-2018 Hansong Zhang <hsz@google.com> Hearing Aid Service with native interface

Bug: 64038649
Test: compilation and instrumentation test
Change-Id: Ic18a5dc4e28b5ecfc96c5ce7300c89b028e5887d
(cherry picked from commit bb773ae52ae2fd387a66ce03b14b63911345cd7f)
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
2bb921516fddb3947f8a3dc199d142a9690b063a 28-Feb-2018 Pavlin Radoslavov <pavlin@google.com> Don't remove auto-connect priority for A2DP connected devices

The original adjustOtherSinkPriorities() implementation has a bug
that could incorrectly reset the PRIORITY_AUTO_CONNECT for A2DP
connected device to PRIORITY_ON.
Note: the bug is specific to A2DP and does not apply to HFP.

Also, added a corresponding unit test: testSetPriorityMultipleDevices

Bug: 73902689
Test: Manual: re-connect multiple A2DP/HFP devices
Unit test:
runtest bluetooth \
--test-class com.android.bluetooth.btservice.PhonePolicyTest \
--test-method testSetPriorityMultipleDevices
Change-Id: Ieb28afef95fb83259cbff74632ea7ea7d38445dd
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
44ef48a20624b290ae614af344c802d6e749eba2 14-Feb-2018 Pavlin Radoslavov <pavlin@google.com> Update PhonePolicy to support Multi-A2DP/Multi-HFP

Remove checks for A2DP and HFP that prevent auto-connecting a profile to
a second device if there is already a connected device for this profile.

Test: Manual with specific headset models
Added unit test:
runtest bluetooth \
--test-class com.android.bluetooth.btservice.PhonePolicyTest \
--test-method testAutoConnectMultipleDevices
Bug: 72125048
Change-Id: I3017f5c99609516d3483800f2e72b56ea857d37c
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
928f14463ee51192039abef856495ecce418fe01 03-Nov-2017 Jack He <siyuanh@google.com> Fix PhonePolicyTest timeout

* PhonePolicyTest used to run too long (26 seconds plus) because it
needs to wait for the reconnect timeout
* This CL fixes the test by
1) Moving common setup code into setUp() method
2) Using TestLooperManager to manually execute delayed handler
messages immediately after they are posted

Bug: 68818803
Test: runtest -i -j40 bluetooth; adb shell am instrument -w -e
timeout_msec 300000 -e class
'com.android.bluetooth.btservice.PhonePolicyTest'
'com.android.bluetooth.tests/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I4789e3427e1a5729be6f620d39da539f76767e57
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
f0429c92669aa388785a97f00985d63a83e509c2 26-Oct-2017 Hansong Zhang <hsz@google.com> Rename Bluetooth HID Service

Rename the Bluetooth HID Host and Device Service to make them more
clear. Also change the corresponding name for jni and config values.

Service:
HidService -> HidHostService
HidDevService -> HidDeviceService

JNI:
com_android_bluetooth_hid -> com_android_bluetooth_hid_host
com_android_bluetooth_hidd -> com_android_bluetooth_hid_device

res/values/config.xml:
profile_supported_hid -> profile_supported_hid_host
profile_supported_hidd -> profile_supported_hid_device

Test: with devices using HID Service.
Bug: 68055651

Change-Id: I8b51a923a31fb3baab599537c942d933f859b41f
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.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/btservice/PhonePolicy.java
0612fada88b00a9896feeb9e7a16d5e3e41114f2 10-Oct-2017 Jack He <siyuanh@google.com> [Script] Replace C-style array declarations with Java style

* Type a[] should be replaced with Type[] a;
* This is achieve through running automatic code cleanup in Intellij
using "C-style array declaration" inspection

Bug: 63597465
Test: make checkbuild, no manual changes, no functional changes
Change-Id: Ie5507e392b6714c3269f25fd31f85b2bcc4dc6e9
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.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/btservice/PhonePolicy.java
2cc754651ee7245e62fa247b1ca85acb6889e79e 22-Sep-2017 Jack He <siyuanh@google.com> PhonePolicy: Retry HFP and A2DP once only

* Limit HFP and A2DP profile retries to once only

Bug: 32998946
Test: build, pair and connect with headset and car kit
Change-Id: I1c1ec48bbbbe8d97664eca81aac8267e3659a6fc
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
d94f6ddab1f088340d197086949409c144ec2b0a 22-Sep-2017 Jack He <siyuanh@google.com> PhonePolicy: Logging and logic refactor

* Do not log arrays by reference
* Do not log intent by reference

Bug: 32998946
Test: make, no functional change
Change-Id: If1d20c1d7ff221a27b0b516a37c919d192efb363
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
eb2e34735003388606ff66988634d012049cdcd0 12-Sep-2017 xutianguo <xutianguo@xiaomi.com> Fix potenial NPE in PhonePolicy

NPE might happen in PhonePolicy since HeadsetService could be null.

Bug: NA
Test: Connect Bluetooth devices and check A2DP/HeadSet profiles

Change-Id: Ib90147b407bc80675ba027f4c6cac94ae39a1d7b
Signed-off-by: xutianguo <xutianguo@xiaomi.com>
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.java
0068bdad22ffd70c90de67b6e85c8a0dfa838d90 24-Jan-2017 Sanket Agarwal <sanketa@google.com> Ignore ACTION_UUID intent when no uuids present

When no uuids are present, parsing UUIDs throws NPE in PhonePolicy

Bug: b/34640345
Test: Manual test by trying various devices. Follow up unit tests
required

Change-Id: Ibe54ea7b62b644ba1d92ef4f1d850c09113875af
/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/PhonePolicy.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/btservice/PhonePolicy.java