Repository: flutter
Issue: [Android] : Black screen after minimizing the app and turning the screen off and on specific device api 22 (Gertec GPOS700A)
Labels: e: device-specific,platform-android,e: OS-version specific,P3,team-android,triaged-android

### Steps to reproduce

1 - With the app open, turn off the screen
2 - Turn the screen back on
3 - Exit the app
4 - Upon returning, the screen goes black. In the tests I performed, even with the black screen, the '+' button still works, generating a log with 'print' when incrementing.

### Expected results

It is expected that the app should not display this black screen :)

### Actual results

Well, I performed the tests using the default code generated by flutter create... The only changes I made were adding a print statement in the _incrementCounter method and configuring signingConfigs, as this device requires it to install any app (Gertec GPOS700A, API 22).

In my tests, I was consistently able to reproduce the issue as shown in the attached video. No errors are generated in the logcat. The app seems to still be working (in my app, it opens the keyboard), and logs are generated when clicking where the increment button would be... However, no further updates appear in Flutter DevTools.



### Code sample

To reproduce the issue, simply run `flutter create bug` and then make the following changes:

1. Add the `debug.keystore` file to the `android/app` folder.
2. Modify the `android/app/build.gradle` file by adding:

    ```kotlin
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'Development@GertecDeveloper2018'
            keyAlias 'developmentgertecdeveloper_customerapp'
            keyPassword 'Development@GertecDeveloper2018'
        }
    }
    ```

3. Update the `_incrementCounter` method in `lib/main.dart` to:

    ```dart
    void _incrementCounter() {
      setState(() {
        print(_counter);
        _counter++;
      });
    }
    ```

This setup consistently reproduces the bug on the Gertec GPOS700A (API 22).


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>


https://github.com/user-attachments/assets/03283216-b710-4760-9580-d63b0cce5a69

https://github.com/user-attachments/assets/cd3a523b-3828-4e4b-856e-ca9983f780d2



</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [versÆo 10.0.22631.4169], locale pt-BR)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/windows-android-setup for more details.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.1)
[√] IntelliJ IDEA Ultimate Edition (version 2024.2)
[√] VS Code (version 1.93.1)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 3 categories.
```

</details>