History log of /frameworks/base/core/java/android/server/BluetoothService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1a1be44c5bf1e6099d678c81ef5e9326cabcb3df 01-Dec-2011 Matthew Xie <mattx@google.com> Merge "Unlink the Binder DeathRecipient when removing a Bluetooth service record" into ics-mr1
c980a495a6d357219a9e0860129ae6bb6d541843 16-Nov-2011 Jason Simmons <jsimmons@google.com> Unlink the Binder DeathRecipient when removing a Bluetooth service record

The fix holds a reference to the Reaper objects, so that they don't get GCed
and cause the error - unlink not called on death recipients.
bug 5602314

Change-Id: Ib8a9e254d7c9ebe9d54f5c10b3daa31d062b4df0
/frameworks/base/core/java/android/server/BluetoothService.java
9bb275197df8eb999eab4cdd0a2aff83c2bb2ef6 28-Nov-2011 Jaikumar Ganesh <jaikumar@google.com> Cleanup references when turning BT off.

Bug: 5572649
Change-Id: I62f9e0620832b69995d5c6e1c24634c9a3895a4b
/frameworks/base/core/java/android/server/BluetoothService.java
2b9af44e401d884469869a4ac0933bfa727d3135 17-Nov-2011 Matthew Xie <mattx@google.com> am 6da97a24: Merge "Check the bluetooth state for getUuid call" into ics-mr0

* commit '6da97a24e329851888890d4e380066037d08bcd7':
Check the bluetooth state for getUuid call
44b58ab89e59b3d8241901232c8f7dc9617b206e 16-Nov-2011 Matthew Xie <mattx@google.com> Check the bluetooth state for getUuid call

Donnot make the bluetoothservice.getUuids call if the bluetooth
is not on. Also get rid of all the necessary locks on BluetoothService
for get property call. It had a lock on BluetoothAdapterProperty.
bug5472114

Change-Id: I383472ae6006fc1f0129c960c8a44ed0df027a43
/frameworks/base/core/java/android/server/BluetoothService.java
98f06da8ed2851a768358de1979838ad1bb6d187 10-Nov-2011 Matthew Xie <mattx@google.com> Send CONNECT_OTHER_PROFILE to Device profile for hfp and a2dp incoming connect

Send CONNECT_OTHER_PROFILE to Device profile for low priority hfp and a2dp
incoming connect. In the case when HFP autoconnect is off but a2dp autoconnect
is on, if HF autoconnect to HFP, phone will reject HFP but connect a2dp.
Before this fix, phone reject HFP. A2dp will not get connected unless the HF do
media auto-connect, which most carkits do not do.
Also do similar change for incoming a2dp connection
bug 5091838

Change-Id: Ife1815f527bcd94e0d9ffc645028484fa9c49a43
/frameworks/base/core/java/android/server/BluetoothService.java
9de1feb673499519cb380a142ba1e453109480bd 03-Oct-2011 Matthew Xie <mattx@google.com> Send TURN_HOT message to the state machine from BluetoothService after it starts

All the messages sent to the StateMachine were ignored before the StateMachine
starts. To avoid TURN_HOT message from being ignored, move it out to BluetoothService
to send to the BluetoothAdapterStateMachine after the state machine starts
bug 5333923

Change-Id: I14ccd6dd7e6430aad2bca9230d01578b5327cc3f
/frameworks/base/core/java/android/server/BluetoothService.java
dcbc97fc28f4eb5910acc11dfac5efcd597c737d 17-Sep-2011 Matthew Xie <mattx@google.com> Check null of pidPair to skip the case the service record has been removed

Check null of pidPair instead of pidPair.first which caused a nullpointer
exception. clean local variables after sending out STATE_OFF intent.
Check bluetooth state in removeServiceRecord.
bug 5330367

Change-Id: Ib0af8143223bea48d3f587cca18544c4aef29980
/frameworks/base/core/java/android/server/BluetoothService.java
f1754050ceaadb4603aaaa0b1f0b193a305834af 14-Sep-2011 Matthew Xie <mattx@google.com> Keep Binder reference in the mServiceRecordToPid hashmap

so that the Binder object does not get destroyed when the thread
that registers the service record ends.
bug 5276332

Change-Id: Id17a4c279e03aa6928dca5bf048c7c90862bd9cf
/frameworks/base/core/java/android/server/BluetoothService.java
6d172e60bb5c7dcaf1558e875bfbfe8cfe24b073 10-Sep-2011 Jaikumar Ganesh <jaikumar@google.com> Merge "Add error codes for channel disconnection / connection."
5d61d8ddec486645c9e851dcc7583cabef50c851 09-Sep-2011 Matthew Xie <mattx@google.com> Merge "Apply timeout for powerdown event and reset state machine when bluez crashes"
b5d2d4526cd2c0117b7a33b1297ac683c37ac5c7 07-Sep-2011 Jaikumar Ganesh <jaikumar@google.com> Add error codes for channel disconnection / connection.

Channel connection / disconnection was handled as boolean,
doesn't capture all the values. Also make it asynchronous
instead of the dbus call being synchronous.

Change-Id: If30177b9f93b7c83f162fbbc1233edf3e46dbfea
/frameworks/base/core/java/android/server/BluetoothService.java
eb9d34630f74d0260690287f2df57c0cd3d7ba1d 01-Sep-2011 Jaikumar Ganesh <jaikumar@google.com> Make Bluetooth Health APIs public.

Fix a few bugs:
a) Pass a integer token to identify the channel.
b) Close fds in case of errors.

Change-Id: I2046787be5008769435f2f72a5bd67c19b749da0
/frameworks/base/core/java/android/server/BluetoothService.java
694c0b833b4235b396ec1b798610d617d0ec7b5c 08-Sep-2011 Matthew Xie <mattx@google.com> Apply timeout for powerdown event and reset state machine when bluez crashes

The powerdown event was missed some time for unknown reasons and bluez could
crash for unknown reasons. We will debug on the issue. But for the time
being, we add a powerdown timer and process power up event to recover from
bluez crash
bug 5239719

Change-Id: Ie7315fb01e029747951e1a97a2d2f1dce53a997b
/frameworks/base/core/java/android/server/BluetoothService.java
484867a8ed3d46fbb8df493c77f2e2d46a0db654 26-Aug-2011 Matthew Xie <mattx@google.com> Move Bluetooth remove service record handler to the app main thread

Move Bluetooth remove service record handler to the app main thread.
This removes the dependency of caller thread that constructs the
BluetoothAdapter singleton instance. The caller thread could stop while
BluetoothAdapter singleton exists but lose the handler context.
Make the BluetoothService.removeServiceRecord return quickly without
blocking on native call.
bug 4999443

Change-Id: I302534baa381f4aca8192e1e4a9ea21793b07ba6
/frameworks/base/core/java/android/server/BluetoothService.java
f9838d0bb961d5464a92819107747237ea1d923c 23-Aug-2011 Matthew Xie <mattx@google.com> Merge "Set bluetooth discoverable off at power on time if the timeout is no forever"
d96daf1ae5f314ea5f56b3e0b465e3f3b0314235 23-Aug-2011 Matthew Xie <mattx@google.com> Set bluetooth discoverable off at power on time if the timeout is no forever

Set bluetooth discoverable off at power on time if the discoverable timeout
is no forever
bug 5068151

Change-Id: I413e8de5f49030b741a8b84a566065d112ee60be
/frameworks/base/core/java/android/server/BluetoothService.java
cb1d354c1e9b458a0426cd08520d938012e32b34 19-Aug-2011 Jaikumar Ganesh <jaikumar@google.com> Add Api to get profile connection state.

This gets the current connection state of the profile with respect
to the local Bluetooth adapter.

Change-Id: I7cff6c9201d29a8b45413cff7384b7483f21bd5c
/frameworks/base/core/java/android/server/BluetoothService.java
14e48e91f6def5448db9994cb13ddcdc676cba53 15-Aug-2011 Matthew Xie <mattx@google.com> Implement switchConnectable with Powered property setting instead of scan modes

Bluez powered property setting is more apropriate for what this method intend to
achieve and it fixes a bug that incoming connection request wake up the stack in
The pairable events are replaced by power and discoverable events
HotOff state
bug 5080232

Change-Id: I43b44cb2f5203bd99bf764d5a1696e8ff52a31db
/frameworks/base/core/java/android/server/BluetoothService.java
24c2d6bc8265b7524b1c8cbf2234c9f2f4667cc1 11-Aug-2011 Matthew Xie <mattx@google.com> Merge "Revert "Implement switchConnectable with Powered property setting instead of scan modes""
10fc9bc55ef26e7e61db47986d559889668ae55e 11-Aug-2011 Matthew Xie <mattx@google.com> Revert "Implement switchConnectable with Powered property setting instead of scan modes"

