Open MohitMaliFtechiz opened 8 months ago
@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).
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.
Blocked by https://github.com/openzim/libzim/issues/852
Describe the bug While testing and refactoring the code for https://github.com/kiwix/kiwix-android/pull/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 existingfile 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
File
which is the basic requirement of our application to function, and we can not access the files without special permission.inputStream
but it did not fit in our requirements, since it used twice the storage for the same ZIM file.file descriptor
approach in https://github.com/kiwix/kiwix-android/issues/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 withold-libkiwix
java-libkiwix
which had the issue opening the ZIM files via file descriptor that we saw while we were introducing theASSET_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 afile 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
Additional notes to remember
https://github.com/kiwix/kiwix-android/assets/34593983/523d4503-3548-45aa-988b-ffc035ef6263