Where does Android take default timezone from?

前端 未结 3 484
小鲜肉
小鲜肉 2021-01-18 07:37

Where does Android device take default timezone from?

Example - you boot a brand new Android device and there is Setup Wizard with \"Date & time\" activity where

3条回答
  •  一整个雨季
    2021-01-18 08:05

    Here is long post about the setting timezone. https://blog.csdn.net/victoryckl/article/details/7969433 It's in Chinese so use translate.

    Here is main points how to set locale and timezone

    The original android code, the system default language is English, generally need to be changed to the default Chinese, a lot of methods of modification:

    1. Modify the PRODUCT_LOCALES field, Put the language you want to choose first, such as: PRODUCT_LOCALES := en_US zh_CN The default language is English, copy it from build/target/product/sdk.mk and paste it into device/{hardware platform}/{product}. In mk, put zh_CN in the first place. Or paste directly into build/target/product/core.mk and all branches inherit this setting.

    2. Modify device/{hardware platform}/{product}/system.prop or default.prop and add:

    [persist.sys.language]: [zh]

    [persist.sys.country]: [CN]

    [persist.sys.localevar]: []

    [persist.sys.timezone]: [Asia/Shanghai]

    [ro.product.locale.language]: [zh]

    [ro.product.locale.region]: [CN]

    1. Modify init.rc and add:

    Setprop persist.sys.language en

    Setprop persist.sys.country CN

    Setprop persist.sys.localevar

    Setprop persist.sys.timezone Asia/Shanghai

    Setprop ro.product.locale.language en

    Setprop ro.product.locale.region CN

    This method has a problem, because it will be executed every time you boot, so the language is the default language after each boot.

    1. Modify device/{hardware platform}/{product}/device.mk and add : PRODUCT_PROPERTY_OVERRIDES += \

    Persist.sys.language=zh \

    Persist.sys.country=CN \

    Persist.sys.localevar= "" \

    Persist.sys.timezone=Asia/Shanghai \

    Ro.product.locale.language=zh \

    Ro.product.locale.region=CN

    I am using the fourth. Note that the quotes above cannot be removed, otherwise the two lines will become one line in build.prop:

    Persist.sys.localevar= persist.sys.timezone=Asia/Shanghai

    This will result in the value of persist.sys.timezone not being obtained, and the time zone is still incorrect.

    1. Modify build/tools/buildinfo.sh:

    Echo "persist.sys.language=zh"

    Echo "persist.sys.country=CN"

    Echo " persist.sys.localevar= "

    Echo "persist.sys.timezone=Asia/Shanghai"

    Echo "ro.product.locale.language=zh"

    Echo "ro.product.locale.region=CN"

提交回复
热议问题