@@ -28,6 +28,8 @@ static PlatformData GetDefaultPlatformData() {
2828 return platform_data;
2929}
3030
31+ bool AndroidShellHolder::use_embedded_view;
32+
3133AndroidShellHolder::AndroidShellHolder (
3234 flutter::Settings settings,
3335 std::shared_ptr<PlatformViewAndroidJNI> jni_facade,
@@ -100,21 +102,47 @@ AndroidShellHolder::AndroidShellHolder(
100102 ui_runner = thread_host_.ui_thread ->GetTaskRunner ();
101103 io_runner = thread_host_.io_thread ->GetTaskRunner ();
102104 }
103-
104- flutter::TaskRunners task_runners (thread_label, // label
105- platform_runner, // platform
106- gpu_runner, // raster
107- ui_runner, // ui
108- io_runner // io
109- );
110-
111- shell_ =
112- Shell::Create (task_runners, // task runners
113- GetDefaultPlatformData (), // window data
114- settings_, // settings
115- on_create_platform_view, // platform view create callback
116- on_create_rasterizer // rasterizer create callback
117- );
105+ if (settings.use_embedded_view ) {
106+ use_embedded_view = true ;
107+ // Embedded views requires the gpu and the platform views to be the same.
108+ // The plan is to eventually dynamically merge the threads when there's a
109+ // platform view in the layer tree.
110+ // For now we use a fixed thread configuration with the same thread used as
111+ // the gpu and platform task runner.
112+ // TODO(amirh/chinmaygarde): remove this, and dynamically change the thread
113+ // configuration. https://github.com/flutter/flutter/issues/23975
114+ // https://github.com/flutter/flutter/issues/59930
115+ flutter::TaskRunners task_runners (thread_label, // label
116+ platform_runner, // platform
117+ platform_runner, // raster
118+ ui_runner, // ui
119+ io_runner // io
120+ );
121+
122+ shell_ =
123+ Shell::Create (task_runners, // task runners
124+ GetDefaultPlatformData (), // window data
125+ settings_, // settings
126+ on_create_platform_view, // platform view create callback
127+ on_create_rasterizer // rasterizer create callback
128+ );
129+ } else {
130+ use_embedded_view = false ;
131+ flutter::TaskRunners task_runners (thread_label, // label
132+ platform_runner, // platform
133+ gpu_runner, // raster
134+ ui_runner, // ui
135+ io_runner // io
136+ );
137+
138+ shell_ =
139+ Shell::Create (task_runners, // task runners
140+ GetDefaultPlatformData (), // window data
141+ settings_, // settings
142+ on_create_platform_view, // platform view create callback
143+ on_create_rasterizer // rasterizer create callback
144+ );
145+ }
118146
119147 platform_view_ = weak_platform_view;
120148 FML_DCHECK (platform_view_);
0 commit comments