Skip to content

perfetto: expose PerfettoSDK Java libs to ART modules - #7230

Open
parthsane wants to merge 1 commit into
mainfrom
dev/parthsane/expose_perfetto_sdk_to_libcore
Open

perfetto: expose PerfettoSDK Java libs to ART modules#7230
parthsane wants to merge 1 commit into
mainfrom
dev/parthsane/expose_perfetto_sdk_to_libcore

Conversation

@parthsane

Copy link
Copy Markdown
Contributor

Expose Perfetto Java SDK and JNI libraries for Libcore / ART integration:

  • Add jarjar rules for dalvik.system.dev.perfetto.sdk.
  • Conditionally expose JNI_OnLoad_Perfetto when LIBCORE_INTEGRATION is defined.
  • Add libperfetto_jni_static, perfetto_jarjar_rules_files, and perfetto_trace_lib_libcore_java targets in Android.bp.extras.
  • Update tools/gen_android_bp to set apex_available and min_sdk_version on SDK libraries.

@parthsane
parthsane marked this pull request as ready for review August 26, 2026 15:29
@parthsane
parthsane requested a review from a team as a code owner August 26, 2026 15:29
@parthsane
parthsane force-pushed the dev/parthsane/expose_perfetto_sdk_to_libcore branch from ebfcc7e to 21d2d15 Compare August 26, 2026 15:43
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Comment thread Android.bp.extras Outdated
Comment thread Android.bp.extras Outdated
Comment thread src/android_sdk/java/main/perfetto-sdk-libcore-jarjar-rules.txt
Comment thread tools/gen_android_bp
Comment thread src/android_sdk/jni/dev_perfetto_sdk_PerfettoTrace.cc Outdated
Comment thread Android.bp.extras Outdated
Comment thread Android.bp.extras Outdated
Comment thread Android.bp.extras Outdated
@parthsane
parthsane force-pushed the dev/parthsane/expose_perfetto_sdk_to_libcore branch from 21d2d15 to 1079a17 Compare August 27, 2026 17:55
Expose Perfetto Java SDK and JNI libraries for Libcore / ART
integration:
- Add jarjar rules for dalvik.system.dev.perfetto.sdk with
  libcore-scoped visibility in Android.bp.extras.
- Define libperfetto_jni_static and libperfetto_jni_static_src in
  src/android_sdk/jni/BUILD.gn.
- Conditionally expose JNI_OnLoad_Perfetto when
  PERFETTO_JNI_ART_STATIC_INTEGRATION is defined.
- Update tools/gen_android_bp to generate libperfetto_jni_static and
  perfetto_trace_lib_libcore_java, and configure min_sdk_version:
  "apex_inherit".
@parthsane
parthsane force-pushed the dev/parthsane/expose_perfetto_sdk_to_libcore branch from 1079a17 to 5de935a Compare August 27, 2026 18:06
@sashwinbalaji

Copy link
Copy Markdown
Member

The PR looks good to me! I chatted with @primiano, though, and we’d like to discuss the wider use of the SDK especially for frequent logging in libcore before moving forward.

We’re not sure this is the right time for it, so it would be good to align with you and @zezeozue first. Can we setup a meeting next week, pls

@@ -0,0 +1,5 @@
rule dev.perfetto.sdk.** dalvik.system.dev.perfetto.sdk.@1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add anothe branch in https://crsrc.org/c/third_party/perfetto/src/android_sdk/java/main/dev/perfetto/sdk/PerfettoNativeLibrary.java;l=37 for libcore otherwise we'll try to load a absent lib

System.loadLibrary(isFramework ? "perfetto_framework_jni" : "perfetto_jni");

[ "-DPERFETTO_JNI_JARJAR_PREFIX=com/android/internal/" ]
}

source_set("libperfetto_jni_static_src") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we call this libperfetto_libcore_jni_src and also change libperfetto_jni_static to libperfetto_libcore_jni would better aling with others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants