360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.qihoo360.mobilesafe.businesscard.a;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.Signature;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import com.qihoo.appstore.utils.h;
import com.qihoo360.mobilesafe.util.AsyncResultReceiver;
import com.qihoo360.mobilesafe.util.aj;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
public class a {
private static a f5322a;
private static List f5323b = null;
public static com.qihoo360.mobilesafe.businesscard.a.a.a a(Context context, String str) {
try {
PackageManager packageManager = context.getPackageManager();
return a(packageManager, packageManager.getPackageInfo(str, 4292), false, true, a(packageManager));
} catch (PackageManager.NameNotFoundException e) {
return null;
}
}
private static com.qihoo360.mobilesafe.businesscard.a.a.a a(PackageManager packageManager, PackageInfo packageInfo, boolean z, boolean z2, HashSet hashSet) {
Bitmap bitmap;
Intent launchIntentForPackage;
ResolveInfo resolveActivity;
ByteArrayOutputStream byteArrayOutputStream = null;
ApplicationInfo applicationInfo = packageInfo.applicationInfo;
com.qihoo360.mobilesafe.businesscard.a.a.a aVar = new com.qihoo360.mobilesafe.businesscard.a.a.a();
aVar.f5325b = packageInfo.packageName;
aVar.c = packageInfo.versionCode;
aVar.d = packageInfo.versionName;
aVar.l = applicationInfo.sourceDir;
aVar.m = applicationInfo.dataDir;
aVar.n = applicationInfo.publicSourceDir;
aVar.o = (packageInfo.services == null || packageInfo.services.length <= 0) && (hashSet == null || !hashSet.contains(aVar.f5325b));
if (z2) {
aVar.f5324a = applicationInfo.loadLabel(packageManager).toString();
if (TextUtils.equals(aVar.f5324a, aVar.f5325b) && (launchIntentForPackage = packageManager.getLaunchIntentForPackage(aVar.f5325b)) != null && (resolveActivity = packageManager.resolveActivity(launchIntentForPackage, 0)) != null) {
aVar.f5324a = (String) resolveActivity.activityInfo.loadLabel(packageManager);
}
} else {
aVar.f5324a = aVar.f5325b;
}
if (TextUtils.equals(aVar.f5325b, "com.baidu.search") && aVar.d != null && aVar.d.startsWith("1.4.0.1-942b")) {
aVar.d = "1.4.0.1-942b";
}
if (TextUtils.equals(aVar.f5325b, "com.baidu.search") && aVar.d != null && aVar.d.startsWith("1.0.3.32-942c")) {
aVar.d = "1.0.3.32-942c";
}
try {
File file = new File(applicationInfo.sourceDir);
aVar.h = file.length();
aVar.i = file.lastModified();
if ((applicationInfo.flags & 262144) != 0) {
aVar.j = 0;
} else {
aVar.j = 1;
}
} catch (Exception e) {
}
if ((applicationInfo.flags & 1) != 0) {
aVar.k = (applicationInfo.flags & 128) != 0 ? 2 : 1;
} else {
aVar.k = 0;
}
StringBuilder sb = new StringBuilder();
if (packageInfo.requestedPermissions != null) {
for (String str : packageInfo.requestedPermissions) {
sb.append(str);
sb.append(":");
}
aVar.g = sb.toString();
}
StringBuilder sb2 = new StringBuilder();
if (packageInfo.signatures != null) {
for (Signature signature : packageInfo.signatures) {
sb2.append(aj.c(signature.toByteArray()));
sb2.append(";");
}
aVar.p = sb2.toString();
}
if (z) {
try {
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
try {
bitmap = ((BitmapDrawable) applicationInfo.loadIcon(packageManager)).getBitmap();
if (bitmap != null) {
try {
if (!bitmap.isRecycled()) {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream2);
aVar.e = new String(h.c(byteArrayOutputStream2.toByteArray(), 0));
}
} catch (Throwable th) {
th = th;
byteArrayOutputStream = byteArrayOutputStream2;
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException e2) {
}
}
if (bitmap == null) {
throw th;
}
bitmap.recycle();
throw th;
}
}
if (byteArrayOutputStream2 != null) {
try {
byteArrayOutputStream2.close();
} catch (IOException e3) {
}
}
if (bitmap != null) {
bitmap.recycle();
}
} catch (Throwable th2) {
th = th2;
bitmap = null;
byteArrayOutputStream = byteArrayOutputStream2;
}
} catch (Throwable th3) {
th = th3;
bitmap = null;
}
}
aVar.q = packageInfo.applicationInfo.enabled;
aVar.r = d(packageManager, packageInfo);
a(packageManager, aVar);
return aVar;
}
public static a a() {
if (f5322a == null) {
f5322a = new a();
}
return f5322a;
}
private static HashSet a(PackageManager packageManager) {
HashSet hashSet = new HashSet();
Iterator<ResolveInfo> it = packageManager.queryBroadcastReceivers(new Intent("android.intent.action.BOOT_COMPLETED"), 0).iterator();
while (it.hasNext()) {
hashSet.add(it.next().activityInfo.packageName);
}
Iterator<ResolveInfo> it2 = packageManager.queryBroadcastReceivers(new Intent("android.appwidget.action.APPWIDGET_UPDATE"), 0).iterator();
while (it2.hasNext()) {
hashSet.add(it2.next().activityInfo.packageName);
}
return hashSet;
}
public static void a(Context context, StringBuilder sb, ArrayList arrayList) {
Intent launchIntentForPackage;
ResolveInfo resolveActivity;
PackageManager packageManager = context.getPackageManager();
for (PackageInfo packageInfo : packageManager.getInstalledPackages(0)) {
String str = packageInfo.packageName;
if ((arrayList != null && arrayList.contains(str)) || arrayList == null || (arrayList != null && arrayList.size() <= 0)) {
sb.append("BEGIN:APPINFO").append("\r\n");
String charSequence = packageInfo.applicationInfo.loadLabel(packageManager).toString();
if (TextUtils.equals(charSequence, str) && (launchIntentForPackage = packageManager.getLaunchIntentForPackage(str)) != null && (resolveActivity = packageManager.resolveActivity(launchIntentForPackage, 0)) != null) {
charSequence = (String) resolveActivity.activityInfo.loadLabel(packageManager);
}
sb.append("APP_NAME:").append(charSequence).append("\r\n");
sb.append("PACKAGE_NAME:").append(str).append("\r\n");
sb.append("END:APPINFO").append("\r\n");
}
}
}
private static void a(PackageManager packageManager, com.qihoo360.mobilesafe.businesscard.a.a.a aVar) {
if (f5323b == null) {
f5323b = packageManager.queryBroadcastReceivers(new Intent("android.intent.action.BOOT_COMPLETED"), 512);
}
try {
if (packageManager.getApplicationEnabledSetting(aVar.f5325b) != 2) {
aVar.u = 1;
}
if (f5323b != null && f5323b.size() > 0) {
for (ResolveInfo resolveInfo : f5323b) {
String str = resolveInfo.activityInfo.packageName;
if (str.equals(aVar.f5325b)) {
String str2 = resolveInfo.activityInfo.name;
int indexOf = str2.indexOf("$");
if (indexOf > 0) {
str2 = str2.substring(0, indexOf);
}
if (packageManager.getComponentEnabledSetting(new ComponentName(str, str2)) != 2) {
aVar.t = 1;
}
aVar.s.add(str2);
}
}
}
} catch (Exception e) {
}
com.qihoo360.mobilesafe.util.h.a("dumpBootReceiverInfo", aVar.f5325b + " disable :" + aVar.u + "info.bootStatus :" + aVar.t, new Object[0]);
}
private static boolean a(PackageManager packageManager, PackageInfo packageInfo) {
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 0);
if (queryIntentActivities != null) {
for (ResolveInfo resolveInfo : queryIntentActivities) {
if (TextUtils.equals(packageInfo.packageName, resolveInfo.activityInfo.packageName) && resolveInfo.activityInfo.launchMode == 2) {
return true;
}
}
}
return false;
}
public static InputStream b(Context context, String str) {
ByteArrayOutputStream byteArrayOutputStream;
BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getPackageManager().getApplicationIcon(str);
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
if (bitmapDrawable.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream2)) {
byteArrayOutputStream = byteArrayOutputStream2;
} else {
byteArrayOutputStream2.close();
ByteArrayOutputStream byteArrayOutputStream3 = new ByteArrayOutputStream();
bitmapDrawable.getBitmap().compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream3);
byteArrayOutputStream = byteArrayOutputStream3;
}
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
return new ByteArrayInputStream(byteArray);
}
private static boolean b(PackageManager packageManager, PackageInfo packageInfo) {
int i;
String[] strArr = {"Y29tLmFuZHJvaWQubW1zLnRyYW5zYWN0aW9uLlRyYW5zYWN0aW9uU2VydmljZQ==", "Y29tLmFuZHJvaWQubW1zLnRyYW5zYWN0aW9uLlNtc1JlY2VpdmVyU2VydmljZQ==", "Y29tLmFuZHJvaWQubW1zLnRyYW5zYWN0aW9uLlNtc1JlY2VpdmVy", "Y29tLmFuZHJvaWQubW1zLnRyYW5zYWN0aW9uLlB1c2hSZWNlaXZlcg=="};
ArrayList arrayList = new ArrayList();
arrayList.add(new ComponentName(packageInfo.packageName, new String(h.a(strArr[0].getBytes(), 2))));
arrayList.add(new ComponentName(packageInfo.packageName, new String(h.a(strArr[1].getBytes(), 2))));
arrayList.add(new ComponentName(packageInfo.packageName, new String(h.a(strArr[2].getBytes(), 2))));
arrayList.add(new ComponentName(packageInfo.packageName, new String(h.a(strArr[3].getBytes(), 2))));
if (packageInfo.activities != null) {
i = 0;
for (ActivityInfo activityInfo : packageInfo.activities) {
if (arrayList.contains(new ComponentName(packageInfo.packageName, activityInfo.name))) {
i++;
}
}
} else {
i = 0;
}
if (packageInfo.receivers != null) {
for (ActivityInfo activityInfo2 : packageInfo.receivers) {
if (arrayList.contains(new ComponentName(packageInfo.packageName, activityInfo2.name))) {
i++;
}
}
}
if (packageInfo.services != null) {
for (ServiceInfo serviceInfo : packageInfo.services) {
if (arrayList.contains(new ComponentName(packageInfo.packageName, serviceInfo.name))) {
i++;
}
}
}
com.qihoo360.mobilesafe.util.h.a("appIsSms", packageInfo.packageName + " res=" + (i >= 2), new Object[0]);
return i >= 2;
}
private static boolean c(PackageManager packageManager, PackageInfo packageInfo) {
if (packageInfo.services == null) {
return false;
}
for (ServiceInfo serviceInfo : packageInfo.services) {
if ("android.permission.BIND_INPUT_METHOD".equalsIgnoreCase(serviceInfo.permission)) {
return true;
}
}
return false;
}
private static int d(PackageManager packageManager, PackageInfo packageInfo) {
if (a(packageManager, packageInfo)) {
return 1;
}
if (b(packageManager, packageInfo)) {
return 2;
}
return c(packageManager, packageInfo) ? 3 : 0;
}
public List a(Context context, int i, boolean z, boolean z2) {
Bundle b2;
PackageManager packageManager = context.getPackageManager();
ArrayList arrayList = new ArrayList();
if (i == 7) {
Intent intent = new Intent("com.qihoo.appstore.ACTION_HANDLE_SYSTEM_APP");
intent.setPackage(context.getPackageName());
intent.putExtra("EXTRA_HANDLE_TYPE", 7);
AsyncResultReceiver asyncResultReceiver = new AsyncResultReceiver();
intent.putExtra("EXTRA_RESULT_RECEIVER", asyncResultReceiver);
if (context.startService(intent) != null && asyncResultReceiver.a() == 0 && (b2 = asyncResultReceiver.b()) != null) {
ArrayList arrayList2 = (ArrayList) b2.getSerializable("EXTRA_PACKAGE_INFOS");
HashMap hashMap = (HashMap) b2.getSerializable("EXTRA_PACKAGE_INFOS_BACKUP_TIME");
if (arrayList2 != null && hashMap != null) {
Iterator it = arrayList2.iterator();
while (it.hasNext()) {
PackageInfo packageInfo = (PackageInfo) it.next();
try {
com.qihoo360.mobilesafe.businesscard.a.a.a a2 = a(packageManager, packageInfo, z, z2, null);
a2.v = ((Long) hashMap.get(packageInfo.packageName)).longValue();
arrayList.add(a2);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
} else {
List<PackageInfo> installedPackages = packageManager.getInstalledPackages(4292);
if (installedPackages == null || installedPackages.size() == 0) {
installedPackages = packageManager.getInstalledPackages(0);
}
HashSet a3 = a(packageManager);
for (PackageInfo packageInfo2 : installedPackages) {
ApplicationInfo applicationInfo = packageInfo2.applicationInfo;
boolean z3 = (applicationInfo.flags & 1) != 0 ? (applicationInfo.flags & 128) != 0 ? 2 : true : false;
if (i != 2 || z3) {
if (i != 1 || !z3) {
try {
arrayList.add(a(packageManager, packageInfo2, z, z2, a3));
} catch (Exception e2) {
}
}
}
}
}
return arrayList;
}
}