Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bc73d91 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Use single thread ExecutorService to process ProtoLogging

We were using a CachedThreadPool which has no upper bound on the number of threads. So if we traced a lot in a fast succession we could end up with too many thread for Perfetto to handle.

Bug: 337222696
Test: Make sure atest com.android.server.wm.flicker.launch can finish without crashing
Change-Id: I837960abcd7c159855b0da9dee709fe06a452357
parent 731423a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -99,7 +99,7 @@ public class PerfettoProtoLogImpl implements IProtoLog {
    private final Map<LogLevel, Integer> mDefaultLogLevelCounts = new ArrayMap<>();
    private final Map<LogLevel, Integer> mDefaultLogLevelCounts = new ArrayMap<>();
    private final Map<IProtoLogGroup, Map<LogLevel, Integer>> mLogLevelCounts = new ArrayMap<>();
    private final Map<IProtoLogGroup, Map<LogLevel, Integer>> mLogLevelCounts = new ArrayMap<>();


    private final ExecutorService mBackgroundLoggingService = Executors.newCachedThreadPool();
    private final ExecutorService mBackgroundLoggingService = Executors.newSingleThreadExecutor();


    public PerfettoProtoLogImpl(String viewerConfigFilePath,
    public PerfettoProtoLogImpl(String viewerConfigFilePath,
            TreeMap<String, IProtoLogGroup> logGroups, Runnable cacheUpdater) {
            TreeMap<String, IProtoLogGroup> logGroups, Runnable cacheUpdater) {