Repository: flutter
Issue: [image_picker] [Android] The app freezes when trying to upload a big image chosen from Google Drive
Labels: c: crash,platform-android,p: image_picker,package,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-android,triaged-android

Hello there! I am experiencing some difficulties with image_picker package on Android. The thing is, when picking a huge image, the app freezes with a black screen for a little while, but this is enough for a user to think that there's something wrong with the app and to close it without waiting for a result. Though, after a few seconds, the app succeeds in picking the image.

I am using Flutter 3.0.4 on macOS 12.3, image_picker version is 0.8.5+3, which is the latest at the moment of filing this issue. Tested on Samsung Galaxy S10e (Android 11) and on Google Pixel 3a (Android 12).

### **Steps to reproduce**
1. Launch the sample code
2. Press the "Pick Photo" button
3. Go to Google Drive and select a big photo (the more it weighs, the better is the reproduction - I use a ~100 MB photo)
4. Keep an eye on the app behavior.

### **Actual result**
App freezes with a black screen for a few seconds, then the screen with a button opens.

### **Expected result**
App lets user know that it is doing something, probably, with a loader.

Below you can find Flutter doctor report, a sample code I used to reproduce the issue and a screencast of the issue.

<details>
<summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.3 21E230 darwin-arm, locale ru-RU)
    • Flutter version 3.0.4 at /Users/chapsan2001/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (8 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/chapsan2001/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] Connected device (3 available)
    • SM G970F (mobile) • RF8M2030CZT • android-arm64  • Android 11 (API 30)
    • macOS (desktop)   • macos       • darwin-arm64   • macOS 12.3 21E230 darwin-arm
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 104.0.5112.101
    ! Error: iPhone is not connected. Xcode will continue when iPhone is connected. (code -13)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```
Don't know why it tells me to install Flutter and Dart plugins, though.
</details>

<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ElevatedButton(
            onPressed: () => ImagePicker().pickImage(source: ImageSource.gallery),
            child: const Text('Pick Photo'),
          ),
        ),
      ),
    );
  }
}

```
</details>

<details>
<summary>Screencast</summary>
<video src="https://user-images.githubusercontent.com/59578374/185969884-3aa63c2c-d7c8-4415-a809-ea71215686d9.mp4">
</details>