Skip to content

Commit

Permalink
使用新线程读取配置文件防止某些情况下系统界面无响应
Browse files Browse the repository at this point in the history
  • Loading branch information
kooritea committed Mar 11, 2022
1 parent 5af761d commit 13d4cd3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.kooritea.fcmfix"
minSdkVersion 29
targetSdkVersion 30
versionCode 23
versionName "0.4.4"
versionCode 24
versionName "0.4.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
19 changes: 15 additions & 4 deletions app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public abstract class XposedModule {
protected static Context context = null;
private static ArrayList<XposedModule> instances = new ArrayList();
private static Boolean isInitUpdateConfigReceiver = false;
private static Thread loadConfigThread = null;

protected XposedModule(final XC_LoadPackage.LoadPackageParam loadPackageParam) {
this.loadPackageParam = loadPackageParam;
Expand Down Expand Up @@ -125,10 +126,20 @@ protected boolean targetIsAllow(String packageName){
}

private static void onUpdateConfig(){
ContentProviderHelper contentProviderHelper = new ContentProviderHelper(context,"content://com.kooritea.fcmfix.provider/config");
allowList = contentProviderHelper.getStringSet("allowList");
if(allowList != null){
printLog( "onUpdateConfig allowList size: " + allowList.size());
if(loadConfigThread == null){
loadConfigThread = new Thread(){
@Override
public void run() {
super.run();
ContentProviderHelper contentProviderHelper = new ContentProviderHelper(context,"content://com.kooritea.fcmfix.provider/config");
allowList = contentProviderHelper.getStringSet("allowList");
if(allowList != null){
printLog( "onUpdateConfig allowList size: " + allowList.size());
}
loadConfigThread = null;
}
};
loadConfigThread.start();
}
}

Expand Down

0 comments on commit 13d4cd3

Please sign in to comment.