MediaGalleryPreviewActivity crashes on Android 13: NPE Class.isInterface() in typed getParcelableExtra
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Mở MediaGalleryPreviewActivity.kt và kiểm tra các thao tác đọc Parcelable có kiểu của Intent và Bundle được mô tả trong báo cáo. So sánh cách xử lý cấp API của chúng với IntentCompat.getParcelableExtra và BundleCompat.getParcelable, sau đó kiểm tra hành vi tương thích của AndroidX trên API 33. Issue được hoàn tất khi bản xem trước mở trên Android 13 mà không gặp sự cố đã báo cáo và các thao tác đọc trạng thái đã lưu sử dụng getter tương thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
MediaGalleryPreviewActivity crashes on Android 13 (API 33) while reading its intent extras, with no app code in the stack:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isInterface()' on a null object reference
at java.lang.Class.isAssignableFrom(Class.java:874)
at android.os.Parcel.readParcelableCreatorInternal(Parcel.java:4875)
at android.os.Parcel.readParcelableInternal(Parcel.java:4788)
at android.os.Parcel.readValue(Parcel.java:4554)
at android.os.Parcel.readValue(Parcel.java:4334)
at android.os.Parcel.-$$Nest$mreadValue(Unknown Source)
at android.os.Parcel$LazyValue.apply(Parcel.java:4432)
at android.os.Parcel$LazyValue.apply(Parcel.java:4391)
at android.os.BaseBundle.getValueAt(BaseBundle.java:394)
at android.os.BaseBundle.getValue(BaseBundle.java:374)
at android.os.BaseBundle.getValue(BaseBundle.java:357)
at android.os.BaseBundle.get(BaseBundle.java:696)
at android.os.Bundle.getParcelable(Bundle.java:947)
at android.content.Intent.getParcelableExtra(Intent.java:8930)
at io.getstream.chat.android.compose.ui.attachments.preview.MediaGalleryPreviewActivity.onCreate$lambda$13(MediaGalleryPreviewActivity.kt)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:122)
...
The private helper Intent.getParcelable<T>(key) in MediaGalleryPreviewActivity switches to the typed getParcelableExtra(key, T::class.java) from Build.VERSION_CODES.TIRAMISU. The typed Intent/Bundle getters have a known platform bug on API 33 that throws exactly this NPE inside Parcel.readParcelableCreatorInternal; it is fixed in API 34. That is why androidx.core.content.IntentCompat.getParcelableExtra / BundleCompat.getParcelable only use the typed API from UPSIDE_DOWN_CAKE and fall back to the untyped call on 33.
Suggested fix: replace the helper with IntentCompat.getParcelableExtra(intent, key, T::class.java) (or raise the version check to Build.VERSION_CODES.UPSIDE_DOWN_CAKE). The same pattern applies to the Bundle reads from savedInstanceState.
The file is identical in 7.13.0, 7.18.0 and develop, so the crash is still present in the latest release.
SDK version
stream-chat-android-compose7.13.0 (code unchanged up to 7.18.0 /develop)
To Reproduce
Not reproducible on demand: it is a platform race in the Android 13 typed Parcel API. Observed in production:
- Open a channel containing an image attachment
- Tap the image to open
MediaGalleryPreviewActivity - The activity crashes during the first composition
Expected behavior
The media gallery preview opens without crashing on Android 13.
Device:
- Vendor and model: Xiaomi Redmi Note 11 (2201117TY)
- Android version: 13 (TKQ1.221114.001)
Screenshots
N/A
- Ngôn ngữ chính
- Kotlin
- Star
- 1.7k
- Fork
- 321
- Merge trung bình
- 19 giờ 57 phút
- Pull request đã merge (30 ngày)
- 167
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GetStream/stream-chat-android
-
feature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
GetStream/stream-chat-android#6556 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add Sort Order Support for Media and Files Attachments Lists in Channel InfoCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởfeature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
GetStream/stream-chat-android#6359 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
GetStream/stream-chat-android#6243 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Unable to wrap ChannelList height due to internal LazyColumn .fillMaxSize()Có thể làm lại được @Ahmetkaragunlu đã nhận 19 ngày trước và không có pull request nào đang mở. Đang mởcompose feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
GetStream/stream-chat-android#5612 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Should Support Larger fileĐang mởcore feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
GetStream/stream-chat-android#5279 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của GetStream/stream-chat-android
Issue tương tự
-
unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
thunderbird/thunderbird-android#11893 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
Droid-Deck/DroidDeck#2198 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
world-federation-of-advertisers/cross-media-measurement#4846 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
airbytehq/airbyte#91201 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày