Skip to content

Commit

Permalink
Pull request #725: Release branch 8.9
Browse files Browse the repository at this point in the history
Merge in MOBILE-SDK/app_mobile-sdk-android from release_branch_8.9 to master

* commit '21231e2078ab2667f75ae0199325177fb0805546':
  release version 8.9
  Pull request #723: 5664325 Added WarmUpAdCall and Prefetch Webview options in XandrAd.init
  updated to version 7.23.0
  upgrade_smartadserver_7.22.0
  upgrade_admob_22.3.0
  trackertestapp changes
  updated omid validation verification script
  fix unit test cases
  updated omid libs
  • Loading branch information
Ritesh Zaveri committed Oct 18, 2023
2 parents df71129 + 21231e2 commit d410c46
Show file tree
Hide file tree
Showing 23 changed files with 215 additions and 130 deletions.
12 changes: 12 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 8.9

### New Feature
+ 5664325 Added new parameters to SDKSettings.init() for flexibility in pre-fetching webviews. This can improve app launch performance

### Improvement/Bug Fixes
+ 5663106 Upgraded OMSDK from 1.4.2 to 1.4.8

### Mediation partner updates
+ 5622329 Upgraded Google AdMob SDK from 21.3.0 to 22.3.0
+ 5622334 Upgraded Smart Ad Server SDK from 7.17.0 to 7.23.0

## 8.8

