fix(android): move the log toggle native into ffi.FFI

Custom clients move the Kotlin classes out of com.carriez.flutter_hbb.
DocumentLogs declared setEnabled as a native method, so its export
Java_com_carriez_flutter_1hbb_DocumentLogs_setEnabled did not link
there and the app crashed on start with UnsatisfiedLinkError. The
ffi package keeps its name, so declare the native in ffi.FFI like the
others and call it from DocumentLogs.

Fixes rustdesk/rustdesk-server-pro#1035

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
This commit is contained in:
rustdeskandClaude Opus 5.5 committed 2026-11-12 20:41:43 +08:00
1 parent 1ac53ccb1b
commit f3a5bf551d
3 files changed
+4 -3

No files matched your search

@@ -7,6 +7,7 @@ import android.os.ParcelFileDescriptor
import android.provider.DocumentsContract
import android.provider.DocumentsContract.Document
import android.util.Log
import ffi.FFI
import java.io.FileNotFoundException
import java.io.IOException
import java.util.UUID
@@ -31,8 +32,7 @@ internal class DocumentLogs(private val context: Context) {
setEnabled(grant() != null)
}
@androidx.annotation.Keep
private external fun setEnabled(enabled: Boolean)
private fun setEnabled(enabled: Boolean) = FFI.setDocumentLogsEnabled(enabled)
private fun grant(): Uri? = prefs.getString(LOG_GRANT, null)?.let(Uri::parse)
@@ -28,4 +28,5 @@ object FFI {
external fun getBuildinOption(key: String): String
external fun onClipboardUpdate(clips: ByteBuffer)
external fun isServiceClipboardEnabled(): Boolean
external fun setDocumentLogsEnabled(enabled: Boolean)
}
+1 -1
View File
@@ -26,7 +26,7 @@ const DEFAULT_LOG_FILE_COUNT: usize = 90;
static PUBLIC_LOGS_ENABLED: AtomicBool = AtomicBool::new(true);
#[no_mangle]
pub extern "system" fn Java_com_carriez_flutter_1hbb_DocumentLogs_setEnabled(
pub extern "system" fn Java_ffi_FFI_setDocumentLogsEnabled(
_env: jni::JNIEnv,
_instance: jni::objects::JObject,
enabled: jni::sys::jboolean,