Commit Graph

386 Commits

Author SHA1 Message Date
Matthew Xie
cf6bc99b97 Merge "Turn off debug messge" 2011-10-07 12:57:08 -07:00
Matthew Xie
f0f95112ff Turn off debug messge
Bug 5425619

Change-Id: I7accb88a40604c5b8a8f2323e751a7f8f3cb9da8
2011-10-07 11:15:03 -07:00
Matthew Xie
9de1feb673 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
2011-10-03 12:50:27 -07:00
Matthew Xie
dcbc97fc28 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
2011-09-19 22:45:00 -07:00
Jaikumar Ganesh
f28c539389 Merge "Use an integer for the channel id." 2011-09-14 14:46:20 -07:00
Jaikumar Ganesh
d1ec771e27 Merge "Add Register before boot flag." 2011-09-14 14:46:10 -07:00
Jaikumar Ganesh
ee4837b3a0 Add Register before boot flag.
In some instances, the device might connect before we have booted up.

Change-Id: I1a50585207a2b0b2339acb048dffaea84e1a91e9
2011-09-14 11:57:46 -07:00
Matthew Xie
f1754050ce 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
2011-09-14 09:05:27 -07:00
Jaikumar Ganesh
cc0b8b2c47 Use an integer for the channel id.
Hashcode are not guranteed to be unique.

Change-Id: I905c4855785ac3da9fde8bb41e1a2678f1e9e5cc
2011-09-12 16:58:29 -07:00
Jaikumar Ganesh
049f5cc3de Merge "Don't override the hash code for the channel." 2011-09-12 09:45:20 -07:00
Jaikumar Ganesh
61eb5ae855 Don't override the hash code for the channel.
Each channel is uniquely represented by the object itself,
so use the hash code to identify it. Using channelPath in the
calculation will mess up things - since in Connecting state the
channel path is null and when its connected, we will get a different
hash code.

Change-Id: I6af6c783e18fddbd38344432b8156e000baafb15
2011-09-09 15:48:22 -07:00
Jaikumar Ganesh
6d172e60bb Merge "Add error codes for channel disconnection / connection." 2011-09-09 15:19:43 -07:00
Matthew Xie
5d61d8ddec Merge "Apply timeout for powerdown event and reset state machine when bluez crashes" 2011-09-08 17:16:50 -07:00
Jaikumar Ganesh
b5d2d4526c 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
2011-09-08 15:26:53 -07:00
Jaikumar Ganesh
8ee53da561 Fix crash while connecting channel.
When an incoming connection comes and then we disconnect it,
and then launch the outgoing connection - we crash because
the channel path chan.mChannelPath is null.

Change-Id: I9115cc038f7ce85a193bf05d14b2b0a5e0579a69
2011-09-08 15:17:25 -07:00
Jaikumar Ganesh
eb9d34630f 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
2011-09-08 15:17:17 -07:00
Matthew Xie
694c0b833b 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
2011-09-08 15:05:19 -07:00
Matthew Xie
484867a8ed 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
2011-08-29 16:24:50 -07:00
Amith Yamasani
7b71e4586b Merge "Update searchables when packages are modified, in case they are enabled/disabled." 2011-08-23 13:34:48 -07:00
Amith Yamasani
13bc602b21 Update searchables when packages are modified, in case they are enabled/disabled.
Bug: 5198361 : SearchManagerService doesn't respond to package updates.
Change-Id: I2ac794c5da4769eadd6b860ab0f9123060d2a5e5
2011-08-23 12:11:35 -07:00
Matthew Xie
f9838d0bb9 Merge "Set bluetooth discoverable off at power on time if the timeout is no forever" 2011-08-23 10:54:07 -07:00
Matthew Xie
d96daf1ae5 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
2011-08-22 19:45:48 -07:00
Jaikumar Ganesh
ef4f8f2c08 Fix sendConnection State intent api params.
Reported by: sj222.choi@samsung.com

Change-Id: I2e767b372bd5d9fa42d083a37e402a013388a3c2
2011-08-22 18:18:24 -07:00
Jaikumar Ganesh
cb1d354c1e 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
2011-08-22 14:44:38 -07:00
Matthew Xie
116f7ee276 Merge "Change prepare bluetooth timeout from 7 seconds to 10 seconds" 2011-08-15 18:01:57 -07:00
Matthew Xie
25c4e2a803 Change prepare bluetooth timeout from 7 seconds to 10 seconds
It was observed that the preparing bluetooth could take up to 8 seconds before
the SD loaded event came in.

