这是indexloc提供的服务,不要输入任何密码
Skip to content

StorageGetApi failing with FLAG_ACTIVITY_NEW_TASK related error #285

@slanglade

Description

@slanglade

Problem
When calling termux-storage-get, nothing happens. When displaying traces using logcat, an error appears, related to FLAG_ACTIVITY_NEW_TASK.

Steps to reproduce
On a fully patched Samsung s8 (stock and not rooted), after installing the needed termux components, this is systematic.

Expected behavior
Should work OK : display a file selector and copy the selected file to the given destination.

Additional information
Post output of command termux-info.
termux-info
Updatable packages:
All packages up to date
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 4.4.111-16290088 #1 SMP PREEMPT Wed Jun 26 16:57:13 KST 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
9
Device manufacturer:
samsung
Device model:
SM-G950F

Trace using logcat
08-20 18:15:25.056 8481 8481 D AndroidRuntime: Calling main entry com.example.termuxam.Am
08-20 18:15:25.131 8491 8491 E com.termux.api: Not starting debugger since process cannot load the jdwp agent.
08-20 18:15:25.254 8491 8506 E termux-api: Error in ResultReturner
08-20 18:15:25.254 8491 8506 E termux-api: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
08-20 18:15:25.254 8491 8506 E termux-api: at android.app.ContextImpl.startActivity(ContextImpl.java:974)
08-20 18:15:25.254 8491 8506 E termux-api: at android.app.ContextImpl.startActivity(ContextImpl.java:950)
08-20 18:15:25.254 8491 8506 E termux-api: at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
08-20 18:15:25.254 8491 8506 E termux-api: at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
08-20 18:15:25.254 8491 8506 E termux-api: at com.termux.api.StorageGetAPI.lambda$onReceive$0(StorageGetAPI.java:31)
08-20 18:15:25.254 8491 8506 E termux-api: at com.termux.api.-$$Lambda$StorageGetAPI$b8crtuQ3KGrGePkdr1kAiAN95Dw.writeResult(Unknown Source:4)
08-20 18:15:25.254 8491 8506 E termux-api: at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:118)

(I copied as much as possible from termux terminal)

Something strange (maybe not related) : the Termux:API has no storage permission that I can give him, in app properties.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions