diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java index 7d42b422c..d6688c0ea 100644 --- a/src/org/fdroid/fdroid/DB.java +++ b/src/org/fdroid/fdroid/DB.java @@ -52,6 +52,7 @@ import android.util.Log; import org.fdroid.fdroid.compat.Compatibility; import org.fdroid.fdroid.compat.ContextCompat; +import org.fdroid.fdroid.compat.SupportedArchitectures; import org.fdroid.fdroid.data.DBHelper; public class DB { @@ -321,7 +322,8 @@ public class DB { private static class CompatibilityChecker extends Compatibility { private HashSet features; - private List cpuAbis; + private HashSet cpuAbis; + private String cpuAbisDesc; private boolean ignoreTouchscreen; //@SuppressLint("NewApi") @@ -344,11 +346,17 @@ public class DB { } } - cpuAbis = new ArrayList(2); - cpuAbis.add(android.os.Build.CPU_ABI); - if (hasApi(8)) { - cpuAbis.add(android.os.Build.CPU_ABI2); + cpuAbis = SupportedArchitectures.getAbis(); + + StringBuilder builder = new StringBuilder(); + boolean first = true; + for (String abi : cpuAbis) { + if (first) first = false; + else builder.append(", "); + builder.append(abi); } + cpuAbisDesc = builder.toString(); + builder = null; Log.d("FDroid", logMsg.toString()); } @@ -382,7 +390,7 @@ public class DB { if (!compatibleApi(apk.nativecode)) { Log.d("FDroid", apk.id + " vercode " + apk.vercode + " only supports " + CommaSeparatedList.str(apk.nativecode) - + " while your architecture is " + cpuAbis.get(0)); + + " while your architectures are " + cpuAbisDesc); return false; } return true; diff --git a/src/org/fdroid/fdroid/compat/SupportedArchitectures.java b/src/org/fdroid/fdroid/compat/SupportedArchitectures.java new file mode 100644 index 000000000..eccf9e25f --- /dev/null +++ b/src/org/fdroid/fdroid/compat/SupportedArchitectures.java @@ -0,0 +1,30 @@ +package org.fdroid.fdroid.compat; + +import java.util.HashSet; + +import android.annotation.TargetApi; +import android.util.Log; +import android.os.Build; + +public class SupportedArchitectures extends Compatibility { + + private static HashSet getOneAbi() { + HashSet abis = new HashSet(1); + abis.add(Build.CPU_ABI); + return abis; + } + + @TargetApi(8) + private static HashSet getTwoAbis() { + HashSet abis = new HashSet(2); + abis.add(Build.CPU_ABI); + abis.add(Build.CPU_ABI2); + return abis; + } + + public static HashSet getAbis() { + if (hasApi(8)) return getTwoAbis(); + return getOneAbi(); + } + +}