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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 119 // Due to a new SELinux policy, all libs must be copied into the app's |
120 // data directory first. | 120 // data directory first. |
121 // https://code.google.com/p/android/issues/detail?id=79480 | 121 // https://code.google.com/p/android/issues/detail?id=79480 |
122 if (mIsPrimaryProcess) { | 122 if (mIsPrimaryProcess) { |
| 123 ensureAppFilesSubDirExists(); |
123 LockFile lockFile = LockFile.acquireRuntimeLock(copyLibsLockFile); | 124 LockFile lockFile = LockFile.acquireRuntimeLock(copyLibsLockFile); |
124 if (lockFile == null) { | 125 if (lockFile == null) { |
125 LockFile.waitForRuntimeLock(copyLibsLockFile, 10 * 1000); | 126 LockFile.waitForRuntimeLock(copyLibsLockFile, 10 * 1000); |
126 } else { | 127 } else { |
127 try { | 128 try { |
128 ensureAppFilesSubDirExists(); | |
129 localLibsDir.mkdir(); | 129 localLibsDir.mkdir(); |
130 localLibsDir.setReadable(true, false); | 130 localLibsDir.setReadable(true, false); |
131 localLibsDir.setExecutable(true, false); | 131 localLibsDir.setExecutable(true, false); |
132 copyChangedFiles(libDir, localLibsDir); | 132 copyChangedFiles(libDir, localLibsDir); |
133 } finally { | 133 } finally { |
134 lockFile.release(); | 134 lockFile.release(); |
135 } | 135 } |
136 } | 136 } |
137 } else { | 137 } else { |
138 // TODO: Work around this issue by using APK splits to install each
dex / lib. | 138 // 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]; | 223 Object[] entries = new Object[files.length]; |
224 File emptyDir = new File(""); | 224 File emptyDir = new File(""); |
225 for (int i = 0; i < files.length; ++i) { | 225 for (int i = 0; i < files.length; ++i) { |
226 File file = files[i]; | 226 File file = files[i]; |
227 Object dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, op
timizedDirectory); | 227 Object dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, op
timizedDirectory); |
228 entries[i] = Reflect.newInstance(entryClazz, emptyDir, false, file,
dexFile); | 228 entries[i] = Reflect.newInstance(entryClazz, emptyDir, false, file,
dexFile); |
229 } | 229 } |
230 return entries; | 230 return entries; |
231 } | 231 } |
232 } | 232 } |
OLD | NEW |