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

[iOS] Flashing white area at the top of the screen when swiping a page containing platform views #119485

Open
0xZOne opened this issue Jan 30, 2023 · 20 comments
Labels
a: platform-views Embedding Android/iOS views in Flutter apps engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@0xZOne
Copy link
Member

0xZOne commented Jan 30, 2023

截屏2023-01-30 10 45 45

Steps to Reproduce

  1. git clone -b task/displaylink git@github.com:0xZOne/platform_view_performance.git
  2. cd platform_view_performance
  3. flutter run
  4. As shown in the video below
RPReplay_Final1675046104.MP4
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.7.0 on channel stable at /Users/zero/fvm/versions/3.7.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (6 days ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/zero/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/zero/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Android Studio (version 2021.3)
    • 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.13+0-b1751.21-8125866)

[✓] VS Code (version 1.74.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (1 available)
    • 艾尔玛的iPhone (2) (mobile) • 00008110-001A30960238401E • ios • iOS 15.5 19F77

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@0xZOne 0xZOne added platform-ios iOS applications specifically a: platform-views Embedding Android/iOS views in Flutter apps found in release: 3.7 Found to occur in 3.7 labels Jan 30, 2023
@jmagman
Copy link
Member

jmagman commented Jan 30, 2023

@0xZOne what's the exception?

@0xZOne
Copy link
Member Author

0xZOne commented Jan 31, 2023

@0xZOne what's the exception?

Flashing white area at the top of the screen when swiping as shown.

@0xZOne 0xZOne changed the title [iOS] Rendering exception when swiping a page containing platform views [iOS] Flashing white area at the top of the screen when swiping a page containing platform views Jan 31, 2023
@jmagman jmagman added the engine flutter/engine repository. See also e: labels. label Jan 31, 2023
@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 6, 2023

@0xZOne Does it only happen on pro-motion devices?

@chinmaygarde
Copy link
Member

From Triage: Our guess is that there are frames in succession where a platform is and isn't in the scene. The thread merge and un-merge is probably causing on frame to not be displayed with -[CALayer setPresentsWithTransation:YES] for a single frame which causes the mismatch.

@chinmaygarde chinmaygarde added the P2 Important issues not at the top of the work list label Feb 6, 2023
@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 6, 2023

From Triage: Our guess is that there are frames in succession where a platform is and isn't in the scene. The thread merge and un-merge is probably causing on frame to not be displayed with -[CALayer setPresentsWithTransation:YES] for a single frame which causes the mismatch.

Should be easily verified by turning on -[CALayer setPresentsWithTransation:YES] always.

@chinmaygarde
Copy link
Member

Should be easily verified by turning on -[CALayer setPresentsWithTransation:YES] always.

You could try that but I don't think we always have a transaction when off the main thread. In case no one pushes a transaction, we may deadlock. Advising caution.

@0xZOne
Copy link
Member Author

0xZOne commented Feb 7, 2023

@0xZOne Does it only happen on pro-motion devices?

I'm not sure, but I only encountered it on ProMotion devices.

@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 9, 2023

Some observations:

  1. I couldn't reproduce it on an iPhone XS (non-pro-motion)
  2. It is less likely reproducible in release mode.
  3. turning on -[CALayer setPresentsWithTransation:YES] on raster thread didn't resolve the issue, which makes sense after looking at the example again. The example app always has at least 1 platform view in the scene so there are no un-merge.

@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 9, 2023

It could be related: #118366

@hellohuanlin
Copy link
Contributor

In case it's helpful - I encountered an issue that I suspect it is related to this.

I tried out the example code in #86787. When using the latest main branch, it looks like the top area becomes transparent, so the platform view underneath is displayed (pic below). The release build is fine.

Simulator Screen Shot - iPhone 14 Pro - 2023-02-21 at 13 32 53

@timtangcoding
Copy link

timtangcoding commented Feb 27, 2023

In case it's helpful - I encountered an issue that I suspect it is related to this.

I tried out the example code in #86787. When using the latest main branch, it looks like the top area becomes transparent, so the platform view underneath is displayed (pic below). The release build is fine.

Same observation found (#116640 (comment)), The native view will move up to top bar even if SafeArea is used.

@timtangcoding
Copy link

Some observations:

  1. I couldn't reproduce it on an iPhone XS (non-pro-motion)
  2. It is less likely reproducible in release mode.
  3. turning on -[CALayer setPresentsWithTransation:YES] on raster thread didn't resolve the issue, which makes sense after looking at the example again. The example app always has at least 1 platform view in the scene so there are no un-merge.

So far I only found this issues on Pro devices. I found such issues appear on iPhone 13 Pro and iPhone 14 Pro. However, on iPhone 11 Pro there is no such issue.

@cyanglaz
Copy link
Contributor

So far I only found this issues on Pro devices. I found such issues appear on iPhone 13 Pro and iPhone 14 Pro. However, on iPhone 11 Pro there is no such issue.

It looks like an issue related to the pro-motion display. (iPhone 13 pro and iPhone 14 pro are the only iPhones support pro-motion)

@ristiisa
Copy link

ristiisa commented Feb 6, 2024

I can repro this on 6s and simulator in addition to 11 pro and 14 pro and 15 pro max.

please see #142801

@ristiisa

This comment was marked as duplicate.

@felipecastrosales

This comment was marked as duplicate.

@ristiisa

This comment was marked as duplicate.

@aayushsaajtak

This comment was marked as off-topic.

@hellohuanlin

This comment was marked as off-topic.

@aayushsaajtak

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: platform-views Embedding Android/iOS views in Flutter apps engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

10 participants