-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Dropshots fails to read images every now and then with this error:
java.io.FileNotFoundException: /storage/emulated/0/Download/screenshots/me.saket.telephoto.subsamplingimage.test/various_image_orientations_in_exif_metadata[RotatedBy180,Center,Fill]_zoomed.png: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:575)
at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
at com.dropbox.dropshots.Dropshots.writeImage(Dropshots.kt:196)
at com.dropbox.dropshots.Dropshots.writeThen(Dropshots.kt:176)
at com.dropbox.dropshots.Dropshots.assertSnapshot(Dropshots.kt:153)
at com.dropbox.dropshots.Dropshots.assertSnapshot(Dropshots.kt:94)
at com.dropbox.dropshots.Dropshots.assertSnapshot$default(Dropshots.kt:90)
…
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273)
at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7725)
at libcore.io.IoBridge.open(IoBridge.java:561)
... 24 more
I used to workaround this by manually granting WRITE_EXTERNAL_STORAGE permission in my tests, but do you know why is this even needed?
// Shouldn't be needed on > API 29, but dropshots is occasionally unable to write to external storage without this.
val uiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation
uiAutomation.grantRuntimePermission(packageName, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels