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.base.multidex; | 5 package org.chromium.base.multidex; |
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.os.Process; | 9 import android.os.Process; |
10 import android.support.multidex.MultiDex; | 10 import android.support.multidex.MultiDex; |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 /** | 24 /** |
25 * Installs secondary dexes if possible. | 25 * Installs secondary dexes if possible. |
26 * | 26 * |
27 * Isolated processes (e.g. renderer processes) can't load secondary dex fi
les on | 27 * Isolated processes (e.g. renderer processes) can't load secondary dex fi
les on |
28 * K and below, so we don't even try in that case. | 28 * K and below, so we don't even try in that case. |
29 * | 29 * |
30 * @param context The application context. | 30 * @param context The application context. |
31 */ | 31 */ |
32 @VisibleForTesting | 32 @VisibleForTesting |
| 33 #if defined(CONFIGURATION_NAME_Debug) |
33 public static void install(Context context) { | 34 public static void install(Context context) { |
34 try { | 35 try { |
35 // TODO(jbudorick): Back out this version check once support for K &
below works. | 36 // TODO(jbudorick): Back out this version check once support for K &
below works. |
36 // http://crbug.com/512357 | 37 // http://crbug.com/512357 |
37 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && processI
sIsolated()) { | 38 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && processI
sIsolated()) { |
38 Log.i(TAG, "Skipping multidex installation: inside isolated proc
ess."); | 39 Log.i(TAG, "Skipping multidex installation: inside isolated proc
ess."); |
39 } else { | 40 } else { |
40 MultiDex.install(context); | 41 MultiDex.install(context); |
41 Log.i(TAG, "Completed multidex installation."); | 42 Log.i(TAG, "Completed multidex installation."); |
42 } | 43 } |
43 } catch (NoSuchMethodException e) { | 44 } catch (NoSuchMethodException e) { |
44 Log.wtf(TAG, "Failed multidex installation", e); | 45 Log.wtf(TAG, "Failed multidex installation", e); |
45 } catch (IllegalAccessException e) { | 46 } catch (IllegalAccessException e) { |
46 Log.wtf(TAG, "Failed multidex installation", e); | 47 Log.wtf(TAG, "Failed multidex installation", e); |
47 } catch (InvocationTargetException e) { | 48 } catch (InvocationTargetException e) { |
48 Log.wtf(TAG, "Failed multidex installation", e); | 49 Log.wtf(TAG, "Failed multidex installation", e); |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 // Calls Process.isIsolated, a private Android API. | 53 // Calls Process.isIsolated, a private Android API. |
53 private static boolean processIsIsolated() | 54 private static boolean processIsIsolated() |
54 throws NoSuchMethodException, IllegalAccessException, InvocationTarg
etException { | 55 throws NoSuchMethodException, IllegalAccessException, InvocationTarg
etException { |
55 return (boolean) Process.class.getMethod("isIsolated").invoke(null); | 56 return (boolean) Process.class.getMethod("isIsolated").invoke(null); |
56 } | 57 } |
| 58 #else |
| 59 public static void install(Context context) { |
| 60 } |
| 61 #endif |
57 | 62 |
58 } | 63 } |
OLD | NEW |