Commit Graph

223 Commits

Author SHA1 Message Date
agnostic-apollo
477b36acd1 Added: Add support for ACTION_NOTIFY_APP_CRASH in receiver registered by TermuxActivity to notify users of plugin app crashes
Once plugins integrate changes for `TermuxCrashUtils.onPostLogCrash()`, they will send the `ACTION_NOTIFY_APP_CRASH` broadcast when an uncaught exception is caught by `CrashHandler`. If `TermuxActivity` is in foreground, then it will receive the broadcast and notify user of the crash by reading it from the crash log file without the user having to restart termux app to be notified.
2022-03-17 02:10:51 +05:00
agnostic-apollo
5f00531381 Changed: Move com.termux.app.utils.CrashUtils to com.termux.shared.termux.crash.TermuxCrashUtils so that plugins trigger plugin notifications too
Calls to `notifyAppCrashFromCrashLogFile()` will now be synchronized as well.
2022-03-17 02:10:51 +05:00
agnostic-apollo
4dbfc1fac8 Added: Add support for onPreLogCrash() and onPostLogCrash() in CrashHandler so that CrashHandlerClient can decide which exceptions to log and add custom logic 2022-03-17 02:10:51 +05:00
agnostic-apollo
4b07e4f4c0 Added: Add multi process support in TermuxAppSharedPreferences since plugin apps may need to read values modified by termux app process 2022-03-17 02:10:51 +05:00
agnostic-apollo
621545dd0a Added: Add support for getting termux app and plugin app info only in TermuxUtils.getAppInfoMarkdownString() 2022-03-17 02:10:51 +05:00
agnostic-apollo
9a65aa4589 Fixed: Do not add double heading if callingPackageName passed to TermuxUtils.getAppInfoMarkdownString() is a plugin app 2022-03-17 02:10:51 +05:00
agnostic-apollo
021cb60e23 Added: Add TERMUX_API_APT_* constants 2022-03-17 02:10:51 +05:00
agnostic-apollo
14c5fc7b1e Fixed: Suppress warnings for requiring android 11 to request MANAGE_EXTERNAL_STORAGE permission and call Environment.isExternalStorageManager() 2022-03-17 02:10:51 +05:00
agnostic-apollo
792c33c9a5 Fixed: Fix PermissionUtils.requestPermissions() not requesting multiple permissions correctly 2022-03-17 02:10:51 +05:00
agnostic-apollo
c3ac30e2fb Added: Add ic_info and ic_settings 2022-03-11 20:16:50 +05:00
agnostic-apollo
b94dc7eea9 Changed|Deprecated: Move from shell command background mode to command runner
This starts the support for adb, root and other custom runners for shell commands. Previously only terminal and background tasks in app shells were supported.

`TERMUX_SERVICE.EXTRA_BACKGROUND` and `RUN_COMMAND_SERVICE.EXTRA_BACKGROUND` extras have been deprecated and instead respective `EXTRA_RUNNER` extra keys should be used. Currently supported extra values are `terminal-session` and `app-shell`. In future, `adb-shell` and `root-shell` are planned to be supported as well.
2022-03-10 02:51:56 +05:00
agnostic-apollo
05283bd774 Changed: Load termux.properties into a single static app wide TermuxAppSharedProperties class
The `TermuxAppSharedProperties.properties` will exist in `termux-shared` library and only the single static instance will be reloaded whenever needed, instead of different activities and services maintaining their own instances. The classes in `termux-shared` library will also get access to the properties for their own needs.

The night mode set in `TermuxApplication` and terminal rows set in `TermuxService` will no longer require loading props from disk.

Updating `allow-external-apps` value will now require restarting termux or running `termux-reload-settings` since value will no longer be loaded from disk every time.
2022-03-10 02:37:10 +05:00
agnostic-apollo
6d944b5f7f Changed: Use application context for SharedProperties 2022-03-10 02:37:10 +05:00
agnostic-apollo
68cdbd6ff4 Added: Add support for getting feature flag values and show MONITOR_PHANTOM_PROCS value in about page
MONITOR_PHANTOM_PROCS will only be shown in Android 12+ devices and will be marked "<unsupported>" if its not supported in current android build. It will show in Termux Settings->About->Device Info->Software and in reports. Flag is available on Pixel Android 12L beta 3 and Android 13. Check FeatureFlagUtils for more details.

