(Throwable ex, final Context context)
| 691 | } |
| 692 | |
| 693 | public static void sendCrashReport(Throwable ex, final Context context) { |
| 694 | if (!isPlayStoreInstall(context) || Util.isDebuggable(context)) |
| 695 | return; |
| 696 | |
| 697 | try { |
| 698 | ApplicationErrorReport report = new ApplicationErrorReport(); |
| 699 | report.packageName = report.processName = context.getPackageName(); |
| 700 | report.time = System.currentTimeMillis(); |
| 701 | report.type = ApplicationErrorReport.TYPE_CRASH; |
| 702 | report.systemApp = false; |
| 703 | |
| 704 | ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo(); |
| 705 | crash.exceptionClassName = ex.getClass().getSimpleName(); |
| 706 | crash.exceptionMessage = ex.getMessage(); |
| 707 | |
| 708 | StringWriter writer = new StringWriter(); |
| 709 | PrintWriter printer = new PrintWriter(writer); |
| 710 | ex.printStackTrace(printer); |
| 711 | |
| 712 | crash.stackTrace = writer.toString(); |
| 713 | |
| 714 | StackTraceElement stack = ex.getStackTrace()[0]; |
| 715 | crash.throwClassName = stack.getClassName(); |
| 716 | crash.throwFileName = stack.getFileName(); |
| 717 | crash.throwLineNumber = stack.getLineNumber(); |
| 718 | crash.throwMethodName = stack.getMethodName(); |
| 719 | |
| 720 | report.crashInfo = crash; |
| 721 | |
| 722 | final Intent bug = new Intent(Intent.ACTION_APP_ERROR); |
| 723 | bug.putExtra(Intent.EXTRA_BUG_REPORT, report); |
| 724 | bug.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 725 | if (bug.resolveActivity(context.getPackageManager()) != null) |
| 726 | context.startActivity(bug); |
| 727 | } catch (Throwable exex) { |
| 728 | Log.e(TAG, exex.toString() + "\n" + Log.getStackTraceString(exex)); |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | public static String getGeneralInfo(Context context) { |
| 733 | StringBuilder sb = new StringBuilder(); |
nothing calls this directly
no test coverage detected