Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.StrictMode;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.core.view.ViewCompat;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sj;
import com.applovin.sdk.R;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinMediaView extends FrameLayout {
protected final ImageView imageView;
protected final n logger;
protected final j sdk;
public AppLovinMediaView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(context);
setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.sdk = jVar;
this.logger = jVar.J();
LayoutInflater.from(context).inflate(R.layout.applovin_native_ad_media_view, (ViewGroup) this, true);
Uri mainImageUri = appLovinNativeAdImpl.getMainImageUri();
aq vastAd = appLovinNativeAdImpl.getVastAd();
Uri t0 = vastAd != null ? vastAd.t0() : null;
if (mainImageUri == null && t0 == null) {
throw new IllegalStateException("AppLovin native ad missing image AND video resources");
}
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
if (((Boolean) jVar.a(sj.Y2)).booleanValue()) {
setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.G0, context, appLovinNativeAdImpl));
} else {
setOnClickListener(appLovinNativeAdImpl);
}
ImageView imageView = (ImageView) findViewById(R.id.image_view);
this.imageView = imageView;
if (mainImageUri != null) {
ImageViewUtils.setAndDownscaleImageUri(imageView, mainImageUri);
}
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void destroy() {
setOnClickListener(null);
setOnTouchListener(null);
removeAllViews();
}
public float getAspectRatio() {
Drawable drawable;
ImageView imageView = this.imageView;
if (imageView == null || (drawable = imageView.getDrawable()) == null) {
return 0.0f;
}
return drawable.getIntrinsicWidth() / drawable.getIntrinsicHeight();
}
}

View File

@@ -0,0 +1,33 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/* loaded from: classes2.dex */
public interface AppLovinNativeAd {
void destroy();
long getAdIdNumber();
String getAdvertiser();
String getBody();
String getCallToAction();
Uri getIconUri();
AppLovinMediaView getMediaView();
AppLovinOptionsView getOptionsView();
Double getStarRating();
String getTitle();
void registerViewsForInteraction(List<View> list, ViewGroup viewGroup);
void unregisterViewsForInteraction();
}

View File

@@ -0,0 +1,6 @@
package com.applovin.impl.sdk.nativeAd;
/* loaded from: classes2.dex */
public interface AppLovinNativeAdEventListener {
void onNativeAdClicked(AppLovinNativeAd appLovinNativeAd);
}

View File

@@ -0,0 +1,903 @@
package com.applovin.impl.sdk.nativeAd;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.util.Function;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.br;
import com.applovin.impl.gc;
import com.applovin.impl.pg;
import com.applovin.impl.rg;
import com.applovin.impl.s;
import com.applovin.impl.sdk.AppLovinAdBase;
import com.applovin.impl.sdk.array.ArrayService;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.network.e;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tl;
import com.applovin.impl.tp;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.impl.zq;
import com.applovin.sdk.AppLovinSdkUtils;
import com.iab.omid.library.applovin.adsession.VerificationScriptResource;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class AppLovinNativeAdImpl extends AppLovinAdBase implements AppLovinNativeAd, View.OnClickListener, AppLovinTouchToClickListener.OnClickListener {
private static final String AD_RESPONSE_TYPE_APPLOVIN = "applovin";
private static final String AD_RESPONSE_TYPE_ORTB = "ortb";
private static final String AD_RESPONSE_TYPE_UNDEFINED = "undefined";
private static final String DEFAULT_APPLOVIN_PRIVACY_URL = "https://www.applovin.com/privacy/";
private static final float MINIMUM_STARS_TO_RENDER = 3.0f;
private static final String TAG = "AppLovinNativeAd";
private static final int VIEWABLE_MRC100_PERCENTAGE = 100;
private static final int VIEWABLE_MRC50_PERCENTAGE = 50;
private static final int VIEWABLE_MRC_REQUIRED_SECONDS = 1;
private static final int VIEWABLE_VIDEO_MRC_REQUIRED_SECONDS = 2;
private final pg adEventTracker;
private final String advertiser;
private final String body;
private final String callToAction;
private final Uri clickDestinationBackupUri;
private final Uri clickDestinationUri;
private final List<e> clickTrackingRequests;
private final List<String> clickTrackingUrls;
private AppLovinNativeAdEventListener eventListener;
private Uri iconUri;
private final List<e> impressionRequests;
private final AtomicBoolean impressionTracked;
private final List<String> jsTrackers;
private Uri mainImageUri;
private AppLovinMediaView mediaView;
private ViewGroup nativeAdView;
private final b onAttachStateChangeHandler;
private AppLovinOptionsView optionsView;
private Uri privacyDestinationUri;
private Uri privacyIconUri;
private final List<View> registeredViews;
private final Double starRating;
private final String tag;
private final String title;
private final aq vastAd;
@Nullable
private View videoView;
private final c viewableMRC100Callback;
private br viewableMRC100Tracker;
private final c viewableMRC50Callback;
private br viewableMRC50Tracker;
@Nullable
private c viewableVideoMRC50Callback;
@Nullable
private br viewableVideoMRC50Tracker;
public class a implements ArrayService.DirectDownloadListener {
final /* synthetic */ Uri a;
final /* synthetic */ Uri b;
final /* synthetic */ Context c;
public a(Uri uri, Uri uri2, Context context) {
this.a = uri;
this.b = uri2;
this.c = context;
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onAppDetailsDismissed() {
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onAppDetailsDisplayed() {
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onFailure() {
AppLovinNativeAdImpl.this.launchUri(this.a, this.b, this.c);
}
}
public static class b implements View.OnAttachStateChangeListener {
private final AppLovinNativeAdImpl a;
public b(AppLovinNativeAdImpl appLovinNativeAdImpl) {
this.a = appLovinNativeAdImpl;
}
public AppLovinNativeAdImpl a() {
return this.a;
}
public boolean a(Object obj) {
return obj instanceof b;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof b)) {
return false;
}
b bVar = (b) obj;
if (!bVar.a(this)) {
return false;
}
AppLovinNativeAdImpl a = a();
AppLovinNativeAdImpl a2 = bVar.a();
return a != null ? a.equals(a2) : a2 == null;
}
public int hashCode() {
AppLovinNativeAdImpl a = a();
return (a == null ? 43 : a.hashCode()) + 59;
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewAttachedToWindow(View view) {
this.a.maybeHandleOnAttachedToWindow(view);
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewDetachedFromWindow(View view) {
}
public String toString() {
return "AppLovinNativeAdImpl.OnAttachStateChangeHandler(ad=" + a() + ")";
}
}
public class c implements br.a {
private final List a;
public c(List list) {
this.a = list;
}
public List a() {
return this.a;
}
public boolean a(Object obj) {
return obj instanceof c;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof c)) {
return false;
}
c cVar = (c) obj;
if (!cVar.a(this)) {
return false;
}
List a = a();
List a2 = cVar.a();
return a != null ? a.equals(a2) : a2 == null;
}
public int hashCode() {
List a = a();
return (a == null ? 43 : a.hashCode()) + 59;
}
@Override // com.applovin.impl.br.a
public void onLogVisibilityImpression() {
Iterator it = this.a.iterator();
while (it.hasNext()) {
((AppLovinAdBase) AppLovinNativeAdImpl.this).sdk.Y().dispatchPostbackRequest((e) it.next(), null);
}
}
public String toString() {
return "AppLovinNativeAdImpl.VisibilityCallback(requests=" + a() + ")";
}
}
public /* synthetic */ AppLovinNativeAdImpl(Builder builder, a aVar) {
this(builder);
}
private List<String> getPrivacySandboxClickAttributionUrls() {
return getStringListFromAdObject("privacy_sandbox_click_attribution_urls", Collections.emptyList());
}
private List<String> getPrivacySandboxImpressionAttributionUrls() {
return getStringListFromAdObject("privacy_sandbox_impression_attribution_urls", Collections.emptyList());
}
private boolean isDspAd() {
return AD_RESPONSE_TYPE_ORTB.equalsIgnoreCase(getType());
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ List lambda$getOpenMeasurementVerificationScriptResources$2(JSONArray jSONArray) {
if (jSONArray == null) {
return Collections.emptyList();
}
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject jSONObject = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null);
try {
URL url = new URL(JsonUtils.getString(jSONObject, "url", null));
String string = JsonUtils.getString(jSONObject, "vendor_key", null);
String string2 = JsonUtils.getString(jSONObject, "parameters", null);
if (StringUtils.isValidString(string) && StringUtils.isValidString(string2)) {
arrayList.add(VerificationScriptResource.createVerificationScriptResourceWithParameters(string, url, string2));
} else {
arrayList.add(VerificationScriptResource.createVerificationScriptResourceWithoutParameters(url));
}
} catch (Throwable th) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Failed to parse OMID verification script resource", th);
}
}
}
return arrayList;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void lambda$unregisterViewsForInteraction$0() {
for (View view : this.registeredViews) {
view.setOnTouchListener(null);
view.setOnClickListener(null);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Unregistered views: " + this.registeredViews);
}
this.registeredViews.clear();
br brVar = this.viewableMRC50Tracker;
if (brVar != null) {
brVar.b();
}
br brVar2 = this.viewableMRC100Tracker;
if (brVar2 != null) {
brVar2.b();
}
br brVar3 = this.viewableVideoMRC50Tracker;
if (brVar3 != null) {
brVar3.b();
}
ViewGroup viewGroup = this.nativeAdView;
if (viewGroup != null) {
viewGroup.removeOnAttachStateChangeListener(this.onAttachStateChangeHandler);
this.nativeAdView = null;
}
AppLovinMediaView appLovinMediaView = this.mediaView;
if (appLovinMediaView != null) {
appLovinMediaView.destroy();
}
AppLovinOptionsView appLovinOptionsView = this.optionsView;
if (appLovinOptionsView != null) {
appLovinOptionsView.destroy();
}
}
/* JADX INFO: Access modifiers changed from: private */
public void launchUri(Uri uri, @Nullable Uri uri2, Context context) {
if (tp.a(uri, context, this.sdk)) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Opening URL: " + uri);
return;
}
return;
}
if (tp.a(uri2, context, this.sdk)) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Opening backup URL: " + uri2);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandleOnAttachedToWindow(View view) {
if (this.impressionTracked.compareAndSet(false, true)) {
br brVar = new br(this.nativeAdView, this.sdk, this.viewableMRC50Callback);
this.viewableMRC50Tracker = brVar;
TimeUnit timeUnit = TimeUnit.SECONDS;
brVar.a(0, 50.0f, 50.0f, timeUnit.toMillis(1L), this.nativeAdView);
br brVar2 = new br(this.nativeAdView, this.sdk, this.viewableMRC100Callback);
this.viewableMRC100Tracker = brVar2;
brVar2.a(0, 100.0f, 100.0f, timeUnit.toMillis(1L), this.nativeAdView);
aq aqVar = this.vastAd;
if (aqVar != null && aqVar.hasVideoUrl()) {
br brVar3 = new br(this.nativeAdView, this.sdk, this.viewableVideoMRC50Callback);
this.viewableVideoMRC50Tracker = brVar3;
brVar3.a(0, 50.0f, 50.0f, timeUnit.toMillis(2L), this.videoView);
}
List<String> list = this.jsTrackers;
if (list != null) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
this.sdk.r0().b(it.next());
}
}
Iterator<e> it2 = this.impressionRequests.iterator();
while (it2.hasNext()) {
this.sdk.Y().dispatchPostbackRequest(it2.next(), null);
}
this.adEventTracker.a(view);
this.adEventTracker.g();
if (this.sdk.Z() != null) {
this.sdk.Z().b(getPrivacySandboxImpressionAttributionUrls());
}
}
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void destroy() {
unregisterViewsForInteraction();
this.eventListener = null;
this.adEventTracker.f();
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public pg getAdEventTracker() {
return this.adEventTracker;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase
public long getAdIdNumber() {
return getLongFromAdObject("ad_id", -1L);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getAdvertiser() {
return this.advertiser;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getBody() {
return this.body;
}
@Nullable
public String getCachePrefix() {
return getStringFromAdObject("cache_prefix", null);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getCallToAction() {
return this.callToAction;
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
@Nullable
public String getDirectDownloadToken() {
return getStringFromAdObject("ah_dd_token", null);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public Uri getIconUri() {
return this.iconUri;
}
public Uri getMainImageUri() {
return this.mainImageUri;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public AppLovinMediaView getMediaView() {
return this.mediaView;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
@Nullable
public String getOpenMeasurementContentUrl() {
return getStringFromAdObject("omid_content_url", null);
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public String getOpenMeasurementCustomReferenceData() {
return getStringFromAdObject("omid_custom_ref_data", "");
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public List<VerificationScriptResource> getOpenMeasurementVerificationScriptResources() {
List<VerificationScriptResource> list;
if (this.sdk.W().e()) {
return Collections.singletonList(VerificationScriptResource.createVerificationScriptResourceWithParameters(rg.c(), rg.b(), rg.a()));
}
final Function function = new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda0
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getOpenMeasurementVerificationScriptResources$2;
lambda$getOpenMeasurementVerificationScriptResources$2 = AppLovinNativeAdImpl.this.lambda$getOpenMeasurementVerificationScriptResources$2((JSONArray) obj);
return lambda$getOpenMeasurementVerificationScriptResources$2;
}
};
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (List) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda1
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getOpenMeasurementVerificationScriptResources$3;
lambda$getOpenMeasurementVerificationScriptResources$3 = AppLovinNativeAdImpl.lambda$getOpenMeasurementVerificationScriptResources$3(Function.this, (tl) obj);
return lambda$getOpenMeasurementVerificationScriptResources$3;
}
});
}
synchronized (this.adObjectLock) {
list = (List) function.apply(getJsonArrayFromAdObject("omid_verification_script_resources", null));
}
return list;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public AppLovinOptionsView getOptionsView() {
return this.optionsView;
}
public Uri getPrivacyDestinationUri() {
return this.privacyDestinationUri;
}
public Uri getPrivacyIconUri() {
return this.privacyIconUri;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public Double getStarRating() {
return this.starRating;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getTitle() {
return this.title;
}
public String getType() {
return getStringFromAdObject("type", "undefined");
}
public aq getVastAd() {
return this.vastAd;
}
public void handleNativeAdClick(Uri uri, @Nullable Uri uri2, MotionEvent motionEvent, Context context) {
if (this.sdk.Z() != null) {
this.sdk.Z().b(getPrivacySandboxClickAttributionUrls(), motionEvent);
}
handleNativeAdClick(uri, uri2, context);
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public boolean isDirectDownloadEnabled() {
return StringUtils.isValidString(getDirectDownloadToken());
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public boolean isOpenMeasurementEnabled() {
if (this.sdk.W().e()) {
return true;
}
return getBooleanFromAdObject("omsdk_enabled", Boolean.FALSE);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Context context;
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Handle view clicked");
}
this.sdk.i().maybeSubmitPersistentPostbacks(getDirectClickTrackingPostbacks());
if (((Boolean) this.sdk.a(sj.F)).booleanValue()) {
context = zq.a(this.nativeAdView, this.sdk);
if (context == null) {
context = view.getContext();
}
} else {
context = view.getContext();
}
handleNativeAdClick(this.clickDestinationUri, this.clickDestinationBackupUri, context);
}
public void setEventListener(AppLovinNativeAdEventListener appLovinNativeAdEventListener) {
this.eventListener = appLovinNativeAdEventListener;
}
public void setIconUri(Uri uri) {
this.iconUri = uri;
}
public void setMainImageUri(Uri uri) {
this.mainImageUri = uri;
}
public void setPrivacyIconUri(Uri uri) {
this.privacyIconUri = uri;
}
public void setUpNativeAdViewComponents() {
aq aqVar = this.vastAd;
if (aqVar == null || !aqVar.hasVideoUrl()) {
this.mediaView = new AppLovinMediaView(this, this.sdk, j.l());
} else {
try {
this.mediaView = new AppLovinVastMediaView(this, this.sdk, j.l());
} catch (Throwable th) {
this.sdk.J();
if (n.a()) {
this.sdk.J().d(this.tag, "Failed to create ExoPlayer VAST media view. Falling back to static image for media view.", th);
}
this.sdk.E().a(TAG, "createExoPlayerVASTMediaView", th);
this.mediaView = new AppLovinMediaView(this, this.sdk, j.l());
}
}
if (this.privacyDestinationUri != null) {
this.optionsView = new AppLovinOptionsView(this, this.sdk, j.l());
return;
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Privacy icon will not render because no native ad privacy URL is provided.");
}
}
public void setVideoView(@Nullable View view) {
this.videoView = view;
}
@NonNull
public String toString() {
return "AppLovinNativeAd{adIdNumber=" + getAdIdNumber() + " - " + getTitle() + "}";
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void unregisterViewsForInteraction() {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
AppLovinNativeAdImpl.this.lambda$unregisterViewsForInteraction$0();
}
});
}
private AppLovinNativeAdImpl(Builder builder) {
super(builder.adObject, builder.fullResponse, builder.sdk);
this.impressionTracked = new AtomicBoolean();
this.registeredViews = new ArrayList();
this.onAttachStateChangeHandler = new b(this);
this.adEventTracker = new pg(this);
this.title = builder.title;
this.advertiser = builder.advertiser;
this.body = builder.body;
this.callToAction = builder.callToAction;
this.iconUri = builder.iconUri;
this.mainImageUri = builder.mainImageUri;
this.privacyIconUri = builder.privacyIconUri;
aq aqVar = builder.vastAd;
this.vastAd = aqVar;
this.clickDestinationUri = builder.clickDestinationUri;
this.clickDestinationBackupUri = builder.clickDestinationBackupUri;
this.clickTrackingUrls = builder.clickTrackingUrls;
this.jsTrackers = builder.jsTrackers;
this.clickTrackingRequests = builder.clickTrackingRequests;
this.impressionRequests = builder.impressionRequests;
Double d = builder.starRating;
this.starRating = (d == null || d.doubleValue() < 3.0d) ? null : d;
if (builder.privacyDestinationUri != null) {
this.privacyDestinationUri = builder.privacyDestinationUri;
} else if (!isDspAd() || getSdk().l0().c()) {
this.privacyDestinationUri = Uri.parse(DEFAULT_APPLOVIN_PRIVACY_URL);
}
this.viewableMRC50Callback = new c(builder.viewableMRC50Requests);
this.viewableMRC100Callback = new c(builder.viewableMRC100Requests);
if (aqVar != null && aqVar.hasVideoUrl()) {
this.viewableVideoMRC50Callback = new c(builder.viewableVideo50Requests);
}
this.tag = "AppLovinNativeAd:" + getAdIdNumber();
}
private List<s> getDirectClickTrackingPostbacks() {
List<s> a2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (List) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda3
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getDirectClickTrackingPostbacks$1;
lambda$getDirectClickTrackingPostbacks$1 = AppLovinNativeAdImpl.this.lambda$getDirectClickTrackingPostbacks$1((tl) obj);
return lambda$getDirectClickTrackingPostbacks$1;
}
});
}
synchronized (this.adObjectLock) {
a2 = yp.a(getJsonObjectFromAdObject("click_tracking_urls", new JSONObject()), getClCode(), getStringFromAdObject("click_tracking_url", null), this.sdk);
}
return a2;
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public Bundle getDirectDownloadParameters() {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (Bundle) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda4
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
Bundle lambda$getDirectDownloadParameters$4;
lambda$getDirectDownloadParameters$4 = AppLovinNativeAdImpl.lambda$getDirectDownloadParameters$4((tl) obj);
return lambda$getDirectDownloadParameters$4;
}
});
}
return JsonUtils.toBundle(getJsonObjectFromAdObject("ah_parameters", null));
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void registerViewsForInteraction(List<View> list, ViewGroup viewGroup) {
this.nativeAdView = viewGroup;
if (z3.e() && this.nativeAdView.isAttachedToWindow()) {
maybeHandleOnAttachedToWindow(this.nativeAdView);
} else if (!z3.e() && this.nativeAdView.getParent() != null) {
maybeHandleOnAttachedToWindow(this.nativeAdView);
} else {
this.nativeAdView.addOnAttachStateChangeListener(this.onAttachStateChangeHandler);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registered ad view for impressions: " + this.nativeAdView);
}
if (this.clickDestinationUri == null && this.clickDestinationBackupUri == null) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Skipping click registration - no click URLs provided");
return;
}
return;
}
for (View view : list) {
if (view.hasOnClickListeners()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().k(this.tag, "View has an onClickListener already - " + view);
}
}
if (!view.isClickable()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().k(this.tag, "View is not clickable - " + view);
}
}
if (!view.isEnabled()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().b(this.tag, "View is not enabled - " + view);
}
}
if (view instanceof Button) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registering click for button: " + view);
}
} else {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registering click for view: " + view);
}
}
if (((Boolean) this.sdk.a(sj.Y2)).booleanValue()) {
view.setOnTouchListener(new AppLovinTouchToClickListener(this.sdk, sj.G0, viewGroup.getContext(), this));
} else {
view.setOnClickListener(this);
}
this.registeredViews.add(view);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registered views: " + this.registeredViews);
}
}
private void handleNativeAdClick(Uri uri, @Nullable Uri uri2, Context context) {
if (this.clickTrackingRequests.size() > 0) {
Iterator<e> it = this.clickTrackingRequests.iterator();
while (it.hasNext()) {
this.sdk.Y().dispatchPostbackRequest(it.next(), null);
}
} else {
Iterator<String> it2 = this.clickTrackingUrls.iterator();
while (it2.hasNext()) {
this.sdk.Y().dispatchPostbackAsync(it2.next(), null);
}
}
gc.b(this.eventListener, this);
if (isDirectDownloadEnabled()) {
this.sdk.m().startDirectInstallOrDownloadProcess(this, null, new a(uri, uri2, context));
} else {
launchUri(uri, uri2, context);
}
}
@Override // com.applovin.impl.adview.AppLovinTouchToClickListener.OnClickListener
public void onClick(View view, MotionEvent motionEvent) {
Context context;
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Handle view clicked");
}
this.sdk.i().maybeSubmitPersistentPostbacks(getDirectClickTrackingPostbacks());
if (((Boolean) this.sdk.a(sj.F)).booleanValue()) {
context = zq.a(this.nativeAdView, this.sdk);
if (context == null) {
context = view.getContext();
}
} else {
context = view.getContext();
}
handleNativeAdClick(this.clickDestinationUri, this.clickDestinationBackupUri, motionEvent, context);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ List lambda$getDirectClickTrackingPostbacks$1(tl tlVar) {
return yp.a(tlVar.a("click_tracking_urls", new JSONObject()), getClCode(), tlVar.a("click_tracking_url", (String) null), this.sdk);
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ List lambda$getOpenMeasurementVerificationScriptResources$3(Function function, tl tlVar) {
return (List) function.apply(tlVar.a("omid_verification_script_resources", (JSONArray) null));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ Bundle lambda$getDirectDownloadParameters$4(tl tlVar) {
return JsonUtils.toBundle(tlVar.a("ah_parameters", (JSONObject) null));
}
public static class Builder {
private final JSONObject adObject;
private String advertiser;
private String body;
private String callToAction;
private Uri clickDestinationBackupUri;
private Uri clickDestinationUri;
private List<e> clickTrackingRequests;
private List<String> clickTrackingUrls;
private final JSONObject fullResponse;
private Uri iconUri;
private List<e> impressionRequests;
private List<String> jsTrackers;
private Uri mainImageUri;
private Uri privacyDestinationUri;
private Uri privacyIconUri;
private final j sdk;
private Double starRating;
private String title;
private aq vastAd;
private List<e> viewableMRC100Requests;
private List<e> viewableMRC50Requests;
private List<e> viewableVideo50Requests;
public Builder(JSONObject jSONObject, JSONObject jSONObject2, j jVar) {
this.adObject = jSONObject;
this.fullResponse = jSONObject2;
this.sdk = jVar;
}
public AppLovinNativeAdImpl build() {
return new AppLovinNativeAdImpl(this, null);
}
public Builder setAdvertiser(String str) {
this.advertiser = str;
return this;
}
public Builder setBody(String str) {
this.body = str;
return this;
}
public Builder setCallToAction(String str) {
this.callToAction = str;
return this;
}
public Builder setClickDestinationBackupUri(Uri uri) {
this.clickDestinationBackupUri = uri;
return this;
}
public Builder setClickDestinationUri(Uri uri) {
this.clickDestinationUri = uri;
return this;
}
public Builder setClickTrackingRequests(List<e> list) {
this.clickTrackingRequests = list;
return this;
}
public Builder setClickTrackingUrls(List<String> list) {
this.clickTrackingUrls = list;
return this;
}
public Builder setIconUri(Uri uri) {
this.iconUri = uri;
return this;
}
public Builder setImpressionRequests(List<e> list) {
this.impressionRequests = list;
return this;
}
public Builder setJsTrackers(List<String> list) {
this.jsTrackers = list;
return this;
}
public Builder setMainImageUri(Uri uri) {
this.mainImageUri = uri;
return this;
}
public Builder setPrivacyDestinationUri(Uri uri) {
this.privacyDestinationUri = uri;
return this;
}
public Builder setPrivacyIconUri(Uri uri) {
this.privacyIconUri = uri;
return this;
}
public Builder setStarRating(Double d) {
this.starRating = d;
return this;
}
public Builder setTitle(String str) {
this.title = str;
return this;
}
public Builder setVastAd(aq aqVar) {
this.vastAd = aqVar;
return this;
}
public Builder setViewableMRC100Requests(List<e> list) {
this.viewableMRC100Requests = list;
return this;
}
public Builder setViewableMRC50Requests(List<e> list) {
this.viewableMRC50Requests = list;
return this;
}
public Builder setViewableVideo50Requests(List<e> list) {
this.viewableVideo50Requests = list;
return this;
}
}
}

View File

@@ -0,0 +1,10 @@
package com.applovin.impl.sdk.nativeAd;
import com.applovin.impl.sdk.AppLovinError;
/* loaded from: classes2.dex */
public interface AppLovinNativeAdLoadListener {
void onNativeAdLoadFailed(AppLovinError appLovinError);
void onNativeAdLoaded(AppLovinNativeAd appLovinNativeAd);
}

View File

@@ -0,0 +1,73 @@
package com.applovin.impl.sdk.nativeAd;
import android.text.TextUtils;
import com.applovin.impl.e4;
import com.applovin.impl.gc;
import com.applovin.impl.nm;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.tm;
import com.applovin.impl.w;
import com.applovin.impl.yl;
import com.applovin.impl.ym;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class AppLovinNativeAdService {
private static final String TAG = "AppLovinNativeAdService";
private final n logger;
private final j sdk;
public AppLovinNativeAdService(j jVar) {
this.sdk = jVar;
this.logger = jVar.J();
}
public void loadNextAdForAdToken(String str, AppLovinNativeAdLoadListener appLovinNativeAdLoadListener) {
String trim = str != null ? str.trim() : null;
if (TextUtils.isEmpty(trim)) {
n.h(TAG, "Empty ad token");
gc.b(appLovinNativeAdLoadListener, new AppLovinError(-8, "Empty ad token"));
return;
}
w wVar = new w(trim, this.sdk);
if (wVar.c() == w.a.REGULAR) {
if (n.a()) {
this.logger.a(TAG, "Loading next ad for token: " + wVar);
}
this.sdk.j0().a((yl) new nm(wVar, appLovinNativeAdLoadListener, this.sdk), tm.b.CORE);
return;
}
if (wVar.c() != w.a.AD_RESPONSE_JSON) {
AppLovinError appLovinError = new AppLovinError(-8, "Invalid token type");
n.h(TAG, "Invalid token type");
gc.b(appLovinNativeAdLoadListener, appLovinError);
return;
}
JSONObject a = wVar.a();
if (a == null) {
String str2 = "Unable to retrieve ad response JSON from token: " + wVar.b();
AppLovinError appLovinError2 = new AppLovinError(-8, str2);
n.h(TAG, str2);
gc.b(appLovinNativeAdLoadListener, appLovinError2);
return;
}
e4.c(a, this.sdk);
e4.b(a, this.sdk);
e4.a(a, this.sdk);
if (JsonUtils.getJSONArray(a, com.mbridge.msdk.foundation.entity.b.JSON_KEY_ADS, new JSONArray()).length() > 0) {
if (n.a()) {
this.logger.a(TAG, "Rendering ad for token: " + wVar);
}
this.sdk.j0().a((yl) new ym(a, appLovinNativeAdLoadListener, this.sdk), tm.b.CORE);
return;
}
if (n.a()) {
this.logger.b(TAG, "No ad returned from the server for token: " + wVar);
}
gc.b(appLovinNativeAdLoadListener, AppLovinError.NO_FILL);
}
}

View File

@@ -0,0 +1,45 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.tp;
import com.applovin.sdk.R;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinOptionsView extends FrameLayout implements View.OnClickListener {
private final Uri privacyDestinationUri;
private final j sdk;
public AppLovinOptionsView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(context);
this.sdk = jVar;
this.privacyDestinationUri = appLovinNativeAdImpl.getPrivacyDestinationUri();
ImageView imageView = new ImageView(getContext());
imageView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
Uri privacyIconUri = appLovinNativeAdImpl.getPrivacyIconUri();
if (privacyIconUri != null) {
ImageViewUtils.setImageUri(imageView, privacyIconUri, jVar);
} else {
imageView.setImageResource(R.drawable.applovin_ic_privacy_icon_layered_list);
}
addView(imageView);
setOnClickListener(this);
}
public void destroy() {
setOnClickListener(null);
removeAllViews();
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
tp.a(this.privacyDestinationUri, j.l(), this.sdk);
}
}

View File

@@ -0,0 +1,137 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import android.view.View;
import com.applovin.impl.t3;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import java.util.ArrayList;
import java.util.List;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinStarRatingView extends View {
private static final int DEFAULT_PADDING_DP = 2;
private static final float DEFAULT_STROKE_WIDTH = 0.5f;
private static final int DEFAULT_TOTAL_NUMBER_OF_STARS = 5;
private static final float INTERNAL_ANGLE_OF_PENTAGON_RADIANS = 1.8849556f;
private static final float SUM_OF_CENTRAL_ANGLES_IN_CIRCLE_RADIANS = 6.2831855f;
private static final float TWELVE_OCLOCK_POSITION_RADIANS = 4.712389f;
private static final Paint emptyStarPaint = new Paint(1);
private static final Paint filledStarPaint = new Paint(1);
private final float interStarsSpacingDp;
private final float paddingDp;
private float sideLength;
private final Double starRating;
public AppLovinStarRatingView(Double d, Context context) {
super(context);
this.starRating = d;
this.paddingDp = AppLovinSdkUtils.dpToPx(context, 2);
this.interStarsSpacingDp = AppLovinSdkUtils.dpToPx(context, 2);
setupPaints();
}
private void drawEmptyStars(Canvas canvas, Path path) {
canvas.drawPath(path, emptyStarPaint);
}
private void drawFilledStars(Canvas canvas, Path path) {
if (this.starRating.doubleValue() == 0.0d) {
return;
}
float roundUpToNearestHalfInt = ((float) roundUpToNearestHalfInt(this.starRating.doubleValue())) / 5.0f;
float ceil = (float) (this.paddingDp + (Math.ceil(r0 - 1.0f) * this.interStarsSpacingDp));
canvas.clipPath(path);
canvas.drawRect(new RectF(0.0f, 0.0f, ceil + (roundUpToNearestHalfInt * 5.0f * this.sideLength), getHeight()), filledStarPaint);
}
private Path getCombinedPathForAllStarsWithSide(float f) {
PointF pointF = new PointF(0.0f, this.paddingDp);
float f2 = pointF.x + this.paddingDp;
Path path = new Path();
for (int i = 0; i < 5; i++) {
float f3 = pointF.y;
Path starPath = getStarPath(new RectF(f2, f3, f2 + f, f3 + f));
f2 += this.interStarsSpacingDp + f;
path.addPath(starPath);
}
return path;
}
private static float getDistanceBetweenPoints(PointF pointF, PointF pointF2) {
return (float) Math.sqrt(Math.pow(pointF.x - pointF2.x, 2.0d) + Math.pow(pointF.y - pointF2.y, 2.0d));
}
private static PointF getMidpointBetweenPoints(PointF pointF, PointF pointF2) {
return new PointF((float) (pointF.x + ((pointF2.x - pointF.x) * 0.5d)), (float) (pointF.y + ((pointF2.y - pointF.y) * 0.5d)));
}
private Path getStarPath(RectF rectF) {
PointF pointF = new PointF(rectF.centerX(), rectF.centerY());
List<PointF> starPointsOnACircle = getStarPointsOnACircle(pointF, (float) (rectF.width() * 0.5d), TWELVE_OCLOCK_POSITION_RADIANS);
PointF pointF2 = starPointsOnACircle.get(0);
List<PointF> starPointsOnACircle2 = getStarPointsOnACircle(pointF, getDistanceBetweenPoints(pointF, getMidpointBetweenPoints(pointF2, starPointsOnACircle.get(1))) - ((float) (getDistanceBetweenPoints(pointF2, r3) / Math.tan(0.9424778f))), 5.340708f);
Path path = new Path();
path.moveTo(pointF2.x, pointF2.y);
for (int i = 0; i < 5; i++) {
PointF pointF3 = starPointsOnACircle.get(i);
PointF pointF4 = starPointsOnACircle2.get(i);
path.lineTo(pointF3.x, pointF3.y);
path.lineTo(pointF4.x, pointF4.y);
}
path.close();
return path;
}
private List<PointF> getStarPointsOnACircle(PointF pointF, float f, float f2) {
float f3 = SUM_OF_CENTRAL_ANGLES_IN_CIRCLE_RADIANS / 5;
ArrayList arrayList = new ArrayList(5);
for (int i = 0; i < 5; i++) {
double d = f;
double d2 = f2;
arrayList.add(new PointF((float) (pointF.x + (Math.cos(d2) * d)), (float) (pointF.y + (d * Math.sin(d2)))));
f2 += f3;
}
return arrayList;
}
private double getTotalHorizontalSpacing() {
return (this.paddingDp * 2.0f) + (this.interStarsSpacingDp * 4.0f);
}
private double roundUpToNearestHalfInt(double d) {
return Math.ceil(d * 2.0d) / 2.0d;
}
private void setupPaints() {
Paint paint = emptyStarPaint;
paint.setColor(t3.a(R.color.applovin_sdk_starColor, getContext()));
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(DEFAULT_STROKE_WIDTH);
Paint paint2 = filledStarPaint;
paint2.setColor(t3.a(R.color.applovin_sdk_starColor, getContext()));
paint2.setStyle(Paint.Style.FILL);
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
if (this.starRating == null) {
return;
}
float min = (float) Math.min((getWidth() - getTotalHorizontalSpacing()) / 5.0d, getHeight() - (this.paddingDp * 2.0f));
this.sideLength = min;
if (min <= 0.0f) {
return;
}
Path combinedPathForAllStarsWithSide = getCombinedPathForAllStarsWithSide(min);
drawEmptyStars(canvas, combinedPathForAllStarsWithSide);
drawFilledStars(canvas, combinedPathForAllStarsWithSide);
}
}

