File tree Expand file tree Collapse file tree
app/src/main/java/net/kollnig/missioncontrol/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import androidx .annotation .NonNull ;
2121
2222import java .util .ArrayList ;
23+ import java .util .Collections ;
2324import java .util .HashSet ;
2425import java .util .List ;
2526import java .util .Set ;
@@ -33,7 +34,7 @@ public class Tracker {
3334 public String category ;
3435 public Long lastSeen ;
3536 public String country ;
36- private List <String > dataTypes = new ArrayList <>() ;
37+ private List <String > dataTypes ;
3738
3839 /**
3940 * Creates class for tracker seen in apps' network traffic
@@ -117,7 +118,7 @@ public Set<String> getHosts() {
117118 * @param dataTypes List of data types
118119 */
119120 public void setDataTypes (List <String > dataTypes ) {
120- this .dataTypes = dataTypes ;
121+ this .dataTypes = dataTypes != null ? new ArrayList <>( dataTypes ) : new ArrayList <>() ;
121122 }
122123
123124 /**
@@ -126,6 +127,6 @@ public void setDataTypes(List<String> dataTypes) {
126127 * @return List of data types
127128 */
128129 public List <String > getDataTypes () {
129- return dataTypes ;
130+ return dataTypes != null ? Collections . unmodifiableList ( dataTypes ) : Collections . emptyList () ;
130131 }
131132}
Original file line number Diff line number Diff line change @@ -546,7 +546,7 @@ private void loadDisconnectTrackers(Context c) {
546546 private void addTrackerDomain (Tracker tracker , String dom ) {
547547 // Check if we have DDG data types for this domain
548548 List <String > dataTypes = domainToDataTypes .get (dom );
549- if (dataTypes != null && ! dataTypes . isEmpty () ) {
549+ if (dataTypes != null ) {
550550 tracker .setDataTypes (dataTypes );
551551 }
552552
You can’t perform that action at this time.
0 commit comments