Chromium Code Reviews| Index: base/android/java/src/org/chromium/base/BuildInfo.java |
| diff --git a/base/android/java/src/org/chromium/base/BuildInfo.java b/base/android/java/src/org/chromium/base/BuildInfo.java |
| index 215ee37452c96b9b550d83f8eb68b9647cd21376..c6d248d4a3c59353365a95167e163296c23f900a 100644 |
| --- a/base/android/java/src/org/chromium/base/BuildInfo.java |
| +++ b/base/android/java/src/org/chromium/base/BuildInfo.java |
| @@ -134,13 +134,25 @@ public class BuildInfo { |
| || TextUtils.equals("MNC", Build.VERSION.CODENAME); |
| } |
| + private static boolean isLanguageSplit(String splitName) { |
| + // Names look like "config.XX". |
| + return splitName.length() == 9 && splitName.startsWith("config."); |
|
Yaron
2015/07/08 21:31:22
we control the split name, don't we? can we make i
agrieve
2015/07/09 00:11:30
Yeah, I don't love this either, but we don't contr
|
| + } |
| + |
| @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| @CalledByNative |
| - public static boolean hasApkSplits(Context context) { |
| + public static boolean hasLanguageApkSplits(Context context) { |
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { |
| return false; |
| } |
| - ApplicationInfo appInfo = context.getApplicationInfo(); |
| - return appInfo.splitSourceDirs != null && appInfo.splitSourceDirs.length > 0; |
| + PackageInfo packageInfo = PackageUtils.getOwnPackageInfo(context); |
| + if (packageInfo.splitNames != null) { |
| + for (int i = 0; i < packageInfo.splitNames.length; ++i) { |
| + if (isLanguageSplit(packageInfo.splitNames[i])) { |
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| } |
| } |