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

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

Issue 2921313002: Fix incremental build for Android O (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.os.Build; 9 import android.os.Build;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 mAppFilesSubDir.setExecutable(true, false); 214 mAppFilesSubDir.setExecutable(true, false);
215 } 215 }
216 216
217 private void createSymlink(String to, File from) throws ReflectiveOperationE xception { 217 private void createSymlink(String to, File from) throws ReflectiveOperationE xception {
218 Reflect.invokeMethod(mLibcoreOs, "symlink", to, from.getAbsolutePath()); 218 Reflect.invokeMethod(mLibcoreOs, "symlink", to, from.getAbsolutePath());
219 } 219 }
220 220
221 private static Object[] makeNativePathElements(File[] paths) 221 private static Object[] makeNativePathElements(File[] paths)
222 throws ReflectiveOperationException { 222 throws ReflectiveOperationException {
223 Object[] entries = new Object[paths.length]; 223 Object[] entries = new Object[paths.length];
224 if (Build.VERSION.CODENAME.startsWith("O")) { 224 if (Build.VERSION.SDK_INT >= 26) {
225 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Nativ eLibraryElement"); 225 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Nativ eLibraryElement");
226 for (int i = 0; i < paths.length; ++i) { 226 for (int i = 0; i < paths.length; ++i) {
227 entries[i] = Reflect.newInstance(entryClazz, paths[i]); 227 entries[i] = Reflect.newInstance(entryClazz, paths[i]);
228 } 228 }
229 } else { 229 } else {
230 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Eleme nt"); 230 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Eleme nt");
231 for (int i = 0; i < paths.length; ++i) { 231 for (int i = 0; i < paths.length; ++i) {
232 entries[i] = Reflect.newInstance(entryClazz, paths[i], true, nul l, null); 232 entries[i] = Reflect.newInstance(entryClazz, paths[i], true, nul l, null);
233 } 233 }
234 } 234 }
(...skipping 11 matching lines...) Expand all
246 File file = files[i]; 246 File file = files[i];
247 Object dexFile; 247 Object dexFile;
248 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 248 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
249 // loadDexFile requires that ret contain all previously added el ements. 249 // loadDexFile requires that ret contain all previously added el ements.
250 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory, 250 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory,
251 mClassLoader, ret); 251 mClassLoader, ret);
252 } else { 252 } else {
253 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory); 253 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory);
254 } 254 }
255 Object dexElement; 255 Object dexElement;
256 if (Build.VERSION.CODENAME.startsWith("O")) { 256 if (Build.VERSION.SDK_INT >= 26) {
257 dexElement = Reflect.newInstance(entryClazz, dexFile, file); 257 dexElement = Reflect.newInstance(entryClazz, dexFile, file);
258 } else { 258 } else {
259 dexElement = Reflect.newInstance(entryClazz, emptyDir, false, fi le, dexFile); 259 dexElement = Reflect.newInstance(entryClazz, emptyDir, false, fi le, dexFile);
260 } 260 }
261 ret[curDexElements.length + i] = dexElement; 261 ret[curDexElements.length + i] = dexElement;
262 } 262 }
263 return ret; 263 return ret;
264 } 264 }
265 } 265 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698