diff options
author | Matthew Xie <mattx@google.com> | 2011-07-26 18:36:49 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2011-07-28 15:56:11 -0700 |
commit | 269e81a563cfe080d7f241d0d46411d3c946c111 (patch) | |
tree | fb62527f5a1dc5bda21202c87e7c026a6c914ed1 /core/jni/android_server_BluetoothService.cpp | |
parent | 686200cb5f3e80c0b0519ec14cc54b280a560863 (diff) | |
download | frameworks_base-269e81a563cfe080d7f241d0d46411d3c946c111.zip frameworks_base-269e81a563cfe080d7f241d0d46411d3c946c111.tar.gz frameworks_base-269e81a563cfe080d7f241d0d46411d3c946c111.tar.bz2 |
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
Diffstat (limited to 'core/jni/android_server_BluetoothService.cpp')
-rw-r--r-- | core/jni/android_server_BluetoothService.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp index 86e7cc0..41056fd 100644 --- a/core/jni/android_server_BluetoothService.cpp +++ b/core/jni/android_server_BluetoothService.cpp @@ -895,6 +895,18 @@ static jboolean setDevicePropertyBooleanNative(JNIEnv *env, jobject object, #endif } +static jboolean setDevicePropertyStringNative(JNIEnv *env, jobject object, + jstring path, jstring key, jstring value) { +#ifdef HAVE_BLUETOOTH + const char *c_value = env->GetStringUTFChars(value, NULL); + jboolean ret = setDevicePropertyNative(env, object, path, key, + (void *)&c_value, DBUS_TYPE_STRING); + env->ReleaseStringUTFChars(value, (char *)c_value); + return ret; +#else + return JNI_FALSE; +#endif +} static jboolean createDeviceNative(JNIEnv *env, jobject object, jstring address) { @@ -1718,6 +1730,8 @@ static JNINativeMethod sMethods[] = { (void *)cancelPairingUserInputNative}, {"setDevicePropertyBooleanNative", "(Ljava/lang/String;Ljava/lang/String;I)Z", (void *)setDevicePropertyBooleanNative}, + {"setDevicePropertyStringNative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", + (void *)setDevicePropertyStringNative}, {"createDeviceNative", "(Ljava/lang/String;)Z", (void *)createDeviceNative}, {"discoverServicesNative", "(Ljava/lang/String;Ljava/lang/String;)Z", (void *)discoverServicesNative}, {"addRfcommServiceRecordNative", "(Ljava/lang/String;JJS)I", (void *)addRfcommServiceRecordNative}, |