mirror of
https://github.com/MaintainTeam/Hypatia.git
synced 2025-03-01 05:48:23 +03:00
Fixes
This commit is contained in:
parent
a31cf44e3d
commit
5b173677a2
4 changed files with 6 additions and 8 deletions
|
@ -37,7 +37,7 @@ public class DatabaseManager {
|
|||
private static Context context;
|
||||
|
||||
public DatabaseManager(Context context) {
|
||||
this.context = context;
|
||||
DatabaseManager.context = context;
|
||||
databasePath = new File(context.getFilesDir() + "/signatures/");
|
||||
databasePath.mkdir();
|
||||
}
|
||||
|
|
|
@ -63,14 +63,10 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||
if (key.equals("scanner_realtime_enabled")) {
|
||||
if (prefs.getBoolean("scanner_realtime_enabled", false)) {
|
||||
Utils.considerStartService(getContext());
|
||||
Log.d("settings", "scanner true");
|
||||
} else {
|
||||
Intent realtimeScanner = new Intent(getContext(), MalwareScannerService.class);
|
||||
getContext().stopService(realtimeScanner);
|
||||
Log.d("settings", "scanner false");
|
||||
|
||||
}
|
||||
}
|
||||
Log.d("settings", key + " " + System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -41,11 +42,11 @@ public class Utils {
|
|||
private static Context context = null;
|
||||
|
||||
public Utils(Context context) {
|
||||
this.context = context;
|
||||
Utils.context = context;
|
||||
}
|
||||
|
||||
public static SharedPreferences getPrefs(Context context) {
|
||||
return context.getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE);
|
||||
return PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
|
||||
private static ThreadPoolExecutor threadPoolExecutor = null;
|
||||
|
@ -101,7 +102,6 @@ public class Utils {
|
|||
public static void considerStartService(Context context) {
|
||||
if (!isServiceRunning(MalwareScannerService.class, context)) {
|
||||
boolean autostart = getPrefs(context).getBoolean("scanner_realtime_enabled", false);
|
||||
Log.d("Utils", autostart + "");
|
||||
if (autostart) {
|
||||
Intent realtimeScanner = new Intent(context, MalwareScannerService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
|
|
@ -36,12 +36,14 @@
|
|||
android:title="@string/settings_pref_optimizations_scanner_max_size"
|
||||
android:summary="@string/settings_pref_optimizations_scanner_max_size_summary"
|
||||
android:defaultValue="80"
|
||||
android:numeric="integer"
|
||||
android:inputType="number" />
|
||||
<EditTextPreference
|
||||
android:key="database_hash_length"
|
||||
android:title="@string/settings_pref_optimizations_database_hash_length"
|
||||
android:summary="@string/settings_pref_optimizations_database_hash_length_summary"
|
||||
android:defaultValue="12"
|
||||
android:numeric="integer"
|
||||
android:inputType="number" />
|
||||
<CheckBoxPreference
|
||||
android:key="database_trim_variants"
|
||||
|
|
Loading…
Add table
Reference in a new issue