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.components.minidump_uploader; | 5 package org.chromium.components.minidump_uploader; |
6 | 6 |
7 import android.content.SharedPreferences; | 7 import android.content.SharedPreferences; |
8 import android.support.annotation.IntDef; | 8 import android.support.annotation.IntDef; |
9 | 9 |
10 import org.chromium.base.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 Log.i(TAG, "Minidump upload skipped due to sampling. Marking fi le as skipped for " | 106 Log.i(TAG, "Minidump upload skipped due to sampling. Marking fi le as skipped for " |
107 + "cleanup to prevent future uploads."); | 107 + "cleanup to prevent future uploads."); |
108 CrashFileManager.markUploadSkipped(mFileToUpload); | 108 CrashFileManager.markUploadSkipped(mFileToUpload); |
109 return UPLOAD_DISABLED_BY_SAMPLING; | 109 return UPLOAD_DISABLED_BY_SAMPLING; |
110 } | 110 } |
111 | 111 |
112 if (!mPermManager.isNetworkAvailableForCrashUploads()) { | 112 if (!mPermManager.isNetworkAvailableForCrashUploads()) { |
113 Log.i(TAG, "Minidump cannot currently be uploaded due to network constraints."); | 113 Log.i(TAG, "Minidump cannot currently be uploaded due to network constraints."); |
114 return UPLOAD_FAILURE; | 114 return UPLOAD_FAILURE; |
115 } | 115 } |
116 | |
117 // The above checks should be at least as strict as the requirements for UMA uploads. | |
118 assert mPermManager.isMetricsUploadPermitted(); | |
gsennton
2017/03/13 17:57:17
Ideally, I would probably remove this in a separat
Ilya Sherman
2017/03/14 02:18:55
Done.
| |
119 } | 116 } |
120 | 117 |
121 HttpURLConnection connection = | 118 HttpURLConnection connection = |
122 mHttpURLConnectionFactory.createHttpURLConnection(CRASH_URL_STRI NG); | 119 mHttpURLConnectionFactory.createHttpURLConnection(CRASH_URL_STRI NG); |
123 if (connection == null) { | 120 if (connection == null) { |
124 return UPLOAD_FAILURE; | 121 return UPLOAD_FAILURE; |
125 } | 122 } |
126 | 123 |
127 FileInputStream minidumpInputStream = null; | 124 FileInputStream minidumpInputStream = null; |
128 try { | 125 try { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 // TODO(gayane): Remove this function and unused prefs in M51. crbug.com/555 022 | 306 // TODO(gayane): Remove this function and unused prefs in M51. crbug.com/555 022 |
310 private void removeOutdatedPrefs(SharedPreferences sharedPreferences) { | 307 private void removeOutdatedPrefs(SharedPreferences sharedPreferences) { |
311 SharedPreferences.Editor editor = sharedPreferences.edit(); | 308 SharedPreferences.Editor editor = sharedPreferences.edit(); |
312 editor.remove(PREF_DAY_UPLOAD_COUNT) | 309 editor.remove(PREF_DAY_UPLOAD_COUNT) |
313 .remove(PREF_LAST_UPLOAD_DAY) | 310 .remove(PREF_LAST_UPLOAD_DAY) |
314 .remove(PREF_LAST_UPLOAD_WEEK) | 311 .remove(PREF_LAST_UPLOAD_WEEK) |
315 .remove(PREF_WEEK_UPLOAD_SIZE) | 312 .remove(PREF_WEEK_UPLOAD_SIZE) |
316 .apply(); | 313 .apply(); |
317 } | 314 } |
318 } | 315 } |
OLD | NEW |