Free Fire v1.103.1版本的 MD5 值为:f6c45f9f1485263aa5af0fb400f973fc
以下内容为反编译后的 c.java 源代码,内容仅作参考
package co.datadome.sdk;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.ConditionVariable;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import co.datadome.sdk.DataDomeSDK;
import com.FF.voiceengine.FFVoiceConst;
import com.google.gson.Gson;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
import qa.b0;
import qa.t;
import qa.w;
import qa.z;
public abstract class c {
public static final String DATADOME_COOKIE_PREFIX = "datadome=";
public static final String HTTP_HEADER_ACCEPT = "Accept";
public static final String HTTP_HEADER_COOKIE = "Cookie";
public static final String HTTP_HEADER_SET_COOKIE = "Set-Cookie";
private static Date f2982q;
protected WeakReference<Application> f2986b;
protected String f2987c;
protected z f2990f;
protected DataDomeSDKListener f2991g;
protected DataDomeSDKManualIntegrationListener f2992h;
private ArrayList<String> f2993i;
private b f2994j;
public String userAgent;
private static ConditionVariable f2976k = new ConditionVariable();
private static AtomicBoolean f2977l = new AtomicBoolean(false);
private static Vector<d1.g> f2978m = new Vector<>();
private static boolean f2979n = false;
private static boolean f2980o = false;
private static boolean f2981p = false;
private static List<DataDomeEvent> f2983r = Collections.synchronizedList(new ArrayList());
private static boolean f2984s = false;
public Boolean bypassDataDomeAcceptHeader = Boolean.FALSE;
protected DataDomeSDK.BackBehaviour f2985a = DataDomeSDK.BackBehaviour.GO_BACKGROUND;
protected String f2988d = "";
protected String f2989e = "";
public static class a extends AsyncTask<i, Void, Void> {
WeakReference<c> f2995a;
a(c cVar) {
this.f2995a = new WeakReference<>(cVar);
}
private void b(i iVar) {
try {
Log.i("DataDome", "Logging events");
b0 a10 = new w.b().b(new C0053c(new Random().nextInt(FFVoiceConst.FFVoiceEvent.FFVoice_EVENT_EOF))).c().d(new z.a().g(iVar.b()).j("https://api-sdk.datadome.co/sdk/").b()).a();
if (a10.c() == 200 && a10.a() != null) {
Object obj = ((Map) new Gson().j(a10.a().j(), Map.class)).get("cookie");
obj.getClass();
this.f2995a.get().k((String) obj);
a10.close();
d(new Date());
return;
}
a10.close();
d(new Date());
f.a("Failed sending tracking payload " + a10.a());
f.a("Failed sending tracking payload with code " + a10.c());
} catch (Exception e10) {
Log.e("DataDome", "Event Tracker", e10);
}
}
private static void d(Date date) {
Date unused = c.f2982q = date;
}
@Override
public Void doInBackground(i... iVarArr) {
if (this.f2995a.get() == null || iVarArr.length <= 0) {
return null;
}
for (i iVar : iVarArr) {
b(iVar);
}
return null;
}
@Override
public void onPostExecute(Void r12) {
c.f2983r.clear();
c.y(false);
}
}
public class b extends BroadcastReceiver {
d1.h f2996a;
public b(d1.h hVar) {
this.f2996a = hVar;
}
private void a() {
d1.h hVar = this.f2996a;
if (hVar != null) {
hVar.onCaptchaLoaded();
}
}
private void b(Context context, Intent intent) {
c.x(false);
String stringExtra = intent.getStringExtra("cookie");
String stringExtra2 = intent.getStringExtra("captcha_url");
Log.i("DataDome", "Did resolve captcha with cookie " + stringExtra);
c.this.f2993i.clear();
c.this.k(stringExtra);
c.C();
d1.h hVar = this.f2996a;
if (hVar != null) {
hVar.onCaptchaDismissed();
this.f2996a.onCaptchaSuccess();
}
c.f2977l.set(true);
c.this.logEvent(DataDomeSDK.a.CAPTCHA_SUCCESS.a("sdk"));
f.a("captcha succeed with url " + stringExtra2);
}
@Override
public void onReceive(Context context, Intent intent) {
int intExtra = intent.getIntExtra("captcha_result", 0);
String stringExtra = intent.getStringExtra("captcha_url");
if (intExtra == -1) {
b(context, intent);
boolean unused = c.f2980o = true;
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener = c.this.f2992h;
if (dataDomeSDKManualIntegrationListener != null) {
dataDomeSDKManualIntegrationListener.onComplete(null);
}
} else if (intExtra == 1) {
a();
c.x(true);
} else {
if (this.f2996a != null && !c.f2980o) {
this.f2996a.onCaptchaDismissed();
this.f2996a.onCaptchaCancelled();
}
if (c.this.f2992h != null && !c.f2980o) {
c.this.f2992h.onDismiss();
}
c.x(false);
c.this.logEvent(DataDomeSDK.a.CAPTCHA_FAILURE.a("sdk"));
f.a("captcha dismiss with url " + stringExtra);
if (c.f2980o) {
c.C();
}
}
}
}
public static class C0053c implements t {
int f2998a;
C0053c(int i10) {
this.f2998a = i10;
if (i10 > 0) {
TrafficStats.setThreadStatsTag(i10);
}
}
@Override
public b0 intercept(t.a aVar) {
int i10 = this.f2998a;
if (i10 > 0) {
TrafficStats.setThreadStatsTag(i10);
}
return aVar.d(aVar.b());
}
}
public c() {
new ArrayList();
this.f2993i = new ArrayList<>();
}
public static void C() {
f2976k.open();
}
private void h(int i10, String str) {
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener = this.f2992h;
if (dataDomeSDKManualIntegrationListener != null) {
dataDomeSDKManualIntegrationListener.onError(Integer.valueOf(i10), "Not captcha's url found");
f2977l.set(false);
}
}
public static Boolean isHandlingResponseInProgress() {
return Boolean.valueOf(f2977l.get());
}
private void l(b0 b0Var) {
Log.i("DataDome", "Handling the blocked response");
DataDomeSDKListener dataDomeSDKListener = this.f2991g;
if (dataDomeSDKListener != null) {
dataDomeSDKListener.onHangOnRequest(b0Var.c());
}
String e10 = b0Var.e("location");
if (e10 == null) {
DataDomeSDKListener dataDomeSDKListener2 = this.f2991g;
if (dataDomeSDKListener2 != null) {
dataDomeSDKListener2.onError(504, "Not captcha's url found");
return;
}
return;
}
DataDomeSDKListener dataDomeSDKListener3 = this.f2991g;
if (dataDomeSDKListener3 != null) {
dataDomeSDKListener3.willDisplayCaptcha();
}
for (String str : b0Var.g("set-cookie")) {
this.f2993i.add(d.d(str));
}
t(e10);
f2976k.close();
f2976k.block();
}
private void m(b0 b0Var, d1.g gVar) {
Log.i("DataDome", "Handling the blocked response");
DataDomeSDKListener dataDomeSDKListener = this.f2991g;
if (dataDomeSDKListener != null) {
dataDomeSDKListener.onHangOnRequest(b0Var.c());
}
try {
f.a("Blocked response: " + gVar.b() + "\nFor request " + b0Var.w().i());
String string = new JSONObject(gVar.b()).getString("url");
StringBuilder sb = new StringBuilder();
sb.append("blocked captcha url: ");
sb.append(string);
f.a(sb.toString());
if (string == null) {
DataDomeSDKListener dataDomeSDKListener2 = this.f2991g;
if (dataDomeSDKListener2 != null) {
dataDomeSDKListener2.onError(504, "Not captcha's url found");
return;
}
return;
}
DataDomeSDKListener dataDomeSDKListener3 = this.f2991g;
if (dataDomeSDKListener3 != null) {
dataDomeSDKListener3.willDisplayCaptcha();
}
t(string);
f2976k.close();
f2976k.block();
} catch (JSONException e10) {
Log.e("DataDome", "Blocked Response Handling", e10);
DataDomeSDKListener dataDomeSDKListener4 = this.f2991g;
if (dataDomeSDKListener4 != null) {
dataDomeSDKListener4.onError(503, "Problem parsing json");
}
}
}
private Boolean o(b0 b0Var) {
if (b0Var.c() != 302) {
return Boolean.FALSE;
}
String e10 = b0Var.e("location");
return !e10.isEmpty() ? Boolean.valueOf(e10.toLowerCase(Locale.ROOT).contains("dduser-challenge")) : Boolean.FALSE;
}
public void q(String str) {
ArrayList<String> arrayList;
Application application = this.f2986b.get();
if (application == null) {
if (this.f2991g != null) {
logEvent(DataDomeSDK.a.NULL_CONTEXT.a("sdk"));
this.f2991g.onError(504, "Empty application context.");
Log.e("DataDome", "Unexpected null context passed to the SDK");
return;
}
return;
}
String c10 = c();
Intent intent = new Intent();
intent.setClass(application, CaptchaActivity.class);
intent.addFlags(276824064);
intent.putExtra("cookie", c10);
intent.putExtra("captcha_url", str);
intent.putExtra("backBehaviour", this.f2985a);
if (f2981p && (arrayList = this.f2993i) != null && arrayList.size() > 0) {
intent.putStringArrayListExtra("cookieHeaders", this.f2993i);
intent.putExtra("isSfcc", f2981p);
}
IntentFilter intentFilter = new IntentFilter("co.datadome.sdk.CAPTCHA_RESULT");
if (this.f2994j != null) {
v0.a.b(application).e(this.f2994j);
}
this.f2994j = new b(this.f2991g);
v0.a.b(application).c(this.f2994j, intentFilter);
application.startActivity(intent);
}
public static void resetHandlingResponseInProgress() {
f2977l.set(false);
}
private void t(String str) {
try {
w(str);
} catch (Exception e10) {
Log.e("DataDome", "Load Captcha View", e10);
DataDomeSDKListener dataDomeSDKListener = this.f2991g;
if (dataDomeSDKListener != null) {
dataDomeSDKListener.onError(505, "Can't start Captcha web view");
}
}
}
private void w(final String str) {
if (f2979n) {
Log.i("DataDome", "Captcha already displayed");
return;
}
x(true);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
co.datadome.sdk.c.this.q(str);
}
});
}
public static void x(boolean z10) {
f2979n = z10;
}
public static void y(boolean z10) {
f2984s = z10;
}
public String c() {
if (this.f2986b.get() == null) {
if (this.f2991g != null) {
logEvent(DataDomeSDK.a.NULL_CONTEXT.a("sdk"));
this.f2991g.onError(504, "Empty application context.");
}
return "";
}
Set<String> b10 = new h(this.f2986b.get()).b();
if (b10 != null) {
for (String str : b10) {
if (str.startsWith(DATADOME_COOKIE_PREFIX)) {
return d.h(str);
}
}
}
return "";
}
public String d(Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) {
if (entry.getKey().equalsIgnoreCase("X-DD-B")) {
return entry.getValue();
}
}
return null;
}
public b0 g(b0 b0Var, Map<String, String> map, String str, qa.d dVar) {
logEvent(DataDomeSDK.a.RESPONSE_VALIDATION.a("sdk"));
int c10 = b0Var.c();
String d10 = d(map);
f.a("X-DD-B header: " + d10);
boolean booleanValue = o(b0Var).booleanValue();
f2981p = booleanValue;
if (booleanValue && !this.bypassDataDomeAcceptHeader.booleanValue()) {
Log.e("DataDome", "bypassDataDomeAcceptHeader argument is not enabled is datadome sdk instance");
}
if (((c10 == 403 || c10 == 401) && !d.e(d10).booleanValue()) || f2981p) {
Log.i("DataDome", "Blocked request by DataDome");
f2978m.add(new d1.g(dVar.mo118clone(), map, str));
synchronized (f2976k) {
try {
try {
Log.i("DataDome", "Validating the response");
if (map != null && str != null) {
new d1.g(dVar.mo118clone(), map, str);
}
if (f2977l.get()) {
Log.i("DataDome", "Validating another response already");
f2976k.wait();
if (f2978m.size() > 0) {
d1.g gVar = f2978m.get(0);
f2978m.remove(0);
b0 a10 = gVar.a().mo118clone().a();
f.a("Retried awaited request " + gVar.a().b().i() + " finished with code: " + a10.c());
return a10;
}
} else {
f2977l.set(true);
if (f2981p) {
l(b0Var);
} else {
m(b0Var, f2978m.get(0));
}
if (f2978m.size() > 0) {
d1.g gVar2 = f2978m.get(0);
f2978m.remove(0);
b0 a11 = gVar2.a().mo118clone().a();
f.a("Retried original request " + gVar2.a().b().i() + " finished with code: " + a11.c());
return a11;
}
}
} catch (Exception e10) {
Log.e("DataDome", "Response Handling", e10);
f2977l.set(false);
return b0Var;
}
} finally {
}
}
} else {
DataDomeSDKListener dataDomeSDKListener = this.f2991g;
if (dataDomeSDKListener != null) {
dataDomeSDKListener.onDataDomeResponse(c10, str);
}
}
s();
return b0Var;
}
public List<DataDomeEvent> getCurrentEvents() {
return f2983r;
}
public z getRequest() {
return this.f2990f;
}
public void i(Boolean bool) {
f.f3000a.set(bool.booleanValue());
}
public void j(Integer num, Map<String, String> map, int i10, String str) {
if (!((i10 == 403 || i10 == 401) && !d.e(d(map)).booleanValue())) {
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener = this.f2992h;
if (dataDomeSDKManualIntegrationListener != null) {
dataDomeSDKManualIntegrationListener.onDismiss();
}
s();
return;
}
Log.i("DataDome", "Blocked request by DataDome");
try {
if (f2977l.get()) {
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener2 = this.f2992h;
if (dataDomeSDKManualIntegrationListener2 != null) {
dataDomeSDKManualIntegrationListener2.onRequestInProgress(num);
return;
}
return;
}
f2977l.set(true);
try {
String string = new JSONObject(str).getString("url");
if (string == null) {
h(num.intValue(), "Not captcha's url found");
return;
}
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener3 = this.f2992h;
if (dataDomeSDKManualIntegrationListener3 != null) {
dataDomeSDKManualIntegrationListener3.willDisplayCaptcha();
}
Log.i("DataDome", "Showing captcha");
t(string);
f2976k.close();
f2976k.block();
f2977l.set(false);
DataDomeSDKManualIntegrationListener dataDomeSDKManualIntegrationListener4 = this.f2992h;
if (dataDomeSDKManualIntegrationListener4 != null) {
dataDomeSDKManualIntegrationListener4.onDismiss();
}
} catch (JSONException e10) {
h(num.intValue(), "Problem parsing json");
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
co.datadome.sdk.c.C();
}
}, 500L);
Log.e("DataDome", "Manual Response Handling", e10);
}
} catch (Exception e11) {
int intValue = num.intValue();
h(intValue, "Exception error: " + e11.getLocalizedMessage());
Log.e("DataDome", "Manual Response Handling", e11);
}
}
public void k(String str) {
WeakReference<Application> weakReference = this.f2986b;
if (weakReference == null || weakReference.get() == null) {
throw new NullPointerException("Empty application context.");
}
h hVar = new h(this.f2986b.get());
Set<String> b10 = hVar.b();
HashSet hashSet = new HashSet();
if (!str.startsWith(DATADOME_COOKIE_PREFIX)) {
str = DATADOME_COOKIE_PREFIX + str;
}
if (b10 == null) {
b10 = new HashSet<>();
}
for (String str2 : b10) {
if (!str2.startsWith(DATADOME_COOKIE_PREFIX)) {
hashSet.add(str2);
}
}
hashSet.add(str);
hVar.c(hashSet);
}
public void logEvent(DataDomeEvent dataDomeEvent) {
if (f2983r.size() < 80) {
try {
f2983r.add(dataDomeEvent);
} catch (Exception unused) {
}
}
}
public String p() {
if (this.f2986b.get() == null) {
if (this.f2991g != null) {
logEvent(DataDomeSDK.a.NULL_CONTEXT.a("sdk"));
this.f2991g.onError(504, "Empty application context.");
}
return "";
}
Set<String> b10 = new h(this.f2986b.get()).b();
if (b10 != null) {
for (String str : b10) {
if (str.startsWith(DATADOME_COOKIE_PREFIX)) {
return str;
}
}
}
return "";
}
public void s() {
if (f2984s) {
return;
}
if (f2982q == null || new Date().getTime() - f2982q.getTime() > 10000) {
y(true);
new a(this).execute(new i(this.f2991g, this.f2986b, new j(c(), this.f2988d, this.f2989e, this.f2987c, this.userAgent, f2983r)));
}
}
}