手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634
以下内容为反编译后的 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 meri.pluginsdk.d;
import org.apache.http.HttpHost;
import org.apache.http.client.HttpClient;
import tcs.bif;
import tcs.bij;
import tmsdk.common.internal.utils.y;
public class DownloaderApn {
private static a eOU;
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 eON = true;
public static String eOO = SQLiteDatabase.KeyEmpty;
private static int eOP = 0;
private static boolean eOQ = false;
public static String eOR = SQLiteDatabase.KeyEmpty;
public static int eOS = 0;
public static int eOT = 0;
private static BroadcastReceiver eOV = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DownloaderApn.MG();
DownloaderApn.MM();
}
};
private static volatile boolean eOW = false;
public static class PhoneStateMonitor extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
DownloaderApn.eOS = DownloaderApn.jV((signalStrength.getGsmSignalStrength() * 2) - 113);
}
}
public interface a {
void M(int i, String str);
}
public static void MG() {
ConnectivityManager connectivityManager;
bif.c("DownloaderApn", "updateApn");
if (eOW) {
return;
}
eOW = true;
synchronized (DownloaderApn.class) {
String str = eOO;
try {
try {
connectivityManager = (ConnectivityManager) bij.agJ().getSystemService("connectivity");
} finally {
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
}
} catch (Exception e) {
e.printStackTrace();
MH();
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
}
if (connectivityManager == null) {
MH();
eON = false;
return;
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null) {
MH();
eON = false;
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
return;
}
if (activeNetworkInfo.isConnected()) {
eON = true;
} else {
eON = false;
}
int type = activeNetworkInfo.getType();
if (type == 1) {
eOP = 1;
eOQ = false;
eOR = SQLiteDatabase.KeyEmpty;
WifiInfo connectionInfo = ((WifiManager) bij.agJ().getSystemService("wifi")).getConnectionInfo();
if (connectionInfo.getBSSID() != null) {
eOT = aJ(connectionInfo.getRssi(), 5);
}
eOO = "wifi_" + connectionInfo.getSSID() + "_" + connectionInfo.getBSSID();
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
return;
}
String extraInfo = activeNetworkInfo.getExtraInfo();
if (extraInfo == null) {
MH();
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
return;
}
eOO = extraInfo.trim().toLowerCase();
if (type == 0) {
int subtype = activeNetworkInfo.getSubtype();
if (subtype == 1 || subtype == 2 || subtype == 4) {
eOP = 2;
} else if (subtype == 13) {
eOP = 4;
} else {
eOP = 3;
}
}
if (eOO.contains(ctZ)) {
eOQ = true;
eOR = "10.0.0.172";
} else if (eOO.contains(ctX)) {
eOQ = true;
eOR = "10.0.0.172";
} else if (eOO.contains(cub)) {
eOQ = true;
eOR = "10.0.0.172";
} else if (eOO.contains(cud)) {
eOQ = true;
eOR = "10.0.0.200";
} else {
eOQ = false;
eOR = SQLiteDatabase.KeyEmpty;
}
if (!str.equals(eOO) && eOU != null) {
eOU.M(MK(), eOO);
}
eOW = false;
}
}
private static void MH() {
eOO = SQLiteDatabase.KeyEmpty;
eOP = 0;
eOQ = false;
eOR = SQLiteDatabase.KeyEmpty;
}
public static boolean MI() {
return eOP == 1;
}
public static boolean MJ() {
return eOP == 2 || eOP == 3 || eOP == 4;
}
public static int MK() {
return eOP;
}
public static boolean ML() {
return eON;
}
public static void MM() {
bif.c("DownloaderApn", "showApnInfo... Apn:" + eOO + ",sIsNetworkOk:" + eON + ",sNetType:" + eOP + ",sIsProxy:" + eOQ + ",sProxyAddress:" + eOR);
}
public static boolean MN() {
if (MJ()) {
return b.MP();
}
return false;
}
public static void a(a aVar) {
eOU = aVar;
}
public static void a(HttpClient httpClient) {
if (!eOQ || TextUtils.isEmpty(eOR)) {
return;
}
httpClient.getParams().setParameter("http.route.default-proxy", new HttpHost(eOR, 80));
bif.D("DownloaderApn", "setProxy... sProxyAddress:" + eOR + ",apn:" + eOO);
}
public static int aJ(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 boolean isProxy() {
return eOQ;
}
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() {
MG();
MM();
bij.agJ().registerReceiver(eOV, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
TelephonyManager telephonyManager = (TelephonyManager) bij.agJ().getSystemService("phone");
if (telephonyManager != null) {
telephonyManager.listen(new PhoneStateMonitor(), 257);
}
}
}