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

Commit 3fda9e8e authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Add logging to help debugging missing viewerConfig issue.

Test: n/a
Flag: EXEMPT adding logging
Bug: 364254249
Change-Id: Ica26ccbcb27cb6803777328fced134f0475e3f91
parent c259a67f
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 =