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

Commit 81faef45 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Load viewer configs of groups that have logToLogcat enabled on registration" into main

parents b5882919 27e9829a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
@@ -423,6 +424,14 @@ public class LegacyProtoLogImpl implements IProtoLog {
        for (IProtoLogGroup group : protoLogGroups) {
            mLogGroups.put(group.name(), group);
        }

        final var hasGroupsLoggingToLogcat = Arrays.stream(protoLogGroups)
                .anyMatch(IProtoLogGroup::isLogToLogcat);

        final ILogger logger = (msg) -> Slog.i(TAG, msg);
        if (hasGroupsLoggingToLogcat) {
            mViewerConfig.loadViewerConfig(logger, mLegacyViewerConfigFilename);
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -214,6 +214,13 @@ public class LegacyProtoLogImplTest {
        verify(mReader, never()).getViewerString(anyLong());
    }

    @Test
    public void loadViewerConfigOnLogcatGroupRegistration() {
        TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true);
        mProtoLog.registerGroups(TestProtoLogGroup.TEST_GROUP);
        verify(mReader).loadViewerConfig(any(), any());
    }

    private static class ProtoLogData {
        Long mMessageHash = null;
        Long mElapsedTime = null;