Skip to content

Commit

Permalink
Merge pull request #694 in MOBILE-SDK/app_mobile-sdk-android from rel…
Browse files Browse the repository at this point in the history
…ease_branch_8.5 to master

* commit '831178b69e087e37c4de3ae9df453a195aa938eb':
  release_version_8.5
  MS-5269 optimize logs
  MS-5270 onInitFinished not getting triggered
  handle null pointer exception
  MS-5237 Removing info logs for request params and response
  deprecated optional sdk
  MS-5254 Logs for impression tracking type
  Updated mvp with Fullscreen fix
  • Loading branch information
Ritesh Zaveri committed Mar 7, 2023
2 parents 1165975 + 831178b commit 642cf8d
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 32 deletions.
7 changes: 7 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.5

### Improvement/Bug Fixes
+ MS-5237 Moved request / response details to debug level log
+ MS-5060 Fixed media buttons in full screen Banner Outstream Video
+ MS-5258 Fixed NullPointerException for Interstitial ad media type

## 8.4

### Improvement/Bug Fixes
Expand Down
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.42" // Instream SDK version
version = "1.43" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 41 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 42 // 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
8 changes: 4 additions & 4 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.4"
version = "8.5"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -9,7 +9,7 @@ android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
defaultConfig {
versionCode 100 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 101 // 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
4 changes: 3 additions & 1 deletion sdk/src/com/appnexus/opensdk/ANNativeAdResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ public void run() {
listener.onAdAboutToExpire();
}
if (anNativeExpireHandler != null) {
anNativeExpireHandler.postDelayed(expireRunnable, getExpiryInterval(UTConstants.RTB, memberId));
long interval = getExpiryInterval(UTConstants.RTB, memberId);
anNativeExpireHandler.postDelayed(expireRunnable, interval);
Clog.w(Clog.baseLogTag, "onAdExpired() will be called in " + interval + "ms.");
}
}
};
Expand Down
12 changes: 6 additions & 6 deletions sdk/src/com/appnexus/opensdk/AdView.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ protected void close(int w, int h, MRAIDImplementation caller) {
}

// Reset the context of MutableContext wrapper for banner expand and close case.
if (getMediaType().equals(MediaType.BANNER) && (caller.owner.getContext() instanceof MutableContextWrapper)) {
if (getMediaType() == MediaType.BANNER && (caller.owner.getContext() instanceof MutableContextWrapper)) {
((MutableContextWrapper) caller.owner.getContext()).setBaseContext(getContext());
}
}
Expand Down Expand Up @@ -604,7 +604,7 @@ public void onLayout(boolean changed, int left, int top, int right, int bottom)
}

