1
0
mirror of https://github.com/termux/termux-app synced 2024-06-20 16:17:07 +00:00
Commit Graph

1038 Commits

Author SHA1 Message Date
agnostic-apollo
d19cf435be Add ".sh" extension to apt_info_script file 2021-04-13 16:57:24 +05:00
agnostic-apollo
1132028bd2 Add TermuxTerminalViewClientBase to com.termux.shared.terminal package and extend that in TermuxTerminalViewClient 2021-04-13 16:34:24 +05:00
agnostic-apollo
b7b4a0a8a2 Move TermuxTerminalSessionClientBase to com.termux.shared.terminal package 2021-04-13 16:20:47 +05:00
agnostic-apollo
ffd8687b4c Revert "Bump to v0.109" 2021-04-13 16:09:31 +05:00
Leonid Pliushch
bbb6f4471f
update bootstrap archives 2021-04-13 13:34:11 +03:00
agnostic-apollo
b33b906784
Merge pull request #1953 from agnostic-apollo/termux-various-fixes-and-improvements 2021-04-13 00:07:24 +05:00
agnostic-apollo
567eeca782 Bump to v0.109 2021-04-12 20:20:26 +05:00
agnostic-apollo
3d46849673 Replace "if(" with "if (" 2021-04-12 20:19:04 +05:00
agnostic-apollo
6293f5f170 Added APT package info when generating "Report Issue" text
This will now take a few more seconds due to "apt update" command being run.
2021-04-12 19:22:29 +05:00
agnostic-apollo
e5c5174f6f Fix TermuxActivityBroadcastReceiver wrongly designed intent actions and extras
From now on
- TERMUX_ACTIVITY.ACTION_REQUEST_PERMISSIONS should be used for requesting storage permissions.
- TERMUX_ACTIVITY.ACTION_RELOAD_STYLE should be used for reloading styling.
- TERMUX_ACTIVITY.EXTRA_RELOAD_STYLE which was previously used for requesting storage permissions if its value equaled "storage" has been deprecated.

If more actions need to be supported in future, add them to TermuxActivity.registerTermuxActivityBroadcastReceiver() IntentFilter.
2021-04-12 19:22:07 +05:00
agnostic-apollo
f1034c2e79 Add support for stdin for background RUN_COMMAND intent and TERMUX_SERVICE.ACTION_SERVICE_EXECUTE commands 2021-04-12 19:16:45 +05:00
agnostic-apollo
bbf03a0507 The TermuxConstants class has been updated to v0.19.0. Check its Changelog section for info on changes. 2021-04-12 19:16:21 +05:00
agnostic-apollo
153818f7fb Fix typos 2021-04-12 18:26:18 +05:00
agnostic-apollo
192b208883 Add support for stdin for background TermuxTasks
This will allow passing scripts (to bash or python) or other data to an executable via stdin. Arguments are passed to the executable and not the script.
2021-04-12 18:25:43 +05:00
agnostic-apollo
824b3e657f Rename termux terminal view and session client classes
- com.termux.app.terminal.TermuxViewClient has been renamed to TermuxTerminalViewClient
- com.termux.app.terminal.TermuxSessionClient has been renamed to TermuxTerminalSessionClient
- com.termux.shared.shell.TermuxSessionClientBase has been renamed to TermuxTerminalSessionClientBase

This was required because com.termux.app.terminal.TermuxSessionClient was in conflict with com.termux.shared.shell.TermuxSessionClient interface of com.termux.shared.shell.TermuxSession.
2021-04-12 15:19:25 +05:00
agnostic-apollo
a95e187b25 Assure "Process completed" string is written to terminal before session is finished 2021-04-12 14:49:49 +05:00
agnostic-apollo
f888f35e35 Fix issue where TermuxService was stopped and Termux notification canceled, if background tasks were still running but all sessions had been closed. 2021-04-12 14:43:39 +05:00
agnostic-apollo
24a5493ea5 Replace "if(" with "if (" 2021-04-12 14:32:02 +05:00
agnostic-apollo
0cd7cb8162 Improve TermuxSession and TermuxTask
TermuxSession, TermuxTask and TermuxSessionClientBase have been moved to termux-shared. They are now not dependent on TermuxService anymore and have become abstract so that they can be called from anywhere. TermuxSession.TermuxSessionClient and TermuxTask.TermuxTaskClient interfaces have been created for callbacks, which the TermuxService now implements.

The TermuxTask now also supports synchronous command execution as well to run shell commands from anywhere for internal use by termux app and its plugins.

