ChromeStrictMode.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:chromium-for-android-56-debug-video 作者:
/**
 * Always process the violation on the UI thread. This ensures other crash reports are not
 * corrupted. Since each individual user has a very small chance of uploading each violation,
 * and we have a hard cap of 3 per session, this will not affect performance too much.
 *
 * @param violationInfo The violation info from the StrictMode violation in question.
 */
@UiThread
private static void reportStrictModeViolation(Object violationInfo) {
    try {
        Field crashInfoField = violationInfo.getClass().getField("crashInfo");
        ApplicationErrorReport.CrashInfo crashInfo =
                (ApplicationErrorReport.CrashInfo) crashInfoField.get(violationInfo);
        String stackTrace = crashInfo.stackTrace;
        if (stackTrace == null) {
            Log.d(TAG, "StrictMode violation stack trace was null.");
        } else {
            Log.d(TAG, "Upload stack trace: " + stackTrace);
            JavaExceptionReporter.reportStackTrace(stackTrace);
        }
    } catch (Exception e) {
        // Ignore all exceptions.
        Log.d(TAG, "Could not handle observed StrictMode violation.", e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号