[core] Remove useless code
This commit is contained in:
parent
5f8bdbe320
commit
58748259b9
|
|
@ -31,9 +31,6 @@
|
||||||
* module list and modules scopes are preloaded
|
* module list and modules scopes are preloaded
|
||||||
* can get app module list by call a const function
|
* can get app module list by call a const function
|
||||||
* for installer's pkg name, it's retrieved by /data/misc/$misc_path/$uid/conf/installer.
|
* for installer's pkg name, it's retrieved by /data/misc/$misc_path/$uid/conf/installer.
|
||||||
* if not exists, fallback
|
|
||||||
* blacklist and whitelist are instead set by blacklist.conf and whitelist.conf respectively
|
|
||||||
* dynamic mode is always on
|
|
||||||
*
|
*
|
||||||
* Permission:
|
* Permission:
|
||||||
* /data/adb/lspd should be accessible by zygote by sepolicy
|
* /data/adb/lspd should be accessible by zygote by sepolicy
|
||||||
|
|
@ -107,20 +104,6 @@ namespace lspd {
|
||||||
return {std::istream_iterator<char>(ifs), std::istream_iterator<char>()};
|
return {std::istream_iterator<char>(ifs), std::istream_iterator<char>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_set<std::string> ConfigManager::GetAppList(const fs::path &dir) {
|
|
||||||
std::unordered_set<std::string> set;
|
|
||||||
try {
|
|
||||||
for (auto &item: fs::directory_iterator(dir)) {
|
|
||||||
if (item.is_regular_file()) {
|
|
||||||
set.emplace(item.path().filename());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (const fs::filesystem_error &e) {
|
|
||||||
LOGE("%s", e.what());
|
|
||||||
}
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ConfigManager::GetPackageNameFromBaseApkPath(const fs::path &path) {
|
std::string ConfigManager::GetPackageNameFromBaseApkPath(const fs::path &path) {
|
||||||
std::vector<std::string> paths(path.begin(), path.end());
|
std::vector<std::string> paths(path.begin(), path.end());
|
||||||
if (paths.empty()) return {};
|
if (paths.empty()) return {};
|
||||||
|
|
@ -229,16 +212,10 @@ namespace lspd {
|
||||||
fs::file_time_type ConfigManager::GetLastWriteTime() const {
|
fs::file_time_type ConfigManager::GetLastWriteTime() const {
|
||||||
auto config_path = GetConfigPath();
|
auto config_path = GetConfigPath();
|
||||||
auto list_path = GetConfigPath("modules.list");
|
auto list_path = GetConfigPath("modules.list");
|
||||||
auto blacklist_path = GetConfigPath("blacklist");
|
|
||||||
auto whitelist_path = GetConfigPath("whitelist");
|
|
||||||
return std::max({path_exists<true>(config_path) ? fs::last_write_time(config_path)
|
return std::max({path_exists<true>(config_path) ? fs::last_write_time(config_path)
|
||||||
: fs::file_time_type{},
|
: fs::file_time_type{},
|
||||||
path_exists<true>(list_path) ? fs::last_write_time(list_path)
|
path_exists<true>(list_path) ? fs::last_write_time(list_path)
|
||||||
: fs::file_time_type{},
|
: fs::file_time_type{},});
|
||||||
path_exists<true>(blacklist_path) ? fs::last_write_time(blacklist_path)
|
|
||||||
: fs::file_time_type{},
|
|
||||||
path_exists<true>(whitelist_path) ? fs::last_write_time(whitelist_path)
|
|
||||||
: fs::file_time_type{}});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigManager::InitConfigPath() const {
|
bool ConfigManager::InitConfigPath() const {
|
||||||
|
|
|
||||||
|
|
@ -27,45 +27,48 @@ public class XposedInstallerHooker {
|
||||||
}
|
}
|
||||||
final String variant = variant_;
|
final String variant = variant_;
|
||||||
|
|
||||||
|
Utils.logI("Found LSPosed Manager, hooking it");
|
||||||
|
|
||||||
// LSPosed Manager R
|
// LSPosed Manager R
|
||||||
try {
|
try {
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getXposedApiVersion", new XC_MethodReplacement() {
|
Class<?> ConstantsClass = XposedHelpers.findClass("io.github.lsposed.manager.Constants", classLoader);
|
||||||
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getXposedApiVersion", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return XposedBridge.getXposedVersion();
|
return XposedBridge.getXposedVersion();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getXposedVersion", new XC_MethodReplacement() {
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getXposedVersion", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return BuildConfig.VERSION_NAME;
|
return BuildConfig.VERSION_NAME;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getXposedVersionCode", new XC_MethodReplacement() {
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getXposedVersionCode", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return BuildConfig.VERSION_CODE;
|
return BuildConfig.VERSION_CODE;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getXposedApiVersion", new XC_MethodReplacement() {
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getXposedApiVersion", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return XposedBridge.getXposedVersion();
|
return XposedBridge.getXposedVersion();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getXposedVariant", new XC_MethodReplacement() {
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getXposedVariant", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return variant;
|
return variant;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
XposedHelpers.findAndHookMethod("io.github.lsposed.manager.Constants", classLoader, "getBaseDir", new XC_MethodReplacement() {
|
XposedHelpers.findAndHookMethod(ConstantsClass, "getBaseDir", new XC_MethodReplacement() {
|
||||||
@Override
|
@Override
|
||||||
protected Object replaceHookedMethod(MethodHookParam param) {
|
protected Object replaceHookedMethod(MethodHookParam param) {
|
||||||
return ConfigManager.getBaseConfigPath() + "/";
|
return ConfigManager.getBaseConfigPath() + "/";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Utils.logD("Hooked LSPosed Manager");
|
Utils.logI("Hooked LSPosed Manager");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Utils.logW("Could not hook LSPosed Manager", t);
|
Utils.logW("Could not hook LSPosed Manager", t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue