1

Storage Access Framework SAF for Tasker

I would like to be able to access my Work Profile storage.

It is available with Shelter via a location defined via SAF. The default Files app lets me access Shelter's Work Profile files.

I am not sure how to access it through Tasker. Is it possible?

1 reply

Are you able to pick a file from Shelter using the "Pick Input Dialog" with the "File System Picker" type (select it with the Magnifying glass)? Thanks!

S

Thanks for the reply!

I can pick the file (I didn't know this Pick Dialog trick, that's a cool one!), then get a link content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt to a file in Download/a.txt.

When I try to copy the file to my main Android Profile (where Tasker is) to Documents/aaa.txt with the "Copy File" task, I get the error

11.43.44/LicenseCheckerTasker Checking cached only
11.43.44/LicenseCheckerTasker Is direct and license was validated
11.43.44/LicenseCheckerTasker Cached only: Licensed
11.43.44/Variables doreplresult: |%input| -> |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt|
11.43.44/Variables doreplresult: |%input| -> |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt|
11.43.44/FileUtil needReqDocAccess: wudf: no write needed
11.43.44/FileUtil nrda: need request: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt: false
11.43.44/FileUtil needReqDocAccess: wudf: not external: /storage/emulated/0/Documents/aaa.txt
11.43.44/FileUtil nrda: need request: /storage/emulated/0/Documents/aaa.txt: false
11.43.44/E Permission Denial: reading net.typeblog.shelter.util.CrossProfileDocumentsProvider uri content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt from pid=16499, uid=10264 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
11.43.44/E result: stop task (error)
11.43.44/E Error: 1
11.43.44/MacroEdit action finished exeID 1 action no 3 code 404 status: Err next 3

Do I need to grant that permission with adb?

Thanks. Where can I can get that Shelter app myself so I can try to reproduce the issue? Thanks in advance!

S

Shelter is available at https://f-droid.org/packages/net.typeblog.shelter/

Thank you so much :)

Thanks! Installed it. What do I do now to reproduce the issue? 😅

S

Sorry, my bad xD

- Open Shelter
- follow the steps to create the Work Profile
- on the top-right of the app, click the button with 3 vertical dots
- click Settings
- activate the box "File Shuttle" (this activates SAF via your default Files app)
- open your default "Files" app and check that Shelter appears in the left menu along with "Recent", "Images", "Downloads", etc...
- Click on that Shelter button -> you are now accessing the Work Profile files from your Main Profile
- Create a basic file/folder somewhere in that Work Profile
- In Tasker, create a "Pick Input Dialog" task, select the file/folder you created
- Create a "Copy Files" task with "From" set to that link or "%input", and "To" set to e.g. "Documents/aaa.txt", then start it and witness the error :P

To get rid of the Work Profile, look into Android Settings > Accounts > Remove work profile, then you can uninstall Shelter if you want.

Thanks! :) Unfortunately I get this on my Files app after doing the other steps:

image-1718116257559.png.

I'm able to see the Shelter option in the "Other Storage" section, but clicking that just opens the app:

image-1718116306579.png

Do you happen to know what's up? 😅

S

It seems you opened the Google Files app, not the native Android one. Two things you can try:

* in the Shelter screen on the top-right, click the 3 vertical dots, then "Open Documents UI". Does it launch the same "Google Files" app, or the default Android one?
* Go to Android Settings -> Apps -> See all apps -> 3 vertical dots on the top-right -> Show system -> find a "Files" app (not "Google Files")

Does either option start the Files app that is not Google?

In the worst case, open Shelter, click on "Shelter" at the bottom of the screen, open the Files/Documents app, create a file there, then try the last 2 steps

- In Tasker, create a "Pick Input Dialog" task, select the file/folder you created
- Create a "Copy Files" task with "From" set to that link or "%input", and "To" set to e.g. "Documents/aaa.txt", then start it and witness the error :P

Thank you very much! I think I fixed it! :)

Can you please try this version? https://drive.google.com/file/d/1YGuMAWRfyYlUKMdgb4xyVEUfddWz_zzI/view

Thanks again!

S

I should have mentioned I am using the Direct Purchase version. This one tells me I need to buy through the Play Store.

Any chance you could link me a Google-less version?

And thank you so much for this fantastic app and fixing bugs so quickly! :D

Sure, here's the direct-purchase version: https://drive.google.com/open?id=1CwpRclcWdyQpP5h4DtidTUAcRQ9AOqKC&usp=drive_fs

Thanks again for testing! :)

S

It works, thank you so much! <3

S

"Pick Input Dialog" > "File System Picker" works great now (and returns content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDownload%2Fa.txt)

But "Pick Input Dialog" > "Directory System Picker" returns / when picking a directory from Shelter. The task "Copy Dir" with its result as input returns the error

