blob: fb39dace8765b69f4bb36d7bb7f9d52be9056914 [file]
/*
* Copyright (C) 2026 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 {
default_applicable_licenses: ["frameworks_native_license"],
}
// Native TrackEvent extensions. Bundles source schemas for offline runtime packaging.
filegroup {
name: "frameworks-native-tracing-protos",
srcs: [
"frameworks_native_tracing_protos.json",
"frameworks_native_track_event.proto",
"frameworks_native_trace_packet.proto",
"frameworks_native_interned_data.proto",
],
}
filegroup {
name: "frameworks-native-tracing-interned-data-proto",
srcs: ["frameworks_native_interned_data.proto"],
}
// Shared leaf protos used by both native- and base-owned winscope schemas.
filegroup {
name: "frameworks-native-tracing-winscope-common-protos",
srcs: [
"winscope/common/corner_radii.proto",
"winscope/common/rect.proto",
"winscope/common/typedef.proto",
],
}
// All native-owned winscope schemas (incl. the TracePacket-extension wrapper and protolog).
filegroup {
name: "frameworks-native-tracing-winscope-protos",
srcs: [
"winscope/android_input_event.proto",
":frameworks-native-tracing-winscope-common-protos",
"winscope/frameworks_native_winscope.proto",
"winscope/surfaceflinger_common.proto",
"winscope/surfaceflinger_layers.proto",
"winscope/surfaceflinger_transactions.proto",
"winscope/protolog.proto",
],
}
// Message-only subset (excludes only the wrapper protos, which import perfetto's
// trace_packet.proto and pull in the whole perfetto closure).
filegroup {
name: "frameworks-native-tracing-winscope-message-protos",
srcs: [
"winscope/android_input_event.proto",
":frameworks-native-tracing-winscope-common-protos",
"winscope/surfaceflinger_common.proto",
"winscope/surfaceflinger_layers.proto",
"winscope/surfaceflinger_transactions.proto",
"winscope/protolog.proto",
],
}
genrule {
name: "frameworks-native-track-event-pzc-h-gen",
tools: [
"protozero_c_plugin",
"aprotoc",
],
srcs: [
"frameworks_native_track_event.proto",
":perfetto_protos_perfetto_trace_track_event_cpp",
],
out: ["android/tracing/frameworks_native_track_event.pzc.h"],
cmd: "mkdir -p $(genDir)/android/tracing && " +
"$(location aprotoc) " +
" --plugin=protoc-gen-plugin=$(location protozero_c_plugin) " +
" --plugin_out=guard_strip_prefix=FRAMEWORKS_NATIVE_,guard_add_prefix=ANDROID_TRACING_FRAMEWORKS_NATIVE_,path_strip_prefix=protos/perfetto,path_add_prefix=perfetto/public/protos:$(genDir)/android/tracing " +
" --proto_path=external/perfetto " +
" --proto_path=frameworks/native/tracing " +
" frameworks_native_track_event.proto",
}
genrule {
name: "frameworks-native-interned-data-pzc-h-gen",
tools: [
"protozero_c_plugin",
"aprotoc",
],
srcs: [
"frameworks_native_interned_data.proto",
"//external/perfetto:perfetto_protos_perfetto_trace_non_minimal_protos",
],
out: ["android/tracing/frameworks_native_interned_data.pzc.h"],
cmd: "mkdir -p $(genDir)/android/tracing && " +
"$(location aprotoc) " +
" --plugin=protoc-gen-plugin=$(location protozero_c_plugin) " +
" --plugin_out=guard_strip_prefix=FRAMEWORKS_NATIVE_,guard_add_prefix=ANDROID_TRACING_FRAMEWORKS_NATIVE_,path_strip_prefix=protos/perfetto/trace/profiling,path_add_prefix=protos/trace/profiling,path_strip_prefix_external=protos/perfetto,path_add_prefix_external=perfetto/public/protos:$(genDir)/android/tracing " +
" --proto_path=external/perfetto " +
" --proto_path=frameworks/native/tracing " +
" frameworks_native_interned_data.proto",
}
genrule {
name: "frameworks-native-tracing-winscope-pzc-h-gen",
tools: [
"protozero_c_plugin",
"aprotoc",
],
srcs: [
":frameworks-native-tracing-winscope-protos",
":frameworks-native-tracing-winscope-common-protos",
":libprotobuf-internal-protos",
"//external/perfetto:perfetto_protos_perfetto_trace_non_minimal_protos",
],
out: [
"android/tracing/winscope/android_input_event.pzc.h",
"android/tracing/winscope/common/corner_radii.pzc.h",
"android/tracing/winscope/common/rect.pzc.h",
"android/tracing/winscope/common/typedef.pzc.h",
"android/tracing/winscope/frameworks_native_winscope.pzc.h",
"android/tracing/winscope/protolog.pzc.h",
"android/tracing/winscope/surfaceflinger_common.pzc.h",
"android/tracing/winscope/surfaceflinger_layers.pzc.h",
"android/tracing/winscope/surfaceflinger_transactions.pzc.h",
],
// The C plugin outputs headers into $(genDir)/frameworks/native/tracing/winscope/
// matching the input's tree path. We copy these into the stable curated include path
// android/tracing/winscope/. A recursive copy is used because the build sandbox
// pre-creates output subdirectories, which prevents using 'mv' directly (mv would nest).
cmd: "mkdir -p $(genDir)/android/tracing && " +
"$(location aprotoc) " +
" --plugin=protoc-gen-plugin=$(location protozero_c_plugin) " +
" --plugin_out=guard_strip_prefix=FRAMEWORKS_NATIVE_TRACING_WINSCOPE_,guard_add_prefix=ANDROID_TRACING_FRAMEWORKS_NATIVE_,path_strip_prefix=frameworks/native/tracing/winscope,path_add_prefix=android/tracing/winscope,path_strip_prefix_external=protos/perfetto,path_add_prefix_external=perfetto/public/protos:$(genDir) " +
" --proto_path=external/protobuf/src " +
" --proto_path=external/perfetto " +
" --proto_path=. " +
" $(locations :frameworks-native-tracing-winscope-protos) && " +
"cp -r $(genDir)/frameworks/native/tracing/winscope/. $(genDir)/android/tracing/winscope/ && " +
"rm -rf $(genDir)/frameworks",
}
genrule {
name: "frameworks-native-tracing-winscope-pbzero-h-gen",
tools: [
"protozero_plugin",
"aprotoc",
],
srcs: [
":frameworks-native-tracing-winscope-protos",
":frameworks-native-tracing-winscope-common-protos",
":libprotobuf-internal-protos",
"//external/perfetto:perfetto_protos_perfetto_trace_non_minimal_protos",
],
out: [
"android/tracing/winscope/android_input_event.pbzero.h",
"android/tracing/winscope/common/corner_radii.pbzero.h",
"android/tracing/winscope/common/rect.pbzero.h",
"android/tracing/winscope/common/typedef.pbzero.h",
"android/tracing/winscope/frameworks_native_winscope.pbzero.h",
"android/tracing/winscope/protolog.pbzero.h",
"android/tracing/winscope/surfaceflinger_common.pbzero.h",
"android/tracing/winscope/surfaceflinger_layers.pbzero.h",
"android/tracing/winscope/surfaceflinger_transactions.pbzero.h",
],
// The C++ plugin outputs headers into $(genDir)/frameworks/native/tracing/winscope/
// matching the input's tree path. We copy these into the stable curated include path
// android/tracing/winscope/. A recursive copy is used because the build sandbox
// pre-creates output subdirectories, which prevents using 'mv' directly (mv would nest).
cmd: "mkdir -p $(genDir)/android/tracing && " +
"$(location aprotoc) " +
" --plugin=protoc-gen-plugin=$(location protozero_plugin) " +
" --plugin_out=wrapper_namespace=pbzero:$(genDir) " +
" --proto_path=external/protobuf/src " +
" --proto_path=external/perfetto " +
" --proto_path=. " +
" $(locations :frameworks-native-tracing-winscope-protos) && " +
"cp -r $(genDir)/frameworks/native/tracing/winscope/. $(genDir)/android/tracing/winscope/ && " +
"rm -rf $(genDir)/frameworks",
}
cc_library_headers {
name: "frameworks-native-tracing-protos-pzc-headers",
host_supported: true,
device_supported: true,
vendor_available: true,
recovery_available: true,
generated_headers: [
"frameworks-native-track-event-pzc-h-gen",
"frameworks-native-tracing-winscope-pzc-h-gen",
"frameworks-native-interned-data-pzc-h-gen",
],
export_generated_headers: [
"frameworks-native-track-event-pzc-h-gen",
"frameworks-native-tracing-winscope-pzc-h-gen",
"frameworks-native-interned-data-pzc-h-gen",
],
}
cc_library_headers {
name: "frameworks-native-tracing-winscope-pbzero-cc-protos",
host_supported: true,
device_supported: true,
vendor_available: true,
recovery_available: true,
generated_headers: [
"frameworks-native-tracing-winscope-pbzero-h-gen",
],
export_generated_headers: [
"frameworks-native-tracing-winscope-pbzero-h-gen",
],
}
genrule {
name: "frameworks-native-trace-packet-pbzero-h-gen",
tools: [
"protozero_plugin",
"aprotoc",
],
srcs: [
"frameworks_native_trace_packet.proto",
"//external/perfetto:perfetto_protos_perfetto_trace_non_minimal_protos",
],
out: [
"android/tracing/frameworks_native_trace_packet.pbzero.h",
],
cmd: "mkdir -p $(genDir)/android/tracing && " +
"$(location aprotoc) " +
" --plugin=protoc-gen-plugin=$(location protozero_plugin) " +
" --plugin_out=wrapper_namespace=pbzero:$(genDir)/android/tracing " +
" --proto_path=external/perfetto " +
" --proto_path=frameworks/native/tracing " +
" frameworks_native_trace_packet.proto",
}
cc_library_headers {
name: "frameworks-native-trace-packet-pbzero-cc-protos",
host_supported: true,
device_supported: true,
vendor_available: true,
recovery_available: true,
generated_headers: [
"frameworks-native-trace-packet-pbzero-h-gen",
],
export_generated_headers: [
"frameworks-native-trace-packet-pbzero-h-gen",
],
}
// Lite C++ MESSAGE classes for SurfaceFlinger's dump path (returns LayersProto by value).
// Deliberately scoped to the SF protos only — never add the wrapper protos here (they import
// perfetto's trace_packet.proto and pull in the whole perfetto closure).
cc_library_static {
name: "frameworks-native-tracing-winscope-lite-cc-protos",
host_supported: true,
device_supported: true,
vendor_available: true,
srcs: [
"winscope/surfaceflinger_layers.proto",
"winscope/surfaceflinger_transactions.proto",
"winscope/surfaceflinger_common.proto",
"winscope/common/rect.proto",
"winscope/common/corner_radii.proto",
"winscope/layertracegenerator_trace.proto",
],
proto: {
type: "lite",
export_proto_headers: true,
canonical_path_from_root: true,
include_dirs: ["external/perfetto"],
local_include_dirs: ["."],
},
}
// Lite classes for the winscope TracePacket extension wrapper, for tests and
// local/host tools that read or write winscope payloads inside whole trace
// packets (LayerTraceGenerator, trace tests). Not for production use -- it
// pulls in perfetto's trace protos and descriptor.proto.
cc_library_static {
name: "frameworks-native-tracing-winscope-lite-for-tests-cc-protos",
host_supported: true,
srcs: [
// descriptor.proto compiled in because common/typedef.proto defines
// custom options (extend google.protobuf.FieldOptions) whose
// generated code needs FieldOptions definitions that
// libprotobuf-cpp-lite does not provide.
":libprotobuf-internal-protos",
"winscope/frameworks_native_winscope.proto",
"winscope/android_input_event.proto",
"winscope/protolog.proto",
"winscope/common/typedef.proto",
],
proto: {
type: "lite",
export_proto_headers: true,
canonical_path_from_root: true,
include_dirs: [
"external/perfetto",
"external/protobuf/src",
],
local_include_dirs: ["."],
},
// The wrapper's generated code includes the payload and perfetto
// generated headers; both deps export them.
static_libs: [
"frameworks-native-tracing-winscope-lite-cc-protos",
"perfetto_trace_protos",
],
}
// Similar to above one of Lite classes for the TracePacket extension, for tests
cc_library_static {
name: "frameworks-native-tracing-lite-cc-protos",
host_supported: true,
device_supported: true,
vendor_available: true,
proto: {
type: "lite",
export_proto_headers: true,
canonical_path_from_root: true,
include_dirs: [
"external/perfetto",
"external/protobuf/src",
],
},
srcs: [
"frameworks_native_trace_packet.proto",
],
static_libs: [
"perfetto_trace_protos",
],
shared_libs: [
"libprotobuf-cpp-lite",
],
}
// Python protos for host tests that build traces with the fw/native OOT
// extensions (frame_timeline_event, protolog interned data). Compiles only the
// fw/native protos; perfetto core comes from perfetto_trace_python_protos via
// `libs`.
python_library_host {
name: "frameworks-native-tracing-python-protos",
srcs: [
"frameworks_native_trace_packet.proto",
"frameworks_native_interned_data.proto",
],
proto: {
canonical_path_from_root: false,
include_dirs: ["external/perfetto"],
},
libs: [
"perfetto_trace_python_protos",
],
}