Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit dcfecdb

Browse files
[engine] make UI thread the platform thread for Android. Still allows opt out as g3 escape hatch. (#55111)
Part of flutter/flutter#150525
1 parent 19bee37 commit dcfecdb

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

common/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct Settings {
231231

232232
// If true, the UI thread is the platform thread on supported
233233
// platforms.
234-
bool merged_platform_ui_thread = false;
234+
bool merged_platform_ui_thread = true;
235235

236236
// Log a warning during shell initialization if Impeller is not enabled.
237237
bool warn_on_impeller_opt_out = false;

shell/platform/android/android_shell_holder.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ AndroidShellHolder::AndroidShellHolder(
140140
fml::MessageLoop::GetCurrent().GetTaskRunner();
141141
raster_runner = thread_host_->raster_thread->GetTaskRunner();
142142
if (settings.merged_platform_ui_thread) {
143-
FML_LOG(IMPORTANT)
144-
<< "Warning: Using highly experimental merged thread mode.";
145143
ui_runner = platform_runner;
146144
} else {
147145
ui_runner = thread_host_->ui_thread->GetTaskRunner();

shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,12 @@ public void ensureInitializationComplete(
361361
if (metaData.getBoolean(IMPELLER_VULKAN_GPU_TRACING_DATA_KEY, false)) {
362362
shellArgs.add("--enable-vulkan-gpu-tracing");
363363
}
364-
if (metaData.getBoolean(ENABLED_MERGED_PLATFORM_UI_THREAD_KEY, false)) {
365-
shellArgs.add("--enable-merged-platform-ui-thread");
364+
if (metaData.containsKey(ENABLED_MERGED_PLATFORM_UI_THREAD_KEY)) {
365+
if (metaData.getBoolean(ENABLED_MERGED_PLATFORM_UI_THREAD_KEY)) {
366+
shellArgs.add("--enable-merged-platform-ui-thread");
367+
} else {
368+
shellArgs.add("--no-enable-merged-platform-ui-thread");
369+
}
366370
}
367371
String backend = metaData.getString(IMPELLER_BACKEND_META_DATA_KEY);
368372
if (backend != null) {

shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,6 @@ static BOOL DoesHardwareSupportWideGamut() {
208208
settings.enable_dart_profiling = enableDartProfiling.boolValue;
209209
}
210210

211-
NSNumber* enableMergedPlatformUIThread =
212-
[mainBundle objectForInfoDictionaryKey:@"FLTEnableMergedPlatformUIThread"];
213-
if (enableMergedPlatformUIThread != nil) {
214-
settings.merged_platform_ui_thread = enableMergedPlatformUIThread.boolValue;
215-
}
216-
217211
// Leak Dart VM settings, set whether leave or clean up the VM after the last shell shuts down.
218212
NSNumber* leakDartVM = [mainBundle objectForInfoDictionaryKey:@"FLTLeakDartVM"];
219213
// It will change the default leak_vm value in settings only if the key exists.

shell/platform/darwin/ios/framework/Source/FlutterEngineTest.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ - (void)testEnableSemanticsWhenFlutterViewAccessibilityDidCall {
472472

473473
- (void)testCanMergePlatformAndUIThread {
474474
auto settings = FLTDefaultSettingsForBundle();
475-
settings.merged_platform_ui_thread = true;
476475
settings.enable_impeller = true;
477476
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
478477
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
@@ -484,7 +483,6 @@ - (void)testCanMergePlatformAndUIThread {
484483

485484
- (void)testCanNotUnMergePlatformAndUIThread {
486485
auto settings = FLTDefaultSettingsForBundle();
487-
settings.merged_platform_ui_thread = false;
488486
settings.enable_impeller = true;
489487
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
490488
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];

0 commit comments

Comments
 (0)