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

Side by Side Diff: base/android/java/src/org/chromium/base/BuildInfo.java

Issue 1227793002: Change BuildInfo.hasApkSplits -> BuildInfo.hasLanguageApkSplits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.pm.ApplicationInfo; 9 import android.content.pm.ApplicationInfo;
10 import android.content.pm.PackageInfo; 10 import android.content.pm.PackageInfo;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 /** 128 /**
129 * @return Whether the Android build is M or later. 129 * @return Whether the Android build is M or later.
130 */ 130 */
131 public static boolean isMncOrLater() { 131 public static boolean isMncOrLater() {
132 // TODO(bauerb): Update this once the SDK is updated. 132 // TODO(bauerb): Update this once the SDK is updated.
133 return Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1 133 return Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1
134 || TextUtils.equals("MNC", Build.VERSION.CODENAME); 134 || TextUtils.equals("MNC", Build.VERSION.CODENAME);
135 } 135 }
136 136
137 private static boolean isLanguageSplit(String splitName) {
138 // Names look like "config.XX".
139 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
140 }
141
137 @TargetApi(Build.VERSION_CODES.LOLLIPOP) 142 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
138 @CalledByNative 143 @CalledByNative
139 public static boolean hasApkSplits(Context context) { 144 public static boolean hasLanguageApkSplits(Context context) {
140 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 145 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
141 return false; 146 return false;
142 } 147 }
143 ApplicationInfo appInfo = context.getApplicationInfo(); 148 PackageInfo packageInfo = PackageUtils.getOwnPackageInfo(context);
144 return appInfo.splitSourceDirs != null && appInfo.splitSourceDirs.length > 0; 149 if (packageInfo.splitNames != null) {
150 for (int i = 0; i < packageInfo.splitNames.length; ++i) {
151 if (isLanguageSplit(packageInfo.splitNames[i])) {
152 return true;
153 }
154 }
155 }
156 return false;
145 } 157 }
146 } 158 }
OLDNEW
« no previous file with comments | « base/android/build_info.cc ('k') | chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698