Repository navigation
fix(chat): guard MediaStore.getPickImagesMaxLimit on older pickers - #1741
Merged
Merged
Conversation
rememberChatPhotoPicker called getPickImagesMaxLimit() during composition with no version check. The method exists only on API 33+, or on API 30-32 with SDK extension R 2+, so an Android 12 device without the MediaProvider update threw NoSuchMethodError every time a chat opened (Bugsnag 6ac91865991833fd09984195, Samsung SM-N976V). Only call it where the system picker provides it. Elsewhere androidx falls back to a picker with no cap of its own, and the result callback already trims the selection to the remaining slots.
Int.MAX_VALUE never reached the picker, since the clamp came out to remaining anyway, but it read as no cap. Fall back to remaining directly.
This was referenced Oct 9, 2026
bmc08gt
added a commit
that referenced
this pull request
Oct 9, 2026
* fix(chat): guard MediaStore.getPickImagesMaxLimit on older pickers rememberChatPhotoPicker called getPickImagesMaxLimit() during composition with no version check. The method exists only on API 33+, or on API 30-32 with SDK extension R 2+, so an Android 12 device without the MediaProvider update threw NoSuchMethodError every time a chat opened (Bugsnag 6ac91865991833fd09984195, Samsung SM-N976V). Only call it where the system picker provides it. Elsewhere androidx falls back to a picker with no cap of its own, and the result callback already trims the selection to the remaining slots. * fix(chat): cap the fallback photo picker at the open slots Int.MAX_VALUE never reached the picker, since the clamp came out to remaining anyway, but it read as no cap. Fall back to remaining directly. * ci(lint): lint library modules from the app's lintDebug CI runs :apps:flipcash:app:lintDebug, but checkDependencies defaults to false, so lint only looked at the app module. The unguarded MediaStore.getPickImagesMaxLimit() call in chat-ui (#1741) shipped because no lint run ever saw it; with checkDependencies on, lint fails on it with NewApi. Turning it on surfaces three other existing errors, which go in the baseline so the check gates new issues only: WrongConstant in AppSettingsMapper, UnspecifiedRegisterReceiverFlag in SmsOtpAutofill (the pre-34 branch, where the flag isn't available), and UnrememberedMutableState in Flippable.
bmc08gt
added a commit
that referenced
this pull request
Oct 9, 2026
* fix(chat): guard MediaStore.getPickImagesMaxLimit on older pickers rememberChatPhotoPicker called getPickImagesMaxLimit() during composition with no version check. The method exists only on API 33+, or on API 30-32 with SDK extension R 2+, so an Android 12 device without the MediaProvider update threw NoSuchMethodError every time a chat opened (Bugsnag 6ac91865991833fd09984195, Samsung SM-N976V). Only call it where the system picker provides it. Elsewhere androidx falls back to a picker with no cap of its own, and the result callback already trims the selection to the remaining slots. * fix(chat): cap the fallback photo picker at the open slots Int.MAX_VALUE never reached the picker, since the clamp came out to remaining anyway, but it read as no cap. Fall back to remaining directly. * ci(lint): lint library modules from the app's lintDebug CI runs :apps:flipcash:app:lintDebug, but checkDependencies defaults to false, so lint only looked at the app module. The unguarded MediaStore.getPickImagesMaxLimit() call in chat-ui (#1741) shipped because no lint run ever saw it; with checkDependencies on, lint fails on it with NewApi. Turning it on surfaces three other existing errors, which go in the baseline so the check gates new issues only: WrongConstant in AppSettingsMapper, UnspecifiedRegisterReceiverFlag in SmsOtpAutofill (the pre-34 branch, where the flag isn't available), and UnrememberedMutableState in Flippable. * fix(lint): clear the three errors baselined in #1743 - WrongConstant: AppSettingMapper passed Biometrics.TEST_AUTH across a module boundary, where lint can't see it is a valid authenticator flag. The check now goes through Biometrics.authenticationState(), and TEST_AUTH is private. - UnspecifiedRegisterReceiverFlag: SmsOtpAutofill only passed RECEIVER_EXPORTED on API 34+. ContextCompat.registerReceiver takes the flag on every version; the receiver stays exported, as SMS_RETRIEVED comes from Play services and SEND_PERMISSION still guards it. - UnrememberedMutableState: FlippableCard built a new State object on each composition when animateFlip is false. It now uses rememberUpdatedState. The three entries come out of the app's lint baseline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening any chat crashes on Android 11–12 devices that lack the MediaProvider update with SDK extension R 2.
rememberChatPhotoPickercallsMediaStore.getPickImagesMaxLimit()during composition, and that method only exists on API 33+ or API 30–32 with extension R ≥ 2. Bugsnag 6ac91865991833fd09984195 has 8NoSuchMethodErrorevents from one Samsung SM-N976V on Android 12, all on 2026.10.2. The call came in with #1683.The fix calls it only when the SDK version or extension check passes. Otherwise the picker is capped at the open slots, and the result callback still trims the selection with
uris.take(currentRemaining)for fallback pickers that ignore the cap.I used an explicit
SDK_INT/SdkExtensionscheck instead ofPickVisualMedia.isPhotoPickerAvailable(context)because lint'sNewApicheck doesn't treat the androidx helper as a guard.:apps:flipcash:shared:chat-ui:lintDebugflagged the original call and passes with this change.A hotfix PR against the 2026.10.2 release follows separately.