Rename XposedApp to App
This commit is contained in:
parent
840d54cccf
commit
cb079df540
|
|
@ -11,7 +11,7 @@
|
|||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
|
||||
<application
|
||||
android:name=".XposedApp"
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import static de.robv.android.xposed.installer.util.InstallZipUtil.parseXposedPr
|
|||
|
||||
@SuppressLint("Registered")
|
||||
public class XposedApp extends Application {
|
||||
public static final String TAG = "XposedApp";
|
||||
public static final String TAG = "App";
|
||||
private static final File EDXPOSED_PROP_FILE = new File("/system/framework/edconfig.jar");
|
||||
private static XposedApp instance = null;
|
||||
public InstallZipUtil.XposedProp mXposedProp;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class AboutActivity extends BaseActivity {
|
|||
binding.translatorsView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
binding.appIcon.setImageBitmap(XposedApp.getInstance().getAppIconLoader().loadIcon(getApplicationInfo(), false));
|
||||
binding.appIcon.setImageBitmap(App.getInstance().getAppIconLoader().loadIcon(getApplicationInfo(), false));
|
||||
}
|
||||
|
||||
void setupView(View v, final int url) {
|
||||
|
|
|
|||
|
|
@ -28,23 +28,22 @@ import org.meowcat.edxposed.manager.util.RepoLoader;
|
|||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import de.robv.android.xposed.installer.XposedApp;
|
||||
import de.robv.android.xposed.installer.util.InstallZipUtil;
|
||||
import me.zhanghai.android.appiconloader.AppIconLoader;
|
||||
|
||||
public class XposedApp extends de.robv.android.xposed.installer.XposedApp implements Application.ActivityLifecycleCallbacks {
|
||||
public class App extends XposedApp implements Application.ActivityLifecycleCallbacks {
|
||||
public static final String TAG = "EdXposedManager";
|
||||
public static String BASE_DIR = null;
|
||||
public static String ENABLED_MODULES_LIST_FILE = null;
|
||||
private static String BASE_DIR_LEGACY = null;
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static XposedApp instance = null;
|
||||
private static App instance = null;
|
||||
private static Thread uiThread;
|
||||
private static Handler mainHandler;
|
||||
private SharedPreferences pref;
|
||||
|
|
@ -52,12 +51,12 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
private boolean isUiLoaded = false;
|
||||
private AppIconLoader appIconLoader;
|
||||
|
||||
public static XposedApp getInstance() {
|
||||
public static App getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static InstallZipUtil.XposedProp getXposedProp() {
|
||||
return de.robv.android.xposed.installer.XposedApp.getInstance().mXposedProp;
|
||||
return XposedApp.getInstance().mXposedProp;
|
||||
}
|
||||
|
||||
public static void runOnUiThread(Runnable action) {
|
||||
|
|
@ -102,10 +101,10 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
String disclaimer = " [stack trace too large]";
|
||||
stackTraceString = stackTraceString.substring(0, 131071 - disclaimer.length()) + disclaimer;
|
||||
}
|
||||
Intent intent = new Intent(XposedApp.this, CrashReportActivity.class);
|
||||
Intent intent = new Intent(App.this, CrashReportActivity.class);
|
||||
intent.putExtra(BuildConfig.APPLICATION_ID + ".EXTRA_STACK_TRACE", stackTraceString);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
XposedApp.this.startActivity(intent);
|
||||
App.this.startActivity(intent);
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(10);
|
||||
});
|
||||
|
|
@ -115,7 +114,6 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
}
|
||||
|
||||
final ApplicationInfo appInfo = getApplicationInfo();
|
||||
BASE_DIR_LEGACY = appInfo.dataDir;
|
||||
BASE_DIR = appInfo.deviceProtectedDataDir + "/";
|
||||
ENABLED_MODULES_LIST_FILE = BASE_DIR + "conf/enabled_modules.list";
|
||||
ModuleUtil.MODULES_LIST_FILE = BASE_DIR + "conf/modules.list";
|
||||
|
|
@ -126,7 +124,7 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
|
||||
pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
de.robv.android.xposed.installer.XposedApp.getInstance().reloadXposedProp();
|
||||
XposedApp.getInstance().reloadXposedProp();
|
||||
createDirectories();
|
||||
NotificationUtil.init();
|
||||
registerReceivers();
|
||||
|
|
@ -167,27 +165,18 @@ public class XposedApp extends de.robv.android.xposed.installer.XposedApp implem
|
|||
new Intent(this, PackageChangeReceiver.class), 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavaReflectionMemberAccess", "OctalInteger"})
|
||||
@SuppressWarnings({"OctalInteger"})
|
||||
@SuppressLint({"PrivateApi", "NewApi"})
|
||||
private void createDirectories() {
|
||||
FileUtils.setPermissions(BASE_DIR, 00777);
|
||||
mkdirAndChmod("conf", 00777);
|
||||
mkdirAndChmod("log", 00777);
|
||||
|
||||
try {
|
||||
@SuppressLint("SoonBlockedPrivateApi") Method deleteDir = FileUtils.class.getDeclaredMethod("deleteContentsAndDir", File.class);
|
||||
deleteDir.invoke(null, new File(BASE_DIR_LEGACY, "bin"));
|
||||
deleteDir.invoke(null, new File(BASE_DIR_LEGACY, "conf"));
|
||||
deleteDir.invoke(null, new File(BASE_DIR_LEGACY, "log"));
|
||||
} catch (ReflectiveOperationException e) {
|
||||
Log.w(de.robv.android.xposed.installer.XposedApp.TAG, "Failed to delete obsolete directories", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateProgressIndicator(final SwipeRefreshLayout refreshLayout) {
|
||||
final boolean isLoading = RepoLoader.getInstance().isLoading() || ModuleUtil.getInstance().isLoading();
|
||||
runOnUiThread(() -> {
|
||||
synchronized (XposedApp.this) {
|
||||
synchronized (App.this) {
|
||||
if (currentActivity != null) {
|
||||
if (refreshLayout != null)
|
||||
refreshLayout.setRefreshing(isLoading);
|
||||
|
|
@ -43,7 +43,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||
private String theme;
|
||||
|
||||
public static boolean isBlackNightTheme() {
|
||||
return XposedApp.getPreferences().getBoolean("black_dark_theme", false) || XposedApp.getPreferences().getBoolean("md2", false);
|
||||
return App.getPreferences().getBoolean("black_dark_theme", false) || App.getPreferences().getBoolean("md2", false);
|
||||
}
|
||||
|
||||
public static String getTheme(Context context) {
|
||||
|
|
@ -84,19 +84,19 @@ public class BaseActivity extends AppCompatActivity {
|
|||
|
||||
@StyleRes
|
||||
private int getCustomTheme() {
|
||||
String baseThemeName = XposedApp.getPreferences().getBoolean("colorized_action_bar", false) && !XposedApp.getPreferences().getBoolean("md2", false) ?
|
||||
String baseThemeName = App.getPreferences().getBoolean("colorized_action_bar", false) && !App.getPreferences().getBoolean("md2", false) ?
|
||||
"ThemeOverlay.ActionBarPrimaryColor" : "ThemeOverlay";
|
||||
String customThemeName;
|
||||
String primaryColorEntryName = "colorPrimary";
|
||||
for (CustomThemeColor color : CustomThemeColors.Primary.values()) {
|
||||
if (XposedApp.getPreferences().getInt("primary_color", ContextCompat.getColor(this, R.color.colorPrimary))
|
||||
if (App.getPreferences().getInt("primary_color", ContextCompat.getColor(this, R.color.colorPrimary))
|
||||
== ContextCompat.getColor(this, color.getResourceId())) {
|
||||
primaryColorEntryName = color.getResourceEntryName();
|
||||
}
|
||||
}
|
||||
String accentColorEntryName = "colorAccent";
|
||||
for (CustomThemeColor color : CustomThemeColors.Accent.values()) {
|
||||
if (XposedApp.getPreferences().getInt("accent_color", ContextCompat.getColor(this, R.color.colorAccent))
|
||||
if (App.getPreferences().getInt("accent_color", ContextCompat.getColor(this, R.color.colorAccent))
|
||||
== ContextCompat.getColor(this, color.getResourceId())) {
|
||||
accentColorEntryName = color.getResourceEntryName();
|
||||
}
|
||||
|
|
@ -119,8 +119,8 @@ public class BaseActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
AppCompatDelegate.setDefaultNightMode(XposedApp.getPreferences().getInt("theme", -1));
|
||||
theme = getTheme(this) + getCustomTheme() + XposedApp.getPreferences().getBoolean("md2", false);
|
||||
AppCompatDelegate.setDefaultNightMode(App.getPreferences().getInt("theme", -1));
|
||||
theme = getTheme(this) + getCustomTheme() + App.getPreferences().getBoolean("md2", false);
|
||||
}
|
||||
|
||||
public int getThemedColor(int id) {
|
||||
|
|
@ -134,13 +134,13 @@ public class BaseActivity extends AppCompatActivity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (!(this instanceof MainActivity)) {
|
||||
if (XposedApp.getPreferences().getBoolean("transparent_status_bar", false)) {
|
||||
if (App.getPreferences().getBoolean("transparent_status_bar", false)) {
|
||||
getWindow().setStatusBarColor(getThemedColor(R.attr.colorActionBar));
|
||||
} else {
|
||||
getWindow().setStatusBarColor(getThemedColor(R.attr.colorPrimaryDark));
|
||||
}
|
||||
}
|
||||
if (!Objects.equals(theme, getTheme(this) + getCustomTheme() + XposedApp.getPreferences().getBoolean("md2", false))) {
|
||||
if (!Objects.equals(theme, getTheme(this) + getCustomTheme() + App.getPreferences().getBoolean("md2", false))) {
|
||||
recreate();
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||
theme.applyStyle(resid, false);
|
||||
}
|
||||
theme.applyStyle(getCustomTheme(), true);
|
||||
if (XposedApp.getPreferences().getBoolean("md2", false) && !(this instanceof MainActivity)) {
|
||||
if (App.getPreferences().getBoolean("md2", false) && !(this instanceof MainActivity)) {
|
||||
theme.applyStyle(R.style.ThemeOverlay_Md2, true);
|
||||
}
|
||||
if (this instanceof MainActivity) {
|
||||
|
|
@ -232,73 +232,65 @@ public class BaseActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.dexopt_all:
|
||||
areYouSure(R.string.take_while_cannot_resore, (dialog, which) -> {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.dexopt_now)
|
||||
.setMessage(R.string.this_may_take_a_while)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
new Thread("dexopt") {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Shell.rootAccess()) {
|
||||
dialog.dismiss();
|
||||
NavUtil.showMessage(BaseActivity.this, getString(R.string.root_failed));
|
||||
return;
|
||||
}
|
||||
|
||||
Shell.su("cmd package bg-dexopt-job").exec();
|
||||
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.dexopt_all) {
|
||||
areYouSure(R.string.take_while_cannot_resore, (dialog, which) -> {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.dexopt_now)
|
||||
.setMessage(R.string.this_may_take_a_while)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
new Thread("dexopt") {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Shell.rootAccess()) {
|
||||
dialog.dismiss();
|
||||
XposedApp.runOnUiThread(() -> Toast.makeText(BaseActivity.this, R.string.done, Toast.LENGTH_LONG).show());
|
||||
NavUtil.showMessage(BaseActivity.this, getString(R.string.root_failed));
|
||||
return;
|
||||
}
|
||||
}.start();
|
||||
});
|
||||
break;
|
||||
case R.id.speed_all:
|
||||
areYouSure(R.string.take_while_cannot_resore, (dialog, which) -> {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.speed_now)
|
||||
.setMessage(R.string.this_may_take_a_while)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
new Thread("dex2oat") {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Shell.rootAccess()) {
|
||||
dialog.dismiss();
|
||||
NavUtil.showMessage(BaseActivity.this, getString(R.string.root_failed));
|
||||
return;
|
||||
}
|
||||
|
||||
Shell.su("cmd package compile -m speed -a").exec();
|
||||
Shell.su("cmd package bg-dexopt-job").exec();
|
||||
|
||||
dialog.dismiss();
|
||||
App.runOnUiThread(() -> Toast.makeText(BaseActivity.this, R.string.done, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
}.start();
|
||||
});
|
||||
} else if (itemId == R.id.speed_all) {
|
||||
areYouSure(R.string.take_while_cannot_resore, (dialog, which) -> {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.speed_now)
|
||||
.setMessage(R.string.this_may_take_a_while)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
new Thread("dex2oat") {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Shell.rootAccess()) {
|
||||
dialog.dismiss();
|
||||
XposedApp.runOnUiThread(() -> Toast.makeText(BaseActivity.this, R.string.done, Toast.LENGTH_LONG).show());
|
||||
NavUtil.showMessage(BaseActivity.this, getString(R.string.root_failed));
|
||||
return;
|
||||
}
|
||||
};
|
||||
});
|
||||
break;
|
||||
case R.id.reboot:
|
||||
areYouSure(R.string.reboot, (dialog, which) -> reboot(null));
|
||||
break;
|
||||
case R.id.soft_reboot:
|
||||
areYouSure(R.string.soft_reboot, (dialog, which) -> softReboot());
|
||||
break;
|
||||
case R.id.reboot_recovery:
|
||||
areYouSure(R.string.reboot_recovery, (dialog, which) -> reboot("recovery"));
|
||||
break;
|
||||
case R.id.reboot_bootloader:
|
||||
areYouSure(R.string.reboot_bootloader, (dialog, which) -> reboot("bootloader"));
|
||||
break;
|
||||
case R.id.reboot_download:
|
||||
areYouSure(R.string.reboot_download, (dialog, which) -> reboot("download"));
|
||||
break;
|
||||
case R.id.reboot_edl:
|
||||
areYouSure(R.string.reboot_edl, (dialog, which) -> reboot("edl"));
|
||||
break;
|
||||
|
||||
Shell.su("cmd package compile -m speed -a").exec();
|
||||
|
||||
dialog.dismiss();
|
||||
App.runOnUiThread(() -> Toast.makeText(BaseActivity.this, R.string.done, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
};
|
||||
});
|
||||
} else if (itemId == R.id.reboot) {
|
||||
areYouSure(R.string.reboot, (dialog, which) -> reboot(null));
|
||||
} else if (itemId == R.id.soft_reboot) {
|
||||
areYouSure(R.string.soft_reboot, (dialog, which) -> softReboot());
|
||||
} else if (itemId == R.id.reboot_recovery) {
|
||||
areYouSure(R.string.reboot_recovery, (dialog, which) -> reboot("recovery"));
|
||||
} else if (itemId == R.id.reboot_bootloader) {
|
||||
areYouSure(R.string.reboot_bootloader, (dialog, which) -> reboot("bootloader"));
|
||||
} else if (itemId == R.id.reboot_download) {
|
||||
areYouSure(R.string.reboot_download, (dialog, which) -> reboot("download"));
|
||||
} else if (itemId == R.id.reboot_edl) {
|
||||
areYouSure(R.string.reboot_edl, (dialog, which) -> reboot("edl"));
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
|
|||
appAdapter.setHasStableIds(true);
|
||||
binding.recyclerView.setAdapter(appAdapter);
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
if (!XposedApp.getPreferences().getBoolean("md2", false)) {
|
||||
if (!App.getPreferences().getBoolean("md2", false)) {
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||
DividerItemDecoration.VERTICAL);
|
||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
|||
}
|
||||
});*/
|
||||
|
||||
sortingOrder = XposedApp.getPreferences().getInt("download_sorting_order", RepoDb.SORT_STATUS);
|
||||
sortingOrder = App.getPreferences().getInt("download_sorting_order", RepoDb.SORT_STATUS);
|
||||
|
||||
ignoredUpdatesPref = getSharedPreferences("update_ignored", MODE_PRIVATE);
|
||||
binding.recyclerView.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
|
||||
|
|
@ -104,7 +104,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
|||
headersDecor.invalidateHeaders();
|
||||
}
|
||||
});
|
||||
if (!XposedApp.getPreferences().getBoolean("md2", false)) {
|
||||
if (!App.getPreferences().getBoolean("md2", false)) {
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||
DividerItemDecoration.VERTICAL);
|
||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
|
@ -185,7 +185,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
|||
.setTitle(R.string.download_sorting_title)
|
||||
.setSingleChoiceItems(R.array.download_sort_order, sortingOrder, (dialog, which) -> {
|
||||
sortingOrder = which;
|
||||
XposedApp.getPreferences().edit().putInt("download_sorting_order", sortingOrder).apply();
|
||||
App.getPreferences().edit().putInt("download_sorting_order", sortingOrder).apply();
|
||||
reloadItems();
|
||||
dialog.dismiss();
|
||||
})
|
||||
|
|
@ -256,7 +256,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
|||
boolean isFramework = cursor.getInt(RepoDbDefinitions.OverviewColumnsIndexes.IS_FRAMEWORK) > 0;
|
||||
boolean isInstalled = cursor.getInt(RepoDbDefinitions.OverviewColumnsIndexes.IS_INSTALLED) > 0;
|
||||
boolean updateIgnored = prefs.getBoolean(cursor.getString(RepoDbDefinitions.OverviewColumnsIndexes.PKGNAME), false);
|
||||
boolean updateIgnorePreference = XposedApp.getPreferences().getBoolean("ignore_updates", false);
|
||||
boolean updateIgnorePreference = App.getPreferences().getBoolean("ignore_updates", false);
|
||||
boolean hasUpdate = cursor.getInt(RepoDbDefinitions.OverviewColumnsIndexes.HAS_UPDATE) > 0;
|
||||
|
||||
if (hasUpdate && updateIgnored && updateIgnorePreference) {
|
||||
|
|
@ -316,7 +316,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
|||
long updated = cursor.getLong(RepoDbDefinitions.OverviewColumnsIndexes.UPDATED);
|
||||
boolean isInstalled = cursor.getInt(RepoDbDefinitions.OverviewColumnsIndexes.IS_INSTALLED) > 0;
|
||||
boolean updateIgnored = prefs.getBoolean(cursor.getString(RepoDbDefinitions.OverviewColumnsIndexes.PKGNAME), false);
|
||||
boolean updateIgnorePreference = XposedApp.getPreferences().getBoolean("ignore_updates", false);
|
||||
boolean updateIgnorePreference = App.getPreferences().getBoolean("ignore_updates", false);
|
||||
boolean hasUpdate = cursor.getInt(RepoDbDefinitions.OverviewColumnsIndexes.HAS_UPDATE) > 0;
|
||||
|
||||
if (hasUpdate && updateIgnored && updateIgnorePreference) {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
|
|||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_download_details, menu);
|
||||
|
||||
boolean updateIgnorePreference = XposedApp.getPreferences().getBoolean("ignore_updates", false);
|
||||
boolean updateIgnorePreference = App.getPreferences().getBoolean("ignore_updates", false);
|
||||
if (updateIgnorePreference) {
|
||||
SharedPreferences prefs = getSharedPreferences("update_ignored", MODE_PRIVATE);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class EdDownloadActivity extends BaseActivity {
|
|||
binding.tabLayout.setupWithViewPager(binding.pager);
|
||||
new JSONParser().execute();
|
||||
|
||||
if (!XposedApp.getPreferences().getBoolean("hide_install_warning", false)) {
|
||||
if (!App.getPreferences().getBoolean("hide_install_warning", false)) {
|
||||
DialogInstallWarningBinding binding = DialogInstallWarningBinding.inflate(getLayoutInflater());
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.install_warning_title)
|
||||
|
|
@ -55,7 +55,7 @@ public class EdDownloadActivity extends BaseActivity {
|
|||
.setView(binding.getRoot())
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
if (binding.checkbox.isChecked())
|
||||
XposedApp.getPreferences().edit().putBoolean("hide_install_warning", true).apply();
|
||||
App.getPreferences().edit().putBoolean("hide_install_warning", true).apply();
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
|
|
@ -69,6 +69,7 @@ public class EdDownloadActivity extends BaseActivity {
|
|||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class JSONParser extends AsyncTask<Void, Void, String> {
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ public class EdDownloadActivity extends BaseActivity {
|
|||
return JSONUtils.getFileContent(JSONUtils.JSON_LINK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(XposedApp.TAG, "AdvancedInstallerFragment -> " + e.getMessage());
|
||||
Log.e(App.TAG, "AdvancedInstallerFragment -> " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ import java.util.Scanner;
|
|||
|
||||
public class LogsActivity extends BaseActivity {
|
||||
private boolean allLog = false;
|
||||
private final File fileErrorLog = new File(XposedApp.BASE_DIR + "log/error.log");
|
||||
private final File fileErrorLog = new File(App.BASE_DIR + "log/error.log");
|
||||
private final File fileErrorLogOld = new File(
|
||||
XposedApp.BASE_DIR + "log/error.log.old");
|
||||
private final File fileAllLog = new File(XposedApp.BASE_DIR + "log/all.log");
|
||||
private final File fileAllLogOld = new File(XposedApp.BASE_DIR + "log/all.log.old");
|
||||
App.BASE_DIR + "log/error.log.old");
|
||||
private final File fileAllLog = new File(App.BASE_DIR + "log/all.log");
|
||||
private final File fileAllLogOld = new File(App.BASE_DIR + "log/all.log.old");
|
||||
private LogsAdapter adapter;
|
||||
private final Handler handler = new Handler();
|
||||
private ActivityLogsBinding binding;
|
||||
|
|
@ -63,7 +63,7 @@ public class LogsActivity extends BaseActivity {
|
|||
}
|
||||
setupWindowInsets(binding.snackbar, binding.recyclerView);
|
||||
|
||||
if (!XposedApp.getPreferences().getBoolean("hide_logcat_warning", false)) {
|
||||
if (!App.getPreferences().getBoolean("hide_logcat_warning", false)) {
|
||||
DialogInstallWarningBinding binding = DialogInstallWarningBinding.inflate(getLayoutInflater());
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.install_warning_title)
|
||||
|
|
@ -71,7 +71,7 @@ public class LogsActivity extends BaseActivity {
|
|||
.setView(binding.getRoot())
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
if (binding.checkbox.isChecked())
|
||||
XposedApp.getPreferences().edit().putBoolean("hide_logcat_warning", true).apply();
|
||||
App.getPreferences().edit().putBoolean("hide_logcat_warning", true).apply();
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
|
|
@ -79,7 +79,7 @@ public class LogsActivity extends BaseActivity {
|
|||
adapter = new LogsAdapter();
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
if (XposedApp.getPreferences().getBoolean("disable_verbose_log", false)) {
|
||||
if (App.getPreferences().getBoolean("disable_verbose_log", false)) {
|
||||
binding.slidingTabs.setVisibility(View.GONE);
|
||||
}
|
||||
binding.slidingTabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
|
|
@ -220,6 +220,7 @@ public class LogsActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class LogsReader extends AsyncTask<File, Integer, ArrayList<String>> {
|
||||
private AlertDialog mProgressDialog;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package org.meowcat.edxposed.manager;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
|
|
@ -79,16 +78,16 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
appMenu.setOnMenuItemClickListener(this::onOptionsItemSelected);
|
||||
appMenu.show();
|
||||
});
|
||||
binding.appIcon.setImageBitmap(XposedApp.getInstance().getAppIconLoader().loadIcon(getApplicationInfo(), false));
|
||||
binding.appIcon.setImageBitmap(App.getInstance().getAppIconLoader().loadIcon(getApplicationInfo(), false));
|
||||
String installedXposedVersion;
|
||||
try {
|
||||
installedXposedVersion = XposedApp.getXposedProp().getVersion();
|
||||
installedXposedVersion = App.getXposedProp().getVersion();
|
||||
} catch (NullPointerException e) {
|
||||
installedXposedVersion = null;
|
||||
}
|
||||
if (installedXposedVersion != null) {
|
||||
int installedXposedVersionInt = extractIntPart(installedXposedVersion);
|
||||
if (installedXposedVersionInt == XposedApp.getXposedVersion()) {
|
||||
if (installedXposedVersionInt == App.getXposedVersion()) {
|
||||
String installedXposedVersionStr = installedXposedVersionInt + ".0";
|
||||
binding.statusTitle.setText(R.string.Activated);
|
||||
binding.statusSummary.setText(installedXposedVersion.replace(installedXposedVersionStr + "-", ""));
|
||||
|
|
@ -100,9 +99,9 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
binding.status.setCardBackgroundColor(ContextCompat.getColor(this, R.color.amber_500));
|
||||
binding.statusIcon.setImageResource(R.drawable.ic_warning);
|
||||
}
|
||||
} else if (XposedApp.getXposedVersion() > 0) {
|
||||
} else if (App.getXposedVersion() > 0) {
|
||||
binding.statusTitle.setText(R.string.Activated);
|
||||
binding.statusSummary.setText(getString(R.string.version_x, XposedApp.getXposedVersion()));
|
||||
binding.statusSummary.setText(getString(R.string.version_x, App.getXposedVersion()));
|
||||
binding.status.setCardBackgroundColor(ContextCompat.getColor(this, R.color.download_status_update_available));
|
||||
binding.statusIcon.setImageResource(R.drawable.ic_check_circle);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
|
|||
appAdapter.setHasStableIds(true);
|
||||
binding.recyclerView.setAdapter(appAdapter);
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
if (!XposedApp.getPreferences().getBoolean("md2", false)) {
|
||||
if (!App.getPreferences().getBoolean("md2", false)) {
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||
DividerItemDecoration.VERTICAL);
|
||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
|||
}
|
||||
}
|
||||
}
|
||||
switch (XposedApp.getPreferences().getInt("list_sort", 0)) {
|
||||
switch (App.getPreferences().getInt("list_sort", 0)) {
|
||||
case 7:
|
||||
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
||||
try {
|
||||
|
|
@ -184,7 +184,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
|||
pm = getPackageManager();
|
||||
displayNameComparator = new ApplicationInfo.DisplayNameComparator(pm);
|
||||
cmp = displayNameComparator;
|
||||
installedXposedVersion = XposedApp.getXposedVersion();
|
||||
installedXposedVersion = App.getXposedVersion();
|
||||
if (installedXposedVersion <= 0) {
|
||||
Snackbar.make(binding.snackbar, R.string.xposed_not_active, Snackbar.LENGTH_LONG).setAction(R.string.Settings, v -> {
|
||||
Intent intent = new Intent();
|
||||
|
|
@ -197,7 +197,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
|||
moduleUtil.addListener(this);
|
||||
binding.recyclerView.setAdapter(adapter);
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
if (!XposedApp.getPreferences().getBoolean("md2", false)) {
|
||||
if (!App.getPreferences().getBoolean("md2", false)) {
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||
DividerItemDecoration.VERTICAL);
|
||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
|
@ -235,7 +235,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
|||
return;
|
||||
}
|
||||
if (requestCode == 42) {
|
||||
File listModules = new File(XposedApp.ENABLED_MODULES_LIST_FILE);
|
||||
File listModules = new File(App.ENABLED_MODULES_LIST_FILE);
|
||||
if (data != null) {
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
|
|
@ -570,31 +570,31 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
|||
TextView warningText = holder.warningText;
|
||||
|
||||
if (item.minVersion == 0) {
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
mSwitch.setEnabled(false);
|
||||
}
|
||||
warningText.setText(getString(R.string.no_min_version_specified));
|
||||
warningText.setVisibility(View.VISIBLE);
|
||||
} else if (installedXposedVersion > 0 && item.minVersion > installedXposedVersion) {
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
mSwitch.setEnabled(false);
|
||||
}
|
||||
warningText.setText(String.format(getString(R.string.warning_xposed_min_version), item.minVersion));
|
||||
warningText.setVisibility(View.VISIBLE);
|
||||
} else if (item.minVersion < ModuleUtil.MIN_MODULE_VERSION) {
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
mSwitch.setEnabled(false);
|
||||
}
|
||||
warningText.setText(String.format(getString(R.string.warning_min_version_too_low), item.minVersion, ModuleUtil.MIN_MODULE_VERSION));
|
||||
warningText.setVisibility(View.VISIBLE);
|
||||
} else if (item.isInstalledOnExternalStorage()) {
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
mSwitch.setEnabled(false);
|
||||
}
|
||||
warningText.setText(getString(R.string.warning_installed_on_external_storage));
|
||||
warningText.setVisibility(View.VISIBLE);
|
||||
} else if (installedXposedVersion == 0 || (installedXposedVersion == -1)) {
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
mSwitch.setEnabled(false);
|
||||
}
|
||||
warningText.setText(getString(R.string.not_installed_no_lollipop));
|
||||
|
|
|
|||
|
|
@ -114,18 +114,18 @@ public class SettingsActivity extends BaseActivity {
|
|||
|
||||
@SuppressWarnings({"ResultOfMethodCallIgnored", "deprecation"})
|
||||
public static class SettingsFragment extends PreferenceFragmentCompat {
|
||||
private static final File pretendXposedInstallerFlag = new File(XposedApp.BASE_DIR + "conf/pretend_xposed_installer");
|
||||
private static final File hideEdXposedManagerFlag = new File(XposedApp.BASE_DIR + "conf/hide_edxposed_manager");
|
||||
private static final File disableHiddenAPIBypassFlag = new File(XposedApp.BASE_DIR + "conf/disable_hidden_api_bypass");
|
||||
private static final File disableResourcesFlag = new File(XposedApp.BASE_DIR + "conf/disable_resources");
|
||||
private static final File dynamicModulesFlag = new File(XposedApp.BASE_DIR + "conf/dynamicmodules");
|
||||
private static final File deoptBootFlag = new File(XposedApp.BASE_DIR + "conf/deoptbootimage");
|
||||
private static final File whiteListModeFlag = new File(XposedApp.BASE_DIR + "conf/usewhitelist");
|
||||
private static final File blackWhiteListModeFlag = new File(XposedApp.BASE_DIR + "conf/blackwhitelist");
|
||||
private static final File disableVerboseLogsFlag = new File(XposedApp.BASE_DIR + "conf/disable_verbose_log");
|
||||
private static final File disableModulesLogsFlag = new File(XposedApp.BASE_DIR + "conf/disable_modules_log");
|
||||
private static final File verboseLogProcessID = new File(XposedApp.BASE_DIR + "log/all.pid");
|
||||
private static final File modulesLogProcessID = new File(XposedApp.BASE_DIR + "log/error.pid");
|
||||
private static final File pretendXposedInstallerFlag = new File(App.BASE_DIR + "conf/pretend_xposed_installer");
|
||||
private static final File hideEdXposedManagerFlag = new File(App.BASE_DIR + "conf/hide_edxposed_manager");
|
||||
private static final File disableHiddenAPIBypassFlag = new File(App.BASE_DIR + "conf/disable_hidden_api_bypass");
|
||||
private static final File disableResourcesFlag = new File(App.BASE_DIR + "conf/disable_resources");
|
||||
private static final File dynamicModulesFlag = new File(App.BASE_DIR + "conf/dynamicmodules");
|
||||
private static final File deoptBootFlag = new File(App.BASE_DIR + "conf/deoptbootimage");
|
||||
private static final File whiteListModeFlag = new File(App.BASE_DIR + "conf/usewhitelist");
|
||||
private static final File blackWhiteListModeFlag = new File(App.BASE_DIR + "conf/blackwhitelist");
|
||||
private static final File disableVerboseLogsFlag = new File(App.BASE_DIR + "conf/disable_verbose_log");
|
||||
private static final File disableModulesLogsFlag = new File(App.BASE_DIR + "conf/disable_modules_log");
|
||||
private static final File verboseLogProcessID = new File(App.BASE_DIR + "log/all.pid");
|
||||
private static final File modulesLogProcessID = new File(App.BASE_DIR + "log/error.pid");
|
||||
|
||||
@SuppressLint({"WorldReadableFiles", "WorldWriteableFiles"})
|
||||
static void setFilePermissionsFromMode(String name) {
|
||||
|
|
@ -494,7 +494,7 @@ public class SettingsActivity extends BaseActivity {
|
|||
updatePreference(!md2.isChecked());
|
||||
|
||||
Preference enhancement_status = findPreference("enhancement_status");
|
||||
Objects.requireNonNull(enhancement_status).setSummary(XposedApp.isEnhancementEnabled() ? R.string.settings_summary_enhancement_enabled : R.string.settings_summary_enhancement);
|
||||
Objects.requireNonNull(enhancement_status).setSummary(App.isEnhancementEnabled() ? R.string.settings_summary_enhancement_enabled : R.string.settings_summary_enhancement);
|
||||
SwitchPreferenceCompat prefPretendXposedInstaller = findPreference("pretend_xposed_installer");
|
||||
|
||||
Objects.requireNonNull(prefPretendXposedInstaller).setChecked(pretendXposedInstallerFlag.exists());
|
||||
|
|
|
|||
|
|
@ -98,13 +98,13 @@ public class StatusInstallerFragment extends Fragment {
|
|||
|
||||
String installedXposedVersion;
|
||||
try {
|
||||
installedXposedVersion = XposedApp.getXposedProp().getVersion();
|
||||
installedXposedVersion = App.getXposedProp().getVersion();
|
||||
} catch (NullPointerException e) {
|
||||
installedXposedVersion = null;
|
||||
}
|
||||
|
||||
String mAppVer;
|
||||
if (XposedApp.isEnhancementEnabled()) {
|
||||
if (App.isEnhancementEnabled()) {
|
||||
mAppVer = String.format("v%s (%s) (%s)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, getString(R.string.status_enhancement));
|
||||
} else {
|
||||
mAppVer = String.format("v%s (%s)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE);
|
||||
|
|
@ -156,7 +156,7 @@ public class StatusInstallerFragment extends Fragment {
|
|||
binding.dmverityExplanation.setVisibility(View.GONE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(XposedApp.TAG, "Could not detect Verified Boot state", e);
|
||||
Log.e(App.TAG, "Could not detect Verified Boot state", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ public class StatusInstallerFragment extends Fragment {
|
|||
String issueName = null;
|
||||
String issueLink = null;
|
||||
final ApplicationInfo appInfo = Objects.requireNonNull(getActivity()).getApplicationInfo();
|
||||
final File baseDir = new File(XposedApp.BASE_DIR);
|
||||
final File baseDir = new File(App.BASE_DIR);
|
||||
final File baseDirCanonical = getCanonicalFile(baseDir);
|
||||
final File baseDirActual = new File(Build.VERSION.SDK_INT >= 24 ? appInfo.deviceProtectedDataDir : appInfo.dataDir);
|
||||
final File baseDirActualCanonical = getCanonicalFile(baseDirActual);
|
||||
|
|
@ -199,8 +199,8 @@ public class StatusInstallerFragment extends Fragment {
|
|||
// issueName = "Samsung TouchWiz ROM";
|
||||
// issueLink = "https://forum.xda-developers.com/showthread.php?t=3034811";
|
||||
} else if (!baseDirCanonical.equals(baseDirActualCanonical)) {
|
||||
Log.e(XposedApp.TAG, "Base directory: " + getPathWithCanonicalPath(baseDir, baseDirCanonical));
|
||||
Log.e(XposedApp.TAG, "Expected: " + getPathWithCanonicalPath(baseDirActual, baseDirActualCanonical));
|
||||
Log.e(App.TAG, "Base directory: " + getPathWithCanonicalPath(baseDir, baseDirCanonical));
|
||||
Log.e(App.TAG, "Expected: " + getPathWithCanonicalPath(baseDirActual, baseDirActualCanonical));
|
||||
issueName = getString(R.string.known_issue_wrong_base_directory, getPathWithCanonicalPath(baseDirActual, baseDirActualCanonical));
|
||||
} else if (!baseDir.exists()) {
|
||||
issueName = getString(R.string.known_issue_missing_base_directory);
|
||||
|
|
@ -271,7 +271,7 @@ public class StatusInstallerFragment extends Fragment {
|
|||
try {
|
||||
return file.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
Log.e(XposedApp.TAG, "Failed to get canonical file for " + file.getAbsolutePath(), e);
|
||||
Log.e(App.TAG, "Failed to get canonical file for " + file.getAbsolutePath(), e);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import androidx.annotation.NonNull;
|
|||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.util.InstallApkUtil;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
|
@ -69,7 +69,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
|||
fullList = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
||||
List<ApplicationInfo> rmList = new ArrayList<>();
|
||||
for (ApplicationInfo info : fullList) {
|
||||
if (!XposedApp.getPreferences().getBoolean("show_modules", true)) {
|
||||
if (!App.getPreferences().getBoolean("show_modules", true)) {
|
||||
if (info.metaData != null && info.metaData.containsKey("xposedmodule") || AppHelper.FORCE_WHITE_LIST_MODULE.contains(info.packageName)) {
|
||||
rmList.add(info);
|
||||
continue;
|
||||
|
|
@ -118,7 +118,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
|||
}
|
||||
|
||||
private void sortApps() {
|
||||
switch (XposedApp.getPreferences().getInt("list_sort", 0)) {
|
||||
switch (App.getPreferences().getInt("list_sort", 0)) {
|
||||
case 7:
|
||||
cmp = Collections.reverseOrder((ApplicationInfo a, ApplicationInfo b) -> {
|
||||
try {
|
||||
|
|
@ -190,7 +190,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.ViewHolder> impl
|
|||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
ApplicationInfo info = showList.get(position);
|
||||
holder.appIcon.setImageBitmap(XposedApp.getInstance().getAppIconLoader().loadIcon(info, false));
|
||||
holder.appIcon.setImageBitmap(App.getInstance().getAppIconLoader().loadIcon(info, false));
|
||||
holder.appName.setText(InstallApkUtil.getAppLabel(info, pm));
|
||||
try {
|
||||
holder.appVersion.setText(pm.getPackageInfo(info.packageName, 0).versionName);
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import androidx.appcompat.view.menu.MenuPopupHelper;
|
|||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.BuildConfig;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.util.CompileUtil;
|
||||
import org.meowcat.edxposed.manager.util.FileUtils;
|
||||
|
||||
|
|
@ -41,9 +41,9 @@ import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
|||
@SuppressWarnings("deprecation")
|
||||
public class AppHelper {
|
||||
|
||||
public static final String TAG = XposedApp.TAG;
|
||||
public static final String TAG = App.TAG;
|
||||
|
||||
private static final String BASE_PATH = XposedApp.BASE_DIR;
|
||||
private static final String BASE_PATH = App.BASE_DIR;
|
||||
private static final String WHITE_LIST_PATH = "conf/whitelist/";
|
||||
private static final String BLACK_LIST_PATH = "conf/blacklist/";
|
||||
private static final String COMPAT_LIST_PATH = "conf/compatlist/";
|
||||
|
|
@ -51,16 +51,16 @@ public class AppHelper {
|
|||
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<>(XposedApp.isEnhancementEnabled() ? Arrays.asList(BuildConfig.APPLICATION_ID, "android") : Collections.singletonList(BuildConfig.APPLICATION_ID));
|
||||
private static final List<String> FORCE_WHITE_LIST = new ArrayList<>(App.isEnhancementEnabled() ? Arrays.asList(BuildConfig.APPLICATION_ID, "android") : Collections.singletonList(BuildConfig.APPLICATION_ID));
|
||||
public static List<String> FORCE_WHITE_LIST_MODULE = new ArrayList<>(FORCE_WHITE_LIST);
|
||||
|
||||
private static final HashMap<String, List<String>> scopeList = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("OctalInteger")
|
||||
static void makeSurePath() {
|
||||
XposedApp.mkdirAndChmod(WHITE_LIST_PATH, 00777);
|
||||
XposedApp.mkdirAndChmod(BLACK_LIST_PATH, 00777);
|
||||
XposedApp.mkdirAndChmod(COMPAT_LIST_PATH, 00777);
|
||||
App.mkdirAndChmod(WHITE_LIST_PATH, 00777);
|
||||
App.mkdirAndChmod(BLACK_LIST_PATH, 00777);
|
||||
App.mkdirAndChmod(COMPAT_LIST_PATH, 00777);
|
||||
}
|
||||
|
||||
public static boolean isWhiteListMode() {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import android.content.Context;
|
|||
import android.content.pm.ApplicationInfo;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.util.ModuleUtil;
|
||||
import org.meowcat.edxposed.manager.util.ToastUtil;
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ public class BlackListAdapter extends AppAdapter {
|
|||
|
||||
@Override
|
||||
public List<String> generateCheckedList() {
|
||||
if (XposedApp.getPreferences().getBoolean("hook_modules", true)) {
|
||||
if (App.getPreferences().getBoolean("hook_modules", true)) {
|
||||
Collection<ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules().values();
|
||||
for (ModuleUtil.InstalledModule info : installedModules) {
|
||||
AppHelper.FORCE_WHITE_LIST_MODULE.add(info.packageName);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.BuildConfig;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.repo.RepoDbDefinitions.InstalledModulesColumns;
|
||||
import org.meowcat.edxposed.manager.repo.RepoDbDefinitions.InstalledModulesUpdatesColumns;
|
||||
import org.meowcat.edxposed.manager.repo.RepoDbDefinitions.ModuleVersionsColumns;
|
||||
|
|
@ -40,7 +40,7 @@ public final class RepoDb extends SQLiteOpenHelper {
|
|||
private static final SQLiteDatabase db;
|
||||
|
||||
static {
|
||||
RepoDb instance = new RepoDb(XposedApp.getInstance());
|
||||
RepoDb instance = new RepoDb(App.getInstance());
|
||||
db = instance.getWritableDatabase();
|
||||
db.execSQL("PRAGMA foreign_keys=ON");
|
||||
instance.createTempTables(db);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
public class RepoParser {
|
||||
public final static String TAG = XposedApp.TAG;
|
||||
public final static String TAG = App.TAG;
|
||||
private final static String NS = null;
|
||||
private final XmlPullParser parser;
|
||||
private final RepoParserCallback callback;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -15,7 +15,7 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
|
||||
public class DownloadsUtil {
|
||||
private static final SharedPreferences pref = XposedApp.getInstance().getSharedPreferences("download_cache", Context.MODE_PRIVATE);
|
||||
private static final SharedPreferences pref = App.getInstance().getSharedPreferences("download_cache", Context.MODE_PRIVATE);
|
||||
|
||||
static SyncDownloadInfo downloadSynchronously(String url, File target) {
|
||||
final boolean useNotModifiedTags = target.exists();
|
||||
|
|
@ -57,7 +57,7 @@ public class DownloadsUtil {
|
|||
return new SyncDownloadInfo(SyncDownloadInfo.STATUS_NOT_MODIFIED, null);
|
||||
} else if (responseCode < 200 || responseCode >= 300) {
|
||||
return new SyncDownloadInfo(SyncDownloadInfo.STATUS_FAILED,
|
||||
XposedApp.getInstance().getString(R.string.repo_download_failed_http,
|
||||
App.getInstance().getString(R.string.repo_download_failed_http,
|
||||
url, responseCode,
|
||||
httpConnection.getResponseMessage()));
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ public class DownloadsUtil {
|
|||
|
||||
} catch (Throwable t) {
|
||||
return new SyncDownloadInfo(SyncDownloadInfo.STATUS_FAILED,
|
||||
XposedApp.getInstance().getString(R.string.repo_download_failed, url,
|
||||
App.getInstance().getString(R.string.repo_download_failed, url,
|
||||
t.getMessage()));
|
||||
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.databinding.ActivityModulesBinding;
|
||||
import org.meowcat.edxposed.manager.repo.ModuleVersion;
|
||||
import org.meowcat.edxposed.manager.repo.RepoDb;
|
||||
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
public final class ModuleUtil {
|
||||
private static final String PLAY_STORE_PACKAGE = "com.android.vending";
|
||||
// xposedminversion below this
|
||||
public static String MODULES_LIST_FILE = XposedApp.BASE_DIR + "conf/modules.list";
|
||||
public static String MODULES_LIST_FILE = App.BASE_DIR + "conf/modules.list";
|
||||
public static int MIN_MODULE_VERSION = 2; // reject modules with
|
||||
private static ModuleUtil instance = null;
|
||||
private final PackageManager pm;
|
||||
|
|
@ -46,9 +46,9 @@ public final class ModuleUtil {
|
|||
private Toast toast;
|
||||
|
||||
private ModuleUtil() {
|
||||
pref = XposedApp.getInstance().getSharedPreferences("enabled_modules", Context.MODE_PRIVATE);
|
||||
pm = XposedApp.getInstance().getPackageManager();
|
||||
frameworkPackageName = XposedApp.getInstance().getPackageName();
|
||||
pref = App.getInstance().getSharedPreferences("enabled_modules", Context.MODE_PRIVATE);
|
||||
pm = App.getInstance().getPackageManager();
|
||||
frameworkPackageName = App.getInstance().getPackageName();
|
||||
}
|
||||
|
||||
public static synchronized ModuleUtil getInstance() {
|
||||
|
|
@ -212,9 +212,9 @@ public final class ModuleUtil {
|
|||
|
||||
public synchronized void updateModulesList(boolean showToast, ActivityModulesBinding binding) {
|
||||
try {
|
||||
Log.i(XposedApp.TAG, "ModuleUtil -> updating modules.list");
|
||||
int installedXposedVersion = XposedApp.getXposedVersion();
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false) && installedXposedVersion <= 0 && showToast) {
|
||||
Log.i(App.TAG, "ModuleUtil -> updating modules.list");
|
||||
int installedXposedVersion = App.getXposedVersion();
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false) && installedXposedVersion <= 0 && showToast) {
|
||||
if (binding != null) {
|
||||
Snackbar.make(binding.snackbar, R.string.notinstalled, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
|
@ -224,11 +224,11 @@ public final class ModuleUtil {
|
|||
}
|
||||
|
||||
PrintWriter modulesList = new PrintWriter(MODULES_LIST_FILE);
|
||||
PrintWriter enabledModulesList = new PrintWriter(XposedApp.ENABLED_MODULES_LIST_FILE);
|
||||
PrintWriter enabledModulesList = new PrintWriter(App.ENABLED_MODULES_LIST_FILE);
|
||||
List<InstalledModule> enabledModules = getEnabledModules();
|
||||
for (InstalledModule module : enabledModules) {
|
||||
|
||||
if (!XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false) && (module.minVersion > installedXposedVersion || module.minVersion < MIN_MODULE_VERSION) && showToast) {
|
||||
if (!App.getPreferences().getBoolean("skip_xposedminversion_check", false) && (module.minVersion > installedXposedVersion || module.minVersion < MIN_MODULE_VERSION) && showToast) {
|
||||
if (binding != null) {
|
||||
Snackbar.make(binding.snackbar, R.string.notinstalled, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
|
@ -250,7 +250,7 @@ public final class ModuleUtil {
|
|||
enabledModulesList.close();
|
||||
|
||||
FileUtils.setPermissions(MODULES_LIST_FILE, 00664);
|
||||
FileUtils.setPermissions(XposedApp.ENABLED_MODULES_LIST_FILE, 00664);
|
||||
FileUtils.setPermissions(App.ENABLED_MODULES_LIST_FILE, 00664);
|
||||
|
||||
if (showToast) {
|
||||
if (binding != null) {
|
||||
|
|
@ -260,11 +260,11 @@ public final class ModuleUtil {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(XposedApp.TAG, "ModuleUtil -> cannot write " + MODULES_LIST_FILE, e);
|
||||
Log.e(App.TAG, "ModuleUtil -> cannot write " + MODULES_LIST_FILE, e);
|
||||
if (binding != null) {
|
||||
Snackbar.make(binding.snackbar, "cannot write " + MODULES_LIST_FILE + e, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(XposedApp.getInstance(), "cannot write " + MODULES_LIST_FILE + e, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(App.getInstance(), "cannot write " + MODULES_LIST_FILE + e, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ public final class ModuleUtil {
|
|||
toast.cancel();
|
||||
toast = null;
|
||||
}
|
||||
toast = Toast.makeText(XposedApp.getInstance(), XposedApp.getInstance().getString(message), Toast.LENGTH_SHORT);
|
||||
toast = Toast.makeText(App.getInstance(), App.getInstance().getString(message), Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
|
@ -331,8 +331,8 @@ public final class ModuleUtil {
|
|||
this.minVersion = 0;
|
||||
this.description = "";
|
||||
} else {
|
||||
int version = XposedApp.getXposedVersion();
|
||||
if (version > 0 && XposedApp.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
int version = App.getXposedVersion();
|
||||
if (version > 0 && App.getPreferences().getBoolean("skip_xposedminversion_check", false)) {
|
||||
this.minVersion = version;
|
||||
} else {
|
||||
Object minVersionRaw = app.metaData.get("xposedminversion");
|
||||
|
|
@ -381,7 +381,7 @@ public final class ModuleUtil {
|
|||
}
|
||||
|
||||
public Bitmap getIcon() {
|
||||
return XposedApp.getInstance().getAppIconLoader().loadIcon(app, false);
|
||||
return App.getInstance().getAppIconLoader().loadIcon(app, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|||
|
||||
import org.meowcat.edxposed.manager.BaseActivity;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
|
||||
public final class NavUtil {
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public final class NavUtil {
|
|||
|
||||
@AnyThread
|
||||
public static void showMessage(final @NonNull Context context, final CharSequence message) {
|
||||
XposedApp.runOnUiThread(() -> new MaterialAlertDialogBuilder(context)
|
||||
App.runOnUiThread(() -> new MaterialAlertDialogBuilder(context)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show());
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ import androidx.core.content.ContextCompat;
|
|||
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.MainActivity;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
|
||||
public final class NotificationUtil {
|
||||
|
||||
|
|
@ -49,8 +49,8 @@ public final class NotificationUtil {
|
|||
return;
|
||||
}
|
||||
|
||||
context = XposedApp.getInstance();
|
||||
prefs = XposedApp.getPreferences();
|
||||
context = App.getInstance();
|
||||
prefs = App.getPreferences();
|
||||
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
|
@ -199,7 +199,7 @@ public final class NotificationUtil {
|
|||
}
|
||||
|
||||
if (!Shell.rootAccess()) {
|
||||
Log.e(XposedApp.TAG, "NotificationUtil -> Could not start root shell");
|
||||
Log.e(App.TAG, "NotificationUtil -> Could not start root shell");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ public final class NotificationUtil {
|
|||
: Shell.su("reboot").exec().getCode();
|
||||
|
||||
if (returnCode != 0) {
|
||||
Log.e(XposedApp.TAG, "NotificationUtil -> Could not reboot");
|
||||
Log.e(App.TAG, "NotificationUtil -> Could not reboot");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.meowcat.edxposed.manager.App;
|
||||
import org.meowcat.edxposed.manager.DownloadActivity;
|
||||
import org.meowcat.edxposed.manager.R;
|
||||
import org.meowcat.edxposed.manager.XposedApp;
|
||||
import org.meowcat.edxposed.manager.repo.Module;
|
||||
import org.meowcat.edxposed.manager.repo.ModuleVersion;
|
||||
import org.meowcat.edxposed.manager.repo.ReleaseType;
|
||||
|
|
@ -49,7 +49,7 @@ public class RepoLoader {
|
|||
private static RepoLoader instance = null;
|
||||
private final List<RepoListener> listeners = new CopyOnWriteArrayList<>();
|
||||
private final Map<String, ReleaseType> localReleaseTypesCache = new HashMap<>();
|
||||
private final XposedApp app;
|
||||
private final App app;
|
||||
private final SharedPreferences pref;
|
||||
private final SharedPreferences modulePref;
|
||||
private final ConnectivityManager conMgr;
|
||||
|
|
@ -61,12 +61,12 @@ public class RepoLoader {
|
|||
|
||||
private RepoLoader() {
|
||||
instance = this;
|
||||
app = XposedApp.getInstance();
|
||||
app = App.getInstance();
|
||||
pref = app.getSharedPreferences("repo", Context.MODE_PRIVATE);
|
||||
DEFAULT_REPOSITORIES = XposedApp.getPreferences().getBoolean("custom_list", false) ? "https://cdn.jsdelivr.net/gh/ElderDrivers/Repository-Website@gh-pages/assets/full.xml.gz" : "https://dl-xda.xposed.info/repo/full.xml.gz";
|
||||
DEFAULT_REPOSITORIES = App.getPreferences().getBoolean("custom_list", false) ? "https://cdn.jsdelivr.net/gh/ElderDrivers/Repository-Website@gh-pages/assets/full.xml.gz" : "https://dl-xda.xposed.info/repo/full.xml.gz";
|
||||
modulePref = app.getSharedPreferences("module_settings", Context.MODE_PRIVATE);
|
||||
conMgr = (ConnectivityManager) app.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
globalReleaseType = ReleaseType.fromString(XposedApp.getPreferences().getString("release_type_global", "stable"));
|
||||
globalReleaseType = ReleaseType.fromString(App.getPreferences().getString("release_type_global", "stable"));
|
||||
refreshRepositories();
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ public class RepoLoader {
|
|||
pref.edit().putLong("last_update_check", System.currentTimeMillis()).apply();
|
||||
|
||||
if (!messages.isEmpty()) {
|
||||
XposedApp.runOnUiThread(() -> {
|
||||
App.runOnUiThread(() -> {
|
||||
for (String message : messages) {
|
||||
Toast.makeText(app, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
|
@ -310,7 +310,7 @@ public class RepoLoader {
|
|||
SyncDownloadInfo info = DownloadsUtil.downloadSynchronously(url,
|
||||
cacheFile);
|
||||
|
||||
Log.i(XposedApp.TAG, String.format(
|
||||
Log.i(App.TAG, String.format(
|
||||
"RepoLoader -> Downloaded %s with status %d (error: %s), size %d bytes",
|
||||
url, info.status, info.errorMessage, cacheFile.length()));
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ public class RepoLoader {
|
|||
repo.version = repository.version;
|
||||
}
|
||||
|
||||
Log.i(XposedApp.TAG, String.format(
|
||||
Log.i(App.TAG, String.format(
|
||||
"RepoLoader -> Updated repository %s to version %s (%d new / %d removed modules)",
|
||||
repo.url, repo.version, insertCounter.get(),
|
||||
deleteCounter.get()));
|
||||
|
|
@ -371,7 +371,7 @@ public class RepoLoader {
|
|||
|
||||
RepoDb.setTransactionSuccessful();
|
||||
} catch (SQLiteException e) {
|
||||
XposedApp.runOnUiThread(() -> new MaterialAlertDialogBuilder(app)
|
||||
App.runOnUiThread(() -> new MaterialAlertDialogBuilder(app)
|
||||
.setTitle(R.string.restart_needed)
|
||||
.setMessage(R.string.cache_cleaned)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
|
|
@ -386,7 +386,7 @@ public class RepoLoader {
|
|||
|
||||
DownloadsUtil.clearCache(url);
|
||||
} catch (Throwable t) {
|
||||
Log.e(XposedApp.TAG, "RepoLoader -> Cannot load repository from " + url, t);
|
||||
Log.e(App.TAG, "RepoLoader -> Cannot load repository from " + url, t);
|
||||
messages.add(app.getString(R.string.repo_load_failed, url, t.getMessage()));
|
||||
DownloadsUtil.clearCache(url);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="?actionBarTheme"
|
||||
app:elevation="4dp">
|
||||
android:elevation="4dp">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
|
|
|||
|
|
@ -33,12 +33,11 @@
|
|||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
|
||||
|
||||
<style name="MasterSwitch">
|
||||
<style name="MasterSwitch" parent="@style/ThemeOverlay.AppCompat.Dark">
|
||||
<item name="masterSwitchBackgroundOff">#80868b</item>
|
||||
<item name="masterSwitchBackgroundOn">?colorAccent</item>
|
||||
<item name="masterSwitchTextAppearance">@style/MasterSwitch.TextAppearance</item>
|
||||
<item name="switchStyle">@style/MasterSwitch.Switch</item>
|
||||
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
</style>
|
||||
|
||||
<style name="MasterSwitch.Switch" parent="@style/Widget.AppCompat.CompoundButton.Switch">
|
||||
|
|
|
|||
Loading…
Reference in New Issue