package com.apkpure.aegon.application; import android.app.Application; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import androidx.work.Configuration; import androidx.work.WorkManager; import com.apkpure.aegon.R; import com.apkpure.aegon.logevent.model.LogNetworkInfo; import com.apkpure.aegon.plugin.login.api.IGoogleAuth; import com.apkpure.aegon.plugin.login.api.IHostApplicationForLogin; import com.apkpure.aegon.plugin.login.api.ILoginService; import com.apkpure.aegon.plugin.topon.api1.IHostApplication; import com.apkpure.aegon.plugin.topon.api1.ITopOnService; import com.apkpure.components.clientchannel.channel.headers.UserInfo; import com.apkpure.crabshell.GlobalConst; import com.google.android.gms.common.internal.ServiceSpecificExtraArgs; import com.tencent.qqdownloader.ionia.event.api.IEventService; import com.tencent.qqlive.module.videoreport.inner.VideoReportInner; import com.tencent.raft.raftframework.RAFT; import com.tencent.raft.raftframework.config.RaftConfig; import com.tencent.trpcprotocol.projecta.projecta_common_util_svr.projecta_common_util_svr.nano.PendantReq; import com.yalantis.ucrop.view.CropImageView; import e.g.a.c.n.p.n; import e.g.a.e.e.y; import e.g.a.e.f.d2; import e.g.a.e.f.g2; import e.g.a.e.f.n2.k; import e.g.a.e.i.f; import e.g.a.e.k.l.h1; import e.g.a.e0.m; import e.g.a.f.p; import e.g.a.f.s; import e.g.a.h.d.b.g; import e.g.a.i0.c0; import e.g.a.i0.g0; import e.g.a.i0.i0; import e.g.a.i0.m0; import e.g.a.i0.s0; import e.g.a.i0.t0; import e.g.a.i0.u0; import e.g.a.i0.z; import e.g.a.l.b0; import e.g.a.l.e0; import e.g.a.l.o; import e.g.a.o.h; import e.g.a.t.a.p0; import e.g.a.v.l; import e.g.c.a.d; import e.g.c.d.b1.q; import e.g.c.d.b1.r; import e.g.c.d.j0; import e.g.c.d.r0; import e.g.c.d.t; import e.l.c.l.i; import java.io.File; import java.lang.reflect.Field; import java.util.Iterator; import java.util.Locale; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import o.s.c.j; public class RealApplicationLike extends e.w.b.b implements IHostApplication, IHostApplicationForLogin { public static final String BETA_PROCESS_NAME = "com.apkpure.aegon:beta"; public static final String MAIN_PROCESS_NAME = "com.apkpure.aegon"; private static boolean allTopOnAdSwitch = true; private static e.g.a.b.d channelConfig = null; private static boolean interstitialEnable = true; private static s.e.a logger; private static volatile RealApplicationLike mApp; public static Application mApplication; public static Context mContext; public static p operatorRecorder = new p("RealApplicationLike"); private f.b settingEventReceiver = null; public static class FTNetworkReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Boolean valueOf = Boolean.valueOf(u0.n(RealApplicationLike.getContext())); ((s.e.c) RealApplicationLike.logger).d("FTNetworkReceiver onReceive : {}", valueOf); RealApplicationLike.updateVpnInfo(valueOf); } } public class a implements f.a { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ Application f1166a; public a(Application application) { this.f1166a = application; } @Override // e.g.a.e.i.f.a public void a(Context context, String str) { if ("language".equals(str)) { d2.f(context).b(); g2.e(context, true); Context context2 = RealApplicationLike.getContext(); int i2 = o.f6677s; b0.a aVar = b0.f6643j; j.e(context2, "context"); b0 b0Var = b0.f6644k; b0Var.c = CropImageView.DEFAULT_ASPECT_RATIO; b0Var.d = CropImageView.DEFAULT_ASPECT_RATIO; b0Var.f6647e = CropImageView.DEFAULT_ASPECT_RATIO; b0Var.b(context2, R.string.arg_RES_2131821089); b0 b0Var2 = b0.f6645l; if (b0Var2 != null) { b0Var2.c = CropImageView.DEFAULT_ASPECT_RATIO; b0Var2.d = CropImageView.DEFAULT_ASPECT_RATIO; b0Var2.f6647e = CropImageView.DEFAULT_ASPECT_RATIO; b0Var2.b(context2, R.string.arg_RES_2131821089); } this.f1166a.getSharedPreferences("last_run_time", 0).edit().remove("update_trending_searches").apply(); e.g.a.a0.c.e.b bVar = e.g.a.a0.c.e.b.f4835e; e.g.a.a0.c.e.b.d().b(); RealApplicationLike.this.preLoadGarbageScanRuleLanguage(); e.g.a.x.f5.c.f7388e.clear(); e.g.a.x.f5.c.i(); h.d = true; e.g.a.a0.d.f.f4866a.a(this.f1166a); PendantReq pendantReq = new PendantReq(); pendantReq.page = new String[]{"chat"}; d.a c = e.d.a.a.a.c("chat_robot_pendant"); c.f7803e = pendantReq; c.c(String.class, new e.g.a.h.d.b.f(null)); c.b(g.b); c.e(); } else if ("region".equals(str)) { e.g.a.b.d channelConfig = RealApplicationLike.getChannelConfig(); String d = e.g.a.z.d.d(); UserInfo userInfo = channelConfig.o().getUserInfo(); if (d == null) { d = ""; } userInfo.setCountryCode(d); e.g.a.a0.c.e.b bVar2 = e.g.a.a0.c.e.b.f4835e; e.g.a.a0.c.e.b.d().b(); } } } public class b implements Runnable { public b(RealApplicationLike realApplicationLike) { } public void run() { String str = t0.f6566a; int i2 = AegonApplication.f1165e; String F = i.i.g.c.F(RealApplicationLike.getApplication(), "key_silent_time"); if (System.currentTimeMillis() - (!TextUtils.isEmpty(F) ? Long.parseLong(F) : 0) >= 43200000) { Application application = RealApplicationLike.getApplication(); i.i.g.c.X(application, "key_silent_time", System.currentTimeMillis() + ""); Iterator<String> it = t0.b.iterator(); while (it.hasNext()) { e.g.a.i0.f2.a.a().post(new s0(it.next())); } } try { c0.a(); } catch (Throwable th) { th.printStackTrace(); i.a().c(th); } } } public class c extends ConcurrentHashMap<String, Object> { public c() { } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // java.util.AbstractMap, java.util.Map, java.util.concurrent.ConcurrentHashMap public Object put(String str, Object obj) { String str2 = str; if (str2 != null && obj != null) { return super.put(str2, obj); } if (str2 != null) { remove(str2); } return null; } } public class d implements s.e.d { public d(RealApplicationLike realApplicationLike) { } public void a(String str, String str2) { try { i a2 = i.a(); a2.b("tag: " + str + " msg: " + str2); } catch (Throwable th) { th.printStackTrace(); } } } public static class e extends ConnectivityManager.NetworkCallback { public e(a aVar) { } public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) { super.onCapabilitiesChanged(network, networkCapabilities); Boolean valueOf = Boolean.valueOf(u0.n(RealApplicationLike.getContext())); ((s.e.c) RealApplicationLike.logger).d("onCapabilitiesChanged: {}", valueOf); RealApplicationLike.updateVpnInfo(valueOf); } } public class f implements Executor { public Executor b = Executors.newFixedThreadPool(Math.max(2, Math.min(Runtime.getRuntime().availableProcessors() - 1, 4))); public f(RealApplicationLike realApplicationLike) { } public void execute(Runnable runnable) { this.b.execute(new e.g.a.f.d(runnable)); } } /* access modifiers changed from: private */ /* renamed from: a */ public void b(Application application) { g2.d(application); try { e.g.a.e0.i.m(application); } catch (Throwable th) { th.printStackTrace(); } f.b bVar = new f.b(application, new a(application)); this.settingEventReceiver = bVar; bVar.a(0); } /* access modifiers changed from: private */ /* renamed from: c */ public void d(Application application, long j2) { e.g.a.h0.b.h.e(); initXInstaller(application); registerBroadcastReceiver(); initPopUpNotification(application); ((s.e.c) logger).d("application onCreate section 3. use time: {}", Long.valueOf(System.currentTimeMillis() - j2)); i0.b(application); g0.h(application); ((s.e.c) logger).d("application onCreate section 4. use time: {}", Long.valueOf(System.currentTimeMillis() - j2)); if (i.i.d.c.J(application)) { new e.g.a.s.h(application).a(); } e.g.a.i.h0.h.b(); e.g.a.z.n.g.g(application); e0.s(application); e.g.a.l.i0.b.a().b(application); int i2 = AegonApplication.f1165e; e.g.a.r.d.a aVar = new e.g.a.r.d.a(getApplication()); if (3190947 > aVar.q()) { l.a(application); aVar.w(3190947); } y.f5354a.e(getContext()); i.i.d.c.Z(application); e.g.a.k0.a.a aVar2 = e.g.a.k0.a.a.f6641a; j.e(getContext(), "context"); o.k(getContext()); j.e(getApplication(), "application"); e.g.a.c.n.g.i(getApplication()); e.g.a.t.a.s0.f7110a.b(); e.g.a.i0.c2.h.a(); e.g.a.c.k.e.f(getContext()); e.g.a.n.c.c(); e.g.a.x.f5.c.h(); e.g.a.x.f5.h.a(); e.g.a.e.d.l.b(); PendantReq pendantReq = new PendantReq(); pendantReq.page = new String[]{"chat"}; d.a c2 = e.d.a.a.a.c("chat_robot_pendant"); c2.f7803e = pendantReq; c2.c(String.class, new e.g.a.h.d.b.f(null)); c2.b(g.b); c2.e(); } private void changeSubProcessWebViewDataDirectory(Application application) { try { i.i.d.c.B(application); } catch (Throwable th) { s.e.a aVar = logger; StringBuilder Z = e.d.a.a.a.Z("changeSubProcessWebViewDataDirectory "); Z.append(th.getMessage()); i.i.g.c.d0(((s.e.c) aVar).f16991a, Z.toString()); } } public static void e(LogNetworkInfo logNetworkInfo) { e.g.a.d0.a.e(15, logNetworkInfo); s.e.a aVar = logger; logNetworkInfo.j(); Objects.requireNonNull((s.e.c) aVar); } public static Application getApplication() { return mApplication; } public static e.g.a.b.d getChannelConfig() { if (channelConfig == null) { channelConfig = new e.g.a.b.d(getApplication()); } return channelConfig; } public static Context getContext() { return mContext; } public static e.w.b.a getInstance() { if (mApp == null) { synchronized (RealApplicationLike.class) { if (mApp == null) { mApp = new RealApplicationLike(); } } } return mApp; } public static void initClientChannel() { try { d.b bVar = e.g.c.a.d.f7798e; bVar.c(getChannelConfig()); bVar.b(); } catch (Exception e2) { s.e.a aVar = logger; i.i.g.c.d0(((s.e.c) aVar).f16991a, e.d.a.a.a.u(e2, e.d.a.a.a.Z("init client channel exception: "))); } } private void initLogger(Application application) { i.i.g.c.b = application.getFilesDir().getAbsolutePath() + "/log"; File file = new File(i.i.g.c.b); if (!file.exists()) { file.mkdir(); } i.i.g.c.c = new d(this); s.e.c cVar = new s.e.c("ApkApplicationLike"); logger = cVar; cVar.d("\n\ninit logger done: {}", e.g.d.a.a()); } private void initPopUpNotification(Application application) { try { e.g.a.a0.c.c.f4832a.d(application); e.g.a.a0.c.f.b bVar = e.g.a.a0.c.f.b.f4842h; e.g.a.a0.c.f.b.e(application); e.g.a.m.e.f6729e.a().a(application); e.g.a.a0.d.f.f4866a.a(application); new e.g.a.a0.c.e.l().b(); } catch (Exception e2) { s.e.a aVar = logger; i.i.g.c.d0(((s.e.c) aVar).f16991a, e.d.a.a.a.u(e2, e.d.a.a.a.Z("init popup notification exception: "))); } } private void initWorkManager() { try { WorkManager.initialize(getApplication(), new Configuration.Builder().setTaskExecutor(new f(this)).setMinimumLoggingLevel(4).build()); } catch (Exception e2) { s.e.a aVar = logger; i.i.g.c.d0(((s.e.c) aVar).f16991a, e.d.a.a.a.u(e2, e.d.a.a.a.Z("init work manager exception: "))); } } private void initXInstaller(Application application) { try { r0 r0Var = new r0(); j.e(r0Var, "log"); j.e(r0Var, "log"); if (!e.g.c.d.d1.e.c) { e.g.c.d.d1.e.c = true; e.g.c.d.d1.e.b = r0Var; Locale c2 = e.g.a.z.d.c(); j.e(c2, "locale"); j0.f7948e = c2; j.e(application, "application"); j0.d = application; t tVar = t.f7966a; j.e(application, "application"); application.registerActivityLifecycleCallbacks(t.d); q qVar = q.f7905a; j.e(application, "application"); q.a aVar = q.c; j.e(aVar, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER); t.c.c(aVar); e.g.c.d.a1.g gVar = new e.g.c.d.a1.g(); r rVar = new r(qVar); j.e(rVar, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER); gVar.f7885a = rVar; gVar.a(application); return; } throw new Exception("LogUtil has been initialized, please do not repeat the initialization."); } catch (Exception e2) { s.e.a aVar2 = logger; i.i.g.c.d0(((s.e.c) aVar2).f16991a, e.d.a.a.a.u(e2, e.d.a.a.a.Z("init xInstaller exception: "))); } } private static void lambda$registerBroadcastReceiver$3(int i2, String str, String str2) { i.i.g.c.d0(((s.e.c) logger).f16991a, str2); } private void pingHost(Application application) { i.i.g.c.F(application, "pingHost"); Objects.requireNonNull((s.e.c) logger); if (TextUtils.equals(i.i.g.c.K(), MAIN_PROCESS_NAME) && TextUtils.equals("0", "0")) { Objects.requireNonNull((s.e.c) logger); u0.r(application, "tapi.pureapk.com", "https://tapi.pureapk.com/v3", e.g.a.f.b.f5751a); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void preLoadGarbageScanRuleLanguage() { try { e.g.a.q.l.c0.f7039a.g(); } catch (Throwable th) { ((s.e.c) logger).d("Pre load garbage scan rule language", th.getMessage()); } } private void registerBroadcastReceiver() { IEventService iEventService = (IEventService) RAFT.get(IEventService.class); iEventService.a(mContext, "ionia.intent.action.USER_PRESENT", "com.tencent.assistant.permission.A_PERMISSION"); iEventService.a(mContext, "ionia.intent.action.RETURN_HOME", "com.tencent.assistant.permission.A_PERMISSION"); } private static void registerNetworkCallback(Context context) { int i2 = Build.VERSION.SDK_INT; if (i2 >= 21) { if (i2 >= 26) { ((ConnectivityManager) context.getSystemService("connectivity")).registerDefaultNetworkCallback(new e(null)); } else { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); context.registerReceiver(new FTNetworkReceiver(), intentFilter); } i.i.g.c.d0(((s.e.c) logger).f16991a, "registerNetworkCallback success"); } } private void setDTPublicParamsAsConcurrentMap() { VideoReportInner instance = VideoReportInner.getInstance(); c cVar = new c(); try { Field declaredField = VideoReportInner.class.getDeclaredField("mPublicParam"); declaredField.setAccessible(true); declaredField.set(instance, cVar); } catch (Exception e2) { e2.printStackTrace(); } ((s.e.c) logger).d("set dt public params map as concurrent map versionInfo:{} ", z.a()); } public static void setInterstitialEnable() { interstitialEnable = true; } public static void setTopOnAdEnable() { allTopOnAdSwitch = true; } /* access modifiers changed from: private */ public static void updateVpnInfo(Boolean bool) { e.g.a.b.d channelConfig2 = getChannelConfig(); boolean booleanValue = bool.booleanValue(); Objects.requireNonNull(channelConfig2); String k2 = j.k("useVpn change: ", Boolean.valueOf(booleanValue)); j.e("AccessConfig", "tag"); j.e(k2, "message"); e.g.c.a.i.g gVar = e.g.c.a.k.d.b; if (gVar != null) { gVar.d(j.k("ClientChannel|", "AccessConfig"), k2); } else { j.k("ClientChannel|", "AccessConfig"); } e.g.a.b.d.f4876o = booleanValue; e.g.a.h0.b.h.q(); e.g.a.i0.y.d("useVpn", bool.booleanValue() ? "1" : "0"); } /* JADX WARNING: Removed duplicated region for block: B:18:0x0089 */ @Override // e.w.b.b, e.w.b.a public void attachBaseContext(Application application) { super.attachBaseContext(application); if (!RAFT.isInit()) { boolean z = true; RAFT.init(application, RaftConfig.createBuilder().setForceCheck(true).build()); initLogger(application); s.e.a aVar = e.g.d.a.f8012a; boolean z2 = application.getSharedPreferences("keepLiveFlag", 0).getBoolean("keepAliveOpen", true); ((s.e.c) logger).e("Process name: {}, isKeepAlive: {}", i.i.g.c.K(), Boolean.valueOf(z2)); if (z2) { String valueOf = String.valueOf((int) GlobalConst.VERSIONCODE); if (valueOf != null) { String string = application.getSharedPreferences("keepLiveFlag", 0).getString("ignoreKeepLiveOpenVersion", "0"); if (!TextUtils.isEmpty(string)) { String[] split = string.split("\\|"); if (split.length != 0) { int length = split.length; int i2 = 0; while (true) { if (i2 >= length) { break; } else if (valueOf.equals(split[i2])) { break; } else { i2++; } } ((s.e.c) logger).e("Process name: {}, isIgnoreVersion: {}", i.i.g.c.K(), Boolean.valueOf(z)); if (!z) { e.g.d.a.d(application); ((s.e.c) logger).d("Process name: {}, KeepAlive start success.", i.i.g.c.K()); } } } } z = false; ((s.e.c) logger).e("Process name: {}, isIgnoreVersion: {}", i.i.g.c.K(), Boolean.valueOf(z)); if (!z) { } } } e.g.a.f.r.a().b(s.APP_BASE_INIT); } @Override // com.apkpure.aegon.plugin.login.api.IHostApplicationForLogin public void onBindLoginService(ILoginService iLoginService) { e.g.a.e0.e.c = iLoginService; } @Override // e.w.b.b, e.w.b.a public void onCreate(Application application) { ((s.e.c) logger).e("Process name: {} ,application onCreate begin. versionInfo: {}", i.i.g.c.K(), z.a()); super.onCreate(application); mApplication = application; mContext = application.getApplicationContext(); String K = i.i.g.c.K(); boolean z = TextUtils.isEmpty(K) || K.equals(application.getApplicationContext().getPackageName()); changeSubProcessWebViewDataDirectory(application); if (!z) { ((s.e.c) logger).d("Process name: {} ,application onCreate end.", i.i.g.c.K()); return; } p pVar = operatorRecorder; synchronized (pVar.b) { pVar.b.clear(); } operatorRecorder.a("real_application_like_on_create"); setDTPublicParamsAsConcurrentMap(); m0.b(); initClientChannel(); z.b(); long currentTimeMillis = System.currentTimeMillis(); if (e.g.a.z.d.f7528e == null) { synchronized (e.g.a.z.d.class) { if (e.g.a.z.d.f7528e == null) { e.g.a.z.d.f7528e = new e.g.a.z.d(application); e.g.a.b.d channelConfig2 = getChannelConfig(); Locale c2 = e.g.a.z.d.c(); Objects.requireNonNull(channelConfig2); if (c2 != null) { UserInfo userInfo = channelConfig2.o().getUserInfo(); String c0 = i.i.g.c.c0(c2); j.d(c0, "toLanguageTag(locale)"); userInfo.setLanguage(c0); UserInfo userInfo2 = channelConfig2.o().getUserInfo(); String displayCountry = c2.getDisplayCountry(); j.d(displayCountry, "locale.displayCountry"); userInfo2.setCountry(displayCountry); } e.g.a.b.d channelConfig3 = getChannelConfig(); String d2 = e.g.a.z.d.d(); UserInfo userInfo3 = channelConfig3.o().getUserInfo(); if (d2 == null) { d2 = ""; } userInfo3.setCountryCode(d2); } } } initWorkManager(); k.d(); registerNetworkCallback(getContext()); int i2 = m.b; h1.b(); new Handler(Looper.getMainLooper()).postDelayed(new e.g.a.f.c(this, application), 200); getApplication().setTheme(R.style.arg_RES_2131886089); ((s.e.c) logger).d("application onCreate section 2. use time: {}", Long.valueOf(System.currentTimeMillis() - currentTimeMillis)); p0 p0Var = p0.f7108a; p0Var.a(getContext()); p0Var.c(getContext()); e.g.a.i0.y.a(getContext()); e.g.a.c.c.b(); n.l(); e.g.a.f.f.b().i(); e.g.a.c.n.e.a(getApplication()); e.g.a.h0.b.h.f(); e.g.a.h0.a.g.a(); i.i.g.c.O().a(new e.g.a.f.e(this, application, currentTimeMillis)); i.i.g.c.O().a(e.g.a.f.a.b); e.g.a.f.r.a().b(s.APP_CREATE); e.g.a.i0.f2.a.a().postDelayed(new b(this), 5000); ((s.e.c) logger).g("Process name: {} ,application onCreate end. use time: {} versionInfo: {}", i.i.g.c.K(), Long.valueOf(System.currentTimeMillis() - currentTimeMillis), z.a()); operatorRecorder.a("splash_activity_start"); } @Override // com.apkpure.aegon.plugin.login.api.IHostApplicationForLogin public void onGetPluginLogin(IGoogleAuth iGoogleAuth) { e.g.a.e0.e.a().b(iGoogleAuth); } @Override // com.apkpure.aegon.plugin.topon.api1.IHostApplication public void onServiceCreated(ITopOnService iTopOnService) { s.e.a aVar = logger; StringBuilder Z = e.d.a.a.a.Z("------onServiceCreated------"); Z.append(allTopOnAdSwitch); ((s.e.c) aVar).d("PluginDownloadManager", Z.toString()); e.g.a.c.c.e(iTopOnService); } }