### New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,4 @@ public void goBacktoNormal() {
baseContainer.setLayoutParams(oldParams);
}
}
}
}
4 changes: 2 additions & 2 deletions instreamvideo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "1.47" // Instream SDK version
version = "1.48" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 46 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 47 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class InstreamVideoView extends FrameLayout {

void setup(Context context) {

SDKSettings.init(context, null);
SDKSettings.init(context, null, true, true, false, false);

Clog.d(Clog.publicFunctionsLogTag, Clog.getString(R.string.new_adview));

Expand Down Expand Up @@ -253,4 +253,4 @@ private boolean alreadyAddedToFriendlyObstruction(View view) {
protected ArrayList<WeakReference<View>> getFriendlyObstructionList() {
return friendlyObstructionList;
}
}
}
2 changes: 1 addition & 1 deletion mediation/mediatedviews/GooglePlay/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "21.3.0" // supported Google version
version = "22.3.0" // supported Google version

apply plugin: 'com.android.library'

Expand Down
3 changes: 1 addition & 2 deletions mediation/mediatedviews/SmartAdServer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "7.17.0" // supported SmartAdServer version
version = "7.23.0" // supported SmartAdServer version
apply plugin: 'com.android.library'

android {
Expand All @@ -23,7 +23,6 @@ android {
dependencies {
api project(':sdk')
api "com.smartadserver.android:smart-display-sdk:$version@aar"
api "com.smartadserver.android:smart-core-sdk:$version@aar"
api 'com.google.android.exoplayer:exoplayer-core:2.12.0'
api 'com.squareup.okhttp3:okhttp:3.12.12'
api 'androidx.preference:preference:1.1.1'
Expand Down
3 changes: 1 addition & 2 deletions sdk/assets/OMLICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Open Measurement (OM) License, V 1.1

Open Measurement (OM) License for Native-App Measurement, V 1.1

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down
158 changes: 83 additions & 75 deletions sdk/assets/apn_omsdk.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions sdk/assets/mobilevastplayer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project properties
version = "8.8"
version = "8.9"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -10,7 +10,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
versionCode 105 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 106 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
minSdkVersion 14
Expand Down
Binary file modified sdk/libs/omsdk.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/AdView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1667,4 +1667,4 @@ public Long getFinishTime() {
* */
public boolean isEligibleForNativeAssemblyRendering() { return eligibleForNativeAssemblyRendering; }

}
}
6 changes: 3 additions & 3 deletions sdk/src/com/appnexus/opensdk/NativeAdRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class NativeAdRequest implements Ad, MultiAd {

public NativeAdRequest(Context context, String placementID) {

SDKSettings.init(context, null);
SDKSettings.init(context, null, true, true, false, false);

requestParameters = new UTRequestParameters(context);
requestParameters.setPlacementID(placementID);
Expand All @@ -57,7 +57,7 @@ public NativeAdRequest(Context context, String placementID) {

public NativeAdRequest(Context context, String inventoryCode, int memberID) {

SDKSettings.init(context, null);
SDKSettings.init(context, null, true, true, false, false);

requestParameters = new UTRequestParameters(context);
requestParameters.setInventoryCodeAndMemberID(memberID, inventoryCode);
Expand Down Expand Up @@ -617,4 +617,4 @@ public Long getFinishTime() {
return 0L;
}

}
}
42 changes: 31 additions & 11 deletions sdk/src/com/appnexus/opensdk/SDKSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public class SDKSettings {
* */
private static Boolean useBackgroundThreads = false;

@Deprecated
private static Boolean enableBannerOptimization = true;

/**
* For internal use only
* */
private static boolean isOmidActivationDone = false, isUserAgentFetched = false, isAAIDFetched = false;
private static boolean isOmidActivationDone = false, isUserAgentFetched = false, isAAIDFetched = false, isWarmupAdCallDone = false, isPrefetchWebViewDone = false;

private static boolean isWarmupAdCallDone = false;

// hide the constructor from javadocs
private SDKSettings() {
Expand Down Expand Up @@ -429,21 +429,42 @@ public static void enableBackgroundThreading(boolean enable) {
}

public static void init(Context context, final InitListener listener) {
init(context, listener, true, true);
init(context, listener, true, true, true, true);
}

/**
* This is an overloaded init method which provides flexibility to enable/disable booleans for activateOmid, fetcbUserAgent and fetchAAID.
* This is an overloaded init method which provides flexibility to enable/disable booleans for activateOmid, fetchUserAgent and fetchAAID.
* @param fetchUserAgent enable / disable fetching of User Agent.
* @param fetchAAID enable / disable fetching of AAID.
* Use {@link SDKSettings#init(Context, InitListener, boolean, boolean, boolean, boolean)} signature instead
* To be removed in v9.0
* */
@Deprecated
public static void init(final Context context, final InitListener listener, final boolean fetchUserAgent, final boolean fetchAAID) {
prefetchWebview(context);
warmupAdCall();
init(context, listener, fetchUserAgent, fetchAAID, true, true);
}

/**
* This is an overloaded init method which provides flexibility to enable/disable booleans for activateOmid, fetchUserAgent, fetchAAID, enableWarmUpAdCall and preFetchWebView.
* @param fetchUserAgent enable / disable fetching of User Agent.
* @param fetchAAID enable / disable fetching of AAID.
* @param enableWarmUpAdCall enable / disable of the warm up ad call.
* @param preFetchWebView enable / disable pre-fetching of the webview.
* */
public static void init(final Context context, final InitListener listener, final boolean fetchUserAgent, final boolean fetchAAID, final boolean enableWarmUpAdCall, final boolean preFetchWebView) {
// Store the UA in the settings
isOmidActivationDone = Omid.isActive();
isUserAgentFetched = !fetchUserAgent || !StringUtil.isEmpty(Settings.getSettings().ua);
isAAIDFetched = !fetchAAID || !StringUtil.isEmpty(getAAID());
// Execute prefetchWebview() if !isPrefetchWebViewDone or prefetchWebView is enabled.
if(!isPrefetchWebViewDone && preFetchWebView){
isPrefetchWebViewDone = true;
prefetchWebview(context);
}
// Execute warmupAdCall() if !isWarmupAdCallDone or warm up ad call is enabled.
if (!isWarmupAdCallDone && enableWarmUpAdCall) {
warmupAdCall();
}
if (!isOmidActivationDone) {
ANOmidViewabilty.getInstance().activateOmidAndCreatePartner(context.getApplicationContext());
isOmidActivationDone = true;
Expand Down Expand Up @@ -496,9 +517,6 @@ public void onInitFinished(boolean success) {
}

private static void warmupAdCall() {
if (isWarmupAdCallDone) {
return;
}
new HTTPGet() {

@Override
Expand All @@ -514,7 +532,7 @@ protected String getUrl() {
}

private static void prefetchWebview(Context context) {
if (isBannerOptimizationEnabled()) {
if (enableBannerOptimization) {
List cachedAdWebView = Settings.getSettings().getCachedAdWebView();
if (cachedAdWebView.size() == 0) {
AdWebView webView = new AdWebView(context);
Expand Down Expand Up @@ -549,6 +567,8 @@ public void run() {
/**
* Experimental API, to be used in case of issue with banner optimization
* To be removed in v9.0
* Use {@link SDKSettings#init(Context, InitListener, boolean, boolean, boolean, boolean)} signature instead
* passing preFetchWebView = true/false while calling SDKSettings.init() has the same effect of setting enableBannerOptimization to true/false
* */
@Deprecated
public static void enableBannerOptimization(boolean enable) {
Expand All @@ -563,4 +583,4 @@ public static void enableBannerOptimization(boolean enable) {
public static Boolean isBannerOptimizationEnabled() {
return enableBannerOptimization;
}
}
}
4 changes: 2 additions & 2 deletions sdk/src/com/appnexus/opensdk/XandrAd.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
public class XandrAd {

/**
* memberId will be set using the {@link XandrAd#init(int, Context, boolean, boolean, InitListener)}
**/
* memberId will be set using the {@link XandrAd#init(int, Context, boolean, boolean, InitListener)}
**/
private static int memberId = -1;
/**
* Cached member IDs list
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/utils/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum ImpressionType {
public boolean debug_mode = false; // This should always be false here.
public String ua = null;

public final String sdkVersion = "8.8";
public final String sdkVersion = "8.9";
// BuildConfig.VERSION_NAME;


Expand Down
6 changes: 3 additions & 3 deletions sdk/test/com/appnexus/opensdk/AdFetcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void testStartWithRefreshOnWithLazyLoad() {
adFetcher.setPeriod(15000);
adFetcher.start();
Lock.pause(1000); // added this so jenkins can have enough time to process
// assert 3 here because a AAID async task
// assert 2 here because a AAID async task
assertExpectedBGTasksAfterOneAdRequest(2);

assertEquals(AdFetcher.STATE.AUTO_REFRESH, adFetcher.getState());
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testStartWithRefreshOnWithLazyLoadAndReload() {
adFetcher.setPeriod(15000);
adFetcher.start();
Lock.pause(1000); // added this so jenkins can have enough time to process
// assert 3 here because a AAID async task
// assert 2 here because a AAID async task
assertExpectedBGTasksAfterOneAdRequest(2);

assertEquals(AdFetcher.STATE.AUTO_REFRESH, adFetcher.getState());
Expand Down Expand Up @@ -207,7 +207,7 @@ public void testStartWithRefreshOnWithLazyLoadAndReload() {

owner.loadAd();
Lock.pause(1000); // added this so jenkins can have enough time to process
// assert 3 here because a AAID async task
// assert 4 here because a AAID async task
assertExpectedBGTasksAfterOneAdRequest(4);

assertEquals(AdFetcher.STATE.AUTO_REFRESH, adFetcher.getState());
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/com/appnexus/opensdk/SDKSettingsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ public void testSDKSettingsInitAboveHONEY_COMB() {
assertNotNull(Settings.getSettings().ua);
assertNotEquals(Settings.getSettings().ua, (userAgentWebView.getSettings().getUserAgentString().trim().toLowerCase(Locale.ROOT)));
}
}
}
6 changes: 3 additions & 3 deletions sdk/test/com/appnexus/opensdk/TestResponsesUT.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static void setTestURL(String url) {
private static final String MRAID_CONTENT = "<script type=\\\"text/javascript\\\" src=\\\"mraid.js\\\"></script><script type=\\\"text/javascript\\\">document.write('<div style=\\\"background-color:#EF8200;height:1000px;width:1000px;\\\"><p>%s</p></div>');</script>";
private static final String NATIVE_MAIN_MEDIA = "[{\"url\":\"%s\",\"width\":%d,\"height\":%d,\"label\":\"default\"},{\"url\":\"%s\",\"width\":%d,\"height\":%d},{\"url\":\"%s\",\"width\":%d,\"height\":%d}]";
private static final String NATIVE_RATING = "{\"value\":%.2f,\"scale\":%.2f}";
private static final String RTB_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendor;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_RENDERER_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendorRenderer;tv=cet=0;cecb=\\\"></script>";
private static final String CSM_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/test/omid-validation-verification-script-1.2.5.js#v;vk=dummyVendorCSM;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendor;tv=cet=0;cecb=\\\"></script>";
private static final String RTB_NATIVE_RENDERER_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendorRenderer;tv=cet=0;cecb=\\\"></script>";
private static final String CSM_NATIVE_VIEWABILITY_CONFIG = "<script type=\\\"text/javascript\\\" async=\\\"true\\\" src=\\\"https://acdn.adnxs.com/mobile/omsdk/validation-verification-scripts-fortesting/omsdk-js-1.4.8/Validation-Script/omid-validation-verification-script-v1.js#v;vk=dummyVendorCSM;tv=cet=0;cecb=\\\"></script>";
// template strings
private static final String CLASSNAME = "com.appnexus.opensdk.testviews.%s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.appnexus.opensdk.shadows;

import android.webkit.ValueCallback;
import android.webkit.WebView;

import com.appnexus.opensdk.util.TestUtil;
Expand All @@ -33,11 +34,31 @@ public class ShadowOMIDBannerHTMLWebView extends ShadowWebView {
public static String omidImpressionString = "";
public static String omidStartSession = "";


/*
* OMID events call loadURL so its possible to store the values here and assert them against expected values.
* OMID events call evaluateJavascript so its possible to store the values here and assert them against expected values.
*/
@Override
protected void evaluateJavascript(String script, ValueCallback<String> callback) {
super.evaluateJavascript(script, callback);
webView = new WebView(RuntimeEnvironment.application);
Clog.d(TestUtil.testLogTag, "ShadowOMIDBannerHTMLWebView loadUrl::"+script);
if(script.contains("omidBridge.init")){
omidInitString = script;
}

if(script.contains("omidBridge.startSession")){
omidStartSession = script;
}

if(script.contains("publishImpressionEvent")){
omidImpressionString = script;
}
}

/*
* OMID events do not make a call to loadUrl as of version 1.4.3 and later.
*/
/*@Override
public void loadUrl(String url) {
super.loadUrl(url);
webView = new WebView(RuntimeEnvironment.application);
Expand All @@ -53,7 +74,7 @@ public void loadUrl(String url) {
if(url.contains("publishImpressionEvent")){
omidImpressionString = url;
}
}
}*/


/*
Expand Down
Loading

0 comments on commit d410c46

Please sign in to comment.