View File

@@ -0,0 +1,710 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.exoplayer2.ui.d;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.be;
import com.applovin.impl.bi;
import com.applovin.impl.ck;
import com.applovin.impl.fq;
import com.applovin.impl.gq;
import com.applovin.impl.kq;
import com.applovin.impl.lq;
import com.applovin.impl.mq;
import com.applovin.impl.nh;
import com.applovin.impl.oq;
import com.applovin.impl.p;
import com.applovin.impl.qh;
import com.applovin.impl.r;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.td;
import com.applovin.impl.tp;
import com.applovin.impl.v4;
import com.applovin.impl.w5;
import com.applovin.impl.xp;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.impl.zq;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinVastMediaView extends AppLovinMediaView implements AppLovinCommunicatorSubscriber {
private static final String COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING = "PROGRESS_TRACKING";
private static final long FADE_ANIMATION_DURATION_MILLIS = 250;
private static final String TAG = "AppLovinVastMediaView";
private final AtomicBoolean automaticPauseHandled;
private final AtomicBoolean automaticResumeHandled;
private final Handler countdownHandler;
private final v4 countdownManager;
@Nullable
private ImageView industryIconImageView;
private final AtomicBoolean initialOnAttachedToWindowHandled;
private boolean isVideoMuted;
private boolean isVideoPausedByUser;
private final boolean isVideoStream;
private long lastVideoPositionFromPauseMillis;
private final p lifecycleCallbacksAdapter;
private final AtomicBoolean mediaErrorHandled;
private final ck mediaPlayer;
@Nullable
private ImageView muteButtonImageView;
@Nullable
private ImageView playPauseButtonImageView;
@Nullable
private FrameLayout replayIconContainer;
private int savedVideoPercentViewed;
private long startTimeMillis;
private final aq vastAd;
private long videoDurationMillis;
private final AtomicBoolean videoEndListenerNotified;
private final Set<kq> videoProgressTrackers;
private final com.applovin.exoplayer2.ui.e videoView;
private boolean videoWasCompleted;
@Nullable
private LinearLayout videoWidgetLinearLayout;
private Activity viewActivity;
public class a extends p {
public a() {
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
if (activity.equals(AppLovinVastMediaView.this.viewActivity)) {
AppLovinVastMediaView.this.maybeHandlePause();
}
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
if (!activity.equals(AppLovinVastMediaView.this.viewActivity) || AppLovinVastMediaView.this.isVideoPausedByUser) {
return;
}
AppLovinVastMediaView.this.maybeHandleResume();
}
}
public class b implements v4.b {
public b() {
}
@Override // com.applovin.impl.v4.b
public void a() {
long seconds = TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis - (AppLovinVastMediaView.this.mediaPlayer.getDuration() - AppLovinVastMediaView.this.mediaPlayer.getCurrentPosition()));
int videoPercentViewed = AppLovinVastMediaView.this.getVideoPercentViewed();
HashSet hashSet = new HashSet();
Iterator it = new HashSet(AppLovinVastMediaView.this.videoProgressTrackers).iterator();
while (it.hasNext()) {
kq kqVar = (kq) it.next();
if (kqVar.a(seconds, videoPercentViewed)) {
hashSet.add(kqVar);
AppLovinVastMediaView.this.videoProgressTrackers.remove(kqVar);
}
}
AppLovinVastMediaView.this.maybeFireTrackers(hashSet);
if (videoPercentViewed >= 25 && videoPercentViewed < 50) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().x();
return;
}
if (videoPercentViewed >= 50 && videoPercentViewed < 75) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().y();
} else if (videoPercentViewed >= 75) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().C();
}
}
@Override // com.applovin.impl.v4.b
public boolean b() {
return !AppLovinVastMediaView.this.videoWasCompleted;
}
}
public class c implements View.OnClickListener {
private c() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Uri b;
gq p1 = AppLovinVastMediaView.this.vastAd.p1();
if (p1 == null || (b = p1.b()) == null) {
return;
}
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Industry icon clicked, opening URL: " + b);
}
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.INDUSTRY_ICON_CLICK);
tp.a(b, view.getContext(), AppLovinVastMediaView.this.sdk);
}
public /* synthetic */ c(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
}
public class d implements AppLovinTouchToClickListener.OnClickListener {
private final AppLovinNativeAdImpl a;
public d(AppLovinNativeAdImpl appLovinNativeAdImpl) {
this.a = appLovinNativeAdImpl;
}
@Override // com.applovin.impl.adview.AppLovinTouchToClickListener.OnClickListener
public void onClick(View view, MotionEvent motionEvent) {
Uri k0;
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.VIDEO_CLICK);
AppLovinVastMediaView.this.vastAd.getAdEventTracker().v();
if (AppLovinVastMediaView.this.vastAd.H0() && (k0 = AppLovinVastMediaView.this.vastAd.k0()) != null) {
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Clicking through video");
}
AppLovinVastMediaView.this.sdk.i().maybeSubmitPersistentPostbacks(AppLovinVastMediaView.this.vastAd.a(motionEvent, false));
this.a.handleNativeAdClick(k0, null, motionEvent, (!((Boolean) AppLovinVastMediaView.this.sdk.a(sj.F)).booleanValue() || AppLovinVastMediaView.this.viewActivity == null) ? AppLovinVastMediaView.this.getContext() : AppLovinVastMediaView.this.viewActivity);
}
}
}
public class e implements qh.c, d.e {
private e() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c() {
AppLovinVastMediaView.this.mediaPlayer.a(0L);
}
@Override // com.applovin.impl.qh.c
public void b(int i) {
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Player state changed to state " + i + " and will play when ready: " + AppLovinVastMediaView.this.mediaPlayer.l());
}
if (i != 3) {
if (i == 4) {
n nVar2 = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Video completed");
}
AppLovinVastMediaView.this.videoWasCompleted = true;
AppLovinVastMediaView.this.finishVideo();
if (AppLovinVastMediaView.this.replayIconContainer != null) {
zq.a(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$e$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppLovinVastMediaView.e.this.c();
}
});
return;
} else {
AppLovinVastMediaView.this.showMediaImageView();
return;
}
}
return;
}
AppLovinVastMediaView.this.mediaPlayer.a(!AppLovinVastMediaView.this.isVideoMuted ? 1 : 0);
AppLovinVastMediaView appLovinVastMediaView = AppLovinVastMediaView.this;
appLovinVastMediaView.videoDurationMillis = appLovinVastMediaView.mediaPlayer.getDuration();
AppLovinVastMediaView.this.vastAd.getAdEventTracker().b(TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis), yp.e(AppLovinVastMediaView.this.sdk));
n nVar3 = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "MediaPlayer prepared: " + AppLovinVastMediaView.this.mediaPlayer);
}
AppLovinVastMediaView.this.countdownManager.b();
}
@Override // com.applovin.exoplayer2.ui.d.e
public void d(int i) {
if (i == 0) {
AppLovinVastMediaView.this.videoView.c();
}
}
public /* synthetic */ e(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
@Override // com.applovin.impl.qh.c
public void a(nh nhVar) {
AppLovinVastMediaView.this.handleMediaError("Video view error (" + yp.a(nhVar) + ")");
}
}
public class f implements View.OnClickListener {
private f() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a() {
AppLovinVastMediaView.this.videoWasCompleted = false;
AppLovinVastMediaView.this.automaticResumeHandled.set(false);
AppLovinVastMediaView.this.sdk.e().a(AppLovinVastMediaView.this.lifecycleCallbacksAdapter);
AppLovinVastMediaView.this.maybeHandleResume();
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (view == AppLovinVastMediaView.this.playPauseButtonImageView) {
if (AppLovinVastMediaView.this.mediaPlayer.isPlaying()) {
AppLovinVastMediaView.this.isVideoPausedByUser = true;
AppLovinVastMediaView.this.maybeHandlePause();
return;
} else {
AppLovinVastMediaView.this.isVideoPausedByUser = false;
AppLovinVastMediaView.this.maybeHandleResume();
return;
}
}
if (view != AppLovinVastMediaView.this.muteButtonImageView) {
if (view == AppLovinVastMediaView.this.replayIconContainer) {
zq.b(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$f$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppLovinVastMediaView.f.this.a();
}
});
}
} else {
boolean z = AppLovinVastMediaView.this.isVideoMuted;
boolean z2 = !z;
AppLovinVastMediaView.this.isVideoMuted = z2;
AppLovinVastMediaView.this.mediaPlayer.a(z ? 1.0f : 0.0f);
AppLovinVastMediaView.this.populateMuteImage(z2);
}
}
public /* synthetic */ f(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
}
public AppLovinVastMediaView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(appLovinNativeAdImpl, jVar, context);
int i;
Handler handler = new Handler(Looper.getMainLooper());
this.countdownHandler = handler;
this.countdownManager = new v4(handler, this.sdk);
this.videoEndListenerNotified = new AtomicBoolean();
this.mediaErrorHandled = new AtomicBoolean();
this.initialOnAttachedToWindowHandled = new AtomicBoolean();
this.automaticPauseHandled = new AtomicBoolean();
this.automaticResumeHandled = new AtomicBoolean();
this.isVideoMuted = true;
this.lastVideoPositionFromPauseMillis = -1L;
HashSet hashSet = new HashSet();
this.videoProgressTrackers = hashSet;
this.lifecycleCallbacksAdapter = new a();
aq vastAd = appLovinNativeAdImpl.getVastAd();
this.vastAd = vastAd;
boolean I0 = vastAd.I0();
this.isVideoStream = I0;
if (I0) {
AppLovinCommunicator.getInstance(context).subscribe(this, "video_caching_failed");
}
a aVar = null;
if (vastAd.v1()) {
this.industryIconImageView = gq.a(vastAd.p1().d(), context, jVar);
int dpToPx = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.a5)).intValue());
this.industryIconImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx, dpToPx, ((Integer) jVar.a(sj.c5)).intValue()));
this.industryIconImageView.setOnClickListener(new c(this, aVar));
addView(this.industryIconImageView);
}
if (((Boolean) jVar.a(sj.h5)).booleanValue()) {
LinearLayout linearLayout = new LinearLayout(context);
this.videoWidgetLinearLayout = linearLayout;
linearLayout.setOrientation(0);
this.videoWidgetLinearLayout.setBackgroundResource(R.drawable.applovin_rounded_black_background);
this.videoWidgetLinearLayout.setAlpha(((Float) jVar.a(sj.g5)).floatValue());
ImageView imageView = new ImageView(context);
this.playPauseButtonImageView = imageView;
imageView.setClickable(true);
f fVar = new f(this, aVar);
this.playPauseButtonImageView.setOnClickListener(fVar);
int dpToPx2 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.e5)).intValue());
this.playPauseButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2, dpToPx2));
populatePlayPauseImage(false);
this.videoWidgetLinearLayout.addView(this.playPauseButtonImageView);
this.muteButtonImageView = new ImageView(context);
if (populateMuteImage(this.isVideoMuted)) {
i = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.d5)).intValue());
this.muteButtonImageView.setClickable(true);
this.muteButtonImageView.setOnClickListener(fVar);
this.muteButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(i, i));
this.videoWidgetLinearLayout.addView(this.muteButtonImageView);
} else {
i = 0;
}
int dpToPx3 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.f5)).intValue());
this.videoWidgetLinearLayout.setPadding(dpToPx3, dpToPx3, dpToPx3, dpToPx3);
int i2 = dpToPx3 * 2;
this.videoWidgetLinearLayout.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2 + i + i2, Math.max(dpToPx2, i) + i2, 8388691));
addView(this.videoWidgetLinearLayout);
}
if (((Boolean) jVar.a(sj.i5)).booleanValue()) {
FrameLayout frameLayout = new FrameLayout(getContext());
this.replayIconContainer = frameLayout;
frameLayout.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.replayIconContainer.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
this.replayIconContainer.setVisibility(4);
this.replayIconContainer.setOnClickListener(new f(this, aVar));
ImageView imageView2 = new ImageView(getContext());
int dpToPx4 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.j5)).intValue());
imageView2.setLayoutParams(new FrameLayout.LayoutParams(dpToPx4, dpToPx4, 17));
imageView2.setImageResource(R.drawable.applovin_ic_replay_icon);
imageView2.setAdjustViewBounds(true);
imageView2.setMaxHeight(this.replayIconContainer.getHeight());
imageView2.setMaxWidth(this.replayIconContainer.getWidth());
this.replayIconContainer.addView(imageView2);
addView(this.replayIconContainer);
}
ck a2 = new ck.b(getContext()).a();
this.mediaPlayer = a2;
e eVar = new e(this, aVar);
a2.a((qh.c) eVar);
a2.a(0);
com.applovin.exoplayer2.ui.e eVar2 = new com.applovin.exoplayer2.ui.e(getContext());
this.videoView = eVar2;
eVar2.c();
eVar2.setControllerVisibilityListener(eVar);
eVar2.setPlayer(a2);
eVar2.setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.E0, getContext(), new d(appLovinNativeAdImpl)));
addView(eVar2);
bringChildToFront(this.industryIconImageView);
bringChildToFront(this.videoWidgetLinearLayout);
prepareMediaPlayer();
appLovinNativeAdImpl.setVideoView(eVar2);
hashSet.addAll(vastAd.a(aq.d.VIDEO, lq.a));
}
private void checkCachedAdResourcesImmediately(boolean z) {
if (yp.a(z, this.vastAd, this.sdk, getContext()).isEmpty()) {
return;
}
handleUnavailableCachedResources();
}
/* JADX INFO: Access modifiers changed from: private */
public void finishVideo() {
maybeFireTrackers(aq.d.VIDEO, "close");
maybeHandlePause();
this.sdk.e().b(this.lifecycleCallbacksAdapter);
if (this.videoWasCompleted) {
maybeFireRemainingCompletionTrackers();
this.vastAd.getAdEventTracker().w();
}
if (this.videoEndListenerNotified.compareAndSet(false, true)) {
this.sdk.i().trackVideoEnd(this.vastAd, TimeUnit.MILLISECONDS.toSeconds(SystemClock.elapsedRealtime() - this.startTimeMillis), getVideoPercentViewed(), this.isVideoStream);
}
}
/* JADX INFO: Access modifiers changed from: private */
public int getVideoPercentViewed() {
long currentPosition = this.mediaPlayer.getCurrentPosition();
if (this.videoWasCompleted) {
return 100;
}
return currentPosition > 0 ? (int) ((currentPosition / this.videoDurationMillis) * 100.0f) : this.savedVideoPercentViewed;
}
/* JADX INFO: Access modifiers changed from: private */
public void handleMediaError(String str) {
if (n.a()) {
this.logger.b(TAG, str);
}
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.l5))) {
maybeFireTrackers(aq.d.ERROR, fq.MEDIA_FILE_ERROR);
this.vastAd.getAdEventTracker().b(str);
} else if (n.a()) {
this.logger.a(TAG, "Not firing trackers for media error: " + str);
}
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.X2))) {
if (this.mediaErrorHandled.compareAndSet(false, true)) {
this.sdk.E().a("handleVastVideoError", str, this.vastAd);
finishVideo();
showMediaImageView();
return;
}
return;
}
if (n.a()) {
this.logger.a(TAG, "Ignoring media error: " + str);
}
}
private void handleUnavailableCachedResources() {
if (n.a()) {
this.logger.b(TAG, "Video failed due to unavailable resources");
}
finishVideo();
showMediaImageView();
}
private void maybeFireRemainingCompletionTrackers() {
if (getVideoPercentViewed() < this.vastAd.n0() || this.videoProgressTrackers.isEmpty()) {
return;
}
if (n.a()) {
this.logger.k(TAG, "Firing " + this.videoProgressTrackers.size() + " un-fired video progress trackers when video was completed.");
}
maybeFireTrackers(this.videoProgressTrackers);
}
private void maybeHandleOnAttachedToWindow() {
if (this.initialOnAttachedToWindowHandled.compareAndSet(false, true)) {
if (this.industryIconImageView != null && this.vastAd.v1()) {
maybeFireTrackers(aq.d.INDUSTRY_ICON_IMPRESSION);
this.industryIconImageView.setVisibility(0);
}
this.startTimeMillis = SystemClock.elapsedRealtime();
maybeFireTrackers(aq.d.IMPRESSION);
maybeFireTrackers(aq.d.VIDEO, "creativeView");
this.vastAd.getAdEventTracker().g();
this.vastAd.setHasShown(true);
this.sdk.i().trackImpression(this.vastAd);
this.viewActivity = r.a(zq.b(this));
this.sdk.e().a(this.lifecycleCallbacksAdapter);
this.mediaPlayer.a(true);
this.countdownManager.a(COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING, TimeUnit.SECONDS.toMillis(1L), new b());
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandlePause() {
if (this.automaticPauseHandled.compareAndSet(false, true)) {
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_PAUSE);
this.vastAd.getAdEventTracker().z();
pauseVideo();
populatePlayPauseImage(true);
this.automaticResumeHandled.set(false);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandleResume() {
if (this.automaticResumeHandled.compareAndSet(false, true)) {
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_RESUME);
this.vastAd.getAdEventTracker().A();
if (this.lastVideoPositionFromPauseMillis >= 0) {
if (n.a()) {
this.logger.a(TAG, "Resuming video at position " + this.lastVideoPositionFromPauseMillis);
}
this.mediaPlayer.a(true);
this.countdownManager.b();
this.lastVideoPositionFromPauseMillis = -1L;
} else if (n.a()) {
this.logger.a(TAG, "Invalid last video position, isVideoPlaying=" + this.mediaPlayer.isPlaying());
}
populatePlayPauseImage(false);
this.automaticPauseHandled.set(false);
}
}
private void pauseVideo() {
if (n.a()) {
this.logger.a(TAG, "Pausing video");
}
this.savedVideoPercentViewed = getVideoPercentViewed();
this.lastVideoPositionFromPauseMillis = this.mediaPlayer.getCurrentPosition();
this.mediaPlayer.a(false);
this.countdownManager.c();
if (n.a()) {
this.logger.a(TAG, "Paused video at position " + this.lastVideoPositionFromPauseMillis + " ms");
}
}
private void prepareMediaPlayer() {
checkCachedAdResourcesImmediately(!this.isVideoStream);
bi a2 = new bi.b(new w5(getContext(), xp.a(getContext(), "com.applovin.sdk"))).a(td.a(this.vastAd.t0()));
this.mediaPlayer.a(!this.isVideoMuted ? 1 : 0);
this.mediaPlayer.a((be) a2);
this.mediaPlayer.b();
this.mediaPlayer.a(false);
}
/* JADX INFO: Access modifiers changed from: private */
public void showMediaImageView() {
if (this.imageView.getDrawable() == null) {
return;
}
this.imageView.setVisibility(0);
this.videoView.setVisibility(8);
LinearLayout linearLayout = this.videoWidgetLinearLayout;
if (linearLayout != null) {
linearLayout.setVisibility(8);
}
ImageView imageView = this.industryIconImageView;
if (imageView != null) {
imageView.setVisibility(8);
}
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinMediaView
public void destroy() {
finishVideo();
ImageView imageView = this.industryIconImageView;
if (imageView != null) {
imageView.setOnClickListener(null);
}
ImageView imageView2 = this.playPauseButtonImageView;
if (imageView2 != null) {
imageView2.setOnClickListener(null);
}
ImageView imageView3 = this.muteButtonImageView;
if (imageView3 != null) {
imageView3.setOnClickListener(null);
}
FrameLayout frameLayout = this.replayIconContainer;
if (frameLayout != null) {
frameLayout.setOnClickListener(null);
}
this.videoView.setOnTouchListener(null);
this.viewActivity = null;
this.mediaPlayer.V();
this.vastAd.getAdEventTracker().f();
this.countdownManager.a();
this.countdownHandler.removeCallbacksAndMessages(null);
if (this.isVideoStream) {
AppLovinCommunicator.getInstance(getContext()).unsubscribe(this, "video_caching_failed");
}
super.destroy();
}
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
public String getCommunicatorId() {
return TAG;
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
maybeHandleOnAttachedToWindow();
if (this.isVideoPausedByUser) {
return;
}
maybeHandleResume();
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
maybeHandlePause();
super.onDetachedFromWindow();
}
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
if (messageData.getLong("ad_id") == this.vastAd.getAdIdNumber() && this.isVideoStream) {
int i = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string == null && i >= 200 && i < 300) || this.videoWasCompleted || this.mediaPlayer.isPlaying()) {
return;
}
handleMediaError("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean populateMuteImage(boolean z) {
if (this.muteButtonImageView == null) {
return false;
}
if (z3.f()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) getContext().getDrawable(z ? R.drawable.applovin_ic_unmute_to_mute : R.drawable.applovin_ic_mute_to_unmute);
if (animatedVectorDrawable != null) {
this.muteButtonImageView.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return true;
}
}
Uri L = z ? this.vastAd.L() : this.vastAd.f0();
if (L == null) {
return false;
}
ImageViewUtils.setImageUri(this.muteButtonImageView, L, this.sdk);
return true;
}
private void populatePlayPauseImage(boolean z) {
ImageView imageView = this.playPauseButtonImageView;
if (imageView == null) {
return;
}
imageView.setImageResource(z ? R.drawable.applovin_ic_play_icon : R.drawable.applovin_ic_pause_icon);
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeFireTrackers(aq.d dVar) {
maybeFireTrackers(dVar, fq.UNSPECIFIED);
}
private void maybeFireTrackers(aq.d dVar, fq fqVar) {
maybeFireTrackers(dVar, "", fqVar);
}
private void maybeFireTrackers(aq.d dVar, String str) {
maybeFireTrackers(dVar, str, fq.UNSPECIFIED);
}
private void maybeFireTrackers(aq.d dVar, String str, fq fqVar) {
maybeFireTrackers((Set<kq>) this.vastAd.a(dVar, str), fqVar);
}
private void maybeFireTrackers(Set<kq> set, fq fqVar) {
if (set == null || set.isEmpty()) {
return;
}
long seconds = TimeUnit.MILLISECONDS.toSeconds(this.mediaPlayer.getCurrentPosition());
oq u1 = this.vastAd.u1();
Uri c2 = u1 != null ? u1.c() : null;
if (n.a()) {
this.logger.a(TAG, "Firing " + set.size() + " tracker(s): " + set);
}
mq.a(set, seconds, c2, fqVar, this.sdk);
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeFireTrackers(Set<kq> set) {
maybeFireTrackers(set, fq.UNSPECIFIED);
}
}

View File

@@ -0,0 +1,77 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.u2;
import com.applovin.impl.yl;
import java.io.File;
import java.util.Collections;
/* loaded from: classes2.dex */
public class a extends yl {
private final u2 h;
private final AppLovinNativeAdImpl i;
private final InterfaceC0039a j;
/* renamed from: com.applovin.impl.sdk.nativeAd.a$a, reason: collision with other inner class name */
public interface InterfaceC0039a {
void a(AppLovinNativeAdImpl appLovinNativeAdImpl);
}
public a(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, InterfaceC0039a interfaceC0039a) {
super("TaskCacheNativeAd", jVar);
this.h = new u2();
this.i = appLovinNativeAdImpl;
this.j = interfaceC0039a;
}
private Uri a(Uri uri) {
if (uri == null) {
return null;
}
if (n.a()) {
this.c.a(this.b, "Attempting to cache resource: " + uri);
}
String a = this.a.B().a(a(), uri.toString(), this.i.getCachePrefix(), Collections.emptyList(), false, false, this.h, 1);
if (StringUtils.isValidString(a)) {
File a2 = this.a.B().a(a, a());
if (a2 != null) {
Uri fromFile = Uri.fromFile(a2);
if (fromFile != null) {
return fromFile;
}
if (n.a()) {
this.c.b(this.b, "Unable to extract Uri from image file");
}
} else if (n.a()) {
this.c.b(this.b, "Unable to retrieve File from cached image filename = " + a);
}
}
return null;
}
@Override // java.lang.Runnable
public void run() {
if (n.a()) {
this.c.a(this.b, "Begin caching ad #" + this.i.getAdIdNumber() + "...");
}
Uri a = a(this.i.getIconUri());
if (a != null) {
this.i.setIconUri(a);
}
Uri a2 = a(this.i.getMainImageUri());
if (a2 != null) {
this.i.setMainImageUri(a2);
}
Uri a3 = a(this.i.getPrivacyIconUri());
if (a3 != null) {
this.i.setPrivacyIconUri(a3);
}
if (n.a()) {
this.c.a(this.b, "Finished caching ad #" + this.i.getAdIdNumber());
}
this.j.a(this.i);
}
}

View File

@@ -0,0 +1,432 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.URLUtil;
import androidx.core.app.NotificationCompat;
import com.applovin.impl.aq;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl;
import com.applovin.impl.sdk.nativeAd.a;
import com.applovin.impl.sdk.network.e;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.zm;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdLoadListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class b extends yl implements a.InterfaceC0039a, AppLovinAdLoadListener {
private final List A;
private final List B;
private final List C;
private final JSONObject h;
private final JSONObject i;
private final AppLovinNativeAdLoadListener j;
private String k;
private String l;
private String m;
private Double n;
private String o;
private Uri p;
private Uri q;
private aq r;
private Uri s;
private Uri t;
private Uri u;
private Uri v;
private final List w;
private final List x;
private final List y;
private final List z;
public b(JSONObject jSONObject, JSONObject jSONObject2, AppLovinNativeAdLoadListener appLovinNativeAdLoadListener, j jVar) {
super("TaskRenderNativeAd", jVar);
this.k = "";
this.l = "";
this.m = "";
this.n = null;
this.o = "";
this.p = null;
this.q = null;
this.s = null;
this.t = null;
this.u = null;
this.v = null;
this.w = new ArrayList();
this.x = new ArrayList();
this.y = new ArrayList();
this.z = new ArrayList();
this.A = new ArrayList();
this.B = new ArrayList();
this.C = new ArrayList();
this.h = jSONObject;
this.i = jSONObject2;
this.j = appLovinNativeAdLoadListener;
}
private void a(JSONObject jSONObject) {
if (jSONObject == null) {
return;
}
String string = JsonUtils.getString(jSONObject, "url", null);
if (StringUtils.isValidString(string)) {
this.u = Uri.parse(string);
if (n.a()) {
this.c.a(this.b, "Processed click destination URL: " + this.u);
}
}
String string2 = JsonUtils.getString(jSONObject, "fallback", null);
if (StringUtils.isValidString(string2)) {
this.v = Uri.parse(string2);
if (n.a()) {
this.c.a(this.b, "Processed click destination backup URL: " + this.v);
}
}
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "clicktrackers", null);
if (jSONArray != null) {
if (!JsonUtils.getBoolean(this.h, "use_requests_for_native_ad_click_postbacks", (Boolean) this.a.a(sj.h3)).booleanValue()) {
try {
this.w.addAll(JsonUtils.toList(jSONArray));
if (n.a()) {
this.c.a(this.b, "Processed click tracking URLs: " + this.w);
return;
}
return;
} catch (Throwable th) {
if (n.a()) {
this.c.a(this.b, "Failed to render click tracking URLs", th);
return;
}
return;
}
}
for (int i = 0; i < jSONArray.length(); i++) {
Object objectAtIndex = JsonUtils.getObjectAtIndex(jSONArray, i, null);
if (objectAtIndex instanceof String) {
String str = (String) objectAtIndex;
if (!TextUtils.isEmpty(str)) {
this.y.add(new e.a(this.a).b(str).b(false).a(false).h(f()).a());
}
}
}
if (n.a()) {
this.c.a(this.b, "Processed click tracking requests: " + this.y);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(AppLovinNativeAdImpl appLovinNativeAdImpl) {
if (n.a()) {
this.c.a(this.b, "Preparing native ad view components...");
}
try {
appLovinNativeAdImpl.setUpNativeAdViewComponents();
if (n.a()) {
this.c.a(this.b, "Successfully prepared native ad view components");
}
appLovinNativeAdImpl.getAdEventTracker().h();
this.j.onNativeAdLoaded(appLovinNativeAdImpl);
} catch (Throwable th) {
if (n.a()) {
this.c.a(this.b, "Failed to prepare native ad view components", th);
}
b(th.getMessage());
this.a.E().a(this.b, "prepareNativeComponents", th);
}
}
private void c(final AppLovinNativeAdImpl appLovinNativeAdImpl) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.b$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
b.this.b(appLovinNativeAdImpl);
}
});
}
private void e() {
AppLovinNativeAdImpl build = new AppLovinNativeAdImpl.Builder(JsonUtils.shallowCopy(this.h), JsonUtils.shallowCopy(this.i), this.a).setTitle(this.k).setAdvertiser(this.l).setBody(this.m).setCallToAction(this.o).setStarRating(this.n).setIconUri(this.p).setMainImageUri(this.q).setPrivacyIconUri(this.s).setVastAd(this.r).setPrivacyDestinationUri(this.t).setClickDestinationUri(this.u).setClickDestinationBackupUri(this.v).setClickTrackingUrls(this.w).setJsTrackers(this.x).setClickTrackingRequests(this.y).setImpressionRequests(this.z).setViewableMRC50Requests(this.A).setViewableMRC100Requests(this.B).setViewableVideo50Requests(this.C).build();
build.getAdEventTracker().e();
if (n.a()) {
this.c.a(this.b, "Starting cache task for type: " + build.getType() + "...");
}
this.a.j0().a((yl) new a(build, this.a, this), tm.b.CORE);
}
private boolean f() {
return JsonUtils.getBoolean(this.h, "fire_native_ad_postbacks_from_webview", (Boolean) this.a.a(sj.g3)).booleanValue();
}
@Override // com.applovin.sdk.AppLovinAdLoadListener
public void adReceived(AppLovinAd appLovinAd) {
if (n.a()) {
this.c.a(this.b, "VAST ad rendered successfully");
}
this.r = (aq) appLovinAd;
e();
}
@Override // com.applovin.sdk.AppLovinAdLoadListener
public void failedToReceiveAd(int i) {
if (n.a()) {
this.c.b(this.b, "VAST ad failed to render");
}
e();
}
/* JADX WARN: Type inference failed for: r3v0 */
/* JADX WARN: Type inference failed for: r3v12, types: [java.lang.String, org.json.JSONObject] */
/* JADX WARN: Type inference failed for: r3v19 */
/* JADX WARN: Type inference failed for: r3v5, types: [java.lang.String, org.json.JSONObject] */
/* JADX WARN: Type inference failed for: r3v64 */
/* JADX WARN: Type inference failed for: r3v9 */
@Override // java.lang.Runnable
public void run() {
?? r3 = 0;
String string = JsonUtils.getString(this.h, "privacy_icon_url", null);
if (URLUtil.isValidUrl(string)) {
this.s = Uri.parse(string);
}
String string2 = JsonUtils.getString(this.h, CampaignEx.JSON_KEY_PRIVACY_URL, null);
if (URLUtil.isValidUrl(string2)) {
this.t = Uri.parse(string2);
}
JSONObject jSONObject = JsonUtils.getJSONObject(this.h, "ortb_response", (JSONObject) null);
if (jSONObject == null || jSONObject.length() == 0) {
if (n.a()) {
this.c.b(this.b, "No oRtb response provided: " + this.h);
}
b("No oRtb response provided");
return;
}
String string3 = JsonUtils.getString(jSONObject, "version", null);
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "value", (JSONObject) null);
if (n.a()) {
this.c.a(this.b, "Rendering native ad for oRTB version: " + string3);
}
JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "native", jSONObject2);
a(JsonUtils.getJSONObject(jSONObject3, "link", (JSONObject) null));
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject3, "assets", null);
if (jSONArray == null || jSONArray.length() == 0) {
if (n.a()) {
this.c.b(this.b, "Unable to retrieve assets - failing ad load: " + this.h);
}
b("Unable to retrieve assets");
return;
}
String str = "";
int i = 0;
while (i < jSONArray.length()) {
JSONObject jSONObject4 = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) r3);
if (jSONObject4.has("title")) {
this.k = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "title", (JSONObject) r3), "text", r3);
if (n.a()) {
this.c.a(this.b, "Processed title: " + this.k);
}
} else if (jSONObject4.has("link")) {
a(JsonUtils.getJSONObject(jSONObject4, "link", (JSONObject) r3));
} else if (jSONObject4.has("img")) {
int i2 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject5 = JsonUtils.getJSONObject(jSONObject4, "img", (JSONObject) r3);
int i3 = JsonUtils.getInt(jSONObject5, "type", -1);
String string4 = JsonUtils.getString(jSONObject5, "url", r3);
if (i3 == 1 || 3 == i2) {
this.p = Uri.parse(string4);
if (n.a()) {
this.c.a(this.b, "Processed icon URL: " + this.p);
}
} else if (i3 == 3 || 2 == i2) {
this.q = Uri.parse(string4);
if (n.a()) {
this.c.a(this.b, "Processed main image URL: " + this.q);
}
} else {
if (n.a()) {
this.c.k(this.b, "Unrecognized image: " + jSONObject4);
}
int i4 = JsonUtils.getInt(jSONObject5, "w", -1);
int i5 = JsonUtils.getInt(jSONObject5, "h", -1);
if (i4 <= 0 || i5 <= 0) {
if (n.a()) {
this.c.k(this.b, "Skipping...");
}
} else if (i4 / i5 > 1.0d) {
if (n.a()) {
this.c.a(this.b, "Inferring main image from " + i4 + "x" + i5 + "...");
}
this.q = Uri.parse(string4);
} else {
if (n.a()) {
this.c.a(this.b, "Inferring icon image from " + i4 + "x" + i5 + "...");
}
this.p = Uri.parse(string4);
}
}
} else if (jSONObject4.has("video")) {
String string5 = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "video", (JSONObject) null), "vasttag", null);
if (StringUtils.isValidString(string5)) {
if (n.a()) {
this.c.a(this.b, "Processed VAST video");
}
} else if (n.a()) {
this.c.k(this.b, "Ignoring invalid \"vasttag\" for video: " + jSONObject4);
}
str = string5;
} else if (jSONObject4.has("data")) {
int i6 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject6 = JsonUtils.getJSONObject(jSONObject4, "data", (JSONObject) null);
int i7 = JsonUtils.getInt(jSONObject6, "type", -1);
String string6 = JsonUtils.getString(jSONObject6, "value", null);
if (i7 == 1 || i6 == 8) {
this.l = string6;
if (n.a()) {
this.c.a(this.b, "Processed advertiser: " + this.l);
}
} else if (i7 == 2 || i6 == 4) {
this.m = string6;
if (n.a()) {
this.c.a(this.b, "Processed body: " + this.m);
}
} else if (i7 == 12 || i6 == 5) {
this.o = string6;
if (n.a()) {
this.c.a(this.b, "Processed cta: " + this.o);
}
} else if (i7 == 3 || i6 == 6) {
double a = yp.a(string6, -1.0d);
if (a != -1.0d) {
this.n = Double.valueOf(a);
if (n.a()) {
this.c.a(this.b, "Processed star rating: " + this.n);
}
} else if (n.a()) {
this.c.a(this.b, "Received invalid star rating: " + string6);
}
} else if (n.a()) {
this.c.k(this.b, "Skipping unsupported data: " + jSONObject4);
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported asset object: " + jSONObject4);
}
i++;
r3 = 0;
}
String string7 = JsonUtils.getString(jSONObject3, "jstracker", null);
if (StringUtils.isValidString(string7)) {
this.x.add(string7);
if (n.a()) {
this.c.a(this.b, "Processed jstracker: " + string7);
}
}
Object obj = null;
JSONArray jSONArray2 = JsonUtils.getJSONArray(jSONObject3, "imptrackers", null);
if (jSONArray2 != null) {
int i8 = 0;
while (i8 < jSONArray2.length()) {
Object objectAtIndex = JsonUtils.getObjectAtIndex(jSONArray2, i8, obj);
if (objectAtIndex instanceof String) {
String str2 = (String) objectAtIndex;
if (!TextUtils.isEmpty(str2)) {
this.z.add(new e.a(this.a).b(str2).b(false).a(false).h(f()).a());
if (n.a()) {
this.c.a(this.b, "Processed imptracker URL: " + str2);
}
}
}
i8++;
obj = null;
}
}
?? r32 = 0;
JSONArray jSONArray3 = JsonUtils.getJSONArray(jSONObject3, "eventtrackers", null);
if (jSONArray3 != null) {
int i9 = 0;
while (i9 < jSONArray3.length()) {
JSONObject jSONObject7 = JsonUtils.getJSONObject(jSONArray3, i9, (JSONObject) r32);
int i10 = JsonUtils.getInt(jSONObject7, NotificationCompat.CATEGORY_EVENT, -1);
int i11 = JsonUtils.getInt(jSONObject7, "method", -1);
String string8 = JsonUtils.getString(jSONObject7, "url", r32);
if (!TextUtils.isEmpty(string8)) {
if (i11 == 1 || i11 == 2) {
if (i11 == 2 && string8.startsWith("<script")) {
this.x.add(string8);
} else {
e a2 = new e.a(this.a).b(string8).b(false).a(false).h(f() || i11 == 2).a();
if (i10 == 1) {
this.z.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed impression URL: " + string8);
}
} else if (i10 == 2) {
this.A.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable MRC50 URL: " + string8);
}
} else if (i10 == 3) {
this.B.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable MRC100 URL: " + string8);
}
} else {
if (i10 == 4) {
this.C.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable video 50 URL: " + string8);
}
} else if (i10 == 555) {
if (n.a()) {
this.c.a(this.b, "Ignoring processing of OMID URL: " + string8);
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported event tracker: " + jSONObject7);
}
i9++;
r32 = 0;
}
i9++;
r32 = 0;
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported method for event tracker: " + jSONObject7);
}
}
i9++;
r32 = 0;
}
}
if (!StringUtils.isValidString(str)) {
e();
return;
}
if (n.a()) {
this.c.a(this.b, "Processing VAST video...");
}
this.a.j0().a(zm.a(str, JsonUtils.shallowCopy(this.h), JsonUtils.shallowCopy(this.i), this, this.a));
}
private void b(String str) {
this.j.onNativeAdLoadFailed(new AppLovinError(-6, str));
}
@Override // com.applovin.impl.sdk.nativeAd.a.InterfaceC0039a
public void a(AppLovinNativeAdImpl appLovinNativeAdImpl) {
if (n.a()) {
this.c.a(this.b, "Successfully cached and loaded ad");
}
c(appLovinNativeAdImpl);
}
}