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

Commit 0af628a1 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Add ProtoLog service & client aidl interfaces

Test: n/a
Flag: EXEMPT adding interfaces
Change-Id: Ic1346b7c3ac1ccce18ebdc472d8c8563cc1fa75c
parent b8357d89
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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.
 *
 * {@hide}
 */
interface IProtoLogClient {
    void toggleLogcat(boolean enabled, in String[] groups);
}
 No newline at end of file
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.protolog;

import com.android.internal.protolog.IProtoLogClient;

/**
 * The ProtoLog Service interface.
 *
 * This service runs in system server.
 *
 * All ProtoLog clients (in theory one per process) will register themselves to this service.
 * This service will then serve as the entry point for any shell command based interactions with
 * protolog and get/forward any required information/actions from/to all the registered ProtoLog
 * clients.
 *
 * Clients will be responsible for directly sending all their trace data to Perfetto without passing
 * through this service, except viewer config data, the mappings from messages hashes (generated by
 * the ProtoLog Tool if and when the tool processed the source code). So, this service is
 * responsible for dumping the viewer config data from all clients. The reason for this is because
 * we do this on Perfetto's onFlush callback when a tracing instance is stopped. However, if a
 * client process is frozen then this will not dump; system server, where this service runs cannot
 * be frozen. Secondly many processes (i.e. apps) will run the same code with the same viewer config
 * data, so this service allows us to orchestrate which config gets dumped so we don't duplicate
 * this information in the trace and waste valuable trace space.
 *
 * {@hide}
 */
interface IProtoLogService {
    interface IRegisterClientArgs {
        String[] getGroups();
        boolean[] getGroupsDefaultLogcatStatus();
        String getViewerConfigFile();
    }

    void registerClient(IProtoLogClient client, IRegisterClientArgs args);
}
 No newline at end of file