Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: missing render when coming back from background #364

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dennisbordet
Copy link

@dennisbordet dennisbordet commented Dec 27, 2023

What

Fix issue #327

Copied from commit on the google map flutter plugin.
The commit concerned was fixing another fix that has inserted a second bug.

Test Plan

Tested on emulator API 28 & samsung Galaxy s7-> no more rendering missed when come back from background
Tested on OnePlus 7T android 12 -> no regression seen

Dec-27-2023 16-18-06

Maestro Flow to reproduce bug

Run this flow with the following command:
maestro test path_to_the_file
Careful the flow does not check if the bug is present, just follow the steps to reproduce 15 times.

appId: ${APP_ID}
name: "Relaunch app"
env: 
      APP_ID: com.mapbox.mapboxglexample
---
# first launch
# CAREFUL, You may need to allow fine location permission on device first
- launchApp: 
        appId: ${APP_ID}
# open map
- tapOn: "Full screen map"

# Stop and launch app
- repeat: 
        times: 15
        commands: 
              - pressKey: home
              - launchApp: 
                      appId: ${APP_ID}
                      stopApp: false
              - waitForAnimationToEnd: 
                      timeout: 5000

Copy from [commit on google maps library](flutter/packages@e393d45)
PostInvalidate ensures invalidation to run on UI thread
@dennisbordet dennisbordet changed the title Fix: missing render when come back from background Fix: missing render when coming back from background Dec 27, 2023
@dennisbordet
Copy link
Author

I just copied the code from the google maps plugin but in fact we just need to invalidate the texture view, not all the mapview

@m0nac0
Copy link
Collaborator

m0nac0 commented Jan 14, 2024

Thanks for contributing!

It would be good if some more people who had the issue could test this approach and comment here, since I can't reproduce the original issue.

@AurelienKun
Copy link

AurelienKun commented Jan 18, 2024

Thanks for contributing!

It would be good if some more people who had the issue could test this approach and comment here, since I can't reproduce the original issue.

I tried on my Samsung Note8 (SM-N950F - Android 9) and the fix is working great !

@T-moz
Copy link

T-moz commented Jan 18, 2024

I can still reproduce the bug on my phone.
It's a Samsung Galaxy s9, android 10

@kuhnroyal
Copy link
Collaborator

I can not reproduce this, can you let me know under which conditions this appears?
Is this tied to a specific Android SDK version or are there already fixes in a later Flutter SDK?

@f1sh1918
Copy link

f1sh1918 commented May 29, 2024

What i've done to test:

  1. I forked your branch
  2. created a tag to be able to include it in my project. (Maybe there is an easier solution)
  3. added this to pubspec.yaml
  4. Also tested enabling impeller engine for android (added in manifest)
dependency_overrides:
    maplibre_gl_platform_interface:
      git:
        url: https://github.com/f1sh1918/flutter-maplibre-gl.git
        path: maplibre_gl_platform_interface
        ref: test
 dependencies:
   maplibre_gl:
    git:
      url: https://github.com/f1sh1918/flutter-maplibre-gl.git
      ref: test

For me the bug is still reproduceable on Android 9 and Android 14 even with your changes
Tested on browserstack

environment:
  sdk: 3.3.1
  flutter: 3.19.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Map flickers when app is resumed, and sometimes get transparent.
6 participants