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