This reverts commit c5708036b47c474ad3a01dacc3c3940e087d6e27
/frameworks/base/core/java/android/server/BluetoothService.java
06ec66266cc31b905647472d1f5cdb296f9e5365 09-Aug-2011 Matthew Xie <mattx@google.com> Merge "Implement switchConnectable with Powered property setting instead of scan modes"
c5708036b47c474ad3a01dacc3c3940e087d6e27 05-Aug-2011 Matthew Xie <mattx@google.com> Implement switchConnectable with Powered property setting instead of scan modes

Bluez powered property setting is more apropriate for what this method intend to
achieve and it fixes a bug that incoming connection request wake up the stack in
HotOff state
bug 5080232

Change-Id: I1e29314041f082c1536b46f9707d17d463ae0fd7
/frameworks/base/core/java/android/server/BluetoothService.java
a66590ed78d0ec8e837dab80a4376a10d7023e9a 05-Aug-2011 Jaikumar Ganesh <jaikumar@google.com> Provide address and name in BT Hot off state.

Clients need this before BT is turned on.
Todo: If BT "hot" feature is off, read from system properties.

Change-Id: I266c2d4731cacde7a53c65e3d5fb43a2cbe29481
/frameworks/base/core/java/android/server/BluetoothService.java
f5fb6c8ce36a98da47f32f4142d372bd5f650bfa 03-Aug-2011 Jaikumar Ganesh <jaikumar@google.com> Enforce permission for changeApplicationState function.

The ADMIN permission is for use cases where we want to manage BT connection
at a deeper level. So just the Bluetooth permission is good enough here.

Change-Id: Iddd038fe9f9a26f155b4edc9484ba1fe27b178ba
/frameworks/base/core/java/android/server/BluetoothService.java
4376b7f2d7bc092b9f41d6e05f245ff1be3bcc8d 03-Aug-2011 Matthew Xie <mattx@google.com> Merge "Move mBluetoothService.runBluetooth after broadcasting the STATE_ON intent."
8594394aadeaaa3f834d33d7b198fb071e0f31fe 30-Jul-2011 Matthew Xie <mattx@google.com> Move mBluetoothService.runBluetooth after broadcasting the STATE_ON intent.

This is because broadcastState method move the Bluetooth adapter state
to ON. The mBluetoothService.runBluetooth should be called only in the ON state.
Remove mIsDiscovering variable in BluetoothService.
Fix a bug in BluetoothA2dpService that caused 2 times of state change
from DISCONNECTED to CONNECTING that messed up BluetoothService's
connection state count.
Change-Id: Ifb782a845ae70f007d2e036d930bb55f445d68b5
/frameworks/base/core/java/android/server/BluetoothService.java
bbd86750570ff75e428b3810dc2e65db558c14b2 02-Aug-2011 Jaikumar Ganesh <jaikumar@google.com> Fix tethering using BT.

1. Since Input device runs in Bluetooth Service, avoid the proxy call.
2. Accept or reject incoming tethering connections.

This broke because of incoming connection request change for phonebook, HID,
A2DP.
Change-Id: Ia8c537bb79e4dbc66cfb6b23dcad4f99dbf950b3
/frameworks/base/core/java/android/server/BluetoothService.java
6903a7de88e32e04965f41f1cf6371d855cdfa88 29-Jul-2011 Matthew Xie <mattx@google.com> Merge "Provide an API to set the friendly name of a remote device."
269e81a563cfe080d7f241d0d46411d3c946c111 27-Jul-2011 Matthew Xie <mattx@google.com> Provide an API to set the friendly name of a remote device.

BluetoothDevice setName overwrite the locally cached remote name.
The changed name is saved in the local storage so that the change
is preserved over power cycle.
bug 5081605
Change-Id: I486966033828d153bfb1076a99e274c8a7f41636
/frameworks/base/core/java/android/server/BluetoothService.java
ef2cb7c93a99096799d415e721dda46d1bf7a005 22-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Add ability to turn BT on / off on a per application basis.

This changes adds an API for system applications
to enable bluetooth without all the side effects like
auto connection to headsets etc.

Also some tweaks to the adapter state machine

Change-Id: Ib9f22d548a26d72334b300101c8eb0d80f08a4bb
/frameworks/base/core/java/android/server/BluetoothService.java
184dd03c81e924f610cf88dae266f2e5629b114d 25-Jul-2011 Matthew Xie <mattx@google.com> Merge "Keep Bluetooth module hot to quickly swith it on/off"
7f9ecca8f2dc288f785b37d2478e89b80fc3cefc 15-Jul-2011 Matthew Xie <mattx@google.com> Keep Bluetooth module hot to quickly swith it on/off

Add BluetoothAdapterStateMachine to maintain a inter state machine other than
the public BluetoothAdapter states. This is a improvement to BluetoothService
code. 2 internal state are added, LoadingFirmware and FirmwareLoaded to place
the Bluetooth module in a ready-to-switch-on state so that it can be quickly
switched on to have a better user experience
bug 5021787

Change-Id: Ia352e88cba509d9e98c900f85e7479f8cee1de5e
/frameworks/base/core/java/android/server/BluetoothService.java
1352531dc73667bbfd9fa9fcf6db47101e56133c 22-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Merge "Auto Pairing tweaks."
8adcacbf83697d1299812f5365380b097898567a 21-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Auto Pairing tweaks.

When the stack returns an incorrect error code, we were going on
in a loop trying auto pairing. Ideally, the stack shouldn't be returning
this incorrect code, but add a fail safe in the userspace code.

Also cap attempts at 2. There is no point trying more than that.

Change-Id: I5bf3ea871b9c2241ae5ac88e9818c9eb847fac92
/frameworks/base/core/java/android/server/BluetoothService.java
d3728cb32fbd0a85bc77f4bcbdfea386ede2c75f 20-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Incoming connection dialog tweaks.

Don't show incoming connection dialog when the device shows
the pairing dialog - this means that the device has already been
trusted by the user.

Change-Id: I98a9f56528f6b62d0f824bbc7612aaa0077ba1e6
/frameworks/base/core/java/android/server/BluetoothService.java
60b4d2a2bd232a7116fd037501cac704f328c0a1 12-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Add REGISTERED_BEFORE_BOOT flag to intent.

Add the flag to Connection state changed intent because
external devices can get connected before booting is complete.

Change-Id: I5bed7a4aa75a42d6facc16aac4f2734e4b5fe246
/frameworks/base/core/java/android/server/BluetoothService.java
5623b074977d55a61f29099f44670916c6282e51 11-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Merge "Bluetooth Health APIs"
fb658c72a3a76dac334c39070d1501a2575c1069 07-Jul-2011 Jaikumar Ganesh <jaikumar@google.com> Bluetooth Health APIs

1. Remove the check of configs in BluetoothHealth.
This check is useless since BluetoothHealth is a proxy.

2. Add a wrapper and a callback class. We shouldn't expose
Binder interfaces as public APIs.

Change-Id: If62620b4251cf93f3f97d2fe63099e40fae7da4d
/frameworks/base/core/java/android/server/BluetoothService.java
a0c680393f2dd03a937c598b2cb9abf98a58152c 26-Jun-2011 Matthew Xie <mattx@google.com> Incoming Bluetooth Connection requests - dialog.

This sends the intents to the Settings app to show
the dialogs for the incoming connection requests.
Includes down merged contributions from Jaikumar Ganesh.

Change-Id: Ic8b857aad3554315aae39a0e871eb94d0ac98a91
/frameworks/base/core/java/android/server/BluetoothService.java
3e65551028916ddd76fbade60d7b0db738f371e5 29-Jun-2011 Matthew Xie <mattx@google.com> Merge "Method setBondState passes its parameter reason to mBondState.setBondState."
c73dd732c962238330cc2e5538a88bffbbb40fe8 28-Jun-2011 Jaikumar Ganesh <jaikumar@google.com> Fix crash while device is pairing / unpairing.

When there are no paired devices, pairing a new device
will cause a crash since the profile proxies will be null.

Change-Id: Ie1a9fd198e46d7e9cc2ba1b2f3a806b3c709f568
/frameworks/base/core/java/android/server/BluetoothService.java
2ea1e85dcb57d17f5782dbafa1d25eb51c630e4b 02-Apr-2011 Jaikumar Ganesh <jaikumar@google.com> Implement APIs for Bluetooth Health profile.

This first patch implements all the APIs.
The APIs wil be made public soon. The data specification
API will be submited in another patchset.
Change-Id: I2462683b7e07380e2c42474b0036b34d03b4bed1
/frameworks/base/core/java/android/server/BluetoothService.java
337b27985a3c5b3756bef5b46bd7c78a663d8931 21-Jun-2011 Jaikumar Ganesh <jaikumar@google.com> Merge "Fix failure of Opp."
421f0101087bbede1152ccc6d8212f6686a10e54 06-Jun-2011 Jaikumar Ganesh <jaikumar@google.com> Fix failure of Opp.

