-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Explicit MIME type declaration on querying available packages for opening files #3020
base: release/3.7
Are you sure you want to change the base?
Explicit MIME type declaration on querying available packages for opening files #3020
Conversation
Pending #3022 before continuing. Will add queries for commonly used document types. |
…ning files As noted by Android Studio on the use of android.permission.QUERY_ALL_PACKAGES permission, use <queries> with explicit action and MIME type instead. This also reduces possibility of unrelated apps from popping up in the list of available apps. Additionally, as noted in https://stackoverflow.com/a/55071463, change SQLITE MIME type to application/vnd.sqlite3.
e3e2e39
to
c2e9eae
Compare
- AndroidManifest.xml, add android:exported attribute to <activity> as recommended by Android Studio - Add back missing rar extension to FileUtils.COMPRESSED_FILE_EXTENSIONS which prevented RAR files be opened by Amaze for viewing
c2e9eae
to
68a23d0
Compare
I don't prefer this. We have an inbuilt file opener. we need to query any and all mime types. |
Use one single wildcard MIME type for querying
Then use a wildcard. It is still the preferred way to declare MIME type query to open files as noted by Android Studio hints. |
@TranceLove It's preferable in other usecases, for us mime type is basically all, so defining a subset is gonna hurt us only. I think we can ignore this warning by ide. |
From play store:
I'll be declaring because as per the policy, file managers should be allowed to query all packages, but just in case it doesn't go through we should have this PR as a backup. Thanks for working on this @TranceLove |
Description
As noted by Android Studio on the use of
android.permission.QUERY_ALL_PACKAGES
permission, use<queries>
with explicitly defined action and MIME type instead. This looks safer (minimal permission principle), and also reduces possibility of unrelated apps from popping up in the list of available apps.Additionally:
application/vnd.sqlite3
android:exported
attribute to<activity>
s in AndroidManifest.xml where the activity is not necessary to exportrar
toFileUtils.COMPRESSED_FILE_EXTENSIONS
to fix problem that opening a RAR file using Amaze does not load up theCompressedExplorerFragment
Manual tests
Device: Pixel 2 emulator
OS: Android 11
Device: Fairphone 3
OS: LineageOS 16.0 (9.0)
Device: Pixel 2 emulator
OS: Android 6.0
CompressedExplorerFragment
for viewing contents inside the archiveBuild tasks success
Successfully running following tasks on local:
./gradlew assembledebug
./gradlew spotlessCheck