Skip to content

fix(android): [Data Collection 19] Preserve installation ID - #5937

Draft
adinauer wants to merge 1 commit into
fix/data-collection-spring-bindingfrom
fix/data-collection-preserve-installation-id
Draft

fix(android): [Data Collection 19] Preserve installation ID#5937
adinauer wants to merge 1 commit into
fix/data-collection-spring-bindingfrom
fix/data-collection-preserve-installation-id

Conversation

@adinauer

@adinauer adinauer commented Aug 12, 2026

Copy link
Copy Markdown
Member

PR Stack (Data Collection)


📜 Description

Keep Android's generated installation ID independent of the Data Collection userInfo option.

Restore installation IDs for the default distinctId, event and exit-info user.id, device context device.id, and hybrid scope serialization when userInfo=false. Application-configured user and distinct IDs remain authoritative. Automatic IP enrichment continues to follow userInfo.

Remove the now-unused isUserInfoWithLegacyAlways() resolver variant and update the Android policy tests.

💡 Motivation and Context

The installation ID is a random identifier generated once per app installation and historically remains available independently of sendDefaultPii. The Data Collection specification defines userInfo around automatic user information, but does not require it to control installation identity, device identity, or session correlation.

Keeping the installation ID independent preserves existing Android behavior and avoids changing crash-free user, session, log, metric, device-context, and hybrid SDK correlation when applications opt out of automatic user information.

Refs #5666

💚 How did you test it?

  • ./gradlew ':sentry-android-core:testDebugUnitTest' --tests='*AndroidOptionsInitializerTest*' --tests='*ApplicationExitInfoEventProcessorTest*' --tests='*DefaultAndroidEventProcessorTest*' --tests='*DeviceInfoUtilTest*' --tests='*InternalSentrySdkTest*'
  • ./gradlew ':sentry:test' --tests='*DataCollectionResolverTest*'
  • ./gradlew spotlessApply apiDump
  • git diff --check

📝 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Continue the remaining Data Collection configuration and release-gate work.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

Keep the Android installation ID available for distinct ID, user ID, device ID, and hybrid scope fallbacks regardless of the userInfo setting. Continue applying userInfo only to automatic user details such as IP addresses and remove the now-unused legacy-always resolver variant.

Refs #5666

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@sentry

sentry Bot commented Aug 12, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

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.

1 participant