Change-Id: I722f94ed9cbd12bdd033ca405838366139c61383
2011-08-15 17:52:29 -07:00
Jaikumar Ganesh
89d55ad781 Fix stuck in pairing when BT is turned off.
When pairing is stuck, on turning BT off, we were
not setting the outgoing parining variable to null in
setBondState because of the extra check for isEnabled.

isEnabled check was added to prevent the proxy crash in
setProfilePriorities function. Proxies should never be null.
Add a safety check and also some extra logs to debug the problem.

Change-Id: I694dfeb8fa9426b3916775ca868c2313fa9c22ee
2011-08-15 16:41:08 -07:00
Matthew Xie
14e48e91f6 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
2011-08-15 11:31:54 -07:00
Matthew Xie
24c2d6bc82 Merge "Revert "Implement switchConnectable with Powered property setting instead of scan modes"" 2011-08-11 11:42:09 -07:00
Matthew Xie
10fc9bc55e Revert "Implement switchConnectable with Powered property setting instead of scan modes"
This reverts commit c5708036b4
2011-08-10 19:04:00 -07:00
Jaikumar Ganesh
d2344ce087 Merge "Check for BT state when sending Bond State Change intent." 2011-08-09 17:33:18 -07:00
Jaikumar Ganesh
bc85a087c9 Check for BT state when sending Bond State Change intent.
When users use application specific Bluetooth state changes,
and the bond state changes, we crash.

We need to recheck Bluetooth state in all functions and scenarios
and even maintain a per application pid Bluetooth state, but this fix
is quick fix for a problem.

Change-Id: I905dfb53965907ccb27757ff6ed1816536277f14
2011-08-09 17:18:29 -07:00
Matthew Xie
06ec66266c Merge "Implement switchConnectable with Powered property setting instead of scan modes" 2011-08-09 12:15:54 -07:00
Matthew Xie
c5708036b4 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
2011-08-05 11:58:23 -07:00
Jaikumar Ganesh
32a1e19aba Merge "Provide address and name in BT Hot off state." 2011-08-05 11:37:22 -07:00
Jaikumar Ganesh
a66590ed78 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
2011-08-05 11:34:06 -07:00
Jaikumar Ganesh
8c90038503 Merge "Fix PAN bug for reverse tethering." 2011-08-03 18:15:11 -07:00
Matthew Xie
cffb287b44 Merge "Add a timeout for disconnecting devices to recover from error situation" 2011-08-03 17:31:11 -07:00
Jaikumar Ganesh
b389bdfba2 Merge "Enforce permission for changeApplicationState function." 2011-08-03 17:20:52 -07:00
Matthew Xie
9a943a6420 Add a timeout for disconnecting devices to recover from error situation
Start the timer (3 second) just after calling disconnect devices.
If the timer expires, it indicates an error condition. we don't wait
on the ALL_DEVICES_DISCONNECTED event upon the error. Instead, get out of
switching state and turn off BT to reset out of the error condition.

Change-Id: I27aa8cd7b6fe50d9191e2d32fc2d6eac50424403
2011-08-03 17:08:55 -07:00
Jaikumar Ganesh
2cbb33c362 Fix PAN bug for reverse tethering.
We were the setting the iface as null while disconnecting
and so when disconnected the iface used was null - which would
lead to a crash. During connecting we don't know the interface,
so we use null.

Change-Id: I970f2f1886fa32237936eff439c359187a798832
2011-08-03 16:42:55 -07:00
Jaikumar Ganesh
f5fb6c8ce3 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
2011-08-03 15:00:07 -07:00
Jaikumar Ganesh
adcea06113 Merge "Fix PAN bugs." 2011-08-03 11:16:18 -07:00
Jaikumar Ganesh
e3b79ca1b9 Fix PAN bugs.
1. The interface was null for reverse tethering.
2. When disconnecting the server, we were passing the address instead of the
interface.

Change-Id: I6004cdf1eed000211cddc6b120e0aded5758eb1e
2011-08-03 09:15:41 -07:00
Matthew Xie
4376b7f2d7 Merge "Move mBluetoothService.runBluetooth after broadcasting the STATE_ON intent." 2011-08-02 15:44:28 -07:00
Matthew Xie
8594394aad 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
2011-08-02 15:22:09 -07:00
Jaikumar Ganesh
bbd8675057 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
2011-08-02 10:31:26 -07:00
Matthew Xie
6903a7de88 Merge "Provide an API to set the friendly name of a remote device." 2011-07-28 17:46:45 -07:00
Matthew Xie
269e81a563 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
2011-07-28 15:56:11 -07:00
Jaikumar Ganesh
ef2cb7c93a 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
2011-07-26 14:49:36 -07:00