18
18
19
19
import android .location .Location ;
20
20
import android .os .Build ;
21
+ import android .text .TextUtils ;
21
22
22
23
import com .appnexus .opensdk .ANExternalUserIdSource ;
24
+ import com .appnexus .opensdk .ANGDPRSettings ;
23
25
import com .appnexus .opensdk .BuildConfig ;
24
26
import com .appnexus .opensdk .MediaType ;
25
27
import com .appnexus .opensdk .R ;
28
+ import com .appnexus .opensdk .ut .UTConstants ;
26
29
30
+ import java .net .URL ;
27
31
import java .util .HashMap ;
28
32
import java .util .HashSet ;
29
33
import java .util .Locale ;
@@ -50,6 +54,10 @@ public enum CountImpression {
50
54
public String carrierName = null ;
51
55
public String aaid = null ;
52
56
public boolean limitTrackingEnabled = false ;
57
+ // Caches the value of DeviceAccessConsent for each request and is updated every time a request is made.
58
+ // Use this value instead of calling and fetching from shared preference each time.
59
+ public boolean deviceAccessAllowed = true ;
60
+
53
61
@ Deprecated
54
62
public boolean useHttps =true ;
55
63
@@ -100,6 +108,13 @@ public enum CountImpression {
100
108
* */
101
109
public static boolean countImpressionOn1pxRendering = false ;
102
110
111
+ /**
112
+ * @deprecated
113
+ * This feature flag is responsible for turning on/off ib.adnxs-simple.com domain usage.
114
+ * By default this is true. This feature flag will be removed in future releases. This is introduced just as a failsafe kill switch.
115
+ * */
116
+ public static boolean simpleDomainUsageAllowed = true ;
117
+
103
118
// STATICS
104
119
public static final int HTTP_CONNECTION_TIMEOUT = 15000 ;
105
120
public static final int HTTP_SOCKET_TIMEOUT = 20000 ;
@@ -134,11 +149,7 @@ public enum CountImpression {
134
149
135
150
public static final int VIDEO_AUTOPLAY_PERCENTAGE = 50 ;
136
151
137
- private static String COOKIE_DOMAIN = "https://mediation.adnxs.com" ;
138
152
public static final String AN_UUID = "uuid2" ;
139
- private static String BASE_URL = "https://mediation.adnxs.com/" ;
140
- private static String REQUEST_BASE_URL = "https://mediation.adnxs.com/mob?" ;
141
- private static String INSTALL_BASE_URL = "https://mediation.adnxs.com/install?" ;
142
153
143
154
private static String VIDEO_HTML = "file:///android_asset/apn_vastvideo.html" ;
144
155
@@ -185,26 +196,29 @@ public HashSet<String> getInvalidNetwork(MediaType type) {
185
196
return null ;
186
197
}
187
198
188
- public static String getBaseUrl () {
189
- return BASE_URL ;
190
- }
191
-
192
- public static String getRequestBaseUrl () {
193
- return REQUEST_BASE_URL ;
199
+ // Returns ib.adnxs-simple.com if we do not have deviceAccessConsent as per GDPR or when doNotTrack is turned on by publisher
200
+ public static String getWebViewBaseUrl () {
201
+ if ((! Settings . getSettings (). deviceAccessAllowed || Settings . getSettings (). doNotTrack ) && Settings . getSettings (). simpleDomainUsageAllowed ) {
202
+ return UTConstants . WEBVIEW_BASE_URL_SIMPLE ;
203
+ }
204
+ return UTConstants . WEBVIEW_BASE_URL_UT ;
194
205
}
195
206
196
- public static String getInstallBaseUrl () {
197
- return INSTALL_BASE_URL ;
207
+ // Returns ib.adnxs-simple.com if we do not have deviceAccessConsent as per GDPR or when doNotTrack is turned on by publisher
208
+ public static String getAdRequestUrl () {
209
+ if ((!Settings .getSettings ().deviceAccessAllowed || Settings .getSettings ().doNotTrack ) && Settings .getSettings ().simpleDomainUsageAllowed ) {
210
+ return UTConstants .REQUEST_BASE_URL_SIMPLE ;
211
+ }
212
+ return UTConstants .REQUEST_BASE_URL_UT ;
198
213
}
199
214
200
-
201
215
public static String getVideoHtmlPage () {
202
216
return Settings .getSettings ().debug_mode ? VIDEO_HTML .replace ("apn_vastvideo.html" , "apn_vastvideo.html?ast_debug=true" ) : VIDEO_HTML ;
203
217
}
204
218
205
-
219
+ // There is only one cookie domain
206
220
public static String getCookieDomain (){
207
- return COOKIE_DOMAIN ;
221
+ return UTConstants . COOKIE_DOMAIN ;
208
222
}
209
223
210
224
}
0 commit comments