Merge branch 'fix-685--downloading-unknown' into 'master'

Ask for all fields from the content provider.

**To be cherry-picked into `master` as well as this merge into `stable-v0.100`**

Fixes #684. 

![fixed](/uploads/dcef00026427778c9180b7da7ab0a9ee/fixed.png)

Ask for all fields from the `ContentProvider`.
    
It is not a particularly expensive operation in the scheme of things. When we are going to the database, the bottlneck is in disk access for the actual query of the database tables (looking up indexes, performing joins, etc). The difference between retrieving two columns or all the columns when the query is for a handful of apps is inconsequential. 
    
Thus, it is better to be safe than sorry and just ask for all the things so that our value objects are correctly populated. There are indeed suitable times to only request specific fields, but I'd suggest that they are probably only when we need to ask a question about thousands of apps at a time, and then the heap space becomes a concern.

See merge request !328
This commit is contained in:
Hans-Christoph Steiner 2016-06-14 21:40:17 +00:00
commit d47e87e53b

View File

@ -467,10 +467,8 @@ public class UpdateService extends IntentService {
private void autoDownloadUpdates() { private void autoDownloadUpdates() {
Cursor cursor = getContentResolver().query( Cursor cursor = getContentResolver().query(
AppProvider.getCanUpdateUri(), AppProvider.getCanUpdateUri(),
new String[]{ AppProvider.DataColumns.ALL,
AppProvider.DataColumns.PACKAGE_NAME, null, null, null);
AppProvider.DataColumns.SUGGESTED_VERSION_CODE,
}, null, null, null);
if (cursor != null) { if (cursor != null) {
cursor.moveToFirst(); cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) { for (int i = 0; i < cursor.getCount(); i++) {