Commit Graph

1306 Commits

Author SHA1 Message Date
Alan Christian 8746db0d22
chore(gitignore): Remove unused ignore rules for crashlytics (#2683)
* Fix typo

* Remove crashlytics
2022-04-02 18:26:43 +05:30
agnostic-apollo ce12b8ad2d Fixed: Fix `Settings.ACTION_*` permission requests result callback
Adding `FLAG_ACTIVITY_NEW_TASK` will start permission activity in separate task and `onActivityResult()` will be called early in the calling activity without grant/not-grant result being actually set.
2022-03-30 19:45:55 +05:00
agnostic-apollo 87a79a9b24 Added: Log intents received by and 2022-03-30 19:42:38 +05:00
agnostic-apollo caa13b7047 Fixed: Fix pull request APKs commit hash 2022-03-18 06:31:43 +05:00
agnostic-apollo 5e820ad249 Added: Allow users to adjust `$TMPDIR` clear mechanism on termux exit
The `delete-tmpdir-files-older-than-x-days-on-exit` key can be used to adjust how many days old the access time should be of files that should be deleted from `$TMPDIR` on termux exit. The user can set an integer value between `-1` and `100000`. Set `-1` to delete no files, `0` to delete all files and `> 0` for `x` days. The default value is `3` days. So adding an entry like `delete-tmpdir-files-older-than-x-days-on-exit=10` to `termux.properties` file will make termux delete files older than `10` when termux is exited. After updating the value, either restart termux or run `termux-reload-settings` for changes to take effect.

Note that currently `> 0` will revert back to `0` since deletion is currently broken for empty sub directories and deletion needs to be done based on access time instead of modified time. It will need to be fixed in a later commit. Check `FileUtils.deleteFilesOlderThanXDays()`.

Related issue #2350
2022-03-17 22:35:31 +05:00
agnostic-apollo 25d21e9d2e Fixed: Fix wrong input type selected if toolbar is switched back to extra keys after tapping terminal if in text input mode
Closes #2503
2022-03-17 05:30:25 +05:00
agnostic-apollo dd378738e3 Fixed: Add `media-*` symlinks to `Android/media` for all storages and `external-0` symlink to `Android/media` of primary storage
The `~/external-0` and `~/media-0` should point to primary storage and `1+` to others, possibly portable sd cards.

Note that one can make portable sd card as primary storage as well instead of internal sd card with adoptable storage, which then links it to `/storage/emulated`, so the concept of `internal` and `external` sd card does not apply to primary storage for all cases.

https://android.stackexchange.com/questions/214233/how-to-free-internal-storage-by-moving-data-or-using-symlink-bind-mount-with-a/214706#214706

https://android.stackexchange.com/questions/217741/how-to-bind-mount-a-folder-inside-sdcard-with-correct-permissions/217936#217936

https://android.stackexchange.com/questions/205430/what-is-storage-emulated-0/205494#205494

https://source.android.com/devices/storage/adoptable

```
$ ls -l storage | cut -d ' ' -f 9-

audiobooks -> /storage/emulated/0/Audiobooks
dcim -> /storage/emulated/0/DCIM
documents -> /storage/emulated/0/Documents
downloads -> /storage/emulated/0/Download
external-0 -> /storage/emulated/0/Android/data/com.termux/files
external-1 -> /storage/XXXX-XXXX/Android/data/com.termux/files
media-0 -> /storage/emulated/0/Android/media/com.termux
media-1 -> /storage/XXXX-XXXX/Android/media/com.termux
movies -> /storage/emulated/0/Movies
music -> /storage/emulated/0/Music
pictures -> /storage/emulated/0/Pictures
podcasts -> /storage/emulated/0/Podcasts
shared -> /storage/emulated/0

```

Closes #2481
2022-03-17 05:30:25 +05:00
agnostic-apollo 93d57f053b Added: Add `~/storage` symlinks for `documents`, `podcasts` and `audiobooks`
The `audiobooks` symlink will only be made on Android `10+`

Closes #2648
2022-03-17 05:30:25 +05:00
agnostic-apollo 26e0fa2b9e Changed: Use thread to setup settings components
Getting plugin contexts may be considered as too much work on main thread in certain situations resulting in android complaining that app is not responding
2022-03-17 05:30:25 +05:00
agnostic-apollo d25f7afd97 Changed: Share terminal transcript with `ShareUtils` 2022-03-17 05:30:25 +05:00
agnostic-apollo e0074f280f Fixed: Fix typos 2022-03-17 05:30:25 +05:00
agnostic-apollo cc58ddde31 Changed: Check crash log file whenever `TermuxActivity` is resumed instead of only on app startup
This adds onto 06dbfbdb since receiver would not be registered to receive `ACTION_NOTIFY_APP_CRASH` if `TermuxActivity` was not be in foreground
2022-03-17 02:10:51 +05:00
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 760ae78aff Docs: Add termux apps vulnerability disclosure post links to README 2022-03-11 20:17:48 +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 bd004514df
Merge pull request #2612 from Nickoriginal/master
Docs: Fix typo
2022-02-24 06:41:22 +05:00
Nickoriginal 270e41fae5
Update README.md 2022-02-23 11:10:58 +02: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 280e284488 Docs: Add building bootstrap link 2022-02-08 23:33:46 +05:00
agnostic-apollo a01ff018b3 Docs: Update matrix invite links 2022-02-08 23:31:20 +05:00
agnostic-apollo f8e7ada143 Fixed: Fix typo from 43858dfb 2022-02-05 07:28:43 +05:00
agnostic-apollo f33758c7c0 Fixed: Fix typo from 43858dfb 2022-02-05 07:25:01 +05:00
agnostic-apollo c567cc3b92 Fixed: Fix app crash if failed to start TermuxService while in background due to android bg restrictions
The crash happens due to android 8.0 background restrictions if TermuxActivity is not in foreground/whitelist and attempts to start TermuxService. With this commit, the app will not crash but will just exit with a toast message.

https://developer.android.com/about/versions/oreo/background#services

https://cs.android.com/android/platform/superproject/+/android-12.0.0_r4:frameworks/base/services/core/java/com/android/server/am/ActiveServices.java;l=722

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.termux/com.termux.app.TermuxActivity}: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.termux/.app.TermuxService }: app is in background uid UidRecord{533ae62 u0a187 TPSL idle procs:1 seq(0,0,0)}
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3082)
 at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:201)
 at android.app.ActivityThread.main(ActivityThread.java:6821)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.termux/.app.TermuxService }: app is in background uid UidRecord{533ae62 u0a187 TPSL idle procs:1 seq(0,0,0)}
 at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1587)
 at android.app.ContextImpl.startService(ContextImpl.java:1542)
 at android.content.ContextWrapper.startService(ContextWrapper.java:674)
 at com.termux.app.TermuxActivity.onCreate(TermuxActivity.java:242)
 at android.app.Activity.performCreate(Activity.java:7224)
 at android.app.Activity.performCreate(Activity.java:7213)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
 ... 11 more

