diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:56 -0700 |
commit | c39a6e0c51e182338deb8b63d07933b585134929 (patch) | |
tree | e55fc5bd38b1eb8fb4851a0fe1cc264a7fe2f245 /core/jni | |
parent | b2a3dd88a53cc8c6d19f6dc8ec4f3d6c4abd9b54 (diff) | |
download | frameworks_base-c39a6e0c51e182338deb8b63d07933b585134929.zip frameworks_base-c39a6e0c51e182338deb8b63d07933b585134929.tar.gz frameworks_base-c39a6e0c51e182338deb8b63d07933b585134929.tar.bz2 |
auto import from //branches/cupcake/...@137873
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 2 | ||||
-rw-r--r-- | core/jni/android_server_BluetoothEventLoop.cpp | 39 |
2 files changed, 40 insertions, 1 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 28c602b..f4643f4 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -220,7 +220,7 @@ int register_com_android_internal_os_RuntimeInit(JNIEnv* env) AndroidRuntime::AndroidRuntime() { - SkGraphics::Init(false); // true means run unittests (slow) + SkGraphics::Init(); // this sets our preference for 16bit images during decode // in case the src is opaque and 24bit SkImageDecoder::SetDeviceConfig(SkBitmap::kRGB_565_Config); diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp index adfd912..c03bab6 100644 --- a/core/jni/android_server_BluetoothEventLoop.cpp +++ b/core/jni/android_server_BluetoothEventLoop.cpp @@ -61,6 +61,8 @@ static jmethodID method_onPasskeyAgentCancel; static jmethodID method_onAuthAgentAuthorize; static jmethodID method_onAuthAgentCancel; +static jmethodID method_onRestartRequired; + typedef event_loop_native_data_t native_data_t; // Only valid during waitForAndDispatchEventNative() @@ -99,6 +101,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_onAuthAgentCancel = env->GetMethodID(clazz, "onAuthAgentCancel", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); method_onGetRemoteServiceChannelResult = env->GetMethodID(clazz, "onGetRemoteServiceChannelResult", "(Ljava/lang/String;I)V"); + method_onRestartRequired = env->GetMethodID(clazz, "onRestartRequired", "()V"); + field_mNativeData = env->GetFieldID(clazz, "mNativeData", "I"); #endif } @@ -165,6 +169,13 @@ static jboolean setUpEventLoopNative(JNIEnv *env, jobject object) { // Set which messages will be processed by this dbus connection dbus_bus_add_match(nat->conn, + "type='signal',interface='org.freedesktop.DBus'", + &err); + if (dbus_error_is_set(&err)) { + LOG_AND_FREE_DBUS_ERROR(&err); + return JNI_FALSE; + } + dbus_bus_add_match(nat->conn, "type='signal',interface='"BLUEZ_DBUS_BASE_IFC".Adapter'", &err); if (dbus_error_is_set(&err)) { @@ -302,6 +313,12 @@ static void tearDownEventLoopNative(JNIEnv *env, jobject object) { if (dbus_error_is_set(&err)) { LOG_AND_FREE_DBUS_ERROR(&err); } + dbus_bus_remove_match(nat->conn, + "type='signal',interface='org.freedesktop.DBus'", + &err); + if (dbus_error_is_set(&err)) { + LOG_AND_FREE_DBUS_ERROR(&err); + } dbus_connection_remove_filter(nat->conn, event_filter, nat); } @@ -509,6 +526,28 @@ static DBusHandlerResult event_filter(DBusConnection *conn, DBusMessage *msg, env->NewStringUTF(c_name)); } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); return DBUS_HANDLER_RESULT_HANDLED; + } else if (dbus_message_is_signal(msg, + "org.freedesktop.DBus", + "NameOwnerChanged")) { + char *c_name; + char *c_old_owner; + char *c_new_owner; + if (dbus_message_get_args(msg, &err, + DBUS_TYPE_STRING, &c_name, + DBUS_TYPE_STRING, &c_old_owner, + DBUS_TYPE_STRING, &c_new_owner, + DBUS_TYPE_INVALID)) { + LOGV("... name = %s", c_name); + LOGV("... old_owner = %s", c_old_owner); + LOGV("... new_owner = %s", c_new_owner); + if (!strcmp(c_name, "org.bluez") && c_new_owner[0] != '\0') { + // New owner of org.bluez. This can only happen when hcid + // restarts. Need to restart framework BT services to recover. + LOGE("Looks like hcid restarted"); + env->CallVoidMethod(nat->me, method_onRestartRequired); + } + } else LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, msg); + return DBUS_HANDLER_RESULT_HANDLED; } return a2dp_event_filter(msg, env); |