zoukankan      html  css  js  c++  java
  • 保留全部Android crash信息

    保留全部Android crash信息


    framework/base/core/java/com/android/internal/os/RuntimeInit.java


    又一次以下这个函数,增加自己的代码,把信息保存下来,或者发回server


         */
        private static class UncaughtHandler implements Thread.UncaughtExceptionHandler {
            public void uncaughtException(Thread t, Throwable e) {
                try {
                    // Don't re-enter -- avoid infinite loops if crash-reporting crashes.
                    if (mCrashing) return;
                    mCrashing = true;


                    if (mApplicationObject == null) {
                        Clog_e(TAG, "*** FATAL EXCEPTION IN SYSTEM PROCESS: " + t.getName(), e);
                    } else {
                        StringBuilder message = new StringBuilder();
                        message.append("FATAL EXCEPTION: ").append(t.getName()).append(" ");
                        final String processName = ActivityThread.currentProcessName();
                        if (processName != null) {
                            message.append("Process: ").append(processName).append(", ");
                        }
                        message.append("PID: ").append(Process.myPid());
                        Clog_e(TAG, message.toString(), e);
                    }


                    // Bring up crash dialog, wait for it to be dismissed
                    ActivityManagerNative.getDefault().handleApplicationCrash(
                            mApplicationObject, new ApplicationErrorReport.CrashInfo(e));

                } catch (Throwable t2) {
                    try {
                        Clog_e(TAG, "Error reporting crash", t2);
                    } catch (Throwable t3) {
                        // Even Clog_e() fails!  Oh well.
                    }
                } finally {
                    // Try everything to make sure this process goes away.
                    Process.killProcess(Process.myPid());
                    System.exit(10);
                }
            }
        }

  • 相关阅读:
    java 开发面试题小整理(二)
    Java 字符串比较小知识
    适配器、工厂模式、线程池、线程组、互斥锁、Timer类、Runtime类、单例设计模式(二十四)
    多线程、死锁、线程安全、同步方法、代码块、休眠、守护线程、Thread、Runnable(二十三)
    RabbitMQ的几种典型使用场景
    SQL一些问题
    Redis和Memcached的区别
    Mongodb 使用场景和不使用场景
    Adapter as a WCF Binding
    ASP.NET MVC使用Filter解除Session, Cookie等依赖
  • 原文地址:https://www.cnblogs.com/mfmdaoyou/p/7074271.html
Copyright © 2011-2022 走看看