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

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

Issue 1445233002: Schedule an early upload of non-JNI Java crashes Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync / rebase Created 5 years 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 b36cfb90293ec972d369f99e0e4a6dcd39e607b0..2deadb8225c6b0c7c50618098bf7be5200a3846d 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
@@ -23,7 +23,8 @@ public class MinidumpUploadService extends IntentService {
private static final String TAG = "MinidmpUploadService";
// Intent actions
- private static final String ACTION_FIND_LAST =
+ @VisibleForTesting
+ static final String ACTION_FIND_LAST =
"com.google.android.apps.chrome.crash.ACTION_FIND_LAST";
@VisibleForTesting
static final String ACTION_FIND_ALL =
@@ -259,4 +260,32 @@ public class MinidumpUploadService extends IntentService {
Intent findAndUploadAllCrashesIntent = createFindAndUploadAllCrashesIntent(context);
context.startService(findAndUploadAllCrashesIntent);
}
+
+ public static void tryUploadLastCrashDump(Context context) {
+ Intent intent = createFindAndUploadLastCrashIntent(context);
+ context.startService(intent);
+ }
+
+ /**
+ * Checks whether it is the first time restrictions for cellular uploads should apply. Is used
+ * to determine whether unsent crash uploads should be deleted which should happen only once.
+ */
+ @VisibleForTesting
+ protected boolean isMinidumpCleanNeeded() {
Yaron 2015/12/04 21:29:30 Where is this used?
+ SharedPreferences sharedPreferences =
+ PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+
+ // If cellular upload logic is enabled and the preference used for that is not initialized
+ // then this is the first time that logic is enabled.
+ boolean cleanNeeded =
+ !sharedPreferences.contains(MinidumpUploadCallable.PREF_LAST_UPLOAD_DAY)
+ && PrivacyPreferencesManager.getInstance(getApplicationContext()).isUploadLimited();
+
+ // Initialize the preference with default value to make sure the above check works only
+ // once.
+ if (cleanNeeded) {
+ sharedPreferences.edit().putInt(MinidumpUploadCallable.PREF_LAST_UPLOAD_DAY, 0).apply();
+ }
+ return cleanNeeded;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698