安全中心 v4.9.2版本的 MD5 值为:d64c0ec7920c532fa6e6d9bb001cf9bf
以下内容为反编译后的 DownloaderApn.java 源代码,内容仅作参考
package com.tencent.halley.common.downloader_detector;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.tencent.kingkong.database.SQLiteDatabase;
import java.net.InetSocketAddress;
import java.net.Proxy;
import meri.pluginsdk.d;
import tcs.bmc;
import tcs.bmg;
import tmsdk.common.internal.utils.y;
public class DownloaderApn {
private static a gbm;
public static String ctX = y.ctX;
public static String ctY = y.ctY;
public static String ctZ = y.ctZ;
public static String cua = y.cua;
public static String cub = y.cub;
public static String cuc = y.cuc;
public static String cud = y.cud;
public static String cue = y.cue;
public static String cuf = y.cuf;
private static volatile boolean gbf = true;
public static String gbg = SQLiteDatabase.KeyEmpty;
private static int gbh = 0;
private static boolean gbi = false;
public static String gbj = SQLiteDatabase.KeyEmpty;
public static int gbk = 0;
public static int gbl = 0;
private static BroadcastReceiver gbn = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DownloaderApn.aiN();
DownloaderApn.aji();
}
};
private static volatile boolean gbo = false;
public static class PhoneStateMonitor extends PhoneStateListener {
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
DownloaderApn.gbk = DownloaderApn.jV((signalStrength.getGsmSignalStrength() * 2) - 113);
}
}
public interface a {
void ac(int i, String str);
}
public static void a(a aVar) {
gbm = aVar;
}
public static int aR(int i, int i2) {
if (Build.VERSION.SDK_INT >= 14) {
return WifiManager.calculateSignalLevel(i, i2);
}
if (i <= -100) {
return 0;
}
if (i >= -55) {
return i2 - 1;
}
return (int) (((i - (-100)) * (i2 - 1)) / 45);
}
public static void aiN() {
?? equals;
ConnectivityManager connectivityManager;
bmc.c("DownloaderApn", "updateApn");
if (gbo) {
return;
}
gbo = true;
synchronized (DownloaderApn.class) {
try {
String str = gbg;
try {
connectivityManager = (ConnectivityManager) bmg.agJ().getSystemService("connectivity");
} catch (Throwable th) {
th.printStackTrace();
aiO();
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
}
if (connectivityManager == null) {
aiO();
gbf = false;
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
return;
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null) {
aiO();
gbf = false;
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
return;
}
if (activeNetworkInfo.isConnected()) {
gbf = true;
} else {
gbf = false;
}
int type = activeNetworkInfo.getType();
if (type == 1) {
gbh = 1;
gbi = false;
gbj = SQLiteDatabase.KeyEmpty;
WifiInfo connectionInfo = ((WifiManager) bmg.agJ().getSystemService("wifi")).getConnectionInfo();
if (connectionInfo.getBSSID() != null) {
gbl = aR(connectionInfo.getRssi(), 5);
}
gbg = "wifi_" + connectionInfo.getSSID() + "_" + connectionInfo.getBSSID();
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
return;
}
String extraInfo = activeNetworkInfo.getExtraInfo();
if (extraInfo == null) {
aiO();
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
return;
}
gbg = extraInfo.trim().toLowerCase();
if (type == 0) {
int subtype = activeNetworkInfo.getSubtype();
if (subtype == 1 || subtype == 2 || subtype == 4) {
gbh = 2;
} else if (subtype == 13) {
gbh = 4;
} else {
gbh = 3;
}
}
if (gbg.contains(ctZ)) {
gbi = true;
gbj = "10.0.0.172";
} else if (gbg.contains(ctX)) {
gbi = true;
gbj = "10.0.0.172";
} else if (gbg.contains(cub)) {
gbi = true;
gbj = "10.0.0.172";
} else if (gbg.contains(cud)) {
gbi = true;
gbj = "10.0.0.200";
} else {
gbi = false;
gbj = SQLiteDatabase.KeyEmpty;
}
if (!str.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
} catch (Throwable th2) {
if (!equals.equals(gbg) && gbm != null) {
gbm.ac(aiS(), gbg);
}
gbo = false;
throw th2;
}
}
}
private static void aiO() {
gbg = SQLiteDatabase.KeyEmpty;
gbh = 0;
gbi = false;
gbj = SQLiteDatabase.KeyEmpty;
}
public static Proxy aiP() {
if (!gbi || TextUtils.isEmpty(gbj)) {
return null;
}
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(gbj, 80));
}
public static boolean aiQ() {
return gbh == 1;
}
public static boolean aiR() {
return gbh == 2 || gbh == 3 || gbh == 4;
}
public static int aiS() {
return gbh;
}
public static boolean aiV() {
return gbf;
}
public static void aji() {
bmc.c("DownloaderApn", "showApnInfo... Apn:" + gbg + ",sIsNetworkOk:" + gbf + ",sNetType:" + gbh + ",sIsProxy:" + gbi + ",sProxyAddress:" + gbj);
}
public static boolean ajj() {
if (aiR()) {
return b.ajl();
}
return false;
}
public static boolean isProxy() {
return gbi;
}
public static int jV(int i) {
if (i <= -105) {
return 0;
}
if (i >= -85) {
return 5;
}
return (int) ((5 * (i - d.j.dKI)) / 20);
}
public static void vr() {
aiN();
aji();
bmg.agJ().registerReceiver(gbn, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
TelephonyManager telephonyManager = (TelephonyManager) bmg.agJ().getSystemService("phone");
if (telephonyManager != null) {
telephonyManager.listen(new PhoneStateMonitor(), 257);
}
}
}