Keep track of the number of updates being verified

This commit is contained in:
Gabriele M
2017-07-04 19:05:04 +02:00
parent e7923a3d56
commit 653b577d61
2 changed files with 10 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ public class UpdaterController implements UpdaterControllerInt {
private final File mDownloadRoot;
private int mActiveDownloads = 0;
private int mVerifyingUpdates = 0;
public static synchronized UpdaterController getInstance() {
return sUpdaterController;
@@ -209,6 +210,7 @@ public class UpdaterController implements UpdaterControllerInt {
new Thread(new Runnable() {
@Override
public void run() {
mVerifyingUpdates++;
UpdateDownload update = mDownloads.get(downloadId).mUpdate;
File file = update.getFile();
if (file.exists() && verifyPackage(file)) {
@@ -221,6 +223,7 @@ public class UpdaterController implements UpdaterControllerInt {
update.setProgress(0);
update.setStatus(UpdateStatus.VERIFICATION_FAILED);
}
mVerifyingUpdates--;
notifyUpdateChange(downloadId);
}
}).start();
@@ -411,4 +414,9 @@ public class UpdaterController implements UpdaterControllerInt {
public boolean hasActiveDownloads() {
return mActiveDownloads > 0;
}
@Override
public boolean isVerifyingUpdate() {
return mVerifyingUpdates > 0;
}
}