打牌网 v4.0.4版本的 MD5 值为:e257b9ecf68b0639529ede50d4c5ca4b
以下内容为反编译后的 dd.java 源代码,内容仅作参考
package c.t.m.g;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import cz.msebera.android.httpclient.cookie.ClientCookie;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONObject;
public class dd {
private static final String b = "ACTION." + dd.class.getSimpleName() + "." + System.nanoTime();
private static dd f39c = null;
private static Context d = null;
private PendingIntent f;
private a g;
private volatile boolean e = false;
public dc a = null;
static long e() {
return g();
}
private dd() {
this.f = null;
this.g = null;
if (d == null || d.getApplicationContext() == null) {
throw new IllegalStateException("Please invoke initial(context,...) first when app started!");
}
this.g = new a(this, (byte) 0);
this.f = PendingIntent.getBroadcast(d, 0, i(), 134217728);
}
public static void a(HashMap<String, String> hashMap) {
de.a(hashMap);
}
public static void a(Context context, String str, String str2) {
if (context == null || context.getApplicationContext() == null) {
throw new NullPointerException("context cannot be null!");
}
Context applicationContext = context.getApplicationContext();
d = applicationContext;
df.a(applicationContext, str);
de.a(str, str2);
new Thread() {
@Override
public final void run() {
try {
dd.a();
df.a();
de.a();
} catch (Throwable th) {
}
}
}.start();
}
public static void a(String str) {
de.a(str);
}
public static synchronized dd a() {
dd ddVar;
synchronized (dd.class) {
if (f39c == null) {
synchronized (dd.class) {
if (f39c == null) {
f39c = new dd();
}
}
}
ddVar = f39c;
}
return ddVar;
}
public final synchronized void b() {
if (!this.e) {
this.e = true;
try {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(b);
d.registerReceiver(this.g, intentFilter);
a(true);
} catch (Throwable th) {
}
}
}
public final synchronized void c() {
if (this.e) {
this.e = false;
try {
de.a().d.clear();
a(0L);
} catch (Throwable th) {
}
}
}
public void a(boolean z) {
long g;
try {
int b2 = de.a().b("cc_version");
new StringBuilder("schedule :").append(z).append(",").append(b2);
if (b2 == -1) {
g = z ? 5000L : 10800000L;
} else {
g = g();
}
a(g);
} catch (Exception e) {
e.toString();
}
}
private static long g() {
long c2 = de.a().c("cc_req_interval");
long j = c2 <= 86400000 ? c2 : 86400000L;
if (j < 3600000) {
return 3600000L;
}
return j;
}
public void a(long j) {
long elapsedRealtime = SystemClock.elapsedRealtime() + j;
new StringBuilder("startSchedule: delay: ").append(j).append("ms,at: ").append(System.currentTimeMillis() + j).append("ms");
if (j <= 0) {
new Thread(new b(), "Th_CC").start();
} else {
h().set(2, elapsedRealtime, this.f);
}
}
private static AlarmManager h() {
return (AlarmManager) d.getSystemService("alarm");
}
private static Intent i() {
Intent intent = new Intent(b);
try {
intent.setPackage(d.getApplicationInfo().packageName);
} catch (Throwable th) {
intent.setPackage(null);
}
return intent;
}
public class a extends BroadcastReceiver {
private a() {
}
a(dd ddVar, byte b) {
this();
}
@Override
public final void onReceive(Context context, Intent intent) {
if (intent != null) {
if (dd.b.equals(intent.getAction())) {
try {
new Thread(new b(), "Th_CC").start();
} catch (Throwable th) {
dd.this.a(1800000L);
}
}
}
}
}
public class b implements Runnable {
private final JSONObject a = new JSONObject();
private de b;
private df f40c;
public b() {
this.b = null;
this.f40c = null;
this.b = de.a();
this.f40c = df.a();
}
@Override
public final void run() {
SharedPreferences b;
SharedPreferences b2;
int i;
try {
if (System.currentTimeMillis() - this.b.c("last_pull_time") >= dd.e()) {
boolean z = dd.this.e;
if (z) {
this.f40c.c();
}
Thread.currentThread().setPriority(1);
JSONObject a = a();
if (a != this.a) {
switch (Integer.parseInt(a.optString("status", "-5"))) {
case -4:
case -3:
String valueOf = String.valueOf(System.currentTimeMillis());
b = this.f40c.b();
if (b != null) {
SharedPreferences.Editor edit = b.edit();
edit.putString("last_pull_time", valueOf);
edit.apply();
break;
}
break;
case 0:
if (a.has(ClientCookie.VERSION_ATTR) && (b2 = this.f40c.b()) != null) {
int b3 = this.b.b("cc_version");
try {
i = Integer.parseInt(a.optString(ClientCookie.VERSION_ATTR, this.b.e("cc_version")));
} catch (Throwable th) {
i = b3;
}
if (i != b3) {
JSONObject optJSONObject = a.optJSONObject("data");
JSONObject jSONObject = optJSONObject == null ? this.a : optJSONObject;
SharedPreferences.Editor edit2 = b2.edit();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
String e = this.b.e(next);
if (e != null && e.length() != 0) {
edit2.putString(next, jSONObject.optString(next, e));
}
} catch (Exception e2) {
e2.getMessage();
}
}
edit2.putString("cc_version", String.valueOf(i));
try {
long parseLong = Long.parseLong(jSONObject.optString("cc_req_interval", this.b.e("cc_req_interval")));
if (parseLong < 3600000) {
parseLong = 3600000;
} else if (parseLong > 86400000) {
parseLong = 86400000;
}
edit2.putString("cc_req_interval", String.valueOf(parseLong));
} catch (Throwable th2) {
}
edit2.apply();
}
}
String valueOf2 = String.valueOf(System.currentTimeMillis());
b = this.f40c.b();
if (b != null) {
}
break;
}
Thread.sleep(2000L);
}
this.b.b();
if (z) {
this.f40c.d();
}
}
if (dd.this.e) {
dd.this.a(false);
} else {
dd.d(dd.this);
}
} catch (Throwable th3) {
th3.getMessage();
}
}
private JSONObject a() {
if (dd.this.a == null) {
return this.a;
}
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("cc_version", this.b.e("cc_version"));
jSONObject.put("m_module", de.a);
jSONObject.put("m_channel", de.b);
jSONObject.put("m_version", de.f41c);
jSONObject.put("imei", b());
String a = dd.this.a.a("https://cc.map.qq.com/?get_c3", db.a(jSONObject.toString(), "sE0zy%DVqLnXA$hmNZ8NBwcg7FDrvi!q").getBytes());
if (TextUtils.isEmpty(a)) {
return this.a;
}
String jSONObject2 = this.a.toString();
String b = !jSONObject2.equals(a) ? db.b(a, "sE0zy%DVqLnXA$hmNZ8NBwcg7FDrvi!q") : jSONObject2;
return TextUtils.isEmpty(b) ? this.a : new JSONObject(b);
} catch (Throwable th) {
th.getMessage();
return this.a;
}
}
private static String b() {
String str;
try {
str = ((TelephonyManager) dd.d.getSystemService("phone")).getDeviceId();
} catch (Throwable th) {
str = "";
}
return TextUtils.isEmpty(str) ? "" : str;
}
}
static void d(dd ddVar) {
try {
d.unregisterReceiver(ddVar.g);
} catch (Throwable th) {
}
try {
h().cancel(ddVar.f);
ddVar.f.cancel();
} finally {
}
}
}