Remove filter by root, replaced by ACCESS_SUPERUSER permission
This commit is contained in:
parent
804496b50b
commit
991b91dfdc
@ -117,8 +117,6 @@
|
|||||||
<string name="appcompatibility">Application compatibility</string>
|
<string name="appcompatibility">Application compatibility</string>
|
||||||
<string name="showincompat">Incompatible apps</string>
|
<string name="showincompat">Incompatible apps</string>
|
||||||
<string name="showincompat_long">Show apps written for newer Android versions or different hardware</string>
|
<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">Ignore Touchscreen</string>
|
||||||
<string name="ignoreTouch_long">Always include apps that require touchscreen</string>
|
<string name="ignoreTouch_long">Always include apps that require touchscreen</string>
|
||||||
|
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
<CheckBoxPreference android:title="@string/showincompat"
|
<CheckBoxPreference android:title="@string/showincompat"
|
||||||
android:defaultValue="false" android:summary="@string/showincompat_long"
|
android:defaultValue="false" android:summary="@string/showincompat_long"
|
||||||
android:key="showIncompatible" />
|
android:key="showIncompatible" />
|
||||||
<CheckBoxPreference android:title="@string/rooted"
|
|
||||||
android:defaultValue="true" android:summary="@string/rooted_long"
|
|
||||||
android:key="rooted" />
|
|
||||||
<CheckBoxPreference android:title="@string/ignoreTouch"
|
<CheckBoxPreference android:title="@string/ignoreTouch"
|
||||||
android:defaultValue="false" android:summary="@string/ignoreTouch_long"
|
android:defaultValue="false" android:summary="@string/ignoreTouch_long"
|
||||||
android:key="ignoreTouchscreen" />
|
android:key="ignoreTouchscreen" />
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-12 Ciaran Gultnieks, ciaran@ciarang.com
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 3
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.fdroid.fdroid;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
public class AppFilter {
|
|
||||||
|
|
||||||
boolean pref_rooted;
|
|
||||||
|
|
||||||
public AppFilter(Context ctx) {
|
|
||||||
|
|
||||||
// Read preferences and cache them so we can do quick lookups.
|
|
||||||
SharedPreferences prefs = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(ctx);
|
|
||||||
pref_rooted = prefs.getBoolean("rooted", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return true if the given app should be filtered based on user
|
|
||||||
// preferences, and false otherwise.
|
|
||||||
public boolean filter(DB.App app) {
|
|
||||||
boolean filtered = false;
|
|
||||||
if (app.requirements != null) {
|
|
||||||
for (String r : app.requirements) {
|
|
||||||
if (r.equals("root") && !pref_rooted)
|
|
||||||
filtered = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -197,9 +197,9 @@ public class AppListManager {
|
|||||||
boolean isInCategory = isInCategory(app, currentCategory, recentDate);
|
boolean isInCategory = isInCategory(app, currentCategory, recentDate);
|
||||||
|
|
||||||
// Add it to the list(s). Always to installed and updates, but
|
// Add it to the list(s). Always to installed and updates, but
|
||||||
// only to available if it's not filtered.
|
// only to available if it's compatible (or incompatible with
|
||||||
if (!app.filtered && isInCategory
|
// showIncompatible at true)
|
||||||
&& (showIncompatible || app.compatible)) {
|
if (isInCategory && (showIncompatible || app.compatible)) {
|
||||||
availApps.add(app);
|
availApps.add(app);
|
||||||
}
|
}
|
||||||
if (app.installedVersion != null) {
|
if (app.installedVersion != null) {
|
||||||
|
@ -96,7 +96,7 @@ public class DB {
|
|||||||
+ "curVersion text," + "curVercode integer,"
|
+ "curVersion text," + "curVercode integer,"
|
||||||
+ "antiFeatures string," + "donateURL string,"
|
+ "antiFeatures string," + "donateURL string,"
|
||||||
+ "bitcoinAddr string," + "litecoinAddr string,"
|
+ "bitcoinAddr string," + "litecoinAddr string,"
|
||||||
+ "flattrID string," + "requirements string,"
|
+ "flattrID string,"
|
||||||
+ "category string," + "added string,"
|
+ "category string," + "added string,"
|
||||||
+ "lastUpdated string," + "compatible int not null,"
|
+ "lastUpdated string," + "compatible int not null,"
|
||||||
+ "ignoreAllUpdates int not null,"
|
+ "ignoreAllUpdates int not null,"
|
||||||
@ -119,7 +119,6 @@ public class DB {
|
|||||||
detail_litecoinAddr = null;
|
detail_litecoinAddr = null;
|
||||||
detail_webURL = null;
|
detail_webURL = null;
|
||||||
antiFeatures = null;
|
antiFeatures = null;
|
||||||
requirements = null;
|
|
||||||
hasUpdates = false;
|
hasUpdates = false;
|
||||||
toUpdate = false;
|
toUpdate = false;
|
||||||
updated = false;
|
updated = false;
|
||||||
@ -130,7 +129,6 @@ public class DB {
|
|||||||
compatible = false;
|
compatible = false;
|
||||||
ignoreAllUpdates = false;
|
ignoreAllUpdates = false;
|
||||||
ignoreThisUpdate = 0;
|
ignoreThisUpdate = 0;
|
||||||
filtered = false;
|
|
||||||
iconUrl = null;
|
iconUrl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,14 +191,6 @@ public class DB {
|
|||||||
// documentation) or null if there aren't any.
|
// documentation) or null if there aren't any.
|
||||||
public CommaSeparatedList antiFeatures;
|
public CommaSeparatedList antiFeatures;
|
||||||
|
|
||||||
// List of special requirements (such as root privileges) or
|
|
||||||
// null if there aren't any.
|
|
||||||
public CommaSeparatedList requirements;
|
|
||||||
|
|
||||||
// Whether the app is filtered or not based on AntiFeatures and root
|
|
||||||
// permission (set in the Settings page)
|
|
||||||
public boolean filtered;
|
|
||||||
|
|
||||||
// True if there are new versions (apks) available, regardless of
|
// True if there are new versions (apks) available, regardless of
|
||||||
// any filtering
|
// any filtering
|
||||||
public boolean hasUpdates;
|
public boolean hasUpdates;
|
||||||
@ -440,7 +430,7 @@ public class DB {
|
|||||||
public String lastetag; // last etag we updated from, null forces update
|
public String lastetag; // last etag we updated from, null forces update
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int DBVersion = 27;
|
private final int DBVersion = 28;
|
||||||
|
|
||||||
private static void createAppApk(SQLiteDatabase db) {
|
private static void createAppApk(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_APP);
|
db.execSQL(CREATE_TABLE_APP);
|
||||||
@ -759,7 +749,7 @@ public class DB {
|
|||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String cols[] = new String[] { "antiFeatures", "requirements",
|
String cols[] = new String[] { "antiFeatures",
|
||||||
"id", "name", "summary", "icon", "license", "category",
|
"id", "name", "summary", "icon", "license", "category",
|
||||||
"curVersion", "curVercode", "added", "lastUpdated",
|
"curVersion", "curVercode", "added", "lastUpdated",
|
||||||
"compatible", "ignoreAllUpdates", "ignoreThisUpdate" };
|
"compatible", "ignoreAllUpdates", "ignoreThisUpdate" };
|
||||||
@ -769,25 +759,24 @@ public class DB {
|
|||||||
|
|
||||||
App app = new App();
|
App app = new App();
|
||||||
app.antiFeatures = DB.CommaSeparatedList.make(c.getString(0));
|
app.antiFeatures = DB.CommaSeparatedList.make(c.getString(0));
|
||||||
app.requirements = DB.CommaSeparatedList.make(c.getString(1));
|
app.id = c.getString(1);
|
||||||
app.id = c.getString(2);
|
app.name = c.getString(2);
|
||||||
app.name = c.getString(3);
|
app.summary = c.getString(3);
|
||||||
app.summary = c.getString(4);
|
app.icon = c.getString(4);
|
||||||
app.icon = c.getString(5);
|
app.license = c.getString(5);
|
||||||
app.license = c.getString(6);
|
app.category = c.getString(6);
|
||||||
app.category = c.getString(7);
|
app.curVersion = c.getString(7);
|
||||||
app.curVersion = c.getString(8);
|
app.curVercode = c.getInt(8);
|
||||||
app.curVercode = c.getInt(9);
|
String sAdded = c.getString(9);
|
||||||
String sAdded = c.getString(10);
|
|
||||||
app.added = (sAdded == null || sAdded.length() == 0) ? null
|
app.added = (sAdded == null || sAdded.length() == 0) ? null
|
||||||
: mDateFormat.parse(sAdded);
|
: mDateFormat.parse(sAdded);
|
||||||
String sLastUpdated = c.getString(11);
|
String sLastUpdated = c.getString(10);
|
||||||
app.lastUpdated = (sLastUpdated == null || sLastUpdated
|
app.lastUpdated = (sLastUpdated == null || sLastUpdated
|
||||||
.length() == 0) ? null : mDateFormat
|
.length() == 0) ? null : mDateFormat
|
||||||
.parse(sLastUpdated);
|
.parse(sLastUpdated);
|
||||||
app.compatible = c.getInt(12) == 1;
|
app.compatible = c.getInt(11) == 1;
|
||||||
app.ignoreAllUpdates = c.getInt(13) == 1;
|
app.ignoreAllUpdates = c.getInt(12) == 1;
|
||||||
app.ignoreThisUpdate = c.getInt(14);
|
app.ignoreThisUpdate = c.getInt(13);
|
||||||
app.hasUpdates = false;
|
app.hasUpdates = false;
|
||||||
|
|
||||||
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
||||||
@ -1145,7 +1134,6 @@ public class DB {
|
|||||||
values.put("curVersion", upapp.curVersion);
|
values.put("curVersion", upapp.curVersion);
|
||||||
values.put("curVercode", upapp.curVercode);
|
values.put("curVercode", upapp.curVercode);
|
||||||
values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures));
|
values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures));
|
||||||
values.put("requirements", CommaSeparatedList.str(upapp.requirements));
|
|
||||||
values.put("compatible", upapp.compatible ? 1 : 0);
|
values.put("compatible", upapp.compatible ? 1 : 0);
|
||||||
|
|
||||||
// Values to keep if already present
|
// Values to keep if already present
|
||||||
|
@ -196,14 +196,10 @@ public class FDroidApp extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void filterApps() {
|
public void filterApps() {
|
||||||
AppFilter appFilter = new AppFilter(ctx);
|
|
||||||
for (DB.App app : apps) {
|
for (DB.App app : apps) {
|
||||||
app.filtered = appFilter.filter(app);
|
|
||||||
|
|
||||||
app.toUpdate = (app.hasUpdates
|
app.toUpdate = (app.hasUpdates
|
||||||
&& !app.ignoreAllUpdates
|
&& !app.ignoreAllUpdates
|
||||||
&& app.curApk.vercode > app.ignoreThisUpdate
|
&& app.curApk.vercode > app.ignoreThisUpdate
|
||||||
&& !app.filtered
|
|
||||||
&& (showIncompatible || app.compatible));
|
&& (showIncompatible || app.compatible));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,6 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
}
|
}
|
||||||
} else if (curel.equals("antifeatures")) {
|
} else if (curel.equals("antifeatures")) {
|
||||||
curapp.antiFeatures = DB.CommaSeparatedList.make(str);
|
curapp.antiFeatures = DB.CommaSeparatedList.make(str);
|
||||||
} else if (curel.equals("requirements")) {
|
|
||||||
curapp.requirements = DB.CommaSeparatedList.make(str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
// Disable it all if it isn't compatible...
|
// Disable it all if it isn't compatible...
|
||||||
View[] views = { convertView, status, summary, license, name };
|
View[] views = { convertView, status, summary, license, name };
|
||||||
for (View view : views) {
|
for (View view : views) {
|
||||||
view.setEnabled(app.compatible && !app.filtered);
|
view.setEnabled(app.compatible);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user