Search in sources :

Example 11 with ApplicationErrorReport

use of android.app.ApplicationErrorReport in project android_frameworks_base by crdroidandroid.

the class AppErrors method createAppErrorReportLocked.

private ApplicationErrorReport createAppErrorReportLocked(ProcessRecord r, long timeMillis, ApplicationErrorReport.CrashInfo crashInfo) {
    if (r.errorReportReceiver == null) {
        return null;
    }
    if (!r.crashing && !r.notResponding && !r.forceCrashReport) {
        return null;
    }
    ApplicationErrorReport report = new ApplicationErrorReport();
    report.packageName = r.info.packageName;
    report.installerPackageName = r.errorReportReceiver.getPackageName();
    report.processName = r.processName;
    report.time = timeMillis;
    report.systemApp = (r.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
    if (r.crashing || r.forceCrashReport) {
        report.type = ApplicationErrorReport.TYPE_CRASH;
        report.crashInfo = crashInfo;
    } else if (r.notResponding) {
        report.type = ApplicationErrorReport.TYPE_ANR;
        report.anrInfo = new ApplicationErrorReport.AnrInfo();
        report.anrInfo.activity = r.notRespondingReport.tag;
        report.anrInfo.cause = r.notRespondingReport.shortMsg;
        report.anrInfo.info = r.notRespondingReport.longMsg;
    }
    return report;
}
Also used : ApplicationErrorReport(android.app.ApplicationErrorReport)

Example 12 with ApplicationErrorReport

use of android.app.ApplicationErrorReport in project kcanotify by antest1.

the class Util method sendCrashReport.

public static void sendCrashReport(Throwable ex, final Context context) {
    if (!isPlayStoreInstall(context) || Util.isDebuggable(context))
        return;
    try {
        ApplicationErrorReport report = new ApplicationErrorReport();
        report.packageName = report.processName = context.getPackageName();
        report.time = System.currentTimeMillis();
        report.type = ApplicationErrorReport.TYPE_CRASH;
        report.systemApp = false;
        ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo();
        crash.exceptionClassName = ex.getClass().getSimpleName();
        crash.exceptionMessage = ex.getMessage();
        StringWriter writer = new StringWriter();
        PrintWriter printer = new PrintWriter(writer);
        ex.printStackTrace(printer);
        crash.stackTrace = writer.toString();
        StackTraceElement stack = ex.getStackTrace()[0];
        crash.throwClassName = stack.getClassName();
        crash.throwFileName = stack.getFileName();
        crash.throwLineNumber = stack.getLineNumber();
        crash.throwMethodName = stack.getMethodName();
        report.crashInfo = crash;
        final Intent bug = new Intent(Intent.ACTION_APP_ERROR);
        bug.putExtra(Intent.EXTRA_BUG_REPORT, report);
        bug.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (bug.resolveActivity(context.getPackageManager()) != null)
            context.startActivity(bug);
    } catch (Throwable exex) {
        Log.e(TAG, exex.toString() + "\n" + Log.getStackTraceString(exex));
    }
}
Also used : ApplicationErrorReport(android.app.ApplicationErrorReport) StringWriter(java.io.StringWriter) Intent(android.content.Intent) PrintWriter(java.io.PrintWriter)

Example 13 with ApplicationErrorReport

use of android.app.ApplicationErrorReport in project cornerstone by Onskreen.

the class ActivityManagerService method createAppErrorIntentLocked.

Intent createAppErrorIntentLocked(ProcessRecord r, long timeMillis, ApplicationErrorReport.CrashInfo crashInfo) {
    ApplicationErrorReport report = createAppErrorReportLocked(r, timeMillis, crashInfo);
    if (report == null) {
        return null;
    }
    Intent result = new Intent(Intent.ACTION_APP_ERROR);
    result.setComponent(r.errorReportReceiver);
    result.putExtra(Intent.EXTRA_BUG_REPORT, report);
    result.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return result;
}
Also used : ApplicationErrorReport(android.app.ApplicationErrorReport) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 14 with ApplicationErrorReport

use of android.app.ApplicationErrorReport in project android_frameworks_base by ParanoidAndroid.

the class ActivityManagerService method createAppErrorIntentLocked.

Intent createAppErrorIntentLocked(ProcessRecord r, long timeMillis, ApplicationErrorReport.CrashInfo crashInfo) {
    ApplicationErrorReport report = createAppErrorReportLocked(r, timeMillis, crashInfo);
    if (report == null) {
        return null;
    }
    Intent result = new Intent(Intent.ACTION_APP_ERROR);
    result.setComponent(r.errorReportReceiver);
    result.putExtra(Intent.EXTRA_BUG_REPORT, report);
    result.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return result;
}
Also used : ApplicationErrorReport(android.app.ApplicationErrorReport) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 15 with ApplicationErrorReport

use of android.app.ApplicationErrorReport in project android_frameworks_base by AOSPA.

the class AppErrors method createAppErrorReportLocked.

private ApplicationErrorReport createAppErrorReportLocked(ProcessRecord r, long timeMillis, ApplicationErrorReport.CrashInfo crashInfo) {
    if (r.errorReportReceiver == null) {
        return null;
    }
    if (!r.crashing && !r.notResponding && !r.forceCrashReport) {
        return null;
    }
    ApplicationErrorReport report = new ApplicationErrorReport();
    report.packageName = r.info.packageName;
    report.installerPackageName = r.errorReportReceiver.getPackageName();
    report.processName = r.processName;
    report.time = timeMillis;
    report.systemApp = (r.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
    if (r.crashing || r.forceCrashReport) {
        report.type = ApplicationErrorReport.TYPE_CRASH;
        report.crashInfo = crashInfo;
    } else if (r.notResponding) {
        report.type = ApplicationErrorReport.TYPE_ANR;
        report.anrInfo = new ApplicationErrorReport.AnrInfo();
        report.anrInfo.activity = r.notRespondingReport.tag;
        report.anrInfo.cause = r.notRespondingReport.shortMsg;
        report.anrInfo.info = r.notRespondingReport.longMsg;
    }
    return report;
}
Also used : ApplicationErrorReport(android.app.ApplicationErrorReport)

Aggregations

ApplicationErrorReport (android.app.ApplicationErrorReport)17 Intent (android.content.Intent)10 PendingIntent (android.app.PendingIntent)2 PrintWriter (java.io.PrintWriter)2 StringWriter (java.io.StringWriter)2 Bundle (android.os.Bundle)1