diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-11 15:24:01 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-11 15:24:01 -0400 |
commit | 7ff269f359a8848fd0c39993d8fe21a8324806f9 (patch) | |
tree | c34d2456e6f507f5af18e1fc1e34df426204d1e3 /core | |
parent | d68781ace179e19b70120411baf307104683fa4b (diff) | |
parent | 5e59ca8ae4e29efb77acbd5513dcc109ea5dd2b4 (diff) | |
download | frameworks_base-7ff269f359a8848fd0c39993d8fe21a8324806f9.zip frameworks_base-7ff269f359a8848fd0c39993d8fe21a8324806f9.tar.gz frameworks_base-7ff269f359a8848fd0c39993d8fe21a8324806f9.tar.bz2 |
Merge change 24735 into eclair
* changes:
Handle DisconnectRequested message sent by Bluez.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 11 | ||||
-rw-r--r-- | core/jni/android_server_BluetoothEventLoop.cpp | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 4c24c50..d0d4b84 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -166,6 +166,17 @@ class BluetoothEventLoop { mContext.sendBroadcast(intent, BLUETOOTH_PERM); } + private void onDeviceDisconnectRequested(String deviceObjectPath) { + String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); + if (address == null) { + Log.e(TAG, "onDeviceDisconnectRequested: Address of the remote device in null"); + return; + } + Intent intent = new Intent(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED); + intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mAdapter.getRemoteDevice(address)); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); + } + private void onCreatePairedDeviceResult(String address, int result) { address = address.toUpperCase(); if (result == BluetoothDevice.BOND_SUCCESS) { diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp index 8fe7487..79a3247 100644 --- a/core/jni/android_server_BluetoothEventLoop.cpp +++ b/core/jni/android_server_BluetoothEventLoop.cpp @@ -45,6 +45,7 @@ static jmethodID method_onDeviceFound; static jmethodID method_onDeviceDisappeared; static jmethodID method_onDeviceCreated; static jmethodID method_onDeviceRemoved; +static jmethodID method_onDeviceDisconnectRequested; static jmethodID method_onCreatePairedDeviceResult; static jmethodID method_onGetDeviceServiceChannelResult; @@ -84,6 +85,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { "(Ljava/lang/String;)V"); method_onDeviceCreated = env->GetMethodID(clazz, "onDeviceCreated", "(Ljava/lang/String;)V"); method_onDeviceRemoved = env->GetMethodID(clazz, "onDeviceRemoved", "(Ljava/lang/String;)V"); + method_onDeviceDisconnectRequested = env->GetMethodID(clazz, "onDeviceDisconnectRequested", + "(Ljava/lang/String;)V"); method_onCreatePairedDeviceResult = env->GetMethodID(clazz, "onCreatePairedDeviceResult", "(Ljava/lang/String;I)V"); @@ -815,6 +818,14 @@ static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, str_array); } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); goto success; + } else if (dbus_message_is_signal(msg, + "org.bluez.Device", + "DisconnectRequested")) { + const char *remote_device_path = dbus_message_get_path(msg); + env->CallVoidMethod(nat->me, + method_onDeviceDisconnectRequested, + env->NewStringUTF(remote_device_path)); + goto success; } ret = a2dp_event_filter(msg, env); |