From 116c161ab713c1f1d96339c1a651b5984fb30cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 29 Aug 2013 17:09:40 +0200 Subject: [PATCH] Filter incompatible apps by architecture as well CPU_ABI and CPU_ABI2 are used to check with the nativecode in the index. This would only break if either of these two was set incorrectly in the ROM's build.prop. Then again, should we worry about that? --- src/org/fdroid/fdroid/DB.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java index b8f66f4c9..de60fe6f1 100644 --- a/src/org/fdroid/fdroid/DB.java +++ b/src/org/fdroid/fdroid/DB.java @@ -330,6 +330,7 @@ public class DB { private static class EclairChecker extends CompatibilityChecker { private HashSet features; + private List cpuAbis; private boolean ignoreTouchscreen; public EclairChecker(Context ctx) { @@ -348,9 +349,25 @@ public class DB { logMsg.append('\n'); logMsg.append(fi.name); } + + cpuAbis = new ArrayList(); + if (hasApi(8)) + cpuAbis.add(android.os.Build.CPU_ABI2); + cpuAbis.add(android.os.Build.CPU_ABI); + Log.d("FDroid", logMsg.toString()); } + private boolean compatibleApi(CommaSeparatedList nativecode) { + if (nativecode == null) return true; + for (String abi : nativecode) { + if (cpuAbis.contains(abi)) { + return true; + } + } + return false; + } + public boolean isCompatible(Apk apk) { if (!hasApi(apk.minSdkVersion)) return false; @@ -367,6 +384,13 @@ public class DB { } } } + if (!compatibleApi(apk.nativecode)) { + Log.d("FDroid", apk.id + + " makes use of incompatible native code: " + + CommaSeparatedList.str(apk.nativecode) + + " while your architecture is " + cpuAbis.get(0)); + return false; + } return true; } }