forked from Juby210/discord-jadx
147 lines
9.9 KiB
Java
147 lines
9.9 KiB
Java
|
package com.adjust.sdk;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.io.ObjectInputStream;
|
||
|
import java.io.ObjectOutputStream;
|
||
|
import java.io.ObjectStreamField;
|
||
|
import java.io.Serializable;
|
||
|
import java.util.Calendar;
|
||
|
import java.util.LinkedList;
|
||
|
public class ActivityState implements Serializable, Cloneable {
|
||
|
private static final int ORDER_ID_MAXCOUNT = 10;
|
||
|
private static final ObjectStreamField[] serialPersistentFields;
|
||
|
private static final long serialVersionUID = 9039439291143138148L;
|
||
|
public String adid = null;
|
||
|
public boolean askingAttribution = false;
|
||
|
public long clickTime = 0;
|
||
|
public long clickTimeHuawei = 0;
|
||
|
public boolean enabled = true;
|
||
|
public int eventCount = 0;
|
||
|
public long installBegin = 0;
|
||
|
public long installBeginHuawei = 0;
|
||
|
public String installReferrer = null;
|
||
|
public String installReferrerHuawei = null;
|
||
|
public boolean isGdprForgotten = false;
|
||
|
public boolean isThirdPartySharingDisabled = false;
|
||
|
public long lastActivity = -1;
|
||
|
public long lastInterval = -1;
|
||
|
private transient ILogger logger = AdjustFactory.getLogger();
|
||
|
public LinkedList<String> orderIds = null;
|
||
|
public String pushToken = null;
|
||
|
public int sessionCount = 0;
|
||
|
public long sessionLength = -1;
|
||
|
public int subsessionCount = -1;
|
||
|
public long timeSpent = -1;
|
||
|
public boolean updatePackages = false;
|
||
|
public String uuid = Util.createUuid();
|
||
|
|
||
|
static {
|
||
|
Class cls = Boolean.TYPE;
|
||
|
Class cls2 = Integer.TYPE;
|
||
|
Class cls3 = Long.TYPE;
|
||
|
serialPersistentFields = new ObjectStreamField[]{new ObjectStreamField("uuid", String.class), new ObjectStreamField("enabled", cls), new ObjectStreamField("isGdprForgotten", cls), new ObjectStreamField("isThirdPartySharingDisabled", cls), new ObjectStreamField("askingAttribution", cls), new ObjectStreamField("eventCount", cls2), new ObjectStreamField("sessionCount", cls2), new ObjectStreamField("subsessionCount", cls2), new ObjectStreamField("sessionLength", cls3), new ObjectStreamField("timeSpent", cls3), new ObjectStreamField("lastActivity", cls3), new ObjectStreamField("lastInterval", cls3), new ObjectStreamField("updatePackages", cls), new ObjectStreamField("orderIds", LinkedList.class), new ObjectStreamField("pushToken", String.class), new ObjectStreamField("adid", String.class), new ObjectStreamField("clickTime", cls3), new ObjectStreamField("installBegin", cls3), new ObjectStreamField("installReferrer", String.class), new ObjectStreamField("clickTimeHuawei", cls3), new ObjectStreamField("installBeginHuawei", cls3), new ObjectStreamField("installReferrerHuawei", String.class)};
|
||
|
}
|
||
|
|
||
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||
|
ObjectInputStream.GetField readFields = objectInputStream.readFields();
|
||
|
this.eventCount = Util.readIntField(readFields, "eventCount", 0);
|
||
|
this.sessionCount = Util.readIntField(readFields, "sessionCount", 0);
|
||
|
this.subsessionCount = Util.readIntField(readFields, "subsessionCount", -1);
|
||
|
this.sessionLength = Util.readLongField(readFields, "sessionLength", -1);
|
||
|
this.timeSpent = Util.readLongField(readFields, "timeSpent", -1);
|
||
|
this.lastActivity = Util.readLongField(readFields, "lastActivity", -1);
|
||
|
this.lastInterval = Util.readLongField(readFields, "lastInterval", -1);
|
||
|
this.uuid = Util.readStringField(readFields, "uuid", null);
|
||
|
this.enabled = Util.readBooleanField(readFields, "enabled", true);
|
||
|
this.isGdprForgotten = Util.readBooleanField(readFields, "isGdprForgotten", false);
|
||
|
this.isThirdPartySharingDisabled = Util.readBooleanField(readFields, "isThirdPartySharingDisabled", false);
|
||
|
this.askingAttribution = Util.readBooleanField(readFields, "askingAttribution", false);
|
||
|
this.updatePackages = Util.readBooleanField(readFields, "updatePackages", false);
|
||
|
this.orderIds = (LinkedList) Util.readObjectField(readFields, "orderIds", null);
|
||
|
this.pushToken = Util.readStringField(readFields, "pushToken", null);
|
||
|
this.adid = Util.readStringField(readFields, "adid", null);
|
||
|
this.clickTime = Util.readLongField(readFields, "clickTime", -1);
|
||
|
this.installBegin = Util.readLongField(readFields, "installBegin", -1);
|
||
|
this.installReferrer = Util.readStringField(readFields, "installReferrer", null);
|
||
|
this.clickTimeHuawei = Util.readLongField(readFields, "clickTimeHuawei", -1);
|
||
|
this.installBeginHuawei = Util.readLongField(readFields, "installBeginHuawei", -1);
|
||
|
this.installReferrerHuawei = Util.readStringField(readFields, "installReferrerHuawei", null);
|
||
|
if (this.uuid == null) {
|
||
|
this.uuid = Util.createUuid();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static String stamp(long j) {
|
||
|
Calendar.getInstance().setTimeInMillis(j);
|
||
|
return Util.formatString("%02d:%02d:%02d", 11, 12, 13);
|
||
|
}
|
||
|
|
||
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
||
|
objectOutputStream.defaultWriteObject();
|
||
|
}
|
||
|
|
||
|
public void addOrderId(String str) {
|
||
|
if (this.orderIds == null) {
|
||
|
this.orderIds = new LinkedList<>();
|
||
|
}
|
||
|
if (this.orderIds.size() >= 10) {
|
||
|
this.orderIds.removeLast();
|
||
|
}
|
||
|
this.orderIds.addFirst(str);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Object
|
||
|
public boolean equals(Object obj) {
|
||
|
if (obj == this) {
|
||
|
return true;
|
||
|
}
|
||
|
if (obj == null || getClass() != obj.getClass()) {
|
||
|
return false;
|
||
|
}
|
||
|
ActivityState activityState = (ActivityState) obj;
|
||
|
return Util.equalString(this.uuid, activityState.uuid) && Util.equalBoolean(Boolean.valueOf(this.enabled), Boolean.valueOf(activityState.enabled)) && Util.equalBoolean(Boolean.valueOf(this.isGdprForgotten), Boolean.valueOf(activityState.isGdprForgotten)) && Util.equalBoolean(Boolean.valueOf(this.isThirdPartySharingDisabled), Boolean.valueOf(activityState.isThirdPartySharingDisabled)) && Util.equalBoolean(Boolean.valueOf(this.askingAttribution), Boolean.valueOf(activityState.askingAttribution)) && Util.equalInt(Integer.valueOf(this.eventCount), Integer.valueOf(activityState.eventCount)) && Util.equalInt(Integer.valueOf(this.sessionCount), Integer.valueOf(activityState.sessionCount)) && Util.equalInt(Integer.valueOf(this.subsessionCount), Integer.valueOf(activityState.subsessionCount)) && Util.equalLong(Long.valueOf(this.sessionLength), Long.valueOf(activityState.sessionLength)) && Util.equalLong(Long.valueOf(this.timeSpent), Long.valueOf(activityState.timeSpent)) && Util.equalLong(Long.valueOf(this.lastInterval), Long.valueOf(activityState.lastInterval)) && Util.equalBoolean(Boolean.valueOf(this.updatePackages), Boolean.valueOf(activityState.updatePackages)) && Util.equalObject(this.orderIds, activityState.orderIds) && Util.equalString(this.pushToken, activityState.pushToken) && Util.equalString(this.adid, activityState.adid) && Util.equalLong(Long.valueOf(this.clickTime), Long.valueOf(activityState.clickTime)) && Util.equalLong(Long.valueOf(this.installBegin), Long.valueOf(activityState.installBegin)) && Util.equalString(this.installReferrer, activityState.installReferrer) && Util.equalLong(Long.valueOf(this.clickTimeHuawei), Long.valueOf(activityState.clickTimeHuawei)) && Util.equalLong(Long.valueOf(this.installBeginHuawei), Long.valueOf(activityState.installBeginHuawei)) && Util.equalString(this.installReferrerHuawei, activityState.installReferrerHuawei);
|
||
|
}
|
||
|
|
||
|
public boolean findOrderId(String str) {
|
||
|
LinkedList<String> linkedList = this.orderIds;
|
||
|
if (linkedList == null) {
|
||
|
return false;
|
||
|
}
|
||
|
return linkedList.contains(str);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Object
|
||
|
public int hashCode() {
|
||
|
int hashBoolean = Util.hashBoolean(Boolean.valueOf(this.enabled));
|
||
|
int hashBoolean2 = Util.hashBoolean(Boolean.valueOf(this.isGdprForgotten));
|
||
|
int hashBoolean3 = Util.hashBoolean(Boolean.valueOf(this.isThirdPartySharingDisabled));
|
||
|
int hashBoolean4 = Util.hashBoolean(Boolean.valueOf(this.askingAttribution));
|
||
|
int hashLong = Util.hashLong(Long.valueOf(this.sessionLength));
|
||
|
int hashLong2 = Util.hashLong(Long.valueOf(this.timeSpent));
|
||
|
int hashLong3 = Util.hashLong(Long.valueOf(this.lastInterval));
|
||
|
int hashBoolean5 = Util.hashBoolean(Boolean.valueOf(this.updatePackages));
|
||
|
int hashObject = Util.hashObject(this.orderIds);
|
||
|
int hashString = Util.hashString(this.pushToken);
|
||
|
int hashString2 = Util.hashString(this.adid);
|
||
|
int hashLong4 = Util.hashLong(Long.valueOf(this.clickTime));
|
||
|
int hashLong5 = Util.hashLong(Long.valueOf(this.installBegin));
|
||
|
int hashString3 = Util.hashString(this.installReferrer);
|
||
|
int hashLong6 = Util.hashLong(Long.valueOf(this.clickTimeHuawei));
|
||
|
int hashLong7 = Util.hashLong(Long.valueOf(this.installBeginHuawei));
|
||
|
return Util.hashString(this.installReferrerHuawei) + ((hashLong7 + ((hashLong6 + ((hashString3 + ((hashLong5 + ((hashLong4 + ((hashString2 + ((hashString + ((hashObject + ((hashBoolean5 + ((hashLong3 + ((hashLong2 + ((hashLong + ((((((((hashBoolean4 + ((hashBoolean3 + ((hashBoolean2 + ((hashBoolean + ((Util.hashString(this.uuid) + 629) * 37)) * 37)) * 37)) * 37)) * 37) + this.eventCount) * 37) + this.sessionCount) * 37) + this.subsessionCount) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37)) * 37);
|
||
|
}
|
||
|
|
||
|
public void resetSessionAttributes(long j) {
|
||
|
this.subsessionCount = 1;
|
||
|
this.sessionLength = 0;
|
||
|
this.timeSpent = 0;
|
||
|
this.lastActivity = j;
|
||
|
this.lastInterval = -1;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Object
|
||
|
public String toString() {
|
||
|
return Util.formatString("ec:%d sc:%d ssc:%d sl:%.1f ts:%.1f la:%s uuid:%s", Integer.valueOf(this.eventCount), Integer.valueOf(this.sessionCount), Integer.valueOf(this.subsessionCount), Double.valueOf(((double) this.sessionLength) / 1000.0d), Double.valueOf(((double) this.timeSpent) / 1000.0d), stamp(this.lastActivity), this.uuid);
|
||
|
}
|
||
|
}
|