Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.incrementalinstall; | 5 package org.chromium.incrementalinstall; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.util.Log; | 9 import android.util.Log; |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 addNativeLibrarySearchPath(libDir); | 109 addNativeLibrarySearchPath(libDir); |
| 110 } | 110 } |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Primary process: Copies native libraries into the app's data directory | 113 * Primary process: Copies native libraries into the app's data directory |
| 114 * Other processes: Waits for primary process to finish copying. | 114 * Other processes: Waits for primary process to finish copying. |
| 115 */ | 115 */ |
| 116 private File prepareNativeLibsAndroidM(File libDir) throws IOException { | 116 private File prepareNativeLibsAndroidM(File libDir) throws IOException { |
| 117 File localLibsDir = new File(mAppFilesSubDir, "lib"); | 117 File localLibsDir = new File(mAppFilesSubDir, "lib"); |
| 118 File copyLibsLockFile = new File(mAppFilesSubDir, "libcopy.lock"); | 118 File copyLibsLockFile = new File(mAppFilesSubDir, "libcopy.lock"); |
| 119 // Due to a new SELinux policy, all libs must be copied into the app's | |
| 120 // data directory first. | |
| 121 // https://code.google.com/p/android/issues/detail?id=79480 | |
|
pkotwicz
2015/10/05 19:39:39
Did you mean to remove this comment?
agrieve
2015/10/05 19:45:35
Done.
| |
| 122 if (mIsPrimaryProcess) { | 119 if (mIsPrimaryProcess) { |
| 120 // Primary process: Copies native libraries into the app's data dire ctory. | |
| 121 ensureAppFilesSubDirExists(); | |
| 123 LockFile lockFile = LockFile.acquireRuntimeLock(copyLibsLockFile); | 122 LockFile lockFile = LockFile.acquireRuntimeLock(copyLibsLockFile); |
| 124 if (lockFile == null) { | 123 if (lockFile == null) { |
| 125 LockFile.waitForRuntimeLock(copyLibsLockFile, 10 * 1000); | 124 LockFile.waitForRuntimeLock(copyLibsLockFile, 10 * 1000); |
| 126 } else { | 125 } else { |
| 127 try { | 126 try { |
| 128 ensureAppFilesSubDirExists(); | |
| 129 localLibsDir.mkdir(); | 127 localLibsDir.mkdir(); |
| 130 localLibsDir.setReadable(true, false); | 128 localLibsDir.setReadable(true, false); |
| 131 localLibsDir.setExecutable(true, false); | 129 localLibsDir.setExecutable(true, false); |
| 132 copyChangedFiles(libDir, localLibsDir); | 130 copyChangedFiles(libDir, localLibsDir); |
| 133 } finally { | 131 } finally { |
| 134 lockFile.release(); | 132 lockFile.release(); |
| 135 } | 133 } |
| 136 } | 134 } |
| 137 } else { | 135 } else { |
| 138 // TODO: Work around this issue by using APK splits to install each dex / lib. | 136 // TODO: Work around this issue by using APK splits to install each dex / lib. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 Object[] entries = new Object[files.length]; | 221 Object[] entries = new Object[files.length]; |
| 224 File emptyDir = new File(""); | 222 File emptyDir = new File(""); |
| 225 for (int i = 0; i < files.length; ++i) { | 223 for (int i = 0; i < files.length; ++i) { |
| 226 File file = files[i]; | 224 File file = files[i]; |
| 227 Object dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, op timizedDirectory); | 225 Object dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, op timizedDirectory); |
| 228 entries[i] = Reflect.newInstance(entryClazz, emptyDir, false, file, dexFile); | 226 entries[i] = Reflect.newInstance(entryClazz, emptyDir, false, file, dexFile); |
| 229 } | 227 } |
| 230 return entries; | 228 return entries; |
| 231 } | 229 } |
| 232 } | 230 } |
| OLD | NEW |