private void attemptUploadWithRetry() { Fabric.m512h() .m474a( CrashlyticsCore.TAG, "Starting report processing in " + this.delay + " second(s)..."); if (this.delay > 0.0f) { try { Thread.sleep((long) (this.delay * 1000.0f)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } CrashlyticsCore instance = CrashlyticsCore.getInstance(); CrashlyticsUncaughtExceptionHandler handler = instance.getHandler(); List<Report> findReports = ReportUploader.this.findReports(); if (!handler.isHandlingException()) { if (findReports.isEmpty() || instance.canSendWithUserApproval()) { List list = findReports; int i = 0; while (!r0.isEmpty() && !CrashlyticsCore.getInstance().getHandler().isHandlingException()) { Fabric.m512h() .m474a(CrashlyticsCore.TAG, "Attempting to send " + r0.size() + " report(s)"); for (Report forceUpload : r0) { ReportUploader.this.forceUpload(forceUpload); } List findReports2 = ReportUploader.this.findReports(); if (findReports2.isEmpty()) { list = findReports2; } else { int i2 = i + 1; long j = (long) ReportUploader.RETRY_INTERVALS[ Math.min(i, ReportUploader.RETRY_INTERVALS.length - 1)]; Fabric.m512h() .m474a( CrashlyticsCore.TAG, "Report submisson: scheduling delayed retry in " + j + " seconds"); try { Thread.sleep(j * 1000); i = i2; list = findReports2; } catch (InterruptedException e2) { Thread.currentThread().interrupt(); return; } } } return; } Fabric.m512h() .m474a( CrashlyticsCore.TAG, "User declined to send. Removing " + findReports.size() + " Report(s)."); for (Report forceUpload2 : findReports) { forceUpload2.remove(); } } }
List<Report> findReports() { Fabric.m512h().m474a(CrashlyticsCore.TAG, "Checking for crash reports..."); synchronized (this.fileAccessLock) { File[] listFiles = CrashlyticsCore.getInstance().getSdkDirectory().listFiles(crashFileFilter); } List<Report> linkedList = new LinkedList(); for (File file : listFiles) { Fabric.m512h().m474a(CrashlyticsCore.TAG, "Found crash report " + file.getPath()); linkedList.add(new SessionReport(file)); } if (linkedList.isEmpty()) { Fabric.m512h().m474a(CrashlyticsCore.TAG, "No reports found."); } return linkedList; }
public void onRun() { try { attemptUploadWithRetry(); } catch (Throwable e) { Fabric.m512h() .m482e( CrashlyticsCore.TAG, "An unexpected error occurred while attempting to upload crash reports.", e); } ReportUploader.this.uploadThread = null; }
boolean forceUpload(Report report) { boolean z = false; synchronized (this.fileAccessLock) { try { boolean invoke = this.createReportCall.invoke( new CreateReportRequest( new ApiKey().m141a(CrashlyticsCore.getInstance().getContext()), report)); Fabric.m512h() .m478c( CrashlyticsCore.TAG, "Crashlytics report upload " + (invoke ? "complete: " : "FAILED: ") + report.getFileName()); if (invoke) { report.remove(); z = true; } } catch (Throwable e) { Fabric.m512h().m482e(CrashlyticsCore.TAG, "Error occurred sending report " + report, e); } } return z; }