Adds preference to ignore touchscreen feature

A ridiclous number of apps claim to be incompatible with devices that
don't have a touchscreen. This even includes devices that have the 'fake
touchscreen' feature instead. Nearly all of those have no such
requirement, so this preference allows you to ignore it and treat those
apps as being compatible.
This commit is contained in:
Ciaran Gultnieks 2012-09-16 11:37:06 +01:00
parent 5c799559a9
commit 717df0b82f
3 changed files with 18 additions and 3 deletions

View File

@ -140,7 +140,9 @@
<string name="showincompat_long">Show apps written for newer Android versions or different hardware</string>
<string name="rooted">Root</string>
<string name="rooted_long">Show apps that require root privileges</string>
<string name="ignoreTouch">Ignore Touchscreen</string>
<string name="ignoreTouch_long">Always include apps that require touchscreen</string>
<string name="category_all">All</string>
<string name="category_whatsnew">What\'s New</string>
<string name="category_recentlyupdated">Recently Updated</string>

View File

@ -40,7 +40,10 @@
<CheckBoxPreference android:title="@string/rooted"
android:defaultValue="true" android:summary="@string/rooted_long"
android:key="rooted" />
</PreferenceCategory>
<CheckBoxPreference android:title="@string/ignoreTouch"
android:defaultValue="false" android:summary="@string/ignoreTouch_long"
android:key="ignoreTouchscreen" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/maintenance">
<Preference android:title="@string/reset" android:summary="@string/clear_all_cached_data"
android:key="reset" />

View File

@ -307,8 +307,15 @@ public class DB {
private static class EclairChecker extends CompatibilityChecker {
private HashSet<String> features;
private boolean ignoreTouchscreen;
public EclairChecker(Context ctx) {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(ctx);
ignoreTouchscreen = prefs
.getBoolean("ignoreTouchscreen", false);
PackageManager pm = ctx.getPackageManager();
StringBuilder logMsg = new StringBuilder();
logMsg.append("Available device features:");
@ -326,7 +333,10 @@ public class DB {
return false;
if (apk.features != null) {
for (String feat : apk.features) {
if (!features.contains(feat)) {
if (ignoreTouchscreen
&& feat.equals("android.hardware.touchscreen")) {
// Don't check it!
} else if (!features.contains(feat)) {
Log.d("FDroid", apk.id
+ " is incompatible based on lack of "
+ feat);