mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 19:06:53 +01:00
Some logging for the weird blacklist issue #696
This commit is contained in:
parent
c79eda5507
commit
e279cd736f
@ -338,26 +338,34 @@ public class GBApplication extends Application {
|
|||||||
private static HashSet<String> blacklist = null;
|
private static HashSet<String> blacklist = null;
|
||||||
|
|
||||||
public static boolean isBlacklisted(String packageName) {
|
public static boolean isBlacklisted(String packageName) {
|
||||||
|
if (blacklist == null) {
|
||||||
|
GB.log("isBlacklisted: blacklisti is null!", GB.INFO, null);
|
||||||
|
}
|
||||||
return blacklist != null && blacklist.contains(packageName);
|
return blacklist != null && blacklist.contains(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBlackList(Set<String> packageNames) {
|
public static void setBlackList(Set<String> packageNames) {
|
||||||
if (packageNames == null) {
|
if (packageNames == null) {
|
||||||
|
GB.log("Set null blacklist", GB.INFO, null);
|
||||||
blacklist = new HashSet<>();
|
blacklist = new HashSet<>();
|
||||||
} else {
|
} else {
|
||||||
blacklist = new HashSet<>(packageNames);
|
blacklist = new HashSet<>(packageNames);
|
||||||
}
|
}
|
||||||
|
GB.log("New blacklist has " + blacklist.size() + " entries", GB.INFO, null);
|
||||||
saveBlackList();
|
saveBlackList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadBlackList() {
|
private static void loadBlackList() {
|
||||||
|
GB.log("Loading blacklist", GB.INFO, null);
|
||||||
blacklist = (HashSet<String>) sharedPrefs.getStringSet(GBPrefs.PACKAGE_BLACKLIST, null);
|
blacklist = (HashSet<String>) sharedPrefs.getStringSet(GBPrefs.PACKAGE_BLACKLIST, null);
|
||||||
if (blacklist == null) {
|
if (blacklist == null) {
|
||||||
blacklist = new HashSet<>();
|
blacklist = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
GB.log("Loaded blacklist has " + blacklist.size() + " entries", GB.INFO, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void saveBlackList() {
|
private static void saveBlackList() {
|
||||||
|
GB.log("Saving blacklist with " + blacklist.size() + " entries", GB.INFO, null);
|
||||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||||
if (blacklist.isEmpty()) {
|
if (blacklist.isEmpty()) {
|
||||||
editor.putStringSet(GBPrefs.PACKAGE_BLACKLIST, null);
|
editor.putStringSet(GBPrefs.PACKAGE_BLACKLIST, null);
|
||||||
@ -374,6 +382,7 @@ public class GBApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void removeFromBlacklist(String packageName) {
|
public static synchronized void removeFromBlacklist(String packageName) {
|
||||||
|
GB.log("Removing from blacklist: " + packageName, GB.INFO, null);
|
||||||
blacklist.remove(packageName);
|
blacklist.remove(packageName);
|
||||||
saveBlackList();
|
saveBlackList();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user