int adviewLoc[] = new int[2];
if (getMediaType().equals(MediaType.INTERSTITIAL)) {
if (getMediaType() == MediaType.INTERSTITIAL) {
InterstitialAdView.INTERSTITIALADVIEW_TO_USE.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
InterstitialAdView.INTERSTITIALADVIEW_TO_USE.getLocationOnScreen(adviewLoc);
container_size = new Point(InterstitialAdView.INTERSTITIALADVIEW_TO_USE.getMeasuredWidth(),
Expand Down Expand Up @@ -1056,9 +1056,9 @@ public void run() {

private void processAdLoaded(AdResponse ad) {
isFetching = false;
if (ad.getMediaType().equals(MediaType.BANNER) || ad.getMediaType().equals(MediaType.INTERSTITIAL)) {
if (ad.getMediaType() == MediaType.BANNER || ad.getMediaType() == MediaType.INTERSTITIAL) {
handleBannerOrInterstitialAd(ad);
} else if (ad.getMediaType().equals(MediaType.NATIVE)) {
} else if (ad.getMediaType() == MediaType.NATIVE) {
handleNativeAd(ad);
} else {
Clog.e(Clog.baseLogTag, "UNKNOWN media type::" + ad.getMediaType());
Expand Down Expand Up @@ -1148,7 +1148,7 @@ public void run() {

@Override
public void toggleAutoRefresh() {
if (getMediaType().equals(MediaType.BANNER) && mAdFetcher.getState() == AdFetcher.STATE.STOPPED) {
if (getMediaType() == MediaType.BANNER && mAdFetcher.getState() == AdFetcher.STATE.STOPPED) {
mAdFetcher.start();
}
}
Expand Down Expand Up @@ -1209,7 +1209,7 @@ public void run() {
if (baseAdResponse.getImpressionURLs() != null && baseAdResponse.getImpressionURLs().size() > 0) {
setImpressionTrackerVariables(baseAdResponse);
}
} else if (ImpressionType.VIEWABLE_IMPRESSION == impressionType && ad.getMediaType().equals(MediaType.BANNER)) {
} else if (ImpressionType.VIEWABLE_IMPRESSION == impressionType && ad.getMediaType() == MediaType.BANNER) {
if (baseAdResponse.getImpressionURLs() != null && baseAdResponse.getImpressionURLs().size() > 0) {
setImpressionTrackerVariables(baseAdResponse);
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/com/appnexus/opensdk/AdViewRequestManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void onReceiveAd(AdResponse ad) {
}
Ad owner = this.owner.get();
if (owner != null) {
if (ad.getMediaType().equals(MediaType.BANNER)) {
if (ad.getMediaType() == MediaType.BANNER) {
BannerAdView bav = (BannerAdView) owner;
if (bav.getExpandsToFitScreenWidth() || bav.getResizeAdToFitContainer()) {
int width = ad.getResponseData().getWidth() <= 1 ? bav.getRequestParameters().getPrimarySize().width() : ad.getResponseData().getWidth();
Expand Down Expand Up @@ -389,14 +389,14 @@ private void handleCSMResponse(Ad ownerAd, final CSMSDKAdResponse csmSdkAdRespon

} else {
AdView owner = (AdView) ownerAd;
if (owner.getMediaType().equals(MediaType.BANNER)) {
if (owner.getMediaType() == MediaType.BANNER) {
controller = MediatedBannerAdViewController.create(
(Activity) owner.getContext(),
AdViewRequestManager.this,
csmSdkAdResponse,
owner.getAdDispatcher());

} else if (owner.getMediaType().equals(MediaType.INTERSTITIAL)) {
} else if (owner.getMediaType() == MediaType.INTERSTITIAL) {
controller = MediatedInterstitialAdViewController.create(
(Activity) owner.getContext(),
AdViewRequestManager.this,
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/AdWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ private AdResponse getAdResponse() {
return new AdResponse() {
@Override
public MediaType getMediaType() {
return adView.getMediaType();
return adView != null ? adView.getMediaType() : null;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/com/appnexus/opensdk/MRAIDImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void run() {
}
});

if (owner.adView.getMediaType().equals(MediaType.BANNER)) {
if (owner.adView.getMediaType() == MediaType.BANNER) {
default_gravity = ((FrameLayout.LayoutParams) owner.getLayoutParams()).gravity;
}

Expand Down Expand Up @@ -269,7 +269,7 @@ void close() {
owner.getLayoutParams());
lp.height = default_height;
lp.width = default_width;
if (owner.adView.getMediaType().equals(MediaType.BANNER)) {
if (owner.adView.getMediaType() == MediaType.BANNER) {
lp.gravity = default_gravity;
} else {
lp.gravity = Gravity.CENTER;
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/NativeAdRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void onAdLoaded(final AdResponse ad) {
}

private void processAdLoaded(AdResponse ad) {
if (!ad.getMediaType().equals(MediaType.NATIVE)) {
if (ad.getMediaType() != MediaType.NATIVE) {
onAdFailed(ResultCode.getNewInstance(ResultCode.INTERNAL_ERROR), null);
} else {
final String IMAGE_URL = "image", ICON_URL = "icon";
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/NativeAdSDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static boolean isValid(NativeAdResponse response) {
if (response != null && !response.hasExpired()) {
return true;
}
Clog.d(Clog.nativeLogTag, "NativeAdResponse is not valid");
Clog.e(Clog.nativeLogTag, "NativeAdResponse is not valid");
return false;
}

Expand Down
12 changes: 10 additions & 2 deletions sdk/src/com/appnexus/opensdk/XandrAd.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public class XandrAd {
* @param context for pre-caching the content.
* @param preCacheContent enable / disable pre-caching of the content.provides flexibility to pre-cache content, such as fetch userAgent, fetch AAID and activate OMID. Pre-caching will make the future ad requests faster.
* @param initListener for listening to the completion event.
* Use {@link XandrAd#init(int, Context, boolean, boolean, InitListener)} signature instead
* To be removed in v9.0
* */
@Deprecated
public static void init(int memberId, final Context context, boolean preCacheContent,
final InitListener initListener) {
init(memberId, context, preCacheContent, false, initListener);
Expand All @@ -76,9 +79,13 @@ public static void init(int memberId, final Context context, boolean preCacheCon
* */
public static void init(int memberId, final Context context, boolean preCacheContent, boolean preCacheMraidSupports,
final InitListener initListener) {
// Assigning / Updating memberId
XandrAd.memberId = memberId;
isSdkInitialised = !preCacheContent || context == null;
isMraidInitialised = !preCacheMraidSupports || !Settings.isIntentMapAlreadyCached();
areMemberIdsCached = cachedViewableImpressionMemberIds.size() > 0;
// Triggering onInitFinished if further initialization is not required
onInitFinished(initListener);
if (!isSdkInitialised) {
SDKSettings.init(context, new InitListener() {
@Override
Expand All @@ -105,7 +112,6 @@ public void run() {
});
}

XandrAd.memberId = memberId;
if (!areMemberIdsCached) {
if (context != null && !SharedNetworkManager.getInstance(context).isConnected(context)) {
if (initListener != null) {
Expand Down Expand Up @@ -165,7 +171,9 @@ public static boolean isInitialised() {
* OR the buyerMemberId is contained within the cached list of member IDs
* */
public static boolean isEligibleForViewableImpression(int buyerMemberId) {
return doesContainMemberId(buyerMemberId) || buyerMemberId == memberId;
boolean isEligible = doesContainMemberId(buyerMemberId) || buyerMemberId == memberId;
Clog.i(Clog.baseLogTag, "Effective impression counting method for this auction : " + (isEligible? "Viewable Impression" : "Begin to Render"));
return isEligible;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/com/appnexus/opensdk/ut/UTAdRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public UTAdRequest(UTAdRequester adRequester) {
SharedNetworkManager networkManager = SharedNetworkManager.getInstance(requestParams.getContext());
if (!networkManager.isConnected(requestParams.getContext())) {
fail(ResultCode.getNewInstance(ResultCode.NETWORK_ERROR));
Clog.i(Clog.httpReqLogTag, "Connection Error");
Clog.e(Clog.httpReqLogTag, "Connection Error");
if (request != null) {
request.cancel(true);
}
}
} else {
Clog.i(Clog.httpReqLogTag, "Internal Error");
Clog.e(Clog.httpReqLogTag, "Internal Error");
fail(ResultCode.getNewInstance(ResultCode.INTERNAL_ERROR));
if (request != null) {
request.cancel(true);
Expand Down Expand Up @@ -192,7 +192,7 @@ HashMap<String, UTAdResponse> makeRequest() {

String result = builder.toString();

Clog.i(Clog.httpRespLogTag, "RESPONSE - " + result);
Clog.d(Clog.httpRespLogTag, "RESPONSE - " + result);
Map<String, List<String>> headers = conn.getHeaderFields();
if (Settings.getSettings().deviceAccessAllowed && !Settings.getSettings().doNotTrack) {
WebviewUtil.cookieSync(headers);
Expand Down Expand Up @@ -279,15 +279,15 @@ void processResponse(HashMap<String, UTAdResponse> adResponseMap) {
if (anMultiAdRequest == null) {

if (adResponseMap == null) {
Clog.i(Clog.httpRespLogTag, Clog.getString(R.string.no_response));
Clog.e(Clog.httpRespLogTag, Clog.getString(R.string.no_response));
fail(ResultCode.getNewInstance(ResultCode.INVALID_REQUEST));
return;
}

if (adResponseMap.size() == 1) {
UTAdResponse result = adResponseMap.get(requestParams.getUUID());
if (result == null) {
Clog.i(Clog.httpRespLogTag, Clog.getString(R.string.no_response));
Clog.e(Clog.httpRespLogTag, Clog.getString(R.string.no_response));
fail(ResultCode.getNewInstance(ResultCode.NETWORK_ERROR));
return; // http request failed
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/ut/UTRequestParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ String getPostData() {
} catch (JSONException e) {
Clog.e(Clog.httpReqLogTag, "JSONException: " + e.getMessage());
}
Clog.i(Clog.httpReqLogTag, "POST data: " + postData.toString());
Clog.d(Clog.httpReqLogTag, "POST data: " + postData.toString());
return postData.toString();
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/utils/HTTPGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected HTTPResponse makeHttpRequest() {
out.setSucceeded(false);
return out;
}
Clog.i(Clog.httpReqLogTag, "HTTPGet ReqURL - " + reqUrl);
Clog.d(Clog.httpReqLogTag, "HTTPGet ReqURL - " + reqUrl);
// Create and connect to HTTP service
connection = createConnection(reqUrl);
setConnectionParams(connection);
Expand Down

0 comments on commit 642cf8d

Please sign in to comment.