Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

ffi.RustDesk -> ffi.FFI

rustdesk05f6fde4672e
diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt
index b3b00b625..9fea4d4d3 100644
--- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt
+++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainService.kt
@@ -1,6 +1,6 @@
package com.carriez.flutter_hbb
-import ffi.RustDesk
+import ffi.FFI
/**
* Capture screen,get video and audio,send to rust.
@@ -195,7 +195,7 @@ class MainService : Service() {
override fun onCreate() {
super.onCreate()
Log.d(logTag,"MainService onCreate")
- RustDesk.init(this)
+ FFI.init(this)
HandlerThread("Service", Process.THREAD_PRIORITY_BACKGROUND).apply {
start()
serviceLooper = looper
@@ -207,7 +207,7 @@ class MainService : Service() {
// keep the config dir same with flutter
val prefs = applicationContext.getSharedPreferences(KEY_SHARED_PREFERENCES, FlutterActivity.MODE_PRIVATE)
val configPath = prefs.getString(KEY_APP_DIR_CONFIG_PATH, "") ?: ""
- RustDesk.startServer(configPath)
+ FFI.startServer(configPath)
createForegroundNotification()
}
@@ -262,7 +262,7 @@ class MainService : Service() {
SCREEN_INFO.dpi = dpi
if (isStart) {
stopCapture()
- RustDesk.refreshScreen()
+ FFI.refreshScreen()
startCapture()
}
}
@@ -290,7 +290,7 @@ class MainService : Service() {
createForegroundNotification()
if (intent.getBooleanExtra(EXT_INIT_FROM_BOOT, false)) {
- RustDesk.startService()
+ FFI.startService()
}
Log.d(logTag, "service starting: ${startId}:${Thread.currentThread()}")
val mediaProjectionManager =
@@ -343,7 +343,7 @@ class MainService : Service() {
val planes = image.planes
val buffer = planes[0].buffer
buffer.rewind()
- RustDesk.onVideoFrameUpdate(buffer)
+ FFI.onVideoFrameUpdate(buffer)
}
} catch (ignored: java.lang.Exception) {
}
@@ -377,16 +377,16 @@ class MainService : Service() {
}
checkMediaPermission()
_isStart = true
- RustDesk.setFrameRawEnable("video",true)
- RustDesk.setFrameRawEnable("audio",true)
+ FFI.setFrameRawEnable("video",true)
+ FFI.setFrameRawEnable("audio",true)
return true
}
@Synchronized
fun stopCapture() {
Log.d(logTag, "Stop Capture")
- RustDesk.setFrameRawEnable("video",false)
- RustDesk.setFrameRawEnable("audio",false)
+ FFI.setFrameRawEnable("video",false)
+ FFI.setFrameRawEnable("audio",false)
_isStart = false
// release video
virtualDisplay?.release()
@@ -521,7 +521,7 @@ class MainService : Service() {
thread {
while (audioRecordStat) {
audioReader!!.readSync(audioRecorder!!)?.let {
- RustDesk.onAudioFrameUpdate(it)
+ FFI.onAudioFrameUpdate(it)
}
}
Log.d(logTag, "Exit audio thread")
diff --git a/flutter/android/app/src/main/kotlin/ffi.kt b/flutter/android/app/src/main/kotlin/ffi.kt
index 62d203a27..d61bccfd6 100644
--- a/flutter/android/app/src/main/kotlin/ffi.kt
+++ b/flutter/android/app/src/main/kotlin/ffi.kt
@@ -5,7 +5,7 @@ package ffi
import android.content.Context
import java.nio.ByteBuffer
-object RustDesk {
+object FFI {
init {
System.loadLibrary("rustdesk")
}
diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs
index bfc6042ee..e27b4140e 100644
--- a/src/flutter_ffi.rs
+++ b/src/flutter_ffi.rs
@@ -2108,7 +2108,7 @@ pub mod server_side {
use crate::start_server;
#[no_mangle]
- pub unsafe extern "system" fn Java_ffi_RustDesk_startServer(
+ pub unsafe extern "system" fn Java_ffi_FFI_startServer(
env: JNIEnv,
_class: JClass,
app_dir: JString,
@@ -2122,7 +2122,7 @@ pub mod server_side {
}
#[no_mangle]
- pub unsafe extern "system" fn Java_ffi_RustDesk_startService(
+ pub unsafe extern "system" fn Java_ffi_FFI_startService(
_env: JNIEnv,
_class: JClass,
) {
@@ -2132,7 +2132,7 @@ pub mod server_side {
}
#[no_mangle]
- pub unsafe extern "system" fn Java_ffi_RustDesk_translateLocale(
+ pub unsafe extern "system" fn Java_ffi_FFI_translateLocale(
env: JNIEnv,
_class: JClass,
locale: JString,
@@ -2151,7 +2151,7 @@ pub mod server_side {
}
#[no_mangle]
- pub unsafe extern "system" fn Java_ffi_RustDesk_refreshScreen(
+ pub unsafe extern "system" fn Java_ffi_FFI_refreshScreen(
_env: JNIEnv,
_class: JClass,
) {