Make autoDownloadUpdatesUpdateService part of the public API of UpdateService.

This will be a requirement for an 'Update All' button in the UI.
This commit is contained in:
Peter Serwylo 2016-11-24 06:54:41 +11:00
parent 226554c026
commit f0d4f8f01a

View File

@ -410,7 +410,7 @@ public class UpdateService extends IntentService {
// now that downloading the index is done, start downloading updates // now that downloading the index is done, start downloading updates
if (changes && fdroidPrefs.isAutoDownloadEnabled()) { if (changes && fdroidPrefs.isAutoDownloadEnabled()) {
autoDownloadUpdates(); autoDownloadUpdates(this);
} }
} }
@ -469,8 +469,8 @@ public class UpdateService extends IntentService {
} }
} }
private void autoDownloadUpdates() { public static void autoDownloadUpdates(Context context) {
Cursor cursor = getContentResolver().query( Cursor cursor = context.getContentResolver().query(
AppProvider.getCanUpdateUri(), AppProvider.getCanUpdateUri(),
Schema.AppMetadataTable.Cols.ALL, Schema.AppMetadataTable.Cols.ALL,
null, null, null); null, null, null);
@ -478,8 +478,8 @@ public class UpdateService extends IntentService {
cursor.moveToFirst(); cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) { for (int i = 0; i < cursor.getCount(); i++) {
App app = new App(cursor); App app = new App(cursor);
Apk apk = ApkProvider.Helper.findApkFromAnyRepo(this, app.packageName, app.suggestedVersionCode); Apk apk = ApkProvider.Helper.findApkFromAnyRepo(context, app.packageName, app.suggestedVersionCode);
InstallManagerService.queue(this, app, apk); InstallManagerService.queue(context, app, apk);
cursor.moveToNext(); cursor.moveToNext();
} }
cursor.close(); cursor.close();