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

@@ -66,8 +66,8 @@ android {
defaultConfig {
minSdkVersion 26
targetSdkVersion 28
versionCode 21
versionName "3.0"
versionCode 22
versionName "3.1"
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
@@ -310,17 +310,17 @@ dependencies {
//OkHttp
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
//RxJava和Retrofit
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
//gson
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.google.code.gson:gson:2.9.0'
//mmkv
implementation 'com.tencent:mmkv-static:1.2.10'
implementation 'com.tencent:mmkv-static:1.2.12'
//腾讯移动推送 TPNS
implementation 'com.tencent.tpns:tpns:1.2.2.0-release'
implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
//极光推送
// implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.8.6 版本为例。
// implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.6.0 版本为例。
@@ -328,7 +328,7 @@ dependencies {
implementation 'me.laoyuyu.aria:core:3.8.16'
annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16'
//工具类
implementation 'com.blankj:utilcodex:1.30.6'
implementation 'com.blankj:utilcodex:1.31.0'
}
preBuild {

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: