| 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 c1682e81e049ebda1ab784f4b628f5c96a803b75..c382799003489ba328a4b60fd7290c5218b53554 100644
|
| --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
|
| +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
|
| @@ -103,6 +103,10 @@ final class ClassLoaderPatcher {
|
| */
|
| void importNativeLibs(File libDir) throws ReflectiveOperationException, IOException {
|
| Log.i(TAG, "Importing native libraries from: " + libDir);
|
| + if (!libDir.exists()) {
|
| + Log.i(TAG, "No native libs exist.");
|
| + return;
|
| + }
|
| // 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
|
| @@ -169,28 +173,34 @@ final class ClassLoaderPatcher {
|
|
|
| private static void copyChangedFiles(File srcDir, File dstDir) throws IOException {
|
| // No need to delete stale libs since libraries are loaded explicitly.
|
| + int numNotChanged = 0;
|
| for (File f : srcDir.listFiles()) {
|
| // Note: Tried using hardlinks, but resulted in EACCES exceptions.
|
| File dest = new File(dstDir, f.getName());
|
| - copyIfModified(f, dest);
|
| + if (!copyIfModified(f, dest)) {
|
| + numNotChanged++;
|
| + }
|
| + }
|
| + if (numNotChanged > 0) {
|
| + Log.i(TAG, numNotChanged + " libs already up-to-date.");
|
| }
|
| }
|
|
|
| - private static void copyIfModified(File src, File dest) throws IOException {
|
| + private static boolean copyIfModified(File src, File dest) throws IOException {
|
| long lastModified = src.lastModified();
|
| - if (!dest.exists() || dest.lastModified() != lastModified) {
|
| - Log.i(TAG, "Copying " + src + " -> " + dest);
|
| - FileInputStream istream = new FileInputStream(src);
|
| - FileOutputStream ostream = new FileOutputStream(dest);
|
| - ostream.getChannel().transferFrom(istream.getChannel(), 0, istream.getChannel().size());
|
| - istream.close();
|
| - ostream.close();
|
| - dest.setReadable(true, false);
|
| - dest.setExecutable(true, false);
|
| - dest.setLastModified(lastModified);
|
| - } else {
|
| - Log.i(TAG, "Up-to-date: " + dest);
|
| + if (dest.exists() && dest.lastModified() == lastModified) {
|
| + return false;
|
| }
|
| + Log.i(TAG, "Copying " + src + " -> " + dest);
|
| + FileInputStream istream = new FileInputStream(src);
|
| + FileOutputStream ostream = new FileOutputStream(dest);
|
| + ostream.getChannel().transferFrom(istream.getChannel(), 0, istream.getChannel().size());
|
| + istream.close();
|
| + ostream.close();
|
| + dest.setReadable(true, false);
|
| + dest.setExecutable(true, false);
|
| + dest.setLastModified(lastModified);
|
| + return true;
|
| }
|
|
|
| private void ensureAppFilesSubDirExists() {
|
|
|