Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jul 2, 2021

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

gungsukma and others added 3 commits April 20, 2021 14:09
May be there should be options --sort-by-id, --id-start=<int>, --id-end=<int>
@pull pull bot added the ⤵️ pull label Jul 2, 2021
Leonid Pliushch and others added 26 commits August 21, 2021 22:41
Date format fixes for Notification List and Call Log
And have only done so for more than 1.5 years now.
Update dependecies and remove android M code
termux-sms-list response changes
This commit adds the inbox content URI so termux-sms-list can filter type by inbox, rather than default to all.
This allows us to remove all hardcoded /data/data/com.termux paths,
and makes future maintenance easier.
As part of adaption for the termux-shared library.
But still keep shrinkResources and obfuscation disabled for testing
reproducible builds and maintaining stacktraces of crashes.
To have them easily accessible in only one place.
The versionName will now follow semantic version "2.0.0" spec in the
format major.minor.patch(-prerelease)(+buildmetadata).  This will make
versioning the prerelease and github debug builds versions easier and
follow as spec.  The @termux devs should make sure that when bumping
versionName in build.gradle file and when creating a tag for new
releases on github that they include the patch number as well, like
v0.1.0 instead of just v0.1.  The build.gradle file and
attach_debug_apks_to_release workflow will now validate the version as
well and the build/attachment will fail if versionName does not follow
the spec.  https://semver.org/spec/v2.0.0.html

APKs released on github for debug build workflows and releases are now
referred as Github releases as per termux/termux-app@7b10a35f and
termux/termux-app@94e01d68, so APK filenames have been modified to
include github in the filename.  The APKs are still debuggable, so
that tag remains too.

For github workflows the apk filename format will be
termux-api_<current_version>+<last_commit_hash>-github-debug_<arch>.apk,
like termux-api_v0.1.0+xxxxxxxx-github-debug_arm64-v8a.apk and for
github releases it will be
termux-api_<release_version>-github-debug_<arch>.apk, like
termux-api_v0.1-github-debug_arm64-v8a.apk.  The last_commit_hash will
be the first 8 characters of the commit hash.  The
<last_commit_hash>-github-debug will act as buildmetadata and will not
affect versioning precedence.

For github workflows triggered by push and pull_request triggers,
<current_version>+<last_commit_hash> will be used as new versionName,
like v0.1.0+xxxxxxxx.  This will make tracking which build a user is
using easier and help in resolving issues as well.

The app/build.gradle now also supports following TERMUX_API_ scoped
environmental variables and RELEASE_TAG variable will not be used
anymore since it may conflict with possibly other variables used by
users.

- TERMUX_API_APP_VERSION_NAME will be used as versionName if its set.
- TERMUX_API_APK_VERSION_TAG will be used as termux-api_<TERMUX_API_APK_VERSION_TAG>.apk if its set.
androidx.biometric:biometric:1.2.0-alpha04 is available as well, but
it requires compileSdkVersion 31, which we cannot use.
agnostic-apollo and others added 30 commits January 13, 2025 03:21
…ursor.getColumnIndex()` if column does not exist for when listing SAF documents
…eplace it with `address` as address column can be a name like service provider instead of a number
… for non existent columns

The following options have been added. Check `termux-sms-list --help` for examples and more info.

- `conversation-limit=<limit>`: The SQL limit for returned SMS conversations.
- `conversation-offset=<offset>`: The SQL offset for returned SMS conversations.
- `conversation-return-multiple-messages`: Return multiple SMS messages per conversation.
- `conversation-return-nested-view`: Return a nested object view of conversations where each conversation contains an array of SMS messages with the conversation id as the key.
- `conversation-return-no-order-reverse`: Return SMS conversations without reversing order of conversation sort.
- `conversation-selection=<selection>`: The SQL selection for returned SMS conversations.
- `conversation-sort-order=<order>`: The SMS conversations sort order as per SQL 'ORDER BY col1, col2, ... ASC|DESC' clause. Default value: 'date DESC'.
- `message-return-no-order-reverse`: Return SMS messages without reversing order of message sort.
- `message-selection=<selection>`: The SQL selection for returned SMS messages.
- `message-sort-order=<order>`: The SMS messages sort order as per SQL 'ORDER BY col1, col2, ... ASC|DESC' clause. Default value: 'date DESC'.
…election and use exact match

SQL does not seem to consider `?` placeholders if inside quotes.

```
java.lang.IllegalArgumentException: Cannot bind argument at index 1 because the index is out of range.  The statement has 0 parameters.
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
    at android.content.ContentProviderProxy.query(ContentProviderNative.java:472)
    at android.content.ContentResolver.query(ContentResolver.java:1183)
    at android.content.ContentResolver.query(ContentResolver.java:1115)
    at android.content.ContentResolver.query(ContentResolver.java:1071)
    at com.termux.api.apis.SmsInboxAPI.getAllSms(SmsInboxAPI.java:302)
