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

Unified Diff: base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java

Issue 1590243003: [Android] Rework multidex and enable multidex for unit_tests_apk. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed 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/multidex/ChromiumMultiDexInstaller.java
diff --git a/base/android/java/templates/ChromiumMultiDex.template b/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java
similarity index 94%
copy from base/android/java/templates/ChromiumMultiDex.template
copy to base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java
index 5580489cd53980d322d294713f10dcbdc7143f65..e4b30b94685fcd8c421df57be95c1217bf8ead86 100644
--- a/base/android/java/templates/ChromiumMultiDex.template
+++ b/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java
@@ -10,7 +10,6 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
-import android.os.Process;
import android.support.multidex.MultiDex;
import org.chromium.base.Log;
@@ -22,7 +21,7 @@ import java.lang.reflect.Method;
/**
* Performs multidex installation for non-isolated processes.
*/
-public class ChromiumMultiDex {
+public class ChromiumMultiDexInstaller {
private static final String TAG = "base_multidex";
@@ -38,7 +37,7 @@ public class ChromiumMultiDex {
* Isolated processes (e.g. renderer processes) can't load secondary dex files on
* K and below, so we don't even try in that case.
*
- * In release builds, this is a no-op because:
+ * In release builds of app apks (as opposed to test apks), this is a no-op because:
* - multidex isn't necessary in release builds because we run proguard there and
* thus aren't threatening to hit the dex limit; and
* - calling MultiDex.install, even in the absence of secondary dexes, causes a
@@ -47,8 +46,9 @@ public class ChromiumMultiDex {
* @param context The application context.
*/
@VisibleForTesting
-#if defined(MULTIDEX_CONFIGURATION_Debug)
public static void install(Context context) {
+ if (!ChromiumMultiDex.isMultidexEnabled()) return;
+
// TODO(jbudorick): Back out this version check once support for K & below works.
// http://crbug.com/512357
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
@@ -83,7 +83,7 @@ public class ChromiumMultiDex {
// Determines whether MultiDex should be installed for the current process. Isolated
// Processes should skip MultiDex as they can not actually access the files on disk.
// Privileged processes need ot have all of their dependencies in the MainDex for
- // performance reasons.
+ // performance reasons.
private static boolean shouldInstallMultiDex(Context context) {
try {
Method isIsolatedMethod =
@@ -99,7 +99,7 @@ public class ChromiumMultiDex {
String currentProcessName = getProcessName(context);
if (currentProcessName == null) return true;
-
+
PackageManager packageManager = context.getPackageManager();
try {
ApplicationInfo appInfo = packageManager.getApplicationInfo(context.getPackageName(),
@@ -110,9 +110,5 @@ public class ChromiumMultiDex {
return true;
}
}
-#else
- public static void install(Context context) {
- }
-#endif
}

Powered by Google App Engine
This is Rietveld 408576698