diff --git a/res/values/strings.xml b/res/values/strings.xml
index 36e4720d0..95184871c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -133,4 +133,6 @@
Application compatibility
Incompatible apps
Show apps written for newer Android versions or different hardware
+ Root
+ Show apps that require root privileges
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 0a86e4bc3..eb1a87d96 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -37,6 +37,9 @@
+
();
@@ -95,10 +96,14 @@ public class DB {
public String marketVersion;
public int marketVercode;
- // Array of anti-features (as defined in the metadata
+ // List of anti-features (as defined in the metadata
// documentation) or null if there aren't any.
public CommaSeparatedList antiFeatures;
+ // List of special requirements (such as root privileges) or
+ // null if there aren't any.
+ public CommaSeparatedList requirements;
+
// True if there are new versions (apks) that the user hasn't
// explicitly ignored. (We're currently not using the database
// field for this - we make the decision on the fly in getApps().
@@ -301,7 +306,10 @@ public class DB {
// Version 10...
{ "alter table " + TABLE_APK + " add minSdkVersion integer",
"alter table " + TABLE_APK + " add permissions string",
- "alter table " + TABLE_APK + " add features string" }};
+ "alter table " + TABLE_APK + " add features string" },
+
+ // Version 11...
+ { "alter table " + TABLE_APP + " add requirements string" }};
private class DBHelper extends SQLiteOpenHelper {
@@ -409,6 +417,7 @@ public class DB {
boolean pref_antiNonFreeAdd = prefs.getBoolean("antiNonFreeAdd", false);
boolean pref_antiNonFreeNet = prefs.getBoolean("antiNonFreeNet", false);
boolean pref_showIncompat = prefs.getBoolean("showIncompatible", false);
+ boolean pref_rooted = prefs.getBoolean("rooted", true);
Vector result = new Vector();
Cursor c = null;
@@ -446,6 +455,15 @@ public class DB {
include = false;
}
}
+ app.requirements = DB.CommaSeparatedList.make(c
+ .getString(c.getColumnIndex("requirements")));
+ if (app.requirements != null) {
+ for (String r : app.requirements) {
+ if (r.equals("root") && !pref_rooted) {
+ include = false;
+ }
+ }
+ }
if (include) {
app.id = c.getString(c.getColumnIndex("id"));
@@ -752,6 +770,7 @@ public class DB {
values.put("marketVersion", upapp.marketVersion);
values.put("marketVercode", upapp.marketVercode);
values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures));
+ values.put("requirements", CommaSeparatedList.str(upapp.requirements));
values.put("hasUpdates", upapp.hasUpdates ? 1 : 0);
if (oldapp != null) {
db.update(TABLE_APP, values, "id = ?", new String[] { oldapp.id });
diff --git a/src/org/fdroid/fdroid/RepoXMLHandler.java b/src/org/fdroid/fdroid/RepoXMLHandler.java
index fe51df8df..a081ca343 100644
--- a/src/org/fdroid/fdroid/RepoXMLHandler.java
+++ b/src/org/fdroid/fdroid/RepoXMLHandler.java
@@ -162,6 +162,8 @@ public class RepoXMLHandler extends DefaultHandler {
}
} else if (curel.equals("antifeatures")) {
curapp.antiFeatures = DB.CommaSeparatedList.make(str);
+ } else if (curel.equals("requirements")) {
+ curapp.requirements = DB.CommaSeparatedList.make(str);
}
}