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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/crash/AwMinidumpUploaderDelegate.java

Issue 2737263006: [Android Crash Reporting] Allow uploading minidumps via the JobScheduler (Closed)
Patch Set: Fully implemented, still needs tests Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview.crash; 5 package org.chromium.android_webview.crash;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.net.ConnectivityManager; 8 import android.net.ConnectivityManager;
9 import android.net.NetworkInfo; 9 import android.net.NetworkInfo;
10 import android.webkit.ValueCallback; 10 import android.webkit.ValueCallback;
(...skipping 18 matching lines...) Expand all
29 private boolean mPermittedByUser = false; 29 private boolean mPermittedByUser = false;
30 30
31 @VisibleForTesting 31 @VisibleForTesting
32 public AwMinidumpUploaderDelegate(Context context) { 32 public AwMinidumpUploaderDelegate(Context context) {
33 mContext = context; 33 mContext = context;
34 mConnectivityManager = 34 mConnectivityManager =
35 (ConnectivityManager) context.getSystemService(Context.CONNECTIV ITY_SERVICE); 35 (ConnectivityManager) context.getSystemService(Context.CONNECTIV ITY_SERVICE);
36 } 36 }
37 37
38 @Override 38 @Override
39 public File createCrashDir() { 39 public File getCacheDir() {
40 // TODO(isherman): This actually results in the directory structure cach e/crash/crash. Is
41 // it worth fixing? We might lose pending crash reports in the nested di r if we do try a fix
42 // here...
Ilya Sherman 2017/03/13 03:12:09 Gustav, WDYT? (In either case, not a change I'd w
gsennton 2017/03/13 17:57:17 the directory structure is cache/WebView_Crashes/C
Ilya Sherman 2017/03/14 02:18:55 Ah, okay, this makes more sense now. I renamed th
40 return CrashReceiverService.createWebViewCrashDir(mContext); 43 return CrashReceiverService.createWebViewCrashDir(mContext);
41 } 44 }
42 45
43 @Override 46 @Override
44 public CrashReportingPermissionManager createCrashReportingPermissionManager () { 47 public CrashReportingPermissionManager createCrashReportingPermissionManager () {
45 return new CrashReportingPermissionManager() { 48 return new CrashReportingPermissionManager() {
46 @Override 49 @Override
47 public boolean isClientInMetricsSample() { 50 public boolean isClientInMetricsSample() {
48 // We will check whether the client is in the metrics sample bef ore 51 // We will check whether the client is in the metrics sample bef ore
49 // generating a minidump - so if no minidump is generated this c ode will 52 // generating a minidump - so if no minidump is generated this c ode will
(...skipping 10 matching lines...) Expand all
60 // checks only whether the network is WiFi (or ethernet) vs. cel lular. Most likely, 63 // checks only whether the network is WiFi (or ethernet) vs. cel lular. Most likely,
61 // Chrome should instead check whether the network is metered, a s is done here. 64 // Chrome should instead check whether the network is metered, a s is done here.
62 NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkI nfo(); 65 NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkI nfo();
63 if (networkInfo == null || !networkInfo.isConnected()) return fa lse; 66 if (networkInfo == null || !networkInfo.isConnected()) return fa lse;
64 return !mConnectivityManager.isActiveNetworkMetered(); 67 return !mConnectivityManager.isActiveNetworkMetered();
65 } 68 }
66 @Override 69 @Override
67 public boolean isCrashUploadDisabledByCommandLine() { 70 public boolean isCrashUploadDisabledByCommandLine() {
68 return false; 71 return false;
69 } 72 }
70 /**
71 * This method is already represented by isClientInMetricsSample() a nd
72 * isNetworkAvailableForCrashUploads().
73 */
74 @Override
75 public boolean isMetricsUploadPermitted() {
76 return true;
77 }
78 @Override 73 @Override
79 public boolean isUsageAndCrashReportingPermittedByUser() { 74 public boolean isUsageAndCrashReportingPermittedByUser() {
80 return mPermittedByUser; 75 return mPermittedByUser;
81 } 76 }
82 @Override 77 @Override
83 public boolean isUploadEnabledForTests() { 78 public boolean isUploadEnabledForTests() {
84 // Note that CommandLine/CommandLineUtil are not thread safe. Th ey are initialized 79 // Note that CommandLine/CommandLineUtil are not thread safe. Th ey are initialized
85 // on the main thread, but before the current worker thread star ted - so this thread 80 // on the main thread, but before the current worker thread star ted - so this thread
86 // will have seen the initialization of the CommandLine. 81 // will have seen the initialization of the CommandLine.
87 return CommandLine.getInstance().hasSwitch( 82 return CommandLine.getInstance().hasSwitch(
(...skipping 15 matching lines...) Expand all
103 98
104 /** 99 /**
105 * Utility method to allow us to test the logic of this class by injecting 100 * Utility method to allow us to test the logic of this class by injecting
106 * a test-specific PlatformServiceBridge. 101 * a test-specific PlatformServiceBridge.
107 */ 102 */
108 @VisibleForTesting 103 @VisibleForTesting
109 public PlatformServiceBridge createPlatformServiceBridge() { 104 public PlatformServiceBridge createPlatformServiceBridge() {
110 return PlatformServiceBridge.getInstance(mContext); 105 return PlatformServiceBridge.getInstance(mContext);
111 } 106 }
112 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698