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

Unified Diff: build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java

Issue 1385893004: GN incremental_install: Enable lib copying for all devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 2 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: build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
index 8b7444a8c7c61c97ceb8dfb807d9c19733ed6702..c1682e81e049ebda1ab784f4b628f5c96a803b75 100644
--- a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
+++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
@@ -103,23 +103,13 @@ final class ClassLoaderPatcher {
*/
void importNativeLibs(File libDir) throws ReflectiveOperationException, IOException {
Log.i(TAG, "Importing native libraries from: " + libDir);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- libDir = prepareNativeLibsAndroidM(libDir);
- }
- addNativeLibrarySearchPath(libDir);
- }
-
- /**
- * Primary process: Copies native libraries into the app's data directory
- * Other processes: Waits for primary process to finish copying.
- */
- private File prepareNativeLibsAndroidM(File libDir) throws IOException {
+ // The library copying is not necessary on older devices, but we do it anyways to
+ // simplify things (it's fast compared to dexing).
+ // https://code.google.com/p/android/issues/detail?id=79480
File localLibsDir = new File(mAppFilesSubDir, "lib");
File copyLibsLockFile = new File(mAppFilesSubDir, "libcopy.lock");
- // Due to a new SELinux policy, all libs must be copied into the app's
- // data directory first.
- // https://code.google.com/p/android/issues/detail?id=79480
if (mIsPrimaryProcess) {
+ // Primary process: Copies native libraries into the app's data directory.
ensureAppFilesSubDirExists();
LockFile lockFile = LockFile.acquireRuntimeLock(copyLibsLockFile);
if (lockFile == null) {
@@ -135,13 +125,17 @@ final class ClassLoaderPatcher {
}
}
} else {
- // TODO: Work around this issue by using APK splits to install each dex / lib.
- throw new RuntimeException("Incremental install does not work on Android M+ "
- + "with isolated processes. Use the gn arg:\n"
- + " disable_incremental_isolated_processes=true\n"
- + "and try again.");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ // TODO: Work around this issue by using APK splits to install each dex / lib.
+ throw new RuntimeException("Incremental install does not work on Android M+ "
+ + "with isolated processes. Use the gn arg:\n"
+ + " disable_incremental_isolated_processes=true\n"
+ + "and try again.");
+ }
+ // Other processes: Waits for primary process to finish copying.
+ LockFile.waitForRuntimeLock(copyLibsLockFile, 10 * 1000);
}
- return localLibsDir;
+ addNativeLibrarySearchPath(localLibsDir);
}
@SuppressWarnings("unchecked")
@@ -194,6 +188,8 @@ final class ClassLoaderPatcher {
dest.setReadable(true, false);
dest.setExecutable(true, false);
dest.setLastModified(lastModified);
+ } else {
+ Log.i(TAG, "Up-to-date: " + dest);
}
}

Powered by Google App Engine
This is Rietveld 408576698