[Android] Util: CPU_ABI2 is only Android 2.2 and above

Edward Wang git at videolan.org
Sat Sep 1 12:11:41 CEST 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Sep  1 06:09:41 2012 -0400| [a5869ed49a0eb5034bdc43ef585b93f04aadc886] | committer: Edward Wang

Util: CPU_ABI2 is only Android 2.2 and above

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a5869ed49a0eb5034bdc43ef585b93f04aadc886
---

 vlc-android/src/org/videolan/vlc/Util.java |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 465d178..9f6b068 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -258,6 +258,14 @@ public class Util {
             return false;
         }
 
+        String CPU_ABI = android.os.Build.CPU_ABI;
+        String CPU_ABI2 = "none";
+        if(android.os.Build.VERSION.SDK_INT >= 8) { // CPU_ABI2 since 2.2
+            try {
+                CPU_ABI2 = (String)android.os.Build.class.getDeclaredField("CPU_ABI2").get(null);
+            } catch (Exception e) { }
+        }
+
         String ANDROID_ABI = properties.getProperty("ANDROID_ABI");
         boolean NO_NEON = properties.getProperty("NO_NEON","0").equals("1");
         boolean NO_FPU = properties.getProperty("NO_FPU","0").equals("1");
@@ -265,14 +273,14 @@ public class Util {
         boolean hasNeon = false, hasFpu = false, hasArmV6 = false, hasArmV7 = false;
         boolean hasX86 = false;
 
-        if(android.os.Build.CPU_ABI.equals("x86")) {
+        if(CPU_ABI.equals("x86")) {
             hasX86 = true;
-        } else if(android.os.Build.CPU_ABI.equals("armeabi-v7a") ||
-           android.os.Build.CPU_ABI2.equals("armeabi-v7a")) {
+        } else if(CPU_ABI.equals("armeabi-v7a") ||
+                  CPU_ABI2.equals("armeabi-v7a")) {
             hasArmV7 = true;
             hasArmV6 = true; /* Armv7 is backwards compatible to < v6 */
-        } else if(android.os.Build.CPU_ABI.equals("armeabi") ||
-                  android.os.Build.CPU_ABI2.equals("armeabi")) {
+        } else if(CPU_ABI.equals("armeabi") ||
+                  CPU_ABI2.equals("armeabi")) {
             hasArmV6 = true;
         }
 
@@ -343,6 +351,7 @@ public class Util {
         isCompatible = true;
         return true;
     }
+
     public static boolean isPhone(){
         TelephonyManager manager = (TelephonyManager)VLCApplication.getAppContext().getSystemService(Context.TELEPHONY_SERVICE);
         if(manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE){



More information about the Android mailing list