AI Chat v1.1.8版本的 MD5 值为:1bcdce875f86738c8cfbf1e5f4064353
以下内容为反编译后的 n.java 源代码,内容仅作参考
package com.bytedance.sdk.openadsdk.core.settings;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.bytedance.sdk.component.utils.o;
import com.bytedance.sdk.component.utils.r;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.common.TTAdDislikeToast;
import com.bytedance.sdk.openadsdk.core.settings.TTSdkSettings;
import com.bytedance.sdk.openadsdk.core.settings.d;
import com.bytedance.sdk.openadsdk.core.settings.k;
import com.bytedance.sdk.openadsdk.n.aa;
import com.bytedance.sdk.openadsdk.n.y;
import com.google.android.gms.common.api.Api;
import java.io.File;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONObject;
public class n implements k.a {
private final h e;
private final j f;
private final AtomicBoolean g;
private volatile boolean h;
private boolean i;
private g j;
private final Runnable k;
private static final String c = aa.n();
private static final com.bytedance.sdk.component.g.g f1388d = new com.bytedance.sdk.component.g.g("TemplateReInitTask") {
@Override
public void run() {
com.bytedance.sdk.component.adexpress.a.b.c.a().g();
com.bytedance.sdk.component.adexpress.a.b.c.a().b(false);
com.bytedance.sdk.component.adexpress.a.b.a.b();
com.bytedance.sdk.component.adexpress.a.b.c.a().b();
}
};
public static String a = null;
public static String b = "IABTCF_TCString";
public static class a {
public static n a = new n();
}
public class b extends BroadcastReceiver {
private final Handler b;
private b() {
this.b = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
y.b(new com.bytedance.sdk.component.g.g("LoadLocalData") {
@Override
public void run() {
try {
n.this.c();
} catch (Exception unused) {
}
}
});
}
};
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
String action = intent.getAction();
com.bytedance.sdk.component.utils.l.b("SdkSettings", "onReceive: action=" + action);
if ("_tryFetRemoDat".equals(action)) {
n.this.a(intent.getIntExtra("_source", 0), intent.getBooleanExtra("_force", false));
} else if ("_dataChanged".equals(action)) {
this.b.removeMessages(0);
this.b.sendEmptyMessageDelayed(0, 10000L);
}
}
}
public static void Z() {
ab();
}
private static void ab() {
Context a2 = com.bytedance.sdk.openadsdk.core.n.a();
if (a2 != null) {
try {
Intent intent = new Intent();
intent.setPackage(a2.getPackageName());
intent.setAction("_dataChanged");
a2.sendBroadcast(intent);
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.c("SdkSettings", "", th);
}
}
}
private String ac() {
return this.f.a("force_language", "");
}
private boolean ad() {
return TextUtils.isEmpty(com.bytedance.sdk.openadsdk.core.h.c().e());
}
private int b(boolean z) {
return z ? 20 : 5;
}
private static void b(int i, boolean z) {
Context a2 = com.bytedance.sdk.openadsdk.core.n.a();
if (a2 != null) {
try {
Intent intent = new Intent();
intent.setPackage(a2.getPackageName());
intent.setAction("_tryFetRemoDat");
intent.putExtra("_force", z);
intent.putExtra("_source", i);
a2.sendBroadcast(intent);
} catch (Throwable unused) {
}
}
}
private static SharedPreferences c(Context context) {
try {
return PreferenceManager.getDefaultSharedPreferences(context);
} catch (Exception unused) {
return null;
}
}
public String A() {
return this.f.a("app_log_url", "");
}
public String B() {
return this.f.a("apm_url", "");
}
public int C() {
return this.f.a("coppa", -99);
}
public String D() {
return this.f.a("policy_url", "");
}
public String E() {
return this.f.a("consent_url", "https://lf-hs-sg.ibytedtos.com/obj/union-platform-i18n/union_platform_gdpr_607_en.html");
}
public int F() {
return this.f.a("ivrv_downward", 0);
}
public String G() {
return this.f.a("dyn_draw_engine_url", c);
}
public String H() {
return this.f.a("dc", "");
}
public int I() {
return this.f.a("isGdprUser", -1);
}
public int J() {
return this.f.a("vbtt", 5);
}
public boolean K() {
int a2 = this.f.a("privacy_ad_enable", Api.BaseClientBuilder.API_PRIORITY_OTHER);
if (a2 == 1) {
return true;
}
if (a2 == 0) {
return false;
}
int p = aa.p();
return p == 1 || p == 2 || p == 3;
}
public int L() {
int a2 = this.f.a("privacy_personalized_ad", Api.BaseClientBuilder.API_PRIORITY_OTHER);
if (a2 != Integer.MAX_VALUE) {
return a2;
}
int p = aa.p();
if (p == 1 || p == 2) {
return 2;
}
return p != 3 ? 0 : 1;
}
public boolean M() {
return this.f.a("privacy_sladar_enable", Api.BaseClientBuilder.API_PRIORITY_OTHER) == 1;
}
public boolean N() {
if ("VA".equalsIgnoreCase(H()) || aa.p() == 3) {
return false;
}
int a2 = this.f.a("privacy_sec_enable", Api.BaseClientBuilder.API_PRIORITY_OTHER);
if (a2 == 1) {
return true;
}
if (a2 == 0) {
return false;
}
int p = aa.p();
return p == 1 || p == 2 || p == 3;
}
public boolean O() {
return this.f.a("privacy_debug_unlock", 1) != 0;
}
public boolean P() {
return this.h;
}
public boolean Q() {
return this.f.a("global_rate", 1.0f) == 1.0f;
}
public boolean R() {
return this.f.a("read_video_from_cache", 1) == 1;
}
public int S() {
int a2 = this.f.a("webview_cache_count", 20);
if (a2 < 0) {
return 20;
}
return a2;
}
public int T() {
return this.f.a("blank_detect_rate", 30);
}
public JSONObject U() {
return (JSONObject) this.f.a("video_cache_config", null, d.a);
}
public long V() {
long a2 = this.f.a("req_inter_min", TTAdConstant.AD_MAX_EVENT_TIME);
return (a2 < 0 || a2 > com.anythink.expressad.foundation.g.a.bV) ? TTAdConstant.AD_MAX_EVENT_TIME : a2;
}
public long W() {
return this.f.a("last_req_time", 0L);
}
public void X() {
this.i = true;
}
public void Y() {
if (r.a(com.bytedance.sdk.openadsdk.core.n.a())) {
com.bytedance.sdk.openadsdk.core.l.b().removeCallbacks(this.k);
long V = com.bytedance.sdk.openadsdk.core.n.d().V();
com.bytedance.sdk.component.utils.l.b("SdkSettings", "scheduleAutoFetchTask, nextTimeDelay=" + V);
com.bytedance.sdk.openadsdk.core.l.b().postDelayed(this.k, V);
}
}
public void a() {
File file;
try {
com.bytedance.sdk.openadsdk.core.settings.b.a();
this.f.c();
this.e.c();
Context a2 = com.bytedance.sdk.openadsdk.core.n.a();
int i = Build.VERSION.SDK_INT;
if (i >= 24) {
file = new File(a2.getDataDir(), "shared_prefs");
} else {
file = new File(a2.getDatabasePath("1").getParentFile().getParentFile(), "shared_prefs");
}
File file2 = new File(file, "tt_sdk_settings.xml");
if (file2.exists() && file2.isFile()) {
String replace = file2.getName().replace(".xml", "");
if (i >= 24) {
a2.deleteSharedPreferences(replace);
return;
}
a2.getSharedPreferences(replace, 0).edit().clear().apply();
com.bytedance.sdk.component.utils.f.c(file2);
}
} catch (Throwable unused) {
}
}
public int d() {
return this.f.a("max_tpl_cnts", 100);
}
public JSONObject e() {
return (JSONObject) this.f.a("digest", null, d.a);
}
public long f() {
return this.f.a("data_time", 0L);
}
public void g() {
this.f.a().a("tt_sdk_settings").a("ab_test_param").a();
}
public boolean h() {
return this.f.a("if_both_open", 0) == 1;
}
public boolean i() {
return !(this.f.a("support_tnc", 1) == 0);
}
public String j() {
return this.f.a("ab_test_version", "");
}
public int k() {
return this.f.a("load_callback_strategy", 0);
}
public boolean l() {
return this.f.a("support_mem_dynamic", 0) == 1;
}
public int m() {
return this.f.a("loadedCallbackOpportunity", 0);
}
public String n() {
return this.f.a("ab_test_param", "");
}
public g o() {
g gVar = this.j;
if (gVar != null) {
return gVar;
}
g gVar2 = (g) this.e.a("mediation_init_conf", g.a, new d.b<g>() {
@Override
public g b(String str) {
return new g(str);
}
});
this.j = gVar2;
return gVar2;
}
public boolean p() {
return this.f.a("landingpage_new_style", -1) == 1;
}
public long q() {
return this.f.a(com.anythink.expressad.foundation.d.r.ag, 10000L);
}
public int r() {
return this.f.a("max", 50);
}
public String s() {
return this.f.a("pyload_h5", (String) null);
}
public e t() {
return (e) this.f.a("insert_js_config", e.a, new d.b<e>() {
@Override
public e b(String str) {
return new e(str);
}
});
}
public String u() {
return this.f.a("playableLoadH5Url", "");
}
public int v() {
int a2 = this.f.a("fetch_tpl_timeout_ctrl", 3000);
if (a2 <= 0) {
return 3000;
}
return a2;
}
public void w() {
if (Build.VERSION.SDK_INT >= 17) {
String ac = ac();
if (TextUtils.isEmpty(ac)) {
return;
}
if (ac.equals("zh-Hant")) {
com.bytedance.sdk.component.utils.i.a(com.bytedance.sdk.openadsdk.core.n.a(), com.anythink.expressad.video.dynview.a.a.Q, "tw");
} else {
com.bytedance.sdk.component.utils.i.a(com.bytedance.sdk.openadsdk.core.n.a(), ac, null);
}
TTAdDislikeToast.a();
}
}
public int x() {
return this.f.a("disable_rotate_banner_on_dislike", Api.BaseClientBuilder.API_PRIORITY_OTHER);
}
public boolean y() {
return this.f.b();
}
public String z() {
return this.f.a("ads_url", "");
}
private n() {
this.e = new h();
this.f = new j();
this.g = new AtomicBoolean(false);
this.h = false;
this.i = false;
this.k = new Runnable() {
@Override
public void run() {
com.bytedance.sdk.component.utils.l.b("SdkSettings", "auto fetch task active, try fetch remote data");
n.this.c(2);
n.this.Y();
}
};
try {
Context a2 = com.bytedance.sdk.openadsdk.core.n.a();
IntentFilter intentFilter = new IntentFilter();
if (r.a(a2)) {
intentFilter.addAction("_tryFetRemoDat");
} else {
intentFilter.addAction("_dataChanged");
}
a2.registerReceiver(new b(), intentFilter);
} catch (Exception e) {
com.bytedance.sdk.component.utils.l.c("SdkSettings", "", e);
}
}
public boolean A(String str) {
Set set = (Set) this.f.a("privacy_fields_allowed", Collections.emptySet(), d.b);
if (set.isEmpty()) {
int p = aa.p();
if (p != 1) {
if (p == 2 || p == 3) {
return "mcc".equals(str) || "mnc".equals(str);
}
return false;
}
return true;
}
return set.contains(str);
}
public synchronized void c() {
com.bytedance.sdk.component.utils.l.b("SdkSettings", "loadLocalData: ");
long elapsedRealtime = SystemClock.elapsedRealtime();
boolean z = !this.h;
this.e.a(this.h);
this.f.a(this.h);
com.bytedance.sdk.openadsdk.core.settings.b.a(z);
com.bytedance.sdk.openadsdk.core.h.c().d(C());
this.h = true;
com.bytedance.sdk.component.utils.l.a("SdkSettings", "loadLocalData: finished, used", Long.valueOf(SystemClock.elapsedRealtime() - elapsedRealtime), "ms");
if (z && r.a(com.bytedance.sdk.openadsdk.core.n.a())) {
com.bytedance.sdk.openadsdk.core.l.b().postDelayed(new Runnable() {
@Override
public void run() {
n.this.c(1);
n.this.Y();
}
}, 1000L);
}
}
public boolean d(String str) {
int i = y(str).e;
if (i != 1) {
return i == 2 && o.c(com.bytedance.sdk.openadsdk.core.n.a()) != 0;
}
return o.d(com.bytedance.sdk.openadsdk.core.n.a());
}
public boolean e(String str) {
return y(str).g == 1;
}
public int f(String str) {
return y(str).q;
}
public boolean g(String str) {
return str == null || y(str).m == 1;
}
public int h(String str) {
if (str == null) {
return 1500;
}
return y(str).o;
}
public int i(String str) {
return y(str).k;
}
public boolean j(String str) {
try {
return y(str).v != null;
} catch (Exception unused) {
return false;
}
}
public boolean k(String str) {
try {
return y(str).w == 8;
} catch (Exception e) {
com.bytedance.sdk.component.utils.l.c("SdkSettings", "", e);
return false;
}
}
public int l(String str) {
return y(String.valueOf(str)).h;
}
public boolean m(String str) {
return l(str) != 1;
}
public int n(String str) {
return y(str).j;
}
public boolean p(String str) {
return str == null || y(str).l == 1;
}
public int q(String str) {
return y(str).s;
}
public boolean r(String str) {
return y(str).t;
}
public int s(String str) {
return y(str).y;
}
public int t(String str) {
return y(str).z;
}
public int u(String str) {
return y(str).A;
}
public boolean v(String str) {
return y(str).C;
}
public boolean x(String str) {
return com.bytedance.sdk.openadsdk.core.n.d().y(str).n == 1;
}
public com.bytedance.sdk.openadsdk.core.settings.a y(String str) {
return com.bytedance.sdk.openadsdk.core.settings.b.a(str);
}
public void z(String str) {
com.bytedance.sdk.openadsdk.core.settings.b.b(str);
}
public boolean o(String str) {
return y(str).u == 0;
}
public static String b(Context context) {
SharedPreferences c2;
return (context == null || (c2 = c(context)) == null) ? "" : c2.getString(b, "");
}
public boolean w(String str) {
return y(str).D;
}
public static n b() {
return a.a;
}
public void b(JSONObject jSONObject, d.a aVar) {
if (jSONObject.has("is_gdpr_user")) {
int i = -1;
int optInt = jSONObject.optInt("is_gdpr_user", -1);
if (optInt == -1 || optInt == 1 || optInt == 0) {
i = optInt;
}
aVar.a("isGdprUser", i);
}
}
public boolean b(String str) {
return y(str).c == 1;
}
public boolean c(String str) {
return y(str).B;
}
public int b(int i) {
return y(String.valueOf(i)).i;
}
public void c(@TTSdkSettings.FETCH_REQUEST_SOURCE int i) {
a(i, false);
}
public static int a(Context context) {
SharedPreferences c2;
if (context == null || (c2 = c(context)) == null) {
return -2;
}
if ((c2.getInt("IABTCF_CmpSdkID", Integer.MIN_VALUE) == Integer.MIN_VALUE && c2.getInt("IABTCF_CmpSdkVersion", Integer.MIN_VALUE) == Integer.MIN_VALUE) ? false : true) {
return c2.getInt("IABTCF_gdprApplies", -1);
}
return -2;
}
public void a(JSONObject jSONObject, d.a aVar) {
if (jSONObject == null || !jSONObject.has("dyn_draw_engine_url")) {
return;
}
j jVar = this.f;
String str = c;
String a2 = jVar.a("dyn_draw_engine_url", str);
String optString = jSONObject.optString("dyn_draw_engine_url", str);
if (!TextUtils.isEmpty(a2) && !TextUtils.isEmpty(optString) && !optString.equals(a2)) {
com.bytedance.sdk.openadsdk.core.l.b().postDelayed(new Runnable() {
@Override
public void run() {
y.a(n.f1388d);
}
}, 5000L);
}
aVar.a("dyn_draw_engine_url", optString);
}
public int a(String str) {
if (str == null) {
return 0;
}
return com.bytedance.sdk.openadsdk.core.n.d().y(str).r;
}
public int a(String str, boolean z) {
if (str == null) {
return b(z);
}
int i = y(str).x;
return i != -1 ? i : b(z);
}
public int a(int i) {
return y(String.valueOf(i)).b;
}
public void a(long j) {
this.f.a().a("last_req_time", j).a();
}
public void a(@TTSdkSettings.FETCH_REQUEST_SOURCE int i, boolean z) {
try {
if (ad()) {
return;
}
long W = com.bytedance.sdk.openadsdk.core.n.d().W();
long currentTimeMillis = System.currentTimeMillis();
long V = com.bytedance.sdk.openadsdk.core.n.d().V();
long j = currentTimeMillis - W;
String str = "fetchRemoteSdkSettings: lastReq=" + W + ", dis=" + j + "/" + V + ", force=" + z + ", source=" + i;
if (!z && j < V) {
com.bytedance.sdk.openadsdk.core.f.a.a();
} else if (!r.a(com.bytedance.sdk.openadsdk.core.n.a())) {
b(i, z);
} else if (this.g.compareAndSet(false, true)) {
y.b(new k(this, this.f, this.e));
com.bytedance.sdk.openadsdk.core.l.b().removeCallbacks(this.k);
}
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.a("SdkSettings", "load sdk settings error: ", th);
}
}
@Override
public void a(boolean z) {
String str = "onFetchFinish() called with: dataChanged = [" + z + "]";
this.g.set(false);
Y();
if (z) {
ab();
}
}
}