Commit 27dc5aad authored by Min Qin's avatar Min Qin Committed by Commit Bot

Fix a StrictMode issue when setting DownloadDelegate in DownloadCollectionBridge

BUG=1061042

Change-Id: I91c3d60d0f9be69fb8ed82b3ca8f67434b4b84c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100716
Commit-Queue: Min Qin <qinmin@chromium.org>
Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750229}
parent 146c32cb
......@@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
import org.chromium.base.BuildInfo;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.StrictModeContext;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
......@@ -88,7 +89,12 @@ public class DownloadCollectionBridge {
* @param downloadDelegate The new delegate to be used.
*/
public static void setDownloadDelegate(DownloadDelegate downloadDelegate) {
sDownloadDelegate = downloadDelegate;
// TODO(qinmin): On Android O, ClassLoader may need to access disk when
// setting the |sDownloadDelegate|. Move this to a background thread.
// See http://crbug.com/1061042.
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
sDownloadDelegate = downloadDelegate;
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment