OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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; | 5 package org.chromium.base; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.pm.ApplicationInfo; |
8 import android.os.Environment; | 9 import android.os.Environment; |
9 | 10 |
10 import org.chromium.base.CalledByNative; | 11 import org.chromium.base.CalledByNative; |
11 | 12 |
12 import java.io.File; | 13 import java.io.File; |
13 | 14 |
14 /** | 15 /** |
15 * This class provides the path related methods for the native library. | 16 * This class provides the path related methods for the native library. |
16 */ | 17 */ |
17 class PathUtils { | 18 class PathUtils { |
(...skipping 16 matching lines...) Expand all Loading... |
34 } | 35 } |
35 | 36 |
36 /** | 37 /** |
37 * @return the public downloads directory. | 38 * @return the public downloads directory. |
38 */ | 39 */ |
39 @CalledByNative | 40 @CalledByNative |
40 public static String getDownloadsDirectory(Context appContext) { | 41 public static String getDownloadsDirectory(Context appContext) { |
41 return Environment.getExternalStoragePublicDirectory( | 42 return Environment.getExternalStoragePublicDirectory( |
42 Environment.DIRECTORY_DOWNLOADS).getPath(); | 43 Environment.DIRECTORY_DOWNLOADS).getPath(); |
43 } | 44 } |
| 45 |
| 46 /** |
| 47 * @return the path to native libraries. |
| 48 */ |
| 49 @CalledByNative |
| 50 public static String getNativeLibraryDirectory(Context appContext) { |
| 51 ApplicationInfo ai = appContext.getApplicationInfo(); |
| 52 if ((ai.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0 || |
| 53 (ai.flags & ApplicationInfo.FLAG_SYSTEM) == 0) { |
| 54 return ai.nativeLibraryDir; |
| 55 } |
| 56 |
| 57 return "/system/lib/"; |
| 58 } |
44 } | 59 } |
OLD | NEW |