Files
rr3-apk/decompiled/sources/com/applovin/impl/sdk/g.java
Daniel Elliott f9d20bb3fc 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>
2026-02-18 14:52:23 -08:00

328 lines
16 KiB
Java

package com.applovin.impl.sdk;
import android.os.Bundle;
import android.view.View;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorPublisher;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.af;
import com.applovin.impl.communicator.CommunicatorMessageImpl;
import com.applovin.impl.ge;
import com.applovin.impl.he;
import com.applovin.impl.ie;
import com.applovin.impl.io;
import com.applovin.impl.je;
import com.applovin.impl.ne;
import com.applovin.impl.sdk.network.d;
import com.applovin.impl.sdk.utils.BundleUtils;
import com.applovin.impl.sdk.utils.CollectionUtils;
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.v3;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.zq;
import com.applovin.mediation.adapter.MaxAdapter;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.AppLovinWebViewActivity;
import com.ironsource.cr;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class g implements AppLovinCommunicatorSubscriber, AppLovinCommunicatorPublisher {
private final j a;
private final AppLovinCommunicator b;
public g(j jVar) {
this.a = jVar;
AppLovinCommunicator appLovinCommunicator = AppLovinCommunicator.getInstance(j.l());
this.b = appLovinCommunicator;
if (((Boolean) jVar.a(sj.N6)).booleanValue()) {
appLovinCommunicator.a(jVar);
appLovinCommunicator.subscribe(this, io.a);
}
}
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
public String getCommunicatorId() {
return "applovin_sdk";
}
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
Map<String, Object> map;
long j;
int i;
if (((Boolean) this.a.a(sj.N6)).booleanValue()) {
if ("send_http_request".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
Map<String, String> stringMap = BundleUtils.toStringMap(messageData.getBundle("query_params"));
Map<String, Object> map2 = BundleUtils.toMap(messageData.getBundle("post_body"));
Map<String, String> stringMap2 = BundleUtils.toStringMap(messageData.getBundle("headers"));
String string = messageData.getString("id", "");
if (!map2.containsKey(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY)) {
map2.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
}
this.a.X().e(new d.b().d(messageData.getString("url")).a(messageData.getString("backup_url")).b(stringMap).c(map2).a(stringMap2).a(((Boolean) this.a.a(sj.o5)).booleanValue()).b(string).a());
return;
}
if (!"send_http_request_v2".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
if ("set_ad_request_query_params".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.i().addCustomQueryParams(yp.a((Map) BundleUtils.toMap(appLovinCommunicatorMessage.getMessageData())));
return;
} else if ("set_ad_request_post_body".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.i().setCustomPostBody(BundleUtils.toJSONObject(appLovinCommunicatorMessage.getMessageData()));
return;
} else {
if ("set_mediate_request_post_body_data".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.Q().setCustomPostBodyData(BundleUtils.toJSONObject(appLovinCommunicatorMessage.getMessageData()));
return;
}
return;
}
}
Bundle messageData2 = appLovinCommunicatorMessage.getMessageData();
String string2 = messageData2.getString("http_method", "POST");
long millis = messageData2.containsKey("timeout_sec") ? TimeUnit.SECONDS.toMillis(messageData2.getLong("timeout_sec")) : ((Long) this.a.a(sj.B3)).longValue();
int i2 = messageData2.getInt("retry_count", ((Integer) this.a.a(sj.C3)).intValue());
long millis2 = messageData2.containsKey("retry_delay_sec") ? TimeUnit.SECONDS.toMillis(messageData2.getLong("retry_delay_sec")) : ((Long) this.a.a(sj.D3)).longValue();
Map<String, String> stringMap3 = BundleUtils.toStringMap(messageData2.getBundle("query_params"));
long j2 = millis2;
if ("GET".equalsIgnoreCase(string2)) {
if (messageData2.getBoolean("include_data_collector_info", true)) {
stringMap3.putAll(BundleUtils.toStringMap(CollectionUtils.toBundle(this.a.y().a(null, false, false))));
}
j = millis;
i = i2;
map = null;
} else {
map = BundleUtils.toMap(messageData2.getBundle("post_body"));
if (messageData2.getBoolean("include_data_collector_info", true)) {
Map A = this.a.y().A();
Map l = this.a.y().l();
if (l.containsKey("idfv") && l.containsKey("idfv_scope")) {
i = i2;
String str = (String) l.get("idfv");
j = millis;
Integer num = (Integer) l.get("idfv_scope");
num.intValue();
l.remove("idfv");
l.remove("idfv_scope");
A.put("idfv", str);
A.put("idfv_scope", num);
} else {
j = millis;
i = i2;
}
A.put("server_installed_at", this.a.a(sj.p));
A.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
map.put(MBridgeConstans.DYNAMIC_VIEW_WX_APP, A);
map.put("device", l);
} else {
j = millis;
i = i2;
}
}
this.a.j0().a((yl) new v3(appLovinCommunicatorMessage.getPublisherId(), com.applovin.impl.sdk.network.a.a(this.a).b(messageData2.getString("url")).a(messageData2.getString("backup_url")).b(stringMap3).c(string2).a((Map) BundleUtils.toStringMap(messageData2.getBundle("headers"))).a(map != null ? new JSONObject(map) : null).c((int) j).a(i).b((int) j2).a((Object) new JSONObject()).a(messageData2.getBoolean("is_encoding_enabled", false)).a(), this.a), tm.b.OTHER);
}
}
public void b(ge geVar, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("max_ad_events")) {
Bundle a = a(geVar);
a.putString("type", str);
this.a.J();
if (n.a()) {
this.a.J().a("CommunicatorService", "Sending \"max_ad_events\" message: " + a);
}
a(a, "max_ad_events");
}
}
public void a(ge geVar, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("ad_callback_blocked_after_hidden")) {
Bundle a = a(geVar);
a.putString("callback_name", str);
a(a, "ad_callback_blocked_after_hidden");
}
}
public void a(JSONObject jSONObject, boolean z) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("safedk_init")) {
Bundle bundle = new Bundle();
bundle.putString(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
bundle.putString("applovin_random_token", this.a.a0());
bundle.putString("compass_random_token", this.a.q());
bundle.putString("device_type", AppLovinSdkUtils.isTablet(j.l()) ? "tablet" : "phone");
bundle.putString("init_success", String.valueOf(z));
bundle.putParcelableArrayList("installed_mediation_adapters", JsonUtils.toBundle(af.a(this.a)));
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "communicator_settings", (JSONObject) null);
Bundle bundle2 = (Bundle) bundle.clone();
bundle2.putString("user_id", this.a.q0().c());
JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "safedk_settings", new JSONObject());
if (!((Boolean) this.a.a(sj.O6)).booleanValue()) {
JSONObject jSONObject4 = new JSONObject();
JsonUtils.putBoolean(jSONObject4, "deactivated", true);
JsonUtils.putJSONObject(jSONObject3, "safeDKDeactivation", jSONObject4);
}
bundle2.putBundle("settings", JsonUtils.toBundle(jSONObject3));
this.a.J();
if (n.a()) {
this.a.J().a("CommunicatorService", "Sending \"safedk_init\" message: " + bundle);
}
a(bundle2, "safedk_init");
}
}
public void a(MaxAdapter.InitializationStatus initializationStatus, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("adapter_initialization_status")) {
Bundle bundle = new Bundle();
bundle.putString("adapter_class", str);
bundle.putInt("init_status", initializationStatus.getCode());
a(bundle, "adapter_initialization_status");
}
}
public void a() {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("privacy_setting_updated")) {
a(new Bundle(), "privacy_setting_updated");
}
}
public void a(String str, String str2) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("network_sdk_version_updated")) {
Bundle bundle = new Bundle();
bundle.putString("adapter_class", str2);
bundle.putString("sdk_version", str);
a(bundle, "network_sdk_version_updated");
}
}
public void a(List list) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("live_networks_updated")) {
if (list != null && !list.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("live_networks", new ArrayList<>(list));
a(bundle, "live_networks_updated");
return;
}
a(Bundle.EMPTY, "live_networks_updated");
}
}
public void a(String str, String str2, String str3) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("responses")) {
String maybeConvertToIndentedString = JsonUtils.maybeConvertToIndentedString(str3, 2);
String maybeConvertToIndentedString2 = JsonUtils.maybeConvertToIndentedString(str, 2);
Bundle bundle = new Bundle();
bundle.putString("request_url", str2);
bundle.putString("request_body", maybeConvertToIndentedString);
bundle.putString(cr.n, maybeConvertToIndentedString2);
a(bundle, "responses");
}
}
public void a(String str, String str2, int i, Object obj, String str3, boolean z) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("receive_http_response")) {
Bundle bundle = new Bundle();
bundle.putString("id", str);
bundle.putString("url", str2);
bundle.putInt("code", i);
bundle.putBundle("body", JsonUtils.toBundle(obj));
bundle.putBoolean("success", z);
BundleUtils.putString("error_message", str3, bundle);
a(bundle, "receive_http_response");
}
}
public void a(Bundle bundle, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber(str)) {
this.b.getMessagingService().publish(CommunicatorMessageImpl.create(bundle, str, this));
}
}
public boolean a(String str) {
return io.a.contains(str);
}
private Bundle a(ge geVar) {
View view;
Bundle bundle = new Bundle();
bundle.putString("id", geVar.S());
bundle.putString("network_name", geVar.c());
bundle.putString("max_ad_unit_id", geVar.getAdUnitId());
bundle.putString("third_party_ad_placement_id", geVar.U());
bundle.putString("ad_format", geVar.getFormat().getLabel());
BundleUtils.putStringIfValid(CampaignEx.JSON_KEY_CREATIVE_ID, geVar.getCreativeId(), bundle);
BundleUtils.putStringIfValid("adomain", geVar.v(), bundle);
BundleUtils.putStringIfValid("dsp_name", geVar.getDspName(), bundle);
if (geVar.a0()) {
BundleUtils.putStringIfValid("hybrid_ad_format", geVar.I().getLabel(), bundle);
}
if (geVar.b0()) {
bundle.putString("custom_js_network_name", geVar.getNetworkName());
} else if ("CUSTOM_NETWORK_SDK".equalsIgnoreCase(geVar.c())) {
bundle.putString("custom_sdk_network_name", geVar.getNetworkName());
}
bundle.putAll(JsonUtils.toBundle(geVar.x()));
if (geVar instanceof ne) {
if (geVar instanceof he) {
view = ((he) geVar).y();
} else {
if (geVar instanceof je) {
je jeVar = (je) geVar;
if (!jeVar.w0()) {
view = jeVar.q0() != null ? jeVar.q0() : jeVar.r0();
}
}
view = null;
}
bundle.putString("ad_view", view != null ? zq.a(view) : "N/A");
} else if (geVar instanceof ie) {
Bundle bundle2 = ((ie) geVar).o0().getBundle("applovin_ad_view_info");
bundle.putString("ad_view", BundleUtils.getString("ad_view_address", "N/A", bundle2));
bundle.putString("video_view", BundleUtils.getString("video_view_address", "N/A", bundle2));
}
return bundle;
}
public void b(ge geVar) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("max_revenue_events")) {
Bundle a = a(geVar);
a.putAll(JsonUtils.toBundle(geVar.R()));
a.putString("country_code", this.a.r().getCountryCode());
a(a, "max_revenue_events");
}
}
public void b(String str, String str2) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("user_info")) {
Bundle bundle = new Bundle(2);
bundle.putString("user_id", StringUtils.emptyIfNull(str));
bundle.putString("applovin_random_token", str2);
a(bundle, "user_info");
}
}
public void b(List list) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("test_mode_networks_updated")) {
if (list != null && !list.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("test_mode_networks", new ArrayList<>(list));
a(bundle, "test_mode_networks_updated");
return;
}
a(Bundle.EMPTY, "test_mode_networks_updated");
}
}
}