add Expert Pref to enable Push Requests
Since !705 will allow OEMs, ROM makers, etc. to add repos, there needs to be a way for the user to prevent those from automatically installing or uninstalling apps for users of the full F-Droid app, which guarantees user control.
This commit is contained in:
parent
1fe0d8f4b7
commit
c2d9749105
@ -108,6 +108,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
public static final String PREF_HIDE_ON_LONG_PRESS_SEARCH = "hideOnLongPressSearch";
|
||||
public static final String PREF_HIDE_ALL_NOTIFICATIONS = "hideAllNotifications";
|
||||
public static final String PREF_SEND_VERSION_AND_UUID_TO_SERVERS = "sendVersionAndUUIDToServers";
|
||||
public static final String PREF_ALLOW_PUSH_REQUESTS = "allowPushRequests";
|
||||
|
||||
public static final int OVER_NETWORK_NEVER = 0;
|
||||
public static final int OVER_NETWORK_ON_DEMAND = 1;
|
||||
@ -512,6 +513,16 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
return preferences.getBoolean(PREF_SEND_VERSION_AND_UUID_TO_SERVERS, IGNORED_B);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether push requests are globally enabled or disabled.
|
||||
*
|
||||
* @see org.fdroid.fdroid.data.RepoPushRequest
|
||||
* @see RepoUpdater#processRepoPushRequests(List)
|
||||
*/
|
||||
public boolean allowPushRequests() {
|
||||
return preferences.getBoolean(PREF_ALLOW_PUSH_REQUESTS, IGNORED_B);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is cached as it is called several times inside app list adapters.
|
||||
* Providing it here means the shared preferences file only needs to be
|
||||
|
@ -442,9 +442,14 @@ public class RepoUpdater {
|
||||
* Server index XML can include optional {@code install} and {@code uninstall}
|
||||
* requests. This processes those requests, figuring out whether the client
|
||||
* should always accept, prompt the user, or ignore those requests on a
|
||||
* per repo basis.
|
||||
* per repo basis. There is also a global preference as a failsafe.
|
||||
*
|
||||
* @see Preferences#allowPushRequests()
|
||||
*/
|
||||
void processRepoPushRequests(List<RepoPushRequest> requestEntries) {
|
||||
if (!Preferences.get().allowPushRequests()) {
|
||||
return;
|
||||
}
|
||||
for (RepoPushRequest repoPushRequest : requestEntries) {
|
||||
String packageName = repoPushRequest.packageName;
|
||||
PackageInfo packageInfo = Utils.getPackageInfo(context, packageName);
|
||||
|
@ -33,6 +33,9 @@
|
||||
downloading, takes affect next app restart.</string>
|
||||
<string name="force_old_index">Force old index format</string>
|
||||
<string name="force_old_index_summary">In case there are bugs or compatibility issues, use the XML app index</string>
|
||||
<string name="allow_push_requests">Allow repos to install/uninstall apps</string>
|
||||
<string name="allow_push_requests_summary">Repo metadata can include "push requests" to install or uninstall apps
|
||||
</string>
|
||||
<string name="other">Other</string>
|
||||
|
||||
<string name="update_interval">Automatic update interval</string>
|
||||
|
@ -190,6 +190,12 @@
|
||||
android:summary="@string/send_version_and_uuid_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="expert"/>
|
||||
<CheckBoxPreference
|
||||
android:key="allowPushRequests"
|
||||
android:title="@string/allow_push_requests"
|
||||
android:summary="@string/allow_push_requests_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="expert"/>
|
||||
<CheckBoxPreference
|
||||
android:key="forceOldIndex"
|
||||
android:title="@string/force_old_index"
|
||||
|
Loading…
x
Reference in New Issue
Block a user