Bug 1084516 - Wrap Build.CPU_ABI access in deprecation annotation. r=snorp, a=lmandel
authorRichard Newman <rnewman@mozilla.com>
Mon, 20 Oct 2014 13:50:38 -0700
changeset 225918 a02835abdd00
parent 225917 66297e95dc47
child 225919 72938afdf993
push id4067
push userryanvm@gmail.com
push date2014-11-03 16:24 +0000
treeherdermozilla-beta@72938afdf993 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lmandel
bugs1084516
milestone34.0
Bug 1084516 - Wrap Build.CPU_ABI access in deprecation annotation. r=snorp, a=lmandel
mobile/android/base/mozglue/GeckoLoader.java.in
--- a/mobile/android/base/mozglue/GeckoLoader.java.in
+++ b/mobile/android/base/mozglue/GeckoLoader.java.in
@@ -262,16 +262,21 @@ public final class GeckoLoader {
             sNSSLibsLoaded = true;
         }
 
         loadMozGlue(context);
         loadLibsSetup(context);
         loadNSSLibsNative(apkName);
     }
 
+    @SuppressWarnings("deprecation")
+    private static final String getCPUABI() {
+        return android.os.Build.CPU_ABI;
+    }
+
     /**
      * Copy a library out of our APK.
      *
      * @param context a Context.
      * @param lib the name of the library; e.g., "mozglue".
      * @param outDir the output directory for the .so. No trailing slash.
      * @return true on success, false on failure.
      */
@@ -288,17 +293,18 @@ public final class GeckoLoader {
         File outDirFile = new File(outDir);
         if (!outDirFile.isDirectory()) {
             if (!outDirFile.mkdirs()) {
                 Log.e(LOGTAG, "Couldn't create " + outDir);
                 return false;
             }
         }
 
-        final String abi = android.os.Build.CPU_ABI;
+        final String abi = getCPUABI();
+
         try {
             final ZipFile zipFile = new ZipFile(new File(apkPath));
             try {
                 final String libPath = "lib/" + abi + "/lib" + lib + ".so";
                 final ZipEntry entry = zipFile.getEntry(libPath);
                 if (entry == null) {
                     Log.w(LOGTAG, libPath + " not found in APK " + apkPath);
                     return false;
@@ -350,17 +356,17 @@ public final class GeckoLoader {
         }
     }
 
     private static String getLoadDiagnostics(final Context context, final String lib) {
         final StringBuilder message = new StringBuilder("LOAD ");
         message.append(lib);
 
         // These might differ. If so, we know why the library won't load!
-        message.append(": ABI: " + MOZ_APP_ABI + ", " + android.os.Build.CPU_ABI);
+        message.append(": ABI: " + MOZ_APP_ABI + ", " + getCPUABI());
         message.append(": Data: " + context.getApplicationInfo().dataDir);
         try {
             final boolean appLibExists = new File("/data/app-lib/" + ANDROID_PACKAGE_NAME + "/lib" + lib + ".so").exists();
             final boolean dataDataExists = new File("/data/data/" + ANDROID_PACKAGE_NAME + "/lib/lib" + lib + ".so").exists();
             message.append(", ax=" + appLibExists);
             message.append(", ddx=" + dataDataExists);
         } catch (Throwable e) {
             message.append(": ax/ddx fail, ");