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

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

Issue 1989203003: Update checks for N+ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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.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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 private Object[] addDexElements(File[] files, File optimizedDirectory, Objec t[] curDexElements) 224 private Object[] addDexElements(File[] files, File optimizedDirectory, Objec t[] curDexElements)
225 throws ReflectiveOperationException { 225 throws ReflectiveOperationException {
226 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Element") ; 226 Class<?> entryClazz = Class.forName("dalvik.system.DexPathList$Element") ;
227 Class<?> clazz = Class.forName("dalvik.system.DexPathList"); 227 Class<?> clazz = Class.forName("dalvik.system.DexPathList");
228 Object[] ret = 228 Object[] ret =
229 Reflect.concatArrays(curDexElements, curDexElements, new Object[ files.length]); 229 Reflect.concatArrays(curDexElements, curDexElements, new Object[ files.length]);
230 File emptyDir = new File(""); 230 File emptyDir = new File("");
231 for (int i = 0; i < files.length; ++i) { 231 for (int i = 0; i < files.length; ++i) {
232 File file = files[i]; 232 File file = files[i];
233 Object dexFile; 233 Object dexFile;
234 if ("N".equals(Build.VERSION.CODENAME)) { 234 if (Build.VERSION.CODENAME.equals("N")
235 || Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
235 // loadDexFile requires that ret contain all previously added el ements. 236 // loadDexFile requires that ret contain all previously added el ements.
236 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory, 237 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory,
237 mClassLoader, ret); 238 mClassLoader, ret);
238 } else { 239 } else {
239 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory); 240 dexFile = Reflect.invokeMethod(clazz, "loadDexFile", file, optim izedDirectory);
240 } 241 }
241 ret[curDexElements.length + i] = 242 ret[curDexElements.length + i] =
242 Reflect.newInstance(entryClazz, emptyDir, false, file, dexFi le); 243 Reflect.newInstance(entryClazz, emptyDir, false, file, dexFi le);
243 } 244 }
244 return ret; 245 return ret;
245 } 246 }
246 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698