Fix part of #5405: Replace deprecated Bundle calls with BundleCompat#6245
Fix part of #5405: Replace deprecated Bundle calls with BundleCompat#6245akkicodes-dev wants to merge 4 commits into
Conversation
|
Hi @adhiamboperes, This PR replaces the deprecated The implementation is cleaner and type-safe — removing the need for manual API version checks and @adhiamboperes PTAL |
There was a problem hiding this comment.
Thanks @akkicodes-dev!
However, I have left some comments in-line.
Additionally:
- Your PR description does not start with
- "Fixes #". I believe this issue is small enough to be fixed in one go. Please work on the other files mentioned in #5405 once your approach has been approved.
| @Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved. | ||
| val readingTextSize = checkNotNull( |
There was a problem hiding this comment.
The supress annotation is removed but no change haas been made, why?
|
|
||
| assertThat(intent).extras().hasSize(1) | ||
| assertThat(intent).extras().containsKey("first_extra") | ||
| // TODO(#5405): Convert this to getSerializableExtra once Robolectric can be updated. |
There was a problem hiding this comment.
I don't see any changes supporting the removal of this TODO, unless I am missing something.
… in BundleExtensions.kt, re-pin maven dependencies
|
Hi @adhiamboperes, I have addressed all the review comments:
PTAL! |
|
Unassigning @akkicodes-dev since a re-review was requested. @akkicodes-dev, please make sure you have addressed all review comments. Thanks! |
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
|
||
|
|
There was a problem hiding this comment.
You added 2 newlines instead of just one.
|
Hi @adhiamboperes, Addressed all review comments:
PTAL! |
|
Unassigning @akkicodes-dev since a re-review was requested. @akkicodes-dev, please make sure you have addressed all review comments. Thanks! |
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
adhiamboperes
left a comment
There was a problem hiding this comment.
Thanks @akkicodes-dev!
I think you can proceed with working on the other files mentioned in the issue, so that this PR can close the issue, not just part of it.
There was a problem hiding this comment.
This file has removed some spaces, and I am not sure why.
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
"Reopening this PR — addressing all pending review comments and expanding scope to fully close #5405." |
|
Hi @akkicodes-dev, is this PR ready for another review, or are you still working on it? If it’s ready for review, please assign a reviewer and leave a comment like Also, please resolve the merge conflict before asking for another review. Thank you!!! |
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
Hi @akkicodes-dev, another friendly ping. |
|
Hi @akkicodes-dev, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |

Explanation
Problem
Android API 33 deprecated several type-ambiguous Bundle methods like
getSerializable()(without type parameter). These methods are unsafe because they don't enforce type checking at compile time, which can lead to runtimeClassCastExceptionerrors. The existing code inBundleExtensions.kthad aTODO(#5405)to migrate this toBundleCompat.Solution
Replaced the deprecated Bundle calls with
BundleCompat.getSerializable()from AndroidX Core, which provides a type-safe, backward-compatible implementation that works correctly across all API levels without requiring manual API version checks.Changes Made
third_party/versions.bzl— Upgradedandroidx.core:coreandandroidx.core:core-ktxfrom1.0.1to1.9.0to enable BundleCompat usage.utility/src/main/java/org/oppia/android/util/extensions/BundleExtensions.kt— Removed theTODO(#5405)comment. Replaced the manual API-version-checking implementation with a single clean call toBundleCompat.getSerializable(). Removed unused imports and addedandroidx.core.os.BundleCompat.utility/src/main/java/org/oppia/android/util/extensions/BUILD.bazel— Added//third_party:androidx_core_coreas a dependency.app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity.kt— Removed@Suppress("DEPRECATION")annotation and its associatedTODO(#5405)comment.utility/src/test/java/org/oppia/android/util/extensions/BundleExtensionsTest.kt— Removed theTODO(#5405)comment.Essential Checklist
Fixes part of #5405