summaryrefslogtreecommitdiff
path: root/java/tests/AndroidTest.xml
diff options
context:
space:
mode:
author Hai Zhang <zhanghai@google.com> 2022-02-06 11:17:57 +0000
committer Hai Zhang <zhanghai@google.com> 2022-02-06 11:31:55 +0000
commitf06549ed6e9978af7c9d5e29e567f6bcd8216429 (patch)
tree3910478cde0827bef36da47f9965d198d6461bb1 /java/tests/AndroidTest.xml
parent9d71e26767a86142844ea7caedfda2bcdb70dd37 (diff)
Query only necessary columns in ChooserActivity.extractFileInfo().
ChooserActivity started querying the content URI with a null projection since Q, which means a default projection that includes all columns. However, ChooserActivity.extractFileInfo() actually only needs the file name and flags, so querying all columns usually means reading unnecessary information that may involve disk access, and it's called on the main thread. For example, ExternalStorageProvider returns the file size and last modified time when it sees a null projection, and it is calling File.length() and File.lastModified() for them. In other file providers, it is also possible for this to trigger a network request for such information, which will result in a NetworkOnMainThreadException that crashes the android:ui process. So to improve stability and performance, we should provide a projection that only contains the columns that we are actually interested in. Bug: 218105374 Test: ChooserActivityTest Change-Id: I2ab9c6f03e7034a5347bfe3a3d3b2d6ea505059c
Diffstat (limited to 'java/tests/AndroidTest.xml')
0 files changed, 0 insertions, 0 deletions