Index: chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java |
index 2bc3b02203fd46930206cfef716637ac6e134122..19210e4da260ef8404c57480044a4c4b16ec803d 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java |
@@ -39,6 +39,7 @@ import org.chromium.content.browser.ChildProcessCreationParams; |
import org.chromium.ui.base.DeviceFormFactor; |
import java.lang.reflect.Field; |
+import java.util.Locale; |
/** |
* An activity that talks with application and activity level delegates for async initialization. |
@@ -77,6 +78,8 @@ public abstract class AsyncInitializationActivity extends AppCompatActivity impl |
protected void attachBaseContext(Context newBase) { |
super.attachBaseContext(newBase); |
Theresa
2016/08/29 20:44:23
Let's add a check here to return early if the SDK
Ian Wen
2016/08/29 21:03:47
Done.
|
+ Configuration overrideConfiguration = null; |
+ |
// On N+, Chrome should always retain the tab strip layout on tablets. Normally in |
// multi-window, if Chrome is launched into a smaller screen Android will load the tab |
// switcher resources. Overriding the smallestScreenWidthDp in the Configuration ensures |
@@ -85,11 +88,21 @@ public abstract class AsyncInitializationActivity extends AppCompatActivity impl |
int smallestDeviceWidthDp = DeviceFormFactor.getSmallestDeviceWidthDp(this); |
if (smallestDeviceWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) { |
- Configuration overrideConfiguration = new Configuration(); |
+ overrideConfiguration = new Configuration(); |
overrideConfiguration.smallestScreenWidthDp = smallestDeviceWidthDp; |
- applyOverrideConfiguration(overrideConfiguration); |
} |
} |
+ |
+ // Before Android N, zh_HK is not well supported. Here we fall back manually to TW locale. |
jungshik at Google
2016/08/29 21:19:42
The above is not an accurate statement.
zh-HK (a
Ian Wen
2016/08/29 21:34:03
Indeed. Done.
|
+ // Since Android N, zh_HK will be automatically handled by the framework properly. |
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { |
+ if ("HK".equals(Locale.getDefault().getCountry())) { |
Theresa
2016/08/29 20:44:23
Do we want to add Macau as well?
Ian Wen
2016/08/29 21:03:47
Probably not. Macau is only an option after Androi
jungshik at Google
2016/08/29 21:19:42
Android OEMs can add zh-MO, zh-SG and whatever loc
Ian Wen
2016/08/29 21:34:03
What you said is correct in theory, but I failed t
|
+ if (overrideConfiguration == null) overrideConfiguration = new Configuration(); |
+ overrideConfiguration.setLocale(Locale.TAIWAN); |
+ } |
+ } |
+ |
+ if (overrideConfiguration != null) applyOverrideConfiguration(overrideConfiguration); |
} |
@Override |