Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify changing locale #379

Merged
merged 3 commits into from
Nov 14, 2018

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Nov 14, 2018

Currently, Appium tries to reboot devices when a user change locale since Appium change locales via adb command for API level 23- devices. It doesn't work for real devices without root permission.

We don't need to reboot devices if we change them through io.appium.setting while we need to set language and locale in caps so far. <= breaking change. (We can keep previous spec if we update io.appium.settings)

I ensured this works on Android 4.2(api level 17) and 6.0(api level 23) real devices.

Below log is an example to change locale via persist.sys.locale (but it does not work)

[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell appops set io.appium.settings android\:mock_location allow'
[debug] [ADB] Device API level: 23
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell getprop persist.sys.locale'
[debug] [ADB] Current device property 'persist.sys.locale': ja-JP
[debug] [ADB] Current locale: 'ja-JP'; requested locale: 'en-US'
[debug] [ADB] Device API level: 23
[debug] [ADB] Setting device property 'persist.sys.locale' to 'en-US'
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell setprop persist.sys.locale en-US'
[ADB] Rebooting the device in order to apply new locale via 'setting persist.sys.locale' command.
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell stop'
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell setprop sys.boot_completed 0'
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell start'
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell getprop sys.boot_completed'
[debug] [ADB] Current device property 'sys.boot_completed': 1
[debug] [ADB] Device API level: 23
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell getprop persist.sys.locale'
[debug] [ADB] Current device property 'persist.sys.locale': ja-JP
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Called deleteSession but bootstrap wasn't active
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s CB5A22LZ79 shell am force-stop io.appium.unlock'

@KazuCocoa KazuCocoa changed the title simplify to change locale simplify changing locale Nov 14, 2018
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@KazuCocoa KazuCocoa merged commit d84ff5d into appium:master Nov 14, 2018
@KazuCocoa KazuCocoa deleted the use-settings-app-to-change-locale branch November 14, 2018 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants