Skip to content

Update deprecated Intent and Bundle functions#18061

Merged
irfano merged 13 commits intofeature/update-compile-sdk-33from
update-intent-bundle-functions
Mar 9, 2023
Merged

Update deprecated Intent and Bundle functions#18061
irfano merged 13 commits intofeature/update-compile-sdk-33from
update-intent-bundle-functions

Conversation

@irfano
Copy link
Copy Markdown
Member

@irfano irfano commented Mar 7, 2023

This PR is part of a parent PR to update compileSdk to 33.

The functions below were deprecated on Android 13.
Intent.getParcelableExtra()
Intent.getSerializableExtra()
Bundle.getParcelable()
Bundle.getParcelableArrayList()
Bundle.getSerializable()
To update these functions for Android 13, there are ready-to-use functions in IntentCompat and BundleCompat, but they're available on the androidx.core:1.10.0-beta01 version, which is not stable yet. I used CompatExtensions that I created to update deprecated functions.

To test:
Being able to build and basic smoke test should be enough.

Regression Notes

  1. Potential unintended areas of impact
    Navigation between screens may result in unintended behaviors.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    I debugged suspicious changes manually.

  3. What automated tests I added (or what prevented me from doing so)
    Updated existing tests.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@irfano irfano added this to the 22.1 milestone Mar 7, 2023
@irfano irfano self-assigned this Mar 7, 2023
@irfano
Copy link
Copy Markdown
Member Author

irfano commented Mar 7, 2023

@ParaskP7, I have made changes based on your suggestions and applied your patches from your comment on the draft PR. There may be slight differences from your patch due to changes in some codes after syncing with the trunk.

Question (❓): This PR has not yet updated deprecated functions on Java files, and there are currently 154 usages of deprecated functions on Java files. I can't use the current extension functions in CopatExtensions as they are inline functions and hence inaccessible from Java files.
While I do not wish to modify CompatExtensions since it is better suited for Kotlin files, I have two options to resolve this issue:

  1. I can create separate functions specifically for Java files.
  2. I can postpone upgrading these functions until we have migrated Java files to Kotlin.

Personally, I prefer option 2 and prioritize Kotlin migration in our process. Wdyt?

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Mar 7, 2023

WordPress📲 You can test these changes on WordPress by downloading wordpress-installable-build-pr18061-4c32fd4.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppWordPress
Build FlavorJalapeno
Build TypeDebug
Commit4c32fd4
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Mar 7, 2023

Jetpack📲 You can test these changes on Jetpack by downloading jetpack-installable-build-pr18061-4c32fd4.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppJetpack
Build FlavorJalapeno
Build TypeDebug
Commit4c32fd4
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@ParaskP7 ParaskP7 self-assigned this Mar 8, 2023
@ParaskP7 ParaskP7 self-requested a review March 8, 2023 10:59
@irfano irfano mentioned this pull request Mar 8, 2023
8 tasks
Copy link
Copy Markdown
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @irfano !

I have reviewed and tested this PR as per the instructions, everything works as expected, great work on this!!! 🌟 🌟 🌟


I have left a couple of question/info comments for you (❓/ℹ️ ), one suggestions (💡) and some minor (🔍) comments for you to consider, plus praises (❤️).

I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.


About you question (❓) here, I agree with you, let's take option (2.) and update these functions at a later time, when/if we migrate those Java files to Kotlin, or else otherwise, when we are forced to update at that point when an SDK update will remove those deprecated APIs for good. 👍

PS: Maybe you would like to create an issue on that so that we are aware of this and could potentially pick this work up at some point in the future. Wdyt? 🤔

@irfano
Copy link
Copy Markdown
Member Author

irfano commented Mar 8, 2023

Thank you so much for your through review, @ParaskP7. ❤️

PS: Maybe you would like to create an issue on that so that we are aware of this and could potentially pick this work up at some point in the future. Wdyt? 🤔

Good idea. I created the issue.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Mar 8, 2023

Warnings
⚠️ PR has more than 300 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@ParaskP7
Copy link
Copy Markdown
Contributor

ParaskP7 commented Mar 9, 2023

Thank you so much for your through review, @ParaskP7. ❤️

No, thank you for applying all my suggestions, you are a beautiful human being @irfano ! 🙇 ❤️ 🚀

PS: Just for next time, feel free to skip any minor (🔍) comments, especially when those are subjective. I am just leaving those there for us to discuss and together become better engineers! 🤗

Good idea. I created the #18066.

Thank you so much for doing that! 🙇 ❤️

@ParaskP7
Copy link
Copy Markdown
Contributor

ParaskP7 commented Mar 9, 2023

FYI @irfano that I only have 2 comments of mine left unresolved. However, please feel free to merge this PR when you are ready, it is still a ✅ from my side!

@ParaskP7 ParaskP7 mentioned this pull request Mar 9, 2023
3 tasks
@irfano irfano removed their assignment Mar 9, 2023
@irfano
Copy link
Copy Markdown
Member Author

irfano commented Mar 9, 2023

PS: Just for next time, feel free to skip any minor (🔍) comments, especially when those are subjective. I am just leaving those there for us to discuss and together become better engineers! 🤗

I really appreciate those comments. Let's keep up the good work! 💪🏻

FYI @irfano that I only have 2 comments of mine left unresolved. However, please feel free to merge this PR when you are ready, it is still a ✅ from my side!

I have resolved them and am currently merging.

@irfano irfano merged commit 36ed7ac into feature/update-compile-sdk-33 Mar 9, 2023
@irfano irfano deleted the update-intent-bundle-functions branch March 9, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants