Commit 5667720b authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

Disable DiskWrite Strict Mode checking in DecoderServiceHost

Disable DiskWrite Strict Mode checking in
DecoderServiceHost#dispatchDecodeImageRequest()

BUG=1095374

Change-Id: Id6a501aaba0fbfebd7833efcb48e22103d665a9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247381Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780335}
parent 2bcd3298
...@@ -17,13 +17,13 @@ import android.os.Bundle; ...@@ -17,13 +17,13 @@ import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.StrictMode;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.StrictModeContext;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.AsyncTask; import org.chromium.base.task.AsyncTask;
...@@ -520,8 +520,7 @@ public class DecoderServiceHost ...@@ -520,8 +520,7 @@ public class DecoderServiceHost
// The restricted utility process can't open the file to read the // The restricted utility process can't open the file to read the
// contents, so we need to obtain a file descriptor to pass over. // contents, so we need to obtain a file descriptor to pass over.
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); try (StrictModeContext ignored = StrictModeContext.allowAllThreadPolicies()) {
try {
AssetFileDescriptor afd = null; AssetFileDescriptor afd = null;
try { try {
afd = mContentResolver.openAssetFileDescriptor(params.mUri, "r"); afd = mContentResolver.openAssetFileDescriptor(params.mUri, "r");
...@@ -539,8 +538,6 @@ public class DecoderServiceHost ...@@ -539,8 +538,6 @@ public class DecoderServiceHost
closeRequestWithError(params.mUri.getPath()); closeRequestWithError(params.mUri.getPath());
return; return;
} }
} finally {
StrictMode.setThreadPolicy(oldPolicy);
} }
// Prepare and send the data over. // Prepare and send the data over.
......
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