@@ -18,13 +18,15 @@ public class VulnerabilityTestRunner extends AsyncTask<Void, Integer, List<Vulne
18
18
private MaterialDialog mProgressDialog ;
19
19
private final ResultsCallback mCustomCallback ;
20
20
private final Context mCtx ;
21
+ private List <VulnerabilityTest > tests ;
21
22
22
23
private static final String TAG = "VULN_TEST" ;
23
24
24
25
public VulnerabilityTestRunner (Context actv , Boolean showScanDialog , ResultsCallback callback ) {
25
26
mCtx = actv ;
26
27
mShowWaitDiaglog = showScanDialog ;
27
28
mCustomCallback = callback ;
29
+ tests = VulnerabilityOrganizer .getTests (mCtx );
28
30
}
29
31
30
32
@ Override
@@ -34,7 +36,7 @@ protected void onPreExecute() {
34
36
.title ("Device Vulnerability Checker" )
35
37
.content ("Checking device for publicly known vulnerabilities" )
36
38
.cancelable (false )
37
- .progress (true , 0 )
39
+ .progress (false , tests . size () )
38
40
.show ();
39
41
}
40
42
}
@@ -43,10 +45,11 @@ protected void onPreExecute() {
43
45
protected List <VulnerabilityTestResult > doInBackground (Void ... params ) {
44
46
Log .d (TAG , "Async execute called!!!!" );
45
47
46
- List <VulnerabilityTest > tests = VulnerabilityOrganizer .getTests (mCtx );
47
- List <VulnerabilityTestResult > results = new ArrayList <VulnerabilityTestResult >();
48
+ List <VulnerabilityTestResult > results = new ArrayList <>();
48
49
49
50
for (int i = 0 ; i < tests .size (); i ++) {
51
+ mProgressDialog .setProgress (i );
52
+
50
53
VulnerabilityTest test = tests .get (i );
51
54
Log .d (TAG , "Running test: " + test .getCVEorID ());
52
55
Exception x = null ;
0 commit comments