Skip to content

Commit

Permalink
Auto add modules to white list
Browse files Browse the repository at this point in the history
  • Loading branch information
MlgmXyysd committed Mar 30, 2020
1 parent a95e21a commit babbae4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.afollestad.materialdialogs.folderselector.FolderChooserDialog;
import com.topjohnwu.superuser.Shell;

import org.meowcat.edxposed.manager.adapter.AppHelper;
import org.meowcat.edxposed.manager.adapter.ApplicationListAdapter;
import org.meowcat.edxposed.manager.util.RepoLoader;
import org.meowcat.edxposed.manager.util.ThemeUtil;
import org.meowcat.edxposed.manager.widget.IconListPreference;
Expand Down Expand Up @@ -207,6 +209,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
prefWhiteListMode.setOnPreferenceChangeListener((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
if (enabled) {
new ApplicationListAdapter(getContext(), AppHelper.isWhiteListMode()).generateCheckedList();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mWhiteListModeFlag.getPath());
Expand Down Expand Up @@ -300,6 +303,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
prefBlackWhiteListMode.setOnPreferenceChangeListener((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
if (enabled) {
new ApplicationListAdapter(getContext(), AppHelper.isWhiteListMode()).generateCheckedList();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mBlackWhiteListModeFlag.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;

import org.meowcat.edxposed.manager.adapter.AppHelper;
import org.meowcat.edxposed.manager.adapter.ApplicationListAdapter;
import org.meowcat.edxposed.manager.util.ModuleUtil;
import org.meowcat.edxposed.manager.util.ModuleUtil.InstalledModule;
import org.meowcat.edxposed.manager.util.ModuleUtil.ModuleListener;
Expand All @@ -49,6 +51,7 @@ public class WelcomeActivity extends XposedBaseActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ThemeUtil.setTheme(this);
new ApplicationListAdapter(getApplicationContext(), AppHelper.isWhiteListMode()).generateCheckedList();
setContentView(R.layout.activity_welcome);

mDrawerLayout = findViewById(R.id.drawer_layout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.util.Log;
import android.widget.CompoundButton;

import com.google.android.material.snackbar.Snackbar;

import org.meowcat.edxposed.manager.MeowCatApplication;
import org.meowcat.edxposed.manager.R;
import org.meowcat.edxposed.manager.XposedApp;
import org.meowcat.edxposed.manager.util.ModuleUtil;
Expand All @@ -30,19 +32,21 @@ public ApplicationListAdapter(Context context, boolean isWhiteListMode) {
// }

@Override
protected List<String> generateCheckedList() {
public List<String> generateCheckedList() {
if (XposedApp.getPreferences().getBoolean("hook_modules", true)) {
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
for (ModuleUtil.InstalledModule info : installedModules) {
FORCE_WHITE_LIST_MODULE.add(info.packageName);
}
Log.d(MeowCatApplication.TAG, "ApplicationList -> generateCheckedList: Force add modules to list");
}
AppHelper.makeSurePath();
if (isWhiteListMode) {
checkedList = AppHelper.getWhiteList();
} else {
checkedList = AppHelper.getBlackList();
}
Log.d(MeowCatApplication.TAG, "ApplicationList -> generateCheckedList: generate done");
return checkedList;
}

Expand Down

0 comments on commit babbae4

Please sign in to comment.