Commit f3bd1cb9 by sikang

update white list

parent 3c201afc
...@@ -186,16 +186,11 @@ public class DeviceInfo { ...@@ -186,16 +186,11 @@ public class DeviceInfo {
return !(defaultLocale.getCountry().equals("CN") || defaultLocale.getCountry().equals("ID")); return !(defaultLocale.getCountry().equals("CN") || defaultLocale.getCountry().equals("ID"));
} }
if (PKG_LIST.contains("androidx.test.tools.crawler") || String[] blackList = getPkgBlackList();
PKG_LIST.contains("androidx.test.services") || for (String pkgName : blackList) {
PKG_LIST.contains("android.support.test.services") || if (PKG_LIST.contains(pkgName)) {
PKG_LIST.contains("com.google.android.gmscore.testing.testsupport") || return true;
PKG_LIST.contains("com.google.android.gms.policy_test_support") || }
PKG_LIST.contains("com.google.android.apps.mtaas.testloop") ||
PKG_LIST.contains("com.google.android.apps.mtaas.loginutil") ||
PKG_LIST.contains("com.google.android.apps.mtaas.deviceadmin") ||
PKG_LIST.contains("com.google.android.apps.mtaas.updateutil")) {
return true;
} }
return false; return false;
...@@ -248,7 +243,20 @@ public class DeviceInfo { ...@@ -248,7 +243,20 @@ public class DeviceInfo {
PackageInfo packageInfo = packages.get(i); PackageInfo packageInfo = packages.get(i);
//Only display the non-system app info //Only display the non-system app info
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) { if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
appList.add(packageInfo); //如果非系统应用,则添加至appList String[] whiteList = getPkgWhiteList();
boolean isWhiteList = false;
for (String pkgName : whiteList) {
if (pkgName.contains("%")) {
if (packageInfo.packageName.contains(pkgName.replace("%", ""))) {
isWhiteList = true;
}
} else if (packageInfo.packageName.equals(pkgName)) {
isWhiteList = true;
}
}
if (!isWhiteList) {
appList.add(packageInfo); //如果非系统应用,则添加至appList
}
} }
} }
Collections.sort(appList, new Comparator<PackageInfo>() { Collections.sort(appList, new Comparator<PackageInfo>() {
...@@ -271,4 +279,39 @@ public class DeviceInfo { ...@@ -271,4 +279,39 @@ public class DeviceInfo {
return appList; return appList;
} }
} }
/**
* 包名黑名单
*/
public static String[] getPkgBlackList() {
return new String[]{
"androidx.test.tools.crawler",
"androidx.test.services",
"android.support.test.services",
"com.google.android.gmscore.testing.testsupport",
"com.google.android.gms.policy_test_support",
"com.google.android.apps.mtaas.testloop",
"com.google.android.apps.mtaas.loginutil",
"com.google.android.apps.mtaas.deviceadmin",
"com.google.android.apps.mtaas.updateutil"
};
}
/**
* 包名白名单,埋点接口接收长度有限,清理已知无参考性的包名,搜集更多有用的信息
*/
public static String[] getPkgWhiteList() {
return new String[]{
PluginConfig.getContext().getPackageName(),
"com.google.android.music",
"com.google.android.apps.photos",
"com.google.android.apps.tachyon",
"com.google.android.apps.docs",
"com.google.android.videos",
"%com.samsung%",
"%com.sec.android%"
};
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment