/*static*/ void SmsManager::NotifyThreadCursorResult(int64_t aId, jni::String::Param aLastMessageSubject, jni::String::Param aBody, int64_t aUnreadCount, jni::ObjectArray::Param aParticipants, int64_t aTimestamp, jni::String::Param aLastMessageType, int32_t aRequestId) { ThreadData thread; thread.id() = aId; thread.lastMessageSubject() = aLastMessageSubject ? aLastMessageSubject->ToString() : EmptyString(); thread.body() = aBody ? aBody->ToString() : EmptyString(); thread.unreadCount() = aUnreadCount; thread.timestamp() = aTimestamp; thread.lastMessageType() = eMessageType_SMS; JNIEnv* const env = jni::GetEnvForThread(); jobjectArray participants = aParticipants.Get(); jsize length = env->GetArrayLength(participants); for (jsize i = 0; i < length; ++i) { jstring participant = static_cast<jstring>(env->GetObjectArrayElement(participants, i)); if (participant) { thread.participants().AppendElement(nsJNIString(participant, env)); } } nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=]() { nsCOMPtr<nsIMobileMessageCursorCallback> request = AndroidBridge::Bridge()->GetSmsCursorRequest(aRequestId); if (!request) { return; } nsCOMArray<nsIMobileMessageThread> arr; arr.AppendElement(new MobileMessageThreadInternal(thread)); nsIMobileMessageThread** elements; int32_t size; size = arr.Forget(&elements); request->NotifyCursorResult(reinterpret_cast<nsISupports**>(elements), size); }); NS_DispatchToMainThread(runnable); }