Closes #2552
2022-02-05 07:19:36 +05:00
agnostic-apollo 43858dfbb1 Fixed: Rename TermuxActivity isOnResumeAfterOnCreate to mIsOnResumeAfterOnCreate as per variable naming convention 2022-02-05 06:30:48 +05:00
agnostic-apollo b8c3db0b6e Fixed: Change extra keys and terminal input view background to black
Required for day/night theming and should fix issues where both views were translucent with light terminal color themes.
2022-02-05 06:28:22 +05:00
agnostic-apollo 622ff4fad4 Fixed: Fix issue where a colour tint/highlight would be added to the terminal on activity re-creation
The fix in c6b4114f was not working for it.
2022-02-05 06:26:23 +05:00
agnostic-apollo a56ed5771d Fixed: Fix terminal sessions being re-added if "New Session" shortcut or termux-reload-settings was used
If TermuxActivity was recreated then the original intent was re-delivered, resulting in a new session being re-added each time.

Closes #2566
2022-02-05 06:22:49 +05:00
agnostic-apollo 2a1c5a70da Docs: Fix issue link 2022-01-29 02:39:17 +05:00
agnostic-apollo 9b5aad9416 Fixed: Fix AppShell failsafe env 2022-01-28 18:06:05 +05:00
agnostic-apollo 95d7a154a4 Docs: Add notice that termux is broken on Android 12 2022-01-28 04:23:59 +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 4fd48a5aed Fixed: Fix termux session shortcuts not working after TermuxActivity recreation
The `List<KeyboardShortcut> mSessionShortcuts = new ArrayList<>()` declaration was causing shortcuts list to be of size 0 in `TermuxTerminalViewClient.onCodePoint()` after re-creation, which resulted in session shortcuts not working.
2022-01-28 03:56:39 +05:00
agnostic-apollo 81dd113157 Docs: Add notice that users should upgrade to v0.118.0 ASAP 2022-01-24 23:39:06 +05:00
agnostic-apollo 2452399a13 Added: Add explicit exported attribute for app components as required by Android 12
https://developer.android.com/about/versions/12/behavior-changes-12#exported
2022-01-23 19:46:46 +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 a3cd058fb4 Update: Remove duplicate log tag prefix from TermuxOpenReceiver 2022-01-23 01:42:26 +05:00
agnostic-apollo b435d94888 Fixed: Do not open null or empty file paths passed to TermuxOpenReceiver 2022-01-23 01:42:26 +05:00