Repository navigation
ref(android): Narrow consumer keep rules to what the SDK reads - #6779
runningcode wants to merge 4 commits into
Conversation
Classes that are only checked by name now keep just their name, the NDK entry points keep only init() and close(), replay keeps the names of the three Painters isMaskable() leaves unmasked, LayoutNode keeps only the reflected members, and the Compose tag elements keep only their tag field. The app-wide Integration keepnames is dropped, since integration names are string literals now. Refs #6771 Refs JAVA-856 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR risk: mediumFor commit Main concerns: reach, public contract, data sent to Sentry. Rules that block low also fired:
This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
0xadam-brown
left a comment
There was a problem hiding this comment.
One quick comment; otherwise lgtm 👍
| # Rules to detect Images/Icons and mask them | ||
| -dontwarn androidx.compose.ui.graphics.painter.Painter | ||
| -keepnames class * extends androidx.compose.ui.graphics.painter.Painter | ||
| # isMaskable() leaves these Painters unmasked by name and masks every other one |
There was a problem hiding this comment.
Looks like the impl of isMaskable() exempts any painter whose class name contains Color, Vector, or Brush. With the three new keep rules, an app-defined painter with, eg, Color in its name can be unmasked in debug and masked in release after R8 renames it.
Thoughts about keeping the original -keepnames class * extends androidx.compose.ui.graphics.painter.Painter rule to preserve current behavior?
Alternatively, if we only want to exempt these three AndroidX painters, we could check for their types directly in isMaskable() + drop the painter-name rules.
There was a problem hiding this comment.
Great catch. I went with checking their types in d242084 let me know if that is what you were thinking!
isMaskable() left any Painter unmasked whose class name contained Vector, Color, or Brush. Once R8 renames an app's painter, that check gave different results in debug and release. Checking the three AndroidX types directly behaves the same in both, and drops their keep rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p-rules # Conflicts: # CHANGELOG.md
📜 Description
Narrows Android consumer keep rules to the names and members the SDK actually reads by reflection, and drops the app-wide
-keepnames class * implements io.sentry.Integration.💡 Motivation and Context
Google Play adds DEX optimization thresholds in Feb 2027, and library consumer rules count against the app. Part of #6771 (JAVA-856).
isMaskable()now leavesVectorPainter,ColorPainter, andBrushPainterunmasked by type instead of by class name, so no Painter needs to keep its name. Before, an app's own Painter withVector,Color, orBrushin its name stayed unmasked; it's now masked in debug and release alike.SentryOptionsrules (hybrid SDKs depend on them), theThrowablerule,-keeppackagenames, and the exception keepnames.💚 How did you test it?
Built the minified
sentry-samples-androidrelease with and without these changes (together with #6778) and ran the same journey on an API 36 emulator: exceptions with screenshot and view hierarchy, Timber, native capture, fragment and ComposetestTagclick breadcrumbs, Session Replay, and a Java crash on relaunch. Captured the envelopes locally. The events, attachments, view hierarchy tags, breadcrumbs,sdk.integrations, and the integration init logs were identical, and logcat showed no reflection failures.R8 Configuration Analyzer on the sample: Sentry's rules keep 1,556 items instead of 1,700, and the uncompressed DEX shrinks by 6.5 KB.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Conflicts with #6778 in
sentry-android-core/proguard-rules.proandCHANGELOG.md. Whichever lands second takes both sides.🤖 Generated with Claude Code