diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 28f63897576e5..645e54e3879dd 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -88,22 +88,6 @@ void _updateLocales(List locales) { _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } -@pragma('vm:entry-point') -// ignore: unused_element -void _updatePlatformResolvedLocale(List localeData) { - if (localeData.length != 4) { - return; - } - final String countryCode = localeData[1]; - final String scriptCode = localeData[2]; - - window._platformResolvedLocale = Locale.fromSubtags( - languageCode: localeData[0], - countryCode: countryCode.isEmpty ? null : countryCode, - scriptCode: scriptCode.isEmpty ? null : scriptCode, - ); -} - @pragma('vm:entry-point') // ignore: unused_element void _updateUserSettingsData(String jsonData) { diff --git a/lib/ui/window.dart b/lib/ui/window.dart index f6c2b2aed4ac8..d9edf7c793d38 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -796,19 +796,6 @@ class Window { List? get locales => _locales; List? _locales; - /// The locale that the platform's native locale resolution system resolves to. - /// - /// This value may differ between platforms and is meant to allow Flutter's locale - /// resolution algorithms access to a locale that is consistent with other apps - /// on the device. Using this property is optional. - /// - /// This value may be used in a custom [localeListResolutionCallback] or used directly - /// in order to arrive at the most appropriate locale for the app. - /// - /// See [locales], which is the list of locales the user/device prefers. - Locale? get platformResolvedLocale => _platformResolvedLocale; - Locale? _platformResolvedLocale; - /// Performs the platform-native locale resolution. /// /// Each platform may return different results. diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index 5fc30a613ed20..7c1c0fa2ce421 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -224,19 +224,6 @@ void Window::UpdateLocales(const std::vector& locales) { })); } -void Window::UpdatePlatformResolvedLocale( - const std::vector& locale) { - std::shared_ptr dart_state = library_.dart_state().lock(); - if (!dart_state) - return; - tonic::DartState::Scope scope(dart_state); - tonic::LogIfError(tonic::DartInvokeField( - library_.value(), "_updatePlatformResolvedLocale", - { - tonic::ToDart>(locale), - })); -} - void Window::UpdateUserSettingsData(const std::string& data) { std::shared_ptr dart_state = library_.dart_state().lock(); if (!dart_state) diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index f763421df8a57..95055c70beddb 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -78,7 +78,6 @@ class Window final { void DidCreateIsolate(); void UpdateWindowMetrics(const ViewportMetrics& metrics); void UpdateLocales(const std::vector& locales); - void UpdatePlatformResolvedLocale(const std::vector& locale); void UpdateUserSettingsData(const std::string& data); void UpdateLifecycleState(const std::string& data); void UpdateSemanticsEnabled(bool enabled); diff --git a/lib/web_ui/lib/src/engine/window.dart b/lib/web_ui/lib/src/engine/window.dart index d396a3faa966a..dc764de1e76ee 100644 --- a/lib/web_ui/lib/src/engine/window.dart +++ b/lib/web_ui/lib/src/engine/window.dart @@ -303,10 +303,6 @@ class EngineWindow extends ui.Window { return locales; } - /// On the web "platform" is the browser, so it's the same as [locale]. - @override - ui.Locale get platformResolvedLocale => locale; - /// Engine code should use this method instead of the callback directly. /// Otherwise zones won't work properly. void invokeOnLocaleChanged() { diff --git a/lib/web_ui/lib/src/ui/window.dart b/lib/web_ui/lib/src/ui/window.dart index ca49014d0c818..aab9bdc6a1349 100644 --- a/lib/web_ui/lib/src/ui/window.dart +++ b/lib/web_ui/lib/src/ui/window.dart @@ -604,18 +604,6 @@ abstract class Window { /// observe when this value changes. List? get locales; - /// The locale that the platform's native locale resolution system resolves to. - /// - /// This value may differ between platforms and is meant to allow flutter locale - /// resolution algorithms to into resolving consistently with other apps on the - /// device. - /// - /// This value may be used in a custom [localeListResolutionCallback] or used directly - /// in order to arrive at the most appropriate locale for the app. - /// - /// See [locales], which is the list of locales the user/device prefers. - Locale? get platformResolvedLocale; - /// Performs the platform-native locale resolution. /// /// Each platform may return different results. diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 66a57994705de..aa557d2abf716 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -131,8 +131,6 @@ std::unique_ptr RuntimeController::Clone() const { bool RuntimeController::FlushRuntimeStateToIsolate() { return SetViewportMetrics(window_data_.viewport_metrics) && SetLocales(window_data_.locale_data) && - SetPlatformResolvedLocale( - window_data_.platform_resolved_locale_data) && SetSemanticsEnabled(window_data_.semantics_enabled) && SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) && SetUserSettingsData(window_data_.user_settings_data) && @@ -161,18 +159,6 @@ bool RuntimeController::SetLocales( return false; } -bool RuntimeController::SetPlatformResolvedLocale( - const std::vector& locale_data) { - window_data_.platform_resolved_locale_data = locale_data; - - if (auto* window = GetWindowIfAvailable()) { - window->UpdatePlatformResolvedLocale(locale_data); - return true; - } - - return false; -} - bool RuntimeController::SetUserSettingsData(const std::string& data) { window_data_.user_settings_data = data; diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 3ac276c624746..ad89cbeae064b 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -161,23 +161,6 @@ class RuntimeController final : public WindowClient { /// bool SetLocales(const std::vector& locale_data); - //---------------------------------------------------------------------------- - /// @brief Forward the specified locale data to the running isolate. If - /// the isolate is not running, this data will be saved and - /// flushed to the isolate when it starts running. - /// - /// - /// @deprecated The persistent isolate data must be used for this purpose - /// instead. - /// - /// @param[in] locale_data The locale data. This should consist of a vector - /// of 4 strings, representing languageCode, contryCode, - /// scriptCode, and variant of the locale. - /// - /// @return If the locale data was forwarded to the running isolate. - /// - bool SetPlatformResolvedLocale(const std::vector& locale_data); - //---------------------------------------------------------------------------- /// @brief Forward the user settings data to the running isolate. If the /// isolate is not running, this data will be saved and flushed to diff --git a/runtime/window_data.h b/runtime/window_data.h index be29720f99bf9..e234d2f558162 100644 --- a/runtime/window_data.h +++ b/runtime/window_data.h @@ -36,7 +36,6 @@ struct WindowData { std::string script_code; std::string variant_code; std::vector locale_data; - std::vector platform_resolved_locale_data; std::string user_settings_data = "{}"; std::string lifecycle_state; bool semantics_enabled = false; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index a5d8a8050d0b9..7428cbf49828e 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -388,24 +388,6 @@ bool Engine::HandleLocalizationPlatformMessage(PlatformMessage* message) { } return runtime_controller_->SetLocales(locale_data); - } else if (method->value == "setPlatformResolvedLocale") { - // Decode and pass the single locale data onwards to dart. - auto args = root.FindMember("args"); - if (args == root.MemberEnd() || !args->value.IsArray()) - return false; - - if (args->value.Size() != strings_per_locale) - return false; - - std::vector locale_data; - if (!args->value[0].IsString() || !args->value[1].IsString()) - return false; - locale_data.push_back(args->value[0].GetString()); - locale_data.push_back(args->value[1].GetString()); - locale_data.push_back(args->value[2].GetString()); - locale_data.push_back(args->value[3].GetString()); - - return runtime_controller_->SetPlatformResolvedLocale(locale_data); } return false; } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index 0f3ef7f0cf1d0..5bad59cad8a7e 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -48,20 +48,4 @@ public void sendLocales(@NonNull List locales) { } channel.invokeMethod("setLocale", data); } - - /** Send the given {@code platformResolvedLocale} to Dart. */ - public void sendPlatformResolvedLocales(Locale platformResolvedLocale) { - Log.v(TAG, "Sending Locales to Flutter."); - // Send platformResolvedLocale first as it may be used in the callback - // triggered by the user supported locales being updated/set. - if (platformResolvedLocale != null) { - List platformResolvedLocaleData = new ArrayList<>(); - platformResolvedLocaleData.add(platformResolvedLocale.getLanguage()); - platformResolvedLocaleData.add(platformResolvedLocale.getCountry()); - platformResolvedLocaleData.add( - Build.VERSION.SDK_INT >= 21 ? platformResolvedLocale.getScript() : ""); - platformResolvedLocaleData.add(platformResolvedLocale.getVariant()); - channel.invokeMethod("setPlatformResolvedLocale", platformResolvedLocaleData); - } - } } diff --git a/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m b/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m index 3648eb9caa57f..9b0f699eebe72 100644 --- a/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m +++ b/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m @@ -33,10 +33,6 @@ - (void)testNoLocalePrepend { XCTAssertTrue([textInputSemanticsObject waitForExistenceWithTimeout:timeout]); [textInputSemanticsObject tap]; - - // [NSLocale currentLocale] always includes a country code. - textInputSemanticsObject = [self.application.textFields matchingIdentifier:@"en_US"].element; - XCTAssertTrue([textInputSemanticsObject waitForExistenceWithTimeout:timeout]); } @end diff --git a/testing/scenario_app/lib/src/locale_initialization.dart b/testing/scenario_app/lib/src/locale_initialization.dart index e19bc418a98b3..4a343ff9140d8 100644 --- a/testing/scenario_app/lib/src/locale_initialization.dart +++ b/testing/scenario_app/lib/src/locale_initialization.dart @@ -78,7 +78,7 @@ class LocaleInitialization extends Scenario { String label; switch(_tapCount) { case 1: { - label = window.platformResolvedLocale.toString(); + // Set label to string data we wish to pass on first frame. break; } // Expand for other test cases.