Skip to content

Commit

Permalink
[Fix] Keep workaround for ChooserActivity since the framework fix is …
Browse files Browse the repository at this point in the history
…reverted.
  • Loading branch information
zhanghai committed Feb 11, 2022
1 parent 71a8c12 commit 6b5da0a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/src/main/java/me/zhanghai/android/files/file/FileProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,12 @@ class FileProvider : ContentProvider() {
}

private fun getDefaultProjection(): Array<String> =
// TODO: Use platform constant for T after SDK finalization.
//if (Build.VERSION.SDK_INT in Build.VERSION_CODES.Q until Build.VERSION_CODES.TIRAMISU
if (Build.VERSION.SDK_INT in Build.VERSION_CODES.Q until 33
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
&& Binder.getCallingUid() == Process.SYSTEM_UID) {
// com.android.internal.app.ChooserActivity.queryResolver() in Q until T queries with a
// null projection (meaning all columns) on main thread but only actually needs the
// display name (and document flags). However if we do return all the columns, we may
// perform network requests and crash it due to StrictMode. So just work around by only
// com.android.internal.app.ChooserActivity.queryResolver() in Q queries with a null
// projection (meaning all columns) on main thread but only actually needs the display
// name (and document flags). However if we do return all the columns, we may perform
// network requests and crash it due to StrictMode. So just work around by only
// returning the display name in this case.
CHOOSER_ACTIVITY_DEFAULT_PROJECTION
} else {
Expand Down

0 comments on commit 6b5da0a

Please sign in to comment.