Commit 3a65f0bd authored by aurimas's avatar aurimas Committed by Commit bot

Suppress deprecation of Build.CPU_ABI

BUG=416041

Review URL: https://codereview.chromium.org/609663002

Cr-Commit-Position: refs/heads/master@{#296948}
parent 1e1d803b
...@@ -139,8 +139,7 @@ public class LibraryLoaderHelper { ...@@ -139,8 +139,7 @@ public class LibraryLoaderHelper {
ApplicationInfo appInfo = context.getApplicationInfo(); ApplicationInfo appInfo = context.getApplicationInfo();
ZipFile file = new ZipFile(new File(appInfo.sourceDir), ZipFile.OPEN_READ); ZipFile file = new ZipFile(new File(appInfo.sourceDir), ZipFile.OPEN_READ);
for (String libName : NativeLibraries.LIBRARIES) { for (String libName : NativeLibraries.LIBRARIES) {
String jniNameInApk = "lib/" + Build.CPU_ABI + "/" + String jniNameInApk = getJniNameInApk(libName);
System.mapLibraryName(libName);
final ZipEntry entry = file.getEntry(jniNameInApk); final ZipEntry entry = file.getEntry(jniNameInApk);
if (entry == null) { if (entry == null) {
...@@ -227,12 +226,17 @@ public class LibraryLoaderHelper { ...@@ -227,12 +226,17 @@ public class LibraryLoaderHelper {
deleteDirectorySync(libDir); deleteDirectorySync(libDir);
} }
@SuppressWarnings("deprecation")
private static String getJniNameInApk(String libName) {
// TODO(aurimas): Build.CPU_ABI has been deprecated. Replace it when final L SDK is public.
return "lib/" + Build.CPU_ABI + "/" + System.mapLibraryName(libName);
}
private static void deleteDirectorySync(File dir) { private static void deleteDirectorySync(File dir) {
try { try {
File[] files = dir.listFiles(); File[] files = dir.listFiles();
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
String fileName = file.getName();
if (!file.delete()) { if (!file.delete()) {
Log.e(TAG, "Failed to remove " + file.getAbsolutePath()); Log.e(TAG, "Failed to remove " + file.getAbsolutePath());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment