Skip to content

Conversation

@joshtrichards
Copy link
Member

Summary

Migrates deprecated readSerializable() and readParcelable() calls to their type-safe variants using AndroidX ParcelCompat for backward compatibility with Android 9+.

Addresses lint warnings such as these:

w: file:///home/runner/work/android/android/app/src/main/java/com/nextcloud/client/account/RegisteredUser.kt:33:16 'fun <T : Parcelable!> readParcelable(p0: ClassLoader?): T?' is deprecated. Deprecated in Java.
w: file:///home/runner/work/android/android/app/src/main/java/com/nextcloud/client/account/RegisteredUser.kt:34:16 'fun <T : Parcelable!> readParcelable(p0: ClassLoader?): T?' is deprecated. Deprecated in Java.
w: file:///home/runner/work/android/android/app/src/main/java/com/nextcloud/client/account/RegisteredUser.kt:35:16 'fun <T : Parcelable!> readParcelable(p0: ClassLoader?): T?' is deprecated. Deprecated in Java.
w: file:///home/runner/work/android/android/app/src/main/java/com/nextcloud/client/account/Server.kt:22:16 'fun readSerializable(): Serializable?' is deprecated. Deprecated in Java.
w: file:///home/runner/work/android/android/app/src/main/java/com/nextcloud/client/account/Server.kt:23:16 'fun <T : Parcelable!> readParcelable(p0: ClassLoader?): T?' is deprecated. Deprecated in Java.

Changes

  • Add readSerializableCompat extension function to existing ParcableExtensions.kt
  • Update Server.kt to use extension functions
  • Update Request.kt (DownloadRequest & UploadRequest) to use extension functions
  • Update RegisteredUser.kt to use extension functions
  • Update OCFile.java to use ParcelCompat directly
  • Update ConflictDialogData.kt for consistency with type parameters

Why

  • Removes deprecation warnings on Android 13+ (API 33+)
  • Maintains backward compatibility with minSdk 28 (Android 9)
  • Provides type safety at compile time
  • Establishes consistent pattern across the codebase

Testing

  • Existing Parcelable tests pass
  • Account switching works correctly
  • File operations (upload/download) work correctly
  • No runtime errors on Android 9-14

🖼️ Screenshots

🏚️ Before 🏡 After
B A

🏁 Checklist

  • Tests written, or not not needed

Signed-off-by: Josh <josh.t.richards@gmail.com>
Add readSerializableCompat to ParcableExtensions.kt for type-safe
Serializable deserialization using AndroidX ParcelCompat, maintaining consistency with existing readParcelableCompat function.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Codacy

SpotBugs

CategoryBaseNew
Bad practice4242
Correctness7474
Dodgy code257257
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3434
Performance4443
Security1818
Total479478

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16488.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@joshtrichards joshtrichards marked this pull request as ready for review February 9, 2026 14:22
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.

1 participant