Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java

Issue 1334533004: Hide existing StrictMode violations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes per review. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java b/chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java
index 65d468866c974b2de18c6c79ac64941ddc2b47d1..941e4fc8e7e059497d6eda4353e6654f71ea1dcb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/crash/MinidumpUploadService.java
@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
+import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -76,19 +77,25 @@ public class MinidumpUploadService extends IntentService {
public void onCreate() {
super.onCreate();
if (isMiniDumpCleanNeeded()) {
- final CrashFileManager crashFileManager =
- new CrashFileManager(getApplicationContext().getCacheDir());
- // Cleaning minidumps in a background not to block the Ui thread.
- // NOTE: {@link CrashFileManager#cleanAllMiniDumps()} is not thread-safe and can
- // possibly result in race condition by calling from multiple threads. However, this
- // should only result in warning messages in logs.
- new AsyncTask<Void, Void, Void>() {
- @Override
- protected Void doInBackground(Void... params) {
- crashFileManager.cleanAllMiniDumps();
- return null;
- }
- }.execute();
+ // Temporarily allowing disk access while fixing. TODO: http://crbug.com/527429
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ try {
+ final CrashFileManager crashFileManager =
+ new CrashFileManager(getApplicationContext().getCacheDir());
+ // Cleaning minidumps in a background not to block the Ui thread.
+ // NOTE: {@link CrashFileManager#cleanAllMiniDumps()} is not thread-safe and can
+ // possibly result in race condition by calling from multiple threads. However, this
+ // should only result in warning messages in logs.
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ crashFileManager.cleanAllMiniDumps();
+ return null;
+ }
+ }.execute();
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698