Skip to content

Commit d1d1fbc

Browse files
Add notes on HCPP to Android-Platform-Views.md (#183859)
Adds notes, including how to opt in, what opt in does, and limitations. --------- Co-authored-by: Gray Mackall <mackall@google.com>
1 parent e9363c1 commit d1d1fbc

1 file changed

Lines changed: 38 additions & 1 deletion

File tree

docs/platforms/android/Android-Platform-Views.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,49 @@ within their Flutter UI.
2828

2929
# Approaches
3030

31-
There are currently three different implementations of Android platform views:
31+
There are currently four different implementations of Android platform views:
32+
- [Hybrid Composition++](#hybrid-composition) (HCPP)
3233
- [Virtual Display](Virtual-Display.md) (VD)
3334
- [Hybrid Composition](../Hybrid-Composition.md) (HC)
3435
- [Texture Layer Hybrid Composition](Texture-Layer-Hybrid-Composition.md) (TLHC)
3536

3637
Each has a different set of limitations and tradeoffs, as discussed below. The pages linked above give details about each implementation.
3738

39+
## Hybrid Composition++
40+
41+
This mode is the latest hybrid composition strategy, and is designed to solve compositing performance and synchronization issues seen in the original Hybrid Composition mode. It is currently available as an opt-in feature.
42+
43+
### Requirements
44+
- **Android API 34 or later**: Required for native transaction synchronization capabilities.
45+
- **Vulkan Rendering**: The device must be capable of rendering with Vulkan.
46+
47+
If these requirements are not met on the end-user device, Flutter will automatically fall back to the existing platform view strategy configured for the app.
48+
49+
### Opting In
50+
Because HCPP acts as a global upgrade for how platform views are backed, it is enabled via configuration rather than standard Dart initialization methods (`initAndroidView`, etc.).
51+
52+
You can enable HCPP using one of the following methods:
53+
54+
1. **Command Line Flag (Run/Test)**:
55+
Pass the `--enable-hcpp` flag to your `flutter run` or `flutter test` command:
56+
```bash
57+
flutter run --enable-hcpp
58+
```
59+
*Note: This flag is intended for local execution and testing. It cannot be passed to `flutter build` commands. For release builds, use the manifest configuration below.*
60+
61+
2. **AndroidManifest.xml**:
62+
Include a `<meta-data>` tag inside the `<application>` block of your `AndroidManifest.xml`:
63+
```xml
64+
<meta-data
65+
android:name="io.flutter.embedding.android.EnableHcpp"
66+
android:value="true" />
67+
```
68+
69+
### Limitations and Known Issues
70+
The following is a list of limitations and known issues. If you encounter an issue not listed below, please file an issue!
71+
- **SurfaceView Compatibility**: Opting in is currently not recommended if your application contains a platform view which is or contains a native [`SurfaceView`](https://developer.android.com/reference/android/view/SurfaceView) (often used by video players or map plugins), due to clipping issues. This is tracked in https://github.com/flutter/flutter/issues/175546.
72+
- **Complex Overlay Stacking**: Transparent platform views will not display correctly in layout stacks structured as: Flutter canvas -> Platform View -> Overlay -> Transparent Platform View, when all four of these layers intersect.
73+
3874
## Virtual Display
3975

4076
This mode works by rendering the platform view into [a `VirtualDisplay`](https://developer.android.com/reference/android/hardware/display/VirtualDisplay), whose contents are connected to [a Flutter `Texture`](https://api.flutter.dev/flutter/widgets/Texture-class.html).
@@ -61,6 +97,7 @@ In most cases this combines the best aspects of Virtual Display and Hybrid Compo
6197

6298
This display mode requires SDK 23 or later.
6399

100+
64101
# Selecting a mode
65102

66103
Usually Android platform views are created with one of the `init*` methods:

0 commit comments

Comments
 (0)