| 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Service; | 8 import android.app.Service; |
| 9 import android.app.job.JobInfo; | 9 import android.app.job.JobInfo; |
| 10 import android.app.job.JobScheduler; | 10 import android.app.job.JobScheduler; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 /** | 26 /** |
| 27 * Service that is responsible for receiving crash dumps from an application, fo
r upload. | 27 * Service that is responsible for receiving crash dumps from an application, fo
r upload. |
| 28 */ | 28 */ |
| 29 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | 29 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| 30 public class CrashReceiverService extends Service { | 30 public class CrashReceiverService extends Service { |
| 31 private static final String TAG = "CrashReceiverService"; | 31 private static final String TAG = "CrashReceiverService"; |
| 32 | 32 |
| 33 private static final String WEBVIEW_CRASH_DIR = "WebView_Crashes"; | 33 private static final String WEBVIEW_CRASH_DIR = "WebView_Crashes"; |
| 34 private static final String WEBVIEW_TMP_CRASH_DIR = "WebView_Crashes_Tmp"; | 34 private static final String WEBVIEW_TMP_CRASH_DIR = "WebView_Crashes_Tmp"; |
| 35 | 35 |
| 36 // Job ID used to schedule the minidump uploading job with the Android JobSc
heduler. Must be |
| 37 // unique in Chromium, see org.chromium.chrome.browser.JobSchedulerConstants
. |
| 36 private static final int MINIDUMP_UPLOADING_JOB_ID = 42; | 38 private static final int MINIDUMP_UPLOADING_JOB_ID = 42; |
| 39 |
| 37 // Initial back-off time for upload-job, this is set to a fairly high number
(30 minutes) to | 40 // Initial back-off time for upload-job, this is set to a fairly high number
(30 minutes) to |
| 38 // increase the chance of performing uploads in batches if the initial uploa
d fails. | 41 // increase the chance of performing uploads in batches if the initial uploa
d fails. |
| 39 private static final int JOB_BACKOFF_TIME_IN_MS = 1000 * 60 * 30; | 42 private static final int JOB_BACKOFF_TIME_IN_MS = 1000 * 60 * 30; |
| 40 // Back-off policy for upload-job. | 43 // Back-off policy for upload-job. |
| 41 private static final int JOB_BACKOFF_POLICY = JobInfo.BACKOFF_POLICY_EXPONEN
TIAL; | 44 private static final int JOB_BACKOFF_POLICY = JobInfo.BACKOFF_POLICY_EXPONEN
TIAL; |
| 42 | 45 |
| 43 private Object mCopyingLock = new Object(); | 46 private Object mCopyingLock = new Object(); |
| 44 private boolean mIsCopying = false; | 47 private boolean mIsCopying = false; |
| 45 | 48 |
| 46 @Override | 49 @Override |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 @VisibleForTesting | 213 @VisibleForTesting |
| 211 public static File getWebViewTmpCrashDir(Context context) { | 214 public static File getWebViewTmpCrashDir(Context context) { |
| 212 return new File(context.getCacheDir(), WEBVIEW_TMP_CRASH_DIR); | 215 return new File(context.getCacheDir(), WEBVIEW_TMP_CRASH_DIR); |
| 213 } | 216 } |
| 214 | 217 |
| 215 @Override | 218 @Override |
| 216 public IBinder onBind(Intent intent) { | 219 public IBinder onBind(Intent intent) { |
| 217 return mBinder; | 220 return mBinder; |
| 218 } | 221 } |
| 219 } | 222 } |
| OLD | NEW |