An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix me
rustdesk260d0cdc678b
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.ktindex 1730e3527..b3b00b625 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.*+import ffi.RustDesk/*** 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")- init(this)+ RustDesk.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 flutterval prefs = applicationContext.getSharedPreferences(KEY_SHARED_PREFERENCES, FlutterActivity.MODE_PRIVATE)val configPath = prefs.getString(KEY_APP_DIR_CONFIG_PATH, "") ?: ""- startServer(configPath)+ RustDesk.startServer(configPath)createForegroundNotification()}@@ -262,7 +262,7 @@ class MainService : Service() {SCREEN_INFO.dpi = dpiif (isStart) {stopCapture()- refreshScreen()+ RustDesk.refreshScreen()startCapture()}}@@ -290,7 +290,7 @@ class MainService : Service() {createForegroundNotification()if (intent.getBooleanExtra(EXT_INIT_FROM_BOOT, false)) {- startService()+ RustDesk.startService()}Log.d(logTag, "service starting: ${startId}:${Thread.currentThread()}")val mediaProjectionManager =@@ -343,7 +343,7 @@ class MainService : Service() {val planes = image.planesval buffer = planes[0].bufferbuffer.rewind()- onVideoFrameUpdate(buffer)+ RustDesk.onVideoFrameUpdate(buffer)}} catch (ignored: java.lang.Exception) {}@@ -377,16 +377,16 @@ class MainService : Service() {}checkMediaPermission()_isStart = true- setFrameRawEnable("video",true)- setFrameRawEnable("audio",true)+ RustDesk.setFrameRawEnable("video",true)+ RustDesk.setFrameRawEnable("audio",true)return true}@Synchronizedfun stopCapture() {Log.d(logTag, "Stop Capture")- setFrameRawEnable("video",false)- setFrameRawEnable("audio",false)+ RustDesk.setFrameRawEnable("video",false)+ RustDesk.setFrameRawEnable("audio",false)_isStart = false// release videovirtualDisplay?.release()@@ -521,7 +521,7 @@ class MainService : Service() {thread {while (audioRecordStat) {audioReader!!.readSync(audioRecorder!!)?.let {- onAudioFrameUpdate(it)+ RustDesk.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.ktindex e2382c647..62d203a27 100644--- a/flutter/android/app/src/main/kotlin/ffi.kt+++ b/flutter/android/app/src/main/kotlin/ffi.kt@@ -5,15 +5,17 @@ package ffiimport android.content.Contextimport java.nio.ByteBuffer-init {- System.loadLibrary("rustdesk")-}+object RustDesk {+ init {+ System.loadLibrary("rustdesk")+ }-external fun init(ctx: Context)-external fun startServer(app_dir: String)-external fun startService()-external fun onVideoFrameUpdate(buf: ByteBuffer)-external fun onAudioFrameUpdate(buf: ByteBuffer)-external fun translateLocale(localeName: String, input: String): String-external fun refreshScreen()-external fun setFrameRawEnable(name: String, value: Boolean)\ No newline at end of file+ external fun init(ctx: Context)+ external fun startServer(app_dir: String)+ external fun startService()+ external fun onVideoFrameUpdate(buf: ByteBuffer)+ external fun onAudioFrameUpdate(buf: ByteBuffer)+ external fun translateLocale(localeName: String, input: String): String+ external fun refreshScreen()+ external fun setFrameRawEnable(name: String, value: Boolean)+}\ No newline at end of file