001package de.econda.droid; 002 003/** 004 * PrivacySettings 005 * 006 * Collection of persisted settings of the user for controlling privacy features. 007 * 008 * The user is often allowed to switch his privacy settings. 009 * 010 * Then at session the method changePrivacySettings(newSettings) is called. 011 * The settings will be stored and used for any further tracking that occur later. 012 * 013 */ 014public class PrivacySettings { 015 016 /** 017 * Predefined Settings, usually used if user has forbidden further tracking. 018 */ 019 public static final PrivacySettings DO_NOT_TRACK = new PrivacySettings(SubmitMode.DO_NOT_TRACK, false, false, false); 020 021 /** 022 * Predefined Settings, usually used if user should be asked for permission to track. 023 * But user has not given his permission until now. 024 * Data will be cached, but not transmitted. 025 */ 026 public static final PrivacySettings CACHE = new PrivacySettings(SubmitMode.CACHE, false, false, false); 027 028 /** 029 * Predefined Settings, usually used if user should be tracked in an very save and privacy friendly way. 030 * No visitor id will be generated. No geoIp will be done. And all known information will be dropped with 031 * which the user can perhaps loose his anonymized state. 032 */ 033 public static final PrivacySettings ANONYM = new PrivacySettings(SubmitMode.TRACK, false, false, true); 034 035 /** 036 * User has given his commit to track. More anonymization (drop of information) can still be configured in econda monitor. 037 */ 038 public static final PrivacySettings FULL = new PrivacySettings(SubmitMode.TRACK, true, true, false); 039 040 041 public PrivacySettings(SubmitMode submitMode, boolean visitorAnalytics, boolean geoIP, boolean anonymizeBeforeTransmit) { 042 this.submitMode = submitMode; 043 this.visitorAnalytics = visitorAnalytics; 044 this.geoIP = geoIP; 045 this.anonymizeBeforeTransmit = anonymizeBeforeTransmit; 046 } 047 048 private final SubmitMode submitMode; 049 private final boolean visitorAnalytics; 050 private final boolean geoIP; 051 private final boolean anonymizeBeforeTransmit; 052 053 /** 054 * @return submitMode If the data is transmitted, cached for later transmission or even dropped. 055 */ 056 public SubmitMode getSubmitMode() { 057 return submitMode; 058 } 059 060 /** 061 * @return visitorAnalytics If a random unique id is created and stored for identifying the user later in an anonymize way. 062 */ 063 public boolean isVisitorAnalytics() { 064 return visitorAnalytics; 065 } 066 067 /** 068 * 069 * @return geoIP Whether the geo location is estimated later (from IP-Address). 070 */ 071 public boolean isGeoIP() { 072 return geoIP; 073 } 074 075 /** 076 * 077 * @return Wheter it should be tried to remove all data, that could break anonymity of user 078 * 079 * Billing ids, login names and more will be removed 080 */ 081 public boolean isAnonymizeBeforeTransmit() { 082 return anonymizeBeforeTransmit; 083 } 084 085 086 @Override 087 public String toString() { 088 return "PrivacySettings{" + 089 "submitMode=" + submitMode + 090 ", visitorAnalytics=" + visitorAnalytics + 091 ", geoIP=" + geoIP + 092 ", anonymizeBeforeTransmit=" + anonymizeBeforeTransmit + 093 '}'; 094 } 095}