From 9fb85f7c76b493117c9e7ed4f8f190dae35db115 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Mon, 26 Oct 2020 11:07:44 -0400 Subject: [PATCH] Build log sections in series. Doing them in parallel was causing possible bad blocked thread reports, since the thread section could be built at the same time we were building the jobs section. --- .../logsubmit/SubmitDebugLogRepository.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/logsubmit/SubmitDebugLogRepository.java b/app/src/main/java/org/thoughtcrime/securesms/logsubmit/SubmitDebugLogRepository.java index 9f57d2e99c..41520f03ef 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/logsubmit/SubmitDebugLogRepository.java +++ b/app/src/main/java/org/thoughtcrime/securesms/logsubmit/SubmitDebugLogRepository.java @@ -22,9 +22,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; import java.util.regex.Pattern; import okhttp3.MediaType; @@ -59,10 +57,10 @@ public class SubmitDebugLogRepository { add(new LogSectionPower()); } add(new LogSectionPin()); - add(new LogSectionThreads()); add(new LogSectionCapabilities()); add(new LogSectionFeatureFlags()); add(new LogSectionPermissions()); + add(new LogSectionThreads()); add(new LogSectionLogcat()); add(new LogSectionLogger()); }}; @@ -134,30 +132,18 @@ public class SubmitDebugLogRepository { int maxTitleLength = Stream.of(SECTIONS).reduce(0, (max, section) -> Math.max(max, section.getTitle().length())); - List>> futures = new ArrayList<>(); - - for (LogSection section : SECTIONS) { - futures.add(SignalExecutors.BOUNDED.submit(() -> { - List lines = getLinesForSection(context, section, maxTitleLength); - - if (SECTIONS.indexOf(section) != SECTIONS.size() - 1) { - for (int i = 0; i < SECTION_SPACING; i++) { - lines.add(SimpleLogLine.EMPTY); - } - } - - return lines; - })); - } - List allLines = new ArrayList<>(); - for (Future> future : futures) { - try { - allLines.addAll(future.get()); - } catch (ExecutionException | InterruptedException e) { - throw new AssertionError(e); + for (LogSection section : SECTIONS) { + List lines = getLinesForSection(context, section, maxTitleLength); + + if (SECTIONS.indexOf(section) != SECTIONS.size() - 1) { + for (int i = 0; i < SECTION_SPACING; i++) { + lines.add(SimpleLogLine.EMPTY); + } } + + allLines.addAll(lines); } List withIds = new ArrayList<>(allLines.size());