1717import java .io .Serializable ;
1818import java .util .Calendar ;
1919import java .util .LinkedList ;
20- import java .util .List ;
2120import java .util .Locale ;
2221
2322public class ActivityState implements Serializable , Cloneable {
2423 private static final long serialVersionUID = 9039439291143138148L ;
25- private static int ORDER_ID_MAXCOUNT = 10 ;
24+ private static final int ORDER_ID_MAXCOUNT = 10 ;
2625 private transient ILogger logger ;
2726 private static final ObjectStreamField [] serialPersistentFields = {
2827 new ObjectStreamField ("uuid" , String .class ),
@@ -39,6 +38,9 @@ public class ActivityState implements Serializable, Cloneable {
3938 new ObjectStreamField ("orderIds" , (Class <LinkedList <String >>)(Class ) LinkedList .class ),
4039 new ObjectStreamField ("pushToken" , String .class ),
4140 new ObjectStreamField ("adid" , String .class ),
41+ new ObjectStreamField ("clickTime" , long .class ),
42+ new ObjectStreamField ("installBegin" , long .class ),
43+ new ObjectStreamField ("installReferrer" , String .class ),
4244 };
4345
4446 // persistent data
@@ -65,13 +67,16 @@ public class ActivityState implements Serializable, Cloneable {
6567 protected String pushToken ;
6668 protected String adid ;
6769
70+ protected long clickTime ;
71+ protected long installBegin ;
72+ protected String installReferrer ;
73+
6874 protected ActivityState () {
6975 logger = AdjustFactory .getLogger ();
7076 // create UUID for new devices
7177 uuid = Util .createUuid ();
7278 enabled = true ;
7379 askingAttribution = false ;
74-
7580 eventCount = 0 ; // no events yet
7681 sessionCount = 0 ; // the first session just started
7782 subsessionCount = -1 ; // we don't know how many subsessions this first session will have
@@ -83,6 +88,9 @@ protected ActivityState() {
8388 orderIds = null ;
8489 pushToken = null ;
8590 adid = null ;
91+ clickTime = 0 ;
92+ installBegin = 0 ;
93+ installReferrer = null ;
8694 }
8795
8896 protected void resetSessionAttributes (long now ) {
@@ -127,19 +135,22 @@ public boolean equals(Object other) {
127135 if (getClass () != other .getClass ()) return false ;
128136 ActivityState otherActivityState = (ActivityState ) other ;
129137
130- if (!Util .equalString (uuid , otherActivityState .uuid )) return false ;
131- if (!Util .equalBoolean (enabled , otherActivityState .enabled )) return false ;
132- if (!Util .equalBoolean (askingAttribution , otherActivityState .askingAttribution )) return false ;
133- if (!Util .equalInt (eventCount , otherActivityState .eventCount )) return false ;
134- if (!Util .equalInt (sessionCount , otherActivityState .sessionCount )) return false ;
135- if (!Util .equalInt (subsessionCount , otherActivityState .subsessionCount )) return false ;
136- if (!Util .equalLong (sessionLength , otherActivityState .sessionLength )) return false ;
137- if (!Util .equalLong (timeSpent , otherActivityState .timeSpent )) return false ;
138- if (!Util .equalLong (lastInterval , otherActivityState .lastInterval )) return false ;
139- if (!Util .equalBoolean (updatePackages , otherActivityState .updatePackages )) return false ;
138+ if (!Util .equalString (uuid , otherActivityState .uuid )) return false ;
139+ if (!Util .equalBoolean (enabled , otherActivityState .enabled )) return false ;
140+ if (!Util .equalBoolean (askingAttribution , otherActivityState .askingAttribution )) return false ;
141+ if (!Util .equalInt (eventCount , otherActivityState .eventCount )) return false ;
142+ if (!Util .equalInt (sessionCount , otherActivityState .sessionCount )) return false ;
143+ if (!Util .equalInt (subsessionCount , otherActivityState .subsessionCount )) return false ;
144+ if (!Util .equalLong (sessionLength , otherActivityState .sessionLength )) return false ;
145+ if (!Util .equalLong (timeSpent , otherActivityState .timeSpent )) return false ;
146+ if (!Util .equalLong (lastInterval , otherActivityState .lastInterval )) return false ;
147+ if (!Util .equalBoolean (updatePackages , otherActivityState .updatePackages )) return false ;
140148 if (!Util .equalObject (orderIds , otherActivityState .orderIds )) return false ;
141149 if (!Util .equalString (pushToken , otherActivityState .pushToken )) return false ;
142150 if (!Util .equalString (adid , otherActivityState .adid )) return false ;
151+ if (!Util .equalLong (clickTime , otherActivityState .clickTime )) return false ;
152+ if (!Util .equalLong (installBegin , otherActivityState .installBegin )) return false ;
153+ if (!Util .equalString (installReferrer , otherActivityState .installReferrer )) return false ;
143154 return true ;
144155 }
145156
@@ -159,6 +170,9 @@ public int hashCode() {
159170 hashCode = 37 * hashCode + Util .hashObject (orderIds );
160171 hashCode = 37 * hashCode + Util .hashString (pushToken );
161172 hashCode = 37 * hashCode + Util .hashString (adid );
173+ hashCode = 37 * hashCode + Util .hashLong (clickTime );
174+ hashCode = 37 * hashCode + Util .hashLong (installBegin );
175+ hashCode = 37 * hashCode + Util .hashString (installReferrer );
162176 return hashCode ;
163177 }
164178
@@ -179,13 +193,14 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
179193 askingAttribution = Util .readBooleanField (fields , "askingAttribution" , false );
180194
181195 updatePackages = Util .readBooleanField (fields , "updatePackages" , false );
182-
183196 orderIds = Util .readObjectField (fields , "orderIds" , null );
184-
185197 pushToken = Util .readStringField (fields , "pushToken" , null );
186-
187198 adid = Util .readStringField (fields , "adid" , null );
188199
200+ clickTime = Util .readLongField (fields , "clickTime" , -1l );
201+ installBegin = Util .readLongField (fields , "installBegin" , -1l );
202+ installReferrer = Util .readStringField (fields , "installReferrer" , null );
203+
189204 // create UUID for migrating devices
190205 if (uuid == null ) {
191206 uuid = Util .createUuid ();
0 commit comments