Skip to content

[PlatformView] Hybrid composition can be slow on android.  #167547

@delfme

Description

@delfme

Steps to reproduce

Hi, it seems the platform view issues are more widespread than initially expected.
Here's the current situation:

  • Hybrid Composition (HC) causes performance issues on Android devices. Initially, we believed this was limited to older phones, but one of our users shared a video showing the issue on a OnePlus 13 running SDK 35 (device specs). You can find the video in the “Videos” section.

In summary:

  • The HC issue impacts performance only on certain Android devices, but they are many, and the performance degradation is severe.
  • Currently, there is no reliable fallback or configuration that consistently avoids these issues.
  • Given the current state, PlatformView on android is not reliable enough for production use.

Note:

A reliable and performant Platform View is critical for our app, as we rely on it for key components such as text fields, video player, Google Maps, WebView, and more.

Expected results

Platform Views should not cause such significant performance degradation—especially for something as basic as a text field. Additionally, Platform Views should always render reliably on devices.

Actual results

Platform Views degrade performance on certain Android models when using HC, and on some subset of devices, also don't render properly.

Code sample

Code sample

Sample repository is linked below in the discussion.

Screenshots or Video

Screenshots / Video demonstration

The video demonstrates a screen where a platform view is used at the bottom for a native text field, and also for rendering video content when the user posts a video.

HC Issue:

UI performance is noticeably janky on an undefined number of android models. Here's a video captured on a OnePlus 13 running SDK 35 (device specs) :

HC.issue.MP4

HC with no issue:

On some Android devices, HC performs smoothly. However, the models where issues occur are unpredictable and appear to include also newer mid-to-high-end devices. Note: The below video showing no HC issues was recorded on a Xiaomi Mi 11 Lite 5G (vulkan and SDK 34)

HC-good.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.24.5, on macOS 14.7.4 23H420 darwin-arm64, locale en-IT)
    ! Flutter version 3.24.5 on channel [user-branch] at /Users/delf/Development/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision dec2ee5c1f (5 months ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks
      and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/delf/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.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 17.0.10+0-17.0.10b1087.21-11609105)

[✓] Connected device (6 available)
    • 2109119DG (mobile)              • bef49dd4                  • android-arm64  • Android 14 (API 34)
    • iPhone 16pro di delf (mobile)   • 00008140-00062D900E98801C • ios            • iOS 18.3.2 22D82
    • iPhone di delf (mobile)         • 00008110-000A788A2161801E • ios            • iOS 18.3.2 22D82
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7.4 23H420 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7.4 23H420 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 135.0.7049.96

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsc: performanceRelates to speed or footprint issues (see "perf:" labels)e: device-specificOnly manifests on certain devicesengineflutter/engine repository. See also e: labels.platform-androidAndroid applications specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy