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.chrome.browser.crash; | 5 package org.chromium.chrome.browser.crash; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.os.Build; | 9 import android.os.Build; |
10 import android.os.FileObserver; | 10 import android.os.FileObserver; |
11 | 11 |
12 import org.chromium.base.ContextUtils; | 12 import org.chromium.base.ContextUtils; |
13 import org.chromium.base.Log; | 13 import org.chromium.base.Log; |
14 import org.chromium.base.PathUtils; | 14 import org.chromium.base.PathUtils; |
15 import org.chromium.base.metrics.RecordUserAction; | 15 import org.chromium.base.metrics.RecordUserAction; |
16 | 16 |
17 import java.io.File; | 17 import java.io.File; |
18 | 18 |
19 /** | 19 /** |
20 * The FileObserver to monitor the minidump directory. | 20 * The FileObserver to monitor the minidump directory. |
21 */ | 21 */ |
22 public class MinidumpDirectoryObserver extends FileObserver { | 22 public class MinidumpDirectoryObserver extends FileObserver { |
23 | 23 |
24 private static final String TAG = "MinidumpDirObserver"; | 24 private static final String TAG = "MinidumpDirObserver"; |
25 private static Context sContext = ContextUtils.getApplicationContext(); | 25 private static Context sContext = ContextUtils.getApplicationContext(); |
26 | 26 |
27 public static final String MINIDUMP_EXPERIMENT_NAME = "MinidumpDirectoryObse
rver"; | |
28 | |
29 public MinidumpDirectoryObserver() { | 27 public MinidumpDirectoryObserver() { |
30 // The file observer detects MOVED_TO for child processes. | 28 // The file observer detects MOVED_TO for child processes. |
31 super(new File(PathUtils.getCacheDirectory(sContext), | 29 super(new File(PathUtils.getCacheDirectory(sContext), |
32 CrashFileManager.CRASH_DUMP_DIR).toString(), FileObserver.MOVED_
TO); | 30 CrashFileManager.CRASH_DUMP_DIR).toString(), FileObserver.MOVED_
TO); |
33 } | 31 } |
34 | 32 |
35 /** | 33 /** |
36 * When a minidump is detected, upload it to Google crash server | 34 * When a minidump is detected, upload it to Google crash server |
37 */ | 35 */ |
38 @Override | 36 @Override |
(...skipping 10 matching lines...) Expand all Loading... |
49 // find our own crash uploading service. Ignore a SecurityExcept
ion here on older | 47 // find our own crash uploading service. Ignore a SecurityExcept
ion here on older |
50 // OS versions since the crash will eventually get uploaded on n
ext start. | 48 // OS versions since the crash will eventually get uploaded on n
ext start. |
51 // crbug/542533 | 49 // crbug/542533 |
52 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | 50 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
53 throw e; | 51 throw e; |
54 } | 52 } |
55 } | 53 } |
56 } | 54 } |
57 } | 55 } |
58 } | 56 } |
OLD | NEW |