360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0
以下内容为反编译后的 ca.java 源代码,内容仅作参考
package com.qihoo.express.mini.service;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.Time;
import com.qihoo.appstore.utils.cu;
import com.qihoo.appstore.utils.dl;
import com.qihoo.speedometer.Config;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ca {
public static long f4608a;
private int A;
private final List B;
private final int C;
public byte[] f4609b;
public long c;
private final com.qihoo.appstore.utils.co d;
private int e;
private PendingIntent f;
private String g;
private String h;
private PendingIntent i;
private PendingIntent j;
private final cu k;
private final Runnable l;
private final Runnable m;
private final Runnable n;
private final dl o;
private final Map p;
private final AtomicBoolean q;
private final AtomicBoolean r;
private final AtomicBoolean s;
private final com.qihoo.appstore.utils.bm t;
private final com.qihoo.appstore.utils.bm u;
private final com.qihoo.appstore.utils.bm v;
private final com.qihoo.appstore.utils.bm w;
private final Handler x;
private final com.qihoo.appstore.utils.bw y;
private final com.qihoo.appstore.utils.bc z;
public ca() {
this.g = "message.openapi.360.cn:80";
if (com.qihoo.express.mini.c.l.a(com.qihoo.express.mini.c.a.a().b())) {
this.g = "218.30.118.71:80";
}
this.k = new cu("QHPushDaemon");
this.o = new dl(com.qihoo.express.mini.c.a.a().b(), "QHPushDaemon", 1);
this.p = new ConcurrentHashMap();
this.q = new AtomicBoolean();
this.r = new AtomicBoolean();
this.s = new AtomicBoolean();
this.x = new Handler(Looper.getMainLooper());
this.y = new com.qihoo.appstore.utils.bw("QHPushDaemon");
this.z = new com.qihoo.appstore.utils.bc();
this.t = b(2, "mExecutorHandlePCMsg");
this.u = b(2, "mExecutorSendPCMsg");
this.v = b(3, "mExecutorDownloadFile");
this.w = b(3, "mExecutorUploadFile");
this.B = new ArrayList();
this.f4609b = new byte[0];
this.C = m();
this.l = new cb(this);
this.m = new ci(this);
this.n = new cj(this);
this.d = new ck(this, "QHPushDaemon", this.y);
}
private static void a(int i, int i2) {
String str = "pstiderror" + i + "(" + i2 + ")";
com.qihoo360.mobilesafe.util.n.a("push.notify", str);
com.qihoo.express.mini.c.a.a().a(str, true);
}
private void a(int i, com.qihoo.appstore.utils.bm bmVar) {
List shutdownNow = i == -1 ? bmVar.shutdownNow() : bmVar.a();
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "cancelAllPCMsgTask.session = " + i + ", executor = " + bmVar + ", tasks.size = " + shutdownNow.size(), new Object[0]);
Iterator it = shutdownNow.iterator();
while (it.hasNext()) {
aw awVar = (aw) it.next();
if (i == -1) {
awVar.a(true);
it.remove();
} else if (awVar.f4601b > 0 && awVar.f4601b <= i) {
awVar.a(true);
bmVar.remove(awVar);
it.remove();
}
}
}
public static void a(int i, String str) {
try {
Context b2 = com.qihoo.express.mini.c.a.a().b();
Intent intent = new Intent("com.qihoo.express.push.MSG_ARRIVED");
intent.putExtra("push_type", i);
intent.putExtra("push_json", str);
b2.startService(intent);
} catch (SecurityException e) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
e.printStackTrace();
}
a(7, -1);
}
}
public void a(int i, String str, int i2) {
this.y.newThread(new co(this, i, str, i2)).start();
}
private void a(int i, JSONObject jSONObject) {
switch (i) {
case 1003:
this.t.execute(new cf(this, jSONObject, i));
return;
case 1004:
this.v.execute(f.A(jSONObject));
return;
case 1005:
this.t.execute(new cg(this, jSONObject, i));
return;
case 1006:
case 1007:
case 1009:
case 1064:
case 1065:
case 1066:
case 1067:
case 1068:
case 1069:
case 1070:
case 1072:
case 1073:
case 1074:
case 1075:
case 1076:
case 1077:
case 1078:
case 1079:
case 1080:
case 1081:
case 1082:
case 1083:
case 1084:
case 1085:
case 1086:
case 1087:
case 1088:
case 1089:
case 1090:
case 1091:
case 1092:
case 1093:
case 1094:
case 1095:
case 1096:
case 1097:
case 1098:
case 1099:
case 1100:
default:
this.t.execute(f.h(jSONObject));
return;
case 1008:
this.t.execute(f.J(jSONObject));
return;
case 1010:
this.t.execute(f.a(jSONObject));
return;
case 1011:
this.t.execute(f.y(jSONObject));
return;
case 1012:
this.w.execute(f.b(jSONObject));
return;
case 1013:
this.t.execute(f.c(jSONObject));
return;
case 1014:
this.t.execute(f.f(jSONObject));
return;
case 1015:
this.t.execute(f.i(jSONObject));
return;
case 1016:
this.t.execute(f.s(jSONObject));
return;
case 1017:
this.t.execute(f.v(jSONObject));
return;
case 1018:
this.t.execute(f.x(jSONObject));
return;
case 1019:
this.t.execute(f.w(jSONObject));
return;
case 1020:
this.t.execute(f.q(jSONObject));
return;
case 1021:
this.t.execute(f.r(jSONObject));
return;
case 1022:
this.t.execute(f.t(jSONObject));
return;
case 1023:
this.w.execute(f.n(jSONObject));
return;
case 1024:
this.w.execute(f.m(jSONObject));
return;
case 1025:
this.t.execute(f.l(jSONObject));
return;
case 1026:
this.t.execute(f.p(jSONObject));
return;
case 1027:
this.t.execute(f.a(jSONObject, true));
return;
case 1028:
this.t.execute(f.a(jSONObject, false));
return;
case 1029:
this.t.execute(f.o(jSONObject));
return;
case 1030:
this.v.execute(f.D(jSONObject));
return;
case 1031:
this.v.execute(f.u(jSONObject));
return;
case 1032:
this.t.execute(f.B(jSONObject));
return;
case 1033:
this.t.execute(f.z(jSONObject));
return;
case 1034:
this.t.execute(f.g(jSONObject));
return;
case 1035:
this.t.execute(f.G(jSONObject));
return;
case 1036:
this.t.execute(ax.K(jSONObject));
return;
case 1037:
this.t.execute(ax.R(jSONObject));
return;
case 1038:
this.t.execute(ax.L(jSONObject));
return;
case 1039:
this.t.execute(ax.M(jSONObject));
return;
case 1040:
this.t.execute(ax.N(jSONObject));
return;
case 1041:
this.t.execute(ax.O(jSONObject));
return;
case 1042:
this.w.execute(ax.P(jSONObject));
return;
case 1043:
this.v.execute(ax.Q(jSONObject));
return;
case 1044:
this.t.execute(ax.S(jSONObject));
return;
case 1045:
this.t.execute(ax.T(jSONObject));
return;
case 1046:
this.t.execute(ax.U(jSONObject));
return;
case 1047:
this.t.execute(ax.V(jSONObject));
return;
case 1048:
this.t.execute(ax.W(jSONObject));
return;
case 1049:
this.t.execute(ax.X(jSONObject));
return;
case 1050:
this.t.execute(ax.Y(jSONObject));
return;
case 1051:
this.t.execute(bo.K(jSONObject));
return;
case 1052:
this.t.execute(bo.L(jSONObject));
return;
case 1053:
this.t.execute(bo.M(jSONObject));
return;
case 1054:
this.t.execute(bo.N(jSONObject));
return;
case 1055:
this.t.execute(bo.O(jSONObject));
return;
case 1056:
this.t.execute(bo.P(jSONObject));
return;
case 1057:
this.t.execute(bo.Q(jSONObject));
return;
case 1058:
this.t.execute(ax.Z(jSONObject));
return;
case 1059:
this.t.execute(f.H(jSONObject));
return;
case 1060:
this.t.execute(f.I(jSONObject));
return;
case 1061:
this.t.execute(f.j(jSONObject));
return;
case 1062:
this.t.execute(f.k(jSONObject));
return;
case 1063:
this.v.execute(f.C(jSONObject));
return;
case 1071:
this.t.execute(f.c());
return;
case 1101:
ch chVar = null;
if (com.qihoo.express.mini.c.a.a().s() >= 2) {
this.k.a(this.n);
chVar = new ch(this);
}
this.t.execute(f.a(jSONObject, chVar));
return;
case 1102:
this.t.execute(f.d(jSONObject));
return;
case 1103:
this.t.execute(f.e(jSONObject));
return;
}
}
private void a(long j) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
Time time = new Time();
time.set(System.currentTimeMillis() + j);
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "startReStartTimer.mReStartCount = " + this.e + ", delay = " + j + ", atTime = " + time.format3339(false), new Object[0]);
}
Context b2 = com.qihoo.express.mini.c.a.a().b();
if (this.i == null) {
Intent intent = new Intent();
intent.setClass(b2, DaemonCoreService.class);
intent.setAction("RESTART_PUSH");
this.i = PendingIntent.getService(b2, 0, intent, 134217728);
}
((AlarmManager) b2.getSystemService("alarm")).set(2, SystemClock.elapsedRealtime() + j, this.i);
}
public void a(com.qihoo.miop.a.a aVar) {
boolean z;
JSONObject jSONObject;
boolean z2;
String[] split;
if (aVar != null) {
if (com.qihoo.express.mini.b.k.g(aVar.a())) {
JSONObject h = com.qihoo.express.mini.b.k.h(aVar.a());
if (h != null) {
int optInt = h.optInt("msgtype", -1);
String jSONObject2 = h.toString();
String o = com.qihoo.express.mini.c.a.a().o();
if (1000 <= optInt) {
int optInt2 = h.optInt("p_id", -1);
int optInt3 = h.optInt("session", -1);
int optInt4 = h.optInt("retry", -1);
com.qihoo360.mobilesafe.util.n.a("R", "s=" + optInt3 + ",m=" + optInt + ",p=" + optInt2 + ",r=" + optInt4);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "messageArrived.session = " + optInt3 + ", msgType = " + optInt + ", pId = " + optInt2 + ", retry = " + optInt4 + ", content = " + jSONObject2 + ", localCid = " + o, new Object[0]);
}
if (optInt3 <= 0 || !this.z.c(Integer.valueOf(optInt3)) || (this.z.c(Integer.valueOf(optInt3)) && !this.z.a(Integer.valueOf(optInt3)).contains(Integer.valueOf(optInt2)))) {
if (optInt3 > 0) {
if (this.z.c(Integer.valueOf(optInt3)) && this.z.a(Integer.valueOf(optInt3)).size() > 50) {
this.z.a(Integer.valueOf(optInt3)).remove(0);
}
this.z.a(Integer.valueOf(optInt3), Integer.valueOf(optInt2));
}
if (1100 == optInt) {
c(optInt3);
com.qihoo360.mobilesafe.b.c.a(com.qihoo.express.mini.c.a.a().b()).a(6, (String) null, (String) null, 1);
} else {
if (optInt3 > 0 && optInt3 > this.A) {
c(this.A);
this.A = optInt3;
}
a(optInt, h);
}
}
f4608a = SystemClock.elapsedRealtime();
if (com.qihoo.express.mini.c.i.c()) {
q();
return;
}
return;
}
return;
}
return;
}
String a2 = aVar.a();
try {
jSONObject = new JSONObject(a2);
z = false;
} catch (JSONException e) {
String str = "messageArrived2.JSONException = " + e.toString();
com.qihoo360.mobilesafe.util.n.a("R", str);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.d("QHPushDaemon", str, new Object[0]);
}
z = true;
jSONObject = null;
}
if (jSONObject == null) {
if (z) {
a(6, -1);
return;
} else {
if ("remove".equals(a2)) {
}
return;
}
}
int optInt5 = jSONObject.optInt("msgtype", 0);
String o2 = com.qihoo.express.mini.c.a.a().o();
boolean d = d(optInt5);
if (d) {
boolean a3 = a(a2);
int i = a3 ? 5 : 4;
int optInt6 = jSONObject.optInt("pstid", -1);
if (5 != optInt5) {
a(i, optInt6);
}
z2 = a3;
} else {
z2 = false;
}
String str2 = "messageArrived2.msgType = " + optInt5 + ", isPushMsgExists = " + z2 + ", content = " + a2 + ", localCid = " + o2;
com.qihoo360.mobilesafe.util.n.a("R", str2);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", str2, new Object[0]);
}
if (-100 == optInt5) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "messageArrived.msgType = -100", new Object[0]);
return;
}
return;
}
if (!d || z2) {
return;
}
if (optInt5 == 0) {
String optString = jSONObject.optString("cid");
if (jSONObject.optInt("iver", 0) != 1 || TextUtils.isEmpty(o2) || TextUtils.isEmpty(optString) || !o2.equals(optString)) {
return;
}
a(optInt5, a2);
return;
}
if (5 != optInt5) {
a(optInt5, a2);
return;
}
try {
String optString2 = jSONObject.optString("start_update_delayed", Config.INVALID_IP);
String optString3 = jSONObject.optString("args", Config.INVALID_IP);
if (TextUtils.isEmpty(optString2) || (split = optString2.split(",")) == null) {
return;
}
int intValue = Integer.valueOf(split[0]).intValue();
int intValue2 = Integer.valueOf(split[1]).intValue();
int nextInt = new Random().nextInt((intValue2 - intValue) + 1) + intValue;
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "messageArrived.msgType = 5 start=" + intValue + " end=" + intValue2 + " random=" + nextInt, new Object[0]);
DaemonCoreService.a(nextInt, optString3);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
public void a(Runnable runnable, boolean z, boolean z2) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "stopPush.callback = " + runnable + ", isForceReStartPush = " + z + ", isResetReStartCount = " + z2, new Object[0]);
}
s();
p();
l();
if (!z) {
this.k.a(this.n);
a(false, false);
}
if (z2) {
this.e = 0;
}
this.d.a("stopPush", true, runnable);
}
public void a(boolean z, boolean z2) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "dispatchPushConnectedCallback.connectSucceed = " + z + ", linkPCByCidSucceed = " + z2 + ", mPushConnectedCallbacks.size() = " + this.p.size(), new Object[0]);
}
if (this.p.isEmpty()) {
return;
}
this.x.post(new cd(this, z, z2));
}
private com.qihoo.appstore.utils.bm b(int i, String str) {
cm cmVar = new cm(this, i, i, 10000L, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), this.y, new cl(this, str), str);
com.qihoo.appstore.utils.c.a(cmVar);
return cmVar;
}
private void c(int i) {
if (i > 0) {
this.z.b(Integer.valueOf(i));
a(i, this.t);
a(i, this.u);
a(i, this.v);
a(i, this.w);
}
}
public static boolean c() {
boolean b2 = com.qihoo.express.mini.b.k.b(com.qihoo.express.mini.c.a.a().f());
if (b2) {
com.qihoo.express.mini.c.a.a().p();
}
return b2;
}
private boolean d(int i) {
return i == 0 || 1 == i || 2 == i || 3 == i || 4 == i || 5 == i;
}
public String e(int i) {
if (this.B.isEmpty()) {
String format = String.format("http://md.openapi.360.cn/baohe/list?version=1&toid=%1$s&pst=%2$s", com.qihoo.express.mini.c.a.a().f(), Integer.valueOf(i));
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "getPushServerUrl = " + format, new Object[0]);
}
com.qihoo.express.mini.b.j jVar = new com.qihoo.express.mini.b.j(format);
jVar.a(8000);
jVar.b(10000);
jVar.c(0);
com.qihoo.express.mini.b.aa a2 = jVar.a();
if (a2 != null && 1 == a2.b() && a2.a() != null) {
String valueOf = String.valueOf(a2.a());
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "getPushServerUrl.result = " + valueOf, new Object[0]);
}
try {
JSONObject jSONObject = new JSONObject(valueOf);
cr.a(com.qihoo.express.mini.c.a.a().b(), jSONObject.optInt("record_error"));
JSONArray jSONArray = jSONObject.getJSONArray("data");
int length = jSONArray.length();
if (length > 0) {
for (int i2 = 0; i2 < length; i2++) {
this.B.add(jSONArray.getString(i2));
}
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "getPushServerUrlList.mPushIps = " + this.B.toString(), new Object[0]);
}
}
} catch (JSONException e) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
e.printStackTrace();
}
}
}
}
if (com.qihoo.express.mini.c.l.a(com.qihoo.express.mini.c.a.a().b()) || this.B.isEmpty()) {
this.h = this.g;
} else {
this.h = (String) this.B.get(this.B.size() != 1 ? new Random().nextInt(this.B.size() - 1) : 0);
}
return this.h;
}
public String i() {
return com.qihoo.express.mini.c.a.a().f() + "@baohe";
}
public void j() {
synchronized (this.f4609b) {
this.c = SystemClock.elapsedRealtime();
}
String str = "keepaliveArrived.userId = " + i();
com.qihoo360.mobilesafe.util.n.a(Config.INVALID_IP, str);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", str, new Object[0]);
}
o();
}
public int k() {
int activeCount = this.t.getActiveCount() + this.t.getQueue().size();
int activeCount2 = this.u.getActiveCount() + this.u.getQueue().size();
int activeCount3 = this.v.getActiveCount() + this.v.getQueue().size();
int activeCount4 = this.w.getActiveCount() + this.w.getQueue().size();
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "getQueueSize.handlePCMsgCount = " + activeCount + ", sendPCMsgCount = " + activeCount2 + ", downloadFileCount = " + activeCount3 + ", uploadFileCount = " + activeCount4, new Object[0]);
}
return activeCount + activeCount2 + activeCount3 + activeCount4;
}
private void l() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "stopReStartTimer", new Object[0]);
}
if (this.i != null) {
((AlarmManager) com.qihoo.express.mini.c.a.a().b().getSystemService("alarm")).cancel(this.i);
}
}
private int m() {
String str;
try {
str = ((TelephonyManager) com.qihoo.express.mini.c.a.a().b().getSystemService("phone")).getSubscriberId();
} catch (SecurityException e) {
str = null;
}
if (str != null) {
if (str.startsWith("46000") || str.startsWith("46002") || str.startsWith("46007")) {
return 1;
}
if (str.startsWith("46001")) {
return 2;
}
if (str.startsWith("46003")) {
return 3;
}
}
return 1;
}
public long n() {
return (2 == this.C || 3 == this.C) ? com.qihoo.express.mini.c.a.a().e(600000L) : com.qihoo.express.mini.c.a.a().c(900000L);
}
private void o() {
long n = n() + Config.SPLASH_SCREEN_DURATION_MSEC;
if (com.qihoo360.mobilesafe.a.a.f5313a) {
Time time = new Time();
time.set(System.currentTimeMillis() + n);
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "startKeepAliveTimer.atTime = " + time.format3339(false), new Object[0]);
}
Context b2 = com.qihoo.express.mini.c.a.a().b();
if (this.f == null) {
Intent intent = new Intent();
intent.setClass(b2, DaemonCoreService.class);
intent.setAction("TAKE_PUSH_KEEPALIVE");
this.f = PendingIntent.getService(b2, 0, intent, 134217728);
}
((AlarmManager) b2.getSystemService("alarm")).set(2, n + SystemClock.elapsedRealtime(), this.f);
}
private void p() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "stopKeepAliveTimer", new Object[0]);
}
if (this.f != null) {
((AlarmManager) com.qihoo.express.mini.c.a.a().b().getSystemService("alarm")).cancel(this.f);
}
}
private void q() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
Time time = new Time();
time.set(System.currentTimeMillis() + 60000);
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "startCheckPushConnectingTimer.atTime = " + time.format3339(false), new Object[0]);
}
Context b2 = com.qihoo.express.mini.c.a.a().b();
if (this.j == null) {
this.j = PendingIntent.getService(b2, 0, new Intent().setClass(b2, DaemonCoreService.class).setAction("ACTION_CHECK_PUSH_CONNECTING"), 134217728);
}
((AlarmManager) b2.getSystemService("alarm")).set(2, SystemClock.elapsedRealtime() + 60000, this.j);
}
private void r() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "stopCheckPushConnectingTimer", new Object[0]);
}
if (this.j != null) {
((AlarmManager) com.qihoo.express.mini.c.a.a().b().getSystemService("alarm")).cancel(this.j);
}
}
public void s() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "cancelReStartPushTimeout.mTakePushKeepaliveReleaseWakeLock = " + this.s.get() + ", mCheckPushConnecting = " + this.r.get(), new Object[0]);
}
synchronized (this.s) {
if (this.s.getAndSet(false)) {
this.k.a(this.m);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo.appstore.t.a.b("mTakePushKeepaliveReleaseWakeLock", new String[0]);
}
this.o.b();
}
}
this.k.a(this.l);
if (this.r.get()) {
r();
this.r.getAndSet(false);
}
}
public void t() {
int c = com.qihoo.express.mini.c.a.a().c(2);
long g = com.qihoo.express.mini.c.a.a().g(300000L);
long i = com.qihoo.express.mini.c.a.a().i(600000L);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "loopReStartPush.pushConnectRetryCount = " + c + ", pushConnectRetryWifiIntervalTime = " + g + ", pushConnectRetryMobileIntervalTime = " + i + ", mReStartCount = " + this.e, new Object[0]);
}
if (c == 0 || this.e < c) {
if (this.e < 1) {
long j = ((this.e * 60) + 60) * 1000;
g = Math.min(g, i);
if (j <= g) {
g = j;
}
} else if (!com.qihoo.express.mini.c.i.b()) {
g = -1;
} else if (!com.qihoo.express.mini.c.i.c()) {
g = i;
}
if (g > 0) {
a(g);
this.e++;
}
}
}
public void u() {
long elapsedRealtime = SystemClock.elapsedRealtime() - f4608a;
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "notifyPCReLinked.LAST_PC_MSG_ARRIVED_TIME = " + f4608a + ", elapsedTime = " + elapsedRealtime, new Object[0]);
}
if (f4608a <= 0 || elapsedRealtime > 180000) {
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("msgmode", 2);
jSONObject.put("category", "relink");
a(jSONObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
public JSONObject v() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("msgtype", -100);
} catch (JSONException e) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
e.printStackTrace();
}
}
return jSONObject;
}
public void a(int i) {
boolean a2 = a();
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "startPush.isConnected = " + a2, new Object[0]);
}
if (a2) {
return;
}
a(60000, (String) null, i);
}
public void a(int i, com.qihoo.express.mini.service.a.m mVar) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "registerPushConnectedCallback.id = " + i + ", callback = " + mVar, new Object[0]);
}
this.p.put(Integer.valueOf(i), mVar);
}
public void a(String str, int i) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "reStartPush.tag = " + str, new Object[0]);
}
a((Runnable) new cq(this, i), false, false);
}
public void a(String str, int i, int i2, String str2, int i3, int i4) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
String str3 = "forceReStartPush.cid = " + str + ", pcVer = " + i + ", type = " + i3 + ", timeout = " + i2 + ", mPushConnecting = " + this.q.get();
com.qihoo360.mobilesafe.util.n.a("QHPushDaemon", str3);
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", str3, new Object[0]);
}
com.qihoo.express.mini.c.a.a().d(i3);
if ((str == null || str.equals(com.qihoo.express.mini.c.a.a().o())) && this.q.get()) {
return;
}
com.qihoo.express.mini.c.a.a().d(str);
com.qihoo.express.mini.c.a.a().a(i);
a((Runnable) new cc(this, i2, str2, i4), true, true);
}
public void a(JSONObject jSONObject) {
this.u.execute(new ce(this, jSONObject));
}
public void a(boolean z, Intent intent, int i) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "onNetworkChanged.isConnected = " + z + ", intent = " + com.qihoo.appstore.utils.c.a(intent) + " startType=" + i, new Object[0]);
}
if (z) {
a(i);
} else {
g();
}
}
public boolean a() {
return this.d.a();
}
public boolean a(String str) {
if (!TextUtils.isEmpty(str)) {
String a2 = com.qihoo.express.mini.c.f.a(str.getBytes());
if (!TextUtils.isEmpty(a2)) {
List f = com.qihoo.express.mini.c.a.a().f((String) null);
boolean contains = f.contains(a2);
if (contains) {
return contains;
}
if (f.size() >= 5) {
f.remove(0);
}
f.add(a2);
com.qihoo.express.mini.c.a.a().a(f);
return contains;
}
}
return false;
}
public void b(int i) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "unregisterPushConnectedCallback.id = " + i, new Object[0]);
}
this.p.remove(Integer.valueOf(i));
}
public boolean b() {
return this.d.a() && com.qihoo.express.mini.c.a.a().n();
}
public void d() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "checkPushConnecting.mCheckPushConnecting = " + this.r.get(), new Object[0]);
}
this.y.newThread(new cn(this)).start();
}
public void e() {
synchronized (this.f4609b) {
boolean z = this.c > 0 && SystemClock.elapsedRealtime() - this.c <= 15000;
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "takePushKeepalive.mTakePushKeepaliveReleaseWakeLock = " + this.s.get() + ", isKeepalivsseArrived = " + z, new Object[0]);
}
if (!z) {
synchronized (this.s) {
if (!this.s.getAndSet(true)) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo.appstore.t.a.a("mTakePushKeepaliveReleaseWakeLock", new String[0]);
}
this.o.a();
this.k.a(this.m, 15000L);
}
}
}
}
}
public String f() {
return this.h;
}
public void g() {
boolean a2 = a();
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "stopPush.isConnected = " + a2, new Object[0]);
}
a((Runnable) null, false, true);
}
public void h() {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
com.qihoo360.mobilesafe.util.h.a("QHPushDaemon", "destroy", new Object[0]);
}
a((Runnable) null, false, true);
this.q.getAndSet(false);
this.k.a();
this.z.a();
this.A = 0;
a(-1, this.t);
a(-1, this.u);
a(-1, this.v);
a(-1, this.w);
}
}