feat(settings): set the locale on iOS simulators and Android
Merged
IM
1d ago+747+747+012345678901234567890123456789-17-17-01234567890123456789
Summary
Refs #5005. settings timezone moved to #5127; this PR covers settings locale only.
Adds settings locale <locale-id|reset> for iPhone and iPad simulators and Android devices and emulators, using the value settings catalog form. Locale ids accept - or _ in any casing, normalize to BCP 47 tags (en-IN, zh-Hans-CN), refuse extensions and variants before dispatch, and refuse --app with setting_app_not_consumed. Each response reports previousLocale.
- iOS simulator: writes or deletes
AppleLanguagesandAppleLocalein the global domain viasimctl spawn defaults. Running apps adopt the new locale on relaunch. - Android: works on emulators, physical devices, and Limrun Android over adb. Adds
SystemLocaleCommandto the snapshot helper APK and runs it throughapp_processas the shell user soIActivityManager.updatePersistentConfigurationupdates running apps and persists across reboots.resetappliesro.product.locale. - Other targets (including Limrun iOS, tvOS, macOS, and Revyl) refuse with
UNSUPPORTED_OPERATION.
Before / after
$ agent-device settings locale en_IN --platform android --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+{"setting":"locale","state":"en-IN","locale":"en-IN","previousLocale":"en-US","message":"Locale set to en-IN"}
$ agent-device settings locale reset --platform android --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+{"setting":"locale","state":"reset","locale":"en-US","previousLocale":"en-IN","message":"Locale reset to the device default"}
$ agent-device settings locale en_IN --platform ios --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+{"setting":"locale","state":"en-IN","locale":"en-IN","previousLocale":"en-US","previousLanguages":["en-US","en-IN"],"warnings":["Running apps keep the old locale until they relaunch; run open <app> --relaunch."],"message":"Locale set to en-IN"}
Validation
- Base
3e0814c574, head489d001e08, rebased after #5127 merged. - Pixel 9 emulator (API 36) with the rebuilt snapshot helper APK:
en_INandresetverified withgetprop persist.sys.locale;settings timezonestill round-trips. - iPhone 17 Pro simulator (iOS 27.2):
en_INandresetverified withdefaults read -g AppleLocaleandAppleLanguages;settings timezonestill round-trips. - Focused suites: 224 passed (contracts, command-surface, daemon handler, Apple, Android, Limrun); 17 mutants each fail a test, including physical Android admission.
- Gate at
489d001e08:format,lint,typecheck,layering,fallow,native-dupes,build,provider-integration(324 passed),command-docs,docs-links, anddocs-prosepassed. Invitest-related, 4 provider-scenario tests timed out under host load; they pass inprovider-integration.