10.24.41/LicenseCheckerTasker Checking cached only
10.24.41/LicenseCheckerTasker Is direct and license was validated
10.24.41/LicenseCheckerTasker Cached only: Licensed
10.24.41/Variables doreplresult: |%input| -> |/|
10.24.41/Variables doreplresult: |%input| -> |/|
10.24.41/FileUtil needReqDocAccess: wudf: no write needed
10.24.41/FileUtil nrda: need request: /: false
10.24.41/E checkSDPath: / useRoot: false there: true file: false dir: true
10.24.41/FileUtil Copy Dir/checkSDPath: wudf: no write needed
10.24.41/E Copy Dir: checkSDPath: / useDocFile: false
10.24.41/E Copy Dir: checkSDPath: / ok true
10.24.41/FileUtil needReqDocAccess: wudf: not external: /storage/emulated/0/Documents/testfolder
10.24.41/FileUtil nrda: need request: /storage/emulated/0/Documents/testfolder: false
10.24.41/E checkSDPath: / useRoot: false there: false file: false dir: true
10.24.41/FileUtil Copy Dir/checkSDPath: wudf: no write needed
10.24.41/E Copy Dir: checkSDPath: / useDocFile: false
10.24.41/E Copy Dir: checkSDPath: / ok true
10.24.41/FileUtil : wudf: no write needed
10.24.41/FileUtil copyFiles: / -> /storage/emulated/0/Documents/testfolder
10.24.41/FileUtil : wudf: no write needed
10.24.41/FileUtil : wudf: not external: /storage/emulated/0/Documents/testfolder
10.24.41/FileUtil copyDir: / -> /storage/emulated/0/Documents/testfolder
10.24.41/E code 3: java.lang.NullPointerException: Attempt to get length of null array.
10.24.41/E prefsException/Copy Dir: Attempt to get length of null array
10.24.41/ net.dinglisch.android.taskerm.u3.c(SourceFile:37)
10.24.41/ net.dinglisch.android.taskerm.u3.e(SourceFile:96)
10.24.41/ net.dinglisch.android.taskerm.ExecuteService.s1(SourceFile:176)
10.24.41/ net.dinglisch.android.taskerm.ExecuteService.f4(SourceFile:290)
10.24.41/ net.dinglisch.android.taskerm.ExecuteService.J2(SourceFile:328)
10.24.41/ net.dinglisch.android.taskerm.ExecuteService.R(SourceFile:1)
10.24.41/ net.dinglisch.android.taskerm.ExecuteService$j.run(SourceFile:559)
10.24.41/ java.lang.Thread.run(Thread.java:1012)
10.24.41/E Copy Dir [
From: %input
To: Documents/testfolder ]
10.24.41/E result: stop task (error)
10.24.41/E Error: 1
10.24.41/MacroEdit action finished exeID 4 action no 5 code 405 status: Err next 5

If I specify the link myself as input for "Copy Dir" (content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments), the task returns the error

10.28.25/LicenseCheckerTasker Checking cached only
10.28.25/LicenseCheckerTasker Is direct and license was validated
10.28.25/LicenseCheckerTasker Cached only: Licensed
10.28.25/Variables doreplresult: |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments| -> |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments|
10.28.25/Variables doreplresult: |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments| -> |content://net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments|
10.28.25/FileUtil needReqDocAccess: wudf: no write needed
10.28.25/FileUtil nrda: need request: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments: false
10.28.25/E checkSDPath: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments useRoot: false there: true file: false dir: true
10.28.25/FileUtil Copy Dir/checkSDPath: wudf: no write needed
10.28.25/E Copy Dir: checkSDPath: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments useDocFile: false
10.28.25/E Copy Dir: file not found: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments.
10.28.25/E Copy Dir: checkSDPath: /storage/emulated/0/content:/net.typeblog.shelter.documents/document/%2Fstorage%2Femulated%2F10%2FDocuments ok false
10.28.25/E result: stop task (error)
10.28.25/E Error: 1
10.28.25/MacroEdit action finished exeID 1 action no 5 code 405 status: Err next 5

Did I do something wrong?

Sorry for the additional bother. All I'm trying to do is backup a folder from the Work Profile along with my other backups from the Main Profile.

 

Thanks. Yeah, Tasker doesn't handle that correctly yet, sorry! But unfortunately I really can't risk changing the way it works now because I risk breaking stuff for other users in other situations. 

I'm trying to release the current version of the app out of beta so everyone can use it publicly right now, so it would be risky to change something so "core" to the app at the moment, sorry! 😅

I can look at it again after the app is released for everyone!

Hope you understand!

S

No worries, it is already great to know it can be done for folders and I just need to be patient!

Thank you so much for being so responsive and maintaining this fantastic app, I can't say this enough :)

Awesome. Thanks for understanding!