[Android] [PATCH 3/3] src: Enforce x86 build checking as well

Edward Wang edward.c.wang at compdigitec.com
Wed Jul 25 04:50:11 CEST 2012


---
 vlc-android/src/org/videolan/vlc/Util.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index bd5ab98..edf40d3 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -221,12 +221,17 @@ public class Util {
         boolean NO_FPU = properties.getProperty("NO_FPU","0").equals("1");
         boolean NO_ARMV6 = properties.getProperty("NO_ARMV6","0").equals("1");
         boolean hasNeon = false, hasFpu = false, hasArmV6 = false, hasArmV7 = false;
+        boolean hasX86 = false;
 
         try {
             FileReader fileReader = new FileReader("/proc/cpuinfo");
             BufferedReader br = new BufferedReader(fileReader);
             String line;
             while((line = br.readLine()) != null) {
+                if(!hasX86 && line.contains("vendor_id")) {
+                    hasX86 = true;
+                    break;
+                }
                 if(!hasNeon && line.contains("neon"))
                     hasNeon = true;
                 if(!hasArmV7 && line.contains("ARMv7")) {
@@ -246,6 +251,13 @@ public class Util {
             return false;
         }
 
+        // Enforce proper architecture to prevent problems
+        if(ANDROID_ABI.equals("x86") && !hasX86) {
+            errorMsg = "x86 build on non-x86 device";
+            isCompatible = false;
+            return false;
+        }
+
         if(ANDROID_ABI.equals("armeabi-v7a") && !hasArmV7) {
             errorMsg = "ARMv7 build on non-ARMv7 device";
             isCompatible = false;
@@ -262,10 +274,12 @@ public class Util {
                 return false;
             }
         }
-        if(!NO_NEON && !hasNeon) {
-            errorMsg = "NEON build on non-NEON device";
-            isCompatible = false;
-            return false;
+        if(ANDROID_ABI.equals("armeabi") || ANDROID_ABI.equals("armeabi-v7a")) {
+            if(!NO_NEON && !hasNeon) {
+                errorMsg = "NEON build on non-NEON device";
+                isCompatible = false;
+                return false;
+            }
         }
         errorMsg = null;
         isCompatible = true;
-- 
1.7.5.4



More information about the Android mailing list