Remove blacklist flag
This commit is contained in:
parent
0be570bcad
commit
ad19c1b1f6
|
|
@ -77,19 +77,17 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
|||
List<ApplicationInfo> rmList = new ArrayList<>();
|
||||
for (ApplicationInfo info : fullList) {
|
||||
if (this instanceof ScopeAdapter) {
|
||||
if (AppHelper.isBlackListMode()) {
|
||||
if (AppHelper.isWhiteListMode()) {
|
||||
List<String> whiteList = AppHelper.getWhiteList();
|
||||
if (!whiteList.contains(info.packageName)) {
|
||||
rmList.add(info);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
List<String> blackList = AppHelper.getBlackList();
|
||||
if (blackList.contains(info.packageName)) {
|
||||
rmList.add(info);
|
||||
continue;
|
||||
}
|
||||
if (AppHelper.isWhiteListMode()) {
|
||||
List<String> whiteList = AppHelper.getWhiteList();
|
||||
if (!whiteList.contains(info.packageName)) {
|
||||
rmList.add(info);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
List<String> blackList = AppHelper.getBlackList();
|
||||
if (blackList.contains(info.packageName)) {
|
||||
rmList.add(info);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (info.packageName.equals(((ScopeAdapter) this).modulePackageName)) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public class AppHelper {
|
|||
private static final String BLACK_LIST_PATH = "conf/blacklist/";
|
||||
private static final String SCOPE_LIST_PATH = "conf/%s.conf";
|
||||
private static final String WHITE_LIST_MODE = "conf/usewhitelist";
|
||||
private static final String BLACK_LIST_MODE = "conf/blackwhitelist";
|
||||
|
||||
private static final List<String> FORCE_WHITE_LIST = new ArrayList<>(Collections.singletonList(BuildConfig.APPLICATION_ID));
|
||||
public static List<String> FORCE_WHITE_LIST_MODULE = new ArrayList<>(FORCE_WHITE_LIST);
|
||||
|
|
@ -60,10 +59,6 @@ public class AppHelper {
|
|||
return new File(BASE_PATH + WHITE_LIST_MODE).exists();
|
||||
}
|
||||
|
||||
public static boolean isBlackListMode() {
|
||||
return new File(BASE_PATH + BLACK_LIST_MODE).exists();
|
||||
}
|
||||
|
||||
private static boolean addWhiteList(String packageName) {
|
||||
return whiteListFileName(packageName, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package org.meowcat.edxposed.manager.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
|
@ -13,8 +12,6 @@ import androidx.appcompat.app.ActionBar;
|
|||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.adapters.AppAdapter;
|
||||
|
|
@ -95,38 +92,19 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (!AppHelper.isBlackListMode()) {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.warning_list_not_enabled)
|
||||
.setPositiveButton(R.string.Settings, (dialog, which) -> {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(BlackListActivity.this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
changeTitle(isBlackListMode(), isWhiteListMode());
|
||||
changeTitle(isWhiteListMode());
|
||||
}
|
||||
|
||||
|
||||
private void changeTitle(boolean isBlackListMode, boolean isWhiteListMode) {
|
||||
if (isBlackListMode) {
|
||||
setTitle(isWhiteListMode ? R.string.title_white_list : R.string.title_black_list);
|
||||
} else {
|
||||
setTitle(R.string.nav_title_black_list);
|
||||
}
|
||||
private void changeTitle(boolean isWhiteListMode) {
|
||||
setTitle(isWhiteListMode ? R.string.title_white_list : R.string.title_black_list);
|
||||
|
||||
}
|
||||
|
||||
private boolean isWhiteListMode() {
|
||||
return AppHelper.isWhiteListMode();
|
||||
}
|
||||
|
||||
private boolean isBlackListMode() {
|
||||
return AppHelper.isBlackListMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataReady() {
|
||||
handler.removeCallbacks(runnable);
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ public class SettingsActivity extends BaseActivity {
|
|||
private static final File dynamicModulesFlag = new File(Constants.getBaseDir() + "conf/dynamicmodules");
|
||||
private static final File deoptBootFlag = new File(Constants.getBaseDir() + "conf/deoptbootimage");
|
||||
private static final File whiteListModeFlag = new File(Constants.getBaseDir() + "conf/usewhitelist");
|
||||
private static final File blackWhiteListModeFlag = new File(Constants.getBaseDir() + "conf/blackwhitelist");
|
||||
private static final File disableVerboseLogsFlag = new File(Constants.getBaseDir() + "conf/disable_verbose_log");
|
||||
private static final File disableModulesLogsFlag = new File(Constants.getBaseDir() + "conf/disable_modules_log");
|
||||
private static final File verboseLogProcessID = new File(Constants.getBaseDir() + "log/all.pid");
|
||||
|
|
@ -244,38 +243,6 @@ public class SettingsActivity extends BaseActivity {
|
|||
});
|
||||
}
|
||||
|
||||
SwitchPreferenceCompat prefBlackWhiteListMode = findPreference("black_white_list_switch");
|
||||
if (prefBlackWhiteListMode != null) {
|
||||
prefBlackWhiteListMode.setChecked(blackWhiteListModeFlag.exists());
|
||||
prefBlackWhiteListMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
boolean enabled = (Boolean) newValue;
|
||||
if (enabled) {
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(blackWhiteListModeFlag.getPath());
|
||||
} catch (FileNotFoundException e) {
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
try {
|
||||
blackWhiteListModeFlag.createNewFile();
|
||||
} catch (IOException e1) {
|
||||
Toast.makeText(getActivity(), e1.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
blackWhiteListModeFlag.delete();
|
||||
}
|
||||
return (enabled == blackWhiteListModeFlag.exists());
|
||||
});
|
||||
}
|
||||
|
||||
SwitchPreferenceCompat prefEnableDeopt = findPreference("enable_boot_image_deopt");
|
||||
if (prefEnableDeopt != null) {
|
||||
prefEnableDeopt.setChecked(deoptBootFlag.exists());
|
||||
|
|
|
|||
|
|
@ -114,12 +114,6 @@
|
|||
android:key="group_framework"
|
||||
android:title="@string/settings_group_framework"
|
||||
app:iconSpaceReserved="false">
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="black_white_list_switch"
|
||||
android:summary="@string/pref_black_white_list_summary"
|
||||
android:title="@string/pref_title_black_white_list"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
|
|
|
|||
Loading…
Reference in New Issue