Skip to content

Commit cd5628c

Browse files
committed
Merge pull request #56 from SandroMachado/enhancement/show-tests-progress
Show tests progress
2 parents d8fcddc + f56f860 commit cd5628c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/src/main/java/fuzion24/device/vulnerability/test/VulnerabilityTestRunner.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ public class VulnerabilityTestRunner extends AsyncTask<Void, Integer, List<Vulne
1818
private MaterialDialog mProgressDialog;
1919
private final ResultsCallback mCustomCallback;
2020
private final Context mCtx;
21+
private List<VulnerabilityTest> tests;
2122

2223
private static final String TAG = "VULN_TEST";
2324

2425
public VulnerabilityTestRunner(Context actv, Boolean showScanDialog, ResultsCallback callback) {
2526
mCtx = actv;
2627
mShowWaitDiaglog = showScanDialog;
2728
mCustomCallback = callback;
29+
tests = VulnerabilityOrganizer.getTests(mCtx);
2830
}
2931

3032
@Override
@@ -34,7 +36,7 @@ protected void onPreExecute() {
3436
.title("Device Vulnerability Checker")
3537
.content("Checking device for publicly known vulnerabilities")
3638
.cancelable(false)
37-
.progress(true, 0)
39+
.progress(false, tests.size())
3840
.show();
3941
}
4042
}
@@ -43,10 +45,11 @@ protected void onPreExecute() {
4345
protected List<VulnerabilityTestResult> doInBackground(Void... params) {
4446
Log.d(TAG, "Async execute called!!!!");
4547

46-
List<VulnerabilityTest> tests = VulnerabilityOrganizer.getTests(mCtx);
47-
List<VulnerabilityTestResult> results = new ArrayList<VulnerabilityTestResult>();
48+
List<VulnerabilityTestResult> results = new ArrayList<>();
4849

4950
for (int i = 0; i < tests.size(); i++) {
51+
mProgressDialog.setProgress(i);
52+
5053
VulnerabilityTest test = tests.get(i);
5154
Log.d(TAG, "Running test: " + test.getCVEorID());
5255
Exception x = null;

0 commit comments

Comments
 (0)