Conversation
Warning Message: "'PreferenceManager' is deprecated. Deprecated in Java" The 'android.preference.PreferenceManager' class was deprecated in API level 29 (Android 10), From there onwards, it is recommended to use the corresponding 'AndroidX Preference Library' for a consistent behavior across all devices. For more info see: - android.preference.PreferenceManager (Documentation): https://developer.android.com/reference/kotlin/android/preference/ PreferenceManager - androidx.preference.PreferenceManager (Documentation): https://developer.android.com/reference/androidx/preference/ PreferenceManager PS: This commit also adds the 'androidx.preference:preference' dependency to the 'analytics' module since it wasn't there already.
Warning Message: "'PreferenceManager' is deprecated. Deprecated in Java" The 'android.preference.PreferenceManager' class was deprecated in API level 29 (Android 10), From there onwards, it is recommended to use the corresponding 'AndroidX Preference Library' for a consistent behavior across all devices. For more info see: - android.preference.PreferenceManager (Documentation): https://developer.android.com/reference/kotlin/android/preference/ PreferenceManager - androidx.preference.PreferenceManager (Documentation): https://developer.android.com/reference/androidx/preference/ PreferenceManager PS: This commit also adds the 'androidx.preference:preference' dependency to the 'analytics' module since it wasn't there already.
Warning Message: "'PreferenceManager' is deprecated. Deprecated in Java" The 'android.preference.PreferenceManager' class was deprecated in API level 29 (Android 10), From there onwards, it is recommended to use the corresponding 'AndroidX Preference Library' for a consistent behavior across all devices. For more info see: - android.preference.PreferenceManager (Documentation): https://developer.android.com/reference/kotlin/android/preference/ PreferenceManager - androidx.preference.PreferenceManager (Documentation): https://developer.android.com/reference/androidx/preference/ PreferenceManager PS: Actually, this 'WordPress' module was already using the 'androidx.preference.PreferenceManager' class instead of the deprecated 'android.preference.PreferenceManager' class here and there, hence it being defined as a dependency on this module already.
|
Found 1 violations: The PR caused the following dependency changes:++--- project :libs:analytics
+| \--- androidx.preference:preference:1.1.0 (*)
+\--- project :libs:editor
+ \--- androidx.preference:preference:1.1.0 (*)
Please review and act accordingly
|
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | WordPress | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | dcfb3d1 | |
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | Jetpack | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | dcfb3d1 | |
After updating the 'android.preference.PreferenceManager' import to 'androidx.preference.PreferenceManager' the below 'java.lang.ClassCastException' started appearing on 'EditPostActivity': org.wordpress.android.ui.prefs.EditTextPreferenceWithValidation cannot be cast to androidx.preference.Preference This crash happens because the [PreferenceManager.setDefaultValues(...)] is instantiating an 'EditTextPreferenceWithValidation' preference, via the 'R.xml.account_settings' preference file, which is a type of 'android.preference.EditTextPreference' and thus a type of 'android.preference.Preference'. Because 'android.preference.Preference' is not an 'androidx.preference.Preference', as expected, a class cast exception is thrown. As such, reverting the 'androidx.preference.PreferenceManager' change is the only logical solution, for now, and until a full migration of 'android.preference.Preference' to 'androidx.preference.Preference' occurs.
PreferenceManager Deprecated Warnings #17210PreferenceManager Deprecated Warnings
|
👋 @RenanLukas ! Apologies for the direct ping, but I wonder if you have the capacity for reviewing and testing this PR. Let me know, and if not, I can assign it to another engineer. I would like to avoid keeping this PR open for much longer, risking it becoming stale. |
|
👋 @RenanLukas ! As I am seeing you being busy with other priorities I am assigning this PR review to @AjeshRPai for now. Ajesh, let me know if that's okay with you too. I have updated the PR description accordingly. Thank you all for helping out in reviewing, testings and ultimately merging this to |
|
@ParaskP7 Thanks for the ping 👍🏼 . I will review the PR tomorrow. I hope the PR is not urgent. Let me know if a review is needed before that. |
Thank you so much @AjeshRPai ! 🙇 PS: No, this PR is not that urgent, so please feel free to review it when you get some extra time this week. It is just that this needs to be done sooner than later in order to avoid having it become stale. |
… into analysis/wordpress-preference-manager-deprecated-warnings � Conflicts: � WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java
AjeshRPai
left a comment
There was a problem hiding this comment.
Thanks for providing me with all the details for the review in the commit messages as well as in the description. 🙌🏼
I have
- tested the PR by going through the changes in every commit and reading the reference links mentioned in the commit messages and everything LGTM
- done a smoke testing of the WordPress and everything looks fine here
- Logcat is showing/hiding the 🔵 Tracked: XYZ related information 🟢
- New block editor dialogue is shown 🟢
- Changed Interface language 🟢
Am going to approve but not merge the PR so that anyone from @wordpress-mobile/apps-infrastructure can have a look. Please feel free to merge the PR at your convenience.
|
Awesome, thank you so much for reviewing and testing this PR @AjeshRPai, you rock! 🙇 ❤️ 🚀 |


Parent: #17173
Partially Closes: #17181
This PR resolves all
PreferenceManagerrelatedDeprecatedwarnings for theWordPressmodule and beyond (AnalyticsandEditormodules):Modules:
PS:
@RenanLukas@AjeshRPai I added you as the main reviewer, that is, in addition to @wordpress-mobile/apps-infrastructure team itself, but randomly, since I want someone from theWordPress Androidteam to primarily sign-off on that change. 🥇FYI: I am going to randomly add more of you in those PRs that will follow, just so you become more aware of this change and how close we are on enabling
allWarningsAsErrorsby default everywhere. 🎉To test:
WordPressandJetpackapps, and see if their settings and preference related functionalities are working as expected. For example, and per module, you could test the following:Collect Informationprivacy setting and verify that theLogcatis showing/hiding the🔵 Tracked: xyzrelated information. To find this setting go to:My Sitetab ->Meoptions ->App Settings->Privacy settingsUse Block Editorsite setting and verify that theDialogthat appears when using the legacy editor is showing/hiding. The dialog's title should beTry the new Block Editor. To find this setting go to:My Sitetab ->Site SettingsconfigurationMy Sitetab ->Meoptions ->App Settings->Interface LanguagePS: The above testing should be enough to verify that all other setting related affecting changes are also working as expected.
Regression Notes
The settings and preference related functionalities are not working as expected.
See
To testsection above.N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.