always update itself last
When auto-updates are enabled, the app should update itself last, to ensure that all of the other apps are completely updated before this app is killed as part of the update process. closes #1556
This commit is contained in:
parent
272a0e3f27
commit
d2fea72ed9
@ -544,12 +544,27 @@ public class UpdateService extends JobIntentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues all apps needing update. If this app itself (e.g. F-Droid) needs
|
||||||
|
* to be updated, it is queued last.
|
||||||
|
*/
|
||||||
public static void autoDownloadUpdates(Context context) {
|
public static void autoDownloadUpdates(Context context) {
|
||||||
List<App> canUpdate = AppProvider.Helper.findCanUpdate(context, Schema.AppMetadataTable.Cols.ALL);
|
List<App> canUpdate = AppProvider.Helper.findCanUpdate(context, Schema.AppMetadataTable.Cols.ALL);
|
||||||
|
String packageName = context.getPackageName();
|
||||||
|
App updateLastApp = null;
|
||||||
|
Apk updateLastApk = null;
|
||||||
for (App app : canUpdate) {
|
for (App app : canUpdate) {
|
||||||
|
if (TextUtils.equals(packageName, app.packageName)) {
|
||||||
|
updateLastApp = app;
|
||||||
|
updateLastApk = ApkProvider.Helper.findSuggestedApk(context, app);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Apk apk = ApkProvider.Helper.findSuggestedApk(context, app);
|
Apk apk = ApkProvider.Helper.findSuggestedApk(context, app);
|
||||||
InstallManagerService.queue(context, app, apk);
|
InstallManagerService.queue(context, app, apk);
|
||||||
}
|
}
|
||||||
|
if (updateLastApp != null && updateLastApk != null) {
|
||||||
|
InstallManagerService.queue(context, updateLastApp, updateLastApk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAppUpdatesNotification(List<App> canUpdate) {
|
private void showAppUpdatesNotification(List<App> canUpdate) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user