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

Side by Side Diff: android/java/debug_src/org/chromium/base/IncrementalInstall.java

Issue 2050803003: Update to Chromium //base at Chromium commit e3a753f17bac62738b0dbf0b36510f767b081e4b. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.base;
6
7 import android.content.Context;
8
9 import java.io.File;
10 import java.util.List;
11
12 /**
13 * Contains hooks for making Incremental Install work. Incremental Install is
14 * where native libraries and (TODO) .dex files are pushed out-of-band to
15 * external storage rather than packaged with the app.
16 */
17 public final class IncrementalInstall {
18 private static final String MANAGED_DIR_PREFIX = "/data/local/tmp/incrementa l-app-";
19
20 public static void initialize(Context context) {
21 File incrementalAppDir = new File(MANAGED_DIR_PREFIX + context.getPackag eName());
22 File incrementalLibDir = new File(incrementalAppDir, "lib");
23 injectNativeLibDir(context.getClassLoader(), incrementalLibDir);
24 }
25
26 @SuppressWarnings("unchecked")
27 private static void injectNativeLibDir(ClassLoader loader, File nativeLibDir ) {
28 try {
29 Object dexPathList = Reflect.getField(loader, "pathList");
30 Object currentDirs = Reflect.getField(dexPathList, "nativeLibraryDir ectories");
31 if (currentDirs instanceof List) {
32 List<File> dirsAsList = (List<File>) currentDirs;
33 dirsAsList.add(nativeLibDir);
34 } else {
35 File[] dirsAsArray = (File[]) currentDirs;
36 File[] newDirs = new File[] {nativeLibDir};
37 Reflect.setField(dexPathList, "nativeLibraryDirectories",
38 Reflect.concatArrays(dirsAsArray, newDirs));
39 }
40 } catch (NoSuchFieldException e) {
41 throw new RuntimeException(e);
42 }
43 }
44 }
OLDNEW
« no previous file with comments | « android/important_file_writer_android.cc ('k') | android/java/debug_src/org/chromium/base/Reflect.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698