Skip to content

Commit 41c6b3d

Browse files
authored
[image_picker_android] Inline sdk guard logic from internal isSystemPickerAvailable$activity_release() (#10314)
Inlines the check, copying the logic and then applying quick fixes that AS suggested to simplify. Fixes flutter/flutter#177673 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent fa67c72 commit 41c6b3d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/image_picker/image_picker_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.13+7
2+
3+
* Removes reference to internal `isSystemPickerAvailable$activity_release()` method.
4+
15
## 0.8.13+6
26

37
* Fixes typo in limit parameter validation error message.

packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import android.content.pm.PackageInfo;
1111
import android.content.pm.PackageManager;
1212
import android.os.Build;
13+
import android.os.ext.SdkExtensions;
1314
import android.provider.MediaStore;
14-
import androidx.activity.result.contract.ActivityResultContracts;
1515
import java.util.Arrays;
1616

1717
final class ImagePickerUtils {
@@ -67,7 +67,9 @@ static boolean needRequestCameraPermission(Context context) {
6767
*/
6868
@SuppressLint({"NewApi", "ClassVerificationFailure"})
6969
static int getMaxItems() {
70-
if (ActivityResultContracts.PickVisualMedia.isSystemPickerAvailable$activity_release()) {
70+
if (Build.VERSION.SDK_INT >= 33
71+
|| (Build.VERSION.SDK_INT >= 30
72+
&& SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2)) {
7173
return MediaStore.getPickImagesMaxLimit();
7274
} else {
7375
return Integer.MAX_VALUE;

packages/image_picker/image_picker_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: image_picker_android
22
description: Android implementation of the image_picker plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
5-
version: 0.8.13+6
5+
version: 0.8.13+7
66

77
environment:
88
sdk: ^3.9.0

0 commit comments

Comments
 (0)