Merge branch 'last-0.104-fixes' into 'master'

failsafe preference for index-v1.jar

See merge request !537
This commit is contained in:
Peter Serwylo 2017-06-15 23:57:42 +00:00
commit 3484d6f1dd
5 changed files with 50 additions and 40 deletions

View File

@ -99,13 +99,14 @@ public class LocalizationTest {
// Resources() requires DisplayMetrics, but they are only needed for drawables // Resources() requires DisplayMetrics, but they are only needed for drawables
resources = new Resources(assets, new DisplayMetrics(), config); resources = new Resources(assets, new DisplayMetrics(), config);
for (Field field : fields) { for (Field field : fields) {
String formats = null;
try {
int resId = field.getInt(int.class); int resId = field.getInt(int.class);
for (int quantity = 0; quantity < 22; quantity++) { for (int quantity = 0; quantity < 22; quantity++) {
resources.getQuantityString(resId, quantity); resources.getQuantityString(resId, quantity);
} }
String formats = haveFormats.get(field.getName()); formats = haveFormats.get(field.getName());
try {
switch (formats) { switch (formats) {
case "d": case "d":
resources.getQuantityString(resId, 1, 1); resources.getQuantityString(resId, 1, 1);
@ -121,7 +122,7 @@ public class LocalizationTest {
throw new IllegalStateException("Pattern not included in tests: " + formats); throw new IllegalStateException("Pattern not included in tests: " + formats);
} }
} }
} catch (IllegalFormatException e) { } catch (IllegalFormatException | Resources.NotFoundException e) {
Log.i(TAG, locale + " " + field.getName()); Log.i(TAG, locale + " " + field.getName());
throw new IllegalArgumentException("Bad '" + formats + "' format in " + locale + " " throw new IllegalArgumentException("Bad '" + formats + "' format in " + locale + " "
+ field.getName() + ": " + e.getMessage()); + field.getName() + ": " + e.getMessage());

View File

@ -53,6 +53,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates"; public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates";
public static final String PREF_KEEP_INSTALL_HISTORY = "keepInstallHistory"; public static final String PREF_KEEP_INSTALL_HISTORY = "keepInstallHistory";
public static final String PREF_EXPERT = "expert"; public static final String PREF_EXPERT = "expert";
public static final String PREF_FORCE_OLD_INDEX = "forceOldIndex";
public static final String PREF_PRIVILEGED_INSTALLER = "privilegedInstaller"; public static final String PREF_PRIVILEGED_INSTALLER = "privilegedInstaller";
public static final String PREF_UNINSTALL_PRIVILEGED_APP = "uninstallPrivilegedApp"; public static final String PREF_UNINSTALL_PRIVILEGED_APP = "uninstallPrivilegedApp";
public static final String PREF_LOCAL_REPO_NAME = "localRepoName"; public static final String PREF_LOCAL_REPO_NAME = "localRepoName";
@ -82,6 +83,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
public static final String DEFAULT_PROXY_HOST = "127.0.0.1"; public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
public static final int DEFAULT_PROXY_PORT = 8118; public static final int DEFAULT_PROXY_PORT = 8118;
private static final boolean DEFAULT_SHOW_NFC_DURING_SWAP = true; private static final boolean DEFAULT_SHOW_NFC_DURING_SWAP = true;
private static final boolean DEFAULT_FORCE_OLD_INDEX = false;
private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false; private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false;
public enum Theme { public enum Theme {
@ -114,6 +116,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
initialized.put(key, false); initialized.put(key, false);
} }
public boolean isForceOldIndexEnabled() {
return preferences.getBoolean(PREF_FORCE_OLD_INDEX, DEFAULT_FORCE_OLD_INDEX);
}
/** /**
* Whether to use the Privileged Installer, based on if it is installed. Only the disabled * Whether to use the Privileged Installer, based on if it is installed. Only the disabled
* state is stored as a preference since the enabled state is based entirely on the presence * state is stored as a preference since the enabled state is based entirely on the presence

View File

@ -409,7 +409,7 @@ public class UpdateService extends IntentService {
try { try {
RepoUpdater updater = new IndexV1Updater(this, repo); RepoUpdater updater = new IndexV1Updater(this, repo);
//TODO setProgressListeners(updater); //TODO setProgressListeners(updater);
if (!updater.update()) { if (Preferences.get().isForceOldIndexEnabled() || !updater.update()) {
updater = new RepoUpdater(getBaseContext(), repo); updater = new RepoUpdater(getBaseContext(), repo);
setProgressListeners(updater); setProgressListeners(updater);
updater.update(); updater.update();

View File

@ -5,11 +5,9 @@
<string name="SignatureMismatch">The new version is signed with a different key to the old one. To install the new <string name="SignatureMismatch">The new version is signed with a different key to the old one. To install the new
version, the old one must be uninstalled first. Please do this and try again. (Note that uninstalling will erase version, the old one must be uninstalled first. Please do this and try again. (Note that uninstalling will erase
any internal data stored by the application) any internal data stored by the app)
</string>
<string name="installIncompatible">It seems like this package is not compatible with your device. Do you want to try
and install it anyway?
</string> </string>
<string name="installIncompatible">App incompatible with your device, install anyway?</string>
<string name="version">Version</string> <string name="version">Version</string>
<string name="by_author_format">by %s</string> <string name="by_author_format">by %s</string>
<string name="delete">Delete</string> <string name="delete">Delete</string>
@ -20,6 +18,8 @@
<string name="unstable_updates_summary">Suggest updates to unstable versions</string> <string name="unstable_updates_summary">Suggest updates to unstable versions</string>
<string name="keep_install_history">Keep install history</string> <string name="keep_install_history">Keep install history</string>
<string name="keep_install_history_summary">Store a log of all installs and uninstalls inside F-Droid</string> <string name="keep_install_history_summary">Store a log of all installs and uninstalls inside F-Droid</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="other">Other</string> <string name="other">Other</string>
<string name="update_interval">Automatic update interval</string> <string name="update_interval">Automatic update interval</string>
@ -32,7 +32,7 @@
</string> </string>
<string name="update_auto_install">Automatically install updates</string> <string name="update_auto_install">Automatically install updates</string>
<string name="update_auto_install_summary">Download and install update apps in the background</string> <string name="update_auto_install_summary">Download and install update apps in the background</string>
<string name="notify">Update notifications</string> <string name="notify">Show available updates</string>
<string name="notify_on">Show a notification when updates are available</string> <string name="notify_on">Show a notification when updates are available</string>
<string name="system_installer">Privileged Extension</string> <string name="system_installer">Privileged Extension</string>
<string name="system_installer_on">Use F-Droid Privileged Extension to install, update, and remove packages</string> <string name="system_installer_on">Use F-Droid Privileged Extension to install, update, and remove packages</string>
@ -58,7 +58,7 @@
<string name="about_version">Version</string> <string name="about_version">Version</string>
<string name="about_site">Website</string> <string name="about_site">Website</string>
<string name="about_source">Source code</string> <string name="about_source">Source code</string>
<string name="about_mail">Email</string> <string name="about_mail">E-mail</string>
<string name="about_license">License</string> <string name="about_license">License</string>
<string name="app_incompatible">Incompatible</string> <string name="app_incompatible">Incompatible</string>
@ -77,7 +77,7 @@
<string name="app_list__name__downloaded_and_ready_to_update">Update %1$s</string> <string name="app_list__name__downloaded_and_ready_to_update">Update %1$s</string>
<string name="app_list__name__downloaded_and_ready_to_install">Install %1$s</string> <string name="app_list__name__downloaded_and_ready_to_install">Install %1$s</string>
<string name="app_list__name__downloading_in_progress">Downloading %1$s</string> <string name="app_list__name__downloading_in_progress">Downloading %1$s</string>
<string name="app_list__name__successfully_installed">%1$s successfully installed</string> <string name="app_list__name__successfully_installed">%1$s installed</string>
<string name="app_list__age__released_today">Released today</string> <string name="app_list__age__released_today">Released today</string>
<string name="app_list__age__released_yesterday">Released yesterday</string> <string name="app_list__age__released_yesterday">Released yesterday</string>
<plurals name="app_list__age__released_x_days_ago"> <plurals name="app_list__age__released_x_days_ago">
@ -136,7 +136,7 @@
<string name="repo_provider">Repository: %s</string> <string name="repo_provider">Repository: %s</string>
<string name="menu_manage">Repositories</string> <string name="menu_manage">Repositories</string>
<string name="repositories_summary">Add additional sources of applications</string> <string name="repositories_summary">Add additional sources of apps</string>
<string name="menu_settings">Settings</string> <string name="menu_settings">Settings</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="menu_add_repo">New Repository</string> <string name="menu_add_repo">New Repository</string>
@ -196,9 +196,9 @@
<string name="expert">Expert mode</string> <string name="expert">Expert mode</string>
<string name="expert_on">Show extra info and enable extra settings</string> <string name="expert_on">Show extra info and enable extra settings</string>
<string name="search_hint">Search applications</string> <string name="search_hint">Search apps</string>
<string name="appcompatibility">Application compatibility</string> <string name="appcompatibility">App compatibility</string>
<string name="show_incompat_versions">Incompatible versions</string> <string name="show_incompat_versions">Incompatible versions</string>
<string name="show_incompat_versions_on">Show app versions incompatible with the device</string> <string name="show_incompat_versions_on">Show app versions incompatible with the device</string>
<string name="rooted">Ignore root</string> <string name="rooted">Ignore root</string>
@ -226,9 +226,9 @@
<string name="enable_proxy_title">Enable HTTP Proxy</string> <string name="enable_proxy_title">Enable HTTP Proxy</string>
<string name="enable_proxy_summary">Configure HTTP Proxy for all network requests</string> <string name="enable_proxy_summary">Configure HTTP Proxy for all network requests</string>
<string name="proxy_host">Proxy Host</string> <string name="proxy_host">Proxy Host</string>
<string name="proxy_host_summary">Configure your proxy\'s hostname (e.g. 127.0.0.1)</string> <string name="proxy_host_summary">Your proxy\'s hostname (e.g. 127.0.0.1)</string>
<string name="proxy_port">Proxy Port</string> <string name="proxy_port">Proxy Port</string>
<string name="proxy_port_summary">Configure your proxy\'s port number (e.g. 8118)</string> <string name="proxy_port_summary">Your proxy\'s port number (e.g. 8118)</string>
<!-- <!--
status_download takes four parameters: status_download takes four parameters:
@ -249,11 +249,11 @@
<string name="update_notification_title">Updating repositories</string> <string name="update_notification_title">Updating repositories</string>
<string name="status_processing_xml_percent">Processing %2$s / %3$s (%4$d%%) from %1$s</string> <string name="status_processing_xml_percent">Processing %2$s / %3$s (%4$d%%) from %1$s</string>
<string name="status_connecting_to_repo">Connecting to\n%1$s</string> <string name="status_connecting_to_repo">Connecting to\n%1$s</string>
<string name="status_inserting_apps">Saving application details</string> <string name="status_inserting_apps">Saving app details</string>
<string name="repos_unchanged">All repositories are up to date</string> <string name="repos_unchanged">All repositories are up to date</string>
<string name="all_other_repos_fine">All other repos didn\'t create errors.</string> <string name="all_other_repos_fine">All other repos didn\'t create errors.</string>
<string name="global_error_updating_repos">Error during update: %s</string> <string name="global_error_updating_repos">Error during update: %s</string>
<string name="warning_no_internet">Cannot update, are you connected to the internet?</string> <string name="warning_no_internet">Cannot update, are you connected to the Internet?</string>
<string name="no_permissions">No permissions are used.</string> <string name="no_permissions">No permissions are used.</string>
<string name="permissions">Permissions</string> <string name="permissions">Permissions</string>
<string name="no_handler_app">You don\'t have any available app that can handle %s.</string> <string name="no_handler_app">You don\'t have any available app that can handle %s.</string>
@ -268,8 +268,8 @@
<string name="repo_last_update">Last update</string> <string name="repo_last_update">Last update</string>
<string name="repo_name">Name</string> <string name="repo_name">Name</string>
<string name="unsigned_description">This means that the list of <string name="unsigned_description">This means that the list of
applications could not be verified. You should be careful apps could not be verified. You should be careful
with applications downloaded from unsigned indexes. with apps downloaded from unsigned indexes.
</string> </string>
<string name="repo_not_yet_updated">This repository has not been used yet. <string name="repo_not_yet_updated">This repository has not been used yet.
You need to enable it to view the apps it provides. You need to enable it to view the apps it provides.
@ -344,10 +344,10 @@
Please create a bug report! Please create a bug report!
</string> </string>
<string name="system_install_button_install">Install</string> <string name="system_install_button_install">Install</string>
<string name="system_install_post_success">Successfully installed F-Droid Privileged Extension</string> <string name="system_install_post_success">F-Droid Privileged Extension installed</string>
<string name="system_install_post_fail">Installation of F-Droid Privileged Extension failed</string> <string name="system_install_post_fail">Installation of F-Droid Privileged Extension failed</string>
<string name="system_install_post_success_message">F-Droid Privileged Extension has been successfully installed. <string name="system_install_post_success_message">F-Droid Privileged Extension installed.
This allows F-Droid to install, upgrade and uninstall apps on its own. This allows F-Droid to install, update and uninstall apps on its own.
</string> </string>
<string name="system_install_post_fail_message">The installation of F-Droid Privileged Extension has failed. The <string name="system_install_post_fail_message">The installation of F-Droid Privileged Extension has failed. The
installation method is not supported by all Android distributions, please consult the F-Droid bug tracker for installation method is not supported by all Android distributions, please consult the F-Droid bug tracker for
@ -367,8 +367,7 @@
on Android 5.1 or later. on Android 5.1 or later.
</string> </string>
<string name="nearby_splash__download_apps_from_people_nearby">No internet? Download apps from people near you! <string name="nearby_splash__download_apps_from_people_nearby">No Internet? Get apps from people near you!</string>
</string>
<string name="nearby_splash__find_people_button">Find people near me</string> <string name="nearby_splash__find_people_button">Find people near me</string>
<string name="nearby_splash__both_parties_need_fdroid">Both parties need %1$s to use nearby.</string> <string name="nearby_splash__both_parties_need_fdroid">Both parties need %1$s to use nearby.</string>
@ -416,27 +415,25 @@
<string name="swap_cant_send_no_bluetooth">Cannot send F-Droid, because Bluetooth is unavailable on this device. <string name="swap_cant_send_no_bluetooth">Cannot send F-Droid, because Bluetooth is unavailable on this device.
</string> </string>
<string name="loading">Loading…</string> <string name="loading">Loading…</string>
<string name="swap_connection_misc_error">An error occurred while connecting to device, we can\'t seem to swap with <string name="swap_connection_misc_error">Error occurred while connecting to device, can\'t swap with it!</string>
it.
</string>
<string name="swap_not_enabled">Swapping not enabled</string> <string name="swap_not_enabled">Swapping not enabled</string>
<string name="swap_not_enabled_description">Before swapping, your device must be made visible.</string> <string name="swap_not_enabled_description">Before swapping, your device must be made visible.</string>
<string name="install_confirm">needs access to</string> <string name="install_confirm">needs access to</string>
<string name="install_confirm_update">Do you want to install an update <string name="install_confirm_update">Do you want to install an update
to this existing application? Your existing data will not to this existing app? Your existing data will not
be lost. The updated application will get access to: be lost. The updated app will get access to:
</string> </string>
<string name="install_confirm_update_system">Do you want to install an update <string name="install_confirm_update_system">Do you want to install an update
to this built-in application? Your existing data will not to this built-in app? Your existing data will not
be lost. The updated application will get access to: be lost. The updated app will get access to:
</string> </string>
<string name="install_confirm_update_no_perms">Do you want to install an update <string name="install_confirm_update_no_perms">Do you want to install an update
to this existing application? Your existing data will not to this existing app? Your existing data will not
be lost. It does not require any special access. be lost. It does not require any special access.
</string> </string>
<string name="install_confirm_update_system_no_perms">Do you want to install an update <string name="install_confirm_update_system_no_perms">Do you want to install an update
to this built-in application? Your existing data will not to this built-in app? Your existing data will not
be lost. It does not require any special access. be lost. It does not require any special access.
</string> </string>
<string name="newPerms">New</string> <string name="newPerms">New</string>
@ -444,7 +441,7 @@
<string name="perm_costs_money">This may cost you money</string> <string name="perm_costs_money">This may cost you money</string>
<string name="uninstall_update_confirm">Do you want to replace this app with the factory version?</string> <string name="uninstall_update_confirm">Do you want to replace this app with the factory version?</string>
<string name="uninstall_confirm">Do you want to uninstall this app?</string> <string name="uninstall_confirm">Do you want to uninstall this app?</string>
<string name="download_error">Download unsuccessful</string> <string name="download_error">Download failed!</string>
<string name="download_pending">Waiting to start download…</string> <string name="download_pending">Waiting to start download…</string>
<string name="install_error_notify_title">Error installing %s</string> <string name="install_error_notify_title">Error installing %s</string>
<string name="uninstall_error_notify_title">Error uninstalling %s</string> <string name="uninstall_error_notify_title">Error uninstalling %s</string>
@ -478,7 +475,7 @@
<string name="crash_dialog_title">F-Droid has crashed</string> <string name="crash_dialog_title">F-Droid has crashed</string>
<string name="crash_dialog_text">An unexpected error occurred <string name="crash_dialog_text">An unexpected error occurred
forcing the application to stop. Would you like to e-mail the forcing the app to stop. Would you like to e-mail the
details to help fix the issue? details to help fix the issue?
</string> </string>
<string name="crash_dialog_comment_prompt">You can add extra information and comments here:</string> <string name="crash_dialog_comment_prompt">You can add extra information and comments here:</string>

View File

@ -111,6 +111,12 @@
android:summary="@string/keep_install_history_summary" android:summary="@string/keep_install_history_summary"
android:defaultValue="false" android:defaultValue="false"
android:dependency="expert" /> android:dependency="expert" />
<CheckBoxPreference
android:key="forceOldIndex"
android:title="@string/force_old_index"
android:summary="@string/force_old_index_summary"
android:defaultValue="false"
android:dependency="expert" />
<CheckBoxPreference android:title="@string/system_installer" <CheckBoxPreference android:title="@string/system_installer"
android:defaultValue="false" android:defaultValue="false"
android:key="privilegedInstaller" android:key="privilegedInstaller"