Merge branch 'master' into improvements/apk-tests

Conflicts:
	test/src/org/fdroid/fdroid/AppProviderTest.java
This commit is contained in:
Peter Serwylo 2014-02-19 09:38:40 +11:00
commit 5877af55ae
7 changed files with 48 additions and 16 deletions

View File

@ -9,10 +9,12 @@
beam the FDroid.apk from FDroid's main screen (Android 4.1+)
* Support for repositories using self-signed HTTPS certificates through
Trust-on-first-use popup
a Trust-on-first-use popup
* Support for TLS Subject-Public-Key-Identifier pinning
* Various fixes to layout issues introduced in 0.58
### 0.58 (2014-01-11)
* Download icons with a resolution that matches the device's screen density,

11
TODO-before-release.md Normal file
View File

@ -0,0 +1,11 @@
These issues are a must-fix before the next stable release:
* Right after updating a repo, "Recently Updated" shows the apps correctly but
the new apks don't show up on App Details until the whole app is restarted
(or until the repos are wiped and re-downloaded)
Other minor issues:
* Make the bluetooth option prettier. Options:
- Move it into submenu (like "Share F-Droid" -> "Bluetooth/Mail/NFC/...")
- Remove ellipsis from menu option string

@ -1 +1 @@
Subproject commit 49452f67a760dfef77ddaa7e0b7d88c713c4a195
Subproject commit a705441ac53b9e1aba9f00f3f59aab81da6fbc9e

View File

@ -55,6 +55,20 @@ public class UpdateService extends IntentService implements ProgressListener {
super("UpdateService");
}
/**
* When an app already exists in the db, and we are updating it on the off chance that some
* values changed in the index, some fields should not be updated. Rather, they should be
* ignored, because they were explicitly set by the user, and hence can't be automatically
* overridden by the index.
*
* NOTE: In the future, these attributes will be moved to a join table, so that the app table
* is essentially completely transient, and can be nuked at any time.
*/
private static final String[] APP_FIELDS_TO_IGNORE = {
AppProvider.DataColumns.IGNORE_ALLUPDATES,
AppProvider.DataColumns.IGNORE_THISUPDATE
};
// For receiving results from the UpdateService when we've told it to
// update in response to a user request.
public static class UpdateReceiver extends ResultReceiver {
@ -304,8 +318,8 @@ public class UpdateService extends IntentService implements ProgressListener {
if (success && changes && prefs.getBoolean(Preferences.PREF_UPD_NOTIFY, false)) {
int updateCount = 0;
for (App app : appsToUpdate.values()) {
if (app.hasUpdates(this)) {
updateCount ++;
if (app.canAndWantToUpdate(this)) {
updateCount++;
}
}
@ -644,6 +658,11 @@ public class UpdateService extends IntentService implements ProgressListener {
private ContentProviderOperation updateExistingApp(App app) {
Uri uri = AppProvider.getContentUri(app);
ContentValues values = app.toContentValues();
for (String toIgnore : APP_FIELDS_TO_IGNORE) {
if (values.containsKey(toIgnore)) {
values.remove(toIgnore);
}
}
return ContentProviderOperation.newUpdate(uri).withValues(values).build();
}

View File

@ -38,6 +38,6 @@ public class MockContextSwappableComponents extends MockContext {
@Override
public MockContentResolver getContentResolver() {
return contentResolver;
return contentResolver;
}
}

View File

@ -126,13 +126,13 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
List<String> categories = AppProvider.Helper.categories(getMockContext());
String[] expected = new String[] {
getMockContext().getResources().getString(R.string.category_whatsnew),
getMockContext().getResources().getString(R.string.category_recentlyupdated),
getMockContext().getResources().getString(R.string.category_all),
"Animal",
"Mineral",
"Vegetable"
};
getMockContext().getResources().getString(R.string.category_whatsnew),
getMockContext().getResources().getString(R.string.category_recentlyupdated),
getMockContext().getResources().getString(R.string.category_all),
"Animal",
"Mineral",
"Vegetable"
};
TestUtils.assertContainsOnly(categories, expected);
}

View File

@ -70,10 +70,10 @@ public abstract class FDroidProviderTest<T extends FDroidProvider> extends Provi
protected void assertInvalidUri(Uri uri) {
try {
// Use getProvdider instead of getContentResolver, because the mock
// content resolver wont result in the provider we are testing, and
// hence we don't get to see how our provider responds to invalid
// uris.
// Use getProvdider instead of getContentResolver, because the mock
// content resolver wont result in the provider we are testing, and
// hence we don't get to see how our provider responds to invalid
// uris.
getProvider().query(uri, getMinimalProjection(), null, null, null);
fail();
} catch (UnsupportedOperationException e) {}