Skip to content

perf(android): Use generated manifest metadata - #5969

Draft
romtsn wants to merge 4 commits into
mainfrom
perf/java-531-generated-manifest-metadata
Draft

perf(android): Use generated manifest metadata#5969
romtsn wants to merge 4 commits into
mainfrom
perf/java-531-generated-manifest-metadata

Conversation

@romtsn

@romtsn romtsn commented Aug 14, 2026

Copy link
Copy Markdown
Member

📜 Description

Use manifest metadata injected by the Sentry Android Gradle plugin when available. The existing PackageManager Bundle remains the fallback, and all existing runtime option precedence remains unchanged.

💡 Motivation and Context

Reading ApplicationInfo metadata and converting every manifest option during startup showed up prominently in customer traces. The paired plugin change in getsentry/sentry-android-gradle-plugin#1405 resolves typed metadata from the final merged manifest and avoids that runtime work, reducing median SDK initialization time by 6.5% in the all-options benchmark.

💚 How did you test it?

Ran the ManifestMetadataReader release unit tests, including typed generated values, absent keys, auto-init, PackageManager fallback, and no Context access on the generated path. Also ran spotlessApply and apiDump.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Release with getsentry/sentry-android-gradle-plugin#1405 to enable the generated path.

Allow the Android Gradle plugin to provide authoritative manifest metadata so SDK initialization can skip PackageManager and Bundle unparceling. Read the injected map directly to avoid conversion overhead.

Refs JAVA-531
Co-Authored-By: Codex <noreply@openai.com>
@linear-code

linear-code Bot commented Aug 14, 2026

Copy link
Copy Markdown

JAVA-531

@sentry

sentry Bot commented Aug 14, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.53.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 357.82 ms 424.16 ms 66.35 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
fc5ccaf 276.52 ms 370.46 ms 93.93 ms
fcec2f2 314.96 ms 373.66 ms 58.70 ms
70118e9 380.00 ms 475.72 ms 95.72 ms
f634d01 359.58 ms 433.88 ms 74.30 ms
f064536 349.86 ms 417.66 ms 67.80 ms
0eaac1e 322.53 ms 389.31 ms 66.78 ms
32811a3 313.16 ms 366.22 ms 53.06 ms
5865051 333.08 ms 355.34 ms 22.26 ms
65aff4f 323.59 ms 370.71 ms 47.12 ms
3998a95 415.94 ms 478.54 ms 62.60 ms

App size

Revision Plain With Sentry Diff
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
fcec2f2 1.58 MiB 2.12 MiB 551.50 KiB
70118e9 1.58 MiB 2.29 MiB 719.84 KiB
f634d01 1.58 MiB 2.10 MiB 533.40 KiB
f064536 1.58 MiB 2.20 MiB 633.90 KiB
0eaac1e 1.58 MiB 2.19 MiB 619.17 KiB
32811a3 0 B 0 B 0 B
5865051 0 B 0 B 0 B
65aff4f 0 B 0 B 0 B
3998a95 1.58 MiB 2.10 MiB 532.96 KiB

Previous results on branch: perf/java-531-generated-manifest-metadata

Startup times

Revision Plain With Sentry Diff
2385db7 377.33 ms 453.35 ms 76.02 ms
0b8acc4 292.31 ms 369.24 ms 76.93 ms

App size

Revision Plain With Sentry Diff
2385db7 0 B 0 B 0 B
0b8acc4 0 B 0 B 0 B

…ed-manifest-metadata

# Conflicts:
#	CHANGELOG.md

// Populated by the Sentry Android Gradle plugin with manifest metadata resolved at build time.
// When set, it is authoritative: the manifest is not read at runtime.
static @Nullable Map<String, Object> buildTimeMetadata;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we should separate the data to a separate class that just holds the data. That would make refactorings of ManifestMetadataReader easier and separate the "reading" from the "data" holder concern.

Keep the Gradle plugin bytecode contract separate from manifest reader implementation details.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
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