aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2019-09-15 12:19:46 +0200
committerMichael W <baddaemon87@gmail.com>2019-11-03 01:26:55 +0100
commit9403977a02874f8569edb51f4a07bbb4d3846b7b (patch)
treebc4d56f06e743e6d9d15d231343732fbc619fa23
parent6b12b1119119f9af76c60f3a1568d15b0b9adb52 (diff)
downloadlineage-sdk-9403977a02874f8569edb51f4a07bbb4d3846b7b.tar.gz
lineage-sdk-9403977a02874f8569edb51f4a07bbb4d3846b7b.tar.bz2
lineage-sdk-9403977a02874f8569edb51f4a07bbb4d3846b7b.zip
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
-rw-r--r--sdk/src/java/org/lineageos/internal/phone/SensitivePhoneNumbers.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/sdk/src/java/org/lineageos/internal/phone/SensitivePhoneNumbers.java b/sdk/src/java/org/lineageos/internal/phone/SensitivePhoneNumbers.java
index 8d917600..ff2d65f5 100644
--- a/sdk/src/java/org/lineageos/internal/phone/SensitivePhoneNumbers.java
+++ b/sdk/src/java/org/lineageos/internal/phone/SensitivePhoneNumbers.java
@@ -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;