Skip to content

Commit

Permalink
Merge pull request #557 from adjust/v4330
Browse files Browse the repository at this point in the history
Version 4.33.0
shashanksu authored Oct 19, 2022

Verified

This commit was signed with the committer’s verified signature.
Meierschlumpf Meier Lukas
2 parents 98a78dd + 999f10f commit 00bac49
Showing 39 changed files with 634 additions and 451 deletions.
3 changes: 2 additions & 1 deletion Adjust/build.gradle
Original file line number Diff line number Diff line change
@@ -9,9 +9,10 @@ ext {
coreMinSdkVersion = 9
coreCompileSdkVersion = 33
coreTargetSdkVersion = 33
coreVersionName = '4.32.0'
coreVersionName = '4.33.0'
defaultVersionCode = 1
webbridgeMinSdkVersion = 17
samsungReferrerMinSdkVersion = 18

// POM.
adjustGroupId = 'com.adjust.sdk'
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ protected void onCreate(Bundle savedInstanceState) {

AdjustBridge.registerAndGetInstance(getApplication(), webView);
try {
// webView.loadUrl("file:///android_asset/AdjustExample-WebView.html");
webView.loadUrl("https://adjustweb.neocities.org");
} catch (Exception e) {
e.printStackTrace();
38 changes: 19 additions & 19 deletions Adjust/sdk-core/build.gradle
Original file line number Diff line number Diff line change
@@ -93,18 +93,18 @@ artifacts {

publishing {
publications {
mavenAndroidCore(MavenPublication) {
customizePom(pom)
groupId rootProject.ext.adjustGroupId
artifactId 'adjust-android'
version rootProject.ext.coreVersionName

artifact adjustCoreJarRelease
artifact adjustCoreAndroidJavadocsJar
artifact adjustCoreAndroidSourcesJar
}

mavenAndroidCoreAAR(MavenPublication) {
// mavenAndroidCoreJar(MavenPublication) {
// customizePomForJar(pom)
// groupId rootProject.ext.adjustGroupId
// artifactId 'adjust-android'
// version rootProject.ext.coreVersionName
//
// artifact adjustCoreJarRelease
// artifact adjustCoreAndroidJavadocsJar
// artifact adjustCoreAndroidSourcesJar
// }

mavenAndroidCoreAar(MavenPublication) {
customizePomForAar(pom)
groupId rootProject.ext.adjustGroupId
artifactId 'adjust-android'
@@ -137,7 +137,7 @@ publishing {
}
}

def customizePom(pom) {
def customizePomForJar(pom) {
pom.withXml {
// Add all items necessary for maven central publication.
asNode().children().last() + {
@@ -216,9 +216,9 @@ def customizePomForAar(pom) {
}

model {
tasks.generatePomFileForMavenAndroidCorePublication {
destination = file("${project.buildDir}/generated-pom.xml")
}
// tasks.generatePomFileForMavenAndroidCoreJarPublication {
// destination = file("${project.buildDir}/generated-pom.xml")
// }
/* TODO check if/how to replace this tasks
tasks.publishMavenAndroidCorePublicationToMavenLocal {
dependsOn project.tasks.signArchives
@@ -227,7 +227,7 @@ model {
dependsOn project.tasks.signArchives
}
*/
tasks.generatePomFileForMavenAndroidCoreAARPublication {
tasks.generatePomFileForMavenAndroidCoreAarPublication {
destination = file("${project.buildDir}/generated-pom.xml")
}
/* TODO check if/how to replace this tasks
@@ -241,6 +241,6 @@ model {
}

signing {
sign publishing.publications.mavenAndroidCore
sign publishing.publications.mavenAndroidCoreAAR
// sign publishing.publications.mavenAndroidCoreJar
sign publishing.publications.mavenAndroidCoreAar
}
29 changes: 29 additions & 0 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@

import static com.adjust.sdk.Constants.ACTIVITY_STATE_FILENAME;
import static com.adjust.sdk.Constants.ATTRIBUTION_FILENAME;
import static com.adjust.sdk.Constants.REFERRER_API_SAMSUNG;
import static com.adjust.sdk.Constants.REFERRER_API_XIAOMI;
import static com.adjust.sdk.Constants.SESSION_CALLBACK_PARAMETERS_FILENAME;
import static com.adjust.sdk.Constants.SESSION_PARTNER_PARAMETERS_FILENAME;
@@ -1257,6 +1258,7 @@ private void processSessionI() {
// Try to check if there's new referrer information.
installReferrer.startConnection();
installReferrerHuawei.readReferrer();
readInstallReferrerSamsung();
readInstallReferrerXiaomi();

return;
@@ -1265,6 +1267,18 @@ private void processSessionI() {
logger.verbose("Time span since last activity too short for a new subsession");
}

private void readInstallReferrerSamsung() {
executor.submit(new Runnable() {
@Override
public void run() {
ReferrerDetails referrerDetails = Reflection.getSamsungReferrer(getContext(), logger);
if (referrerDetails != null) {
sendInstallReferrer(referrerDetails, REFERRER_API_SAMSUNG);
}
}
});
}

private void readInstallReferrerXiaomi() {
executor.submit(new Runnable() {
@Override
@@ -1703,6 +1717,7 @@ private void checkAfterNewStartI(SharedPreferencesManager sharedPreferencesManag
// try to read and send the install referrer
installReferrer.startConnection();
installReferrerHuawei.readReferrer();
readInstallReferrerSamsung();
readInstallReferrerXiaomi();
}

@@ -2606,6 +2621,19 @@ private void checkForInstallReferrerInfo(final SdkClickResponseData responseData
return;
}

boolean isInstallReferrerSamsung =
responseData.referrerApi != null &&
(responseData.referrerApi.equalsIgnoreCase(REFERRER_API_SAMSUNG));

if (isInstallReferrerSamsung) {
activityState.clickTimeSamsung = responseData.clickTime;
activityState.installBeginSamsung = responseData.installBegin;
activityState.installReferrerSamsung = responseData.installReferrer;

writeActivityStateI();
return;
}

boolean isInstallReferrerXiaomi =
responseData.referrerApi != null &&
(responseData.referrerApi.equalsIgnoreCase(REFERRER_API_XIAOMI));
@@ -2616,6 +2644,7 @@ private void checkForInstallReferrerInfo(final SdkClickResponseData responseData
activityState.installReferrerXiaomi = responseData.installReferrer;
activityState.clickTimeServerXiaomi = responseData.clickTimeServer;
activityState.installBeginServerXiaomi = responseData.installBeginServer;
activityState.installVersionXiaomi = responseData.installVersion;

writeActivityStateI();
return;
26 changes: 26 additions & 0 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityState.java
Original file line number Diff line number Diff line change
@@ -56,6 +56,10 @@ public class ActivityState implements Serializable, Cloneable {
new ObjectStreamField("installReferrerXiaomi", String.class),
new ObjectStreamField("clickTimeServerXiaomi", long.class),
new ObjectStreamField("installBeginServerXiaomi", long.class),
new ObjectStreamField("installVersionXiaomi", String.class),
new ObjectStreamField("clickTimeSamsung", long.class),
new ObjectStreamField("installBeginSamsung", long.class),
new ObjectStreamField("installReferrerSamsung", String.class),
};

// persistent data
@@ -103,6 +107,11 @@ public class ActivityState implements Serializable, Cloneable {
protected String installReferrerXiaomi;
protected long clickTimeServerXiaomi;
protected long installBeginServerXiaomi;
protected String installVersionXiaomi;

protected long clickTimeSamsung;
protected long installBeginSamsung;
protected String installReferrerSamsung;

protected ActivityState() {
logger = AdjustFactory.getLogger();
@@ -140,6 +149,10 @@ protected ActivityState() {
installReferrerXiaomi = null;
clickTimeServerXiaomi = 0;
installBeginServerXiaomi = 0;
installVersionXiaomi = null;
clickTimeSamsung = 0;
installBeginSamsung = 0;
installReferrerSamsung = null;
}

protected void resetSessionAttributes(long now) {
@@ -215,6 +228,10 @@ public boolean equals(Object other) {
if (!Util.equalString(installReferrerXiaomi, otherActivityState.installReferrerXiaomi)) return false;
if (!Util.equalLong(clickTimeServerXiaomi, otherActivityState.clickTimeServerXiaomi)) return false;
if (!Util.equalLong(installBeginServerXiaomi, otherActivityState.installBeginServerXiaomi)) return false;
if (!Util.equalString(installVersionXiaomi, otherActivityState.installVersionXiaomi)) return false;
if (!Util.equalLong(clickTimeSamsung, otherActivityState.clickTimeSamsung)) return false;
if (!Util.equalLong(installBeginSamsung, otherActivityState.installBeginSamsung)) return false;
if (!Util.equalString(installReferrerSamsung, otherActivityState.installReferrerSamsung)) return false;
return true;
}

@@ -253,6 +270,10 @@ public int hashCode() {
hashCode = 37 * hashCode + Util.hashString(installReferrerXiaomi);
hashCode = 37 * hashCode + Util.hashLong(clickTimeServerXiaomi);
hashCode = 37 * hashCode + Util.hashLong(installBeginServerXiaomi);
hashCode = 37 * hashCode + Util.hashString(installVersionXiaomi);
hashCode = 37 * hashCode + Util.hashLong(clickTimeSamsung);
hashCode = 37 * hashCode + Util.hashLong(installBeginSamsung);
hashCode = 37 * hashCode + Util.hashString(installReferrerSamsung);
return hashCode;
}

@@ -298,6 +319,11 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFo
installReferrerXiaomi = Util.readStringField(fields, "installReferrerXiaomi", null);
clickTimeServerXiaomi = Util.readLongField(fields, "clickTimeServerXiaomi", -1l);
installBeginServerXiaomi = Util.readLongField(fields, "installBeginServerXiaomi", -1l);
installVersionXiaomi = Util.readStringField(fields, "installVersionXiaomi", null);

clickTimeSamsung = Util.readLongField(fields, "clickTimeSamsung", -1l);
installBeginSamsung = Util.readLongField(fields, "installBeginSamsung", -1l);
installReferrerSamsung = Util.readStringField(fields, "installReferrerSamsung", null);

// create UUID for migrating devices
if (uuid == null) {
13 changes: 12 additions & 1 deletion Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@

import org.json.JSONObject;

import java.util.Map;

/**
* The main interface to Adjust.
* Use the methods of this class to tell Adjust about the usage of your app.
@@ -32,7 +34,7 @@ private Adjust() {
*/
public static synchronized AdjustInstance getDefaultInstance() {
@SuppressWarnings("unused")
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.32.0";
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.33.0";

if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
@@ -96,6 +98,15 @@ public static boolean isEnabled() {
return adjustInstance.isEnabled();
}

/**
* Get information if the payload originates from Adjust.
*
* @return boolean indicating whether payload originates from Adjust or not.
*/
public static boolean isAdjustUninstallDetectionPayload(Map<String, String> payload) {
return Util.isAdjustUninstallDetectionPayload(payload);
}

/**
* Called to process deep link.
*
7 changes: 6 additions & 1 deletion Adjust/sdk-core/src/main/java/com/adjust/sdk/Constants.java
Original file line number Diff line number Diff line change
@@ -29,13 +29,14 @@ public interface Constants {

String SCHEME = "https";
String AUTHORITY = "app.adjust.com";
String CLIENT_SDK = "android4.32.0";
String CLIENT_SDK = "android4.33.0";
String LOGTAG = "Adjust";
String REFTAG = "reftag";
String INSTALL_REFERRER = "install_referrer";
String REFERRER_API_GOOGLE = "google";
String REFERRER_API_HUAWEI_ADS = "huawei_ads";
String REFERRER_API_HUAWEI_APP_GALLERY = "huawei_app_gallery";
String REFERRER_API_SAMSUNG = "samsung";
String REFERRER_API_XIAOMI = "xiaomi";
String DEEPLINK = "deeplink";
String PUSH = "push";
@@ -64,6 +65,10 @@ public interface Constants {
String CALLBACK_PARAMETERS = "callback_params";
String PARTNER_PARAMETERS = "partner_params";

String FCM_PAYLOAD_KEY = "adjust_purpose";

String FCM_PAYLOAD_VALUE = "uninstall detection";

int MAX_INSTALL_REFERRER_RETRIES = 2;

String FB_AUTH_REGEX = "^(fb|vk)[0-9]{5,}[^:]*://authorize.*access_token=.*";
13 changes: 13 additions & 0 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/Reflection.java
Original file line number Diff line number Diff line change
@@ -57,6 +57,19 @@ public static Boolean isPlayTrackingEnabled(Context context, Object AdvertisingI
}
}

public static ReferrerDetails getSamsungReferrer(Context context, ILogger logger) {
ReferrerDetails referrerDetails = null;
try {
referrerDetails = (ReferrerDetails) invokeStaticMethod("com.adjust.sdk.samsung.Util",
"getSamsungInstallReferrerDetails",
new Class[]{Context.class, ILogger.class},
context, logger);
} catch (Exception e) {
logger.error("invoke getSamsungInstallReferrerDetails error: " + e.getMessage());
}
return referrerDetails;
}

public static ReferrerDetails getXiaomiReferrer(Context context, ILogger logger) {
ReferrerDetails referrerDetails = null;
try {
22 changes: 20 additions & 2 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/Util.java
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@
import android.net.Uri;
import android.os.Build;
import android.os.LocaleList;
import android.os.Looper;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -47,6 +46,7 @@
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Callable;
@@ -484,6 +484,14 @@ public static boolean isValidParameter(String attribute, String attributeType, S
return true;
}

public static boolean isAdjustUninstallDetectionPayload(Map<String, String> payload) {
if (payload == null) {
return false;
}
return payload.size() == 1 &&
Objects.equals(payload.get(Constants.FCM_PAYLOAD_KEY), Constants.FCM_PAYLOAD_VALUE);
}

public static Map<String, String> mergeParameters(Map<String, String> target,
Map<String, String> source,
String parameterName) {
@@ -751,6 +759,8 @@ public static boolean isEqualReferrerDetails(final ReferrerDetails referrerDetai
return isEqualHuaweiReferrerAdsDetails(referrerDetails, activityState);
} else if (referrerApi.equals(Constants.REFERRER_API_HUAWEI_APP_GALLERY)) {
return isEqualHuaweiReferrerAppGalleryDetails(referrerDetails, activityState);
} else if (referrerApi.equals(Constants.REFERRER_API_SAMSUNG)) {
return isEqualSamsungReferrerDetails(referrerDetails, activityState);
} else if (referrerApi.equals(Constants.REFERRER_API_XIAOMI)) {
return isEqualXiaomiReferrerDetails(referrerDetails, activityState);
}
@@ -839,12 +849,20 @@ private static boolean isEqualHuaweiReferrerAppGalleryDetails(final ReferrerDeta
&& Util.equalString(referrerDetails.installReferrer, activityState.installReferrerHuaweiAppGallery);
}

private static boolean isEqualSamsungReferrerDetails(final ReferrerDetails referrerDetails,
final ActivityState activityState) {
return referrerDetails.referrerClickTimestampSeconds == activityState.clickTimeSamsung
&& referrerDetails.installBeginTimestampSeconds == activityState.installBeginSamsung
&& Util.equalString(referrerDetails.installReferrer, activityState.installReferrerSamsung);
}

private static boolean isEqualXiaomiReferrerDetails(final ReferrerDetails referrerDetails,
final ActivityState activityState) {
return referrerDetails.referrerClickTimestampSeconds == activityState.clickTimeXiaomi
&& referrerDetails.installBeginTimestampSeconds == activityState.installBeginXiaomi
&& referrerDetails.referrerClickTimestampServerSeconds == activityState.clickTimeServerXiaomi
&& referrerDetails.installBeginTimestampServerSeconds == activityState.installBeginServerXiaomi
&& Util.equalString(referrerDetails.installReferrer, activityState.installReferrerXiaomi);
&& Util.equalString(referrerDetails.installReferrer, activityState.installReferrerXiaomi)
&& Util.equalString(referrerDetails.installVersion, activityState.installVersionXiaomi);
}
}
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-criteo/build.gradle
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.32.0'
// implementation 'com.adjust.sdk:adjust-android:4.33.0'
}

// read local properties
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-imei/build.gradle
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.32.0'
// implementation 'com.adjust.sdk:adjust-android:4.33.0'
}

// read local properties
Loading

0 comments on commit 00bac49

Please sign in to comment.