/** * 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); } }
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void showDefaultReportActivity(Context context, Throwable th) { String packageName = context.getPackageName(); PackageManager pm = context.getPackageManager(); // Not perfect.. but it'll have to do. ApplicationErrorReport report = new ApplicationErrorReport(); report.installerPackageName = pm.getInstallerPackageName(packageName); report.packageName = packageName; report.processName = packageName; report.time = System.currentTimeMillis(); report.systemApp = false; report.type = ApplicationErrorReport.TYPE_CRASH; report.crashInfo = new ApplicationErrorReport.CrashInfo(th); sAppContext.startActivity(new Intent(Intent.ACTION_APP_ERROR) .setPackage("com.google.android.feedback") .putExtra(Intent.EXTRA_BUG_REPORT, report) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); }
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)); } }
@Override protected List<Item> getItemList() { List<Item> items = new ArrayList<>(); if (BuildConfig.ENG) { items.add(new ActionItem(getString(R.string.dev_item_watch_history)) { @Override protected void onSelected() { getMainActivity().getOverlayManager().showRecentlyWatchedDialog(); } }); } items.add(new ActionItem(getString(R.string.dev_item_send_feedback)) { @Override protected void onSelected() { Intent intent = new Intent(Intent.ACTION_APP_ERROR); ApplicationErrorReport report = new ApplicationErrorReport(); report.packageName = report.processName = getContext().getPackageName(); report.time = System.currentTimeMillis(); report.type = ApplicationErrorReport.TYPE_NONE; intent.putExtra(Intent.EXTRA_BUG_REPORT, report); startActivityForResult(intent, 0); } }); items.add(new SwitchItem(getString(R.string.dev_item_store_ts_on), getString(R.string.dev_item_store_ts_off), getString(R.string.dev_item_store_ts_description)) { @Override protected void onUpdate() { super.onUpdate(); setChecked(TunerPreferences.getStoreTsStream(getContext())); } @Override protected void onSelected() { super.onSelected(); TunerPreferences.setStoreTsStream(getContext(), isChecked()); } }); return items; }
public static void openFeedback(Activity activity) { try { throw new IOException(); } catch (IOException e) { ApplicationErrorReport report = new ApplicationErrorReport(); report.packageName = report.processName = activity.getApplication() .getPackageName(); report.time = System.currentTimeMillis(); report.type = ApplicationErrorReport.TYPE_CRASH; report.systemApp = false; ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo(); crash.exceptionClassName = e.getClass().getSimpleName(); crash.exceptionMessage = e.getMessage(); StringWriter writer = new StringWriter(); PrintWriter printer = new PrintWriter(writer); e.printStackTrace(printer); crash.stackTrace = writer.toString(); StackTraceElement stack = e.getStackTrace()[0]; crash.throwClassName = stack.getClassName(); crash.throwFileName = stack.getFileName(); crash.throwLineNumber = stack.getLineNumber(); crash.throwMethodName = stack.getMethodName(); report.crashInfo = crash; Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.putExtra(Intent.EXTRA_BUG_REPORT, report); activity.startActivity(intent); } }
FeedbackOptions(int paramInt, String paramString1, Bundle paramBundle, String paramString2, ApplicationErrorReport paramApplicationErrorReport, String paramString3, BitmapTeleporter paramBitmapTeleporter, String paramString4, ArrayList<FileTeleporter> paramArrayList, boolean paramBoolean, ThemeSettings paramThemeSettings, LogOptions paramLogOptions) { this.mVersionCode = paramInt; this.mAccountInUse = paramString1; this.mPsdBundle = paramBundle; this.mDescription = paramString2; this.mApplicationErrorReport = paramApplicationErrorReport; this.mCategoryTag = paramString3; this.mBitmapTeleporter = paramBitmapTeleporter; this.mPackageName = paramString4; this.mFileTeleporters = paramArrayList; this.mExcludePii = paramBoolean; this.mThemeSettings = paramThemeSettings; this.mLogOptions = paramLogOptions; }
public final ApplicationErrorReport.CrashInfo getCrashInfo() { if (this.mApplicationErrorReport == null) { return null; } return this.mApplicationErrorReport.crashInfo; }
public FeedbackOptions(int paramInt, String paramString1, Bundle paramBundle, String paramString2, ApplicationErrorReport paramApplicationErrorReport, String paramString3, BitmapTeleporter paramBitmapTeleporter, String paramString4, ArrayList<FileTeleporter> paramArrayList, boolean paramBoolean, ThemeSettings paramThemeSettings, LogOptions paramLogOptions) { this.a = paramInt; this.b = paramString1; this.c = paramBundle; this.d = paramString2; this.e = paramApplicationErrorReport; this.f = paramString3; this.g = paramBitmapTeleporter; this.h = paramString4; this.i = paramArrayList; this.j = paramBoolean; this.k = paramThemeSettings; this.l = paramLogOptions; }
public final ApplicationErrorReport.CrashInfo a() { if (this.e == null) { return null; } return this.e.crashInfo; }
private ApplicationErrorReport getReport() { return null; }
private FeedbackOptions() { this(3, null, null, null, new ApplicationErrorReport(), null, null, null, null, true, null, null); }
ErrorReport(int paramInt1, ApplicationErrorReport paramApplicationErrorReport, String paramString1, int paramInt2, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, String paramString8, int paramInt3, String paramString9, String paramString10, String paramString11, String paramString12, String paramString13, String[] paramArrayOfString1, String[] paramArrayOfString2, String[] paramArrayOfString3, String paramString14, String paramString15, byte[] paramArrayOfByte, int paramInt4, int paramInt5, int paramInt6, int paramInt7, String paramString16, String paramString17, String paramString18, Bundle paramBundle1, boolean paramBoolean1, int paramInt8, int paramInt9, boolean paramBoolean2, String paramString19, String paramString20, int paramInt10, String paramString21, String paramString22, String paramString23, String paramString24, String paramString25, String paramString26, String paramString27, BitmapTeleporter paramBitmapTeleporter, String paramString28, FileTeleporter[] paramArrayOfFileTeleporter, String[] paramArrayOfString4, boolean paramBoolean3, String paramString29, ThemeSettings paramThemeSettings, LogOptions paramLogOptions, String paramString30, boolean paramBoolean4, Bundle paramBundle2, List<RectF> paramList) { this.versionCode = paramInt1; this.applicationErrorReport = paramApplicationErrorReport; this.description = paramString1; this.packageVersion = paramInt2; this.packageVersionName = paramString2; this.device = paramString3; this.buildId = paramString4; this.buildType = paramString5; this.model = paramString6; this.product = paramString7; this.buildFingerprint = paramString8; this.sdk_int = paramInt3; this.release = paramString9; this.incremental = paramString10; this.codename = paramString11; this.board = paramString12; this.brand = paramString13; this.runningApplications = paramArrayOfString1; this.systemLog = paramArrayOfString2; this.eventLog = paramArrayOfString3; this.anrStackTraces = paramString14; this.screenshot = paramString15; this.screenshotBytes = paramArrayOfByte; this.screenshotHeight = paramInt4; this.screenshotWidth = paramInt5; this.phoneType = paramInt6; this.networkType = paramInt7; this.networkName = paramString16; this.account = paramString17; this.localeString = paramString18; this.psdBundle = paramBundle1; this.isSilentSend = paramBoolean1; this.networkMcc = paramInt8; this.networkMnc = paramInt9; this.isCtlAllowed = paramBoolean2; this.exceptionClassName = paramString19; this.throwFileName = paramString20; this.throwLineNumber = paramInt10; this.throwClassName = paramString21; this.throwMethodName = paramString22; this.stackTrace = paramString23; this.exceptionMessage = paramString24; this.categoryTag = paramString25; this.color = paramString26; this.submittingPackageName = paramString27; this.bitmapTeleporter = paramBitmapTeleporter; this.screenshotPath = paramString28; this.fileTeleporterList = paramArrayOfFileTeleporter; this.psdFilePaths = paramArrayOfString4; this.excludePii = paramBoolean3; this.launcher = paramString29; this.themeSettings = paramThemeSettings; this.logOptions = paramLogOptions; this.suggestionSessionId = paramString30; this.suggestionShown = paramBoolean4; this.classificationSignals = paramBundle2; this.highlightBounds = paramList; }
public FeedbackOptions() { this(3, null, null, null, new ApplicationErrorReport(), null, null, null, null, true, null, null); }
public ErrorReport(int paramInt1, ApplicationErrorReport paramApplicationErrorReport, String paramString1, int paramInt2, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, String paramString8, int paramInt3, String paramString9, String paramString10, String paramString11, String paramString12, String paramString13, String[] paramArrayOfString1, String[] paramArrayOfString2, String[] paramArrayOfString3, String paramString14, String paramString15, byte[] paramArrayOfByte, int paramInt4, int paramInt5, int paramInt6, int paramInt7, String paramString16, String paramString17, String paramString18, Bundle paramBundle1, boolean paramBoolean1, int paramInt8, int paramInt9, boolean paramBoolean2, String paramString19, String paramString20, int paramInt10, String paramString21, String paramString22, String paramString23, String paramString24, String paramString25, String paramString26, String paramString27, BitmapTeleporter paramBitmapTeleporter, String paramString28, FileTeleporter[] paramArrayOfFileTeleporter, String[] paramArrayOfString4, boolean paramBoolean3, String paramString29, ThemeSettings paramThemeSettings, LogOptions paramLogOptions, String paramString30, boolean paramBoolean4, Bundle paramBundle2) { this.a = paramInt1; this.b = paramApplicationErrorReport; this.c = paramString1; this.d = paramInt2; this.e = paramString2; this.f = paramString3; this.g = paramString4; this.h = paramString5; this.i = paramString6; this.j = paramString7; this.k = paramString8; this.l = paramInt3; this.m = paramString9; this.n = paramString10; this.o = paramString11; this.p = paramString12; this.q = paramString13; this.r = paramArrayOfString1; this.s = paramArrayOfString2; this.t = paramArrayOfString3; this.u = paramString14; this.v = paramString15; this.w = paramArrayOfByte; this.x = paramInt4; this.y = paramInt5; this.z = paramInt6; this.A = paramInt7; this.B = paramString16; this.C = paramString17; this.D = paramString18; this.E = paramBundle1; this.F = paramBoolean1; this.G = paramInt8; this.H = paramInt9; this.I = paramBoolean2; this.J = paramString19; this.K = paramString20; this.L = paramInt10; this.M = paramString21; this.N = paramString22; this.O = paramString23; this.P = paramString24; this.Q = paramString25; this.R = paramString26; this.S = paramString27; this.T = paramBitmapTeleporter; this.U = paramString28; this.V = paramArrayOfFileTeleporter; this.W = paramArrayOfString4; this.X = paramBoolean3; this.Y = paramString29; this.Z = paramThemeSettings; this.aa = paramLogOptions; this.ab = paramString30; this.ac = paramBoolean4; this.ad = paramBundle2; }
public evk() { this.h.crashInfo = new ApplicationErrorReport.CrashInfo(); this.h.crashInfo.throwLineNumber = -1; }
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void reportToPlayStore(Context c) { if (currentCrashInfo == null || currentException == null) { return; } ApplicationErrorReport applicationErrorReport = new ApplicationErrorReport(); applicationErrorReport.packageName = this.context.getPackageName(); applicationErrorReport.processName = this.context.getPackageName(); applicationErrorReport.time = System.currentTimeMillis(); applicationErrorReport.systemApp = false; /////////// // CRASH // /////////// applicationErrorReport.type = ApplicationErrorReport.TYPE_CRASH; ApplicationErrorReport.CrashInfo crashInfo = new ApplicationErrorReport.CrashInfo(); crashInfo.exceptionClassName = currentException.getClass().getSimpleName(); crashInfo.exceptionMessage = currentException.getMessage(); crashInfo.stackTrace = currentCrashInfo.toString() + " - " +Utils.getStackTrace(currentException); StackTraceElement stackTraceElement = currentException.getStackTrace()[0]; crashInfo.throwClassName = stackTraceElement.getClassName(); crashInfo.throwFileName = stackTraceElement.getFileName(); crashInfo.throwMethodName = stackTraceElement.getMethodName(); crashInfo.throwLineNumber = stackTraceElement.getLineNumber(); applicationErrorReport.crashInfo = crashInfo; Intent i = new Intent(Intent.ACTION_APP_ERROR); i.putExtra(Intent.EXTRA_BUG_REPORT, applicationErrorReport); if (!(c instanceof Activity)) { i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } // Force "Send feedback choice", but still needs user acknowledgement i.setClassName("com.google.android.feedback", "com.google.android.feedback.FeedbackActivity"); c.startActivity(i); currentCrashInfo = null; currentException = null; }