From c23852fb357d627f637b1ac3d2f8c09c7380ceba Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 8 Jan 2022 01:35:35 +0500 Subject: [PATCH 01/40] Docs: Add google play store deprecation notice --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 10a77f1..77e8ceb 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ The APKs for `Github Releases` will be listed under `Assets` drop-down of a rele The APKs for `Github Build` action workflows will be listed under `Artifacts` section of a workflow run. These are created for each commit/push done to the repository and can be used by users who don't want to wait for releases and want to try out the latest features immediately or want to test their pull requests. Note that for action workflows, you need to be [**logged into a `Github` account**](https://github.com/login) for the `Artifacts` links to be enabled/clickable. If you are using the [`Github` app](https://github.com/mobile), then make sure to open workflow link in a browser like Chrome or Firefox that has your Github account logged in since the in-app browser may not be logged in. The APKs for both of these are [`debuggable`](https://developer.android.com/studio/debug) and are compatible with each other but they are not compatible with other sources. + +### Google Play Store **(Deprecated)** + +**Termux and its plugins are no longer updated on [Google Play Store](https://play.google.com/store/apps/details?id=com.termux) due to [android 10 issues](https://github.com/termux/termux-packages/wiki/Termux-and-Android-10) and have been deprecated. **It is highly recommended to not install Termux apps from Play Store any more.** Check https://github.com/termux/termux-app#google-play-store-deprecated for details. ## From 52684898fcd3fcbae6b7e5d4d92133dd05d9dd58 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 8 Jan 2022 01:36:52 +0500 Subject: [PATCH 02/40] Docs: Add google play store deprecation notice --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77e8ceb..6cff477 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The APKs for both of these are [`debuggable`](https://developer.android.com/stud ### Google Play Store **(Deprecated)** -**Termux and its plugins are no longer updated on [Google Play Store](https://play.google.com/store/apps/details?id=com.termux) due to [android 10 issues](https://github.com/termux/termux-packages/wiki/Termux-and-Android-10) and have been deprecated. **It is highly recommended to not install Termux apps from Play Store any more.** Check https://github.com/termux/termux-app#google-play-store-deprecated for details. +**Termux and its plugins are no longer updated on [Google Play Store](https://play.google.com/store/apps/details?id=com.termux) due to [android 10 issues](https://github.com/termux/termux-packages/wiki/Termux-and-Android-10) and have been deprecated. It is highly recommended to not install Termux apps from Play Store any more.** Check https://github.com/termux/termux-app#google-play-store-deprecated for details. ## From 829008eb180412341f1118a64dd32e79bb6febc4 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 8 Jan 2022 15:17:12 +0500 Subject: [PATCH 03/40] Docs: Fix wrong fdroid metadata and google playstore links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6cff477..fb794c4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Latest version is `v0.15.0`. You **do not** need to download the `F-Droid` app (via the `Download F-Droid` link) to install `Termux:Float`. You can download the `Termux:Float` APK directly from the site by clicking the `Download APK` link at the bottom of each version section. -It usually takes a few days (or even a week or more) for updates to be available on `F-Droid` once an update has been released on `Github`. The `F-Droid` releases are built and published by `F-Droid` once they [detect](https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.termux.yml) a new `Github` release. The Termux maintainers **do not** have any control over the building and publishing of the Termux apps on `F-Droid`. Moreover, the Termux maintainers also do not have access to the APK signing keys of `F-Droid` releases, so we cannot release an APK ourselves on `Github` that would be compatible with `F-Droid` releases. +It usually takes a few days (or even a week or more) for updates to be available on `F-Droid` once an update has been released on `Github`. The `F-Droid` releases are built and published by `F-Droid` once they [detect](https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.termux.window.yml) a new `Github` release. The Termux maintainers **do not** have any control over the building and publishing of the Termux apps on `F-Droid`. Moreover, the Termux maintainers also do not have access to the APK signing keys of `F-Droid` releases, so we cannot release an APK ourselves on `Github` that would be compatible with `F-Droid` releases. The `F-Droid` app often may not notify you of updates and you will manually have to do a pull down swipe action in the `Updates` tab of the app for it to check updates. Make sure battery optimizations are disabled for the app, check https://dontkillmyapp.com/ for details on how to do that. @@ -47,7 +47,7 @@ The APKs for both of these are [`debuggable`](https://developer.android.com/stud ### Google Play Store **(Deprecated)** -**Termux and its plugins are no longer updated on [Google Play Store](https://play.google.com/store/apps/details?id=com.termux) due to [android 10 issues](https://github.com/termux/termux-packages/wiki/Termux-and-Android-10) and have been deprecated. It is highly recommended to not install Termux apps from Play Store any more.** Check https://github.com/termux/termux-app#google-play-store-deprecated for details. +**Termux and its plugins are no longer updated on [Google Play Store](https://play.google.com/store/apps/details?id=com.termux.window) due to [android 10 issues](https://github.com/termux/termux-packages/wiki/Termux-and-Android-10) and have been deprecated. It is highly recommended to not install Termux apps from Play Store any more.** Check https://github.com/termux/termux-app#google-play-store-deprecated for details. ## @@ -71,7 +71,7 @@ nano ~/.termux/termux.float.properties You can help debug problems by setting appropriate `logcat` `Log Level` in `Termux` app settings -> `Termux:Float` -> `Debugging` -> `Log Level` (Requires `Termux` app version `>= 0.118.0`). The `Log Level` defaults to `Normal` and log level `Verbose` currently logs additional information. Its best to revert log level to `Normal` after you have finished debugging since private data may otherwise be passed to `logcat` during normal operation and moreover, additional logging increases execution time. -Once log levels have been set, you can run the `logcat` command in `Termux` or `Termux:Float` app terminal to view the logs in realtime (`Ctrl+c` to stop) or use `logcat -d` to take a dump of the log. You can also view the logs from a PC over `ADB`. For more information, check official android `logcat` guide [here](https://developer.android.com/studio/command-line/logcat). +Once log levels have been set, you can run the `logcat` command in `Termux` or `Termux:Float` app terminal to view the logs in realtime (`Ctrl+c` to stop) or use `logcat -d > logcat.txt` to take a dump of the log. You can also view the logs from a PC over `ADB`. For more information, check official android `logcat` guide [here](https://developer.android.com/studio/command-line/logcat). ##### Log Levels - `Off` - Log nothing From 639a3c1de48c0ee79b83927d1e4b91ba06299f25 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Wed, 30 Mar 2022 21:31:22 +0200 Subject: [PATCH 04/40] README: change termux url termux.com->termux.org --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb794c4..2d2f52a 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,4 @@ Check [Forking](https://github.com/termux/termux-app#Forking) section of `termux -[Termux]: https://termux.com +[Termux]: https://termux.org From 4424fb0116614cedbc8ab1b84821fa3f34b91d4e Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sun, 3 Jul 2022 19:08:51 +0200 Subject: [PATCH 05/40] README: change termux url termux.org->termux.dev --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d2f52a..9d14cf6 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,4 @@ Check [Forking](https://github.com/termux/termux-app#Forking) section of `termux -[Termux]: https://termux.org +[Termux]: https://termux.dev From ea6ed806abd15faf1eaf1cdc69d12c27b63cc20e Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Wed, 21 Sep 2022 10:30:24 +0300 Subject: [PATCH 06/40] rename dev_keystore.jks to testkey_untrusted.jks Hopefully the new name of keystore file would provide to potential user more info about what it actually is. --- app/build.gradle | 2 +- app/{dev_keystore.jks => testkey_untrusted.jks} | Bin 2 files changed, 1 insertion(+), 1 deletion(-) rename app/{dev_keystore.jks => testkey_untrusted.jks} (100%) diff --git a/app/build.gradle b/app/build.gradle index e5ae623..c63255c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ android { signingConfigs { debug { - storeFile file('dev_keystore.jks') + storeFile file('testkey_untrusted.jks') keyAlias 'alias' storePassword 'xrj45yWGLbsO7W0v' keyPassword 'xrj45yWGLbsO7W0v' diff --git a/app/dev_keystore.jks b/app/testkey_untrusted.jks similarity index 100% rename from app/dev_keystore.jks rename to app/testkey_untrusted.jks From d082486ef134c1508284648612822288938c08c8 Mon Sep 17 00:00:00 2001 From: Lucy Phipps Date: Mon, 7 Nov 2022 01:26:01 +0000 Subject: [PATCH 07/40] Create dependabot.yml --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a83ef38 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: / + schedule: + interval: daily From aa0d3732a015ce5aa4e95f945c3df63b4577d09f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 01:26:20 +0000 Subject: [PATCH 08/40] Bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/debug_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index 88fe227..102050f 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -57,7 +57,7 @@ jobs: fi - name: Attach files - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ env.APK_BASENAME_PREFIX }} path: | From e7a62c146d79938ce3849183104d00249056fe18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 01:26:21 +0000 Subject: [PATCH 09/40] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/attach_debug_apk_to_release.yml | 2 +- .github/workflows/debug_build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/attach_debug_apk_to_release.yml b/.github/workflows/attach_debug_apk_to_release.yml index 2a42147..625f216 100644 --- a/.github/workflows/attach_debug_apk_to_release.yml +++ b/.github/workflows/attach_debug_apk_to_release.yml @@ -12,7 +12,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ env.GITHUB_REF }} diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index 102050f..cf0f705 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build APK shell: bash {0} From 6d1eb230e8b3eda039f69131d5de951eab8c00e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Oct 2023 12:48:38 +0100 Subject: [PATCH 10/40] Bump actions/checkout from 3 to 4 (#56) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/attach_debug_apk_to_release.yml | 2 +- .github/workflows/debug_build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/attach_debug_apk_to_release.yml b/.github/workflows/attach_debug_apk_to_release.yml index 625f216..8a5a2d0 100644 --- a/.github/workflows/attach_debug_apk_to_release.yml +++ b/.github/workflows/attach_debug_apk_to_release.yml @@ -12,7 +12,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ env.GITHUB_REF }} diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index cf0f705..909652a 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build APK shell: bash {0} From ecfea83dc67c0b7d483f8aac6792e540807f0312 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 15:24:31 +0000 Subject: [PATCH 11/40] Bump actions/upload-artifact from 3 to 4 (#58) --- .github/workflows/debug_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index 909652a..4cd7404 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -57,7 +57,7 @@ jobs: fi - name: Attach files - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.APK_BASENAME_PREFIX }} path: | From 4e9f15494d49f4d3d6ba16c755f877b51720332b Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Wed, 1 Jun 2022 00:27:15 +0500 Subject: [PATCH 12/40] Fixed: Fix `NullPointerException` in `TermuxFloatSessionClient.checkForFontAndColors()` ``` com.termux.window E/Logger.TermuxFloatSessionClient: Error in checkForFontAndColors(): java.lang.NullPointerException: Attempt to invoke virtual method 'com.termux.terminal.TerminalSession com.termux.shared.termux.shell.command.runner.terminal.TermuxSession.getTerminalSession()' on a null object reference at com.termux.window.TermuxFloatSessionClient.checkForFontAndColors(TermuxFloatSessionClient.java:166) at com.termux.window.TermuxFloatSessionClient.onReload(TermuxFloatSessionClient.java:66) at com.termux.window.TermuxFloatView.reloadViewStyling(TermuxFloatView.java:361) at com.termux.window.TermuxFloatService.createTermuxSession(TermuxFloatService.java:235) at com.termux.window.TermuxFloatService.initializeFloatView(TermuxFloatService.java:179) at com.termux.window.TermuxFloatService.onStartCommand(TermuxFloatService.java:55) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4320) at android.app.ActivityThread.access$1800(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1951) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7664) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) ``` --- .../main/java/com/termux/window/TermuxFloatService.java | 7 ++++++- .../java/com/termux/window/TermuxFloatSessionClient.java | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/termux/window/TermuxFloatService.java b/app/src/main/java/com/termux/window/TermuxFloatService.java index 416c397..5e83b1f 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatService.java +++ b/app/src/main/java/com/termux/window/TermuxFloatService.java @@ -22,6 +22,7 @@ import com.termux.shared.shell.TermuxShellEnvironmentClient; import com.termux.shared.termux.TermuxConstants; import com.termux.shared.termux.TermuxConstants.TERMUX_FLOAT_APP.TERMUX_FLOAT_SERVICE; +import com.termux.terminal.TerminalSession; public class TermuxFloatService extends Service { @@ -237,8 +238,12 @@ public synchronized TermuxSession createTermuxSession(ExecutionCommand execution return newTermuxSession; } - public TermuxSession getSession() { + public TermuxSession getTermuxSession() { return mSession; } + public TerminalSession getCurrentSession() { + return mSession != null ? mSession.getTerminalSession() : null; + } + } diff --git a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java index 6891a0a..ee6cce9 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java +++ b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java @@ -163,10 +163,11 @@ public void checkForFontAndColors() { } TerminalColors.COLOR_SCHEME.updateWith(props); - TerminalSession session = mService.getSession().getTerminalSession(); + TerminalSession session = mService.getCurrentSession(); if (session != null && session.getEmulator() != null) { session.getEmulator().mColors.reset(); } + updateBackgroundColor(); final Typeface newTypeface = (fontFile.exists() && fontFile.length() > 0) ? Typeface.createFromFile(fontFile) : Typeface.MONOSPACE; @@ -178,7 +179,8 @@ public void checkForFontAndColors() { public void updateBackgroundColor() { //if (!mView.isVisible()) return; - TerminalSession session = mService.getSession().getTerminalSession(); + + TerminalSession session = mService.getCurrentSession(); if (session != null && session.getEmulator() != null) { mView.getTerminalView().setBackgroundColor(session.getEmulator().mColors.mCurrentColors[TextStyle.COLOR_INDEX_BACKGROUND]); } From 68e2eb0860be5d1103537514652584fbe21942bc Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 15 Apr 2024 23:18:12 +0500 Subject: [PATCH 13/40] Changed!: Rename `app/build.gradle` environmental variables to `TERMUX_FLOAT_APP_BUILD__` scope instead of `TERMUX_FLOAT_` - Renamed `TERMUX_FLOAT_APP_VERSION_NAME` to `TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME` - Renamed `TERMUX_FLOAT_APK_VERSION_TAG` to `TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG` --- .github/workflows/attach_debug_apk_to_release.yml | 2 +- .github/workflows/debug_build.yml | 4 ++-- app/build.gradle | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/attach_debug_apk_to_release.yml b/.github/workflows/attach_debug_apk_to_release.yml index 8a5a2d0..437edc0 100644 --- a/.github/workflows/attach_debug_apk_to_release.yml +++ b/.github/workflows/attach_debug_apk_to_release.yml @@ -38,7 +38,7 @@ jobs: APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" echo "Building APK for '$RELEASE_VERSION_NAME' release" - export TERMUX_FLOAT_APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle + export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release." fi diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index 4cd7404..5e57430 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -39,8 +39,8 @@ jobs: echo "APK_BASENAME_PREFIX=$APK_BASENAME_PREFIX" >> $GITHUB_ENV echo "Building APK for '$RELEASE_VERSION_NAME' build" - export TERMUX_FLOAT_APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle - export TERMUX_FLOAT_APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle + export TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle + export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then exit_on_error "Build failed for '$RELEASE_VERSION_NAME' build." fi diff --git a/app/build.gradle b/app/build.gradle index c63255c..9ae647e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,8 +2,8 @@ apply plugin: 'com.android.application' android { compileSdkVersion project.properties.compileSdkVersion.toInteger() - def appVersionName = System.getenv("TERMUX_FLOAT_APP_VERSION_NAME") ?: "" - def apkVersionTag = System.getenv("TERMUX_FLOAT_APK_VERSION_TAG") ?: "" + def appVersionName = System.getenv("TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME") ?: "" + def apkVersionTag = System.getenv("TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG") ?: "" defaultConfig { applicationId "com.termux.window" From cfd56fd5e90c915f5d844c9fe6d3c308268cd05f Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 15 Apr 2024 23:41:04 +0500 Subject: [PATCH 14/40] Added|Changed!: Change `sha256sums` filename to `checksums-sha256.txt` that is generated for APKs built and uploaded to GitHub releases/actions with GitHub actions and log checksum file contents This is done so that the checksums gets stored internally in GitHub action logs as well and if APK/checksum files attached to GitHub releases are modified manually by someone, this can be detected, at least until logs expire. --- .github/workflows/attach_debug_apk_to_release.yml | 9 +++++---- .github/workflows/debug_build.yml | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/attach_debug_apk_to_release.yml b/.github/workflows/attach_debug_apk_to_release.yml index 437edc0..c625d8d 100644 --- a/.github/workflows/attach_debug_apk_to_release.yml +++ b/.github/workflows/attach_debug_apk_to_release.yml @@ -49,16 +49,17 @@ jobs: exit_on_error "Failed to find built APK at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" fi - echo "Generating sha25sums file" - if ! (cd "$APK_DIR_PATH"; sha256sum "${APK_BASENAME_PREFIX}.apk" > sha256sums); then - exit_on_error "Generate sha25sums failed for '$RELEASE_VERSION_NAME' release." + echo "Generating checksums-sha256.txt file" + if ! (cd "$APK_DIR_PATH"; sha256sum "${APK_BASENAME_PREFIX}.apk" > checksums-sha256.txt); then + exit_on_error "Generate checksums-sha256.txt file failed for '$RELEASE_VERSION_NAME' release." fi + echo "checksums-sha256.txt:"$'\n```\n'"$(cat "$APK_DIR_PATH/checksums-sha256.txt")"$'\n```' echo "Attaching APK to github release" if ! hub release edit \ -m "" \ -a "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk" \ - -a "$APK_DIR_PATH/sha256sums" \ + -a "$APK_DIR_PATH/checksums-sha256.txt" \ "$RELEASE_VERSION_NAME"; then exit_on_error "Attach APK to release failed for '$RELEASE_VERSION_NAME' release." fi diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index 5e57430..b18d95e 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -51,10 +51,11 @@ jobs: exit_on_error "Failed to find built APK at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" fi - echo "Generating sha25sums file" - if ! (cd "$APK_DIR_PATH"; sha256sum "${APK_BASENAME_PREFIX}.apk" > sha256sums); then - exit_on_error "Generate sha25sums failed for '$RELEASE_VERSION_NAME' release." + echo "Generating checksums-sha256.txt file" + if ! (cd "$APK_DIR_PATH"; sha256sum "${APK_BASENAME_PREFIX}.apk" > checksums-sha256.txt); then + exit_on_error "Generate checksums-sha256.txt file failed for '$RELEASE_VERSION_NAME' release." fi + echo "checksums-sha256.txt:"$'\n```\n'"$(cat "$APK_DIR_PATH/checksums-sha256.txt")"$'\n```' - name: Attach files uses: actions/upload-artifact@v4 @@ -62,5 +63,5 @@ jobs: name: ${{ env.APK_BASENAME_PREFIX }} path: | ${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}.apk - ${{ env.APK_DIR_PATH }}/sha256sums + ${{ env.APK_DIR_PATH }}/checksums-sha256.txt ${{ env.APK_DIR_PATH }}/output-metadata.json From eead87205e8f89b52997de4edd57a1dbf6c44cf8 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 16 Apr 2024 18:32:43 +0500 Subject: [PATCH 15/40] Changed: Rename workflow filename of `debug_build.yml` to `github_action_build.yml` and `attach_debug_apk_to_release.yml` to `github_release_build.yml` --- .github/workflows/{debug_build.yml => github_action_build.yml} | 0 .../{attach_debug_apk_to_release.yml => github_release_build.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{debug_build.yml => github_action_build.yml} (100%) rename .github/workflows/{attach_debug_apk_to_release.yml => github_release_build.yml} (100%) diff --git a/.github/workflows/debug_build.yml b/.github/workflows/github_action_build.yml similarity index 100% rename from .github/workflows/debug_build.yml rename to .github/workflows/github_action_build.yml diff --git a/.github/workflows/attach_debug_apk_to_release.yml b/.github/workflows/github_release_build.yml similarity index 100% rename from .github/workflows/attach_debug_apk_to_release.yml rename to .github/workflows/github_release_build.yml From 11a3df439a76282ab9191e7cc29f7711530497d8 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 16 Apr 2024 19:06:18 +0500 Subject: [PATCH 16/40] Fixed: Fix pull request APK version commit hash for GitHub Action builds --- .github/workflows/github_action_build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index b18d95e..77e2d75 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -21,6 +21,11 @@ jobs: exit_on_error() { echo "$1"; exit 1; } echo "Setting vars" + + if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then + GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA + fi + # Set RELEASE_VERSION_NAME to "+" CURRENT_VERSION_NAME_REGEX='\s+versionName "([^"]+)"$' CURRENT_VERSION_NAME="$(grep -m 1 -E "$CURRENT_VERSION_NAME_REGEX" ./app/build.gradle | sed -r "s/$CURRENT_VERSION_NAME_REGEX/\1/")" From 7d178481c8101a9e5497fcd1433860d86c193b65 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 16 Apr 2024 23:15:05 +0500 Subject: [PATCH 17/40] Changed: Update references for `github_action_build.yml` and `github_release_build.yml` workflows renamed in a previous commit and their internal names and comments --- .github/workflows/github_action_build.yml | 18 +++++++++--------- .github/workflows/github_release_build.yml | 20 ++++++++++---------- README.md | 6 +++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index 77e2d75..e09d692 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -1,4 +1,4 @@ -name: Build +name: GitHub Action Build on: push: @@ -15,7 +15,7 @@ jobs: - name: Clone repository uses: actions/checkout@v4 - - name: Build APK + - name: Build shell: bash {0} run: | exit_on_error() { echo "$1"; exit 1; } @@ -31,29 +31,29 @@ jobs: CURRENT_VERSION_NAME="$(grep -m 1 -E "$CURRENT_VERSION_NAME_REGEX" ./app/build.gradle | sed -r "s/$CURRENT_VERSION_NAME_REGEX/\1/")" RELEASE_VERSION_NAME="v$CURRENT_VERSION_NAME+${GITHUB_SHA:0:7}" # The "+" is necessary so that versioning precedence is not affected if ! printf "%s" "${RELEASE_VERSION_NAME/v/}" | grep -qP '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'; then - exit_on_error "The versionName '${RELEASE_VERSION_NAME/v/}' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html." + exit_on_error "The release version '${RELEASE_VERSION_NAME/v/}' generated from current version '$CURRENT_VERSION_NAME' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html." fi APK_DIR_PATH="./app/build/outputs/apk/debug" APK_VERSION_TAG="$RELEASE_VERSION_NAME-github-debug" # Note the "-", GITHUB_SHA will already have "+" before it APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" - # Used by attachment steps later + # Used by upload step later echo "APK_DIR_PATH=$APK_DIR_PATH" >> $GITHUB_ENV echo "APK_VERSION_TAG=$APK_VERSION_TAG" >> $GITHUB_ENV echo "APK_BASENAME_PREFIX=$APK_BASENAME_PREFIX" >> $GITHUB_ENV - echo "Building APK for '$RELEASE_VERSION_NAME' build" + echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" export TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then - exit_on_error "Build failed for '$RELEASE_VERSION_NAME' build." + exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag." fi - echo "Validating APK" + echo "Validating APK file" if ! test -f "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk"; then files_found="$(ls "$APK_DIR_PATH")" - exit_on_error "Failed to find built APK at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" + exit_on_error "Failed to find built APK file at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" fi echo "Generating checksums-sha256.txt file" @@ -62,7 +62,7 @@ jobs: fi echo "checksums-sha256.txt:"$'\n```\n'"$(cat "$APK_DIR_PATH/checksums-sha256.txt")"$'\n```' - - name: Attach files + - name: Upload files to action uses: actions/upload-artifact@v4 with: name: ${{ env.APK_BASENAME_PREFIX }} diff --git a/.github/workflows/github_release_build.yml b/.github/workflows/github_release_build.yml index c625d8d..7143f8c 100644 --- a/.github/workflows/github_release_build.yml +++ b/.github/workflows/github_release_build.yml @@ -1,4 +1,4 @@ -name: Attach Debug APK To Release +name: GitHub Release Build on: release: @@ -6,7 +6,7 @@ on: - published jobs: - attach-apks: + build: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -16,7 +16,7 @@ jobs: with: ref: ${{ env.GITHUB_REF }} - - name: Build and attach APK to release + - name: Build and upload files to release shell: bash {0} run: | exit_on_error() { @@ -30,23 +30,23 @@ jobs: echo "Setting vars" RELEASE_VERSION_NAME="${GITHUB_REF/refs\/tags\//}" if ! printf "%s" "${RELEASE_VERSION_NAME/v/}" | grep -qP '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'; then - exit_on_error "The versionName '${RELEASE_VERSION_NAME/v/}' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html." + exit_on_error "The release version '${RELEASE_VERSION_NAME/v/}' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html." fi APK_DIR_PATH="./app/build/outputs/apk/debug" APK_VERSION_TAG="$RELEASE_VERSION_NAME+github-debug" APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" - echo "Building APK for '$RELEASE_VERSION_NAME' release" + echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then - exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release." + exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag." fi - echo "Validating APK" + echo "Validating APK file" if ! test -f "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk"; then files_found="$(ls "$APK_DIR_PATH")" - exit_on_error "Failed to find built APK at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" + exit_on_error "Failed to find built APK file at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: "$'\n'"$files_found" fi echo "Generating checksums-sha256.txt file" @@ -55,11 +55,11 @@ jobs: fi echo "checksums-sha256.txt:"$'\n```\n'"$(cat "$APK_DIR_PATH/checksums-sha256.txt")"$'\n```' - echo "Attaching APK to github release" + echo "Uploading files to release" if ! hub release edit \ -m "" \ -a "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk" \ -a "$APK_DIR_PATH/checksums-sha256.txt" \ "$RELEASE_VERSION_NAME"; then - exit_on_error "Attach APK to release failed for '$RELEASE_VERSION_NAME' release." + exit_on_error "Upload files to release failed for '$RELEASE_VERSION_NAME' release." fi diff --git a/README.md b/README.md index 9d14cf6..c01bdc2 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,11 @@ The `F-Droid` app often may not notify you of updates and you will manually have ### Github -`Termux:Float` application can be obtained on `Github` either from [`Github Releases`](https://github.com/termux/termux-float/releases) for version `>= 0.15.0` or from [`Github Build`](https://github.com/termux/termux-float/actions/workflows/debug_build.yml) action workflows. +`Termux:Float` application can be obtained on `Github` either from [`Github Releases`](https://github.com/termux/termux-float/releases) for version `>= 0.15.0` or from [`Github Actions`](https://github.com/termux/termux-float/actions/workflows/github_action_build.yml?query=branch%3Amaster+event%3Apush). -The APKs for `Github Releases` will be listed under `Assets` drop-down of a release. These are automatically attached when a new version is released. +The APKs for `Github Releases` will be listed under `Assets` drop-down of the release. These are automatically attached when a new version is released. -The APKs for `Github Build` action workflows will be listed under `Artifacts` section of a workflow run. These are created for each commit/push done to the repository and can be used by users who don't want to wait for releases and want to try out the latest features immediately or want to test their pull requests. Note that for action workflows, you need to be [**logged into a `Github` account**](https://github.com/login) for the `Artifacts` links to be enabled/clickable. If you are using the [`Github` app](https://github.com/mobile), then make sure to open workflow link in a browser like Chrome or Firefox that has your Github account logged in since the in-app browser may not be logged in. +The APKs for `Github Actions` will be listed under `Artifacts` section of the workflow run. These are created for each commit/push done to the repository and can be used by users who don't want to wait for releases and want to try out the latest features immediately or want to test their pull requests. Note that for action workflows, you need to be [**logged into a `Github` account**](https://github.com/login) for the `Artifacts` links to be enabled/clickable. If you are using the [`Github` app](https://github.com/mobile), then make sure to open workflow link in a browser like Chrome or Firefox that has your Github account logged in since the in-app browser may not be logged in. The APKs for both of these are [`debuggable`](https://developer.android.com/studio/debug) and are compatible with each other but they are not compatible with other sources. From b550a0d998eee37776fce6507aca60b859207f82 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 16 Apr 2024 23:23:34 +0500 Subject: [PATCH 18/40] Changed!: Use dot `.` as tags separator instead of dash `-` for `github` release source and `debug` build type in the apk version tag This is done to be consistent with semver build metadata tags. For example `github-debug` will now be `github.debug`. - https://semver.org/#spec-item-10 --- .github/workflows/github_action_build.yml | 2 +- .github/workflows/github_release_build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index e09d692..0d70147 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -35,7 +35,7 @@ jobs: fi APK_DIR_PATH="./app/build/outputs/apk/debug" - APK_VERSION_TAG="$RELEASE_VERSION_NAME-github-debug" # Note the "-", GITHUB_SHA will already have "+" before it + APK_VERSION_TAG="$RELEASE_VERSION_NAME.github.debug" # Note the ".", GITHUB_SHA will already have "+" before it APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" # Used by upload step later diff --git a/.github/workflows/github_release_build.yml b/.github/workflows/github_release_build.yml index 7143f8c..6e45f38 100644 --- a/.github/workflows/github_release_build.yml +++ b/.github/workflows/github_release_build.yml @@ -34,7 +34,7 @@ jobs: fi APK_DIR_PATH="./app/build/outputs/apk/debug" - APK_VERSION_TAG="$RELEASE_VERSION_NAME+github-debug" + APK_VERSION_TAG="$RELEASE_VERSION_NAME+github.debug" APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" From 3f4e87355f79e61151111ab70215f8f60a87f3fc Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 22 Jun 2024 07:05:06 +0500 Subject: [PATCH 19/40] Changed!: Add `-app` suffix to app name and add version name in APKs generated --- .github/workflows/github_action_build.yml | 2 +- .github/workflows/github_release_build.yml | 2 +- app/build.gradle | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index 0d70147..930598a 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -36,7 +36,7 @@ jobs: APK_DIR_PATH="./app/build/outputs/apk/debug" APK_VERSION_TAG="$RELEASE_VERSION_NAME.github.debug" # Note the ".", GITHUB_SHA will already have "+" before it - APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" + APK_BASENAME_PREFIX="termux-float-app_$APK_VERSION_TAG" # Used by upload step later echo "APK_DIR_PATH=$APK_DIR_PATH" >> $GITHUB_ENV diff --git a/.github/workflows/github_release_build.yml b/.github/workflows/github_release_build.yml index 6e45f38..8c630af 100644 --- a/.github/workflows/github_release_build.yml +++ b/.github/workflows/github_release_build.yml @@ -35,7 +35,7 @@ jobs: APK_DIR_PATH="./app/build/outputs/apk/debug" APK_VERSION_TAG="$RELEASE_VERSION_NAME+github.debug" - APK_BASENAME_PREFIX="termux-float_$APK_VERSION_TAG" + APK_BASENAME_PREFIX="termux-float-app_$APK_VERSION_TAG" echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle diff --git a/app/build.gradle b/app/build.gradle index 9ae647e..39710f7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,11 +49,8 @@ android { applicationVariants.all { variant -> variant.outputs.all { output -> - if (variant.buildType.name == "debug") { - outputFileName = new File("termux-float_" + (apkVersionTag ? apkVersionTag : "debug") + ".apk") - } else if (variant.buildType.name == "release") { - outputFileName = new File("termux-float_" + (apkVersionTag ? apkVersionTag : "release") + ".apk") - } + outputFileName = new File("termux-float-app_" + + (apkVersionTag ? apkVersionTag : "v" + versionName + "+" + variant.buildType.name) + ".apk") } } } From 35f064f76fc4619fc32321b0c969ff5e441a0c95 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 16 Apr 2024 23:51:27 +0500 Subject: [PATCH 20/40] Changed: Use GitHub `cli` instead of `hub` for uploading GitHub release files as later has been removed from runner images - https://github.com/actions/runner-images/issues/8362 --- .github/workflows/github_release_build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/github_release_build.yml b/.github/workflows/github_release_build.yml index 8c630af..9b6db58 100644 --- a/.github/workflows/github_release_build.yml +++ b/.github/workflows/github_release_build.yml @@ -56,10 +56,9 @@ jobs: echo "checksums-sha256.txt:"$'\n```\n'"$(cat "$APK_DIR_PATH/checksums-sha256.txt")"$'\n```' echo "Uploading files to release" - if ! hub release edit \ - -m "" \ - -a "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk" \ - -a "$APK_DIR_PATH/checksums-sha256.txt" \ - "$RELEASE_VERSION_NAME"; then + if ! gh release upload "$RELEASE_VERSION_NAME" \ + "$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk" \ + "$APK_DIR_PATH/checksums-sha256.txt" \ + ; then exit_on_error "Upload files to release failed for '$RELEASE_VERSION_NAME' release." fi From 33660b5a3617e5703990d4616e4131838ca3b6de Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Wed, 17 Apr 2024 01:23:14 +0500 Subject: [PATCH 21/40] Added: Add `workflow_dispatch` and `cron` schedule for "00:15 on 1st of every 2nd month" to `github_action_build` workflow triggers - `workflow_dispatch` can be used to manually trigger a build, in case action run was deleted or artifacts get expired. - `cron` is scheduled to be run every 2nd month (`~60` days) because artifacts expire after `90` days by default, and there is no easy way to set `89` days from now/start of year or ideally last commit, and some months have 28 or 31 days, which would make it even harder. Additionally, workflow should get triggered based on `cron` schedule regardless of last push time, so multiple action runs may exist for every commit anyways, so using 2nd month shouldn't be an issue. - `cron` is scheduled to be run on the 15th minute to reduce chances of workflow getting dropped. If it does get dropped, then `workflow_dispatch` can be used. > The schedule event can be delayed during periods of high loads of GitHub Actions workflow runs. High load times include the start of every hour. If the load is sufficiently high enough, some queued jobs may be dropped. To decrease the chance of delay, schedule your workflow to run at a different time of the hour. - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule --- .github/workflows/github_action_build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index 930598a..0126470 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -7,6 +7,9 @@ on: pull_request: branches: - master + schedule: + - cron: "15 0 1 */2 *" + workflow_dispatch: jobs: build: From 829d0165780c4dbc9623cc982ac0c733a64be230 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Wed, 17 Apr 2024 23:24:06 +0500 Subject: [PATCH 22/40] Changed: Rename `minSdkVersion` to `minSdk`, `targetSdkVersion` to `targetSdk` and `compileSdkVersion` to `compileSdk` in `build.gradle` files `compileSdkVersion` was deprecated in Android gradle plugin (`AGP`) version `>= 7.2.0` in favour of `compileSdk`, so replace `Version` suffix from other related variables as well to be consistent. - https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/CommonExtension#compileSdkVersion(kotlin.Int) --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 39710f7..7445d23 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion project.properties.compileSdkVersion.toInteger() + compileSdk project.properties.compileSdkVersion.toInteger() def appVersionName = System.getenv("TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME") ?: "" def apkVersionTag = System.getenv("TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG") ?: "" defaultConfig { applicationId "com.termux.window" - minSdkVersion project.properties.minSdkVersion.toInteger() - targetSdkVersion project.properties.targetSdkVersion.toInteger() + minSdk project.properties.minSdkVersion.toInteger() + targetSdk project.properties.targetSdkVersion.toInteger() versionCode 15 versionName "0.15.0" From 8546eb8eaf0ff5b79a3aae155ab4d266bab33c61 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Thu, 19 Dec 2024 02:27:01 +0500 Subject: [PATCH 23/40] Changed!: Rename `app/build.gradle` environmental variables to `TERMUX_FLOAT_APP__BUILD__` scope instead of `TERMUX_FLOAT_APP_BUILD__` - Renamed `TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME` to `TERMUX_FLOAT_APP__BUILD__APP_VERSION_NAME` - Renamed `TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG` to `TERMUX_FLOAT_APP__BUILD__APK_VERSION_TAG` --- .github/workflows/github_action_build.yml | 4 ++-- .github/workflows/github_release_build.yml | 2 +- app/build.gradle | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/github_action_build.yml b/.github/workflows/github_action_build.yml index 0126470..9134698 100644 --- a/.github/workflows/github_action_build.yml +++ b/.github/workflows/github_action_build.yml @@ -47,8 +47,8 @@ jobs: echo "APK_BASENAME_PREFIX=$APK_BASENAME_PREFIX" >> $GITHUB_ENV echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" - export TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle - export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle + export TERMUX_FLOAT_APP__BUILD__APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle + export TERMUX_FLOAT_APP__BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag." fi diff --git a/.github/workflows/github_release_build.yml b/.github/workflows/github_release_build.yml index 9b6db58..1ac69ba 100644 --- a/.github/workflows/github_release_build.yml +++ b/.github/workflows/github_release_build.yml @@ -38,7 +38,7 @@ jobs: APK_BASENAME_PREFIX="termux-float-app_$APK_VERSION_TAG" echo "Building APK file for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag" - export TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle + export TERMUX_FLOAT_APP__BUILD__APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle if ! ./gradlew assembleDebug; then exit_on_error "Build failed for '$RELEASE_VERSION_NAME' release with '$APK_VERSION_TAG' tag." fi diff --git a/app/build.gradle b/app/build.gradle index 7445d23..58cb796 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,8 +2,8 @@ apply plugin: 'com.android.application' android { compileSdk project.properties.compileSdkVersion.toInteger() - def appVersionName = System.getenv("TERMUX_FLOAT_APP_BUILD__APP_VERSION_NAME") ?: "" - def apkVersionTag = System.getenv("TERMUX_FLOAT_APP_BUILD__APK_VERSION_TAG") ?: "" + def appVersionName = System.getenv("TERMUX_FLOAT_APP__BUILD__APP_VERSION_NAME") ?: "" + def apkVersionTag = System.getenv("TERMUX_FLOAT_APP__BUILD__APK_VERSION_TAG") ?: "" defaultConfig { applicationId "com.termux.window" From 93fcf5eb96ea68663fb38c0738acc1cbe1af80d1 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 22 Dec 2024 16:09:53 +0500 Subject: [PATCH 24/40] Changed: Bump gradle to `8.9`, gradle android plugin to `8.7.3` and `compileSdkVersion` to `35` --- app/build.gradle | 2 ++ app/src/main/AndroidManifest.xml | 1 - build.gradle | 2 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 58cb796..286991a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,8 @@ apply plugin: 'com.android.application' android { + namespace "com.termux.window" + compileSdk project.properties.compileSdkVersion.toInteger() def appVersionName = System.getenv("TERMUX_FLOAT_APP__BUILD__APP_VERSION_NAME") ?: "" def apkVersionTag = System.getenv("TERMUX_FLOAT_APP__BUILD__APK_VERSION_TAG") ?: "" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 50f8976..6617df8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ diff --git a/build.gradle b/build.gradle index 565c865..2452b6d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath "com.android.tools.build:gradle:8.7.3" } } diff --git a/gradle.properties b/gradle.properties index 8618581..bff406b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,4 @@ android.useAndroidX=true minSdkVersion=24 targetSdkVersion=28 -compileSdkVersion=30 +compileSdkVersion=35 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a0f7639..2fa91c5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 62c713ae0ee105befddf7092cbbbe2bd86a3cc43 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 22 Dec 2024 16:23:18 +0500 Subject: [PATCH 25/40] Fixed: Catch rare `RuntimeException` while loading bell and use `if` instead of `case` ``` java.lang.RuntimeException: Unable to resume activity {com.termux/com.termux.app.TermuxActivity}: android.content.res.Resources$NotFoundException: File res/raw/bell.ogg from drawable resource ID #0x7f0f0001 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3480) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3520) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1554) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6247) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107) Caused by: android.content.res.Resources$NotFoundException: File res/raw/bell.ogg from drawable resource ID #0x7f0f0001 at android.content.res.ResourcesImpl.openRawResourceFd(ResourcesImpl.java:308) at android.content.res.Resources.openRawResourceFd(Resources.java:1272) at android.media.SoundPool.load(SoundPool.java:247) at com.termux.app.terminal.TermuxTerminalSessionClient.getBellSoundPool(TermuxTerminalSessionClient.java:257) at com.termux.app.terminal.TermuxTerminalSessionClient.onResume(TermuxTerminalSessionClient.java:82) at com.termux.app.TermuxActivity.onResume(TermuxActivity.java:290) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1270) at android.app.Activity.performResume(Activity.java:6861) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3457) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3520) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1554) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6247) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107) Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed at android.content.res.AssetManager.openNonAssetFdNative(Native Method) at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:467) at android.content.res.ResourcesImpl.openRawResourceFd(ResourcesImpl.java:306) at android.content.res.Resources.openRawResourceFd(Resources.java:1272) at android.media.SoundPool.load(SoundPool.java:247) at com.termux.app.terminal.TermuxTerminalSessionClient.getBellSoundPool(TermuxTerminalSessionClient.java:257) at com.termux.app.terminal.TermuxTerminalSessionClient.onResume(TermuxTerminalSessionClient.java:82) at com.termux.app.TermuxActivity.onResume(TermuxActivity.java:290) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1270) at android.app.Activity.performResume(Activity.java:6861) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3457) ``` at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3520) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1554) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6247) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107) --- .../window/TermuxFloatSessionClient.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java index ee6cce9..d92d7dc 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java +++ b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java @@ -45,7 +45,7 @@ public void onAttachedToWindow() { // Just initialize the mBellSoundPool and load the sound, otherwise bell might not run // the first time bell key is pressed and play() is called, since sound may not be loaded // quickly enough before the call to play(). https://stackoverflow.com/questions/35435625 - getBellSoundPool(); + loadBellSoundPool(); } /** @@ -102,16 +102,15 @@ public void onPasteTextFromClipboard(TerminalSession session) { public void onBell(TerminalSession session) { if (!mView.isVisible()) return; - switch (mView.getProperties().getBellBehaviour()) { - case TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_VIBRATE: - BellHandler.getInstance(mService).doBell(); - break; - case TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_BEEP: - getBellSoundPool().play(mBellSoundId, 1.f, 1.f, 1, 0, 1.f); - break; - case TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_IGNORE: - // Ignore the bell character. - break; + int bellBehaviour = mView.getProperties().getBellBehaviour(); + if (bellBehaviour == TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_VIBRATE) { + BellHandler.getInstance(mService).doBell(); + } else if (bellBehaviour == TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_BEEP) { + loadBellSoundPool(); + if (mBellSoundPool != null) + mBellSoundPool.play(mBellSoundId, 1.f, 1.f, 1, 0, 1.f); + } else if (bellBehaviour == TermuxPropertyConstants.IVALUE_BELL_BEHAVIOUR_IGNORE) { + // Ignore the bell character. } } @@ -127,17 +126,20 @@ public Integer getTerminalCursorStyle() { } - /** Initialize and get mBellSoundPool */ - private synchronized SoundPool getBellSoundPool() { + /** Load mBellSoundPool */ + private synchronized void loadBellSoundPool() { if (mBellSoundPool == null) { mBellSoundPool = new SoundPool.Builder().setMaxStreams(1).setAudioAttributes( new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION).build()).build(); - mBellSoundId = mBellSoundPool.load(mService, R.raw.bell, 1); + try { + mBellSoundId = mBellSoundPool.load(mService, com.termux.shared.R.raw.bell, 1); + } catch (Exception e){ + // Catch java.lang.RuntimeException: Unable to resume activity {com.termux/com.termux.app.TermuxActivity}: android.content.res.Resources$NotFoundException: File res/raw/bell.ogg from drawable resource ID + Logger.logStackTraceWithMessage(LOG_TAG, "Failed to load bell sound pool", e); + } } - - return mBellSoundPool; } /** Release mBellSoundPool resources */ From 39c4a17bcb2cdbd91d316a830ad16dc7299c2054 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 22 Dec 2024 16:27:25 +0500 Subject: [PATCH 26/40] Changed: Log full intent for `TermuxFloatService` and remove multiple log entries for action --- .../main/java/com/termux/window/TermuxFloatService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/termux/window/TermuxFloatService.java b/app/src/main/java/com/termux/window/TermuxFloatService.java index 5e83b1f..321787a 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatService.java +++ b/app/src/main/java/com/termux/window/TermuxFloatService.java @@ -56,20 +56,21 @@ public int onStartCommand(Intent intent, int flags, int startId) { if (mFloatingWindow == null && !initializeFloatView()) return Service.START_NOT_STICKY; - String action = intent.getAction(); + String action = null; + if (intent != null) { + Logger.logVerboseExtended(LOG_TAG, "Received intent:\n" + IntentUtils.getIntentString(intent)); + action = intent.getAction(); + } if (action != null) { switch (action) { case TERMUX_FLOAT_SERVICE.ACTION_STOP_SERVICE: - Logger.logDebug(LOG_TAG, "ACTION_STOP_SERVICE intent received"); actionStopService(); break; case TERMUX_FLOAT_SERVICE.ACTION_SHOW: - Logger.logDebug(LOG_TAG, "ACTION_SHOW intent received"); setVisible(true); break; case TERMUX_FLOAT_SERVICE.ACTION_HIDE: - Logger.logDebug(LOG_TAG, "ACTION_HIDE intent received"); setVisible(false); break; default: From 4ce49587c8455b81bfcd30dec558528afa2e4ced Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 22 Dec 2024 16:35:13 +0500 Subject: [PATCH 27/40] Changed: Update gradle dependencies --- app/build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 286991a..85d6cd4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,7 +58,9 @@ android { } dependencies { - implementation 'androidx.annotation:annotation:1.3.0' + testImplementation "junit:junit:4.13.2" + + implementation "androidx.annotation:annotation:1.9.1" implementation 'com.termux.termux-app:termux-shared:fcc0d36258' implementation 'com.termux.termux-app:terminal-view:fcc0d36258' @@ -69,7 +71,6 @@ dependencies { //implementation 'com.termux:termux-shared:0.117' //implementation 'com.termux:terminal-view:0.117' - testImplementation 'junit:junit:4.13.2' } task versionName { From e416c8c0afb3807b23fbe9cdfec50ff61cf1f9da Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sun, 22 Dec 2024 16:37:57 +0500 Subject: [PATCH 28/40] Changed: Implicitly typecast float to int for bubble size pixels --- app/src/main/java/com/termux/window/FloatingBubbleManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/termux/window/FloatingBubbleManager.java b/app/src/main/java/com/termux/window/FloatingBubbleManager.java index 639e514..31e8e58 100644 --- a/app/src/main/java/com/termux/window/FloatingBubbleManager.java +++ b/app/src/main/java/com/termux/window/FloatingBubbleManager.java @@ -32,7 +32,7 @@ public class FloatingBubbleManager { public FloatingBubbleManager(TermuxFloatView termuxFloatView) { mTermuxFloatView = termuxFloatView; - BUBBLE_SIZE_PX = ViewUtils.dpToPx(mTermuxFloatView.getContext(), DEFAULT_BUBBLE_SIZE_DP); + BUBBLE_SIZE_PX = (int) ViewUtils.dpToPx(mTermuxFloatView.getContext(), DEFAULT_BUBBLE_SIZE_DP); } public void toggleBubble() { From 4c4bd64f0971571909898aa73246f2cf9619ddb6 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 23 Dec 2024 04:41:56 +0500 Subject: [PATCH 29/40] Added: Add `INTERNET` permission The internet permission may solve problems for Termux app not having internet access if Termux:Float app is installed first due to Android `sharedUserId` bugs which shares permissions across all apps. --- app/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6617df8..b3aed65 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,8 +5,8 @@ + - Date: Mon, 23 Dec 2024 04:48:31 +0500 Subject: [PATCH 30/40] Changed: Bump `termux-shared` to `b0e1dbc3da` --- app/build.gradle | 23 ++++++++++++++----- .../termux/window/TermuxFloatApplication.java | 4 ++-- .../com/termux/window/TermuxFloatService.java | 16 +++++++------ .../window/TermuxFloatSessionClient.java | 6 ++--- .../com/termux/window/TermuxFloatView.java | 2 +- .../termux/window/TermuxFloatViewClient.java | 2 +- .../TermuxFloatAppSharedProperties.java | 4 ++-- 7 files changed, 35 insertions(+), 22 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 85d6cd4..ca0442b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,8 +45,11 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true + + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } applicationVariants.all { variant -> @@ -55,22 +58,30 @@ android { (apkVersionTag ? apkVersionTag : "v" + versionName + "+" + variant.buildType.name) + ".apk") } } + + packagingOptions { + // Remove terminal-shared JNI libs added via termux-shared dependency + exclude "lib/*/liblocal-socket.so" + } } dependencies { + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" + testImplementation "junit:junit:4.13.2" implementation "androidx.annotation:annotation:1.9.1" - implementation 'com.termux.termux-app:termux-shared:fcc0d36258' - implementation 'com.termux.termux-app:terminal-view:fcc0d36258' + implementation "com.termux.termux-app:termux-shared:b0e1dbc3da" + implementation "com.termux.termux-app:terminal-view:b0e1dbc3da" // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`. // If updates are done, republish there and sync project with gradle files here // https://github.com/termux/termux-app/wiki/Termux-Libraries - //implementation 'com.termux:termux-shared:0.117' - //implementation 'com.termux:terminal-view:0.117' + //implementation "com.termux:termux-shared:0.118.0" + //implementation "com.termux:terminal-view:0.118.0" + implementation "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" } task versionName { diff --git a/app/src/main/java/com/termux/window/TermuxFloatApplication.java b/app/src/main/java/com/termux/window/TermuxFloatApplication.java index 8910191..1422bef 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatApplication.java +++ b/app/src/main/java/com/termux/window/TermuxFloatApplication.java @@ -3,10 +3,10 @@ import android.app.Application; import android.content.Context; -import com.termux.shared.crash.TermuxCrashUtils; import com.termux.shared.logger.Logger; -import com.termux.shared.settings.preferences.TermuxFloatAppSharedPreferences; import com.termux.shared.termux.TermuxConstants; +import com.termux.shared.termux.crash.TermuxCrashUtils; +import com.termux.shared.termux.settings.preferences.TermuxFloatAppSharedPreferences; public class TermuxFloatApplication extends Application { diff --git a/app/src/main/java/com/termux/window/TermuxFloatService.java b/app/src/main/java/com/termux/window/TermuxFloatService.java index 321787a..3940222 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatService.java +++ b/app/src/main/java/com/termux/window/TermuxFloatService.java @@ -15,13 +15,14 @@ import android.view.LayoutInflater; import android.view.View; +import com.termux.shared.data.IntentUtils; import com.termux.shared.logger.Logger; -import com.termux.shared.models.ExecutionCommand; import com.termux.shared.notification.NotificationUtils; -import com.termux.shared.shell.TermuxSession; -import com.termux.shared.shell.TermuxShellEnvironmentClient; +import com.termux.shared.shell.command.ExecutionCommand; import com.termux.shared.termux.TermuxConstants; import com.termux.shared.termux.TermuxConstants.TERMUX_FLOAT_APP.TERMUX_FLOAT_SERVICE; +import com.termux.shared.termux.shell.command.environment.TermuxShellEnvironment; +import com.termux.shared.termux.shell.command.runner.terminal.TermuxSession; import com.termux.terminal.TerminalSession; public class TermuxFloatService extends Service { @@ -179,7 +180,7 @@ private boolean initializeFloatView() { mFloatingWindow.initFloatView(this); mSession = createTermuxSession( - new ExecutionCommand(0, null, null, null, mFloatingWindow.getProperties().getDefaultWorkingDirectory(), false, false), null); + new ExecutionCommand(0, null, null, null, mFloatingWindow.getProperties().getDefaultWorkingDirectory(), ExecutionCommand.Runner.TERMINAL_SESSION.getName(), false), null); if (mSession == null) return false; mFloatingWindow.getTerminalView().attachSession(mSession.getTerminalSession()); @@ -216,7 +217,7 @@ public synchronized TermuxSession createTermuxSession(ExecutionCommand execution Logger.logDebug(LOG_TAG, "Creating \"" + executionCommand.getCommandIdAndLabelLogString() + "\" TermuxSession"); - if (executionCommand.inBackground) { + if (ExecutionCommand.Runner.APP_SHELL.getName().equals(executionCommand.runner)) { Logger.logDebug(LOG_TAG, "Ignoring a background execution command passed to createTermuxSession()"); return null; } @@ -224,10 +225,11 @@ public synchronized TermuxSession createTermuxSession(ExecutionCommand execution if (Logger.getLogLevel() >= Logger.LOG_LEVEL_VERBOSE) Logger.logVerboseExtended(LOG_TAG, executionCommand.toString()); + executionCommand.shellName = sessionName; executionCommand.terminalTranscriptRows = mFloatingWindow.getProperties().getTerminalTranscriptRows(); TermuxSession newTermuxSession = TermuxSession.execute(this, executionCommand, - mFloatingWindow.getTermuxFloatSessionClient(), null, new TermuxShellEnvironmentClient(), - sessionName, executionCommand.isPluginExecutionCommand); + mFloatingWindow.getTermuxFloatSessionClient(), null, new TermuxShellEnvironment(), + null, executionCommand.isPluginExecutionCommand); if (newTermuxSession == null) { Logger.logError(LOG_TAG, "Failed to execute new TermuxSession command for:\n" + executionCommand.getCommandIdAndLabelLogString()); return null; diff --git a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java index d92d7dc..135fc4f 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java +++ b/app/src/main/java/com/termux/window/TermuxFloatSessionClient.java @@ -9,10 +9,10 @@ import android.text.TextUtils; import com.termux.shared.logger.Logger; -import com.termux.shared.settings.properties.TermuxPropertyConstants; -import com.termux.shared.terminal.TermuxTerminalSessionClientBase; -import com.termux.shared.terminal.io.BellHandler; import com.termux.shared.termux.TermuxConstants; +import com.termux.shared.termux.settings.properties.TermuxPropertyConstants; +import com.termux.shared.termux.terminal.TermuxTerminalSessionClientBase; +import com.termux.shared.termux.terminal.io.BellHandler; import com.termux.terminal.TerminalColors; import com.termux.terminal.TerminalSession; import com.termux.terminal.TextStyle; diff --git a/app/src/main/java/com/termux/window/TermuxFloatView.java b/app/src/main/java/com/termux/window/TermuxFloatView.java index 629c279..dff9e46 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatView.java +++ b/app/src/main/java/com/termux/window/TermuxFloatView.java @@ -18,8 +18,8 @@ import android.widget.LinearLayout; import com.termux.shared.logger.Logger; -import com.termux.shared.settings.preferences.TermuxFloatAppSharedPreferences; import com.termux.shared.termux.TermuxConstants; +import com.termux.shared.termux.settings.preferences.TermuxFloatAppSharedPreferences; import com.termux.shared.view.KeyboardUtils; import com.termux.terminal.TerminalSession; import com.termux.terminal.TerminalSessionClient; diff --git a/app/src/main/java/com/termux/window/TermuxFloatViewClient.java b/app/src/main/java/com/termux/window/TermuxFloatViewClient.java index c52906b..ad814ed 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatViewClient.java +++ b/app/src/main/java/com/termux/window/TermuxFloatViewClient.java @@ -6,7 +6,7 @@ import android.view.KeyEvent; import android.view.MotionEvent; -import com.termux.shared.terminal.TermuxTerminalViewClientBase; +import com.termux.shared.termux.terminal.TermuxTerminalViewClientBase; import com.termux.shared.view.KeyboardUtils; import com.termux.terminal.KeyHandler; import com.termux.terminal.TerminalEmulator; diff --git a/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java b/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java index 2690c33..d18909e 100644 --- a/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java +++ b/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java @@ -4,9 +4,9 @@ import androidx.annotation.NonNull; -import com.termux.shared.settings.properties.TermuxPropertyConstants; -import com.termux.shared.settings.properties.TermuxSharedProperties; import com.termux.shared.termux.TermuxConstants; +import com.termux.shared.termux.settings.properties.TermuxPropertyConstants; +import com.termux.shared.termux.settings.properties.TermuxSharedProperties; public class TermuxFloatAppSharedProperties extends TermuxSharedProperties { From 599aacefe4ccd5e6c2be81dac43fd962db62fd38 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 23 Dec 2024 05:46:45 +0500 Subject: [PATCH 31/40] Changed: Set `DEFAULT_LOG_TAG` at application startup as per termux/termux-app@1b794b35 and termux/termux-app@6ff55729 --- .../com/termux/window/TermuxFloatActivity.java | 4 ++++ .../com/termux/window/TermuxFloatApplication.java | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/termux/window/TermuxFloatActivity.java b/app/src/main/java/com/termux/window/TermuxFloatActivity.java index 1572667..315d20a 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatActivity.java +++ b/app/src/main/java/com/termux/window/TermuxFloatActivity.java @@ -11,6 +11,10 @@ public class TermuxFloatActivity extends Activity { @Override protected void onResume() { super.onResume(); + + // Set log level for the app + TermuxFloatApplication.setLogConfig(this, false); + startService(new Intent(this, TermuxFloatService.class)); finish(); } diff --git a/app/src/main/java/com/termux/window/TermuxFloatApplication.java b/app/src/main/java/com/termux/window/TermuxFloatApplication.java index 1422bef..cd55375 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatApplication.java +++ b/app/src/main/java/com/termux/window/TermuxFloatApplication.java @@ -2,6 +2,7 @@ import android.app.Application; import android.content.Context; +import android.util.Log; import com.termux.shared.logger.Logger; import com.termux.shared.termux.TermuxConstants; @@ -10,20 +11,24 @@ public class TermuxFloatApplication extends Application { + public static final String LOG_TAG = "TermuxFloatApplication"; + public void onCreate() { super.onCreate(); + Log.i(LOG_TAG, "AppInit"); + + Context context = getApplicationContext(); + // Set crash handler for the app - TermuxCrashUtils.setCrashHandler(this); + TermuxCrashUtils.setCrashHandler(context); // Set log config for the app - setLogConfig(getApplicationContext(), true); - - Logger.logDebug("Starting Application"); + setLogConfig(context, true); } public static void setLogConfig(Context context, boolean commitToFile) { - //Logger.setDefaultLogTag(TermuxConstants.TERMUX_FLOAT_APP_NAME); + Logger.setDefaultLogTag(TermuxConstants.TERMUX_FLOAT_APP_NAME.replaceAll("[: ]", "")); // Load the log level from shared preferences and set it to the {@link Logger.CURRENT_LOG_LEVEL} TermuxFloatAppSharedPreferences preferences = TermuxFloatAppSharedPreferences.build(context); From b29a4a17dd47c2ab4b0dd7a8c3a2a6eda01c4d46 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 23 Dec 2024 04:49:48 +0500 Subject: [PATCH 32/40] Release: v0.16.0 The `versionCode` has been bumped to `1000` so that users who have installed from F-Droid or GitHub should not have the app attempted to be updated by Google PlayStore and failing and also shown in PlayStore app updates list in case the `versionCode` is set to higher than the latest F-Droid or GitHub release. Unlike F-Droid, PlayStore does not check for difference in app APK signature before attempting to download and then failing to install due to signature mismatch. - termux/termux-app#4000 - termux/termux-app#4012 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ca0442b..dbd9ee3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.termux.window" minSdk project.properties.minSdkVersion.toInteger() targetSdk project.properties.targetSdkVersion.toInteger() - versionCode 15 - versionName "0.15.0" + versionCode 1000 + versionName "0.16.0" if (appVersionName) versionName = appVersionName validateVersionName(versionName) From 14c5f734c9dc6c1c5ed8267a5e45015945387174 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Fri, 2 May 2025 04:05:00 +0500 Subject: [PATCH 33/40] Changed: Bump `termux-shared` to `9ee1c9d5ad` Related commit https://github.com/termux/termux-app/commit/d2cd6ac2 The older `b0e1dbc3da` commit is also resulting in `> Could not GET 'https://jitpack.io/com/termux/termux-app/termux-shared/b0e1dbc3da/termux-shared-b0e1dbc3da.pom'. Received status code 401 from server: Unauthorized` and build is not found in jitpack commits list. Related issue https://github.com/jitpack/jitpack.io/issues/7063 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dbd9ee3..51bae1e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,8 +72,8 @@ dependencies { implementation "androidx.annotation:annotation:1.9.1" - implementation "com.termux.termux-app:termux-shared:b0e1dbc3da" - implementation "com.termux.termux-app:terminal-view:b0e1dbc3da" + implementation "com.termux.termux-app:termux-shared:9ee1c9d5ad" + implementation "com.termux.termux-app:terminal-view:9ee1c9d5ad" // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`. // If updates are done, republish there and sync project with gradle files here From 64bc3c5b588fcf22e374a35a0e3b4d3c162df57d Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Fri, 2 May 2025 04:17:58 +0500 Subject: [PATCH 34/40] Fixed: Fix `TermuxFloatAppSharedProperties` as per changes in `termux-shared` library - https://github.com/termux/termux-app/commit/82b15803126138eef8899e0c7b582713f872cd09 - https://github.com/termux/termux-app/commit/05283bd7745ee789b5468186a8d47e6c7700af6b --- .../properties/TermuxFloatAppSharedProperties.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java b/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java index d18909e..0986af8 100644 --- a/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java +++ b/app/src/main/java/com/termux/window/settings/properties/TermuxFloatAppSharedProperties.java @@ -13,16 +13,10 @@ public class TermuxFloatAppSharedProperties extends TermuxSharedProperties { private static final String LOG_TAG = "TermuxFloatAppSharedProperties"; public TermuxFloatAppSharedProperties(@NonNull Context context) { - super(context, TermuxConstants.TERMUX_FLOAT_APP_NAME, TermuxPropertyConstants.getTermuxFloatPropertiesFile(), - TermuxPropertyConstants.TERMUX_PROPERTIES_LIST, new SharedPropertiesParserClient()); - } - - /** - * Load the {@link TermuxPropertyConstants#KEY_TERMINAL_TRANSCRIPT_ROWS} value from termux properties file on disk. - */ - public static int getTerminalTranscriptRows(Context context) { - return (int) TermuxSharedProperties.getInternalPropertyValue(context, TermuxPropertyConstants.getTermuxFloatPropertiesFile(), - TermuxPropertyConstants.KEY_TERMINAL_TRANSCRIPT_ROWS, new SharedPropertiesParserClient()); + super(context, TermuxConstants.TERMUX_FLOAT_APP_NAME, + TermuxConstants.TERMUX_FLOAT_PROPERTIES_FILE_PATHS_LIST, + TermuxPropertyConstants.TERMUX_APP_PROPERTIES_LIST, + new SharedPropertiesParserClient()); } } From cb730d5b9b58a09582afdc7ed2e74e6b866d0029 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Fri, 23 May 2025 03:59:07 +0500 Subject: [PATCH 35/40] Changed: Bump `termux-shared` to `da3a0ac4e2` Related commit https://github.com/termux/termux-app/commit/4de0caac Related commit https://github.com/termux/termux-app/commit/da3a0ac4 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 51bae1e..4fa5bcf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,8 +72,8 @@ dependencies { implementation "androidx.annotation:annotation:1.9.1" - implementation "com.termux.termux-app:termux-shared:9ee1c9d5ad" - implementation "com.termux.termux-app:terminal-view:9ee1c9d5ad" + implementation "com.termux.termux-app:termux-shared:da3a0ac4e2" + implementation "com.termux.termux-app:terminal-view:da3a0ac4e2" // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`. // If updates are done, republish there and sync project with gradle files here From f2f37f78fdbcd8308c3e89a27a165e6dd708e902 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Thu, 26 Jun 2025 04:38:41 +0500 Subject: [PATCH 36/40] Added: Add `SECURITY.md` --- SECURITY.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..479f15c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1 @@ +Check https://termux.dev/security for info on Termux security policies and how to report vulnerabilities. From 61030a9590f59eb597c85f91a44ca702a4fbe833 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 12 Jul 2025 14:44:39 +0500 Subject: [PATCH 37/40] Changed: Bump termux-shared to 7bceab88e2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4fa5bcf..b80e8d3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,8 +72,8 @@ dependencies { implementation "androidx.annotation:annotation:1.9.1" - implementation "com.termux.termux-app:termux-shared:da3a0ac4e2" - implementation "com.termux.termux-app:terminal-view:da3a0ac4e2" + implementation "com.termux.termux-app:termux-shared:7bceab88e2" + implementation "com.termux.termux-app:terminal-view:7bceab88e2" // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`. // If updates are done, republish there and sync project with gradle files here From 09f479968fe9ac864be2e3ba68cd6ddc00b311cf Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 2 Sep 2025 04:22:26 +0500 Subject: [PATCH 38/40] Fixed: Add `PendingIntent` immutability flags to prevent `Warning: Missing PendingIntent mutability flag [UnspecifiedImmutableFlag]` error - https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability --- .../main/java/com/termux/window/TermuxFloatService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/termux/window/TermuxFloatService.java b/app/src/main/java/com/termux/window/TermuxFloatService.java index 3940222..ee01978 100644 --- a/app/src/main/java/com/termux/window/TermuxFloatService.java +++ b/app/src/main/java/com/termux/window/TermuxFloatService.java @@ -138,7 +138,8 @@ private Notification buildNotification() { final String intentAction = mVisibleWindow ? TERMUX_FLOAT_SERVICE.ACTION_HIDE : TERMUX_FLOAT_SERVICE.ACTION_SHOW; Intent notificationIntent = new Intent(this, TermuxFloatService.class).setAction(intentAction); - PendingIntent contentIntent = PendingIntent.getService(this, 0, notificationIntent, 0); + PendingIntent contentIntent = PendingIntent.getService(this, 0, notificationIntent, + Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0); // Build the notification Notification.Builder builder = NotificationUtils.geNotificationBuilder(this, @@ -161,7 +162,9 @@ private Notification buildNotification() { // Set Exit button action Intent exitIntent = new Intent(this, TermuxFloatService.class).setAction(TERMUX_FLOAT_SERVICE.ACTION_STOP_SERVICE); - builder.addAction(android.R.drawable.ic_delete, res.getString(R.string.notification_action_exit), PendingIntent.getService(this, 0, exitIntent, 0)); + builder.addAction(android.R.drawable.ic_delete, res.getString(R.string.notification_action_exit), + PendingIntent.getService(this, 0, exitIntent, + Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0)); return builder.build(); } From b435f4b671fd1702817e889ef680850a9934a05f Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Tue, 2 Sep 2025 04:25:06 +0500 Subject: [PATCH 39/40] Release: v0.17.0 --- README.md | 2 +- app/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c01bdc2..469ae98 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A [Termux] plugin app to show the terminal in a floating terminal window. ### Installation -Latest version is `v0.15.0`. +Latest version is `v0.17.0`. **Check [`termux-app` Installation](https://github.com/termux/termux-app#Installation) for details before reading forward.** diff --git a/app/build.gradle b/app/build.gradle index b80e8d3..82357ab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.termux.window" minSdk project.properties.minSdkVersion.toInteger() targetSdk project.properties.targetSdkVersion.toInteger() - versionCode 1000 - versionName "0.16.0" + versionCode 1001 + versionName "0.17.0" if (appVersionName) versionName = appVersionName validateVersionName(versionName) From 75352bde928e9888a2aa2ad7e130f16118391b75 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Wed, 29 Oct 2025 19:40:21 +0500 Subject: [PATCH 40/40] Changed: Bump termux-shared to 8aca6dbbf4 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 82357ab..432ba1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,8 +72,8 @@ dependencies { implementation "androidx.annotation:annotation:1.9.1" - implementation "com.termux.termux-app:termux-shared:7bceab88e2" - implementation "com.termux.termux-app:terminal-view:7bceab88e2" + implementation "com.termux.termux-app:termux-shared:8aca6dbbf4" + implementation "com.termux.termux-app:terminal-view:8aca6dbbf4" // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`. // If updates are done, republish there and sync project with gradle files here