Benjamin-Loison / termux-api

Termux add-on app which exposes device functionality as API to command line programs.
https://f-droid.org/en/packages/com.termux.api/
0 stars 0 forks source link

`termux-call-log` does not return anything with the proper permission on my Fairphone 4 LineageOS #18

Open Benjamin-Loison opened 2 months ago

Benjamin-Loison commented 2 months ago

wiki.termux.com: Termux-call-log

termux-call-log
Output: ```json { "error": "Please grant the following permission to use this command: android.permission.READ_CALL_LOG" } ```

Once provide this permission this command does not return anything.

Problem description

Steps to reproduce

Expected behavior

Additional information

Benjamin-Loison commented 2 months ago

Related to Benjamin-Loison/android/issues/46.

Benjamin-Loison commented 2 months ago
adb logcat -c && adb logcat
Output: ``` 08-26 00:33:38.698 20682 8562 E DatabaseUtils: Writing exception to parcel 08-26 00:33:38.698 20682 8562 E DatabaseUtils: java.lang.IllegalArgumentException: Invalid token LIMIT 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder.enforceStrictToken(SQLiteQueryBuilder.java:833) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder.$r8$lambda$EEbhqTppbnvZCUlI6Z8L2GjkKmg(Unknown Source:0) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder$$ExternalSyntheticLambda0.accept(D8$$SyntheticClass:0) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteTokenizer.tokenize(SQLiteTokenizer.java:108) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder.enforceStrictGrammar(SQLiteQueryBuilder.java:803) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:566) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:511) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at com.android.providers.contacts.CallLogProvider.queryInternal(CallLogProvider.java:537) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at com.android.providers.contacts.CallLogProvider.query(CallLogProvider.java:463) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.content.ContentProvider.query(ContentProvider.java:1620) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.content.ContentProvider.query(ContentProvider.java:1716) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:295) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:107) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.os.Binder.execTransactInternal(Binder.java:1500) 08-26 00:33:38.698 20682 8562 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:1444) 08-26 00:33:38.700 645 1495 E termux-api: Error in ResultReturner 08-26 00:33:38.700 645 1495 E termux-api: java.lang.IllegalArgumentException: Invalid token LIMIT 08-26 00:33:38.700 645 1495 E termux-api: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184) 08-26 00:33:38.700 645 1495 E termux-api: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:154) 08-26 00:33:38.700 645 1495 E termux-api: at android.content.ContentProviderProxy.query(ContentProviderNative.java:495) 08-26 00:33:38.700 645 1495 E termux-api: at android.content.ContentResolver.query(ContentResolver.java:1229) 08-26 00:33:38.700 645 1495 E termux-api: at android.content.ContentResolver.query(ContentResolver.java:1161) 08-26 00:33:38.700 645 1495 E termux-api: at android.content.ContentResolver.query(ContentResolver.java:1117) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.a1.b(Unknown Source:48) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.a1.a(Unknown Source:0) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.a1$a.b(Unknown Source:6) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.util.b$a.a(Unknown Source:10) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.util.b.b(Unknown Source:89) 08-26 00:33:38.700 645 1495 E termux-api: at com.termux.api.util.a.run(Unknown Source:8) 08-26 00:33:38.700 645 1495 E termux-api: at java.lang.Thread.run(Thread.java:1012) ```
Benjamin-Loison commented 2 months ago
termux-call-log -h
Output: ``` Usage: termux-call-log [-l limit] [-o offset] List call log history -l limit offset in call log list (default: 10) -o offset offset in call log list (default: 0) ```

No Termux output with termux-call-log -l 1. Same with termux-call-log -l -1.

blob/c553bc2ba7de37ad5c42df23d71e699d2785d7c5/app/src/main/java/com/termux/api/apis/CallLogAPI.java

Search occurrences of limit case insensitively.

blob/c553bc2ba7de37ad5c42df23d71e699d2785d7c5/app/src/main/java/com/termux/api/apis/CallLogAPI.java#L44 seems to be the source of the issue.

Benjamin-Loison commented 2 months ago

termux-api/actions/runs/10155362023/job/28081990125 termux-api/actions/runs/10155362023/artifacts/1753648493

adb install termux-api_v0.50.1+c553bc2-github-debug.apk
Output: ``` Performing Streamed Install adb: failed to install termux-api_v0.50.1+c553bc2-github-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.termux.api signatures do not match newer version; ignoring!] ```

-f does not help.

Benjamin-Loison commented 2 months ago

image

So interacting with Verify apps over USB will not help.

Benjamin-Loison commented 2 months ago
adb install -k termux-api_v0.50.1+c553bc2-github-debug.apk
Output: ``` Performing Streamed Install adb: failed to install termux-api_v0.50.1+c553bc2-github-debug.apk: Exception occurred while executing 'install': java.lang.IllegalArgumentException: Unknown option -k at com.android.server.pm.PackageManagerShellCommand.makeInstallParams(PackageManagerShellCommand.java:3793) at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1602) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:250) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6609) at android.os.Binder.shellCommand(Binder.java:1230) at android.os.Binder.onTransact(Binder.java:1043) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4617) at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6593) at android.os.Binder.execTransactInternal(Binder.java:1505) at android.os.Binder.execTransact(Binder.java:1444) ```
adb install -h
Output: ``` Performing Streamed Install adb: filename doesn't end .apk or .apex: -h ```
adb install --help
Output: ``` Performing Streamed Install adb: filename doesn't end .apk or .apex: --help ```

Source: the Android Stack Exchange answer 220267

Benjamin-Loison commented 2 months ago

Uninstall Termux API graphically is not enough:

adb install termux-api_v0.50.1+c553bc2-github-debug.apk
Output: ``` Performing Streamed Install adb: failed to install termux-api_v0.50.1+c553bc2-github-debug.apk: Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Reconciliation failed...: Reconcile failed: Package com.termux.api has no signatures that match those in shared user com.termux; ignoring!] ```

Related to #11.

Benjamin-Loison commented 2 months ago

termux-app termux-app/commit/661c37501f2f0d26a81c9d512e61d98ca05d987d termux-app/actions/runs/10418405890/job/28854498477 termux-app/actions/runs/10418405890/artifacts/1819552827

Related to Benjamin-Loison/waydroid/issues/14.

adb install-multiple termux-api_v0.50.1+c553bc2-github-debug.apk termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk
Output: ``` adb: failed to finalize session Failure [INSTALL_FAILED_INVALID_APK: Split null was defined multiple times] ```

The Android Stack Exchange comment 311135 may be relevant.

adb install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk
Output: ``` Performing Streamed Install adb: failed to install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected: Update version code 118 is older than current 1000] ```

Related to Benjamin_Loison/fdroidclient/issues/13 and Benjamin_Loison/AuroraStore/issues/24.

Benjamin-Loison commented 2 months ago

adb install-multi-package may help, source: https://adbshell.com/commands/adb-install.

Benjamin-Loison commented 2 months ago
adb install -r -d termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk
Output: ``` Performing Streamed Install adb: failed to install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.termux signatures do not match newer version; ignoring!] ```

Source: the Stack Overflow answer 21868040 and https://adbshell.com/commands/adb-install

Benjamin-Loison commented 2 months ago

Related to up stream issues (notably those closed) found by searching termux-call-log and actually using Firefox Find in page... with the same query:

Benjamin-Loison commented 2 months ago
adb uninstall -k com.termux.app
Output: ``` The -k option uninstalls the application while retaining the data/cache. At the moment, there is no way to remove the remaining data. You will have to reinstall the application with the same signature, and fully uninstall it. If you truly wish to continue, execute 'adb shell cmd package uninstall -k'. ```

Source: https://adbshell.com/commands/adb-uninstall

Re-execute the command does not help.

adb shell cmd package uninstall -k com.termux.app
Failure [DELETE_FAILED_INTERNAL_ERROR]

Even if Force stop.

adb logcat just returns:

08-26 02:25:02.818  4517  4520 I cmd     : oneway function results will be dropped but finished with status OK and parcel size 

DuckDuckGo and Google results for "oneway function results will be dropped but finished with status OK and parcel size" do not look relevant except the Stack Overflow question 63939972.

Same adb install error for:

adb uninstall com.termux.app

and

adb shell cmd package uninstall com.termux.app

On LineageOS 18.1, Benjamin-Loison/waydroid/issues/16 could help.

Graphical Uninstall does not let a choice about app data.

adb install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk

results in state loss.

Benjamin-Loison commented 2 months ago

image

image

So still no choice about data.

After re-installing from F-Droid and touch before_uninstall:

adb uninstall com.termux.app
Failure [DELETE_FAILED_INTERNAL_ERROR]
adb uninstall -k com.termux.app
Failure [DELETE_FAILED_INTERNAL_ERROR]

Anyway can quite easily restore, see Benjamin-Loison/android/issues/46 just have to proceed to a backup.

Benjamin-Loison commented 2 months ago
adb install-multi-package termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk termux-api_v0.50.1+c553bc2-github-debug.apk
Output: ``` Created parent session ID 1145841301. Created child session ID 1113858070. Created child session ID 1811263675. adb: failed to finalize session Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Reconciliation failed...: Reconcile failed: Package com.termux has no signatures that match those in shared user com.termux; ignoring!] Attempting to abandon session ID 1113858070 Attempting to abandon session ID 1811263675 Attempting to abandon session ID 1145841301 ```
Benjamin-Loison commented 2 months ago
adb install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a/termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk
Output: ``` Performing Streamed Install adb: failed to install termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a/termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk: Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Reconciliation failed...: Reconcile failed: Package com.termux has no signatures that match those in shared user com.termux; ignoring!] ```

While Apps does not list Termux.

Removing Termux Boot app too solved the issue.

adb install-multi-package termux-app_v0.118.0+661c375-apt-android-7-github-debug_arm64-v8a.apk termux-api_v0.50.1+c553bc2-github-debug.apk
Output: ``` Created parent session ID 880475325. Created child session ID 1200294135. Created child session ID 376153896. Success ```
Benjamin-Loison commented 2 months ago

termux-call-log works now.

Benjamin-Loison commented 2 months ago

image

image

image

https://github.com/termux/termux-boot https://github.com/termux/termux-boot/commit/613dc9893f672313e2c572c0089ece7475e04f5b https://github.com/termux/termux-boot/actions/runs/9626993470/job/26553590004 https://github.com/termux/termux-boot/actions/runs/9626993470/artifacts/1627809038

adb install termux-boot-app_v0.8.1+613dc98.github.debug.apk
Success