Skip to content

ref(android): Remove code made obsolete by minSdk 24 - #6519

Merged
runningcode merged 3 commits into
no/min-sdk-24from
no/min-sdk-24-remove-checks
Nov 10, 2026
Merged

runningcode merged 3 commits into
no/min-sdk-24from
no/min-sdk-24-remove-checks

Conversation

@runningcode

@runningcode runningcode commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (minSdk 24)


📜 Description

This is just my agent going through the codebase systematically to remove dead code.

Here's an AI summary of what this does:

Removes the code that minSdk 24 (#6518) made dead, and turns the ObsoleteSdkInt lint check back on.

  • Runtime checks for API levels below 24, with the branches they guarded:
    • profilers: the API 21 guard in AndroidTransactionProfiler and AndroidContinuousProfiler
    • network: the pre-M and pre-N paths in AndroidConnectionStatusProvider, NetworkBreadcrumbsIntegration and CellularNetworkTechnologyProvider, including the deprecated NetworkInfo transport fallback
    • app start: the API 24 check around Process.getStartUptimeMillis() in SentryAndroid and SentryPerformanceProvider, and the pre-M fallback for MessageQueue.addIdleHandler in AppStartMetrics
    • SentryFrameMetricsCollector: the API 24 availability check
  • @RequiresApi / @TargetApi annotations for API 24 and lower in sentry-android-core and sentry-android-replay
  • 35 of the 54 NewApi lint suppressions, and the last two ObsoleteSdkInt ones. Lint reports no error without them. The 19 that stay cover APIs above 24 behind BuildInfoProvider checks, which lint can't see.

💡 Motivation and Context

Follow-up to #6518.

💚 How did you test it?

CI

📝 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

After #6518 is squash-merged, this branch needs 9.x.x merged in before it can be merged.

🤖 Generated with Claude Code

#skip-changelog

runningcode and others added 2 commits November 9, 2026 14:38
Remove the SDK_INT checks for API 24 and lower, with the branches they
guarded, and turn lint's ObsoleteSdkInt check back on. Most checks go
through BuildInfoProvider, which lint doesn't see, so it flagged only
five of them.

Code for API 25 and lower, such as the bundled root CAs, the pre-O
screenshot canvas and the Choreographer frame start, stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sentry

sentry Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode marked this pull request as ready for review November 9, 2026 13:47
@runningcode
runningcode requested review from a team and adinauer as code owners November 9, 2026 13:47
@runningcode
runningcode requested review from 0xadam-brown and romtsn and removed request for a team November 9, 2026 13:47
@runningcode runningcode added next-major This should only be merged in the next major version. sanity-check PR needs a lightweight review for obvious issues labels Nov 9, 2026

@markushi markushi left a comment

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.

Maybe you can double check the usage of the "NewApi" lint ignores, other than that LGTM!

At minSdk 24, 35 of the 54 NewApi suppressions in sentry-android-core
and sentry-android-replay no longer hide any lint error. The same goes
for the two remaining ObsoleteSdkInt suppressions. The 19 that stay
cover APIs above 24, behind BuildInfoProvider checks that lint can't
see.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode requested a review from markushi November 10, 2026 07:25

@markushi markushi left a comment

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.

thanks! 🙌

@runningcode
runningcode merged commit f257861 into no/min-sdk-24 Nov 10, 2026
25 of 27 checks passed
@runningcode
runningcode deleted the no/min-sdk-24-remove-checks branch November 10, 2026 07:28
runningcode added a commit that referenced this pull request Nov 10, 2026
The baseline keys buildReplay by its signature, which included the
@Suppress("NewApi") annotation removed in #6519.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode added a commit that referenced this pull request Nov 10, 2026
* feat(android): Raise minSdk from 21 to 24

Raise the minimum supported Android API level of all Android modules
from 21 to 24. The SDK_INT checks this makes obsolete stay for now, so
lint's ObsoleteSdkInt check is disabled until they are removed.

The R8 bundled with AGP 9.0 and 9.2 crashes on androidx.core at the new
minSdk, so builds that override AGP run the R8 of the default AGP.

Resolves #5508
Resolves JAVA-547

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* changelog

* test(android): Drop obsolete API checks from the UI test app

sentry-uitest-android lints with warningsAsErrors and is part of the
root build, so its two pre-24 checks fail check at minSdk 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ref(android): Remove code made obsolete by minSdk 24 (#6519)

* ref(android): Remove code made obsolete by minSdk 24

Remove the SDK_INT checks for API 24 and lower, with the branches they
guarded, and turn lint's ObsoleteSdkInt check back on. Most checks go
through BuildInfoProvider, which lint doesn't see, so it flagged only
five of them.

Code for API 25 and lower, such as the bundled root CAs, the pre-O
screenshot canvas and the Choreographer frame start, stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ref(android): Remove NewApi suppressions lint no longer needs

At minSdk 24, 35 of the 54 NewApi suppressions in sentry-android-core
and sentry-android-replay no longer hide any lint error. The same goes
for the two remaining ObsoleteSdkInt suppressions. The 19 that stay
cover APIs above 24, behind BuildInfoProvider checks that lint can't
see.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(replay): Update detekt baseline for the removed NewApi suppression

The baseline keys buildReplay by its signature, which included the
@Suppress("NewApi") annotation removed in #6519.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-major This should only be merged in the next major version. sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants