From 5f8a9222014f2731b09b77208fa4d2632846221b Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 17 Apr 2022 08:14:18 +0500 Subject: [PATCH] Added: Allow users to disable `termux-am` server The user can add `run-termux-am-socket-server=false` entry to `termux.properties` file to disable the `termux-am` server to run at app startup which is connected to by `$PREFIX/bin/termux-am` from the `termux-am-socket` package. The default value is `true`. Changes require `termux-app` to be force stopped and restarted to provide consistent state for all termux sessions and tasks. The prop will be used in a later commit. --- .../settings/properties/TermuxPropertyConstants.java | 10 +++++++++- .../settings/properties/TermuxSharedProperties.java | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxPropertyConstants.java b/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxPropertyConstants.java index 34e3dfed..643b1ddd 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxPropertyConstants.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxPropertyConstants.java @@ -1,6 +1,7 @@ package com.termux.shared.termux.settings.properties; import com.google.common.collect.ImmutableBiMap; +import com.termux.shared.termux.shell.am.TermuxAmSocketServer; import com.termux.shared.theme.NightMode; import com.termux.shared.file.FileUtils; import com.termux.shared.file.filesystem.FileType; @@ -120,6 +121,11 @@ public final class TermuxPropertyConstants { + /** Defines the key for whether the {@link TermuxAmSocketServer} should be run at app startup */ + public static final String KEY_RUN_TERMUX_AM_SOCKET_SERVER = "run-termux-am-socket-server"; // Default: "run-termux-am-socket-server" + + + /** Defines the key for whether url links in terminal transcript will automatically open on click or on tap */ public static final String KEY_TERMINAL_ONCLICK_URL_OPEN = "terminal-onclick-url-open"; // Default: "terminal-onclick-url-open" @@ -379,6 +385,7 @@ public final class TermuxPropertyConstants { KEY_ENFORCE_CHAR_BASED_INPUT, KEY_EXTRA_KEYS_TEXT_ALL_CAPS, KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP, + KEY_RUN_TERMUX_AM_SOCKET_SERVER, KEY_TERMINAL_ONCLICK_URL_OPEN, KEY_USE_CTRL_SPACE_WORKAROUND, KEY_USE_FULLSCREEN, @@ -436,7 +443,8 @@ public final class TermuxPropertyConstants { * default: true */ public static final Set TERMUX_DEFAULT_TRUE_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList( - KEY_EXTRA_KEYS_TEXT_ALL_CAPS + KEY_EXTRA_KEYS_TEXT_ALL_CAPS, + KEY_RUN_TERMUX_AM_SOCKET_SERVER )); /** Defines the set for keys loaded by termux that have default inverted boolean behaviour with false as default. diff --git a/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxSharedProperties.java b/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxSharedProperties.java index 4b1b7bfd..ad863e9c 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxSharedProperties.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/settings/properties/TermuxSharedProperties.java @@ -583,6 +583,10 @@ public abstract class TermuxSharedProperties { return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP, true); } + public boolean shouldRunTermuxAmSocketServer() { + return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_RUN_TERMUX_AM_SOCKET_SERVER, true); + } + public boolean shouldOpenTerminalTranscriptURLOnClick() { return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_TERMINAL_ONCLICK_URL_OPEN, true); }