Getting supported feature flags and their values is done through reflection on android "android.util.FeatureFlagUtils" class and requires bypassing android hidden API restrictions.

Related issue #2366
https://issuetracker.google.com/u/1/issues/205156966#comment27
2022-02-13 00:37:41 +05:00
agnostic-apollo
9b5aad9416 Fixed: Fix AppShell failsafe env 2022-01-28 18:06:05 +05:00
agnostic-apollo
172a75e578 Changed: Do not recreate TermuxActivity enabled in 6631599f when TermuxService starts a session
Activity will only be recreated when `termux-reload-settings` is run or `night-mode` config does not equal current system mode when TermuxActivity is initially started. Running `termux-reload-settings` can cause some problems if some variable whose state should be maintained or reset is not being done so correctly, like termux session shortcuts weren't before 4fd48a5a. It requires further testing and any bugs should be reported.
2022-01-28 04:03:48 +05:00
agnostic-apollo
6631599fb6 Added: Add support for shared day/night theming across termux apps
With this commit, activities will automatically change theme between day/night if `night-mode` `termux.properties` is not set or is set to `system` without requiring app restart.

Dialog theming will be fully added in a later commit and may currently be in an inconsistent state or have crashes.

The `uiMode` has been removed from `configChanges` of `TermuxActivity`, this may cause termux app to restart if samsung DEX mode is changed, if it does, then users should report it so that it can be fixed by re-adding the value and ignoring the change inside `TermuxActivity.onConfigurationChanged()`. The docs don't state if its necessary. Check related pull request #1446.

Running `termux-reload-settings` will also restart `TermuxActivity`, the activity data should be preserved.
2022-01-23 01:42:26 +05:00
agnostic-apollo
f3f434af92 Changed: Rename ShareUtils openURL() to openUrl() 2022-01-23 01:42:26 +05:00
agnostic-apollo
6fea1fbddc Changed: Change ShareUtils.openSystemAppChooser() to public 2022-01-23 01:42:26 +05:00
agnostic-apollo
3898ebdc74 Changed: Rename UriUtils getUriFilePath() to getUriFilePathWithFragment() 2022-01-23 01:42:26 +05:00
agnostic-apollo
b45ff8a407 Added: Store pid in ExecutionCommand for sessions and tasks 2022-01-23 01:42:26 +05:00
agnostic-apollo
bf10c72661 Added: Add annotations and modifiers 2022-01-23 01:42:26 +05:00
agnostic-apollo
1fb4fe2510 Fixed: Fix FileUtils labels 2022-01-23 01:42:26 +05:00
agnostic-apollo
0fa0738cf6 Changed: Add uncommitted changes from 361bfb39 2022-01-23 01:41:57 +05:00
agnostic-apollo
998499d991 Changed: Remove redundant double quotes from string resources 2022-01-23 01:40:22 +05:00
agnostic-apollo
20a70b1a22 Fixed: Add uncommitted string resource changes 2022-01-23 01:40:22 +05:00
agnostic-apollo
5d202d082f Changed: Replace extra-keys Button with MaterialButton 2022-01-23 01:40:22 +05:00
agnostic-apollo
c1a0d6deff Changed: Rename ActivityUtilsErrno to ActivityErrno 2022-01-23 01:40:22 +05:00
agnostic-apollo
3f84b5345f Changed: Make ExtraKeysView private functions public and variables protected 2022-01-23 01:40:22 +05:00
agnostic-apollo
006bfeac8d Fixed: Fix termux background command logging at verbose level if CUSTOM_LOG_LEVEL was not passed 2022-01-23 01:40:22 +05:00
agnostic-apollo
b79ed509f1 Changed: Store app wide night mode in NightMode.APP_NIGHT_MODE so that libraries can use it directly without having to load or get it from termux properties 2022-01-23 01:40:22 +05:00
agnostic-apollo
1b794b3518 Fixed: Do not use colon character ":" in log tag since it is invalid and breaks logcat command filterspecs argument 2022-01-23 01:40:22 +05:00
agnostic-apollo
36e49707ec Added: Add support to request Settings.ACTION* permissions to be requested via Service context 2022-01-23 01:40:22 +05:00
agnostic-apollo
f857bf2968 Added: Add ActivityUtils.startActivity() and catch uncaught exceptions in TermuxActivity 2022-01-23 01:40:22 +05:00
agnostic-apollo
b69d14119e Changed: Return Error instead of boolean for ActivityUtils.startActivityForResult() 2022-01-23 01:40:22 +05:00
agnostic-apollo
8c43b7f0a1 Changed: Remove TermuxConstants reference from PackageUtils 2022-01-23 01:40:22 +05:00
agnostic-apollo
6ff5572999 Changed!: Remove TermuxConstants reference from Logger and set DEFAULT_LOG_TAG at application startup
Plugin apps must do the same
2022-01-23 01:40:22 +05:00
agnostic-apollo
8e506859a6 Changed!: Rename TermuxTask to AppShell since its not part of termux-app or com.termux.shared.termux package 2022-01-23 01:40:22 +05:00
agnostic-apollo
361bfb3961 Changed!: Move to package-by-feature hierarchy for classes not using it since termux-shared is growing too big and layers are getting out of hand 2022-01-23 01:40:22 +05:00
agnostic-apollo
549a772d45 Added: Add UriScheme and move UriUtils to com.termux.shared.net package 2022-01-23 01:40:22 +05:00
agnostic-apollo
37b9bcf5af Changed!: Rename FileUtils readStringFromFile() to readTextFromFile() and writeStringToFile() to writeTextToFile() 2022-01-23 01:40:22 +05:00
agnostic-apollo
7bbc12c7c9 Fixed: Get file basename from Uri path when opening files in termux if failed to get it ContentResolver and EXTRA_TITLE 2022-01-23 01:40:22 +05:00
agnostic-apollo
3e518a6a75 Fixed: Fix termux-open failing to open files with "#" and remove hardcoded "content" and "file" strings
termux-open "/data/data/com.termux/files/home/te#st.sh"
2022-01-23 01:40:22 +05:00
agnostic-apollo
d96883c4d6 Changed|Deprecated: Deprecate use-black-ui termux property and replace it with night-mode
This will not break existing `use-black-ui` settings for users and it will automatically be converted to `night-mode` when properties are loaded from disk but a deprecation message will be logged.

This `night-mode` key can be used to set the day/night theme variant for activities used by termux app and its plugin. The user can set a string value to `true` to force use dark variant of theme, `false` to force use light variant of theme or `system` to automatically set theme based on current system settings. The default value is still `system`. The app must be restarted for changes to take effect for existing activities, including main terminal `TermuxActivity`.

This is required since "theme != night mode". In future custom theme or color support may be provided that will have both dark and night modes for the same theme.
2022-01-23 01:40:22 +05:00
agnostic-apollo
28ecb64992 Changed: Automatically use default properties file and client for TermuxSharedProperties.getTermuxInternalPropertyValue() 2022-01-23 01:40:22 +05:00
agnostic-apollo
5d64f1225c Added: Add support in SharedProperties to modify properties loaded from disk before they are mapped to internal values 2022-01-23 01:40:22 +05:00
agnostic-apollo
aed4b96a31 Added: Add FileUtils.regularOrDirectoryFileExists() 2022-01-23 01:40:22 +05:00
agnostic-apollo
5b2aca9cf7 Changed: Fix minor typos in FileUtils and FileUtilsErrno 2022-01-23 01:40:22 +05:00
agnostic-apollo
93d738ae63 Fixed: Remove all trailing slashes when normalizing path 2022-01-23 01:40:22 +05:00
agnostic-apollo
f7ebcae7b3 Added: Add functions to get dirname and basename in FileUtils 2022-01-23 01:40:22 +05:00