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; }
void startAppProblemLocked(ProcessRecord app) { // If this app is not running under the current user, then we // can't give it a report button because that would require // launching the report UI under a different user. app.errorReportReceiver = null; for (int userId : mService.mUserController.getCurrentProfileIdsLocked()) { if (app.userId == userId) { app.errorReportReceiver = ApplicationErrorReport.getErrorReportReceiver( mContext, app.info.packageName, app.info.flags); } } mService.skipCurrentReceiverLocked(app); }