Add UI for prompting about crashes.

This commit is contained in:
Greyson Parrelli
2023-09-06 15:05:23 -04:00
committed by Alex Hart
parent 0a6c3baf24
commit f959543c19
23 changed files with 1089 additions and 182 deletions

View File

@@ -21,7 +21,7 @@ class LogDataSource(
val logDatabase = LogDatabase.getInstance(application)
override fun size(): Int {
return prefixLines.size + logDatabase.getLogCountBeforeTime(untilTime)
return prefixLines.size + logDatabase.logs.getLogCountBeforeTime(untilTime)
}
override fun load(start: Int, length: Int, totalSize: Int, cancellationSignal: PagedDataSource.CancellationSignal): List<LogLine> {
@@ -29,9 +29,9 @@ class LogDataSource(
return prefixLines.subList(start, start + length)
} else if (start < prefixLines.size) {
return prefixLines.subList(start, prefixLines.size) +
logDatabase.getRangeBeforeTime(0, length - (prefixLines.size - start), untilTime).map { convertToLogLine(it) }
logDatabase.logs.getRangeBeforeTime(0, length - (prefixLines.size - start), untilTime).map { convertToLogLine(it) }
} else {
return logDatabase.getRangeBeforeTime(start - prefixLines.size, length, untilTime).map { convertToLogLine(it) }
return logDatabase.logs.getRangeBeforeTime(start - prefixLines.size, length, untilTime).map { convertToLogLine(it) }
}
}

View File

@@ -116,7 +116,7 @@ public class SubmitDebugLogRepository {
public void buildAndSubmitLog(@NonNull Callback<Optional<String>> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
Log.blockUntilAllWritesFinished();
LogDatabase.getInstance(context).trimToSize();
LogDatabase.getInstance(context).logs().trimToSize();
callback.onResult(submitLogInternal(System.currentTimeMillis(), getPrefixLogLinesInternal(), Tracer.getInstance().serialize()));
});
}
@@ -140,7 +140,7 @@ public class SubmitDebugLogRepository {
outputStream.putNextEntry(new ZipEntry("log.txt"));
outputStream.write(prefixLines.toString().getBytes(StandardCharsets.UTF_8));
try (LogDatabase.Reader reader = LogDatabase.getInstance(context).getAllBeforeTime(untilTime)) {
try (LogDatabase.LogTable.Reader reader = LogDatabase.getInstance(context).logs().getAllBeforeTime(untilTime)) {
while (reader.hasNext()) {
outputStream.write(reader.next().getBytes());
outputStream.write("\n".getBytes());
@@ -193,7 +193,7 @@ public class SubmitDebugLogRepository {
stopwatch.split("front-matter");
try (LogDatabase.Reader reader = LogDatabase.getInstance(context).getAllBeforeTime(untilTime)) {
try (LogDatabase.LogTable.Reader reader = LogDatabase.getInstance(context).logs().getAllBeforeTime(untilTime)) {
while (reader.hasNext()) {
gzipOutput.write(reader.next().getBytes());
gzipOutput.write("\n".getBytes());

View File

@@ -54,7 +54,7 @@ public class SubmitDebugLogViewModel extends ViewModel {
this.staticLines.addAll(staticLines);
Log.blockUntilAllWritesFinished();
LogDatabase.getInstance(ApplicationDependencies.getApplication()).trimToSize();
LogDatabase.getInstance(ApplicationDependencies.getApplication()).logs().trimToSize();
LogDataSource dataSource = new LogDataSource(ApplicationDependencies.getApplication(), staticLines, firstViewTime);
PagingConfig config = new PagingConfig.Builder().setPageSize(100)