Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPERM when trying to create CSV on Android 11 #21

Open
tatokis opened this issue Apr 9, 2022 · 0 comments
Open

EPERM when trying to create CSV on Android 11 #21

tatokis opened this issue Apr 9, 2022 · 0 comments

Comments

@tatokis
Copy link

tatokis commented Apr 9, 2022

Trying to start a recording on Android 11 (LineageOS 18.1) results in an EPERM error.
According to logcat it seems that Android, with the existing permissions requested and granted, only allows access to Downloads and Documents.

04-09 22:54:14.094  3098  3341 W MediaProvider: Forgot to handle a top level directory in getContentUriForFile?
04-09 22:54:14.096  3098  3341 E MediaProvider: insertFileIfNecessary failed
04-09 22:54:14.096  3098  3341 E MediaProvider: java.lang.IllegalArgumentException: Primary directory AnotherMonitor not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2707)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:2372)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:2981)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:3533)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insert(MediaProvider.java:3249)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:6717)
04-09 22:54:14.096  3098  3341 E MediaProvider: 	at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:6804)
04-09 22:54:14.097  5975  6002 W System.err: java.io.FileNotFoundException: /storage/emulated/0/AnotherMonitor/AnotherMonitorRecord-2022-04-09-22-54-14.csv: open failed: EPERM (Operation not permitted)
04-09 22:54:14.097  5975  6002 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:492)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
04-09 22:54:14.097  5975  6002 W System.err: 	at java.io.FileWriter.<init>(FileWriter.java:90)
04-09 22:54:14.097  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.record(ServiceReader.java:479)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.read(ServiceReader.java:449)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader.access$100(ServiceReader.java:53)
04-09 22:54:14.098  5975  6002 W System.err: 	at org.anothermonitor.ServiceReader$1.run(ServiceReader.java:85)
04-09 22:54:14.098  5975  6002 W System.err: 	at java.lang.Thread.run(Thread.java:923)
04-09 22:54:14.098  5975  6002 W System.err: Caused by: android.system.ErrnoException: open failed: EPERM (Operation not permitted)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.Linux.open(Native Method)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
04-09 22:54:14.098  5975  6002 W System.err: 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
04-09 22:54:14.099  5975  6002 W System.err: 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
04-09 22:54:14.099  5975  6002 W System.err: 	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7550)
04-09 22:54:14.099  5975  6002 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:478)
04-09 22:54:14.099  5975  6002 W System.err: 	... 8 more

Manually creating /storage/emulated/0/AnotherMonitor/ doesn't seem to change anything.

I don't have an Android dev environment set up, so I can't test changing the directory to one of the allowed ones to test, but I assume that'd enable it to create the CSV.

Running the latest version of the app from F-Droid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant