@@ -0,0 +1,2934 @@
+package com.shunix.scavenger.log;%0A%0Aimport android.content.Context;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0Aimport android.os.Build;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0A%0A/**%0A * This class represent a crash%0A * Created by shunix on 15-2-2.%0A */%0Apublic class Crash %7B%0A    protected Throwable mException;%0A    protected Context mContext;%0A    private StringBuilder mBuilder;%0A%0A    public Crash(Throwable throwable, Context context) %7B%0A        this.mException = throwable;%0A        this.mContext = context;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        if (mBuilder != null) %7B%0A            return mBuilder.toString();%0A        %7D%0A        mBuilder = new StringBuilder();%0A        mBuilder.append(getPackageInfo());%0A        mBuilder.append(getDeviceInfo());%0A        if (mException != null) %7B%0A            ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A            try %7B%0A                mException.printStackTrace(new PrintStream(baos));%0A                mBuilder.append(new String(baos.toByteArray()));%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A            %7D finally %7B%0A                if (baos != null) %7B%0A                    try %7B%0A                        baos.close();%0A                    %7D catch (IOException e) %7B%0A                        e.printStackTrace();%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return mBuilder.toString();%0A    %7D%0A%0A    protected String getPackageInfo() %7B%0A        String packageInfoString = %22%22;%0A        if (mContext == null) %7B%0A            return %22%22;%0A        %7D%0A        PackageManager packageManager = mContext.getPackageManager();%0A        try %7B%0A            PackageInfo packageInfo = packageManager.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);%0A            StringBuilder stringBuilder = new StringBuilder();%0A            stringBuilder%0A                    .append(%22Package Name: %22)%0A                    .append(packageInfo.packageName)%0A                    .append(%22 Package Version Name: %22)%0A                    .append(packageInfo.versionName)%0A                    .append(%22 Package Version Code: %22)%0A                    .append(packageInfo.versionCode)%0A                    .append(%22%5Cn%22);%0A            packageInfoString = stringBuilder.toString();%0A        %7D catch (PackageManager.NameNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        return packageInfoString;%0A    %7D%0A%0A    protected String getDeviceInfo() %7B%0A        if (mContext == null) %7B%0A            return %22%22;%0A        %7D%0A        StringBuilder stringBuilder = new StringBuilder();%0A        stringBuilder%0A                .append(%22Device Model: %22)%0A                .append(Build.MODEL)%0A                .append(%22 Android Version: %22)%0A                .append(Build.VERSION.RELEASE)%0A                .append(%22%5Cn%22);%0A        return stringBuilder.toString();%0A    %7D%0A%7D%0A

Add a class to represent crash