夏天YY v1.0版本的 MD5 值为:04df6daece98ad4aaa5f0e7a450865f8
以下内容为反编译后的 eh.java 源代码,内容仅作参考
package c.t.m.g;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Pair;
import com.tencent.map.geolocation.util.SoUtils;
import com.umeng.socialize.net.dplus.CommonNetImpl;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.LinkedBlockingQueue;
public class eh {
private static eh j;
private final LinkedBlockingQueue<a> a = new LinkedBlockingQueue<>(3);
private final dl b;
private long f74c;
private long d;
private long e;
private long f;
private volatile boolean g;
private boolean h;
private volatile Handler i;
public static eh a(dl dlVar) {
if (j == null) {
synchronized (eh.class) {
if (j == null) {
j = new eh(dlVar);
}
}
}
return j;
}
private eh(dl dlVar) {
this.b = dlVar;
}
public void a(String str) {
try {
if (TextUtils.isEmpty(str)) {
return;
}
byte[] b = fr.b(str.getBytes("UTF-8"));
if (fl.a) {
fl.a("hh", "postWifisRequest fun_o");
}
SoUtils.fun_o(b, 2);
if (fl.a) {
fl.a("hh", "postWifisRequest fun_d");
}
a aVar = new a(3, b, "https://ue.indoorloc.map.qq.com/?wl", null);
aVar.b = str;
a(aVar);
} catch (Throwable th) {
if (fl.a) {
fl.a("TxRequestSender", "", th);
}
}
}
public void a(String str, ep epVar, int i) {
try {
if (fl.a) {
fl.b("TxRequestSender", str);
}
byte[] a2 = fs.a(str.getBytes("GBK"));
String a3 = a(a2, i);
if (fl.a) {
fl.b("TxRequestSender", "postLocationRequest url = " + a3);
}
a aVar = new a(1, a2, a3, epVar);
aVar.b = str;
a(aVar);
} catch (Throwable th) {
if (fl.a) {
fl.a("TxRequestSender", "", th);
}
}
}
private boolean a(a aVar) {
boolean offer = aVar.f != null ? this.a.offer(aVar) : false;
if (!offer) {
this.a.clear();
this.a.offer(aVar);
String str = "Location";
if (aVar.e == 2) {
str = "List";
} else if (aVar.e == 3) {
str = "Wifis";
}
if (fl.a) {
fl.b("TxRequestSender", "post" + str + "Request: failed to add request,because the queue has full,so we delete the first");
}
}
return offer;
}
public void a(Handler handler, boolean z) {
if (this.g) {
return;
}
this.g = true;
this.i = handler;
this.h = z;
this.b.i().execute(new Runnable() {
@Override
public void run() {
eh.this.a.clear();
eh.this.c();
}
});
this.f = SystemClock.elapsedRealtime();
}
public void a() {
if (this.g) {
this.g = false;
this.a.clear();
this.a.offer(a.d);
this.i = null;
if (this.f != 0) {
String format = String.format(Locale.ENGLISH, "shutdown: duration=%ds, sent=%dB, recv=%dB, reqCount=%d", Long.valueOf((SystemClock.elapsedRealtime() - this.f) / 1000), Long.valueOf(this.d), Long.valueOf(this.e), Long.valueOf(this.f74c));
if (fl.a) {
fl.a("TxRequestSender", format);
}
}
b();
}
}
private void b() {
this.f74c = 0L;
this.d = 0L;
this.e = 0L;
this.f = 0L;
}
public void c() {
a aVar;
Throwable th;
InterruptedException e;
long j2;
IOException e2;
LinkedBlockingQueue<a> linkedBlockingQueue = this.a;
a aVar2 = null;
while (this.g) {
try {
aVar = linkedBlockingQueue.take();
try {
try {
} catch (IOException e3) {
e2 = e3;
j2 = 0;
}
} catch (InterruptedException e4) {
e = e4;
if (fl.a) {
fl.a("TxRequestSender", "run: thread is interrupted", e);
}
aVar2 = aVar;
} catch (Throwable th2) {
th = th2;
if (fl.a) {
fl.a("TxRequestSender", "run: other exception.", th);
}
aVar2 = aVar;
}
} catch (IOException e5) {
j2 = 0;
aVar = aVar2;
e2 = e5;
} catch (InterruptedException e6) {
aVar = aVar2;
e = e6;
} catch (Throwable th3) {
aVar = aVar2;
th = th3;
}
if (a.d == aVar) {
if (fl.a) {
fl.a("TxRequestSender", "run: state=[shutdown]");
return;
}
return;
}
j2 = System.currentTimeMillis();
try {
Bundle a2 = this.b.a(aVar.g, aVar.f, true);
String string = a2.getString(CommonNetImpl.RESULT);
long currentTimeMillis = System.currentTimeMillis() - j2;
fl.a("cost:" + currentTimeMillis + ",result:" + string);
if (string == null) {
string = "";
}
a(aVar, string);
Handler handler = this.i;
aVar.f75c = j2;
if (!this.h && this.g && handler != null && handler.getLooper().getThread().isAlive()) {
Message obtainMessage = handler.obtainMessage();
obtainMessage.arg1 = (int) currentTimeMillis;
a(string, aVar, obtainMessage);
}
if (aVar.e == 1 && this.b.h().m() == 0) {
this.b.h().c(currentTimeMillis);
this.b.h().i(a2.getString("req_key"));
}
} catch (IOException e7) {
e2 = e7;
long currentTimeMillis2 = System.currentTimeMillis() - j2;
if (fl.a) {
fl.a("TxRequestSender", "cost:" + currentTimeMillis2 + ",run: io error", e2);
}
b(aVar);
if (fl.a) {
fl.b("TxRequestSender", "Send timeout");
}
Handler handler2 = this.i;
Looper looper = handler2 == null ? null : handler2.getLooper();
if (looper != null && looper.getThread().isAlive()) {
handler2.sendEmptyMessageDelayed(4998, 0L);
}
aVar2 = aVar;
}
aVar2 = aVar;
}
}
private void a(a aVar, String str) throws FileNotFoundException, IOException {
byte[] a2;
this.f74c++;
this.d += aVar.f.length;
this.e += fs.a(str.getBytes("UTF-8")) != null ? a2.length : 0;
}
private void b(a aVar) {
boolean z;
a.d(aVar);
Iterator<a> it = this.a.iterator();
while (true) {
if (!it.hasNext()) {
z = false;
break;
} else if (it.next().e == aVar.e) {
z = true;
break;
}
}
if (aVar.h <= 0 || z) {
return;
}
if (fl.a) {
fl.a("TxRequestSender", "retryIfNeed: times=" + aVar.h);
}
this.a.offer(aVar);
}
private void a(String str, a aVar, Message message) {
if (fl.a) {
fl.b("TxRequestSender", "handleResponse");
}
if (1 == aVar.e) {
if (fl.a) {
fl.b("TxRequestSender", "handleResponse result: " + str);
}
message.obj = Pair.create(str, aVar);
message.what = 4999;
message.sendToTarget();
}
}
private String a(byte[] bArr, int i) {
boolean a2 = ev.a();
try {
if (fl.a) {
fl.a("hh", "obfuscate fun_o");
}
if (!a2 && bArr != null && SoUtils.fun_o(bArr, 1) >= 0) {
return dz.a(1, i, 1);
}
return dz.a(1, i, 0);
} catch (UnsatisfiedLinkError unused) {
return null;
}
}
public static class a {
public static final a d = new a();
final Object a;
public String b;
public long f75c;
private final int e;
private final byte[] f;
private final String g;
private int h;
static int d(a aVar) {
int i = aVar.h;
aVar.h = i - 1;
return i;
}
private a() {
this.h = 1;
this.e = 0;
this.f = null;
this.g = null;
this.a = null;
}
a(int i, byte[] bArr, String str, Object obj) {
this.h = 1;
this.e = i;
this.f = bArr;
this.g = str;
this.a = obj;
}
}
}