| 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 package org.chromium.android_webview.crash; | 4 package org.chromium.android_webview.crash; |
| 5 | 5 |
| 6 import android.annotation.TargetApi; | 6 import android.annotation.TargetApi; |
| 7 import android.os.Build; | 7 import android.os.Build; |
| 8 | 8 |
| 9 import org.chromium.android_webview.command_line.CommandLineUtil; | 9 import org.chromium.android_webview.command_line.CommandLineUtil; |
| 10 import org.chromium.base.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
| 11 import org.chromium.components.minidump_uploader.MinidumpUploadJobService; | 11 import org.chromium.components.minidump_uploader.MinidumpUploadJobService; |
| 12 import org.chromium.components.minidump_uploader.MinidumpUploader; | 12 import org.chromium.components.minidump_uploader.MinidumpUploader; |
| 13 import org.chromium.components.minidump_uploader.MinidumpUploaderImpl; |
| 13 | 14 |
| 14 /** | 15 /** |
| 15 * Class that interacts with the Android JobScheduler to upload Minidumps at app
ropriate times. | 16 * Class that interacts with the Android JobScheduler to upload Minidumps at app
ropriate times. |
| 16 */ | 17 */ |
| 17 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | 18 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| 18 // OBS: This class needs to be public to be started from android.app.ActivityThr
ead. | 19 // OBS: This class needs to be public to be started from android.app.ActivityThr
ead. |
| 19 public class AwMinidumpUploadJobService extends MinidumpUploadJobService { | 20 public class AwMinidumpUploadJobService extends MinidumpUploadJobService { |
| 20 @Override | 21 @Override |
| 21 public void onCreate() { | 22 public void onCreate() { |
| 22 super.onCreate(); | 23 super.onCreate(); |
| 23 // This overwrites the command line set by ChromeApplication.onCreate()
to use a | 24 // This overwrites the command line set by ChromeApplication.onCreate()
to use a |
| 24 // WebView-specific command line file. This is okay since this Service i
s not running in the | 25 // WebView-specific command line file. This is okay since this Service i
s not running in the |
| 25 // same process as the main Chrome process. | 26 // same process as the main Chrome process. |
| 26 CommandLineUtil.initCommandLine(); | 27 CommandLineUtil.initCommandLine(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 @Override | 30 @Override |
| 30 protected MinidumpUploader createMinidumpUploader() { | 31 protected MinidumpUploader createMinidumpUploader() { |
| 31 // Ensure we can use ContextUtils later on (from the minidump_uploader c
omponent). | 32 // Ensure we can use ContextUtils later on (from the minidump_uploader c
omponent). |
| 32 ContextUtils.initApplicationContext(this.getApplicationContext()); | 33 ContextUtils.initApplicationContext(this.getApplicationContext()); |
| 33 | 34 |
| 34 return new MinidumpUploaderImpl(this); | 35 return new MinidumpUploaderImpl(new AwMinidumpUploaderDelegate(this)); |
| 35 } | 36 } |
| 36 } | 37 } |
| OLD | NEW |