| 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 54f611d5092ea4595f5d07b6345952d039bd144f..1b91d396bf51b5525600ae3d52ee05027130cd5c 100644
|
| --- a/base/android/java/src/org/chromium/base/BuildInfo.java
|
| +++ b/base/android/java/src/org/chromium/base/BuildInfo.java
|
| @@ -4,12 +4,14 @@
|
|
|
| package org.chromium.base;
|
|
|
| +import android.annotation.TargetApi;
|
| import android.content.Context;
|
| import android.content.pm.ApplicationInfo;
|
| import android.content.pm.PackageInfo;
|
| import android.content.pm.PackageManager;
|
| import android.content.pm.PackageManager.NameNotFoundException;
|
| import android.os.Build;
|
| +import android.text.TextUtils;
|
| import android.util.Log;
|
|
|
| /**
|
| @@ -122,4 +124,35 @@ public class BuildInfo {
|
| public static int getSdkInt() {
|
| return Build.VERSION.SDK_INT;
|
| }
|
| +
|
| + /**
|
| + * @return Whether the Android build is M or later.
|
| + */
|
| + public static boolean isMncOrLater() {
|
| + // TODO(bauerb): Update this once the SDK is updated.
|
| + return Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1
|
| + || TextUtils.equals("MNC", Build.VERSION.CODENAME);
|
| + }
|
| +
|
| + private static boolean isLanguageSplit(String splitName) {
|
| + // Names look like "config.XX".
|
| + return splitName.length() == 9 && splitName.startsWith("config.");
|
| + }
|
| +
|
| + @TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
| + @CalledByNative
|
| + public static boolean hasLanguageApkSplits(Context context) {
|
| + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
| + return false;
|
| + }
|
| + 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;
|
| + }
|
| }
|
|
|