Google Installer v1.0版本的 MD5 值为:cded706947e19d011b30ce3df4f280af
以下内容为反编译后的 c.java 源代码,内容仅作参考
package uAgent.commonsdk.statistics.internal;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import com.android.leech.base.bugly.download.BuglyStrategy;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLHandshakeException;
import org.apache.http.conn.ssl.SSLSocketFactory;
import uAgent.commonsdk.framework.UMEnvelopeBuild;
import uAgent.commonsdk.statistics.AnalyticsConstants;
import uAgent.commonsdk.statistics.UMServerURL;
import uAgent.commonsdk.statistics.common.DataHelper;
import uAgent.commonsdk.statistics.common.DeviceConfig;
import uAgent.commonsdk.statistics.common.HelperUtils;
import uAgent.commonsdk.statistics.common.MLog;
import uAgent.commonsdk.statistics.noise.ABTest;
public class c {
private static boolean e = false;
private String a = "10.0.0.172";
private int b = 80;
private Context c;
private b d;
public c(Context context) {
this.c = context;
}
private void a() {
String imprintProperty = UMEnvelopeBuild.imprintProperty(this.c, "domain_p", "");
String imprintProperty2 = UMEnvelopeBuild.imprintProperty(this.c, "domain_s", "");
if (!TextUtils.isEmpty(imprintProperty)) {
UMServerURL.DEFAULT_URL = DataHelper.assembleURL(imprintProperty);
}
if (!TextUtils.isEmpty(imprintProperty2)) {
UMServerURL.SECONDARY_URL = DataHelper.assembleURL(imprintProperty2);
}
AnalyticsConstants.APPLOG_URL_LIST = new String[]{UMServerURL.DEFAULT_URL, UMServerURL.SECONDARY_URL};
int testPolicy = ABTest.getService(this.c).getTestPolicy();
if (testPolicy != -1) {
if (testPolicy == 0) {
AnalyticsConstants.APPLOG_URL_LIST = new String[]{UMServerURL.DEFAULT_URL, UMServerURL.SECONDARY_URL};
} else if (testPolicy == 1) {
AnalyticsConstants.APPLOG_URL_LIST = new String[]{UMServerURL.SECONDARY_URL, UMServerURL.DEFAULT_URL};
}
}
}
private boolean b() {
NetworkInfo activeNetworkInfo;
String extraInfo;
if (this.c.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", this.c.getPackageName()) != 0) {
return false;
}
try {
ConnectivityManager connectivityManager = (ConnectivityManager) this.c.getSystemService("connectivity");
if (DeviceConfig.checkPermission(this.c, "android.permission.ACCESS_NETWORK_STATE") && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null && activeNetworkInfo.getType() != 1 && (extraInfo = activeNetworkInfo.getExtraInfo()) != null) {
if (!extraInfo.equals("cmwap") && !extraInfo.equals("3gwap")) {
if (extraInfo.equals("uniwap")) {
}
}
return true;
}
} catch (Throwable th) {
uAgent.commonsdk.proguard.b.a(this.c, th);
}
return false;
}
public void a(b bVar) {
this.d = bVar;
}
public byte[] a(byte[] bArr, String str) {
HttpsURLConnection httpsURLConnection;
OutputStream outputStream;
HttpsURLConnection httpsURLConnection2;
OutputStream outputStream2;
URLConnection openConnection;
OutputStream outputStream3 = null;
try {
try {
if (this.d != null) {
this.d.onRequestStart();
}
if (b()) {
openConnection = new URL(str).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(this.a, this.b)));
} else {
openConnection = new URL(str).openConnection();
}
httpsURLConnection = (HttpsURLConnection) openConnection;
} catch (Throwable th) {
th = th;
httpsURLConnection = str;
outputStream3 = outputStream2;
}
try {
if (!e) {
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, null, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
e = true;
}
httpsURLConnection.setRequestProperty("X-Umeng-UTC", String.valueOf(System.currentTimeMillis()));
httpsURLConnection.setRequestProperty("X-Umeng-Sdk", a.a(this.c).b());
httpsURLConnection.setRequestProperty("Content-Type", a.a(this.c).a());
httpsURLConnection.setRequestProperty("Msg-Type", "envelope/json");
httpsURLConnection.setConnectTimeout(BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH);
httpsURLConnection.setReadTimeout(BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setDoInput(true);
boolean z = false;
httpsURLConnection.setUseCaches(false);
outputStream = httpsURLConnection.getOutputStream();
try {
outputStream.write(bArr);
outputStream.flush();
httpsURLConnection.connect();
if (this.d != null) {
this.d.onRequestEnd();
}
int responseCode = httpsURLConnection.getResponseCode();
String headerField = httpsURLConnection.getHeaderField("Content-Type");
if (!TextUtils.isEmpty(headerField) && headerField.equalsIgnoreCase("application/thrift")) {
z = true;
}
if (AnalyticsConstants.UM_DEBUG) {
MLog.d("status code : " + responseCode + "; isThrifit:" + z);
}
if (responseCode != 200 || !z) {
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e2) {
uAgent.commonsdk.proguard.b.a(this.c, e2);
}
}
if (httpsURLConnection != 0) {
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused) {
}
httpsURLConnection.disconnect();
return null;
}
return null;
}
MLog.i("Send message to server. status code is: " + responseCode);
InputStream inputStream = httpsURLConnection.getInputStream();
try {
byte[] readStreamToByteArray = HelperUtils.readStreamToByteArray(inputStream);
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e3) {
uAgent.commonsdk.proguard.b.a(this.c, e3);
}
}
if (httpsURLConnection != 0) {
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused2) {
}
httpsURLConnection.disconnect();
}
return readStreamToByteArray;
} finally {
HelperUtils.safeClose(inputStream);
}
} catch (SSLHandshakeException unused3) {
httpsURLConnection2 = httpsURLConnection;
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e4) {
uAgent.commonsdk.proguard.b.a(this.c, e4);
}
}
if (httpsURLConnection2 != null) {
try {
httpsURLConnection2.getInputStream().close();
} catch (IOException unused4) {
}
httpsURLConnection2.disconnect();
return null;
}
return null;
} catch (Throwable th2) {
th = th2;
uAgent.commonsdk.proguard.b.a(this.c, th);
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e5) {
uAgent.commonsdk.proguard.b.a(this.c, e5);
}
}
if (httpsURLConnection != null) {
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused5) {
}
httpsURLConnection.disconnect();
return null;
}
return null;
}
} catch (SSLHandshakeException unused6) {
outputStream = null;
httpsURLConnection2 = httpsURLConnection;
} catch (Throwable th3) {
th = th3;
if (outputStream3 != null) {
try {
outputStream3.close();
} catch (Exception e6) {
uAgent.commonsdk.proguard.b.a(this.c, e6);
}
}
if (httpsURLConnection != null) {
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused7) {
}
httpsURLConnection.disconnect();
}
throw th;
}
} catch (SSLHandshakeException unused8) {
httpsURLConnection2 = null;
outputStream = null;
} catch (Throwable th4) {
th = th4;
httpsURLConnection = null;
outputStream = null;
}
}
public byte[] a(byte[] bArr, boolean z) {
a();
byte[] bArr2 = null;
int i = 0;
while (true) {
if (i >= AnalyticsConstants.APPLOG_URL_LIST.length) {
break;
}
bArr2 = a(bArr, AnalyticsConstants.APPLOG_URL_LIST[i]);
if (bArr2 != null) {
b bVar = this.d;
if (bVar != null) {
bVar.onRequestSucceed(z);
}
} else {
b bVar2 = this.d;
if (bVar2 != null) {
bVar2.onRequestFailed();
}
i++;
}
}
return bArr2;
}
}