Loading core/java/android/content/Context.java +4 −3 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ import android.window.WindowContext; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.compat.IPlatformCompat; import com.android.internal.compat.IPlatformCompatNative; import com.android.internal.protolog.ProtoLogConfigurationService; import java.io.File; import java.io.FileInputStream; Loading Loading @@ -6701,13 +6702,13 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve the * {@link com.android.internal.protolog.ProtoLogService} for registering ProtoLog clients. * {@link ProtoLogConfigurationService} for registering ProtoLog clients. * * @see #getSystemService(String) * @see com.android.internal.protolog.ProtoLogService * @see ProtoLogConfigurationService * @hide */ public static final String PROTOLOG_SERVICE = "protolog"; public static final String PROTOLOG_CONFIGURATION_SERVICE = "protolog_configuration"; /** * Determine whether the given permission is allowed for a particular Loading core/java/com/android/internal/protolog/IProtoLogClient.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package com.android.internal.protolog; * The ProtoLog client interface. * * These clients will communicate bi-directionally with the ProtoLog service * (@see IProtoLogService.aidl) running in the system process. * (@see IProtoLogConfigurationService.aidl) running in the system process. * * {@hide} */ Loading core/java/com/android/internal/protolog/IProtoLogService.aidl→core/java/com/android/internal/protolog/IProtoLogConfigurationService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import com.android.internal.protolog.IProtoLogClient; * * {@hide} */ interface IProtoLogService { interface IProtoLogConfigurationService { interface IRegisterClientArgs { String[] getGroups(); boolean[] getGroupsDefaultLogcatStatus(); Loading core/java/com/android/internal/protolog/PerfettoProtoLogImpl.java +13 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.internal.protolog; import static android.content.Context.PROTOLOG_SERVICE; import static android.content.Context.PROTOLOG_CONFIGURATION_SERVICE; import static android.internal.perfetto.protos.InternedDataOuterClass.InternedData.PROTOLOG_STACKTRACE; import static android.internal.perfetto.protos.InternedDataOuterClass.InternedData.PROTOLOG_STRING_ARGS; import static android.internal.perfetto.protos.ProfileCommon.InternedString.IID; Loading Loading @@ -114,7 +114,7 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto private final Runnable mCacheUpdater; @Nullable // null when the flag android.tracing.client_side_proto_logging is not flipped private final IProtoLogService mProtoLogService; private final IProtoLogConfigurationService mProtoLogConfigurationService; @NonNull private final int[] mDefaultLogLevelCounts = new int[LogLevel.values().length]; Loading Loading @@ -186,30 +186,32 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto registerGroupsLocally(groups); if (android.tracing.Flags.clientSideProtoLogging()) { mProtoLogService = IProtoLogService.Stub.asInterface(ServiceManager.getService(PROTOLOG_SERVICE)); Objects.requireNonNull(mProtoLogService, mProtoLogConfigurationService = IProtoLogConfigurationService.Stub.asInterface(ServiceManager.getService( PROTOLOG_CONFIGURATION_SERVICE)); Objects.requireNonNull(mProtoLogConfigurationService, "ServiceManager returned a null ProtoLog service"); try { var args = new ProtoLogService.RegisterClientArgs(); var args = new ProtoLogConfigurationService.RegisterClientArgs(); if (viewerConfigFilePath != null) { args.setViewerConfigFile(viewerConfigFilePath); } final var groupArgs = Stream.of(groups) .map(group -> new ProtoLogService.RegisterClientArgs.GroupConfig( group.name(), group.isLogToLogcat())) .toArray(ProtoLogService.RegisterClientArgs.GroupConfig[]::new); .map(group -> new ProtoLogConfigurationService.RegisterClientArgs .GroupConfig(group.name(), group.isLogToLogcat())) .toArray( ProtoLogConfigurationService.RegisterClientArgs.GroupConfig[]::new); args.setGroups(groupArgs); mProtoLogService.registerClient(this, args); mProtoLogConfigurationService.registerClient(this, args); } catch (RemoteException e) { throw new RuntimeException("Failed to register ProtoLog client"); } } else { mProtoLogService = null; mProtoLogConfigurationService = null; } } Loading core/java/com/android/internal/protolog/ProtoLogCommandHandler.java +14 −11 Original line number Diff line number Diff line Loading @@ -29,18 +29,20 @@ import java.util.Set; public class ProtoLogCommandHandler extends ShellCommand { @NonNull private final ProtoLogService mProtoLogService; private final ProtoLogConfigurationService mProtoLogConfigurationService; @Nullable private final PrintWriter mPrintWriter; public ProtoLogCommandHandler(@NonNull ProtoLogService protoLogService) { this(protoLogService, null); public ProtoLogCommandHandler( @NonNull ProtoLogConfigurationService protoLogConfigurationService) { this(protoLogConfigurationService, null); } @VisibleForTesting public ProtoLogCommandHandler( @NonNull ProtoLogService protoLogService, @Nullable PrintWriter printWriter) { this.mProtoLogService = protoLogService; @NonNull ProtoLogConfigurationService protoLogConfigurationService, @Nullable PrintWriter printWriter) { this.mProtoLogConfigurationService = protoLogConfigurationService; this.mPrintWriter = printWriter; } Loading Loading @@ -94,7 +96,7 @@ public class ProtoLogCommandHandler extends ShellCommand { switch (cmd) { case "list": { final String[] availableGroups = mProtoLogService.getGroups(); final String[] availableGroups = mProtoLogConfigurationService.getGroups(); if (availableGroups.length == 0) { pw.println("No ProtoLog groups registered with ProtoLog service."); return 0; Loading @@ -117,12 +119,13 @@ public class ProtoLogCommandHandler extends ShellCommand { pw.println("ProtoLog group " + group + "'s status:"); if (!Set.of(mProtoLogService.getGroups()).contains(group)) { if (!Set.of(mProtoLogConfigurationService.getGroups()).contains(group)) { pw.println("UNREGISTERED"); return 0; } pw.println("LOG_TO_LOGCAT = " + mProtoLogService.isLoggingToLogcat(group)); pw.println("LOG_TO_LOGCAT = " + mProtoLogConfigurationService.isLoggingToLogcat(group)); return 0; } default: { Loading @@ -142,11 +145,11 @@ public class ProtoLogCommandHandler extends ShellCommand { switch (cmd) { case "enable" -> { mProtoLogService.enableProtoLogToLogcat(processGroups()); mProtoLogConfigurationService.enableProtoLogToLogcat(processGroups()); return 0; } case "disable" -> { mProtoLogService.disableProtoLogToLogcat(processGroups()); mProtoLogConfigurationService.disableProtoLogToLogcat(processGroups()); return 0; } default -> { Loading @@ -159,7 +162,7 @@ public class ProtoLogCommandHandler extends ShellCommand { @NonNull private String[] processGroups() { if (getRemainingArgsCount() == 0) { return mProtoLogService.getGroups(); return mProtoLogConfigurationService.getGroups(); } final List<String> groups = new ArrayList<>(); Loading Loading
core/java/android/content/Context.java +4 −3 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ import android.window.WindowContext; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.compat.IPlatformCompat; import com.android.internal.compat.IPlatformCompatNative; import com.android.internal.protolog.ProtoLogConfigurationService; import java.io.File; import java.io.FileInputStream; Loading Loading @@ -6701,13 +6702,13 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve the * {@link com.android.internal.protolog.ProtoLogService} for registering ProtoLog clients. * {@link ProtoLogConfigurationService} for registering ProtoLog clients. * * @see #getSystemService(String) * @see com.android.internal.protolog.ProtoLogService * @see ProtoLogConfigurationService * @hide */ public static final String PROTOLOG_SERVICE = "protolog"; public static final String PROTOLOG_CONFIGURATION_SERVICE = "protolog_configuration"; /** * Determine whether the given permission is allowed for a particular Loading
core/java/com/android/internal/protolog/IProtoLogClient.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package com.android.internal.protolog; * The ProtoLog client interface. * * These clients will communicate bi-directionally with the ProtoLog service * (@see IProtoLogService.aidl) running in the system process. * (@see IProtoLogConfigurationService.aidl) running in the system process. * * {@hide} */ Loading
core/java/com/android/internal/protolog/IProtoLogService.aidl→core/java/com/android/internal/protolog/IProtoLogConfigurationService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import com.android.internal.protolog.IProtoLogClient; * * {@hide} */ interface IProtoLogService { interface IProtoLogConfigurationService { interface IRegisterClientArgs { String[] getGroups(); boolean[] getGroupsDefaultLogcatStatus(); Loading
core/java/com/android/internal/protolog/PerfettoProtoLogImpl.java +13 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.internal.protolog; import static android.content.Context.PROTOLOG_SERVICE; import static android.content.Context.PROTOLOG_CONFIGURATION_SERVICE; import static android.internal.perfetto.protos.InternedDataOuterClass.InternedData.PROTOLOG_STACKTRACE; import static android.internal.perfetto.protos.InternedDataOuterClass.InternedData.PROTOLOG_STRING_ARGS; import static android.internal.perfetto.protos.ProfileCommon.InternedString.IID; Loading Loading @@ -114,7 +114,7 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto private final Runnable mCacheUpdater; @Nullable // null when the flag android.tracing.client_side_proto_logging is not flipped private final IProtoLogService mProtoLogService; private final IProtoLogConfigurationService mProtoLogConfigurationService; @NonNull private final int[] mDefaultLogLevelCounts = new int[LogLevel.values().length]; Loading Loading @@ -186,30 +186,32 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto registerGroupsLocally(groups); if (android.tracing.Flags.clientSideProtoLogging()) { mProtoLogService = IProtoLogService.Stub.asInterface(ServiceManager.getService(PROTOLOG_SERVICE)); Objects.requireNonNull(mProtoLogService, mProtoLogConfigurationService = IProtoLogConfigurationService.Stub.asInterface(ServiceManager.getService( PROTOLOG_CONFIGURATION_SERVICE)); Objects.requireNonNull(mProtoLogConfigurationService, "ServiceManager returned a null ProtoLog service"); try { var args = new ProtoLogService.RegisterClientArgs(); var args = new ProtoLogConfigurationService.RegisterClientArgs(); if (viewerConfigFilePath != null) { args.setViewerConfigFile(viewerConfigFilePath); } final var groupArgs = Stream.of(groups) .map(group -> new ProtoLogService.RegisterClientArgs.GroupConfig( group.name(), group.isLogToLogcat())) .toArray(ProtoLogService.RegisterClientArgs.GroupConfig[]::new); .map(group -> new ProtoLogConfigurationService.RegisterClientArgs .GroupConfig(group.name(), group.isLogToLogcat())) .toArray( ProtoLogConfigurationService.RegisterClientArgs.GroupConfig[]::new); args.setGroups(groupArgs); mProtoLogService.registerClient(this, args); mProtoLogConfigurationService.registerClient(this, args); } catch (RemoteException e) { throw new RuntimeException("Failed to register ProtoLog client"); } } else { mProtoLogService = null; mProtoLogConfigurationService = null; } } Loading
core/java/com/android/internal/protolog/ProtoLogCommandHandler.java +14 −11 Original line number Diff line number Diff line Loading @@ -29,18 +29,20 @@ import java.util.Set; public class ProtoLogCommandHandler extends ShellCommand { @NonNull private final ProtoLogService mProtoLogService; private final ProtoLogConfigurationService mProtoLogConfigurationService; @Nullable private final PrintWriter mPrintWriter; public ProtoLogCommandHandler(@NonNull ProtoLogService protoLogService) { this(protoLogService, null); public ProtoLogCommandHandler( @NonNull ProtoLogConfigurationService protoLogConfigurationService) { this(protoLogConfigurationService, null); } @VisibleForTesting public ProtoLogCommandHandler( @NonNull ProtoLogService protoLogService, @Nullable PrintWriter printWriter) { this.mProtoLogService = protoLogService; @NonNull ProtoLogConfigurationService protoLogConfigurationService, @Nullable PrintWriter printWriter) { this.mProtoLogConfigurationService = protoLogConfigurationService; this.mPrintWriter = printWriter; } Loading Loading @@ -94,7 +96,7 @@ public class ProtoLogCommandHandler extends ShellCommand { switch (cmd) { case "list": { final String[] availableGroups = mProtoLogService.getGroups(); final String[] availableGroups = mProtoLogConfigurationService.getGroups(); if (availableGroups.length == 0) { pw.println("No ProtoLog groups registered with ProtoLog service."); return 0; Loading @@ -117,12 +119,13 @@ public class ProtoLogCommandHandler extends ShellCommand { pw.println("ProtoLog group " + group + "'s status:"); if (!Set.of(mProtoLogService.getGroups()).contains(group)) { if (!Set.of(mProtoLogConfigurationService.getGroups()).contains(group)) { pw.println("UNREGISTERED"); return 0; } pw.println("LOG_TO_LOGCAT = " + mProtoLogService.isLoggingToLogcat(group)); pw.println("LOG_TO_LOGCAT = " + mProtoLogConfigurationService.isLoggingToLogcat(group)); return 0; } default: { Loading @@ -142,11 +145,11 @@ public class ProtoLogCommandHandler extends ShellCommand { switch (cmd) { case "enable" -> { mProtoLogService.enableProtoLogToLogcat(processGroups()); mProtoLogConfigurationService.enableProtoLogToLogcat(processGroups()); return 0; } case "disable" -> { mProtoLogService.disableProtoLogToLogcat(processGroups()); mProtoLogConfigurationService.disableProtoLogToLogcat(processGroups()); return 0; } default -> { Loading @@ -159,7 +162,7 @@ public class ProtoLogCommandHandler extends ShellCommand { @NonNull private String[] processGroups() { if (getRemainingArgsCount() == 0) { return mProtoLogService.getGroups(); return mProtoLogConfigurationService.getGroups(); } final List<String> groups = new ArrayList<>(); Loading