mirror of https://github.com/M66B/NetGuard.git
Clear database cache on import
This commit is contained in:
parent
dd4fd5378f
commit
a7e8147943
|
@ -1277,6 +1277,8 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
// Upgrade imported settings
|
||||
Receiver.upgrade(true, this);
|
||||
|
||||
DatabaseHelper.clearCache();
|
||||
|
||||
// Refresh UI
|
||||
prefs.edit().putBoolean("imported", true).apply();
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
|
|
@ -55,6 +55,8 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
private static HandlerThread hthread = null;
|
||||
private static Handler handler = null;
|
||||
|
||||
private static Map<Integer, Long> mapUidHosts = new HashMap<>();
|
||||
|
||||
private final static int MSG_LOG = 1;
|
||||
private final static int MSG_ACCESS = 2;
|
||||
private final static int MSG_FORWARD = 3;
|
||||
|
@ -81,6 +83,12 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
return dh;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
synchronized (mapUidHosts) {
|
||||
mapUidHosts.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
Log.w(TAG, "Database is being closed");
|
||||
|
@ -728,8 +736,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private static Map<Integer, Long> mapUidHosts = new HashMap<>();
|
||||
|
||||
public long getHostCount(int uid, boolean usecache) {
|
||||
if (usecache)
|
||||
synchronized (mapUidHosts) {
|
||||
|
|
Loading…
Reference in New Issue