The `copyTextToClipboard()` method has been updated to pass clip label when copying text to clipboard and `getTextFromClipboard()` and `getTextStringFromClipboardIfSet()` methods have been added to get current clipboard.
Previously, bootstrap was only installed if `$PREFIX` didn't exist, was empty or only had `$PREFIX/tmp`. But now with 03e1d14e, `$PREFIX/etc/termux/termux.env` was also created at app startup before bootstrap check was made, hence it was being assumed that bootstrap was already installed.
Now, bootstrap will be installed even if `$PREFIX/tmp`, `$PREFIX/etc/termux/termux.env.tmp` or `$PREFIX/etc/termux/termux.env` exist but no other files do.
Closes#2844
Attempting to bypass restrictions while tests are running will fail due to call to `TermuxApplication.onCreate()` -> `TermuxShellEnvironment.init()` -> `SELinuxUtils.getContext()`
The user can add `disable-file-share-receiver=true` entry to `termux.properties` file to disable termux from showing in Android file `Share With` apps list.
The user can add `disable-file-view-receiver=true` entry to `termux.properties` file to disable termux from showing in Android file `Open With` apps list.
The default value is `false`. Restarting termux app or running `termux-reload-settings` command will update the behaviour instantaneously if changed.
Closes#2549
This commit adds onto 841c41bf and implements the `setTerminalShellPid()` interface method in `TermuxTerminalSessionServiceClient` so that `pid` is set properly for all cases.
Addition of `TermuxTerminalSessionServiceClient` is required so that interface methods that `TermuxService` can handle without `TermuxActivity` should implemented instead of relying on base implementation of `TermuxTerminalSessionClientBase`.
- `settings_enable_monitor_phantom_procs` feature flag value can be received with a call to `getFeatureFlagMonitorPhantomProcsValueString()`. Likely only available on Android `12L+`.
- `max_phantom_processes` value from `dumpsys activity settings` output can be received with a call to `getActivityManagerMaxPhantomProcesses()`. Requires granting Termux `DUMP` and `PACKAGE_USAGE_STATS` permission. Can be granted with `adb shell "pm grant com.termux android.permission.PACKAGE_USAGE_STATS; pm grant com.termux android.permission.DUMP"` and revoked with `adb shell "pm revoke com.termux android.permission.PACKAGE_USAGE_STATS; pm revoke com.termux android.permission.DUMP"`.
- `device_config_sync_disabled` settings global namespace value can be received with a call to `getSettingsGlobalDeviceConfigSyncDisabled()`.
The `termux.env` can be sourced by shells to set termux environment normally exported. This can be useful for users starting termux shells with `adb` `run-as` or `root`. The file will not contain `SHELL_CMD__` variables since those are shell command specific.
The items in the `termux.env` file have the format `export name="value"`.
The `"`\$` characters will be escaped with `a backslash `\`, like `\"` if characters are for literal value. Note that if `$` is escaped and if its part of variable, then variable expansion will not happen if `.env` file is sourced. The `\` at the end of a value line means line continuation. Value can contain newline characters.
The `termux.env` file should be sourceable by `POSIX` compliant shells like `bash`, `zsh`, `sh`, android's `mksh`, etc. Other shells with require manual parsing of the file to export variables.
Related discussion #2565
This will currently cache `TermuxAppShellEnvironment` so that its not regenerated for each shell started since it contains some slightly expensive operations.
This adds onto f102ea20 to build termux environment. Variables for `ExecutionCommand` app have the `SHELL_CMD__` scope. Docs will be provided for details of the variables.
- `SHELL_CMD__SHELL_ID`
- `SHELL_CMD__SHELL_NAME`
- `SHELL_CMD__APP_SHELL_NUMBER_SINCE_BOOT`
- `SHELL_CMD__TERMINAL_SESSION_NUMBER_SINCE_BOOT`
- `SHELL_CMD__APP_SHELL_NUMBER_SINCE_APP_START`
- `SHELL_CMD__TERMINAL_SESSION_NUMBER_SINCE_APP_START`
The commit also adds `SystemEventReceiver` to Termux app that will receive `ACTION_BOOT_COMPLETED`.
This adds onto f102ea20 to build termux environment. Variables for `Termux` app have the `TERMUX_APP__` scope and variables for `Termux:API` app have `TERMUX_API_APP__` scope, which allows easier management for variables and know which variable belongs to which component. Some variables that were added in the last `termux-app` `v0.118.0` release have been renamed as per scoped variable design. The `TERMUX_VERSION` variable will stay as is for backward compatibility and will be duplicate of `TERMUX_APP__VERSION_NAME`. Docs will be provided for details of the variables.
- `TERMUX_APP__VERSION_NAME`
- `TERMUX_APP__VERSION_CODE`
- `TERMUX_APP__PACKAGE_NAME`
- `TERMUX_APP__PID` (previously `TERMUX_APP_PID`)
- `TERMUX_APP__UID`
- `TERMUX_APP__TARGET_SDK`
- `TERMUX_APP__IS_DEBUGGABLE_BUILD` (previously `TERMUX_IS_DEBUGGABLE_BUILD`)
- `TERMUX_APP__APK_RELEASE` (previously `TERMUX_APK_RELEASE`)
- `TERMUX_APP__APK_PATH`
- `TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE`
- `TERMUX_APP__SE_PROCESS_CONTEXT`
- `TERMUX_APP__SE_FILE_CONTEXT`
- `TERMUX_APP__SE_INFO`
- `TERMUX_APP__USER_ID`
- `TERMUX_APP__PROFILE_OWNER`
- `TERMUX_APP__PACKAGE_MANAGER` (previously `TERMUX_APP_PACKAGE_MANAGER`)
- `TERMUX_APP__PACKAGE_VARIANT` (previously `TERMUX_APP_PACKAGE_VARIANT`)
- `TERMUX_APP__FILES_DIR`
- `TERMUX_APP__AM_SOCKET_SERVER_ENABLED` (previously `TERMUX_APP_AM_SOCKET_SERVER_ENABLED`)
- `TERMUX_API_APP__VERSION_NAME` (previously `TERMUX_API_VERSION`)
- `ShellEnvironmentClient` has been renamed to `IShellEnvironment` with certain changes to its interface methods, including requirement for `Execution` command itself for `setupShellCommandEnvironment()`.
- `UnixShellEnvironment` implements the `IShellEnvironment` interface as is the abstract base class of all other shell environments.
- `AndroidShellEnvironment` extends from the `UnixShellEnvironment` class and provides an environment that would work for Android shells. This is `MIT` licensed and can be used by users importing the `termux-shared` library or the library itself to run `AppShell` shells. Previously, `TermuxShellEnvironmentClient` existed which was `GPLv3` licensed and it would not have been possible to use it for non-GPL code.
- `TermuxShellEnvironment` extends from the `AndroidShellEnvironment` class and adds/overrides additional environment variables required for Termux shells to work, including setting `HOME`, `TMPDIR`, `PATH` and `LD_LIBRARY_PATH` appropriately. Termux app related variables will be added in a later commit. `TermuxShellEnvironment` replaces `TermuxShellEnvironmentClient` and is `GPLv3` licensed.