summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pablo Gamito <pablogamito@google.com> 2024-08-28 17:08:00 +0000
committer Pablo Gamito <pablogamito@google.com> 2024-09-02 10:18:04 +0000
commit6c829c74276e6893d18e20bee6ddceee66fddccc (patch)
treeab260978a31fed5515f5acf6909f8c6c73d04508
parent1ec1bba395f3cead409b28314317608b6faa4129 (diff)
Fix missing viewer config dump
Flag: android.tracing.client_side_proto_logging Test: atest InternalTests:com.android.internal.protolog.PerfettoProtoLogImplTest Change-Id: Ib393fd465325fbc00ddab83955124152eaaec9bd
-rw-r--r--core/java/com/android/internal/protolog/ProtoLogConfigurationService.java27
1 files changed, 12 insertions, 15 deletions
diff --git a/core/java/com/android/internal/protolog/ProtoLogConfigurationService.java b/core/java/com/android/internal/protolog/ProtoLogConfigurationService.java
index 27be3559f8ed..eeac1392e4d1 100644
--- a/core/java/com/android/internal/protolog/ProtoLogConfigurationService.java
+++ b/core/java/com/android/internal/protolog/ProtoLogConfigurationService.java
@@ -211,8 +211,7 @@ public final class ProtoLogConfigurationService extends IProtoLogConfigurationSe
* want to write to the trace buffer.
* @throws FileNotFoundException if the viewerConfigFilePath is invalid.
*/
- void trace(@NonNull ProtoLogDataSource dataSource, @NonNull String viewerConfigFilePath)
- throws FileNotFoundException;
+ void trace(@NonNull ProtoLogDataSource dataSource, @NonNull String viewerConfigFilePath);
}
@Override
@@ -352,11 +351,7 @@ public final class ProtoLogConfigurationService extends IProtoLogConfigurationSe
private void onTracingInstanceFlush() {
for (String fileName : mConfigFileCounts.keySet()) {
- try {
- mViewerConfigFileTracer.trace(mDataSource, fileName);
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
- }
+ mViewerConfigFileTracer.trace(mDataSource, fileName);
}
}
@@ -365,10 +360,16 @@ public final class ProtoLogConfigurationService extends IProtoLogConfigurationSe
}
private static void dumpTransitionTraceConfig(@NonNull ProtoLogDataSource dataSource,
- @NonNull String viewerConfigFilePath) throws FileNotFoundException {
- final var pis = new ProtoInputStream(new FileInputStream(viewerConfigFilePath));
-
+ @NonNull String viewerConfigFilePath) {
dataSource.trace(ctx -> {
+ final ProtoInputStream pis;
+ try {
+ pis = new ProtoInputStream(new FileInputStream(viewerConfigFilePath));
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException(
+ "Failed to load viewer config file " + viewerConfigFilePath, e);
+ }
+
try {
final ProtoOutputStream os = ctx.newTracePacket();
@@ -397,11 +398,7 @@ public final class ProtoLogConfigurationService extends IProtoLogConfigurationSe
mConfigFileCounts.put(configFile, newCount);
boolean lastProcessWithViewerConfig = newCount == 0;
if (lastProcessWithViewerConfig) {
- try {
- mViewerConfigFileTracer.trace(mDataSource, configFile);
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
- }
+ mViewerConfigFileTracer.trace(mDataSource, configFile);
}
}
}