Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.19.1 #407

Merged
merged 15 commits into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Adjust/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext {
coreMinSdkVersion = 9
coreCompileSdkVersion = 28
coreTargetSdkVersion = 28
coreVersionName = '4.19.0' //append -SNAPSHOT for snapshot version
coreVersionName = '4.19.1' //append -SNAPSHOT for snapshot version
defaultVersionCode = 1

// POM.
Expand All @@ -24,7 +24,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.5.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files.
Expand Down
2 changes: 1 addition & 1 deletion Adjust/example-app-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
// implementation project(':plugin-imei')
// implementation project(":plugin-play")
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private Adjust() {
*/
public static synchronized AdjustInstance getDefaultInstance() {
@SuppressWarnings("unused")
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.19.0";
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.19.1";

if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface Constants {
String GDPR_URL = "https://gdpr.adjust.com";
String SCHEME = "https";
String AUTHORITY = "app.adjust.com";
String CLIENT_SDK = "android4.19.0";
String CLIENT_SDK = "android4.19.1";
String LOGTAG = "Adjust";
String REFTAG = "reftag";
String INSTALL_REFERRER = "install_referrer";
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-criteo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'
}

task adjustCriteoAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-imei/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'
}

task adjustImeiAndroidAar (type: Copy) {
Expand Down
7 changes: 6 additions & 1 deletion Adjust/sdk-plugin-oaid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ repositories {
maven {
url "https://oss.sonatype.org/content/repositories/staging/"
}
flatDir {
dirs 'libs'
}
}

android {
Expand All @@ -24,7 +27,9 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'

implementation(name:'miit_mdid_1.0.10', ext:'aar')
}

task adjustOaidAndroidAar (type: Copy) {
Expand Down
Binary file added Adjust/sdk-plugin-oaid/libs/miit_mdid_1.0.10.aar
Binary file not shown.
3 changes: 2 additions & 1 deletion Adjust/sdk-plugin-oaid/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-keep class com.bun.miitmdid.core.** {*;}
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
package com.adjust.sdk.oaid;

import android.content.Context;
import android.util.Log;

import com.bun.miitmdid.core.JLibrary;

public class AdjustOaid {
static boolean isOaidToBeRead = false;
static boolean isMsaSdkAvailable = false;

public static void readOaid() {
AdjustOaid.isOaidToBeRead = true;
}

public static void readOaid(Context base) {
readOaid();

try {
JLibrary.InitEntry(base);
isMsaSdkAvailable = true;
} catch (Throwable t) {
isMsaSdkAvailable = false;
Log.d("Adjust", "Error during msa sdk initialization " + t.getMessage());
}
}

public static void doNotReadOaid() {
AdjustOaid.isOaidToBeRead = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.adjust.sdk.oaid;

import android.content.Context;

import com.adjust.sdk.ILogger;
import com.bun.miitmdid.core.ErrorCode;
import com.bun.miitmdid.core.IIdentifierListener;
import com.bun.miitmdid.core.MdidSdkHelper;
import com.bun.miitmdid.supplier.IdSupplier;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

public class MsaSdkClient {
public static String getOaid(Context context, final ILogger logger, long maxWaitTimeInMilli) {
final BlockingQueue<String> oaidHolder = new LinkedBlockingQueue<String>(1);

try {
boolean msaInternalLogging = false;
int result = MdidSdkHelper.InitSdk(context, msaInternalLogging, new IIdentifierListener() {
@Override
public void OnSupport(boolean b, IdSupplier idSupplier) {
try {
if (idSupplier == null || idSupplier.getOAID() == null) {
// so to avoid waiting for timeout
oaidHolder.offer("");
} else {
oaidHolder.offer(idSupplier.getOAID());
}
} catch (Exception e) {
logger.error("Fail to add %s", e.getMessage());
}
}
});

if (!isError(result, logger)) {
return oaidHolder.poll(maxWaitTimeInMilli, TimeUnit.MILLISECONDS);
}
} catch (NoClassDefFoundError ex) {
logger.error("Couldn't find msa sdk " + ex.getMessage());
} catch (InterruptedException e) {
logger.error("Waiting to read oaid from callback interrupted: %s",
e.getMessage());
} catch (Throwable t) {
logger.error("Oaid reading process failed %s", t.getMessage());
}

return null;
}

private static boolean isError(int result, ILogger logger) {
switch(result) {
case ErrorCode.INIT_ERROR_BEGIN:
logger.error("msa sdk error - INIT_ERROR_BEGIN");
return true;
case ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT:
logger.error("msa sdk error - INIT_ERROR_DEVICE_NOSUPPORT");
return true;
case ErrorCode.INIT_ERROR_LOAD_CONFIGFILE:
logger.error("msa sdk error - INIT_ERROR_LOAD_CONFIGFILE");
return true;
case ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT:
logger.error("msa sdk error - INIT_ERROR_MANUFACTURER_NOSUPPORT");
return true;
case ErrorCode.INIT_HELPER_CALL_ERROR:
logger.error("msa sdk error - INIT_HELPER_CALL_ERROR");
return true;
default:
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.concurrent.TimeUnit;

public class OpenDeviceIdentifierClient {

private static final String OAID_INTENT_ACTION = "com.uodis.opendevice.OPENIDS_SERVICE";
private static final String HUAWEI_PACKAGE_NAME = "com.huawei.hwid";

Expand Down Expand Up @@ -61,13 +60,12 @@ private OpenDeviceIdentifierClient(Context context, ILogger logger, long maxWait
this.maxWaitTime = maxWaitTime;
}

private synchronized Info getOaidInfo()
throws RemoteException
{
private synchronized Info getOaidInfo() throws RemoteException {
OpenDeviceIdentifierConnector serviceConnector = getServiceConnector(this.context);
if (serviceConnector == null) {
return null;
}

OpenDeviceIdentifierService service =
serviceConnector.getOpenDeviceIdentifierService(maxWaitTime, TimeUnit.MILLISECONDS);
if (service == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.concurrent.TimeUnit;

public class OpenDeviceIdentifierConnector implements ServiceConnection, IBinder.DeathRecipient {

private static volatile OpenDeviceIdentifierConnector instance = null;
private static final Object lockObject = new Object();
private BlockingQueue<IBinder> binders = null;
Expand Down Expand Up @@ -42,9 +41,7 @@ public boolean isServiceConnected() {
return !binders.isEmpty();
}

public OpenDeviceIdentifierService getOpenDeviceIdentifierService(long timeOut,
TimeUnit timeUnit)
{
public OpenDeviceIdentifierService getOpenDeviceIdentifierService(long timeOut, TimeUnit timeUnit) {
// poll in order to wait & retrieve the service
IBinder service;
try {
Expand Down
68 changes: 61 additions & 7 deletions Adjust/sdk-plugin-oaid/src/main/java/com/adjust/sdk/oaid/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,71 @@

public class Util {
public static Map<String, String> getOaidParameters(Context context, ILogger logger) {
if (!AdjustOaid.isOaidToBeRead) {
return null;
}

Map<String, String> oaidParameters;

// IMPORTANT:
// if manufacturer is huawei then try reading the oaid with hms (huawei mobile service)
// approach first, as it can read both oaid and limit tracking status
// otherwise use the msa sdk which only gives the oaid currently

if (isManufacturerHuawei(logger)) {
oaidParameters = getOaidParametersUsingHMS(context, logger);
if (oaidParameters != null) {
return oaidParameters;
}

return getOaidParametersUsingMSA(context, logger);
} else {
oaidParameters = getOaidParametersUsingMSA(context, logger);
if (oaidParameters != null) {
return oaidParameters;
}

return getOaidParametersUsingHMS(context, logger);
}
}

if (AdjustOaid.isOaidToBeRead) {
Info oaidInfo = OpenDeviceIdentifierClient.getOaidInfo(context, logger, 1000);
if (oaidInfo != null) {
Map<String, String> parameters = new HashMap<String, String>();
PackageBuilder.addString(parameters, "oaid", oaidInfo.getOaid());
PackageBuilder.addBoolean(parameters, "oaid_tracking_enabled", !oaidInfo.isOaidTrackLimited());
return parameters;
private static boolean isManufacturerHuawei(ILogger logger) {
try {
String manufacturer = android.os.Build.MANUFACTURER;
if (manufacturer != null && manufacturer.equalsIgnoreCase("huawei")) {
return true;
}
} catch (Exception e) {
logger.debug("Manufacturer not available");
}
return false;
}

private static Map<String, String> getOaidParametersUsingHMS(Context context, ILogger logger) {
Info oaidInfo = OpenDeviceIdentifierClient.getOaidInfo(context, logger, 1000);
if (oaidInfo != null) {
Map<String, String> parameters = new HashMap<String, String>();
PackageBuilder.addString(parameters, "oaid", oaidInfo.getOaid());
PackageBuilder.addBoolean(parameters, "oaid_tracking_enabled", !oaidInfo.isOaidTrackLimited());
return parameters;
}
logger.debug("Fail to read the OAID using HMS");
return null;
}

private static Map<String, String> getOaidParametersUsingMSA(Context context, ILogger logger) {
if (!AdjustOaid.isMsaSdkAvailable) {
return null;
}

String oaid = MsaSdkClient.getOaid(context, logger, 1000);
if (oaid != null && !oaid.isEmpty()) {
Map<String, String> parameters = new HashMap<String, String>();
PackageBuilder.addString(parameters, "oaid", oaid);
return parameters;
}

logger.debug("Fail to read the OAID using MSA");
return null;
}
}
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-sociomantic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'
}

task adjustSociomanticAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-trademob/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'
}

task adjustTrademobAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-webbridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.19.0'
// implementation 'com.adjust.sdk:adjust-android:4.19.1'
}

task adjustWebBridgeAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-webbridge/src/main/assets/adjust.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ var Adjust = {
if (this.adjustConfig) {
return this.adjustConfig.getSdkPrefix();
} else {
return 'web-bridge4.19.0';
return 'web-bridge4.19.1';
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public TestActivityPackage(ActivityPackage activityPackage) {
// default values
appToken = "123456789012";
environment = "sandbox";
clientSdk = "android4.19.0";
clientSdk = "android4.19.1";
suffix = "";
attribution = new AdjustAttribution();
playServices = true;
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 4.19.1 (13th December 2019)
#### Added
- Added support to Adjust OAID plugin for reading `OAID` identifier with usage of MSA SDK if present in app and supported on device.

---

### Version 4.19.0 (9th December 2019)
#### Added
- Added `disableThirdPartySharing(Context)` method to `Adjust` interface to allow disabling of data sharing with third parties outside of Adjust ecosystem.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ These are the minimum required steps to integrate the Adjust SDK in your Android
If you are using Maven, add the following to your `build.gradle` file:

```gradle
implementation 'com.adjust.sdk:adjust-android:4.19.0'
implementation 'com.adjust.sdk:adjust-android:4.19.1'
implementation 'com.android.installreferrer:installreferrer:1.0'
```

If you would prefer to use the Adjust SDK inside web views in your app, please include this additional dependency as well:

```gradle
implementation 'com.adjust.sdk:adjust-android-webbridge:4.19.0'
implementation 'com.adjust.sdk:adjust-android-webbridge:4.19.1'
```

You can also add the Adjust SDK and web view extension as JAR files, which can be downloaded from our [releases page][releases].
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.19.0
4.19.1
Loading