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

Commit 62c8f5d7 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

When not provided set viewerConfigInputStreamProvider from viewerConfigFilePath

Otherwise there are cases where we are missing the viewer config in the trace which means we fail to decode the protolog in Winscope.

Flag: EXEMPT bug fix
Bug: 369052956
Test: Capture a protolog trace from Winscope
Change-Id: Ibdb04549b9e427790d83838010a99145cb2bde1e
parent a90ea9c8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -218,6 +218,22 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto
        // NOTE: Registering that datasource is an async operation, so there may be no data traced
        // for some messages logged right after the construction of this class.
        mDataSource.register(params);

        if (viewerConfigInputStreamProvider == null && viewerConfigFilePath != null) {
            viewerConfigInputStreamProvider = new ViewerConfigInputStreamProvider() {
                @NonNull
                @Override
                public ProtoInputStream getInputStream() {
                    try {
                        return new ProtoInputStream(new FileInputStream(viewerConfigFilePath));
                    } catch (FileNotFoundException e) {
                        throw new RuntimeException(
                                "Failed to load viewer config file " + viewerConfigFilePath, e);
                    }
                }
            };
        }

        this.mViewerConfigInputStreamProvider = viewerConfigInputStreamProvider;
        this.mViewerConfigReader = viewerConfigReader;
        this.mCacheUpdater = cacheUpdater;