TermuxTask now also supports killing the process being run by sending it a SIGKILL. This is used by TermuxService to kill all the TermuxTasks (in addition to TermuxSessions) it manages when it is destroyed, either by user exiting it or by android killing it. Only the tasks that were started by a plugin which **expects** the result back via a pending intent will be killed, but the remaining background tasks will keep on running until the termux app process is killed by android, like by OOM. Check TermuxService.killAllTermuxExecutionCommands() for more details on how TermuxService kills TermuxTasks and TermuxSessions.

Fixed null pointer exception when getting terminal transcript if TerminalEmulator not initialized.
2021-04-12 14:26:53 +05:00
agnostic-apollo
df4d8ac7e5 Add support for reporting issues to the termuxreports@groups.io email 2021-04-11 02:29:00 +05:00
agnostic-apollo
64fb2ce49b Update TermuxConstants
The `TermuxConstants` class has been updated to `v0.18.0`. Check its Changelog section for info on changes.
2021-04-11 02:28:00 +05:00
agnostic-apollo
0c9b85a4f9 Micro optimization for StreamGobbler 2021-04-10 02:32:21 +05:00
agnostic-apollo
62a2104adc Updated RunCommandService javadocs.
Documentation has been moved to https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
2021-04-08 03:26:43 +05:00
agnostic-apollo
71dfefd4b7 Add termux-shared library to github workflow so that its published 2021-04-07 11:32:22 +05:00
agnostic-apollo
682ce08314 Create termux-shared library package for all termux constants and shared utils
The termux plugins should use this library instead of hardcoding "com.termux" values in their source code.

The library can be included as a dependency by plugins and third party apps by including the following line in the build.gradle where x.xxx is the version number, once its published.

`implementation 'com.termux:termux-shared:x.xxx'`

The `TermuxConstants` class has been updated to `v0.17.0`, `TermuxPreferenceConstants` to `v0.9.0` and `TermuxPropertyConstants` to `v0.6.0`. Check their Changelog sections for info on changes.

Some typos and redundant code has also been fixed.
2021-04-07 11:31:30 +05:00
agnostic-apollo
c9a476caf7 Add TermuxTaskerAppSharedPreferences to handle termux-tasker shared preferences 2021-04-06 17:23:12 +05:00
agnostic-apollo
9cee71004f Replace "if(" with "if (" 2021-04-06 17:17:12 +05:00
agnostic-apollo
81d97c3584 Fix potential TransactionTooLargeException when sharing text 2021-04-06 17:13:28 +05:00
agnostic-apollo
939338aaac Allow users to report an issue from terminal transcript by selection "Report Issue" from context menu 2021-04-06 17:09:54 +05:00
agnostic-apollo
067709bf4b Disable obfuscation of termux-app in release builds without disabling optimizations and shrinking
This will allow stacktraces to have full class and method names when a crash report is generated.
2021-04-06 16:15:50 +05:00
agnostic-apollo
69e4b575a8 Implement crash handler and reporting
Now whenever the Termux app crashes, the crash report (stacktrace, app and device info) will be logged to ~/crash_log.md file. When the user will reopen the app, a notification will be shown which when clicked will show the crash report content in the ReportActivity. The activity will have important links like email, reddit, github issues of termux app and packages at which the user can optionally report an issue if necessary after copying the crash report text. The ~/crash_log.md file will be moved to ~/crash_log-backup.md so that a notification is not shown again on next startup and can be viewed again via SAF, etc.

This will allow reports for bugs that are submitted to have complete and useful info, specially in markdown format, making lives of devs a tad bit easier. Also more bugs that are rare might be submitted since users will have the info to report with and know where to report at.

ToDo:
- The TermuxConstants.TERMUX_SUPPORT_EMAIL_URL needs to be updated with a valid support email once its set up. The TermuxUtils.getReportIssueMarkdownString() function currently also has "email" lines commented out which will need to be uncommented.
- Currently, crashes will only be handled for the main app thread, other threads will have to manually hooked into where necessary.
2021-04-06 16:15:00 +05:00
agnostic-apollo
07e6ecd3c3 Update TermuxConstants
The `TermuxConstants` classes has been updated to `v0.16.0`. Check its Changelog section for info on changes.
2021-04-06 16:13:28 +05:00
agnostic-apollo
325a6f7d66 Fix SettingsActivity shortcut not showing on android 7 and fixed shortcut actions and categories 2021-04-06 13:27:43 +05:00
agnostic-apollo
cf5bb69fc8 Add crash_report_notifications_enabled shared preferences
This will allow users to control if a notification should be shown with the crash info when app is restarted after a crash

