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

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

Merge "Add logging to help debugging missing viewerConfig issue." into main

parents 2e76423c 3fda9e8e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -480,8 +480,19 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto
        String messageString;
        if (mViewerConfigReader == null) {
            messageString = message.getMessage();

            if (messageString == null) {
                Log.e(LOG_TAG, "Failed to decode message for logcat. "
                        + "Message not available without ViewerConfig to decode the hash.");
            }
        } else {
            messageString = message.getMessage(mViewerConfigReader);

            if (messageString == null) {
                Log.e(LOG_TAG, "Failed to decode message for logcat. "
                        + "Message hash either not available in viewerConfig file or "
                        + "not loaded into memory from file before decoding.");
            }
        }

        if (messageString == null) {
+9 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.internal.protolog.common.ProtoLogToolInjected.Value.LO
import static com.android.internal.protolog.common.ProtoLogToolInjected.Value.VIEWER_CONFIG_PATH;

import android.annotation.Nullable;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.IProtoLog;
@@ -37,6 +38,8 @@ import java.util.TreeMap;
 * A service for the ProtoLog logging system.
 */
public class ProtoLogImpl {
    private static final String LOG_TAG = "ProtoLogImpl";

    private static IProtoLog sServiceInstance = null;

    @ProtoLogToolInjected(VIEWER_CONFIG_PATH)
@@ -97,6 +100,9 @@ public class ProtoLogImpl {
     */
    public static synchronized IProtoLog getSingleInstance() {
        if (sServiceInstance == null) {
            Log.i(LOG_TAG, "Setting up " + ProtoLogImpl.class.getSimpleName() + " with "
                    + "viewerConfigPath = " + sViewerConfigPath);

            final var groups = sLogGroups.values().toArray(new IProtoLogGroup[0]);

            if (android.tracing.Flags.perfettoProtologTracing()) {
@@ -105,6 +111,9 @@ public class ProtoLogImpl {
                    // TODO(b/353530422): Remove - temporary fix to unblock b/352290057
                    // In some tests the viewer config file might not exist in which we don't
                    // want to provide config path to the user
                    Log.w(LOG_TAG, "Failed to find viewerConfigFile when setting up "
                            + ProtoLogImpl.class.getSimpleName() + ". "
                            + "Setting up without a viewer config instead...");
                    sServiceInstance = new PerfettoProtoLogImpl(sCacheUpdater, groups);
                } else {
                    sServiceInstance =