summaryrefslogtreecommitdiffstats
path: root/core/jni/android_server_BluetoothService.cpp
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2011-06-25 21:47:07 -0700
committerMatthew Xie <mattx@google.com>2011-07-07 12:43:27 -0700
commita0c680393f2dd03a937c598b2cb9abf98a58152c (patch)
treed8d240310c4a4d31d9215174643a95da016bc0c0 /core/jni/android_server_BluetoothService.cpp
parentb75a798471342da5e4624048c5516773dfecf4ca (diff)
downloadframeworks_base-a0c680393f2dd03a937c598b2cb9abf98a58152c.zip
frameworks_base-a0c680393f2dd03a937c598b2cb9abf98a58152c.tar.gz
frameworks_base-a0c680393f2dd03a937c598b2cb9abf98a58152c.tar.bz2
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
Diffstat (limited to 'core/jni/android_server_BluetoothService.cpp')
-rw-r--r--core/jni/android_server_BluetoothService.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 036c34c..1166ae4 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -255,7 +255,7 @@ done:
}
static jboolean stopDiscoveryNative(JNIEnv *env, jobject object) {
- LOGV(__FUNCTION__);
+ LOGV("%s", __FUNCTION__);
#ifdef HAVE_BLUETOOTH
DBusMessage *msg = NULL;
DBusMessage *reply = NULL;
@@ -616,6 +616,35 @@ static jboolean setRemoteOutOfBandDataNative(JNIEnv *env, jobject object, jstrin
return JNI_FALSE;
}
+static jboolean setAuthorizationNative(JNIEnv *env, jobject object, jstring address,
+ jboolean val, int nativeData) {
+#ifdef HAVE_BLUETOOTH
+ LOGV("%s", __FUNCTION__);
+ native_data_t *nat = get_native_data(env, object);
+ if (nat) {
+ DBusMessage *msg = (DBusMessage *)nativeData;
+ DBusMessage *reply;
+ if (val) {
+ reply = dbus_message_new_method_return(msg);
+ } else {
+ reply = dbus_message_new_error(msg,
+ "org.bluez.Error.Rejected", "Authorization rejected");
+ }
+ if (!reply) {
+ LOGE("%s: Cannot create message reply D-Bus\n", __FUNCTION__);
+ dbus_message_unref(msg);
+ return JNI_FALSE;
+ }
+
+ dbus_connection_send(nat->conn, reply, NULL);
+ dbus_message_unref(msg);
+ dbus_message_unref(reply);
+ return JNI_TRUE;
+ }
+#endif
+ return JNI_FALSE;
+}
+
static jboolean setPinNative(JNIEnv *env, jobject object, jstring address,
jstring pin, int nativeData) {
#ifdef HAVE_BLUETOOTH
@@ -1692,6 +1721,7 @@ static JNINativeMethod sMethods[] = {
(void *)setPairingConfirmationNative},
{"setPasskeyNative", "(Ljava/lang/String;II)Z", (void *)setPasskeyNative},
{"setRemoteOutOfBandDataNative", "(Ljava/lang/String;[B[BI)Z", (void *)setRemoteOutOfBandDataNative},
+ {"setAuthorizationNative", "(Ljava/lang/String;ZI)Z", (void *)setAuthorizationNative},
{"setPinNative", "(Ljava/lang/String;Ljava/lang/String;I)Z", (void *)setPinNative},
{"cancelPairingUserInputNative", "(Ljava/lang/String;I)Z",
(void *)cancelPairingUserInputNative},