diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-16 16:22:17 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-16 16:22:17 -0800 |
commit | 43ad522d49dd3f89d7e367112fab64e4d5027bf3 (patch) | |
tree | 62a5228373f09106f78bd61f4f548d040affd959 /core/java | |
parent | 601112f213035851a2fa2c2281c7f56cf767b14a (diff) | |
parent | c0e32f12439e5373dca5879e4eb7e819be7fb417 (diff) | |
download | frameworks_base-43ad522d49dd3f89d7e367112fab64e4d5027bf3.zip frameworks_base-43ad522d49dd3f89d7e367112fab64e4d5027bf3.tar.gz frameworks_base-43ad522d49dd3f89d7e367112fab64e4d5027bf3.tar.bz2 |
Merge change Ic0e32f12 into eclair-mr2
* changes:
Add a callback for the ConnectSink Call.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/server/BluetoothA2dpService.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java index f2e132b..03dcf00 100644 --- a/core/java/android/server/BluetoothA2dpService.java +++ b/core/java/android/server/BluetoothA2dpService.java @@ -305,7 +305,11 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { return false; // State is DISCONNECTED + handleSinkStateChange(device, state, BluetoothA2dp.STATE_CONNECTING); + if (!connectSinkNative(path)) { + // Restore previous state + handleSinkStateChange(device, mAudioDevices.get(device), state); return false; } return true; @@ -321,7 +325,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { return false; } - switch (getSinkState(device)) { + int state = getSinkState(device); + switch (state) { case BluetoothA2dp.STATE_DISCONNECTED: return false; case BluetoothA2dp.STATE_DISCONNECTING: @@ -329,11 +334,13 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } // State is CONNECTING or CONNECTED or PLAYING + handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTING); if (!disconnectSinkNative(path)) { + // Restore previous state + handleSinkStateChange(device, mAudioDevices.get(device), state); return false; - } else { - return true; } + return true; } public synchronized boolean suspendSink(BluetoothDevice device) { @@ -512,6 +519,19 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { return result; } + private void onConnectSinkResult(String deviceObjectPath, boolean result) { + // If the call was a success, ignore we will update the state + // when we a Sink Property Change + if (!result) { + if (deviceObjectPath != null) { + String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); + BluetoothDevice device = mAdapter.getRemoteDevice(address); + int state = getSinkState(device); + handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED); + } + } + } + @Override protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mAudioDevices.isEmpty()) return; |