 Chromium Code Reviews
 Chromium Code Reviews Issue 2628863004:
  [Android WebView] Ensure we have user consent before uploading minidumps  (Closed)
    
  
    Issue 2628863004:
  [Android WebView] Ensure we have user consent before uploading minidumps  (Closed) 
  | Index: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java | 
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java | 
| index 4831fcf1f4333f1635489736e2a85ebe73d7accf..f5f2ba610501338c13d280e3c559f2e02293d816 100644 | 
| --- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java | 
| +++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java | 
| @@ -157,8 +157,11 @@ public abstract class AwBrowserProcess { | 
| * Pass Minidumps to a separate Service declared in the WebView provider package. | 
| * That Service will copy the Minidumps to its own data directory - at which point we can delete | 
| * our copies in the app directory. | 
| + * @param userConsent whether we have user consent to upload crash data - if we do, copy the | 
| + * minidumps, if we don't, delete them. | 
| */ | 
| - public static void handleMinidumps(final String webViewPackageName) { | 
| + public static void handleMinidumps( | 
| + final String webViewPackageName, final boolean userApproved) { | 
| new AsyncTask<Void, Void, Void>() { | 
| @Override | 
| protected Void doInBackground(Void... params) { | 
| @@ -169,6 +172,16 @@ public abstract class AwBrowserProcess { | 
| crashFileManager.getAllMinidumpFiles(MAX_MINIDUMP_UPLOAD_TRIES); | 
| if (minidumpFiles.length == 0) return null; | 
| + // Delete the minidumps if the user doesn't allow crash data uploading. | 
| + if (!userApproved) { | 
| 
gsennton
2017/01/13 19:01:54
TODO also read enableForTesting flag (to have it o
 
gsennton
2017/01/23 17:50:39
Done (in WebViewFactoryProvider).
 | 
| + for (File minidump : minidumpFiles) { | 
| + if (!minidump.delete()) { | 
| + Log.w(TAG, "Couldn't delete file " + minidump.getAbsolutePath()); | 
| + } | 
| + } | 
| + return null; | 
| + } | 
| + | 
| final Intent intent = new Intent(); | 
| intent.setClassName(webViewPackageName, CrashReceiverService.class.getName()); |