手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634
以下内容为反编译后的 amf.java 源代码,内容仅作参考
package tcs;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Proxy;
import android.os.Environment;
import android.os.Process;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import com.tencent.kingkong.database.SQLiteDatabase;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.zip.GZIPInputStream;
import org.apache.http.HttpHost;
import org.json.JSONObject;
public final class amf {
private static String a = null;
private static String OT = null;
private static String Rb = null;
private static String dHg = null;
private static Random dMR = null;
private static DisplayMetrics dMS = null;
private static String dCB = null;
private static String dCC = SQLiteDatabase.KeyEmpty;
private static String dCD = SQLiteDatabase.KeyEmpty;
private static int dCX = -1;
private static aiy dMW = null;
private static String dNV = null;
private static String dDO = null;
private static volatile int dCu = -1;
private static String dNW = null;
private static String dHO = null;
private static long dNX = -1;
private static String dHQ = SQLiteDatabase.KeyEmpty;
private static amn dNY = null;
private static String dNZ = "__MTA_FIRST_ACTIVATE__";
private static int dOa = -1;
private static long dOb = -1;
private static int w = 0;
private static String dOc = SQLiteDatabase.KeyEmpty;
public static synchronized String F(Context context) {
String str;
synchronized (amf.class) {
if (a == null || a.trim().length() == 0) {
String bo = amq.bo(context);
a = bo;
if (bo == null || a.trim().length() == 0) {
a = Integer.toString(tC().nextInt(Integer.MAX_VALUE));
}
str = a;
} else {
str = a;
}
}
return str;
}
public static void P(Context context, int i) {
w = i;
amp.d(context, "mta.qq.com.difftime", i);
}
private static Long a(String str, String str2, Long l) {
if (str == null || str2 == null) {
return l;
}
if (str2.equalsIgnoreCase(".") || str2.equalsIgnoreCase("|")) {
str2 = "\\" + str2;
}
String[] split = str.split(str2);
if (split.length != 3) {
return l;
}
try {
Long l2 = 0L;
int i = 0;
while (i < split.length) {
Long valueOf = Long.valueOf(100 * (l2.longValue() + Long.valueOf(split[i]).longValue()));
i++;
l2 = valueOf;
}
return l2;
} catch (NumberFormatException e) {
return l;
}
}
public static boolean a(com.tencent.wxop.stat.x xVar) {
if (xVar == null) {
return false;
}
return e(xVar.wz());
}
public static String ai(Context context, String str) {
if (!com.tencent.wxop.stat.u.vE()) {
return str;
}
if (dDO == null) {
dDO = bD(context);
}
return dDO != null ? str + "_" + dDO : str;
}
public static byte[] b(byte[] bArr) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
GZIPInputStream gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
byte[] bArr2 = new byte[4096];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bArr.length * 2);
while (true) {
int read = gZIPInputStream.read(bArr2);
if (read == -1) {
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayInputStream.close();
gZIPInputStream.close();
byteArrayOutputStream.close();
return byteArray;
}
byteArrayOutputStream.write(bArr2, 0, read);
}
}
public static Integer bA(Context context) {
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
if (telephonyManager != null) {
return Integer.valueOf(telephonyManager.getNetworkType());
}
} catch (Throwable th) {
}
return null;
}
public static String bB(Context context) {
if (e(dCD)) {
return dCD;
}
try {
String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
dCD = str;
if (str != null) {
}
return aco.UNKNOWN;
} catch (Throwable th) {
dMW.f(th);
}
return dCD;
}
public static String bC(Context context) {
String str;
String path;
if (e(dNV)) {
return dNV;
}
try {
} catch (Throwable th) {
dMW.f(th);
}
if (amq.ae(context, "android.permission.WRITE_EXTERNAL_STORAGE")) {
String externalStorageState = Environment.getExternalStorageState();
if (externalStorageState != null && externalStorageState.equals("mounted") && (path = Environment.getExternalStorageDirectory().getPath()) != null) {
StatFs statFs = new StatFs(path);
str = String.valueOf((statFs.getAvailableBlocks() * statFs.getBlockSize()) / 1000000) + "/" + String.valueOf((statFs.getBlockCount() * statFs.getBlockSize()) / 1000000);
dNV = str;
}
str = null;
} else {
dMW.warn("can not get the permission of android.permission.WRITE_EXTERNAL_STORAGE");
str = null;
}
return str;
}
public static String bD(Context context) {
if (dDO != null) {
return dDO;
}
int myPid = Process.myPid();
Iterator<ActivityManager.RunningAppProcessInfo> it = ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ActivityManager.RunningAppProcessInfo next = it.next();
if (next.pid == myPid) {
dDO = next.processName;
break;
}
}
return dDO;
}
public static String bE(Context context) {
return ai(context, ahp.dHf);
}
public static synchronized Integer bF(Context context) {
Integer valueOf;
synchronized (amf.class) {
if (dCu <= 0) {
dCu = amp.c(context, "MTA_EVENT_INDEX", 0);
amp.d(context, "MTA_EVENT_INDEX", dCu + 1000);
} else if (dCu % 1000 == 0) {
try {
amp.d(context, "MTA_EVENT_INDEX", dCu < 2147383647 ? dCu + 1000 : 0);
} catch (Throwable th) {
dMW.E(th);
}
}
int i = dCu + 1;
dCu = i;
valueOf = Integer.valueOf(i);
}
return valueOf;
}
public static String bG(Context context) {
try {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return String.valueOf(memoryInfo.availMem / 1000000) + "/" + String.valueOf(tL() / 1000000);
} catch (Throwable th) {
th.printStackTrace();
return null;
}
}
public static String bQ(Context context) {
List<Sensor> sensorList;
if (e(dHQ)) {
return dHQ;
}
try {
SensorManager sensorManager = (SensorManager) context.getSystemService("sensor");
if (sensorManager != null && (sensorList = sensorManager.getSensorList(-1)) != null) {
StringBuilder sb = new StringBuilder(sensorList.size() * 10);
for (int i = 0; i < sensorList.size(); i++) {
sb.append(sensorList.get(i).getType());
if (i != sensorList.size() - 1) {
sb.append(",");
}
}
dHQ = sb.toString();
}
} catch (Throwable th) {
dMW.f(th);
}
return dHQ;
}
public static synchronized int bR(Context context) {
int i;
synchronized (amf.class) {
if (dOa != -1) {
i = dOa;
} else {
bS(context);
i = dOa;
}
}
return i;
}
public static void bS(Context context) {
int c = amp.c(context, dNZ, 1);
dOa = c;
if (c == 1) {
amp.d(context, dNZ, 0);
}
}
public static boolean bT(Context context) {
if (dOb < 0) {
dOb = amp.aj(context, "mta.qq.com.checktime");
}
return Math.abs(System.currentTimeMillis() - dOb) > 86400000;
}
public static void bU(Context context) {
dOb = System.currentTimeMillis();
amp.b(context, "mta.qq.com.checktime", dOb);
}
public static String bV(Context context) {
if (context == null) {
return null;
}
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 0);
if (resolveActivity.activityInfo == null || resolveActivity.activityInfo.packageName.equals("android")) {
return null;
}
return resolveActivity.activityInfo.packageName;
}
public static HttpHost bk(Context context) {
HttpHost httpHost;
if (context == null) {
return null;
}
try {
} catch (Throwable th) {
dMW.f(th);
}
if (context.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", context.getPackageName()) != 0) {
httpHost = null;
} else {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo == null) {
httpHost = null;
} else if (activeNetworkInfo.getTypeName() == null || !activeNetworkInfo.getTypeName().equalsIgnoreCase("WIFI")) {
String extraInfo = activeNetworkInfo.getExtraInfo();
if (extraInfo == null) {
httpHost = null;
} else if (extraInfo.equals(tmsdk.common.internal.utils.y.ctX) || extraInfo.equals(tmsdk.common.internal.utils.y.ctZ) || extraInfo.equals(tmsdk.common.internal.utils.y.cub)) {
httpHost = new HttpHost("10.0.0.172", 80);
} else if (extraInfo.equals(tmsdk.common.internal.utils.y.cud)) {
httpHost = new HttpHost("10.0.0.200", 80);
} else {
String defaultHost = Proxy.getDefaultHost();
if (defaultHost != null && defaultHost.trim().length() > 0) {
httpHost = new HttpHost(defaultHost, Proxy.getDefaultPort());
}
httpHost = null;
}
} else {
httpHost = null;
}
}
return httpHost;
}
public static synchronized String bl(Context context) {
String str;
synchronized (amf.class) {
if (Rb == null || Rb.trim().length() == 0) {
Rb = amq.F(context);
}
str = Rb;
}
return str;
}
public static DisplayMetrics bp(Context context) {
if (dMS == null) {
dMS = new DisplayMetrics();
((WindowManager) context.getApplicationContext().getSystemService("window")).getDefaultDisplay().getMetrics(dMS);
}
return dMS;
}
public static boolean br(Context context) {
NetworkInfo[] allNetworkInfo;
try {
} catch (Throwable th) {
dMW.f(th);
}
if (!amq.ae(context, "android.permission.ACCESS_WIFI_STATE")) {
dMW.warn("can not get the permission of android.permission.ACCESS_WIFI_STATE");
return false;
}
ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService("connectivity");
if (connectivityManager != null && (allNetworkInfo = connectivityManager.getAllNetworkInfo()) != null) {
for (int i = 0; i < allNetworkInfo.length; i++) {
if (allNetworkInfo[i].getTypeName().equalsIgnoreCase("WIFI") && allNetworkInfo[i].isConnected()) {
return true;
}
}
}
return false;
}
public static String bt(Context context) {
if (OT != null) {
return OT;
}
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
if (applicationInfo != null) {
String string = applicationInfo.metaData.getString("TA_APPKEY");
if (string != null) {
OT = string;
return string;
}
dMW.D("Could not read APPKEY meta-data from AndroidManifest.xml");
}
} catch (Throwable th) {
dMW.D("Could not read APPKEY meta-data from AndroidManifest.xml");
}
return null;
}
public static String bu(Context context) {
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
if (applicationInfo != null) {
Object obj = applicationInfo.metaData.get("InstallChannel");
if (obj != null) {
return obj.toString();
}
dMW.E("Could not read InstallChannel meta-data from AndroidManifest.xml");
}
} catch (Throwable th) {
dMW.h("Could not read InstallChannel meta-data from AndroidManifest.xml");
}
return null;
}
public static String bv(Context context) {
if (context == null) {
return null;
}
return context.getClass().getName();
}
public static String bw(Context context) {
TelephonyManager telephonyManager;
if (dCB != null) {
return dCB;
}
try {
if (amq.ae(context, "android.permission.READ_PHONE_STATE")) {
if ((context.getPackageManager().checkPermission("android.permission.READ_PHONE_STATE", context.getPackageName()) == 0) && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) {
dCB = telephonyManager.getSimOperator();
}
} else {
dMW.h("Could not get permission of android.permission.READ_PHONE_STATE");
}
} catch (Throwable th) {
dMW.f(th);
}
return dCB;
}
public static String bx(Context context) {
if (e(dCC)) {
return dCC;
}
try {
String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
dCC = str;
if (str == null) {
return SQLiteDatabase.KeyEmpty;
}
} catch (Throwable th) {
dMW.f(th);
}
return dCC;
}
public static String by(Context context) {
String str;
String str2 = SQLiteDatabase.KeyEmpty;
try {
if (amq.ae(context, "android.permission.INTERNET") && amq.ae(context, "android.permission.ACCESS_NETWORK_STATE")) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
str = activeNetworkInfo.getTypeName();
String extraInfo = activeNetworkInfo.getExtraInfo();
if (str != null) {
if (str.equalsIgnoreCase("WIFI")) {
str2 = "WIFI";
} else if (str.equalsIgnoreCase("MOBILE")) {
str2 = extraInfo != null ? extraInfo : "MOBILE";
} else {
if (extraInfo != null) {
str2 = extraInfo;
}
str2 = str;
}
}
}
str = SQLiteDatabase.KeyEmpty;
str2 = str;
} else {
dMW.h("can not get the permission of android.permission.ACCESS_WIFI_STATE");
}
} catch (Throwable th) {
dMW.f(th);
}
return str2;
}
public static String ci(String str) {
if (str == null) {
return "0";
}
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(str.getBytes());
byte[] digest = messageDigest.digest();
StringBuffer stringBuffer = new StringBuffer();
for (byte b : digest) {
int i = b & 255;
if (i < 16) {
stringBuffer.append("0");
}
stringBuffer.append(Integer.toHexString(i));
}
return stringBuffer.toString();
} catch (Throwable th) {
return "0";
}
}
public static long cm(String str) {
return a(str, ".", 0L).longValue();
}
public static boolean e(String str) {
return (str == null || str.trim().length() == 0) ? false : true;
}
public static int o(Context context, boolean z) {
if (z) {
w = amp.c(context, "mta.qq.com.difftime", 0);
}
return w;
}
public static long rU() {
try {
Calendar calendar = Calendar.getInstance();
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.set(14, 0);
return calendar.getTimeInMillis() + 86400000;
} catch (Throwable th) {
dMW.f(th);
return System.currentTimeMillis() + 86400000;
}
}
public static int sc() {
return tC().nextInt(Integer.MAX_VALUE);
}
private static synchronized Random tC() {
Random random;
synchronized (amf.class) {
if (dMR == null) {
dMR = new Random();
}
random = dMR;
}
return random;
}
public static int tD() {
if (dCX != -1) {
return dCX;
}
try {
if (amo.a()) {
dCX = 1;
}
} catch (Throwable th) {
dMW.f(th);
}
dCX = 0;
return 0;
}
public static synchronized aiy tI() {
aiy aiyVar;
synchronized (amf.class) {
if (dMW == null) {
aiy aiyVar2 = new aiy("MtaSDK");
dMW = aiyVar2;
aiyVar2.si();
}
aiyVar = dMW;
}
return aiyVar;
}
public static String tJ() {
Calendar calendar = Calendar.getInstance();
calendar.roll(6, 0);
return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());
}
public static String tK() {
if (e(dHO)) {
return dHO;
}
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
StatFs statFs2 = new StatFs(Environment.getDataDirectory().getPath());
String str = String.valueOf((statFs2.getAvailableBlocks() * statFs2.getBlockSize()) / 1000000) + "/" + String.valueOf((statFs.getBlockCount() * statFs.getBlockSize()) / 1000000);
dHO = str;
return str;
}
private static long tL() {
if (dNX > 0) {
return dNX;
}
long j = 1;
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/meminfo"), 8192);
j = Integer.valueOf(bufferedReader.readLine().split("\\s+")[1]).intValue() * 1024;
bufferedReader.close();
} catch (Exception e) {
}
dNX = j;
return j;
}
public static JSONObject tM() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("n", amh.sc());
String tK = amh.tK();
if (tK != null && tK.length() > 0) {
jSONObject.put("na", tK);
}
int tO = amh.tO();
if (tO > 0) {
jSONObject.put("fx", tO / 1000000);
}
int uD = amh.uD();
if (uD > 0) {
jSONObject.put("fn", uD / 1000000);
}
} catch (Throwable th) {
}
return jSONObject;
}
public static String u(long j) {
return new SimpleDateFormat("yyyyMMdd").format(new Date(j));
}
}