SensitivePhoneNumbers: Convert to singleton class

* Now that there are more users than just call log, it is better to parse
  the XML-file just once
* Keep an instance around for the various users of this class

Change-Id: Iff1510dc40d68a211a6a1c5f19e4ca9ac64c3fcd
This commit is contained in:
Michael W
2019-09-15 12:19:46 +02:00
committed by Luca Stefani
parent bf0d04e4de
commit 1498ef9052

View File

@@ -50,12 +50,21 @@ public class SensitivePhoneNumbers {
public static final String SENSIBLE_PHONENUMBERS_FILE_PATH = "etc/sensitive_pn.xml";
private static final String ns = null;
private static SensitivePhoneNumbers sInstance = null;
private HashMap<String, ArrayList<String>> mSensitiveNumbersMap = new HashMap<>();
public SensitivePhoneNumbers() {
private SensitivePhoneNumbers() {
loadSensiblePhoneNumbers();
}
public static SensitivePhoneNumbers getInstance() {
if (sInstance == null) {
sInstance = new SensitivePhoneNumbers();
}
return sInstance;
}
private void loadSensiblePhoneNumbers() {
FileReader sensiblePNReader;