正在查看: OLX India v19.42.007 应用的 e0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 e0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.amazon.device.ads;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import com.amazon.aps.shared.b;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
public class e0 {
private static final String b = "com.amazon.device.ads.e0";
private static e0 c;
private static String d;
private static int e;
private final n0 a = new n0();
private e0() {
}
private HashMap b(String str) {
HashMap hashMap = new HashMap();
hashMap.put("appId", str);
hashMap.put("sdkVer", y.k());
hashMap.put("fp", "false");
hashMap.put("testMode", Boolean.toString(c.r()));
JSONObject i = b0.c().i();
if (i != null) {
hashMap.put("dinfo", i);
}
JSONObject b2 = r0.a(c.g()).b();
if (b2 != null) {
hashMap.put("pkg", b2);
}
if (c.h() != null && c.h().containsKey("mediationName")) {
String str2 = (String) c.h().get("mediationName");
if (!y.p(str2)) {
hashMap.put("mediationName", str2);
}
}
if (Math.random() <= t.d("distribution_pixel", t.e.intValue(), "sample_rates").intValue() / 100.0f) {
String l = c.l();
if (!y.p(l)) {
hashMap.put("distribution", l);
}
}
hashMap.put("segmentId", Integer.valueOf(new SecureRandom().nextInt(com.android.volley.toolbox.j.DEFAULT_IMAGE_TIMEOUT_MS) + 1));
hashMap.put("os", "android");
hashMap.put("osVersion", Build.VERSION.RELEASE);
return hashMap;
}
private HashMap c(String str) {
HashMap hashMap = new HashMap(b0.c().e());
String g = t0.n().g();
if (g != null) {
hashMap.put("adId", g);
}
String m = t0.n().m();
Boolean p = t0.n().p();
if (!y.p(m)) {
hashMap.put("idfa", m);
}
hashMap.put("oo", d(p));
if (str != null) {
hashMap.put("appId", str);
}
JSONObject b2 = r0.a(c.g()).b();
if (b2 != null) {
hashMap.put("pkg", b2);
}
Context g2 = c.g();
if (g2 != null) {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(g2);
Object obj = defaultSharedPreferences.contains("IABTCF_gdprApplies") ? defaultSharedPreferences.getAll().get("IABTCF_gdprApplies") : null;
String string = defaultSharedPreferences.getString("IABTCF_TCString", null);
if (obj != null) {
try {
if ((obj instanceof Integer) && (((Integer) obj).intValue() == 1 || ((Integer) obj).intValue() == 0)) {
hashMap.put("gdpr", obj);
} else if (((obj instanceof String) && ((String) obj).equals("1")) || ((String) obj).equals("0")) {
hashMap.put("gdpr", obj);
} else {
k0.j("IABTCF_gdprApplies should be a 1 or 0 as per IAB guideline");
}
} catch (ClassCastException unused) {
k0.j("IABTCF_gdprApplies should be a number as per IAB guideline");
}
}
if (string != null) {
hashMap.put("gdpr_consent", string);
}
if (t.h().j("enable_gpp_params_to_aip_call")) {
HashMap a = y.a(defaultSharedPreferences);
if (!y.r(a)) {
hashMap.putAll(a);
}
}
}
String i = c.i();
if (!y.p(i)) {
hashMap.put("gdpr_custom", i);
}
return hashMap;
}
private static String d(Boolean bool) {
return (bool != null && bool.booleanValue()) ? "1" : "0";
}
private synchronized void e() {
l0 l0Var;
l0 l0Var2;
JSONObject jSONObject;
if (y.t()) {
k0.g(b, "Unable to fetch advertising identifier information on main thread.");
return;
}
String d2 = c.d();
d = d2;
if (y.p(d2)) {
k0.g(b, "App id not available");
return;
}
if (!y.o()) {
k0.a("Network is not available");
return;
}
a0.g();
l(d);
long currentTimeMillis = System.currentTimeMillis();
long longValue = t0.n().x().longValue();
if (t0.n().o()) {
long j = currentTimeMillis - longValue;
if (j <= 86400000) {
k0.a("SIS call not required, last registration duration:" + j + ", expiration:86400000");
return;
}
}
new x();
?? r1 = 0;
if (!com.amazon.aps.ads.privacy.c.g.g() && !t.h().k("aip_if_no_gdpr_consent", false)) {
com.amazon.aps.ads.d.b(b, "No AIP calls as the feature flag is off");
return;
}
String w = t0.n().w();
if (w.startsWith("null")) {
k0.a("SIS is not ready");
return;
}
StringBuilder sb = new StringBuilder(a0.i(w));
if (longValue == 0) {
k0.k(b, "Trying to register ad id..");
sb.append("/generate_did");
} else {
k0.k(b, "Trying to update ad id..");
sb.append("/update_dev_info");
r1 = 1;
}
HashMap c2 = c(d);
JSONObject jSONObject2 = null;
try {
try {
jSONObject = new JSONObject();
} catch (Throwable th) {
th = th;
}
try {
jSONObject.put("api", r1 != 0 ? "update_dev_info" : "generate_did");
j0 j0Var = new j0(sb.toString());
j0Var.n(a0.h(true));
j0Var.m(c2);
j0Var.d();
l0 l0Var3 = r1 != 0 ? l0.SIS_LATENCY_UPDATE_DEVICE_INFO : l0.SIS_LATENCY_REGISTER_EVENT;
this.a.h(l0Var3);
j0Var.f(60000);
this.a.i(l0Var3);
if (y.p(j0Var.j())) {
k0.a("No response from sis call.");
throw new Exception("SIS Response is null");
}
JSONObject jSONObject3 = (JSONObject) new JSONTokener(j0Var.j()).nextValue();
t0.n().c0(g(jSONObject3));
if (t0.n().o()) {
com.amazon.aps.shared.b.q("sisApiSuccess", String.valueOf(t0.n().C()), jSONObject);
if (l0Var3 != null) {
this.a.f(l0Var3);
}
k(w, d);
return;
}
k0.k(b, "ad id failed registration: " + jSONObject3);
throw new Exception("ad id failed registration: ");
} catch (JSONException e2) {
e = e2;
l0Var2 = null;
jSONObject2 = jSONObject;
k0.f("JSON error parsing return from SIS: " + e.getMessage());
com.amazon.aps.shared.b.q("sisApiFailed", String.valueOf(t0.n().C()), jSONObject2);
if (l0Var2 != null) {
this.a.f(l0Var2);
}
} catch (Exception e3) {
e = e3;
l0Var = null;
jSONObject2 = jSONObject;
k0.f("Error registering device for ads:" + e);
com.amazon.aps.shared.b.q("sisApiFailed", String.valueOf(t0.n().C()), jSONObject2);
if (l0Var != null) {
this.a.f(l0Var);
}
} catch (Throwable th2) {
th = th2;
r1 = 0;
jSONObject2 = jSONObject;
com.amazon.aps.shared.b.q("sisApiFailed", String.valueOf(t0.n().C()), jSONObject2);
if (r1 != 0) {
this.a.f(r1);
}
throw th;
}
} catch (JSONException e4) {
e = e4;
l0Var2 = null;
} catch (Exception e5) {
e = e5;
l0Var = null;
} catch (Throwable th3) {
th = th3;
r1 = 0;
}
}
private boolean f(JSONObject jSONObject) {
if (!jSONObject.has("rcode")) {
return false;
}
if (jSONObject.getInt("rcode") == 1) {
t0.n().Z(System.currentTimeMillis());
k0.k(b, "ad id is registered or updated successfully.");
return true;
}
if (jSONObject.getInt("rcode") != 103 && (jSONObject.getInt("rcode") != 101 || !jSONObject.has("msg") || jSONObject.getInt("msg") != 103)) {
return false;
}
t0.n().Z(System.currentTimeMillis());
k0.j("gdpr consent not granted");
return true;
}
private boolean g(JSONObject jSONObject) {
if (!jSONObject.has("rcode")) {
return false;
}
t0.n().Y(System.currentTimeMillis());
if (jSONObject.getInt("rcode") == 1 && jSONObject.has("adId")) {
String string = jSONObject.getString("adId");
if (jSONObject.has("idChanged") && jSONObject.getBoolean("idChanged")) {
k0.k(b, "ad id has changed, updating..");
this.a.d(l0.SIS_COUNTER_IDENTIFIED_DEVICE_CHANGED);
}
t0.n().J(string);
k0.k(b, "ad id is registered or updated successfully.");
return true;
}
if (jSONObject.getInt("rcode") != 103) {
if (jSONObject.getInt("rcode") != 101 || !jSONObject.has("msg")) {
return false;
}
if (jSONObject.optInt("msg") != 103 && !"need at least one native id in parameter".equals(jSONObject.get("msg"))) {
return false;
}
}
t0.n().D();
k0.b(b, "No ad-id returned");
return true;
}
public static void h() {
c.e();
com.amazon.aps.ads.e.d(false);
}
private void i() {
b.a aVar = com.amazon.aps.shared.b.a;
aVar.o(t.f("apsmetricsv2", "mobile", "url", "https://prod.tahoe-analytics.publishers.adversising.a2z.com/logevent/putRecord"));
aVar.p(t.c("apsmetricsv2", "mobile", "samplingPercentage", 0.1d).doubleValue());
aVar.n(t.f("apsmetricsv2", "mobile", "apiKey", "a5c71f6aff54eb34c826d952c285eaf0650b4259c83ae598962681a6429b63f6"));
}
private boolean j(String str, long j, boolean z) {
JSONObject jSONObject = (JSONObject) new JSONTokener(str).nextValue();
if (jSONObject.has("privacyApplicable")) {
Object obj = jSONObject.get("privacyApplicable");
if (obj instanceof JSONArray) {
com.amazon.aps.ads.privacy.c.g.k((JSONArray) obj);
}
}
if (jSONObject.has("pj")) {
t0.n().T(jSONObject.getJSONObject("pj"));
} else {
t0.n().F();
}
if (jSONObject.has("privacy")) {
m(jSONObject.getJSONArray("privacy"));
} else {
t0.n().G();
}
if (!jSONObject.has("aaxHostname") && !jSONObject.has("sisURL") && !jSONObject.has("aaxVideoHostname")) {
k0.k(b, "ad configuration failed load: " + jSONObject);
throw new Exception("ad configuration failed load");
}
if (jSONObject.has("aaxHostname")) {
t0.n().H(jSONObject.getString("aaxHostname"));
}
if (jSONObject.has("sisURL")) {
z = t0.n().X(jSONObject.getString("sisURL"));
}
if (jSONObject.has("ttl")) {
t0.n().M(Long.parseLong(jSONObject.getString("ttl")));
}
if (jSONObject.has("aaxVideoHostname")) {
t0.n().I(jSONObject.getString("aaxVideoHostname"));
}
if (jSONObject.has("bidTimeout")) {
t0.n().K(Integer.valueOf(jSONObject.getInt("bidTimeout")));
} else {
t0.n().E();
}
t0.n().L(j);
k0.k(b, "ad configuration loaded successfully.");
return z;
}
private void k(String str, String str2) {
if (System.currentTimeMillis() - t0.n().y() < 2592000000L) {
return;
}
String g = t0.n().g();
if (g == null || g.isEmpty()) {
k0.j("error retrieving ad id, cancelling sis ping");
return;
}
try {
if (!y.o()) {
k0.a("Network is not available");
return;
}
j0 j0Var = new j0(str + "/ping");
j0Var.n(a0.h(true));
HashMap hashMap = new HashMap();
hashMap.put("appId", str2);
hashMap.put("adId", g);
Context g2 = c.g();
if (g2 != null) {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(g2);
Object obj = defaultSharedPreferences.contains("IABTCF_gdprApplies") ? defaultSharedPreferences.getAll().get("IABTCF_gdprApplies") : null;
String string = defaultSharedPreferences.getString("IABTCF_TCString", null);
if (obj != null) {
try {
if ((obj instanceof Integer) && (((Integer) obj).intValue() == 1 || ((Integer) obj).intValue() == 0)) {
hashMap.put("gdpr", obj);
} else if (((obj instanceof String) && ((String) obj).equals("1")) || ((String) obj).equals("0")) {
hashMap.put("gdpr", obj);
} else {
k0.j("IABTCF_gdprApplies should be a 1 or 0 as per IAB guideline");
}
} catch (ClassCastException unused) {
k0.j("IABTCF_gdprApplies should be a number as per IAB guideline");
}
}
if (string != null) {
hashMap.put("gdpr_consent", string);
}
if (t.h().j("enable_gpp_params_to_aip_call")) {
HashMap a = y.a(defaultSharedPreferences);
if (!y.r(a)) {
hashMap.putAll(a);
}
}
}
String i = c.i();
if (!y.p(i)) {
hashMap.put("gdpr_custom", i);
}
j0Var.m(hashMap);
j0Var.e(60000);
if (y.p(j0Var.j())) {
k0.a("No response from sis ping.");
throw new Exception("Ping SIS Response is null");
}
JSONObject jSONObject = (JSONObject) new JSONTokener(j0Var.j()).nextValue();
if (f(jSONObject)) {
return;
}
k0.k(b, "sis ping failed failed registration: " + jSONObject);
throw new Exception("sis ping failed registration: ");
} catch (Exception e2) {
k0.f("Error pinging sis: " + e2);
}
}
private boolean l(String str) {
l0 l0Var;
e++;
long currentTimeMillis = System.currentTimeMillis();
long longValue = currentTimeMillis - t0.n().j().longValue();
long k = t0.n().k();
k0.a("Config last check in duration: " + longValue + ", Expiration: " + k);
if (!t.h().j("config_check_in_ttl_feature_v2")) {
k = 172800000;
}
boolean z = false;
if (longValue <= k) {
k0.a("No config refresh required");
return false;
}
if (!y.o()) {
k0.a("Network is not available");
return false;
}
j0 j0Var = new j0(a0.c("mads.amazon-adsystem.com") + "/msdk/getConfig");
j0Var.a("Accept", "application/json");
for (Map.Entry entry : a0.d("{}").entrySet()) {
j0Var.a((String) entry.getKey(), (String) entry.getValue());
}
j0Var.n(a0.h(true));
j0Var.m(b(str));
try {
try {
n0 n0Var = this.a;
l0Var = l0.CONFIG_DOWNLOAD_LATENCY;
n0Var.h(l0Var);
j0Var.e(60000);
this.a.i(l0Var);
} catch (Exception e2) {
k0.f("Error fetching DTB config: " + e2);
com.amazon.aps.shared.a.k(com.amazon.aps.shared.analytics.b.FATAL, com.amazon.aps.shared.analytics.c.EXCEPTION, "Error fetching DTB config:", e2);
com.amazon.aps.shared.b.q("remoteConfigFetchFailed", String.valueOf(e), null);
n0 n0Var2 = this.a;
if (n0Var2 != null) {
n0Var2.f(l0.CONFIG_DOWNLOAD_LATENCY);
}
}
if (y.p(j0Var.j())) {
throw new Exception("Config Response is null");
}
z = j(j0Var.j(), currentTimeMillis, false);
com.amazon.aps.shared.b.q("remoteConfigFetchSuccess", String.valueOf(e), null);
n0 n0Var3 = this.a;
if (n0Var3 != null) {
n0Var3.f(l0Var);
}
try {
t.h().q();
double intValue = t.d("sampling_rate", t.f.intValue(), "analytics").intValue() / 100.0f;
String e3 = t.e("url", "", "analytics");
String e4 = t.e("api_key", "", "analytics");
if (!com.amazon.aps.shared.a.i()) {
com.amazon.aps.shared.a.g(c.g());
com.amazon.aps.shared.a.q(c.o());
}
com.amazon.aps.shared.a.p((int) intValue);
com.amazon.aps.shared.a.o(e3);
com.amazon.aps.shared.a.n(e4);
i();
} catch (RuntimeException e5) {
k0.n("Error when reading client config file for APSAndroidShared library" + e5);
}
return z;
} catch (Throwable th) {
n0 n0Var4 = this.a;
if (n0Var4 != null) {
n0Var4.f(l0.CONFIG_DOWNLOAD_LATENCY);
}
throw th;
}
}
private void m(JSONArray jSONArray) {
for (int i = 0; i < jSONArray.length(); i++) {
try {
JSONObject jSONObject = jSONArray.getJSONObject(i);
if (jSONObject.has("location")) {
t0.n().W(jSONObject.getJSONObject("location"));
return;
}
} catch (RuntimeException e2) {
e = e2;
k0.g(b, "Failed to parse privacy configuration");
com.amazon.aps.shared.a.k(com.amazon.aps.shared.analytics.b.FATAL, com.amazon.aps.shared.analytics.c.EXCEPTION, "Failed to parse privacy configuration", e);
return;
} catch (JSONException e3) {
e = e3;
k0.g(b, "Failed to parse privacy configuration");
com.amazon.aps.shared.a.k(com.amazon.aps.shared.analytics.b.FATAL, com.amazon.aps.shared.analytics.c.EXCEPTION, "Failed to parse privacy configuration", e);
return;
}
}
t0.n().G();
}
public static synchronized void n() {
synchronized (e0.class) {
try {
if (c == null) {
c = new e0();
com.amazon.aps.ads.e.d(false);
}
if (!com.amazon.aps.ads.e.c()) {
com.amazon.aps.ads.e.d(true);
DtbThreadService.g().e(new Runnable() {
@Override
public final void run() {
e0.h();
}
});
}
} catch (Throwable th) {
throw th;
}
}
}
}