872 lines
52 KiB
Java
872 lines
52 KiB
Java
package com.adjust.sdk;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.text.TextUtils;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import org.json.JSONObject;
|
|
public class PackageBuilder {
|
|
private static ILogger logger = AdjustFactory.getLogger();
|
|
private ActivityStateCopy activityStateCopy;
|
|
private AdjustConfig adjustConfig;
|
|
public AdjustAttribution attribution;
|
|
public long clickTimeInMilliseconds = -1;
|
|
public long clickTimeInSeconds = -1;
|
|
private long createdAt;
|
|
public String deeplink;
|
|
private DeviceInfo deviceInfo;
|
|
public Map<String, String> extraParameters;
|
|
public long installBeginTimeInSeconds = -1;
|
|
public String rawReferrer;
|
|
public String referrer;
|
|
public String referrerApi;
|
|
public String reftag;
|
|
private SessionParameters sessionParameters;
|
|
|
|
public class ActivityStateCopy {
|
|
public int eventCount = -1;
|
|
public long lastInterval = -1;
|
|
public String pushToken = null;
|
|
public int sessionCount = -1;
|
|
public long sessionLength = -1;
|
|
public int subsessionCount = -1;
|
|
public long timeSpent = -1;
|
|
public String uuid = null;
|
|
|
|
public ActivityStateCopy(ActivityState activityState) {
|
|
if (activityState != null) {
|
|
this.eventCount = activityState.eventCount;
|
|
this.sessionCount = activityState.sessionCount;
|
|
this.subsessionCount = activityState.subsessionCount;
|
|
this.timeSpent = activityState.timeSpent;
|
|
this.lastInterval = activityState.lastInterval;
|
|
this.sessionLength = activityState.sessionLength;
|
|
this.uuid = activityState.uuid;
|
|
this.pushToken = activityState.pushToken;
|
|
}
|
|
}
|
|
}
|
|
|
|
public PackageBuilder(AdjustConfig adjustConfig, DeviceInfo deviceInfo, ActivityState activityState, SessionParameters sessionParameters, long j) {
|
|
this.createdAt = j;
|
|
this.deviceInfo = deviceInfo;
|
|
this.adjustConfig = adjustConfig;
|
|
this.activityStateCopy = new ActivityStateCopy(activityState);
|
|
this.sessionParameters = sessionParameters;
|
|
}
|
|
|
|
public static void addBoolean(Map<String, String> map, String str, Boolean bool) {
|
|
if (bool != null) {
|
|
addLong(map, str, bool.booleanValue() ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
private static void addDate(Map<String, String> map, String str, Date date) {
|
|
if (date != null) {
|
|
addString(map, str, Util.dateFormatter.format(date));
|
|
}
|
|
}
|
|
|
|
private static void addDateInMilliseconds(Map<String, String> map, String str, long j) {
|
|
if (j > 0) {
|
|
addDate(map, str, new Date(j));
|
|
}
|
|
}
|
|
|
|
private static void addDateInSeconds(Map<String, String> map, String str, long j) {
|
|
if (j > 0) {
|
|
addDate(map, str, new Date(j * 1000));
|
|
}
|
|
}
|
|
|
|
private static void addDouble(Map<String, String> map, String str, Double d) {
|
|
if (d != null) {
|
|
addString(map, str, Util.formatString("%.5f", d));
|
|
}
|
|
}
|
|
|
|
private static void addDuration(Map<String, String> map, String str, long j) {
|
|
if (j >= 0) {
|
|
addLong(map, str, (j + 500) / 1000);
|
|
}
|
|
}
|
|
|
|
public static void addJsonObject(Map<String, String> map, String str, JSONObject jSONObject) {
|
|
if (jSONObject != null) {
|
|
addString(map, str, jSONObject.toString());
|
|
}
|
|
}
|
|
|
|
public static void addLong(Map<String, String> map, String str, long j) {
|
|
if (j >= 0) {
|
|
addString(map, str, Long.toString(j));
|
|
}
|
|
}
|
|
|
|
public static void addMapJson(Map<String, String> map, String str, Map<String, String> map2) {
|
|
if (map2 != null && map2.size() != 0) {
|
|
addString(map, str, new JSONObject(map2).toString());
|
|
}
|
|
}
|
|
|
|
public static void addString(Map<String, String> map, String str, String str2) {
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
map.put(str, str2);
|
|
}
|
|
}
|
|
|
|
private void checkDeviceIds(Map<String, String> map) {
|
|
if (map != null && !map.containsKey("mac_sha1") && !map.containsKey("mac_md5") && !map.containsKey("android_id") && !map.containsKey("gps_adid") && !map.containsKey("oaid") && !map.containsKey("imei") && !map.containsKey("meid") && !map.containsKey("device_id") && !map.containsKey("imeis") && !map.containsKey("meids") && !map.containsKey("device_ids")) {
|
|
logger.error("Missing device id's. Please check if Proguard is correctly set with Adjust SDK", new Object[0]);
|
|
}
|
|
}
|
|
|
|
private boolean containsPlayIds(Map<String, String> map) {
|
|
if (map == null) {
|
|
return false;
|
|
}
|
|
return map.containsKey("gps_adid");
|
|
}
|
|
|
|
private Map<String, String> getAdRevenueParameters(String str, JSONObject jSONObject) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addLong(hashMap, "connectivity_type", (long) Util.getConnectivityType(this.adjustConfig.context));
|
|
addString(hashMap, "country", this.deviceInfo.country);
|
|
addString(hashMap, "cpu_type", this.deviceInfo.abi);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addString(hashMap, "default_tracker", this.adjustConfig.defaultTracker);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_manufacturer", this.deviceInfo.deviceManufacturer);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "display_height", this.deviceInfo.displayHeight);
|
|
addString(hashMap, "display_width", this.deviceInfo.displayWidth);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fb_id", this.deviceInfo.fbAttributionId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "hardware_name", this.deviceInfo.hardwareName);
|
|
addString(hashMap, "installed_at", this.deviceInfo.appInstallTime);
|
|
addString(hashMap, "language", this.deviceInfo.language);
|
|
addDuration(hashMap, "last_interval", this.activityStateCopy.lastInterval);
|
|
addString(hashMap, "mcc", Util.getMcc(this.adjustConfig.context));
|
|
addString(hashMap, "mnc", Util.getMnc(this.adjustConfig.context));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addLong(hashMap, "network_type", (long) Util.getNetworkType(this.adjustConfig.context));
|
|
addString(hashMap, "os_build", this.deviceInfo.buildName);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "screen_density", this.deviceInfo.screenDensity);
|
|
addString(hashMap, "screen_format", this.deviceInfo.screenFormat);
|
|
addString(hashMap, "screen_size", this.deviceInfo.screenSize);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addString(hashMap, "source", str);
|
|
addJsonObject(hashMap, "payload", jSONObject);
|
|
addLong(hashMap, "session_count", (long) this.activityStateCopy.sessionCount);
|
|
addDuration(hashMap, "session_length", this.activityStateCopy.sessionLength);
|
|
addLong(hashMap, "subsession_count", (long) this.activityStateCopy.subsessionCount);
|
|
addDuration(hashMap, "time_spent", this.activityStateCopy.timeSpent);
|
|
addString(hashMap, "updated_at", this.deviceInfo.appUpdateTime);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private Map<String, String> getAttributionParameters(String str) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "initiated_by", str);
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private Map<String, String> getClickParameters(String str) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
AdjustAttribution adjustAttribution = this.attribution;
|
|
if (adjustAttribution != null) {
|
|
addString(hashMap, "tracker", adjustAttribution.trackerName);
|
|
addString(hashMap, "campaign", this.attribution.campaign);
|
|
addString(hashMap, "adgroup", this.attribution.adgroup);
|
|
addString(hashMap, "creative", this.attribution.creative);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addMapJson(hashMap, "callback_params", this.sessionParameters.callbackParameters);
|
|
addDateInMilliseconds(hashMap, "click_time", this.clickTimeInMilliseconds);
|
|
addDateInSeconds(hashMap, "click_time", this.clickTimeInSeconds);
|
|
addLong(hashMap, "connectivity_type", (long) Util.getConnectivityType(this.adjustConfig.context));
|
|
addString(hashMap, "country", this.deviceInfo.country);
|
|
addString(hashMap, "cpu_type", this.deviceInfo.abi);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addString(hashMap, "deeplink", this.deeplink);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_manufacturer", this.deviceInfo.deviceManufacturer);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "display_height", this.deviceInfo.displayHeight);
|
|
addString(hashMap, "display_width", this.deviceInfo.displayWidth);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fb_id", this.deviceInfo.fbAttributionId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "hardware_name", this.deviceInfo.hardwareName);
|
|
addDateInSeconds(hashMap, "install_begin_time", this.installBeginTimeInSeconds);
|
|
addString(hashMap, "installed_at", this.deviceInfo.appInstallTime);
|
|
addString(hashMap, "language", this.deviceInfo.language);
|
|
addDuration(hashMap, "last_interval", this.activityStateCopy.lastInterval);
|
|
addString(hashMap, "mcc", Util.getMcc(this.adjustConfig.context));
|
|
addString(hashMap, "mnc", Util.getMnc(this.adjustConfig.context));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addLong(hashMap, "network_type", (long) Util.getNetworkType(this.adjustConfig.context));
|
|
addString(hashMap, "os_build", this.deviceInfo.buildName);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addMapJson(hashMap, "params", this.extraParameters);
|
|
addMapJson(hashMap, "partner_params", this.sessionParameters.partnerParameters);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "raw_referrer", this.rawReferrer);
|
|
addString(hashMap, "referrer", this.referrer);
|
|
addString(hashMap, "referrer_api", this.referrerApi);
|
|
addString(hashMap, "reftag", this.reftag);
|
|
addString(hashMap, "screen_density", this.deviceInfo.screenDensity);
|
|
addString(hashMap, "screen_format", this.deviceInfo.screenFormat);
|
|
addString(hashMap, "screen_size", this.deviceInfo.screenSize);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addLong(hashMap, "session_count", (long) this.activityStateCopy.sessionCount);
|
|
addDuration(hashMap, "session_length", this.activityStateCopy.sessionLength);
|
|
addString(hashMap, "source", str);
|
|
addLong(hashMap, "subsession_count", (long) this.activityStateCopy.subsessionCount);
|
|
addDuration(hashMap, "time_spent", this.activityStateCopy.timeSpent);
|
|
addString(hashMap, "updated_at", this.deviceInfo.appUpdateTime);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private ActivityPackage getDefaultActivityPackage(ActivityKind activityKind) {
|
|
ActivityPackage activityPackage = new ActivityPackage(activityKind);
|
|
activityPackage.setClientSdk(this.deviceInfo.clientSdk);
|
|
return activityPackage;
|
|
}
|
|
|
|
private Map<String, String> getDisableThirdPartySharingParameters() {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private String getEventSuffix(AdjustEvent adjustEvent) {
|
|
Double d = adjustEvent.revenue;
|
|
return d == null ? Util.formatString("'%s'", adjustEvent.eventToken) : Util.formatString("(%.5f %s, '%s')", d, adjustEvent.currency, adjustEvent.eventToken);
|
|
}
|
|
|
|
private Map<String, String> getGdprParameters() {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private Map<String, String> getInfoParameters(String str) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addString(hashMap, "source", str);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private Map<String, String> getSessionParameters(boolean z2) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
if (!z2) {
|
|
addMapJson(hashMap, "callback_params", this.sessionParameters.callbackParameters);
|
|
addMapJson(hashMap, "partner_params", this.sessionParameters.partnerParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addLong(hashMap, "connectivity_type", (long) Util.getConnectivityType(this.adjustConfig.context));
|
|
addString(hashMap, "country", this.deviceInfo.country);
|
|
addString(hashMap, "cpu_type", this.deviceInfo.abi);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addString(hashMap, "default_tracker", this.adjustConfig.defaultTracker);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_manufacturer", this.deviceInfo.deviceManufacturer);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "display_height", this.deviceInfo.displayHeight);
|
|
addString(hashMap, "display_width", this.deviceInfo.displayWidth);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fb_id", this.deviceInfo.fbAttributionId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "hardware_name", this.deviceInfo.hardwareName);
|
|
addString(hashMap, "installed_at", this.deviceInfo.appInstallTime);
|
|
addString(hashMap, "language", this.deviceInfo.language);
|
|
addDuration(hashMap, "last_interval", this.activityStateCopy.lastInterval);
|
|
addString(hashMap, "mcc", Util.getMcc(this.adjustConfig.context));
|
|
addString(hashMap, "mnc", Util.getMnc(this.adjustConfig.context));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addLong(hashMap, "network_type", (long) Util.getNetworkType(this.adjustConfig.context));
|
|
addString(hashMap, "os_build", this.deviceInfo.buildName);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "screen_density", this.deviceInfo.screenDensity);
|
|
addString(hashMap, "screen_format", this.deviceInfo.screenFormat);
|
|
addString(hashMap, "screen_size", this.deviceInfo.screenSize);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addLong(hashMap, "session_count", (long) this.activityStateCopy.sessionCount);
|
|
addDuration(hashMap, "session_length", this.activityStateCopy.sessionLength);
|
|
addLong(hashMap, "subsession_count", (long) this.activityStateCopy.subsessionCount);
|
|
addDuration(hashMap, "time_spent", this.activityStateCopy.timeSpent);
|
|
addString(hashMap, "updated_at", this.deviceInfo.appUpdateTime);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
private Map<String, String> getSubscriptionParameters(AdjustPlayStoreSubscription adjustPlayStoreSubscription, boolean z2) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
if (!z2) {
|
|
addMapJson(hashMap, "callback_params", Util.mergeParameters(this.sessionParameters.callbackParameters, adjustPlayStoreSubscription.getCallbackParameters(), "Callback"));
|
|
addMapJson(hashMap, "partner_params", Util.mergeParameters(this.sessionParameters.partnerParameters, adjustPlayStoreSubscription.getPartnerParameters(), "Partner"));
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addLong(hashMap, "connectivity_type", (long) Util.getConnectivityType(this.adjustConfig.context));
|
|
addString(hashMap, "country", this.deviceInfo.country);
|
|
addString(hashMap, "cpu_type", this.deviceInfo.abi);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addString(hashMap, "default_tracker", this.adjustConfig.defaultTracker);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_manufacturer", this.deviceInfo.deviceManufacturer);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "display_height", this.deviceInfo.displayHeight);
|
|
addString(hashMap, "display_width", this.deviceInfo.displayWidth);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fb_id", this.deviceInfo.fbAttributionId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "hardware_name", this.deviceInfo.hardwareName);
|
|
addString(hashMap, "installed_at", this.deviceInfo.appInstallTime);
|
|
addString(hashMap, "language", this.deviceInfo.language);
|
|
addDuration(hashMap, "last_interval", this.activityStateCopy.lastInterval);
|
|
addString(hashMap, "mcc", Util.getMcc(this.adjustConfig.context));
|
|
addString(hashMap, "mnc", Util.getMnc(this.adjustConfig.context));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addLong(hashMap, "network_type", (long) Util.getNetworkType(this.adjustConfig.context));
|
|
addString(hashMap, "os_build", this.deviceInfo.buildName);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addString(hashMap, "screen_density", this.deviceInfo.screenDensity);
|
|
addString(hashMap, "screen_format", this.deviceInfo.screenFormat);
|
|
addString(hashMap, "screen_size", this.deviceInfo.screenSize);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addLong(hashMap, "session_count", (long) this.activityStateCopy.sessionCount);
|
|
addDuration(hashMap, "session_length", this.activityStateCopy.sessionLength);
|
|
addLong(hashMap, "subsession_count", (long) this.activityStateCopy.subsessionCount);
|
|
addDuration(hashMap, "time_spent", this.activityStateCopy.timeSpent);
|
|
addString(hashMap, "updated_at", this.deviceInfo.appUpdateTime);
|
|
addLong(hashMap, "revenue", adjustPlayStoreSubscription.getPrice());
|
|
addDateInMilliseconds(hashMap, "transaction_date", adjustPlayStoreSubscription.getPurchaseTime());
|
|
addString(hashMap, "currency", adjustPlayStoreSubscription.getCurrency());
|
|
addString(hashMap, "product_id", adjustPlayStoreSubscription.getSku());
|
|
addString(hashMap, "receipt", adjustPlayStoreSubscription.getSignature());
|
|
addString(hashMap, "purchase_token", adjustPlayStoreSubscription.getPurchaseToken());
|
|
addString(hashMap, "billing_store", adjustPlayStoreSubscription.getBillingStore());
|
|
addString(hashMap, "transaction_id", adjustPlayStoreSubscription.getOrderId());
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
|
|
public ActivityPackage buildAdRevenuePackage(String str, JSONObject jSONObject) {
|
|
Map<String, String> adRevenueParameters = getAdRevenueParameters(str, jSONObject);
|
|
ActivityKind activityKind = ActivityKind.AD_REVENUE;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/ad_revenue");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(adRevenueParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(adRevenueParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildAttributionPackage(String str) {
|
|
Map<String, String> attributionParameters = getAttributionParameters(str);
|
|
ActivityKind activityKind = ActivityKind.ATTRIBUTION;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("attribution");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(attributionParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(attributionParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildClickPackage(String str) {
|
|
Map<String, String> clickParameters = getClickParameters(str);
|
|
ActivityKind activityKind = ActivityKind.CLICK;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/sdk_click");
|
|
defaultActivityPackage.setSuffix("");
|
|
defaultActivityPackage.setClickTimeInMilliseconds(this.clickTimeInMilliseconds);
|
|
defaultActivityPackage.setClickTimeInSeconds(this.clickTimeInSeconds);
|
|
defaultActivityPackage.setInstallBeginTimeInSeconds(this.installBeginTimeInSeconds);
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(clickParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(clickParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildDisableThirdPartySharingPackage() {
|
|
Map<String, String> disableThirdPartySharingParameters = getDisableThirdPartySharingParameters();
|
|
ActivityKind activityKind = ActivityKind.DISABLE_THIRD_PARTY_SHARING;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/disable_third_party_sharing");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(disableThirdPartySharingParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(disableThirdPartySharingParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildEventPackage(AdjustEvent adjustEvent, boolean z2) {
|
|
Map<String, String> eventParameters = getEventParameters(adjustEvent, z2);
|
|
ActivityKind activityKind = ActivityKind.EVENT;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/event");
|
|
defaultActivityPackage.setSuffix(getEventSuffix(adjustEvent));
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(eventParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(eventParameters);
|
|
if (z2) {
|
|
defaultActivityPackage.setCallbackParameters(adjustEvent.callbackParameters);
|
|
defaultActivityPackage.setPartnerParameters(adjustEvent.partnerParameters);
|
|
}
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildGdprPackage() {
|
|
Map<String, String> gdprParameters = getGdprParameters();
|
|
ActivityKind activityKind = ActivityKind.GDPR;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/gdpr_forget_device");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(gdprParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(gdprParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildInfoPackage(String str) {
|
|
Map<String, String> infoParameters = getInfoParameters(str);
|
|
ActivityKind activityKind = ActivityKind.INFO;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/sdk_info");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(infoParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(infoParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildSessionPackage(boolean z2) {
|
|
Map<String, String> sessionParameters = getSessionParameters(z2);
|
|
ActivityKind activityKind = ActivityKind.SESSION;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/session");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(sessionParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(sessionParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public ActivityPackage buildSubscriptionPackage(AdjustPlayStoreSubscription adjustPlayStoreSubscription, boolean z2) {
|
|
Map<String, String> subscriptionParameters = getSubscriptionParameters(adjustPlayStoreSubscription, z2);
|
|
ActivityKind activityKind = ActivityKind.SUBSCRIPTION;
|
|
ActivityPackage defaultActivityPackage = getDefaultActivityPackage(activityKind);
|
|
defaultActivityPackage.setPath("/v2/purchase");
|
|
defaultActivityPackage.setSuffix("");
|
|
String activityKind2 = activityKind.toString();
|
|
String clientSdk = defaultActivityPackage.getClientSdk();
|
|
AdjustConfig adjustConfig = this.adjustConfig;
|
|
AdjustSigner.sign(subscriptionParameters, activityKind2, clientSdk, adjustConfig.context, adjustConfig.logger);
|
|
defaultActivityPackage.setParameters(subscriptionParameters);
|
|
return defaultActivityPackage;
|
|
}
|
|
|
|
public Map<String, String> getEventParameters(AdjustEvent adjustEvent, boolean z2) {
|
|
ContentResolver contentResolver = this.adjustConfig.context.getContentResolver();
|
|
HashMap hashMap = new HashMap();
|
|
Map<String, String> imeiParameters = Reflection.getImeiParameters(this.adjustConfig.context, logger);
|
|
if (imeiParameters != null) {
|
|
hashMap.putAll(imeiParameters);
|
|
}
|
|
Map<String, String> oaidParameters = Reflection.getOaidParameters(this.adjustConfig.context, logger);
|
|
if (oaidParameters != null) {
|
|
hashMap.putAll(oaidParameters);
|
|
}
|
|
if (!z2) {
|
|
addMapJson(hashMap, "callback_params", Util.mergeParameters(this.sessionParameters.callbackParameters, adjustEvent.callbackParameters, "Callback"));
|
|
addMapJson(hashMap, "partner_params", Util.mergeParameters(this.sessionParameters.partnerParameters, adjustEvent.partnerParameters, "Partner"));
|
|
}
|
|
this.deviceInfo.reloadPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "android_uuid", this.activityStateCopy.uuid);
|
|
addBoolean(hashMap, "tracking_enabled", this.deviceInfo.isTrackingEnabled);
|
|
addString(hashMap, "gps_adid", this.deviceInfo.playAdId);
|
|
addString(hashMap, "gps_adid_src", this.deviceInfo.playAdIdSource);
|
|
addLong(hashMap, "gps_adid_attempt", (long) this.deviceInfo.playAdIdAttempt);
|
|
if (!containsPlayIds(hashMap)) {
|
|
logger.warn("Google Advertising ID not detected, fallback to non Google Play identifiers will take place", new Object[0]);
|
|
this.deviceInfo.reloadNonPlayIds(this.adjustConfig.context);
|
|
addString(hashMap, "mac_sha1", this.deviceInfo.macSha1);
|
|
addString(hashMap, "mac_md5", this.deviceInfo.macShortMd5);
|
|
addString(hashMap, "android_id", this.deviceInfo.androidId);
|
|
}
|
|
addString(hashMap, "api_level", this.deviceInfo.apiLevel);
|
|
addString(hashMap, "app_secret", this.adjustConfig.appSecret);
|
|
addString(hashMap, "app_token", this.adjustConfig.appToken);
|
|
addString(hashMap, "app_version", this.deviceInfo.appVersion);
|
|
Boolean bool = Boolean.TRUE;
|
|
addBoolean(hashMap, "attribution_deeplink", bool);
|
|
addLong(hashMap, "connectivity_type", (long) Util.getConnectivityType(this.adjustConfig.context));
|
|
addString(hashMap, "country", this.deviceInfo.country);
|
|
addString(hashMap, "cpu_type", this.deviceInfo.abi);
|
|
addDateInMilliseconds(hashMap, "created_at", this.createdAt);
|
|
addString(hashMap, "currency", adjustEvent.currency);
|
|
addBoolean(hashMap, "device_known", this.adjustConfig.deviceKnown);
|
|
addString(hashMap, "device_manufacturer", this.deviceInfo.deviceManufacturer);
|
|
addString(hashMap, "device_name", this.deviceInfo.deviceName);
|
|
addString(hashMap, "device_type", this.deviceInfo.deviceType);
|
|
addString(hashMap, "display_height", this.deviceInfo.displayHeight);
|
|
addString(hashMap, "display_width", this.deviceInfo.displayWidth);
|
|
addString(hashMap, "environment", this.adjustConfig.environment);
|
|
addString(hashMap, "event_callback_id", adjustEvent.callbackId);
|
|
addLong(hashMap, "event_count", (long) this.activityStateCopy.eventCount);
|
|
addBoolean(hashMap, "event_buffering_enabled", Boolean.valueOf(this.adjustConfig.eventBufferingEnabled));
|
|
addString(hashMap, "event_token", adjustEvent.eventToken);
|
|
addString(hashMap, "external_device_id", this.adjustConfig.externalDeviceId);
|
|
addString(hashMap, "fb_id", this.deviceInfo.fbAttributionId);
|
|
addString(hashMap, "fire_adid", Util.getFireAdvertisingId(contentResolver));
|
|
addBoolean(hashMap, "fire_tracking_enabled", Util.getFireTrackingEnabled(contentResolver));
|
|
addString(hashMap, "hardware_name", this.deviceInfo.hardwareName);
|
|
addString(hashMap, "language", this.deviceInfo.language);
|
|
addString(hashMap, "mcc", Util.getMcc(this.adjustConfig.context));
|
|
addString(hashMap, "mnc", Util.getMnc(this.adjustConfig.context));
|
|
addBoolean(hashMap, "needs_response_details", bool);
|
|
addLong(hashMap, "network_type", (long) Util.getNetworkType(this.adjustConfig.context));
|
|
addString(hashMap, "os_build", this.deviceInfo.buildName);
|
|
addString(hashMap, "os_name", this.deviceInfo.osName);
|
|
addString(hashMap, "os_version", this.deviceInfo.osVersion);
|
|
addString(hashMap, "package_name", this.deviceInfo.packageName);
|
|
addString(hashMap, "push_token", this.activityStateCopy.pushToken);
|
|
addDouble(hashMap, "revenue", adjustEvent.revenue);
|
|
addString(hashMap, "screen_density", this.deviceInfo.screenDensity);
|
|
addString(hashMap, "screen_format", this.deviceInfo.screenFormat);
|
|
addString(hashMap, "screen_size", this.deviceInfo.screenSize);
|
|
addString(hashMap, "secret_id", this.adjustConfig.secretId);
|
|
addLong(hashMap, "session_count", (long) this.activityStateCopy.sessionCount);
|
|
addDuration(hashMap, "session_length", this.activityStateCopy.sessionLength);
|
|
addLong(hashMap, "subsession_count", (long) this.activityStateCopy.subsessionCount);
|
|
addDuration(hashMap, "time_spent", this.activityStateCopy.timeSpent);
|
|
checkDeviceIds(hashMap);
|
|
return hashMap;
|
|
}
|
|
}
|