Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: base/android/java/src/org/chromium/base/BuildInfo.java

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698