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

Use public download directoty to by-pass scoped storage (API 30) #273

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TimoPtr
Copy link
Contributor

@TimoPtr TimoPtr commented Dec 16, 2020

#162 (comment) I did some try and error on the API 30 and it seems that the only solution that I've found to make it work on API 30 is to use public download dir on external storage.

I first try using specific folder within scoped storage but the files are removed at the end of connected task.
I did use download dir because there is some restriction on Picture (filter on the extension).

This solution works but one day this public api is going to be removed.

Also I found out that there is an issue with the orchestrator library and API 30, android/android-test#743 I did try the last alpha but it was not working as expected on the sample project so for now on my side I won't use the orchestrator on API 30.

@oradkovsky
Copy link

Really appreciate your effort here, as evolving android is ever-trying to make our lives more "fun".

I cherry-picked the commit and tried it together with whatever master has, not working under Pixel 5 API30 (Android 11) emulator.

Caused by: java.lang.RuntimeException: java.io.IOException: Operation not permitted
at com.facebook.testing.screenshot.internal.ScreenshotImpl.storeBitmap(ScreenshotImpl.java:200)
at com.facebook.testing.screenshot.internal.ScreenshotImpl.record(ScreenshotImpl.java:271)

Can be tested under https://maven.pkg.github.com/oradkovsky/screenshot-tests-for-android ver 0.14.2-SNAPSHOT.

@oradkovsky
Copy link

Interestingly enough, tests are not crashing under physical device (FTL Pixel 5e redfin, API 30) BUT cloud artifacts no longer have screenshots :(

@mo0rti
Copy link

mo0rti commented Oct 11, 2021

I have the same problem with API 30, The test can't read the file. Is there any update on this PR?

@xiphirx
Copy link
Contributor

xiphirx commented Feb 2, 2022

Sorry for the (severely) late review. I think the easiest way to maybe get around this would be to move the library to persist screenshots into private app storage and use adb shell run-as when pulling since the APK should be debuggable, although I'm not sure if this will cause issues on real devices off the top of my head.

@Dr-Bootman
Copy link

@xiphirx Hey mate, Is there any chance you merge this PR ?

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

Successfully merging this pull request may close these issues.

6 participants