From ed4f1d6f2c5df4fd931913bdd549016d00ec9154 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 13 Aug 2025 17:51:04 -0400 Subject: [PATCH] android: Be smarter about the file watcher. --- GNUmakefile | 5 +++++ .../unprompted/tildefriends/TildeFriendsActivity.java | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index f3b11d8cc..eb02ac25f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1140,6 +1140,11 @@ releaseapkgo: out/TildeFriends-arm-release.apk ## Build, install, and run a rele @adb shell am start com.unprompted.tildefriends/.TildeFriendsActivity .PHONY: releaseapkgo +x86releaseapkgo: out/TildeFriends-x86-release.apk ## Build, install, and run an x86 release Android APK. + @adb install -r $< + @adb shell am start com.unprompted.tildefriends/.TildeFriendsActivity +.PHONY: x86releaseapkgo + apklog: ## Display Android log output. @adb logcat *:S tildefriends .PHONY: apklog diff --git a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java index 5a74887bf..8b466f5a1 100644 --- a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java +++ b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java @@ -81,14 +81,14 @@ public class TildeFriendsActivity extends Activity { TildeFriendsActivity activity = this; - Log.w("tildefriends", "Watching for changes in: " + getFilesDir().toString()); - observer = make_file_observer(getFilesDir().toString(), port_file_path); - observer.startWatching(); - set_status("Starting server..."); server_thread = new Thread(new Runnable() { @Override public void run() { + Log.w("tildefriends", "Watching for changes in: " + getFilesDir().toString()); + observer = make_file_observer(getFilesDir().toString(), port_file_path); + observer.startWatching(); + Log.w("tildefriends", "Calling tf_server_main."); int result = tf_server_main( getFilesDir().toString(), @@ -445,6 +445,7 @@ public class TildeFriendsActivity extends Activity { hide_status(); web_view.loadUrl(base_url + "login/auto"); }); + observer.stopWatching(); observer = null; } else { runOnUiThread(() -> {