Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Android 13 sdk #2251

Merged
merged 8 commits into from
Sep 29, 2022
Merged

Upgrade to Android 13 sdk #2251

merged 8 commits into from
Sep 29, 2022

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Sep 21, 2022

📜 Description

This pr is still a draft: to work with the new agp version, the latest version of Android Studio is needed. It is already out in the stable version, but we should be sure everyone updated before merging this pr into master.

upgraded Android Gradle Plugin to 7.3.0
upgraded target and compile sdk of sample app to 33 (android 13)
updated getPackageInfo and getApplicationInfo deprecated methods

#skip-changelog

💡 Motivation and Context

We want to make sure the Android sdk can be built without issues when targeting the latest Android version, currently 13.
So we upgrade our sample app to sdk 33 and fix any deprecation issues, other than testing the app is working fine.

💚 How did you test it?

Just running the app locally. We want to run ui tests on Android 13 devices, but we are going to do it when Saucelabs will have working devices with Android 13. There is a separate pr for this.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

updated target and compile sdk of sample app to 33 (android 13)
updated getPackageInfo and getApplicationInfo deprecated methods
updated target and compile sdk of sample app to 33 (android 13)
updated getPackageInfo and getApplicationInfo deprecated methods
@github-actions
Copy link
Contributor

github-actions bot commented Sep 21, 2022

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 324.57 ms 429.16 ms 104.59 ms
Size 1.73 MiB 2.29 MiB 578.36 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3d89dea 345.59 ms 364.06 ms 18.47 ms
1e4690d 354.69 ms 387.88 ms 33.19 ms
3d89dea 322.38 ms 350.82 ms 28.45 ms
2f079a1 296.91 ms 337.43 ms 40.51 ms

App size

Revision Plain With Sentry Diff
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB
1e4690d 1.74 MiB 2.33 MiB 604.92 KiB
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB
2f079a1 1.74 MiB 2.33 MiB 605.56 KiB

Previous results on branch: android_target_sdk_33

Startup times

Revision Plain With Sentry Diff
5ec80f4 333.24 ms 375.65 ms 42.41 ms
e743770 292.57 ms 331.86 ms 39.29 ms
f8b03cb 346.86 ms 370.68 ms 23.82 ms
fb22390 328.43 ms 389.27 ms 60.84 ms
ffd7905 332.70 ms 434.72 ms 102.02 ms
2ad7631 334.92 ms 400.10 ms 65.19 ms

App size

Revision Plain With Sentry Diff
5ec80f4 1.73 MiB 2.29 MiB 577.10 KiB
e743770 1.74 MiB 2.29 MiB 562.11 KiB
f8b03cb 1.73 MiB 2.29 MiB 578.29 KiB
fb22390 1.73 MiB 2.29 MiB 578.43 KiB
ffd7905 1.74 MiB 2.29 MiB 562.46 KiB
2ad7631 1.73 MiB 2.29 MiB 577.10 KiB

CHANGELOG.md Outdated Show resolved Hide resolved
static PackageInfo getPackageInfo(
final @NotNull Context context, final int flags, final @NotNull ILogger logger) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), flags);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a class that replaces Build.VERSION in the SKD to make it testable.

Copy link
Member Author

Choose a reason for hiding this comment

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

@marandaneto I created an istance of BuildInfoProvider inside these methods.
I couldn't pass directly the instance we create at the beginning of the init flow.
Is it fine, since it wasn't created anywhere else?

@stefanosiano stefanosiano mentioned this pull request Sep 21, 2022
4 tasks
@romtsn
Copy link
Member

romtsn commented Sep 26, 2022

@stefanosiano since you are on it already, could you also tackle #2133? It's about switching from AndroidManifest to namespace attribute in build.gradle. I planned to do it when updating to AGP 7.3.0, but you've already done it here.

Otherwise the PR LGTM 👍

replaced sdk version check in ContextUtils and RootChecker with BuildInfoProvider instance methods
@stefanosiano
Copy link
Member Author

@romtsn sure, i'll put it here, too

@codecov-commenter
Copy link

Codecov Report

Base: 80.62% // Head: 80.53% // Decreases project coverage by -0.09% ⚠️

Coverage data is based on head (aa617fc) compared to base (3d89dea).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2251      +/-   ##
============================================
- Coverage     80.62%   80.53%   -0.10%     
- Complexity     3368     3393      +25     
============================================
  Files           240      240              
  Lines         12388    12461      +73     
  Branches       1646     1659      +13     
============================================
+ Hits           9988    10035      +47     
- Misses         1791     1813      +22     
- Partials        609      613       +4     
Impacted Files Coverage Δ
...ry/src/main/java/io/sentry/TransactionContext.java 60.78% <0.00%> (-14.22%) ⬇️
sentry/src/main/java/io/sentry/Baggage.java 83.22% <0.00%> (-6.20%) ⬇️
...ring/tracing/SentrySpanClientWebRequestFilter.java 63.63% <0.00%> (-3.87%) ⬇️
sentry/src/main/java/io/sentry/SentryTracer.java 90.82% <0.00%> (-0.66%) ⬇️
sentry/src/main/java/io/sentry/TraceContext.java 82.83% <0.00%> (-0.60%) ⬇️
sentry/src/main/java/io/sentry/Span.java 100.00% <0.00%> (ø)
sentry/src/main/java/io/sentry/NoOpSpan.java 25.00% <0.00%> (ø)
...n/java/io/sentry/apollo/SentryApolloInterceptor.kt 81.57% <0.00%> (ø)
...racing/SentrySpanClientHttpRequestInterceptor.java 0.00% <0.00%> (ø)
...in/java/io/sentry/openfeign/SentryFeignClient.java 97.05% <0.00%> (+0.33%) ⬆️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stefanosiano
Copy link
Member Author

@romtsn i did the change. Of course, i didn't make the change to agp 8
would you give another look?
Also, should i merge this pr now, or should i wait a little bit until we are sure everyone updated android studio?

@romtsn
Copy link
Member

romtsn commented Sep 26, 2022

Looks good 👍 I'd merge it now, since it's just a few of us who uses AS and shouldn't be a problem to update. Since AS Dolphin is already stable, I think it's an easy update.

@stefanosiano stefanosiano marked this pull request as ready for review September 27, 2022 08:20
@stefanosiano stefanosiano merged commit c92eb47 into main Sep 29, 2022
@stefanosiano stefanosiano deleted the android_target_sdk_33 branch September 29, 2022 11:16
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.

4 participants