| /* | |
| * 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 { | |
| // See: http://go/android-license-faq | |
| // A large-scale-change added 'default_applicable_licenses' to import | |
| // all of the 'license_kinds' from "frameworks_base_license" | |
| // to get the below license kinds: | |
| // SPDX-license-identifier-Apache-2.0 | |
| default_applicable_licenses: ["frameworks_base_license"], | |
| } | |
| // frameworks/base TrackEvent extensions filegroup. Future CLs will add a | |
| // `java_library_static` (with jarjar) that compiles the .proto, plus a | |
| // reference to this filegroup from system/core/tracing/Android.bp's | |
| // descriptor genrule. See rfcs/0017-out-of-tree-protos.md. | |
| filegroup { | |
| name: "frameworks-base-tracing-protos", | |
| srcs: [ | |
| "frameworks_base_common.proto", | |
| "frameworks_base_interned_data.proto", | |
| "frameworks_base_track_event.proto", | |
| "frameworks_base_trace_packet.proto", | |
| "frameworks_base_tracing_protos.json", | |
| ], | |
| } | |
| // Winscope tracing schemas: out-of-tree protos owned by Android. | |
| filegroup { | |
| name: "frameworks-base-tracing-winscope-protos", | |
| srcs: [ | |
| "winscope/**/*.proto", | |
| ], | |
| } | |
| // Java codegen of the fw/base TrackEvent extensions. | |
| // Generates flat stream constants natively in com.android.internal. | |
| genrule { | |
| name: "frameworks-base-tracing-javastream-protos-gen", | |
| srcs: [ | |
| "frameworks_base_common.proto", | |
| "frameworks_base_interned_data.proto", | |
| "frameworks_base_track_event.proto", | |
| "frameworks_base_trace_packet.proto", | |
| ":frameworks-native-tracing-interned-data-proto", | |
| ":perfetto_javastream_filegroup_proto", | |
| ], | |
| tools: [ | |
| "aprotoc", | |
| "protoc-gen-javastream", | |
| "soong_zip", | |
| ], | |
| out: ["framework_javastream_protos_base.srcjar"], | |
| cmd: "mkdir -p $(genDir)/out " + | |
| "&& $(location aprotoc) " + | |
| "--plugin=$(location protoc-gen-javastream) " + | |
| "--javastream_out=$(genDir)/out " + | |
| "-Iexternal/protobuf/src " + | |
| "-Iexternal/perfetto " + | |
| "-I . " + | |
| "-Iframeworks/native/tracing " + | |
| "-Iframeworks/base/proto/tracing " + | |
| "$(location frameworks_base_common.proto) " + | |
| "$(location frameworks_base_track_event.proto) " + | |
| "$(location frameworks_base_trace_packet.proto) " + | |
| "$(location frameworks_base_interned_data.proto) " + | |
| "$(locations :frameworks-native-tracing-interned-data-proto) " + | |
| "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/out -D $(genDir)/out", | |
| } | |
| // Javastream (stream-token) codegen of ALL winscope protos for framework dump/tracing code. | |
| genrule { | |
| name: "frameworks-base-tracing-winscope-javastream-protos-gen", | |
| srcs: [ | |
| ":frameworks-base-tracing-winscope-protos", | |
| ":frameworks-native-tracing-winscope-protos", | |
| ":frameworks-native-tracing-winscope-common-protos", | |
| ":libprotobuf-internal-protos", | |
| "//external/perfetto:perfetto_protos_perfetto_trace_non_minimal_protos", | |
| ], | |
| tools: [ | |
| "aprotoc", | |
| "protoc-gen-javastream", | |
| "soong_zip", | |
| ], | |
| out: ["frameworks_base_winscope_compat_javastream_protos.srcjar"], | |
| cmd: "mkdir -p $(genDir)/out " + | |
| "&& $(location aprotoc) " + | |
| "--plugin=$(location protoc-gen-javastream) " + | |
| "--javastream_out=$(genDir)/out " + | |
| "-Iexternal/protobuf/src " + | |
| "-Iexternal/perfetto " + | |
| "-I. " + | |
| "$(locations :frameworks-base-tracing-winscope-protos) " + | |
| "$(locations :frameworks-native-tracing-winscope-protos) " + | |
| "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/out -D $(genDir)/out", | |
| } | |
| java_library_static { | |
| name: "frameworks-base-tracing-javastream-protos", | |
| srcs: [":frameworks-base-tracing-javastream-protos-gen"], | |
| static_libs: [ | |
| "frameworks-base-tracing-winscope-javastream-protos", | |
| ], | |
| sdk_version: "core_platform", | |
| libs: ["framework-annotations-lib"], | |
| installable: false, | |
| } | |
| java_library_static { | |
| name: "frameworks-base-tracing-winscope-javastream-protos", | |
| srcs: [ | |
| ":frameworks-base-tracing-winscope-javastream-protos-gen", | |
| ], | |
| // Uses core_platform because it compiles into the framework jar/boot classpath. | |
| sdk_version: "core_platform", | |
| libs: ["framework-annotations-lib"], | |
| installable: false, | |
| } | |
| // Native Lite compilation for framework unit tests. Applies a custom jarjar | |
| // rule to rename the class structure to FrameworksBaseTrackEventLite to prevent | |
| // classpath shadowing against the Stream version packaged into framework.jar. | |
| java_library_static { | |
| name: "frameworks-base-tracing-test-protos", | |
| proto: { | |
| type: "lite", | |
| include_dirs: ["external/perfetto"], | |
| }, | |
| srcs: [ | |
| "frameworks_base_common.proto", | |
| "frameworks_base_interned_data.proto", | |
| "frameworks_base_trace_packet.proto", | |
| "frameworks_base_track_event.proto", | |
| ], | |
| libs: ["perfetto_trace_java_protos"], | |
| jarjar_rules: "lite_for_tests_jarjar_rules.txt", | |
| sdk_version: "current", | |
| } | |
| // Lite message classes for all winscope protos. | |
| java_library_static { | |
| name: "frameworks-base-tracing-winscope-lite-java-protos", | |
| proto: { | |
| type: "lite", | |
| include_dirs: [ | |
| "external/perfetto", | |
| "external/protobuf/src", | |
| ], | |
| }, | |
| srcs: [ | |
| ":frameworks-base-tracing-winscope-protos", | |
| ":frameworks-native-tracing-winscope-protos", | |
| ":libprotobuf-internal-protos", | |
| ], | |
| static_libs: [ | |
| "perfetto_trace_java_protos", | |
| ], | |
| jarjar_rules: "lite_for_tests_jarjar_rules.txt", | |
| // Enabled because protologtool is the only host consumer of winscope lite messages. | |
| host_supported: true, | |
| // Uses current to support app-level testing consumers (e.g. CTS modules, host tools). | |
| sdk_version: "current", | |
| installable: false, | |
| } | |
| // The legacy AndroidTrackEvent Java API surface for framework consumers that | |
| // haven't yet migrated to com.android.internal.FrameworksBaseTrackEvent.*. | |
| // Soong target name preserved (was an auto-gen lib pre-OOT) so consumers' | |
| // static_libs deps keep resolving. Retired once all consumers have migrated. | |
| java_library_static { | |
| name: "perfetto_trace_android_track_event_extension_java_protos", | |
| srcs: ["AndroidTrackEventOuterClass.java"], | |
| static_libs: [ | |
| "frameworks-base-tracing-javastream-protos", | |
| ], | |
| jarjar_rules: ":framework-jarjar-rules", | |
| sdk_version: "core_platform", | |
| installable: false, | |
| } |