App freezes when switching via task switcher on API 25 – Android 7.1.1

Steps to Reproduce

  1. Run flutter create freeze_bug to create example app.
  2. Run flutter run to launch app.
  3. Click Fab a few times to show app is working.
  4. Click home button to return to home launcher.
  5. Press square button to launch task switcher and switch back to the Flutter app.
  6. Click the Fab button. App no longer responds to input.

Expected results:

I would expect the app to work as normal.

Actual results:

The app appears to freeze and it no longer responds to inputs, but on the console each tap results in a:

E/EGL_emulation( 5541): egl_window_surface_t::swapBuffers called with NULL buffer
E/EGL_emulation( 5541): tid 5568: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)

I experienced this issue consistently on both a physical device and emulator; both running 7.1.1. I have only noticed this issue since updating to the latest stable release 1.20.2. Could this be related to issue #60576?

Logs

Running the app in full verbose mode shows the following at the point you switch back to the app via the task switcher and start clicking/tapping:

[+4204 ms] D/EGL_emulation( 5901): eglMakeCurrent: 0x7f7f623eeb20: ver 2 0 (tinfo 0x7f7f6045be00)
[+6565 ms] D/EGL_emulation( 5901): eglMakeCurrent: 0x7f7f622a3300: ver 2 0 (tinfo 0x7f7f64e68780)
[  +25 ms] D/EGL_emulation( 5901): eglMakeCurrent: 0x7f7f623eeb20: ver 2 0 (tinfo 0x7f7f6045be00)
[        ] D/EGL_emulation( 5901): eglMakeCurrent: 0x7f7f622a3300: ver 2 0 (tinfo 0x7f7f64e68780)
[  +52 ms] E/Surface ( 5901): queueBuffer: error queuing buffer to SurfaceTexture, -19
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(531): error 0x300d (EGL_BAD_SURFACE)
[+4892 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[   +2 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +27 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[   +6 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +18 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +15 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +14 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +16 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +17 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +17 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +16 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +17 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[  +15 ms] E/EGL_emulation( 5901): egl_window_surface_t::swapBuffers called with NULL buffer
[        ] E/EGL_emulation( 5901): tid 5920: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)

Result of flutter analyze showed no errors:

Analyzing flutter_bug...                                                
No issues found! (ran in 2.5s)

Flutter doctor:

[✓] Flutter (Channel stable, 1.20.2, on Linux, locale en_GB.UTF-8)
    • Flutter version 1.20.2 at /home/ben/Development/flutter
    • Framework revision bbfbf1770c (10 days ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /media/ubuntudata/Development/android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /home/ben/Development/android/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at /home/ben/Development/android/android-studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.13.2

[✓] Connected device (1 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 7.1.1 (API 25) (emulator)

• No issues found!

3 thoughts on “App freezes when switching via task switcher on API 25 – Android 7.1.1

  1. When could we expect a release with a fix? will it be introduced as a hotfix release? As currently, flutter apps built with the latest SDK is fairly unusable with android 7
    p.s I no longer can reproduce the issue on flutter master branch 👍

  2. When could we expect a release with a fix? will it be introduced as a hotfix release? As currently, flutter apps built with the latest SDK is fairly unusable with android 7
    p.s I no longer can reproduce the issue on flutter master branch

    Working on a hotfix now flutter/engine#20838