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

Android: Use storage access framework for importing WADs #8962

Merged
merged 1 commit into from Oct 21, 2020

Conversation

JosJuice
Copy link
Member

This is part of my efforts to add support for scoped storage. I figured I would start with a relatively simple feature to make sure that everyone is fine with the approach I'm taking before I tackle more complicated features like the game list.

@mbc07
Copy link
Contributor

mbc07 commented Jul 18, 2020

Make sure this works on an actual Android TV device. I don't know if this was fixed but the last time I checked (~ 2 years ago), Android TV didn't ship with the DocumentsUI system app, which made SAF do nothing when an app requested it. If that's still the case we'll need some sort of fallback...

@JosJuice
Copy link
Member Author

According to https://commonsware.com/blog/2017/12/27/storage-access-framework-missing-action.html, it works on the Shield TV, so it should be fine ;)

But more seriously, that's some really weird behavior, and I agree that it would be a good idea to test it before this is merged. Adding a fallback wouldn't be too hard... as long as there are no devices that have this problem and run Android 11.

@mbc07
Copy link
Contributor

mbc07 commented Jul 18, 2020

Well, we should have plenty of time. This issue seems exclusive to some Android TV devices, I've never seen an Android phone missing the DocumentsUI app (not even on heavily skinned ones like Xiaomi), and Android TV releases seems to follow a different schedule: at the time of this comment, Android TV 9.0 still is the latest version available, with no ETA on when Android TV 10 will be actually released...

Copy link
Member

@Ebola16 Ebola16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on my Android 9 device.

Copy link
Member

@Ebola16 Ebola16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JosJuice
Copy link
Member Author

JosJuice commented Sep 5, 2020

Currently all file types are visible in the new storage access framework. I haven't worked with ACTION_OPEN_DOCUMENT before but it may be possible to restrict the file types to the relevant ones. See https://stackoverflow.com/questions/33117592/restricting-selectable-file-types-via-intent-in-android.

This only works for MIME types and not file name extensions, and there is no MIME type we can use for WAD files as far as I know. An unfortunate limitation of the framework.

Can access to ACTION_OPEN_DOCUMENT be blocked if WRITE_EXTERNAL_STORAGE permission isn't granted? See #9061.

ACTION_OPEN_DOCUMENT doesn't require WRITE_EXTERNAL_STORAGE.

@Ebola16
Copy link
Member

Ebola16 commented Sep 5, 2020

This only works for MIME types and not file name extensions, and there is no MIME type we can use for WAD files as far as I know. An unfortunate limitation of the framework.

Fair point, if this framework is needed for scoped storage we'll need to accept that.

ACTION_OPEN_DOCUMENT doesn't require WRITE_EXTERNAL_STORAGE.

Although that's true, the process of installing the WAD itself would require that permission. Since the actions that follow ACTION_OPEN_DOCUMENT can require WRITE_EXTERNAL_STORAGE, we should probably display the toast message from #9061 instead of starting the storage access framework activity.

@JosJuice
Copy link
Member Author

JosJuice commented Sep 5, 2020

I've made the Install WAD action check for directory initialization.

@JosJuice
Copy link
Member Author

For the reference, the first commit of this PR ("Android: Add content provider support to File::IOFile") was merged as part of PR #8902.

This is part of my efforts to add support for scoped storage.
I figured I would start with a relatively simple feature to
make sure that everyone is fine with the approach I'm taking
before I tackle more complicated features like the game list.
@leoetlino leoetlino merged commit 43d11ca into dolphin-emu:master Oct 21, 2020
10 checks passed
@JosJuice JosJuice deleted the android-saf-wad branch October 21, 2020 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants