package com.lt.app; import android.app.Activity; import android.app.Application; import android.content.ComponentCallbacks; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.graphics.Point; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkInfo; import android.net.NetworkRequest; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.d.b; import android.text.TextUtils; import android.view.WindowManager; import com.d.a.b.e; import com.d.a.b.f; import com.d.b.b.c; import com.d.b.k; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.huawei.hms.support.api.entity.core.JosStatusCodes; import com.lt.app.a.n; import com.lt.app.a.s; import com.lt.app.a.t; import com.lt.app.c.o; import com.lt.app.c.p; import com.lt.app.c.q; import com.lt.plugin.an; import com.lt.plugin.as; import com.lt.plugin.au; import com.lt.plugin.u; import com.meizu.cloud.pushsdk.constants.PushConstants; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.util.HashMap; import java.util.Map; import java.util.UUID; import me.dhtv.app.R; import org.json.JSONObject; public class App extends b implements Application.ActivityLifecycleCallbacks { /* renamed from: ʻ reason: contains not printable characters */ private static App f5951; /* renamed from: ʼ reason: contains not printable characters */ private int f5952; /* renamed from: ʽ reason: contains not printable characters */ private String f5953; /* renamed from: ʾ reason: contains not printable characters */ private String f5954 = " LT-APP/44"; /* renamed from: ʿ reason: contains not printable characters */ private long f5955; /* renamed from: ˆ reason: contains not printable characters */ private long f5956; /* renamed from: ˈ reason: contains not printable characters */ private long f5957; /* renamed from: ˉ reason: contains not printable characters */ private com.lt.app.c.a f5958 = null; /* renamed from: ˊ reason: contains not printable characters */ private int f5959; /* renamed from: ˋ reason: contains not printable characters */ private ConnectivityManager f5960; /* renamed from: ˎ reason: contains not printable characters */ private boolean f5961 = true; /* renamed from: ˏ reason: contains not printable characters */ private boolean f5962 = false; /* renamed from: ˑ reason: contains not printable characters */ private String f5963 = null; /* renamed from: י reason: contains not printable characters */ private String f5964 = null; /* renamed from: ـ reason: contains not printable characters */ private String f5965 = null; /* renamed from: ٴ reason: contains not printable characters */ private String f5966 = null; /* renamed from: ᐧ reason: contains not printable characters */ private Activity f5967; public interface a { void onCompleted(com.lt.app.c.a aVar); } public void onActivityCreated(Activity activity, Bundle bundle) { } public void onActivityPaused(Activity activity) { } public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } public void onCreate() { super.onCreate(); this.f5959 = 0; registerActivityLifecycleCallbacks(this); com.lt.app.a.b.m8245().m8248(); f5951 = this; this.f5955 = m8151().getLong("k_x", 0); this.f5956 = m8151().getLong("k_x2", 0); this.f5957 = m8151().getLong("k_x3", 0); try { this.f5953 = getPackageName(); this.f5952 = 101; this.f5954 = " LT-APP/44/" + this.f5952; } catch (Exception e) { e.printStackTrace(); } m8131(); e.m8573(this); } /* access modifiers changed from: protected */ @Override // android.support.d.b public void attachBaseContext(Context context) { super.attachBaseContext(context); f5951 = this; e.m8574(this, context); } /* renamed from: ʻ reason: contains not printable characters */ public boolean m8137() { boolean z = true; if (Build.VERSION.SDK_INT < 21) { return true; } if (this.f5960 == null) { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity"); this.f5960 = connectivityManager; if (connectivityManager != null) { AnonymousClass1 r0 = new ConnectivityManager.NetworkCallback() { /* class com.lt.app.App.AnonymousClass1 */ public void onAvailable(Network network) { App.this.f5961 = true; } public void onLost(Network network) { App.this.f5961 = false; } }; if (Build.VERSION.SDK_INT >= 24) { this.f5960.registerDefaultNetworkCallback(r0); } else { this.f5960.registerNetworkCallback(new NetworkRequest.Builder().build(), r0); } NetworkInfo activeNetworkInfo = this.f5960.getActiveNetworkInfo(); if (activeNetworkInfo == null || !activeNetworkInfo.isConnected() || activeNetworkInfo.getState() != NetworkInfo.State.CONNECTED) { z = false; } this.f5961 = z; } } return this.f5961; } /* renamed from: ٴ reason: contains not printable characters */ private void m8131() { byte[] r0; if (!this.f5962) { String str = null; if (m8151().getInt("k_lt_ver", 0) == this.f5952) { str = m8151().getString("k_lt", null); } if (TextUtils.isEmpty(str) && (r0 = m8132()) != null && r0.length > 0) { str = t.m8453(r0, this.f5953); } if (!TextUtils.isEmpty(str)) { com.lt.app.c.a aVar = (com.lt.app.c.a) au.m8935(str, com.lt.app.c.a.class); this.f5958 = aVar; if (aVar != null) { aVar.m8520(); this.f5955 = this.f5958.x; this.f5956 = this.f5958.x2; this.f5957 = this.f5958.x3; } } as.m8821(new u<Integer, Boolean>() { /* class com.lt.app.App.AnonymousClass2 */ /* renamed from: ʻ reason: contains not printable characters */ public Boolean process(Integer num) { return Boolean.valueOf(App.m8121(num.intValue(), true)); } }); this.f5962 = true; } } /* renamed from: ʻ reason: contains not printable characters */ public String m8136(boolean z) { if (!z) { return this.f5954; } return this.f5954 + "/YM-RT/"; } /* renamed from: ʼ reason: contains not printable characters */ public JSONObject m8140() { JSONObject jSONObject = new JSONObject(); com.lt.app.c.a aVar = this.f5958; if (aVar == null) { return jSONObject; } try { jSONObject.put("appId", aVar.ltid); jSONObject.put("appVer", m8146()); jSONObject.put("appName", m8145()); jSONObject.put("url", this.f5958.url); jSONObject.put("packageName", this.f5958.key); jSONObject.put("platformVer", 44); jSONObject.put("deviceId", m8147()); jSONObject.put("deviceName", Build.BRAND + " " + Build.MODEL + " Android " + Build.VERSION.RELEASE + " SDK " + Build.VERSION.SDK_INT); jSONObject.put("installId", m8148()); jSONObject.put("certMD5", m8149()); jSONObject.put("certSHA1", m8150()); jSONObject.put("apiLevel", Build.VERSION.SDK_INT); } catch (Exception e) { e.printStackTrace(); } return jSONObject; } /* renamed from: ʻ reason: contains not printable characters */ public String m8135(String str) { if (TextUtils.isEmpty(str)) { return ""; } if (d.m8555(str)) { return str; } try { String encode = URLEncoder.encode(str, "UTF-8"); return m8139("qr/?x=" + encode); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return ""; } } /* renamed from: ʼ reason: contains not printable characters */ public String m8139(String str) { return as.m8812(this, str); } /* renamed from: ʽ reason: contains not printable characters */ public boolean m8143() { com.lt.app.c.a aVar; App app; an r0 = as.m8893(); if (r0 == null || (app = f5951) == null || r0.m8801(app) == -1) { if (!m8121(20, true) || (aVar = this.f5958) == null || aVar.m8521(4)) { return false; } return true; } else if (r0.m8801(f5951) == 1) { return true; } else { return false; } } /* renamed from: ʻ reason: contains not printable characters */ public static boolean m8121(int i, boolean z) { if (i < 64) { long j = 1 << i; return (m8130().f5955 & j) == j; } else if (i < 128) { long j2 = 1 << (i - 64); if ((m8130().f5956 & j2) == j2) { return true; } return false; } else { long j3 = 1 << (i - 128); if ((m8130().f5957 & j3) == j3) { return true; } return false; } } /* renamed from: ʾ reason: contains not printable characters */ public void m8144() { n.m8379(); as.m8813(); this.f5958 = null; e.m8572(); s.m8451(); this.f5962 = false; } /* renamed from: ʿ reason: contains not printable characters */ public static com.lt.app.c.a m8128() { App app = f5951; if (app == null) { return null; } return app.f5958; } /* renamed from: ˆ reason: contains not printable characters */ public static com.lt.app.c.a m8129() { App app = f5951; if (app == null) { return null; } app.m8131(); return f5951.f5958; } /* renamed from: ʻ reason: contains not printable characters */ public static void m8116(a aVar) { f5951.m8124(aVar); } /* renamed from: ʻ reason: contains not printable characters */ public static String m8114(int i) { return f5951.getString(i); } public void registerComponentCallbacks(ComponentCallbacks componentCallbacks) { super.registerComponentCallbacks(componentCallbacks); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8120(String str, a aVar, boolean z) { com.lt.app.c.a aVar2; if (!TextUtils.isEmpty(str)) { this.f5958 = (com.lt.app.c.a) new Gson().fromJson(str, com.lt.app.c.a.class); } if (this.f5958 != null) { if (!TextUtils.isEmpty("")) { this.f5958.url = new String(c.m8500("")); } this.f5958.m8520(); this.f5955 = this.f5958.x; this.f5956 = this.f5958.x2; this.f5957 = this.f5958.x3; m8151().edit().putLong("k_x", this.f5958.x).putLong("k_x2", this.f5958.x2).putLong("k_x3", this.f5958.x3).apply(); } n.m8375(); if (aVar == null) { return; } if (!z || ((aVar2 = this.f5958) != null && !aVar2.isOk)) { aVar.onCompleted(this.f5958); } } /* renamed from: ʼ reason: contains not printable characters */ private void m8124(final a aVar) { boolean z; if (this.f5958 != null) { m8120((String) null, aVar, false); z = true; } else { z = false; } if (z) { new Thread(new Runnable() { /* class com.lt.app.App.AnonymousClass3 */ public void run() { try { Thread.sleep(2500); } catch (Exception e) { e.printStackTrace(); } App.this.m8117((App) aVar, (a) true); } }).start(); } else { m8117(aVar, false); } } /* renamed from: ʾ reason: contains not printable characters */ private String m8127(String str) { byte[] bytes = str.getBytes(); StringBuilder sb = new StringBuilder(bytes.length * 2); for (byte b : bytes) { String hexString = Integer.toHexString((b ^ -1) & 255); if (hexString.length() < 2) { hexString = PushConstants.PUSH_TYPE_NOTIFY + hexString; } sb.append(hexString); } return sb.toString(); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8117(final a aVar, final boolean z) { Point point = new Point(1080, 1920); WindowManager windowManager = (WindowManager) getSystemService("window"); if (windowManager != null) { windowManager.getDefaultDisplay().getRealSize(point); } String property = System.getProperty("http.agent"); if (TextUtils.isEmpty(property)) { property = "Java " + System.getProperty("java.version"); } String str = property + String.format(" LT-APP/Android %d/%dx%d", Integer.valueOf(Build.VERSION.SDK_INT), Integer.valueOf(point.x), Integer.valueOf(point.y)); String r1 = m8139("ga/"); int indexOf = r1.indexOf("?"); ((c.a.f) ((c.a.f) ((c.a.AbstractC0065a) ((c.a.AbstractC0065a) k.m7775(this).m7660(r1.substring(0, indexOf)).m7667(str)).m7665(JosStatusCodes.RTN_CODE_COMMON_ERROR)).m7671("q", m8127(r1.substring(indexOf + 1)))).m7671("d", m8147())).m7656().m6537(new f<byte[]>() { /* class com.lt.app.App.AnonymousClass4 */ /* JADX WARNING: Removed duplicated region for block: B:11:0x001d */ /* JADX WARNING: Removed duplicated region for block: B:14:0x0048 */ /* renamed from: ʻ reason: contains not printable characters */ public void m8154(Exception exc, byte[] bArr) { String str; if (exc == null && bArr != null && bArr.length > 0) { try { str = t.m8453(bArr, App.this.f5953); } catch (Exception e) { e.printStackTrace(); } if (TextUtils.isEmpty(str)) { App.this.m8151().edit().putInt("k_lt_ver", App.this.f5952).putString("k_lt", str).apply(); a aVar = aVar; if (aVar != null) { App.this.m8120((App) str, (String) aVar, (a) z); return; } return; } a aVar2 = aVar; if (aVar2 != null) { aVar2.onCompleted(App.this.f5958); return; } return; } str = null; if (TextUtils.isEmpty(str)) { } } }); } /* JADX WARNING: Removed duplicated region for block: B:18:0x0028 A[SYNTHETIC, Splitter:B:18:0x0028] */ /* JADX WARNING: Removed duplicated region for block: B:24:0x002f A[SYNTHETIC, Splitter:B:24:0x002f] */ /* renamed from: ᐧ reason: contains not printable characters */ private byte[] m8132() { InputStream inputStream; Throwable th; Exception e; try { inputStream = getAssets().open("y.x"); try { byte[] bArr = new byte[inputStream.available()]; inputStream.read(bArr); if (inputStream != null) { try { inputStream.close(); } catch (Exception unused) { } } return bArr; } catch (Exception e2) { e = e2; try { e.printStackTrace(); if (inputStream != null) { } return null; } catch (Throwable th2) { th = th2; if (inputStream != null) { } throw th; } } } catch (Exception e3) { e = e3; inputStream = null; e.printStackTrace(); if (inputStream != null) { try { inputStream.close(); } catch (Exception unused2) { } } return null; } catch (Throwable th3) { inputStream = null; th = th3; if (inputStream != null) { try { inputStream.close(); } catch (Exception unused3) { } } throw th; } } /* renamed from: ˈ reason: contains not printable characters */ public String m8145() { return m8114((int) R.string.app_name); } /* renamed from: ˉ reason: contains not printable characters */ public int m8146() { return f5951.f5952; } /* renamed from: ˊ reason: contains not printable characters */ public String m8147() { if (this.f5963 == null) { this.f5963 = c.m8508(Settings.Secure.getString(getContentResolver(), "android_id") + Build.SERIAL); } return this.f5963; } /* renamed from: ˋ reason: contains not printable characters */ public String m8148() { if (this.f5964 == null) { String string = m8151().getString("k_xapp", null); this.f5964 = string; if (TextUtils.isEmpty(string)) { this.f5964 = UUID.randomUUID().toString(); m8151().edit().putString("k_xapp", this.f5964).apply(); } } return this.f5964; } /* renamed from: ᴵ reason: contains not printable characters */ private void m8133() { try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 64); if (packageInfo != null && packageInfo.signatures != null && packageInfo.signatures.length > 0) { Certificate generateCertificate = CertificateFactory.getInstance("X509").generateCertificate(new ByteArrayInputStream(packageInfo.signatures[0].toByteArray())); this.f5965 = c.m8488(MessageDigest.getInstance("MD5").digest(generateCertificate.getEncoded())); this.f5966 = c.m8488(MessageDigest.getInstance("SHA1").digest(generateCertificate.getEncoded())); } } catch (Exception e) { e.printStackTrace(); } } /* renamed from: ˎ reason: contains not printable characters */ public String m8149() { if (this.f5965 == null) { m8133(); } return this.f5965; } /* renamed from: ˏ reason: contains not printable characters */ public String m8150() { if (this.f5966 == null) { m8133(); } return this.f5966; } /* renamed from: ʽ reason: contains not printable characters */ public Map<String, String> m8142(String str) { HashMap hashMap = new HashMap(); hashMap.put("x-app", m8148()); if (!TextUtils.isEmpty(str)) { hashMap.put("Referer", str); } return hashMap; } /* renamed from: ˑ reason: contains not printable characters */ public static App m8130() { return f5951; } /* renamed from: י reason: contains not printable characters */ public SharedPreferences m8151() { return f5951.getSharedPreferences("LT-APP", 0); } /* renamed from: ʻ reason: contains not printable characters */ public final e m8134(String str, String str2, BigDecimal bigDecimal, String str3, f<q<o>> fVar) { c.a.AbstractC0065a aVar = (c.a.AbstractC0065a) k.m7775(this).m7660(m8139("pay/ali/")).m7665(15000); com.lt.app.c.a aVar2 = this.f5958; return ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) aVar.m7671("id", aVar2 != null ? String.valueOf(aVar2.ltid) : PushConstants.PUSH_TYPE_NOTIFY)).m7671("title", str)).m7671("orderid", str2)).m7671("amount", bigDecimal.toString())).m7671("attach", str3)).m7658(new TypeToken<q<o>>() { /* class com.lt.app.App.AnonymousClass5 */ }).m6537(fVar); } /* renamed from: ʼ reason: contains not printable characters */ public final e m8138(String str, String str2, BigDecimal bigDecimal, String str3, f<q<p>> fVar) { c.a.AbstractC0065a aVar = (c.a.AbstractC0065a) k.m7775(this).m7660(m8139("pay/wx/")).m7665(15000); com.lt.app.c.a aVar2 = this.f5958; return ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) aVar.m7671("id", aVar2 != null ? String.valueOf(aVar2.ltid) : PushConstants.PUSH_TYPE_NOTIFY)).m7671("title", str)).m7671("orderid", str2)).m7671("amount", bigDecimal.toString())).m7671("attach", str3)).m7658(new TypeToken<q<p>>() { /* class com.lt.app.App.AnonymousClass6 */ }).m6537(fVar); } /* renamed from: ʽ reason: contains not printable characters */ public final e m8141(String str, String str2, BigDecimal bigDecimal, String str3, f<q<String>> fVar) { c.a.AbstractC0065a aVar = (c.a.AbstractC0065a) k.m7775(this).m7660(m8139("pay/upay/")).m7665(15000); com.lt.app.c.a aVar2 = this.f5958; return ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) ((c.a.f) aVar.m7671("id", aVar2 != null ? String.valueOf(aVar2.ltid) : PushConstants.PUSH_TYPE_NOTIFY)).m7671("title", str)).m7671("orderid", str2)).m7671("amount", bigDecimal.toString())).m7671("attach", str3)).m7658(new TypeToken<q<String>>() { /* class com.lt.app.App.AnonymousClass7 */ }).m6537(fVar); } /* renamed from: ـ reason: contains not printable characters */ public Activity m8152() { return this.f5967; } public void onActivityStarted(Activity activity) { int i = this.f5959 + 1; this.f5959 = i; if (i == 1) { m8125(false); } } public void onActivityResumed(Activity activity) { this.f5967 = activity; } public void onActivityStopped(Activity activity) { int i = this.f5959 - 1; this.f5959 = i; if (i == 0) { m8125(true); } } public void onActivityDestroyed(Activity activity) { if (this.f5967 == activity) { this.f5967 = null; } } /* renamed from: ʼ reason: contains not printable characters */ private void m8125(boolean z) { Intent intent = new Intent("ym_app_state_changed"); intent.putExtra("ym_app_enter_bg", z); au.m8942(this, intent); } }