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

Add FilePicker in PlayStore variant. #3628

Open
MohitMaliFtechiz opened this issue Dec 22, 2023 · 3 comments · May be fixed by #3636
Open

Add FilePicker in PlayStore variant. #3628

MohitMaliFtechiz opened this issue Dec 22, 2023 · 3 comments · May be fixed by #3636
Assignees
Milestone

Comments

@MohitMaliFtechiz
Copy link
Collaborator

MohitMaliFtechiz commented Dec 22, 2023

Describe the bug
While testing and refactoring the code for #3624, I was thinking of accessing the zim file with file descriptor without any permission(MANAGE_EXTERNAL_STORAGE). I can read the file without permission if I select the file via the existing file picker in the Play Store variant. I have tested it on Android 11 and Android 12.

Why we had failed to access the ZIM files in the past without special permission

  • We were trying to access the File which is the basic requirement of our application to function, and we can not access the files without special permission.
  • We had some options at that time e.g. copying the content in a temp file from inputStream but it did not fit in our requirements, since it used twice the storage for the same ZIM file.
  • With the file descriptor approach in Storage permissions are unnecessarily required #3265. In this PR we are trying to access the fileDescriptor from a file, which gives us the permission denied message for fileDescriptor. We did this with old-libkiwix
  • In the past, we were using the java-libkiwix which had the issue opening the ZIM files via file descriptor that we saw while we were introducing the ASSET_FILE_DELIVERY for custom apps.

Expected behavior
We should add the file picker in the Play Store variant and if possible we should move our functionalities to rely on fileDescriptor instead of file. Since we have more access to a file descriptor instead of a file, Android limits direct access to files without special permission on Android 11 and above.

What if we use file descriptor instead of file

  • It did not work for scanning the storage.
  • It will work for opening the ZIM files with the file picker without any special permission.
  • It needs refactoring to make the application properly work with the file descriptor.

Additional notes to remember

  • We can show the ZIM file inside the library section if possible since at that time we have the URI of that ZIM file once opened with fileDescriptor.
vidma_recorder_22122023_152225.mp4
@MohitMaliFtechiz MohitMaliFtechiz self-assigned this Dec 22, 2023
@kelson42 kelson42 added this to the 3.10.0 milestone Dec 25, 2023
@MohitMaliFtechiz MohitMaliFtechiz linked a pull request Dec 27, 2023 that will close this issue
@Jaifroid
Copy link
Member

@MohitMaliFtechiz This seems a very positive direction to me. Not being able to pick archives is the biggest disadvantage of the PlayStore variant of the Kiwix Android app (which, like it or not, is always going to be the main variant for the average user).

@kelson42
Copy link
Collaborator

We can not support opening on filehandle of ZIM files on many architectures. Reason is not very clear, but is linked to restriction on files. Therefore this can not be implemented straight.

@kelson42
Copy link
Collaborator

Blocked by openzim/libzim#852

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

Successfully merging a pull request may close this issue.

3 participants