Needed due to upgrade of the Bluez stack, we can now
depend on just called createDevice.

Change-Id: I9c547d2ca3ee275365a22447641199eeaf807eac
/frameworks/base/core/java/android/server/BluetoothService.java
f8789167e903b637b1dbe8f710e7c66c4cfd74fd 26-May-2011 Jaikumar Ganesh <jaikumar@google.com> Refactor Bluetooth Profile.

Move connect / disconnect / set and get priority
functions down the interface as they are not generic enough
for all profiles.

Change-Id: I2656e1bdbc8046c53bb0dfbd9172f5f10b57aa7d
/frameworks/base/core/java/android/server/BluetoothService.java
35bfcbb9abdd61feb9cbfad0624680e594f0b772 22-May-2011 Jaikumar Ganesh <jaikumarg@android.com> am e2271a55: am d7030e55: am 198ed3e4: Merge "BT: Wrong publishing result of bonding error code."

* commit 'e2271a55ad67f766a6a47239d1a3f7319a1e7b2e':
BT: Wrong publishing result of bonding error code.
e2271a55ad67f766a6a47239d1a3f7319a1e7b2e 20-May-2011 Jaikumar Ganesh <jaikumarg@android.com> am d7030e55: am 198ed3e4: Merge "BT: Wrong publishing result of bonding error code."

* commit 'd7030e551aa99ed9f533d46de5f3443ceb4c5703':
BT: Wrong publishing result of bonding error code.
6003fe9af08b134485ebac61ee312528325f6c3c 08-Apr-2011 Jaikumar Ganesh <jaikumar@google.com> Improve locking granularity for PAN and Input.

Long term, all this needs to be converted to a state machine.

Change-Id: I757a04994cd04e490a632b433e62b00a23880638
/frameworks/base/core/java/android/server/BluetoothService.java
68f840a32845b86ff7f23eefbc1ce930c8e36c6a 14-Apr-2011 Matthew Xie <mattx@google.com> Method setBondState passes its parameter reason to mBondState.setBondState.

The bonding failure status was dropped by function setBondState.
Fix the problem by passing funtion parameter reason to mBondState.setBondState.
Bug 3162947

Change-Id: I515af34dd04000dfc6ab44453594082136869460
/frameworks/base/core/java/android/server/BluetoothService.java
ae5fbb0b4363a2a399e92e310777d7a955a25370 23-Feb-2011 Arek Lichwa <arkadiusz.lichwa@tieto.com> BT: Wrong publishing result of bonding error code.

During bonding bluez stack publish the error code over dbus.
JNI gets the error, in this ER case:
org.bluez.Error.AuthenticationFailed (Authentication Failed),
and then wrong call to overloaded setBondState() is made on
callstack using default result code parameter as 0 (BOND_SUCCESS).

Change-Id: I6f743cedc76e63d0c2a35e89d3aa48267b89c06e
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
/frameworks/base/core/java/android/server/BluetoothService.java
cc2c06656ceafbcd91ec5b679aa6c9eae0d9982c 25-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Unset device trust state before unpairing.

a) Device is trusted.
b) Device is unpaired.
c) We need to set the trusted value before unpairing.

Else on the next pairing, the device will be trusted automatically
and we will not show the PBAP authentication dialog.

Change-Id: I8d7c962688885885d37be341e5494069294eb392
/frameworks/base/core/java/android/server/BluetoothService.java
9a62c9cd6585656f4e29ba971b1f88a510d674bd 09-Dec-2010 Jake Hamby <jhamby@google.com> Refactor android.server.BluetoothService classes.

Several cleanups to BluetoothService:
- Move BluetoothService.BondState inner class to top level.
- Extract adapter and remote device properties cache management
logic into two new classes: BluetoothAdapterProperties and
BluetoothDeviceProperties.
- Add getter methods for other classes in the package to access
the new properties cache objects for multi-part operations.
- Inline log() method in BluetoothService and selected the
appropriate Log method (Log.d, Log.w, Log.e) for each message.
- Refactor dump() method into smaller sized pieces.
- Clean up logic of updateCountersAndCheckForConnectionStateChange()
method for better readability.
- Change sendConnectionStateChange() to return instead of sending
an intent if the current or previous state values are invalid.
Previously the code sent an intent with -1 for the invalid state.
- Added Javadoc comments to document the methods that are called from
native Bluez code.
- Fixed some typos and code style issues.

Original Change by: Jake Hamby
Modified by: Jaikumar Ganesh

Change-Id: I76ebac00ecd29566dcb2d1ad3e7a486b7530ce24
/frameworks/base/core/java/android/server/BluetoothService.java
74ef1199459629c5dd9f272f8cd706d82cdfeeb1 23-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Make BluetoothPan inherit from BluetoothProfile.

Change-Id: Ibd3e24e391be93ebe2cf975bd075efb68e10c1ff
/frameworks/base/core/java/android/server/BluetoothService.java
4ab0e7746fe74a9e4d75d374f73b7af87420b2f6 18-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Make BluetoothInputDevice inherit from BluetoothProfile.

This makes it in sync with BluetoothHeadset and BluetoothA2dp profiles.

Change-Id: I3ddb1d18b04aacb173b7bc376bca21c277a6afe4
/frameworks/base/core/java/android/server/BluetoothService.java
9efb1343a018c479ff57d70e8058658faa8a926d 12-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Fix ANR in Settings and Phone app.

When we have a lot of devices paired and try to enable bluetooth,
loadBondState will take a some time. During this all UUIDs would
have been registered and we would send out the Bluetooth On intent.
When Settings apps or phone app gets the Bluetooth On intent, they
try to initialize state. However, the enable Thread in Bluetooth Service
is still initializing internal state in loadBondState leading to
ANRs and deadlocks. So register SDP records as the last step of enable Thread.

Change-Id: Iaa0a773e31b9d269f4c56c4f975a0e2973e02d6e
/frameworks/base/core/java/android/server/BluetoothService.java
30b8cbe059b9addff643242e8a1fc86ca72ba54e 12-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Refactor Input profile operations from Bluetooth Service.

Change-Id: I818b0c7056fd43c7303c95150d8001dfc434e5e7
/frameworks/base/core/java/android/server/BluetoothService.java
a8571f15c39da2b7c6e672fef26106f5ac60dea0 12-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Remove Bluetooth Pan operations from Bluetooth Service.

Change-Id: I4dfe14ce04ec357a952b577d452da2257165fc6f
/frameworks/base/core/java/android/server/BluetoothService.java
a44a1e77ef435942b2ff60e9e60d3a64b43d775b 11-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Distinguish between NAP and PAN role disconnections

Distinguish between NAP and PANU disconnect in BT tethering
and call appropriate functions. We were never disconnecting
NAP role devices.

ToDo: BluetoothService needs to be refactored, its become too big
1) BluetoothAdapter and BluetoothDevice properties need to be moved to separate
classes.
2) BluetoothPanProfile and BluetoothInputDeviceProfile which are handled
by BluetoothService need to be moved to a separate file.
3) Integrate PAN to the profile state machine.

Change-Id: I32a8d274f38c78931434bd9738c8f6570ba89fcf
/frameworks/base/core/java/android/server/BluetoothService.java
b979f79158f9c470fa09ff3b96d72db274262201 12-Feb-2011 Robert Greenwalt <rgreenwalt@google.com> Remove more use of netmask

bug:2542681
Change-Id: Ifd75672739ee8262d4df22afd8173e4f3f67260d
/frameworks/base/core/java/android/server/BluetoothService.java
b3c4efc22dec106c8c888e9a74edcb71b8702daa 04-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Merge "Wait till SDP records are registered before sending intent."
50b40cec9c43eeeb9389ba2a99bcffd160246132 02-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Wait till SDP records are registered before sending intent.

Wait till all SDP records are registered, before sending STATE_ON intent.
This would fix crashes in Settings app when the profile manager
is not registered.
Problem:
We were sending Bluetooth State on intent before we got the uuid state
change intent from Bluez, which is asynchronous.
Hence when the Settings app queries for the profiles
to decide if headset profile was registered it would get false and
the profile manager would be null causing crashes.
This was not 100 % reproducible, well because it was a race condition.

Change-Id: I791eb63dfbc78aba4c06fd8db933069cb5fde00d
/frameworks/base/core/java/android/server/BluetoothService.java
f8d40f0d55fdf7046b013cc7d74a4cd199484f7a 03-Feb-2011 Robert Greenwalt <rgreenwalt@google.com> Merge "Bind addr and prefixLength together in LinkAddress"
fbb238db719cbae98afcb897f509b02edf58b062 01-Feb-2011 Jaikumar Ganesh <jaikumar@google.com> Remove discoverable timeout handler.

This is leftover code from bluez3 days. We get a property change
in Bluez4 and an intent is sent.

Change-Id: Iba8821ef73edf08add590ef9d11074b59fec2d50
/frameworks/base/core/java/android/server/BluetoothService.java
ed1264093234b1f1354cd5f669eb82a50bb56869 29-Jan-2011 Robert Greenwalt <rgreenwalt@google.com> Bind addr and prefixLength together in LinkAddress

bug:2542681
Change-Id: I90200446216d78c676498144946832afe75efdb8
/frameworks/base/core/java/android/server/BluetoothService.java
6312927254dcfe4b9e1a046286ed4e86694bc659 27-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> am e97c0188: am 55271a79: Merge "Disable PBAP for no voice capability" into honeycomb

* commit 'e97c01888fcc94453041eb6adc575598d744b580':
Disable PBAP for no voice capability
67a8b8eaa15013c6af9b66a839c9920a8c8f1d9a 26-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> Disable PBAP for no voice capability

PBAP is contact transfer to cars and headsets.
This is closely tied to handsfree profile.
Without calling functionality it was of practically no use.
It will just confuse users when they see a "Dial" button
on their car systems.

Bug: 3395362
Change-Id: I4e4597f0e4b371f69ed7af95d73893554e3fb8ac
/frameworks/base/core/java/android/server/BluetoothService.java
55b6b862c84d040ad92c5c0086954f3a7a8cd048 25-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> Do Not Merge. Don't connect to non keyboard HID devices.

Bug: 3385950
Change-Id: I2cfb17467c3d2fd383747111cd990d39f10f5136
/frameworks/base/core/java/android/server/BluetoothService.java
d1287f5ef091bd41ec902d6a83284db21a4dcabb 14-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> Fix bug in handling connect/disconnect multiple devices.

Multiple HID devices can be connected. There is no pointing
maintaining the global state. Check individual device state.

Bug: 3350904

Change-Id: I03d9a6015e39e4f9d7f68cc8bbdb19731129b4e6
/frameworks/base/core/java/android/server/BluetoothService.java
f487d72215421a02e5a1b2fbff4618bc5ee185cb 12-Jan-2011 Jaikumar Ganesh <jaikumar@google.com> Add ability to parse keyboard fixed pin auto pair blacklist.

Try auto pairing with such keyboards.
Also fix bug where dynamic auto pairing file was not being created.

Change-Id: I93afb96fee8bc4f245f96ec5961979c620de7948
/frameworks/base/core/java/android/server/BluetoothService.java
057898a9b5d50e0d8eed52bdaa74a5f17bf85c1a 22-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Enable Bluetooth reverse tethering.

Change-Id: I84a508b64f18a1445b8ac424f2a36d56ef432375
/frameworks/base/core/java/android/server/BluetoothService.java
b9fbc9e92fe1b1f823c8536d7489b82e827781b1 22-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Fix parameter to Pan Device Call.

Change-Id: I659e47feb56b052c61b7ee5521ffb5be71ce04c2
/frameworks/base/core/java/android/server/BluetoothService.java
5200c8ab721b56025340306bdecca651e6bf2f12 14-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Add EXTRA_LOCAL_ROLE to Pan State change intent.

This will help apps distinguish between reverse and normal tethering.

Change-Id: I5327ad75dc2cbf478e4f7c2cd6ef1dbe8fba9e93
/frameworks/base/core/java/android/server/BluetoothService.java
b7ec3e10194084e2a198602e20589c5bdecbda37 17-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Fix PANU - Bluetooth tethering - JNI calls.

Change-Id: Ia0b37a03e65be6632cc0bb8f1a98f268d42c9d87
/frameworks/base/core/java/android/server/BluetoothService.java
81d5ad515a9379432b2907aa9bcc830303202c84 16-Dec-2010 Robert Greenwalt <rgreenwalt@google.com> Fix Bluetooth-tethering config of interface.

bug:3288692
Change-Id: Id7f1b680392f938000953157716bf9a8f8a66af9
/frameworks/base/core/java/android/server/BluetoothService.java
04808c294027f8bc318643a94c85a999257d7f52 14-Dec-2010 Robert Greenwalt <rgreenwalt@google.com> Fix some IpV4-only code.

InterfaceConfiguration changed to use InetAddress and stop with the string->int->string
conversions.

bug:2542681
Change-Id: I11c4954547333c43bb840fa0469ddde57b0d043b
/frameworks/base/core/java/android/server/BluetoothService.java
2d1fc4e3f5eb612f9ef8a50080310ced1dfaaadf 14-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Remove delay with auto connection.

SDP records are now registered with a dbus call so we don't have to wait
for initiating auto connections.

Also reduce time to connect other profiles case by 2 secs.

Change-Id: I8f0eab6a95d3bfaf11a8eb7495a024949639d7fc
/frameworks/base/core/java/android/server/BluetoothService.java
84690c88f37f395094147d27ace8319a2803a522 10-Dec-2010 Jaikumar Ganesh <jaikumar@google.com> Add direct calls to Bluez to add SDP records.

This helps Settings app to enable just the Headset service.

Change-Id: Ia9c39467df1e83d665e377313e16e6c54991f6d6
/frameworks/base/core/java/android/server/BluetoothService.java
58b93c36409c7fb91a644605f004b6d247d9b540 24-Nov-2010 Jaikumar Ganesh <jaikumar@google.com> Update BT code for voice capability cases.

1. Disable PBAP and Headset / Handsfree records.
2. Add API to query for local adapter UUIDs.

Change-Id: Ic84ba6a49738adc89a8695d3a4890f08562e0621
/frameworks/base/core/java/android/server/BluetoothService.java
bb0773fac888c6748cbf778ab5c99c7d0a2c1309 12-Nov-2010 Jaikumar Ganesh <jaikumar@google.com> Fix crash in dump function.

Change-Id: I5a4cd7cf3fd325ced5d05f036c191f759dee16e0
/frameworks/base/core/java/android/server/BluetoothService.java
7a0f816916abb200d9337a5afde5d6d2a637a20a 01-Nov-2010 Jaikumar Ganesh <jaikumar@google.com> Disconnect PAN and Input devices on BT disable.

Also, add a missing break.

Change-Id: I228f80a4223de20e60d2f3828e3f63bdc14f5afc
/frameworks/base/core/java/android/server/BluetoothService.java
c53cab20b225ba69057441ecb06db6478ab8ff9b 27-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Add an API call to get the ConnectionState of the Bluetooth Adapter.

Change-Id: Icd87d7720189034946aaa98e1a6c5d03ef4219e5
/frameworks/base/core/java/android/server/BluetoothService.java
a46f2fb152355fe591f9dddeb41f01fef5ccad1d 21-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Implement ACTION_CONNECTION_STATE_CHANGED intent.

Change-Id: I6b5783c189c9796ebd85d9d54bdcb07949bef27e
/frameworks/base/core/java/android/server/BluetoothService.java
5a1e4cf83f5be1b5d79e2643fa791aa269b6a4bc 19-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Update BT APIs return type from Set to List.

Change-Id: Ia27220dd26cde13007f6938c830517ee7f6968ce
/frameworks/base/core/java/android/server/BluetoothService.java
7d0548d0944e48421857de4aec2822ced325bea0 19-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Fix race condition between starting of service and getting the Profile Proxy.

Incoming A2DP connections were not working.

Change-Id: I5a3322ddb39b2512495b4cd2e35593da0f605087
/frameworks/base/core/java/android/server/BluetoothService.java
72cd64b20ed7118a6c0ed12f4924659abb5dcd0d 15-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> resolved conflicts for merge of bbb90d13 to master

Change-Id: I85de73f6e11e7547a006d41ca49021bca19af14b
70a053bf1ba331d727e2fbfca8f39d96b3b324b4 14-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Work around for errant headsets.

1. Some headsets send an AVCTP connection before an AVDTP connection
When that AVCTP connection fails, we get stuck in IncomingA2DP state
because we don't handle AVCTP signals for now.
We need to handle the signals and fix it better.

2. Also when ACL gets disconnected, reset state i.e
when the low level connection disconnected reset our state.
This is like a fail safe in case we get stuck.

Bug: 3051490
Change-Id: Ibcf188103999ffb1e08c36c2554504c639fb7f50
/frameworks/base/core/java/android/server/BluetoothService.java
980d40b568bf976eed8de7c035c2e30ddc67fa89 01-Oct-2010 Jake Hamby <jhamby@google.com> resolved conflicts for merge of 738aadd7 to master

Change-Id: I8810cc6dbd532de002d6a623ad93e86afb48c0b4
f51eadaf1f83abfe16a609a4ded6d789494689b2 21-Sep-2010 Jake Hamby <jhamby@google.com> Typo fixes in comments and minor code cleanups.

* Fix some typos in Javadoc and log messages.
* Remove redundant initializer in BluetoothAdapter.readOutOfBandData()
* Use canonical "UTF-8" charset name instead of "UTF8" in
BluetoothDevice.convertPinToBytes()

Change-Id: I58cd5dc48a7ad0053d204c5f590b4b3d438d8672
/frameworks/base/core/java/android/server/BluetoothService.java
96a79830ea1ae3ab3d6d3cce2bd1397fcd40ea0e 28-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Update code for new BT public APIs.

Change-Id: Id730fb6226db59f3a0416111c4790653c2fccb0b
/frameworks/base/core/java/android/server/BluetoothService.java
ea8e8d7342ab8b9d2c54983d1f3c92018b074513 15-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> am b390728b: am a224f70b: Fix interaction between BluetoothEventLoop and BluetoothService.

Merge commit 'b390728b54805ecba3e0690edf2b83b60933e6a7'

* commit 'b390728b54805ecba3e0690edf2b83b60933e6a7':
Fix interaction between BluetoothEventLoop and BluetoothService.
707952ecd4b6cae25aabcf51f94d702a65847e9e 14-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Rework Bluetooth tethering networking configuration.

Limit it to 5 for now, and store the iface.

Change-Id: Ia6044b8e8f886dcd587ab0bb57273e0c11b6cd74
/frameworks/base/core/java/android/server/BluetoothService.java
a224f70b1efc29d9698da5b5c143251a43838f2b 11-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Fix interaction between BluetoothEventLoop and BluetoothService.

BluetoothEventLoop primarily handles event notifications from Bluez.
It should know innards of Bonding and especially BondState.
BondState class and BluetoothService call into each other.
When BluetoothEvent loop gets the handle to BondState it leads
to deadlocks and ANRs.

Change-Id: I785c57f6246c1288350d26d4acb87d879b27a5f9
/frameworks/base/core/java/android/server/BluetoothService.java
20c8f47330e7d4f5f191264f0d7ca67f6532adc2 13-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> resolved conflicts for merge of 0522f5e9 to master

Change-Id: Ie0a7ece33dced1042948087053e49665f6235fc2
cc5494c9996f809e36539b24e8b6b67683383d29 10-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Out Of Band API for Secure Simple Pairing.

Change-Id: I54ded27ab85d46eef3d2cca84f2394b1ffe88ced
/frameworks/base/core/java/android/server/BluetoothService.java
b70765cc27a174d1d4a0bab7062733ebd3eae354 02-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Decouple Tethering UI with registering of SDP records.

This can lead to usability issues, since the SDP record
will get registered later on.

Change-Id: Ifda78a3831572f1b9955bf06da9a8b0e949942aa
/frameworks/base/core/java/android/server/BluetoothService.java
02f4f0eb4919453e8dbf40549d4ae9c05f05b8dd 31-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> am 734d2707: am bb660d7e: Merge "Renaming SharedPreferences.startCommit to apply" into gingerbread

Merge commit '734d270769c609c7d3a1f2ec46e1d329d9682ab4'

* commit '734d270769c609c7d3a1f2ec46e1d329d9682ab4':
Renaming SharedPreferences$Editor.startCommit to apply
66fce5068a8a3aeb28aaf713843891b286a75280 31-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Renaming SharedPreferences$Editor.startCommit to apply

Also removes the artifical restriction that only one apply() can be in
flight at once. That was old from when I thought it'd end up being
required, but wasn't.

Change-Id: I3540ea8be6e0760d6a51d218186f71655c2f3f55
/frameworks/base/core/java/android/server/BluetoothService.java
7f7ce40f90cf00dc046fb9520d77d29e96b474d6 28-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> resolved conflicts for merge of 28130bae to master

Change-Id: I13df8dc12092c3d2536e12216df9130d5914380a
333b8cba996c8ebb8ca55ebfc5cc536bdd64af94 26-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> SharedPreferences$Editor.startCommit()

Adds a fire-and-forget save method (startCommit) to the
SharedPreferences.Editor, which is the way most people use it anyway.

This commit adds the implementation. The previous commit added the
interface and docs:

previous change: Idf9934b445da1fb72b79f0192218b47c0a7f5a34
git commit: edf32d01316bd3432c023f17747461b08ae36375

In addition, this change:

-- adds a generic "runPendingWorkFinishers" mechanism to
ActivityThread to wait on async operations that are still
in flight and use it for this.

-- ties runPendingWorkFinishers into Activity.onPause,
BroadcastReceiver, and Service.

-- makes sSharedPreferences keyed on name, not File, to avoid
unnnecessary allocations

-- documents and guarantees what thread
OnSharedPreferenceChangeListener callbacks run on

-- makes a few things in frameworks/base use startCommit(), notably
Preference.java (which was ignoring the return value anyway)

Change-Id: I1c8db60ad45643226fe6d246d3e513eeb7bd0ebd
/frameworks/base/core/java/android/server/BluetoothService.java
8aac82a5248e922bac2f84df746b5d1f34498f53 20-Aug-2010 Danica Chang <danicachang@google.com> Wait for bluetooth to turn on before Bluetooth Tethering is enabled

Change-Id: I3fef94ea2cb102e1bb618f85e25d60c95cea1221
/frameworks/base/core/java/android/server/BluetoothService.java
6fdd0c6274c81b337ad35b70480f881daf7354c3 11-Aug-2010 Danica Chang <danicachang@google.com> bluetooth tethering

Change-Id: Id6d5fb1922facc7013abc29214d3e1141995b767
/frameworks/base/core/java/android/server/BluetoothService.java
05a1863cebcc8e318283f3f4a49ba69d83b62866 21-Jul-2010 Jaikumar Ganesh <jaikumar@google.com> Allow multiple HID devices to be connected.

Change-Id: I40d9820b756c1e3bb4e773fbb78212e2716e99bf
/frameworks/base/core/java/android/server/BluetoothService.java
de07503a382e81ba82f4cd4dee81ff2fbf3295bc 20-Jul-2010 Jaikumar Ganesh <jaikumar@google.com> Add HID to the state machine and add native call backs.

Change-Id: Ib9f3e476d4176bc04e23e7674dc54aa5a6417308
/frameworks/base/core/java/android/server/BluetoothService.java
c3ee99d9eb7e8b4b20c2b8f1c548373e1017e0d3 19-Jul-2010 Jaikumar Ganesh <jaikumar@google.com> Set initial HID profile preference.

Change-Id: I804089cbea4ad25b87ade60fa8a905ddb167bff4
/frameworks/base/core/java/android/server/BluetoothService.java
cab94f75aadb9fc3c7b592919765897b7741c63f 19-Jul-2010 Danica Chang <danicachang@google.com> am cbbd3a1b: am f23682f1: Merge "fixed parsing issue in BluetoothService so that it parses the UUID property correctly" into gingerbread

Merge commit 'cbbd3a1b950ef14075159319ac0fd0a8a19bb9ed'

* commit 'cbbd3a1b950ef14075159319ac0fd0a8a19bb9ed':
fixed parsing issue in BluetoothService so that it parses the UUID property correctly
7a9de8b425954e4039053038e4ec1762b866c83c 17-Jul-2010 Danica Chang <danicachang@google.com> fixed parsing issue in BluetoothService so that it parses the UUID property correctly

Change-Id: If46fd3ae1a0e6393cd47a8f0dc913cef45e05441
/frameworks/base/core/java/android/server/BluetoothService.java
56d26139659c2414d289194c63860ff27ab80da0 16-Jul-2010 Jaikumar Ganesh <jaikumar@google.com> Handle Input and network signal changes for HID and tethering.

Change-Id: I7f0c2884bb766189b41093bdcd6241f4540a31f3
/frameworks/base/core/java/android/server/BluetoothService.java
df7627db715a7a2e7f646f02a07caf2347bb90b8 22-Jun-2010 Adam Powell <adamp@google.com> Changes for bluetooth keyboard support.

Add device class constant for PROFILE_HID and check for
Device.Major.PERIPHERAL when checking for class matches.

Change UUID for HID support.

Fix bug in BluetoothService.

Change-Id: Ie5361257d90fd749249e915824564bc3d79fb95d
/frameworks/base/core/java/android/server/BluetoothService.java
545e6708adda6859932b55fd824794b1401f5318 04-Jun-2010 Jaikumar Ganesh <jaikumar@google.com> HID profile.

Change-Id: I52e965a6537bce02c751ba26fe7b44dd03832510
/frameworks/base/core/java/android/server/BluetoothService.java
f1048cdb68d4e4671be2060ca31a3adfc613e88e 03-Jun-2010 Jaikumar Ganesh <jaikumar@google.com> Serialize all commands for a particular profile.

Change-Id: I843ea9ab0bb2372c8316e99e8c083a9939ad774a
/frameworks/base/core/java/android/server/BluetoothService.java
740e39be6af3e366a4b82c030b5ea67ab144b42a 02-Jun-2010 Jaikumar Ganesh <jaikumar@google.com> Pass BluetoothDevice to the Bluetooth Headset calls.

This is to support multiple headsets at the same time, atleast
at the framework level.

Change-Id: I91d05c6c2828c9a09d00806d5e79f1e9c9c7cf84
/frameworks/base/core/java/android/server/BluetoothService.java
9b637e5985f9a86f39d70335c0390ade3716592a 02-Jun-2010 Jaikumar Ganesh <jaikumar@google.com> Add a new state machine for handling the incoming / outgoing profile
connections.

Change-Id: I5fc9170b5e24c4a52a6f2ef4ca7a8bac65271941
/frameworks/base/core/java/android/server/BluetoothService.java
0e09030977aea8b40fd177139528d4b5637c9771 29-Mar-2010 Jaikumar Ganesh <jaikumar@google.com> Relax the requirement of making a DBUS call for creating the Bluez Device.

Bug: 2136464

When the bluez device is created, we get the onDeviceCreated signal.
We add it to our cache when that happens. We can have a device created
even when its not bonded - as a result of OPP. So use this cache to avoid
a DBUS call to Bluez.

Change-Id: I9465da7d72a12a6888128ff40ac1fe598cbae3c3
/frameworks/base/core/java/android/server/BluetoothService.java
b7e029d03c115ed65cdea9b2bba307e882c308e2 10-Mar-2010 Jaikumar Ganesh <jaikumar@google.com> Add an API to set the link timeout.

This fixes the problem where the car dock is
powered on and off pretty quickly.

Change-Id: I8724641b8c337019f089b005cb236fc90549cf6f
/frameworks/base/core/java/android/server/BluetoothService.java
c06fe59cb5a1bdd2a87d1aff3e35edf29a859979 08-Jan-2010 Jaikumar Ganesh <jaikumar@google.com> Move auto pairing data to a file, add values dynamically.
/frameworks/base/core/java/android/server/BluetoothService.java
5f61416305c47c4db0b94c0cf500e9a9d11d4cdb 17-Feb-2010 Kenny Root <kroot@google.com> Add hashCode() to BluetoothService$RemoteService

RemoteService is used as a key in a HashMap, so it should have a
hashCode()

Change-Id: I69b72991474f4d5ec11c0620a6e66eb0c44d04b6
/frameworks/base/core/java/android/server/BluetoothService.java
44303922f14ac71b446a6e50e1180be4c8fed2c7 02-Dec-2009 Jeff Sharkey <jsharkey@android.com> Watch for "bluetooth" in list of toggleable radios.

Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS is a list of
radios that can be toggled while in airplane mode. This
change adds logic to BluetoothService to allow enabling
when Settings.System.RADIO_BLUETOOTH appears in that list.

Fixes http://b/2297314
/frameworks/base/core/java/android/server/BluetoothService.java
368c332ddc804d5fb0bb2362f658e7a3706fb003 11-Dec-2009 Jaikumar Ganesh <jaikumar@google.com> am f6e32e72: Merge change Icced7a09 into eclair

Merge commit 'f6e32e72a902d9a309410bc5306a539ea850159f' into eclair-mr2

* commit 'f6e32e72a902d9a309410bc5306a539ea850159f':
Maintain a list of all Bluetooth docks.
6e9c443460e40e9d663c117ba836585335e7c2c1 09-Dec-2009 Jaikumar Ganesh <jaikumar@google.com> Maintain a list of all Bluetooth docks.

With this change, isBluetoothDock API can be used anytime and is not in tied
to dock state. The Dock State is a sticky intent so users
can query for the dock state.

Dr No: Eastham
Bug: 2133530
/frameworks/base/core/java/android/server/BluetoothService.java
11a2853e0196905e25a2dc5c227320688e04e950 03-Dec-2009 Jaikumar Ganesh <jaikumar@google.com> am 8c411fb1: Merge change I79420b02 into eclair

Merge commit '8c411fb13923d1fa28fcd98452bf3d17b8b1a338' into eclair-mr2

* commit '8c411fb13923d1fa28fcd98452bf3d17b8b1a338':
Add support for Car Dock.
3fbf7b62bb48b10316353087d09cc3720af00642 03-Dec-2009 Jaikumar Ganesh <jaikumar@google.com> Add support for Car Dock.

Dr No: Eastham
Bug: 2133530
/frameworks/base/core/java/android/server/BluetoothService.java
5f24a24004a9694db757dd6e666d0061dfbdf2b0 30-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Register Handsfree profile before headset profile. DO NOT MERGE.

There is a delay between registering the two profiles,
and handsfree profile is a superset of the headset profile.
So some devices do an SDP and get the headset profile record
before we have registered the handsfree profile.

a) We can reject all incoming connections till all profiles are
registered, but then this would mean we connect later in some cases.
Registering profiles in this order seems fine to me.

Note: There is a also the need to fix forking sdptool to register
profiles, which would obliviate the need to wait 500 msecs between
profile registrations.

Bug: 2293792
Dr No: Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
77b4ad0e496941a28382eb938a05831f1f8d2d4a 30-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Register Handsfree profile before headset profile.

There is a delay between registering the two profiles,
and handsfree profile is a superset of the headset profile.
So some devices do an SDP and get the headset profile record
before we have registered the handsfree profile.

a) We can reject all incoming connections till all profiles are
registered, but then this would mean we connect later in some cases.
Registering profiles in this order seems fine to me.

Note: There is a also the need to fix forking sdptool to register
profiles, which would obliviate the need to wait 500 msecs between
profile registrations.
/frameworks/base/core/java/android/server/BluetoothService.java
8631e55425b2ab81eb74396e6834c6f7a4549804 23-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> am ad431ad8: Merge change Ia3acc2ee into eclair

Merge commit 'ad431ad8631d8b19b04193ff1f89a955a7643c60' into eclair-mr2

* commit 'ad431ad8631d8b19b04193ff1f89a955a7643c60':
Fix pairings lost on reboot.
b148bc844e5eddb07bef2fd1b4b754716decb43e 20-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Fix pairings lost on reboot.

Bug:2277376
Dr No:Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
4fea2919abeba149376fed98a14e3ffc8464eadf 18-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> am 660282dc: Merge change I706fe6b0 into eclair

Merge commit '660282dc3e81784224945be0787a9e2d4276de8c' into eclair-mr2

* commit '660282dc3e81784224945be0787a9e2d4276de8c':
Check if Bluetooth is enabled before making any calls down.
8c9dd7d8b99e1b064fc064a3c6737eaf179eae68 17-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Check if Bluetooth is enabled before making any calls down.

This was causing problems when apps were making calls, without
turning on BT first.

Bug: 2234918
Dr No: Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
48956ad3fa4bfcd6d386c61872363c9e8990fa39 12-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> am 3c58d279: Merge change I738ed802 into eclair

Merge commit '3c58d279abed1da56b0ece74ded5854c509a42a4' into eclair-mr2

* commit '3c58d279abed1da56b0ece74ded5854c509a42a4':
Fix BMW and Audi auto pairing lists.
738ed80262aa26128924c51f59ffd49e1163eb8d 12-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Fix BMW and Audi auto pairing lists.

Bug no:2256558
Dr No:Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
4e552b606cc9fc3e6cac210b3894974709531ec1 12-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> am 013b0e53: Merge change I143ea844 into eclair

Merge commit '013b0e531a4318b3e78c9bd0e077d3632fce2280' into eclair-mr2

* commit '013b0e531a4318b3e78c9bd0e077d3632fce2280':
Add BMW and Audi to Auto Pairing black list.
9b26f3fae406fa84cf4ddbc00674ccfe7ae2feb5 12-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Add BMW and Audi to Auto Pairing black list.

Bug: 2256558
Dr No: Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
f53f86a743a91b4383e480dcf44a8e7b16ca7fa0 06-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> am 8de4e0ad: Merge change I21d0dca3 into eclair

Merge commit '8de4e0ad8ff39d9a397cd80de5155d4c09ef98fd' into eclair-mr2

* commit '8de4e0ad8ff39d9a397cd80de5155d4c09ef98fd':
Add BMW kits made by Motorola PCS to autoblack list for Bluetooth.
21d0dca33e0c16c7de5c42bbcdf5a98ec67ead5d 05-Nov-2009 Jaikumar Ganesh <jaikumar@google.com> Add BMW kits made by Motorola PCS to autoblack list for Bluetooth.

This may force some Motorola headsets to thow up the Pairing Request.

Bug: 2210365
Dr No: Eastham
/frameworks/base/core/java/android/server/BluetoothService.java
77df9d6e0ca56a34c66a1e30e9696085ddbd9038 12-Oct-2009 Nick Pelly <npelly@google.com> am d301c904: Merge change I305c181c into eclair

Merge commit 'd301c90446644f63cda9b9263f83332676065bb4' into eclair-mr2

* commit 'd301c90446644f63cda9b9263f83332676065bb4':
Delay 500ms between each registering each SDP record using sdptool.
bc1fc05c1b3e8c407fa07b25777bf577d5285f49 12-Oct-2009 Nick Pelly <npelly@google.com> Delay 500ms between each registering each SDP record using sdptool.

This is to workaround an issue where SDP records will fail to register using
sdptool. When we run SystemService.start() it forks sdptool, so if we do this
four times in a row these forked processes can run in parallel, and one or
more of them fails. There is probably some thready safety issue in sdptool
or Bluez that makes it unsafe to run sdptool in parallel.

As a workaround, delay 500ms between each run of sdptool to register SDP
records when starting Bluetooth.

Before this fix it was easy to reproduce problems with service record
registration. If you turn BT off/on multiple times you can see that sometimes
one or more service records are missing. Repro rate is about 20% in my tests.
Result is that remote devices cannot connect to the missing service.

After this fix I am unable to reproduce any missing SDP records, after 30+
cycles of BT on/off. Motorola BT team also ran stress tests overnight with this
fix and were unable to reproduce the missing SDP records.

This is a low risk fix. It does delay some records from being registered
by an additional 1.5 seconds (on top of the 3 second delay we already had),
so if you try and very quickly connect a BT service after turning BT on it
won't work the first time.

Do not merge. (I will use a less hacky fix for MR2/Master)

Change-Id: I305c181c3194e8ce25e3825320cc2e1ef6d3d3cc
Bug: 2180800
DrNo: eastham
Joke: Why can't you play cards in the jungle? Because there's too many cheetas!
/frameworks/base/core/java/android/server/BluetoothService.java
db7ae10d6b8e86ff5311512de45afa65a1b0a738 09-Oct-2009 Nick Pelly <npelly@google.com> Remove STOPSHIP BT logging.

Do not merge.

Change-Id: I428bc0fc67030f24112f2e9c865824dfaea4897d
DrNo: eastham
Bug: 2089423
Joke: Why was Tigger looking in the toilet? To find Pooh
/frameworks/base/core/java/android/server/BluetoothService.java
e6ee3be1c254404dad842298f6f56c11cc6c7ac8 08-Oct-2009 Nick Pelly <npelly@google.com> BT API security audit: fix a couple of permission mistakes.

Make functions that are meant to be BLUETOOTH_ADMIN really
BLUETOOTH_ADMIN.

Add some missing javadoc for permissions.

The only functional change here is the BLUETOOTH->BLUETOOTH_ADMIN
changes. This is super safe because every system app that uses BT
has both permissions.

Change-Id: Iddc61f9fd5d81fe0171358665a0fa52f2fa02871
DrNo: eastham
Joke: How do you catch a rabbit? Hide behind a tree and make carrott noises.
/frameworks/base/core/java/android/server/BluetoothService.java
e5d93b7ed983f98855555d560faf060836f1a52f 08-Oct-2009 Jaikumar Ganesh <jaikumar@google.com> Set the Bond State to NONE when we receive a Agent Cancel.

Sometimes during OPP, we can get stuck in Pairing state when the remote
end, cancels the Pairing process - we will just get onAgentCancel
and thus not set the Pairing state properly.

DrNo: Eastham
Bug:2174874
/frameworks/base/core/java/android/server/BluetoothService.java
f242b7b931898856bcbcb7ec36cacf43098ba544 08-Oct-2009 Nick Pelly <npelly@google.com> Introduce BluetoothAdapter.getDefaultAdapter().

This is the main entry point to the Bluetooth APIs, and returns the default
local Bluetooth adapter.

It replaces context.getSystemService(Context.BLUETOOTH_SERVICE). This was
never in a public SDK release.

DrNo: eastham
Bug: 2158765
Joke: Why can't you play cards in the jungle? Because there's too many cheetas!
Change-Id: Ieed8be009ee5aba621cb69090ee8c8a9c19c840d
/frameworks/base/core/java/android/server/BluetoothService.java
16fb88a673c41b93c5d57ccb28c2697e7d87701a 07-Oct-2009 Nick Pelly <npelly@google.com> Encourage developers to connect RFCOMM by UUID instead of Channel.

Hide createRfcommSocket(int channel)
Add createRfcommSocketWithServiceRecord(UUID uuid)

Rename listenUsingRfcomm(String,UUID) -> listenUsingRfcommWithServiceRecord(..)

Now we have a complete API for developers to make peer-peer RFCOMM connections
with hard-coding the limited (30) RFCOMM channels, instead using SDP lookup
of an UUID.

This commit addresses two serious bugs:
- Do not throw IOException on accepting an incoming RFCOMM connection with
BluetoothSocket. This was a regression from commit 24bb9b8af4ff6915
- Workaround failure of bluez to update SDP cache when channel changes by
trying to use the same RFCOMM channel on the server every time, instead
of picking server channels randomly. This is a pretty ugly workaround,
and we are still trying to fix the caching issue - but with this
workaround we are at least shippable and apps will work at least until
they start colliding on the 30 RFCOMM channels.

DrNo: eastham
Bug: 2158900
Joke: What did the digital watch say to his mom? "Look mom no hands."
Change-Id: Ia4879943b83afac06b6f1a3f2391cf1628afce7d
/frameworks/base/core/java/android/server/BluetoothService.java
24bb9b8af4ff691538fe9e517e8156016b0da6cd 03-Oct-2009 Nick Pelly <npelly@google.com> Provide an API for apps to use a dynamic RFCOMM channel and SDP record.

Hide listenUsingRfcommOn(int channel)
Add listenUsingRfcomm(String name, ParcelUuid uuid)

The new API automatically finds a free RFCOMM channel and registers an SDP
record with the given uuid and name. The SDP record is automatically
removed when the socket is closed, or if the application dies.

Apps are prevented from registering SDP records with the uuid of system
Bluetooth profiles, such as A2DP, HFP and OPP.

Apps are prevented from removing SDP records that they did not create. This is
tracked by pid.

TODO: Provide an API for the connecting app to look up an SDP record.

Bug: 2158900
DrNo: eastham
Joke: "What did the dog say to the tree? bark."
Change-Id: Ia92f51c34615a7270a403255ad2b8faa98c4a3f5
/frameworks/base/core/java/android/server/BluetoothService.java
55929a958bf0e482c8e4d7df3dd75957f1e9d871 30-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Query from Bluez if name is not present in cache.

Change-Id: I78c4e64a52b8290053dedfb1326df8d4c20f8a09
/frameworks/base/core/java/android/server/BluetoothService.java
aef439e6f825c0cb99a2ac08c8207f48b7a9fe10 28-Sep-2009 Nick Pelly <npelly@google.com> Move android.bluetooth.ParcelUuid to android.os.ParcelUuid

Change-Id: I564429d5c5b6a5372b6ff26a53b0d7e518b53631
/frameworks/base/core/java/android/server/BluetoothService.java
12835478ee687a493d1b5882e67b6725bd539c26 26-Sep-2009 Nick Pelly <npelly@google.com> Handle expiration of discovery mode in system server.

Change-Id: I58fd199b40ffdf8168a5489be8eedb5d25d56722
/frameworks/base/core/java/android/server/BluetoothService.java
18b1e79a123b979d25bfa5d0b0ee5d0382dbd64b 24-Sep-2009 Nick Pelly <npelly@google.com> Bluetooth API: Do not allow apps to programmatically make BT discoverable.

Instead add ACTION_REQUEST_DISCOVERABLE for the system to show a dialog to
adjust discoverable mode.

Also remove createBond(), removeBond() and cancelBondProcess(). The Settings
App already handles these automatically when connections require bonding.

Change-Id: I216154cd1b6de410de64ba91b07d7263ac03e8df
/frameworks/base/core/java/android/server/BluetoothService.java
2d3b98d868cda30535505b2a2fba47aa1c9c052b 22-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Send the address of the device with the UUID intent.

Change-Id: I6357d482550e9e02edf221add318ecd9cfadcb66
/frameworks/base/core/java/android/server/BluetoothService.java
10eac971b3a6e5f34a420dd68ebfa796553ad2b9 21-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Cache the remote device's service channel.

Bluez Device implementation is such that when a device
is unpaired, we removes the device and hence there is no
way to interact with it unless you pair again. Remote service
channel call is used to get the rfcomm channel number which
will be used in profiles like OPP which don't require pairing.

Change-Id: I868a6cdfdb1b7d3591dd8b66cd0320f41a9c1b92
/frameworks/base/core/java/android/server/BluetoothService.java
6179965e85ec17b836084a4a3d7963d8a7a1e1cc 21-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Send the UUID intent even if apps have not requested for it.

This will help apps listening to this intent to update icons etc
if the remote uuid changes. For example, the settings app used to
refresh the icons when the class bits change. It can do it now
when the remote ends uuids changes too.

Change-Id: Ib9af45780e83118d8877b0ef16f5b39b87fb4bef
/frameworks/base/core/java/android/server/BluetoothService.java
2092361d586a20190c9137fb3cc9434cdc9ec99f 20-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Maintain pending outgoing bonding address.

This helps us to distinguish between incoming and outgoing Bonding requests.

Change-Id: I69e6a269b7dd6aad60e6f5711cad812291a7d313
/frameworks/base/core/java/android/server/BluetoothService.java
1caa6d111eff6814760ec156b14adc29aa3aae6c 18-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Add new API for fetching UUIDs using SDP.

Add new API which clients can use to force an SDP query.
The result is broadcast using an intent having the UUIDs.
The intent is broadcast after a timeout, in case of an error.
This timeout is greater than the page timeout.

Change-Id: I61e6db4c05b34c42f679a66987e37e2063a793b6
/frameworks/base/core/java/android/server/BluetoothService.java
dd0463aef18d251c741bfc9dc7a2787443ef36f1 16-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Change handling of remoteUuids.

Use the ParcelUuid instead of UUID

Change-Id:Ie05d65a62e8a4df8182a4c737d46c14142bfec43
/frameworks/base/core/java/android/server/BluetoothService.java
adbaef234e1bd7bbec561fb6291bae394a412ce8 15-Sep-2009 Nick Pelly <npelly@google.com> Add Panasonic KX-TH112 to blacklist.

Change-Id: I12475aff4046796132beb2554cd067bcec712973
/frameworks/base/core/java/android/server/BluetoothService.java
482d54bb0cd9e00fd929185c31fea3ad845d97bc 14-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Add black listing of car kits by name.
/frameworks/base/core/java/android/server/BluetoothService.java
32d8571f509c392dca732c243e9b2138c15daecf 11-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Changes for BT 2.1

1) Handle incoming 2.1 pairing requests
2) Modify displaying error messages on bond failures.
3) Add delay while accepting incoming pairing for certain 2.1 devices.
When MITM is on, the link key request might come more than once.
Auto accept with a delay.
4) Handle DisplayPasskey callback for pairing a 2.1 keyboard with
a 2.1 device
/frameworks/base/core/java/android/server/BluetoothService.java
005b228cdfb369d9b3b325884c0337ba5968bf8c 10-Sep-2009 Nick Pelly <npelly@google.com> API_CHANGE: Cleanup, javadoc and unhide more Bluetooth API.

This is a large batch, and covers:

-- Bluetooth Device Discovery --
BluetoothAdapter.ACTION_DISCOVERY_STARTED
BluetoothAdapter.ACTION_DISCOVERY_FINISHED
BluetoothAdapter.startDiscovery()
BluetoothAdapter.cancelDiscovery()
BluetoothAdapter.isDiscovering()

-- Bluetooth bonding (pairing) --
BluetoothAdapter.getBondedDevices()
BluetoothDevice.ACTION_BOND_STATE_CHANGED
BluetoothDevice.EXTRA_BOND_STATE
BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE
BluetoothDevice.BOND_NONE
BluetoothDevice.BOND_BONDING
BluetoothDevice.BOND_BONDED
BluetoothDevice.getBondState()
BluetoothDevice.createBond()
BluetoothDevice.cancelBondProcess()
BluetoothDevice.removeBond()

-- BluetoothClass --
BluetoothDevice.ACTION_CLASS_CHANGED
BluetoothDevice.EXTRA_CLASS
BluetoothDevice.getBluetoothClass()
BluetoothClass.Service.*
BluetoothClass.Device.Major.*
BluetoothClass.Device.*
BluetoothClass.getDeviceClass()
BluetoothClass.getMajorDeviceClass()
BluetoothClass.hasService()

-- Misc BluetoothDevice --
BluetoothDevice.ACTION_ACL_CONNECTED
BluetoothDevice.ACTION_ACL_DISCONNECTED_REQUESTED
BluetoothDevice.ACTION_ACL_DISCONNECTED
BluetoothDevice.ACTION_DISCOVERED
BluetoothDevice.ACTION_NAME_CHANGED
BluetoothDevice.EXTRA_DEVICE
BluetoothDevice.EXTRA_NAME
BluetoothDevice.EXTRA_RSSI

-- Misc BluetoothAdapter --
BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED
BluetoothAdapter.EXTRA_LOCAL_NAME
BluetoothAdapter.checkBluetoothAddress()

I deprecated BluetoothIntent and moved each intent into the class it relates
to.

Change-Id: I877b1280428ab46278b2bc25668bb44cda22dc36
/frameworks/base/core/java/android/server/BluetoothService.java
b24e11baac589fe16426f2d243b460ab84991c7b 09-Sep-2009 Nick Pelly <npelly@google.com> API_CHANGE

Deprecate BluetoothError.java.

I spent a lot of time experimenting with a class BluetoothError to enumerate
the many error codes returned by the Bluetooth API. But at the end of the day
they were never used. The vast majority of method calls only really need a
true/false error value, and often not even that.

Methods which do need more detailed error enumeration (for example, bonding
failures) can have there own enumerated error codes. But there is no need
for a common set of error codes.

Also change the IPC failed warnings in BluetoothA2dp to Log.e. These indicate
a very serious error.

Introduce BluetoothAdapter.ERROR and BluetoothDevice.ERROR as helper sentinel
values.
/frameworks/base/core/java/android/server/BluetoothService.java
de893f550301a60274e87aa8168225e7a7a42184 08-Sep-2009 Nick Pelly <npelly@google.com> API_CHANGE

Another round of Bluetooth API clean up, javadoc'ing and unhide'ing.

-- Symbols for getting/setting bluetooth state --
BluetoothAdapter.ACTION_STATE_CHANGED
BluetoothAdapter.EXTRA_STATE
BluetoothAdapter.EXTRA_PREVIOUS_STATE
BluetoothAdapter.STATE_OFF
BluetoothAdapter.STATE_TURNING_ON
BluetoothAdapter.STATE_ON
BluetoothAdapter.STATE_TURNING_OFF
BluetoothAdapter.isEnabled()
BluetoothAdapter.getState()
BluetoothAdapter.enable()
BluetoothAdapter.disable()

-- Symbols for getting/setting scan mode --
BluetoothAdapter.ACTION_SCAN_MODE_CHANGED
BluetoothAdapter.EXTRA_SCAN_MODE
BluetoothAdapter.EXTRA_PREVIOUS_SCAN_MODE
BluetoothAdapter.SCAN_MODE_NONE
BluetoothAdapter.SCAN_MODE_CONNECTABLE
BluetoothAdapter.SCAN_MODE_DISCOVERABLE
BluetoothAdapter.getScanMode()
BluetoothAdapter.setScanMode()

-- Symbols for getting address/names --
BluetoothAdapter.getAddress()
BluetoothAdapter.getName()
BluetoothAdapter.setName()
/frameworks/base/core/java/android/server/BluetoothService.java
9519ce75f15ba287a641166c1b7ed10f2aa73f74 09-Sep-2009 Jaikumar Ganesh <jaikumar@google.com> Query for all properties if a property change is received and cache is empty.
/frameworks/base/core/java/android/server/BluetoothService.java
efa1dd716da3372cc74a201d11de5e0ef1a9fe9a 31-Aug-2009 Lixin Yue <L.X.YUE@motorola.com> Add Bluetooth Device trust
/frameworks/base/core/java/android/server/BluetoothService.java
efa33676caf5b7a637fad73cd22c9ef23b68cdc2 28-Aug-2009 Jaikumar Ganesh <jaikumar@google.com> Fix property being cleared when DeviceFound signal is received.
/frameworks/base/core/java/android/server/BluetoothService.java
b015e193b7304230749bbf1e0676628b8a38de77 26-Aug-2009 Nick Pelly <npelly@google.com> Add trailing "\n" to debug output.
/frameworks/base/core/java/android/server/BluetoothService.java
1eada0d3d655d6396bf862da954d254856a1bc03 26-Aug-2009 Nick Pelly <npelly@google.com> Add uuids to adb shell dumpsys bluetooth
/frameworks/base/core/java/android/server/BluetoothService.java
397d8f4f4829a45f4fe7a672cc395466bbc0f442 21-Aug-2009 Jaikumar Ganesh <jaikumar@google.com> Set BondState to Canceled when user cancels pairing.
/frameworks/base/core/java/android/server/BluetoothService.java
bd022f423a33f0794bb53e5b0720da2d67e4631c 15-Aug-2009 Nick Pelly <npelly@google.com> Bluetooth: API change.

Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.

BluetoothAdapter: Represents the local BT adapter. Operations on the local
adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
(pair, connect, etc).

IBluetoothDevice.aidl -> Bluetooth.aidl
BluetoothDeviceService.java -> BluetoothDeviceService.java

TODO:
Javadoc
/frameworks/base/core/java/android/server/BluetoothService.java