OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public boolean isNetworkAvailableForCrashUploads() { | 56 public boolean isNetworkAvailableForCrashUploads() { |
57 // JobScheduler will call onStopJob causing our upload to be int
errupted when our | 57 // JobScheduler will call onStopJob causing our upload to be int
errupted when our |
58 // network requirements no longer hold. | 58 // network requirements no longer hold. |
59 // TODO(isherman): This code should really be shared with Chrome
. Chrome currently | 59 // TODO(isherman): This code should really be shared with Chrome
. Chrome currently |
60 // checks only whether the network is WiFi (or ethernet) vs. cel
lular. Most likely, | 60 // 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. | 61 // Chrome should instead check whether the network is metered, a
s is done here. |
62 NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkI
nfo(); | 62 NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkI
nfo(); |
63 if (networkInfo == null || !networkInfo.isConnected()) return fa
lse; | 63 if (networkInfo == null || !networkInfo.isConnected()) return fa
lse; |
64 return !mConnectivityManager.isActiveNetworkMetered(); | 64 return !mConnectivityManager.isActiveNetworkMetered(); |
65 } | 65 } |
66 @Override | |
67 public boolean isCrashUploadDisabledByCommandLine() { | |
68 return false; | |
69 } | |
70 /** | 66 /** |
71 * This method is already represented by isClientInMetricsSample() a
nd | 67 * This method is already represented by isClientInMetricsSample() a
nd |
72 * isNetworkAvailableForCrashUploads(). | 68 * isNetworkAvailableForCrashUploads(). |
73 */ | 69 */ |
74 @Override | 70 @Override |
75 public boolean isMetricsUploadPermitted() { | 71 public boolean isMetricsUploadPermitted() { |
76 return true; | 72 return true; |
77 } | 73 } |
78 @Override | 74 @Override |
79 public boolean isUsageAndCrashReportingPermittedByUser() { | 75 public boolean isUsageAndCrashReportingPermittedByUser() { |
(...skipping 29 matching lines...) Expand all Loading... |
109 | 105 |
110 /** | 106 /** |
111 * Utility method to allow us to test the logic of this class by injecting | 107 * Utility method to allow us to test the logic of this class by injecting |
112 * a test-specific PlatformServiceBridge. | 108 * a test-specific PlatformServiceBridge. |
113 */ | 109 */ |
114 @VisibleForTesting | 110 @VisibleForTesting |
115 public PlatformServiceBridge createPlatformServiceBridge() { | 111 public PlatformServiceBridge createPlatformServiceBridge() { |
116 return PlatformServiceBridge.getInstance(mContext); | 112 return PlatformServiceBridge.getInstance(mContext); |
117 } | 113 } |
118 } | 114 } |
OLD | NEW |