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

@@ -317,12 +317,20 @@ public class LauncherModel extends BroadcastReceiver
}
}
/**
* 更新日历图标
* @param user
*/
void changedData(UserHandle user) {
final String calendar = "com.android.calendar";
enqueueModelUpdateTask(
new PackageUpdatedTask(PackageUpdatedTask.OP_UPDATE, user, calendar));
}
/**
* 更新时钟图标
* @param user
*/
void changedTime(UserHandle user) {
final String deskclock = "com.android.deskclock";
enqueueModelUpdateTask(

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());

View File

@@ -63,7 +63,7 @@ import java.util.List;
*/
public class PackageUpdatedTask extends BaseModelUpdateTask {
private static final boolean DEBUG = false;
private static final boolean DEBUG = true;
private static final String TAG = "PackageUpdatedTask";
public static final int OP_NONE = 0;
@@ -85,6 +85,11 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
mPackages = packages;
}
HashSet<String> hideAppList = new HashSet<String>() {{
this.add("com.tencent.android.qqdownloader");
this.add("com.android.email");
}};
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList appsList) {
final Context context = app.getContext();
@@ -98,7 +103,8 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
switch (mOp) {
case OP_ADD: {
for (int i = 0; i < N; i++) {
if (DEBUG) Log.d(TAG, "mAllAppsList.addPackage " + packages[i]);
if (DEBUG) Log.e(TAG, "mAllAppsList.addPackage " + packages[i]);
if (hideAppList.contains(packages[i])) continue;
iconCache.updateIconsForPkg(packages[i], mUser);
if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
appsList.removePackage(packages[i], Process.myUserHandle());
@@ -115,7 +121,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
case OP_UPDATE:
for (int i = 0; i < N; i++) {
if (DEBUG) Log.d(TAG, "mAllAppsList.updatePackage " + packages[i]);
if (DEBUG) Log.e(TAG, "mAllAppsList.updatePackage " + packages[i]);
iconCache.updateIconsForPkg(packages[i], mUser);
appsList.updatePackage(context, packages[i], mUser);
app.getWidgetCache().removePackage(packages[i], mUser);
@@ -131,7 +137,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
case OP_UNAVAILABLE:
for (int i = 0; i < N; i++) {
if (DEBUG) Log.d(TAG, "mAllAppsList.removePackage " + packages[i]);
if (DEBUG) Log.e(TAG, "mAllAppsList.removePackage " + packages[i]);
appsList.removePackage(packages[i], mUser);
app.getWidgetCache().removePackage(packages[i], mUser);
}
@@ -142,7 +148,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
flagOp = mOp == OP_SUSPEND ?
FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED) :
FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED);
if (DEBUG) Log.d(TAG, "mAllAppsList.(un)suspend " + N);
if (DEBUG) Log.e(TAG, "mAllAppsList.(un)suspend " + N);
appsList.updateDisabledFlags(matcher, flagOp);
break;
case OP_USER_AVAILABILITY_CHANGE: