Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: termux/termux-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.51.0
Choose a base ref
...
head repository: termux/termux-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.52.0
Choose a head ref
  • 13 commits
  • 9 files changed
  • 1 contributor

Commits on Apr 13, 2025

  1. Fixed(BatteryStatusAPI): Output double value instead of string for te…

    …mperature field with value rounded up to 1 decimal place
    
    `String.format("%.1f", batteryTemperature)` was used in d5364ef to round up the value to 1 decimal place, which resulted in field being a string in json output and with a comma-as-decimal-separater depending on device locale, like `25,5` instead of `25.5`, so we stay with double now.
    
    Closes #763
    agnostic-apollo committed Apr 13, 2025
    Configuration menu
    Copy the full SHA
    97b4100 View commit details
    Browse the repository at this point in the history

Commits on May 22, 2025

  1. Fixed: Manually add stack trace of caller function that called `Resul…

    …tReturner.returnData()` to exception messages as exceptions thrown inside `Runnable` lambda thread will not include it by default
    
    For example, exceptions like following don't tell which API call failed and where.
    
    ```
    Error in ResultReturner:
    java.io.IOException: Connection refused
    	at android.net.LocalSocketImpl.connectLocal(Native Method)
    	at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:259)
    	at android.net.LocalSocket.connect(LocalSocket.java:162)
    	at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:244)
    	at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    	at java.lang.Thread.run(Thread.java:1119)
    ```
    
    Now it will be something like this
    
    ```
    Error in ResultReturner:
    java.io.IOException: Connection refused
    	at android.net.LocalSocketImpl.connectLocal(Native Method)
    	at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:259)
    	at android.net.LocalSocket.connect(LocalSocket.java:162)
    	at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:244)
    	at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    	at java.lang.Thread.run(Thread.java:1119)
    	Suppressed: java.lang.Exception: Called by:
    		at com.termux.api.util.ResultReturner.returnData(ResultReturner.java:234)
    		at com.termux.api.apis.BatteryStatusAPI.onReceive(BatteryStatusAPI.java:27)
    		at com.termux.api.TermuxApiReceiver.doWork(TermuxApiReceiver.java:91)
    		at com.termux.api.TermuxApiReceiver.onReceive(TermuxApiReceiver.java:65)
    		at android.app.ActivityThread.handleReceiver(ActivityThread.java:5029)
    		at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
    		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2577)
    		at android.os.Handler.dispatchMessage(Handler.java:110)
    		at android.os.Looper.loopOnce(Looper.java:248)
    		at android.os.Looper.loop(Looper.java:338)
    		at android.app.ActivityThread.main(ActivityThread.java:9067)
    		at java.lang.reflect.Method.invoke(Native Method)
    		at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
    		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
    ```
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    922f358 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    02b1c66 View commit details
    Browse the repository at this point in the history
  3. Fixed(NotificationAPI): Fix termux-notification actions not updatin…

    …g or conflicting between notifications due to same request code being used for the `PendingIntent` of all actions and also specify `PendingIntent.FLAG_IMMUTABLE` to prevent any modification
    
    - https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
    
    Closes #677, Closes #764
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    7c1759a View commit details
    Browse the repository at this point in the history
  4. Fixed(NotificationAPI): Fix termux-notification --icon not working …

    …for release builds as icon drawables were being removed by resource shrinker possibly related to 6ef2618
    
    Use standard Android API to get resource id for drawable icon instead of using reflection into drawable class. Additionally use `String.format()` so that resource shrinker does not remove icons used by `NotificationAPI` for release builds.
    
    Closes #483
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    1639e73 View commit details
    Browse the repository at this point in the history
  5. Fixed: Fix disabling obfuscation added in 6ef2618 caused due to wrong…

    … proguard file being used.
    
    This caused Termux classes like `ReportInfo` to be obfuscated making stacktraces harder to read.
    
    ```
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.termux/com.termux.shared.activities.ReportActivity}: android.os.BadParcelableException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = I0.a)
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3864)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4006)
    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111)
    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2462)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loopOnce(Looper.java:240)
    	at android.os.Looper.loop(Looper.java:351)
    	at android.app.ActivityThread.main(ActivityThread.java:8377)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
    Caused by: android.os.BadParcelableException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = I0.a)
    	at android.os.Parcel.readSerializableInternal(Parcel.java:5113)
    	at android.os.Parcel.readValue(Parcel.java:4655)
    	at android.os.Parcel.readValue(Parcel.java:4363)
    	at android.os.Parcel.-$$Nest$mreadValue(Unknown Source:0)
    	at android.os.Parcel$LazyValue.apply(Parcel.java:4461)
    	at android.os.Parcel$LazyValue.apply(Parcel.java:4420)
    	at android.os.BaseBundle.getValueAt(BaseBundle.java:394)
    	at android.os.BaseBundle.getValue(BaseBundle.java:374)
    	at android.os.BaseBundle.getValue(BaseBundle.java:357)
    	at android.os.BaseBundle.getValue(BaseBundle.java:350)
    	at android.os.BaseBundle.getSerializable(BaseBundle.java:1451)
    	at android.os.Bundle.getSerializable(Bundle.java:1144)
    	at com.termux.shared.activities.ReportActivity.updateUI(ReportActivity.java:136)
    	at com.termux.shared.activities.ReportActivity.onCreate(ReportActivity.java:89)
    	at android.app.Activity.performCreate(Activity.java:8397)
    	at android.app.Activity.performCreate(Activity.java:8370)
    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403)
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3837)
    	... 12 more
    Caused by: java.lang.ClassNotFoundException: I0.a
    	at java.lang.Class.classForName(Native Method)
    	at java.lang.Class.forName(Class.java:536)
    	at android.os.Parcel$2.resolveClass(Parcel.java:5090)
    	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1733)
    	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1624)
    	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1902)
    	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1442)
    	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
    	at android.os.Parcel.readSerializableInternal(Parcel.java:5096)
    	... 29 more
    Caused by: java.lang.ClassNotFoundException: I0.a
    	... 38 more
    ```
    
    Related commit termux/termux-app@da3a0ac4
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    28bc8c8 View commit details
    Browse the repository at this point in the history
  6. Fixed(NfcAPI): Fix termux-nfc -t x resulting in error notification …

    …being shown as method was not returned from after sending error resulting in `ResultReturner.returnData()` being called twice
    
    ```
    Error in ResultReturner:
    java.io.IOException: Connection refused
    	at android.net.LocalSocketImpl.connectLocal(Native Method)
    	at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:259)
    	at android.net.LocalSocket.connect(LocalSocket.java:162)
    	at com.termux.api.util.ResultReturner.lambda$returnData$0(SourceFile:250)
    	at com.termux.api.util.ResultReturner.$r8$lambda$RFR2zSHu5FsJH7JvuCx4CPnUmMY(SourceFile:0)
    	at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(SourceFile:0)
    	at java.lang.Thread.run(Thread.java:1119)
    	Suppressed: java.lang.Exception: Called by:
    		at com.termux.api.util.ResultReturner.returnData(SourceFile:239)
    		at com.termux.api.apis.NfcAPI$NfcActivity.errorNfc(SourceFile:48)
    		at com.termux.api.apis.NfcAPI$NfcActivity.onCreate(SourceFile:87)
    		at android.app.Activity.performCreate(Activity.java:9155)
    		at android.app.Activity.performCreate(Activity.java:9133)
    		at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1521)
    		at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4262)
    		at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467)
    		at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222)
    		at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
    		at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
    		at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
    		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2823)
    		at android.os.Handler.dispatchMessage(Handler.java:110)
    		at android.os.Looper.loopOnce(Looper.java:248)
    		at android.os.Looper.loop(Looper.java:338)
    		at android.app.ActivityThread.main(ActivityThread.java:9067)
    		at java.lang.reflect.Method.invoke(Native Method)
    		at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
    		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
    
    ```
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    c986fb0 View commit details
    Browse the repository at this point in the history
  7. Fixed(NfcAPI): Check if NfcAdapter is available and not null in `…

    …NfcActivity.onResume()` in addition to `onCreate()` before calling its methods otherwise would trigger a `NullPointerException`
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    4ba140d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5040a66 View commit details
    Browse the repository at this point in the history
  9. Added(JobSchedulerAPI): Add docs for JobInfo minimum period being r…

    …estricted to `900000ms` (`15` minutes) for Android `>= 7`
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    9be2a6d View commit details
    Browse the repository at this point in the history
  10. Changed|Fixed(JobSchedulerAPI): Fix ResultReturner.returnData() bei…

    …ng called multiple times for different printing since 51a02f4 and 61262f7 throwing `Connection refused` exceptions for calls after the first one instead of printing, and also refactor actions out to functions and change action output format
    
    The `ResultReturner.returnData()` will be called once for each action.
    
    The schedule job action will not print all pending jobs at end and only the pending job that was scheduled if successful. Users should use `termux-job-scheduler -p` to get all pending jobs.
    
    The `termux-job-scheduler --p` action will print `No jobs found` instead of `No pending jobs` if no pending job exists.
    
    The `termux-job-scheduler --cancel-all` action will now print all jobs to be cancelled, or `No jobs found` found.
    
    The job description will use `4` spaces instead of a tab after the path.
    
    ```
    Error in ResultReturner:
    java.io.IOException: Connection refused
    	at android.net.LocalSocketImpl.connectLocal(Native Method)
    	at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:259)
    	at android.net.LocalSocket.connect(LocalSocket.java:162)
    	at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:250)
    	at com.termux.api.util.ResultReturner$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    	at java.lang.Thread.run(Thread.java:1119)
    	Suppressed: java.lang.Exception: Called by:
    		at com.termux.api.util.ResultReturner.returnData(ResultReturner.java:239)
    		at com.termux.api.apis.JobSchedulerAPI.displayPendingJobs(JobSchedulerAPI.java:197)
    		at com.termux.api.apis.JobSchedulerAPI.onReceive(JobSchedulerAPI.java:181)
    		at com.termux.api.TermuxApiReceiver.doWork(TermuxApiReceiver.java:146)
    		at com.termux.api.TermuxApiReceiver.onReceive(TermuxApiReceiver.java:65)
    		at android.app.ActivityThread.handleReceiver(ActivityThread.java:5029)
    		at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
    		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2577)
    		at android.os.Handler.dispatchMessage(Handler.java:110)
    		at android.os.Looper.loopOnce(Looper.java:248)
    		at android.os.Looper.loop(Looper.java:338)
    		at android.app.ActivityThread.main(ActivityThread.java:9067)
    		at java.lang.reflect.Method.invoke(Native Method)
    		at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
    		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
    ```
    
    ```shell
    ~ $ termux-job-scheduler -s ~/test1.sh --period-ms 900000 --job-id 1
    Scheduling Job 1: /data/data/com.termux/files/home/test1.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ]) - response 1
    Pending Job 1: /data/data/com.termux/files/home/test1.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler -s ~/test2.sh --period-ms 900000 --job-id 2
    Scheduling Job 2: /data/data/com.termux/files/home/test2.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ]) - response 1
    Pending Job 2: /data/data/com.termux/files/home/test2.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler -s ~/test3.sh --period-ms 900000 --job-id 3
    Scheduling Job 3: /data/data/com.termux/files/home/test3.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ]) - response 1
    Pending Job 3: /data/data/com.termux/files/home/test3.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler -p
    Pending Job 3: /data/data/com.termux/files/home/test3.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    Pending Job 2: /data/data/com.termux/files/home/test2.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    Pending Job 1: /data/data/com.termux/files/home/test1.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler --cancel --job-id 2
    Cancelling Job 2: /data/data/com.termux/files/home/test2.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler --cancel-all
    Cancelling Job 3: /data/data/com.termux/files/home/test3.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    Cancelling Job 1: /data/data/com.termux/files/home/test1.sh    (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&TRUSTED&VALIDATED&NOT_VCN_MANAGED&NOT_BANDWIDTH_CONSTRAINED Uid: 10215 UnderlyingNetworks: Null] ])
    
    ~ $ termux-job-scheduler --cancel-all
    No jobs found
    
    ~ $ termux-job-scheduler -p
    No jobs found
    
    ~ $ termux-job-scheduler --cancel --job-id 2
    No job 2 found
    ```
    
    Closes #762, Closes #773
    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    6fbf61a View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a3a231e View commit details
    Browse the repository at this point in the history
  12. Release: v0.52.0

    agnostic-apollo committed May 22, 2025
    Configuration menu
    Copy the full SHA
    7e225c9 View commit details
    Browse the repository at this point in the history
Loading