Files
rr3-apk/decompiled-community/sources/com/vungle/ads/BannerView.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

295 lines
14 KiB
Java

package com.vungle.ads;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RelativeLayout;
import com.vungle.ads.ServiceLocator;
import com.vungle.ads.internal.ConfigManager;
import com.vungle.ads.internal.ImpressionTracker;
import com.vungle.ads.internal.executor.Executors;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.BidPayload;
import com.vungle.ads.internal.model.Placement;
import com.vungle.ads.internal.omsdk.OMTracker;
import com.vungle.ads.internal.platform.Platform;
import com.vungle.ads.internal.presenter.AdEventListener;
import com.vungle.ads.internal.presenter.AdPlayCallback;
import com.vungle.ads.internal.presenter.MRAIDPresenter;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.ui.VungleWebClient;
import com.vungle.ads.internal.ui.WatermarkView;
import com.vungle.ads.internal.ui.view.MRAIDAdWidget;
import com.vungle.ads.internal.util.Logger;
import com.vungle.ads.internal.util.ViewUtility;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class BannerView extends RelativeLayout {
public static final Companion Companion = new Companion(null);
private static final String TAG = "BannerView";
private MRAIDAdWidget adWidget;
private final AdPayload advertisement;
private int calculatedPixelHeight;
private int calculatedPixelWidth;
private final AtomicBoolean destroyed;
private WatermarkView imageView;
private final Lazy impressionTracker$delegate;
private boolean isOnImpressionCalled;
private final Placement placement;
private MRAIDPresenter presenter;
private final AtomicBoolean presenterStarted;
public final AdPayload getAdvertisement() {
return this.advertisement;
}
public final Placement getPlacement() {
return this.placement;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public BannerView(final Context context, final Placement placement, AdPayload advertisement, VungleAdSize adSize, AdConfig adConfig, final AdPlayCallback adPlayCallback, BidPayload bidPayload) throws InstantiationException {
super(context);
Lazy lazy;
Lazy lazy2;
Lazy lazy3;
Lazy lazy4;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(placement, "placement");
Intrinsics.checkNotNullParameter(advertisement, "advertisement");
Intrinsics.checkNotNullParameter(adSize, "adSize");
Intrinsics.checkNotNullParameter(adConfig, "adConfig");
Intrinsics.checkNotNullParameter(adPlayCallback, "adPlayCallback");
this.placement = placement;
this.advertisement = advertisement;
boolean z = false;
this.destroyed = new AtomicBoolean(false);
this.presenterStarted = new AtomicBoolean(false);
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.BannerView$impressionTracker$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final ImpressionTracker invoke() {
return new ImpressionTracker(context);
}
});
this.impressionTracker$delegate = lazy;
ViewUtility viewUtility = ViewUtility.INSTANCE;
this.calculatedPixelHeight = viewUtility.dpToPixels(context, adSize.getHeight());
this.calculatedPixelWidth = viewUtility.dpToPixels(context, adSize.getWidth());
AdEventListener adEventListener = new AdEventListener(adPlayCallback, placement) { // from class: com.vungle.ads.BannerView$adEventListener$1
};
try {
MRAIDAdWidget mRAIDAdWidget = new MRAIDAdWidget(context);
this.adWidget = mRAIDAdWidget;
mRAIDAdWidget.setCloseDelegate(new MRAIDAdWidget.CloseDelegate() { // from class: com.vungle.ads.BannerView.2
@Override // com.vungle.ads.internal.ui.view.MRAIDAdWidget.CloseDelegate
public void close() {
BannerView.this.finishAdInternal(false);
}
});
ServiceLocator.Companion companion = ServiceLocator.Companion;
LazyThreadSafetyMode lazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED;
lazy2 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.BannerView$special$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.executor.Executors, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final Executors invoke() {
return ServiceLocator.Companion.getInstance(context).getService(Executors.class);
}
});
lazy3 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.BannerView$special$$inlined$inject$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.omsdk.OMTracker$Factory, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final OMTracker.Factory invoke() {
return ServiceLocator.Companion.getInstance(context).getService(OMTracker.Factory.class);
}
});
OMTracker.Factory m3797_init_$lambda4 = m3797_init_$lambda4(lazy3);
if (ConfigManager.INSTANCE.omEnabled() && advertisement.omEnabled()) {
z = true;
}
OMTracker make = m3797_init_$lambda4.make(z);
lazy4 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.BannerView$special$$inlined$inject$3
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.platform.Platform, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final Platform invoke() {
return ServiceLocator.Companion.getInstance(context).getService(Platform.class);
}
});
VungleWebClient vungleWebClient = new VungleWebClient(advertisement, placement, m3796_init_$lambda3(lazy2).getOffloadExecutor(), null, m3798_init_$lambda5(lazy4), 8, null);
vungleWebClient.setWebViewObserver(make);
MRAIDPresenter mRAIDPresenter = new MRAIDPresenter(mRAIDAdWidget, advertisement, placement, vungleWebClient, m3796_init_$lambda3(lazy2).getJobExecutor(), make, bidPayload, m3798_init_$lambda5(lazy4));
mRAIDPresenter.setEventListener(adEventListener);
this.presenter = mRAIDPresenter;
String watermark$vungle_ads_release = adConfig.getWatermark$vungle_ads_release();
if (watermark$vungle_ads_release != null) {
this.imageView = new WatermarkView(context, watermark$vungle_ads_release);
}
} catch (InstantiationException e) {
AdCantPlayWithoutWebView adCantPlayWithoutWebView = new AdCantPlayWithoutWebView();
adCantPlayWithoutWebView.setPlacementId$vungle_ads_release(this.placement.getReferenceId());
adCantPlayWithoutWebView.setEventId$vungle_ads_release(this.advertisement.eventId());
adCantPlayWithoutWebView.setCreativeId$vungle_ads_release(this.advertisement.getCreativeId());
adEventListener.onError(adCantPlayWithoutWebView.logError$vungle_ads_release(), this.placement.getReferenceId());
throw e;
}
}
private final ImpressionTracker getImpressionTracker() {
return (ImpressionTracker) this.impressionTracker$delegate.getValue();
}
@Override // android.view.View
public void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
setAdVisibility(i == 0);
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
Logger.Companion.d(TAG, "onAttachedToWindow()");
if (!this.presenterStarted.getAndSet(true)) {
MRAIDPresenter mRAIDPresenter = this.presenter;
if (mRAIDPresenter != null) {
mRAIDPresenter.prepare();
}
getImpressionTracker().addView(this, new ImpressionTracker.ImpressionListener() { // from class: com.vungle.ads.BannerView$$ExternalSyntheticLambda0
@Override // com.vungle.ads.internal.ImpressionTracker.ImpressionListener
public final void onImpression(View view) {
BannerView.m3799onAttachedToWindow$lambda0(BannerView.this, view);
}
});
}
renderAd();
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onAttachedToWindow$lambda-0, reason: not valid java name */
public static final void m3799onAttachedToWindow$lambda0(BannerView this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Logger.Companion.d(TAG, "ImpressionTracker checked the banner view become visible.");
this$0.isOnImpressionCalled = true;
this$0.checkHardwareAcceleration();
MRAIDPresenter mRAIDPresenter = this$0.presenter;
if (mRAIDPresenter != null) {
mRAIDPresenter.start();
}
}
private final void setAdVisibility(boolean z) {
MRAIDPresenter mRAIDPresenter;
if (!this.isOnImpressionCalled || this.destroyed.get() || (mRAIDPresenter = this.presenter) == null) {
return;
}
mRAIDPresenter.setAdVisibility(z);
}
private final void checkHardwareAcceleration() {
Logger.Companion.w(TAG, "hardwareAccelerated = " + isHardwareAccelerated());
if (isHardwareAccelerated()) {
return;
}
AnalyticsClient.INSTANCE.logMetric$vungle_ads_release(Sdk.SDKMetric.SDKMetricType.HARDWARE_ACCELERATE_DISABLED, (r15 & 2) != 0 ? 0L : 0L, (r15 & 4) != 0 ? null : this.placement.getReferenceId(), (r15 & 8) != 0 ? null : this.advertisement.getCreativeId(), (r15 & 16) != 0 ? null : this.advertisement.eventId(), (r15 & 32) == 0 ? null : null);
}
public final void finishAdInternal(boolean z) {
if (this.destroyed.get()) {
return;
}
this.destroyed.set(true);
int i = (z ? 4 : 0) | 2;
MRAIDPresenter mRAIDPresenter = this.presenter;
if (mRAIDPresenter != null) {
mRAIDPresenter.stop();
}
MRAIDPresenter mRAIDPresenter2 = this.presenter;
if (mRAIDPresenter2 != null) {
mRAIDPresenter2.detach(i);
}
getImpressionTracker().destroy();
try {
ViewParent parent = getParent();
if (parent != null && (parent instanceof ViewGroup)) {
((ViewGroup) parent).removeView(this);
}
removeAllViews();
} catch (Exception e) {
Logger.Companion.d(TAG, "Removing webView error: " + e);
}
}
private final void renderAd() {
MRAIDAdWidget mRAIDAdWidget = this.adWidget;
if (mRAIDAdWidget != null) {
if (!Intrinsics.areEqual(mRAIDAdWidget != null ? mRAIDAdWidget.getParent() : null, this)) {
addView(this.adWidget, this.calculatedPixelWidth, this.calculatedPixelHeight);
WatermarkView watermarkView = this.imageView;
if (watermarkView != null) {
addView(watermarkView, this.calculatedPixelWidth, this.calculatedPixelHeight);
WatermarkView watermarkView2 = this.imageView;
if (watermarkView2 != null) {
watermarkView2.bringToFront();
}
}
}
}
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams != null) {
layoutParams.height = this.calculatedPixelHeight;
layoutParams.width = this.calculatedPixelWidth;
requestLayout();
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
/* renamed from: _init_$lambda-3, reason: not valid java name */
private static final Executors m3796_init_$lambda3(Lazy lazy) {
return (Executors) lazy.getValue();
}
/* renamed from: _init_$lambda-4, reason: not valid java name */
private static final OMTracker.Factory m3797_init_$lambda4(Lazy lazy) {
return (OMTracker.Factory) lazy.getValue();
}
/* renamed from: _init_$lambda-5, reason: not valid java name */
private static final Platform m3798_init_$lambda5(Lazy lazy) {
return (Platform) lazy.getValue();
}
}