| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |