百度手机卫士 v8.4.5版本的 MD5 值为:c65ef854a40bb6200c4d8c4603c58403
以下内容为反编译后的 aip.java 源代码,内容仅作参考
package dxoptimizer;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import com.quickbird.sdk.internal.HttpsClient;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONException;
import org.json.JSONObject;
public class aip {
public static boolean a;
public static boolean b;
public static boolean c;
public static boolean d;
static {
a = !abg.b;
b = alv.a;
c = b;
d = c;
}
public static JSONObject a(String str, Number number) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(str, number);
} catch (JSONException e) {
}
return jSONObject;
}
public static boolean a(Context context, int i) {
try {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.getType() == i) {
if (activeNetworkInfo.isConnectedOrConnecting()) {
return true;
}
}
return false;
} catch (Exception e) {
return false;
}
}
public static boolean a(Context context) {
try {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null) {
if (activeNetworkInfo.isConnected()) {
return true;
}
}
return false;
} catch (Exception e) {
return false;
}
}
public static long a(Context context, String str) {
return context.getSharedPreferences("rt", 0).getLong(str, 0L);
}
public static void b(Context context, String str) {
SharedPreferences.Editor edit = context.getSharedPreferences("rt", 0).edit();
edit.putLong(str, System.currentTimeMillis());
edit.commit();
}
public static void c(Context context, String str) {
SharedPreferences.Editor edit = context.getSharedPreferences("rt", 0).edit();
edit.putLong(str, 0L);
edit.commit();
}
public static int b(Context context) {
return context.getSharedPreferences("rt", 0).getInt("rts", 0);
}
public static void c(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences("rt", 0);
int i = sharedPreferences.getInt("rts", 0);
if (i < 3) {
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putInt("rts", i + 1);
edit.commit();
}
}
public static void d(Context context) {
SharedPreferences.Editor edit = context.getSharedPreferences("rt", 0).edit();
edit.putInt("rts", 0);
edit.commit();
}
public static int e(Context context) {
return context.getSharedPreferences("rt", 0).getInt("rtv", 0);
}
public static void b(Context context, int i) {
SharedPreferences.Editor edit = context.getSharedPreferences("rt", 0).edit();
edit.putInt("rtv", i);
edit.commit();
}
public static void a(SharedPreferences.Editor editor) {
if (editor != null) {
try {
editor.commit();
} catch (Exception e) {
}
}
}
public static String a(Date date) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((java.util.Date) date);
}
public static String a(String str) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(str.getBytes(HttpsClient.HTTP_CHARSET));
return new String(ihy.a(messageDigest.digest()), HttpsClient.HTTP_CHARSET);
} catch (UnsupportedEncodingException e) {
if (d) {
Log.e("stat.CommonUtils", "Encoding#2 not found.", e);
return str;
}
return str;
} catch (NoSuchAlgorithmException e2) {
if (d) {
Log.e("stat.CommonUtils", "Encoding#1 not found.", e2);
return str;
}
return str;
}
}
public static String a(String str, Context context) {
HashMap hashMap = new HashMap();
String a2 = aad.a(context);
String a3 = ahr.a(a2, ahs.b());
if ("data".equals(str)) {
amf.a("token", a3, hashMap);
}
amf.a("tk", a2, hashMap);
amf.a("sv", ago.a(), hashMap);
String str2 = "?" + amf.a(hashMap, HttpsClient.HTTP_CHARSET);
if ("feedback".equals(str)) {
if (a) {
return "http://sandbox.sjws.baidu.com:8080/statistics_feedback" + str2;
}
return "https://mobsec-pasta.baidu.com/feedback" + str2;
}
if ("appInfo".equals(str)) {
if (a) {
return "http://sandbox.sjws.baidu.com:8080/api/tokens" + str2;
}
return "https://mobsec-pasta.baidu.com/api/tokens" + str2;
}
if ("data".equals(str)) {
if (a) {
return "http://sandbox.sjws.baidu.com:8080/api/data" + str2;
}
return "https://mobsec-pasta.baidu.com/api/data" + str2;
}
if ("token".equals(str)) {
if (a) {
return "http://sandbox.sjws.baidu.com:8080/api/tokens" + str2;
}
return "https://mobsec-pasta.baidu.com/api/tokens" + str2;
}
return "";
}
public static boolean f(Context context) {
boolean z;
boolean z2;
String str = null;
amu a2 = amu.a(context);
context.getContentResolver();
PackageManager packageManager = context.getPackageManager();
String b2 = a2.b("android.{F46B117B-CBC7-4ac2-8F3C-43C1649DC76WR}", (String) null);
String packageName = context.getPackageName();
if (packageName == null || packageManager == null) {
return false;
}
Iterator<ApplicationInfo> it = packageManager.getInstalledApplications(0).iterator();
while (true) {
if (!it.hasNext()) {
z = false;
z2 = false;
break;
}
String str2 = it.next().packageName;
if (str2 != null) {
if ("com.dianxinos.dxservice".equals(str2)) {
z = true;
z2 = false;
break;
}
if (str2.equals(b2)) {
z = false;
z2 = true;
break;
}
if (!b(str2) || (str != null && str.compareTo(str2) <= 0)) {
str2 = str;
}
str = str2;
}
}
if (z2) {
if (packageName.equals(b2)) {
return true;
}
} else if (z) {
if (packageName.equals("com.dianxinos.dxservice")) {
return a2.a("android.{F46B117B-CBC7-4ac2-8F3C-43C1649DC76WR}", packageName);
}
} else if (str == null || packageName.equals(str)) {
return a2.a("android.{F46B117B-CBC7-4ac2-8F3C-43C1649DC76WR}", packageName);
}
return false;
}
private static boolean b(String str) {
String[] split = str.split("\\.");
return split.length > 1 && split[1].equals("dianxinos");
}
public static void g(Context context) {
amu.a(context).a("android.{F46B117B-CBC7-4ac2-8F3C-43C1649DC76WR}", "");
}
}