version:3.1

fix:
update:过滤邮件和应用宝
This commit is contained in:
2022-03-09 16:16:12 +08:00
parent e33b21142f
commit 8d8271901b
4 changed files with 43 additions and 17 deletions

View File

@@ -263,10 +263,13 @@ public class LoaderTask implements Runnable {
this.add("com.android.email");
}};
/**
* 系统应用只显示这几个
*/
public static HashSet<String> showApp = new HashSet<String>() {{
// this.add(BuildConfig.APPLICATION_ID);
//aoleyun
this.add("com.aoleyun.sn");
// this.add("com.aoleyun.sn");
this.add("com.aoleyun.appstore");
this.add("com.aoleyun.postern");
this.add("com.aoleyun.browser");
@@ -303,26 +306,35 @@ public class LoaderTask implements Runnable {
ArrayList<Pair<ItemInfo, Object>> installQueue = new ArrayList<>();
final List<UserHandle> profiles = mUserManager.getUserProfiles();
String whiteList = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list");
Log.e("verifyApplications", "whiteList: " + whiteList);
for (UserHandle user : profiles) {
final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user);
ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo> added = new ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo>();
synchronized (this) {
for (LauncherActivityInfo app : apps) {
Log.e("verifyApplications", "AllAPP: " + app.getApplicationInfo().packageName);
if (BuildConfig.APPLICATION_ID.equals(app.getApplicationInfo().packageName))
continue;
Log.e(TAG, "verifyApplications: " + app.getApplicationInfo().packageName);
/*系统应用*/
if ((app.getApplicationFlags() & ApplicationInfo.FLAG_SYSTEM) == 1) {
if (!showApp.contains(app.getApplicationInfo().packageName)) {
Log.e("verifyApplications", "skip1: " + app.getApplicationInfo().packageName);
continue;
}
} else {
if (TextUtils.isEmpty(whiteList)) {
continue;
if (!showApp.contains(app.getApplicationInfo().packageName)) {
Log.e("verifyApplications", "skip2: " + app.getApplicationInfo().packageName);
continue;
}
} else if (!whiteList.contains(app.getApplicationInfo().packageName)) {
continue;
if (!showApp.contains(app.getApplicationInfo().packageName)) {
Log.e("verifyApplications", "skip3: " + app.getApplicationInfo().packageName);
continue;
}
}
}
Log.e("verifyApplications", "AddApp: " + app.getApplicationInfo().packageName);
InstallShortcutReceiver.PendingInstallShortcutInfo pendingInstallShortcutInfo = new InstallShortcutReceiver.PendingInstallShortcutInfo(app, context);
added.add(pendingInstallShortcutInfo);
installQueue.add(pendingInstallShortcutInfo.getItemInfo());