diff options
author | agrieve <agrieve@chromium.org> | 2015-10-05 17:37:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-06 00:39:30 +0000 |
commit | 31978e66f0c2ae00926292b37ce61bb19827836c (patch) | |
tree | 1f77a7455b3d126b7a1780fe23598e3695bd269f | |
parent | de281b568ad8d0249d6edd3040122e56c3b62dfe (diff) | |
download | chromium_src-31978e66f0c2ae00926292b37ce61bb19827836c.zip chromium_src-31978e66f0c2ae00926292b37ce61bb19827836c.tar.gz chromium_src-31978e66f0c2ae00926292b37ce61bb19827836c.tar.bz2 |
GN incremental_install: Enable lib copying for all devices
Some non-M devices seem to need it
BUG=520082
Review URL: https://codereview.chromium.org/1385893004
Cr-Commit-Position: refs/heads/master@{#352486}
3 files changed, 20 insertions, 23 deletions
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java index 5d3bf112..81e06a2 100644 --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java @@ -50,11 +50,11 @@ public final class BootstrapApplication extends Application { if (isFirstRun) { if (mClassLoaderPatcher.mIsPrimaryProcess) { // Wait for incremental_install.py to finish. - LockFile.waitForInstallerLock(installLockFile, 20 * 1000); + LockFile.waitForInstallerLock(installLockFile, 30 * 1000); } else { // Wait for the browser process to create the optimized dex files - // (and for M+, copy the library files). - LockFile.waitForInstallerLock(firstRunLockFile, 30 * 1000); + // and copy the library files. + LockFile.waitForInstallerLock(firstRunLockFile, 60 * 1000); } } 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 8b7444a..c1682e8 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); } } diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/LockFile.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/LockFile.java index 39256a6..6e48f3b 100644 --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/LockFile.java +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/LockFile.java @@ -99,6 +99,7 @@ final class LockFile { outputStream.close(); } catch (IOException e) { // Do nothing. We didn't get the lock. + Log.w(TAG, "Exception trying to acquire lock " + file, e); } return null; } |