Reformat code and bump version

This commit is contained in:
Tad 2018-10-21 16:07:32 -04:00
parent 521ae4891d
commit 716b58bd16
4 changed files with 12 additions and 13 deletions

Binary file not shown.

View file

@ -6,8 +6,8 @@ android {
applicationId "us.spotco.malwarescanner"
minSdkVersion 16
targetSdkVersion 26
versionCode 38
versionName "2.8"
versionCode 39
versionName "2.9"
resConfigs "en"
}
buildTypes {

View file

@ -124,7 +124,7 @@ class Database {
if (databaseLocation.exists()) {
try {
BufferedReader reader;
if(databaseLocation.getName().endsWith(".gz")) {
if (databaseLocation.getName().endsWith(".gz")) {
reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(databaseLocation))));
} else {
reader = new BufferedReader(new FileReader(databaseLocation));
@ -133,7 +133,7 @@ class Database {
if (database.getName().contains(".hdb")) {//.hdb format: md5, size, name
while ((line = reader.readLine()) != null) {
String[] lineS = line.split(":");
if(Utils.TRIM_VARIANT_NUMBER) {
if (Utils.TRIM_VARIANT_NUMBER) {
lineS[2] = lineS[2].split("-")[0];
}
signaturesMD5.put(lineS[0].substring(0, Utils.MAX_HASH_LENGTH), lineS[2]);
@ -141,7 +141,7 @@ class Database {
} else if (database.getName().contains(".hsb")) {//.hsb format: sha256, size, name
while ((line = reader.readLine()) != null) {
String[] lineS = line.split(":");
if(Utils.TRIM_VARIANT_NUMBER) {
if (Utils.TRIM_VARIANT_NUMBER) {
lineS[2] = lineS[2].split("-")[0];
}
if (lineS[0].length() == 32) {
@ -152,7 +152,7 @@ class Database {
}
}
reader.close();
} catch(Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.preference.PreferenceManager;
import java.io.File;
import java.net.Socket;
@ -37,7 +36,7 @@ class Utils {
public final static int MAX_SCAN_SIZE_REALTIME = MAX_SCAN_SIZE / 2; //40MB
public final static int MAX_HASH_LENGTH = 12;
public final static boolean TRIM_VARIANT_NUMBER = true;
public final static boolean TRIM_VARIANT_NUMBER = false;
public static int FILES_SCANNED = 0;
private static ThreadPoolExecutor threadPoolExecutor = null;
@ -111,7 +110,7 @@ class Utils {
PackageManager pm = context.getPackageManager();
try {
pm.getPackageInfo(packageID, PackageManager.GET_META_DATA);
} catch(PackageManager.NameNotFoundException e) {
} catch (PackageManager.NameNotFoundException e) {
return false;
}
return true;
@ -135,13 +134,13 @@ class Utils {
try {
s = new Socket(host, port);
return true;
} catch(Exception e) {
} catch (Exception e) {
return false;
} finally {
if (s != null) {
try {
s.close();
} catch(Exception e1) {
} catch (Exception e1) {
}
}
}
@ -150,11 +149,11 @@ class Utils {
public static boolean waitUntilOrbotIsAvailable() {
int tries = 0;
boolean listening;
while(!(listening = isPortListening("127.0.0.1", 9050)) && tries <= 60) {
while (!(listening = isPortListening("127.0.0.1", 9050)) && tries <= 60) {
tries++;
try {
Thread.sleep(1000);
} catch(Exception e) {
} catch (Exception e) {
}
}