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?
This commit is contained in:
Daniel Martí 2013-08-29 17:09:40 +02:00
parent d4a7247629
commit 116c161ab7

View File

@ -330,6 +330,7 @@ public class DB {
private static class EclairChecker extends CompatibilityChecker {
private HashSet<String> features;
private List<String> 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<String>();
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;
}
}