```

Exact match is used by default so that only exactly matched entries are returned, users can use `%` wildcards in the address passed if they want to do prefix/contains/suffix matching.

- https://www.w3schools.com/sql/sql_like.asp
Added monochrome icon for Android 13 "Themed icons" support.
…d `termux-saf-ls`

Co-authored-by: @BryanJacobs <b@q3q.us>
Co-authored-by: @agnostic-apollo  <agnosticapollo@gmail.com>
Previously, one sensor name is a substring of another sensor name (like `ORIENTATION` and `DEVICE_ORIENTATION`), then the first matched sensor in available sensors list would get registered, depending on order of sensors. Now we use the shortest match for the requested sensor in the available sensors list, the shortest being an exact match if requested sensor is passed exactly (ignoring case).

Closes #570
…nd fix multiple exceptions for Android 12+ and hang up for Android 14+

- Fix `termux-usb` command hanging for a long time after permission request was granted/denied on Android `14`. This was being caused by `BroadcastReceiver.goAsync()` call for `TermuxApiReceiver` in `ResultReturner.returnData()`. If that is called, then the permission request `BroadcastReceiver.onReceive()` registered by `UsbAPI` is not called immediately or may hang indefinitely. Removing the `goAsync` fixes the issue, but that would result in `TermuxApiReceiver.onReceive()` processing time to be reduced as per Android `BroadcastReceiver` limits, and longer processing time would result in exceptions. To fix this, the `UsbService` has been added that will handle all the UsbAPI actions, including requesting and waiting for permission. Using a service will also not have limits on processing times.

- Use explicit intent, otherwise permission request intent will be blocked if intent is mutable and app uses `targetSdkVersion` `>= 34`, or following exception will be logged to logcat if app uses `targetSdkVersion` `< 34`.
    - https://developer.android.com/about/versions/14/behavior-changes-14#safer-intents
    ```
    android.app.StackTrace: New mutable implicit PendingIntent: pkg=com.termux.api, action=com.termux.api.USB_PERMISSION, featureId=null. This will be blocked once the app targets U+ for security reasons.
        at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:465)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:753)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:740)
    ```

- Use mutable intent, otherwise permission request intent will be blocked if app uses `targetSdkVersion` `>= 31` and following exception may be logged to logcat.
    - https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
    ```
    java.lang.IllegalArgumentException: com.termux.api: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
        Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:450)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:753)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:740)
        at com.termux.api.apis.UsbAPI.requestPermission(UsbAPI.java:139)
     ```

- Specify flag to not export receiver, otherwise permission request intent will be blocked if app uses `targetSdkVersion` `>= 34`.
    - https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

- Use a single queue for `permission` and `open` device requests. Additionally, use a `30s` timeout, and if user does not grant/deny permission within the timeout, then abort request with `Permission request timeout.` error. Pressing the permission dialog `OK` button after `30s` will be ignored. However, on Android `>= 14`, the Termux:API app process may get frozen after showing the permission dialog, and the timeout will not occur. To fix that, either disable `cached_apps_freezer`, or send an intent to Termux:API app process to unfreeze it, like with `termux-api-start` with a 30s delay before running the actual open request command, like with following commands.
    - #638 (comment)
    ```
    ( { sleep 30 && termux-api-start; } &)
    termux-usb -r -e echo "<device>"
    ```

- The following messages/errors have been updated for consistency. Error handling for exit code `1` in `termux-usb` script will be updated accordingly.
    - open|permission: `No such device` -> `No such device.`
    - permission: `yes` -> `Permission granted.`
    - permission: `no` -> `Permission denied.`
    - open: `No permission` -> `Permission denied.`
    - open: `Failed to open device` -> `Open device failed.`

Co-authored-by: @agnostic-apollo  <agnosticapollo@gmail.com>
Co-authored-by: @9hm2 <m.horvath020@gmail.com>

Closes #675
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
…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
…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)
```
…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
…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
… 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
…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)

```
…NfcActivity.onResume()` in addition to `onCreate()` before calling its methods otherwise would trigger a `NullPointerException`
…estricted to `900000ms` (`15` minutes) for Android `>= 7`
…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
…ing a `null` `Integer` to an `int` for `batteryCurrentNow` and also do not output `null` values

```
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
    at com.termux.api.apis.BatteryStatusAPI$1.writeJson(SourceFile:138)
    at com.termux.api.util.ResultReturner$ResultJsonWriter.writeResult(SourceFile:169)
    at com.termux.api.util.ResultReturner.lambda$returnData$0(SourceFile:271)
    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.BatteryStatusAPI.onReceive(SourceFile:27)
        at com.termux.api.TermuxApiReceiver.doWork(SourceFile:91)
        at com.termux.api.TermuxApiReceiver.onReceive(SourceFile:65)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:4458)
        at android.app.ActivityThread.access$1800(ActivityThread.java:277)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2172)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:210)
        at android.os.Looper.loop(Looper.java:299)
        at android.app.ActivityThread.main(ActivityThread.java:8298)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pull merge-conflict Resolve conflicts manually

Projects

None yet

Development

Successfully merging this pull request may close these issues.