The `TermuxPreferenceConstants` classes has been updated to `v0.8.0`. Check its Changelog section for info on changes.
2021-04-06 12:48:56 +05:00
agnostic-apollo
18b004a2ba Fix Logger function modifier order 2021-04-06 12:23:00 +05:00
agnostic-apollo
38323b1c2a Fix RUN_COMMAND Intent plugin api url 2021-04-06 12:21:22 +05:00
agnostic-apollo
8a5442f80d Update TermuxConstants
The `TermuxConstants` classes has been updated to `v0.15.0`. Check its Changelog sections for info on changes.
2021-04-06 12:19:37 +05:00
agnostic-apollo
8598b92dea Use FileUtils for clearing TMPDIR and move clearing function to ShellUtils from TermuxService 2021-04-06 06:00:41 +05:00
agnostic-apollo
b2cd20c035 Use FileUtils for bootstrap and shared storage symlinks setup 2021-04-06 06:00:21 +05:00
agnostic-apollo
d4fc34ca2d Move FileUtils to file package and define more file util functions
A lot of utils have been defined now that can be used to safely manage files.

The java java.io.File API has poor support for detecting symlinks including broken symlinks. Android implementation also has issues. Check FileTypes.getFileType() function for more info. For this reason, the UnixFileAttributes and related classes has been ported from AOSP to get file attributes and type.

Some file utils and android versions use google's Guava com.google.common.io.MoreFiles library for managing files, specially for safer directory deletion with SecureDirectoryStream.

Some file utils and android versions use org.apache.commons.io.FileUtils for managing files. The library version used is 2.5 and it must not be incremented for compatibility with android version < 8, otherwise runtime crashes will occur.
2021-04-06 06:00:05 +05:00
agnostic-apollo
c0323fe816 Move ShellUtils to shell package 2021-04-05 23:26:47 +05:00
agnostic-apollo
a32309827f Update gradle version to 4.1.3 2021-04-05 23:22:04 +05:00
agnostic-apollo
ada678dfe2 Move get*LogStringEntry() functions to logger class 2021-04-05 23:21:13 +05:00
agnostic-apollo
cdbd38faaa Move StreamGobbler to shell package 2021-04-05 23:18:43 +05:00
agnostic-apollo
d4653d0590 Get TERMUX_VERSION while building shell environment via Termux package context 2021-03-29 07:20:39 +05:00
agnostic-apollo
49f53f55f3 Renamed TextDataUtils to DataUtils 2021-03-28 09:08:45 +05:00
agnostic-apollo
15eb56d4dd Add PackageUtils and fix ReportActivity
- PackageUtils has been added to get various package related info. This will be used to get info based on Context objects instead of using BuildConfig which wouldn't have been available across termux plugins.

- Support for getting Context objects of all termux plugin apps have been added to TermuxUtils.

- Support for showing more details for the app has been added for ReportActivity. This will also allow app info of Termux app to be generated when TermuxUtils.getAppInfoMarkdownString() is called by a termux plugin so that both are shown so that devs/users can more easily detect compatibility issues.

- ReportActivity has been fixed to also include report and device info instead of just the ExecutionCommand info when copying and sharing.

- Moved the generation of markdown for ReportInfo to its own class and added creationTimestamp field.

- Increased markdown headings size for some cases.
2021-03-28 09:06:17 +05:00
agnostic-apollo
d7ea770d47 Move com.termux.models to com.termux.app.models package 2021-03-27 19:08:26 +05:00
agnostic-apollo
2a8d5e292d Add support for disabling soft keyboard completely with the "soft_keyboard_enabled" SharedPreferences key
Users can toggle the state from Settings -> Keyboard I/O -> Soft Keyboard toggle.

Android phone should also have an internal setting for disabling soft keyboard when a hardware keyboard is connected in Language and Input android settings or from the input mode selection notification, but the above setting will be Termux app specific and will allow soft keyboard to still be shown in other apps.

The `TermuxPreferenceConstants` classes has been updated to `v0.7.0`. Check its Changelog section for info on changes.
2021-03-27 07:55:21 +05:00
agnostic-apollo
04da4b2268 Send PendingIntent back for pre-execution errors generated for RUN_COMMAND intent
If the pending intent is not null, then the errors will be sent back to the caller without notifying the user, since we will let the caller handle the errors himself. They will still be logged in logcat.

However, if "allow-external-apps" is not true, then a flash and notification will be shown forcefully (regardless of "Plugin Execution Errors" toggle state), so that the user knows someone tried to run a command in termux context, since it may be malicious app or imported (tasker) plugin project and not the user himself. If a pending intent is also sent, then its creator is also logged and shown.
2021-03-26 16:33:46 +05:00