Skip to content

Commit

Permalink
Force put module to its scope
Browse files Browse the repository at this point in the history
And remove something bad
  • Loading branch information
MlgmXyysd committed Feb 7, 2021
1 parent 1212e45 commit 7efb245
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions edxp-core/src/main/cpp/main/src/config_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Permission:
* /data/adb/edxp should be accessible by zygote by sepolicy
* /data/misc/$misc_path is random path, and mounted by magisk
* it should have context `u:object_r:shell_data_file:s0`, which should be readable by normal app
* it should have context `u:object_r:magisk_data_file:s0`, which should be readable by normal app
* and zygote
*
* /data/misc/$misc_path's owner should be root:root, with permission 771
Expand Down Expand Up @@ -123,6 +123,7 @@ namespace edxp {

std::string ConfigManager::GetPackageNameFromBaseApkPath(const fs::path &path) {
std::vector<std::string> paths(path.begin(), path.end());
if (paths.empty()) return {};
auto base_apk = paths.back(); // base.apk
if (base_apk != "base.apk") return {};
paths.pop_back();
Expand Down Expand Up @@ -225,6 +226,7 @@ namespace edxp {
while (std::getline(ifs, module)) {
const auto &module_pkg_name = GetPackageNameFromBaseApkPath(module);
auto &[module_path, scope] = modules_list[module_pkg_name];
scope.insert(module_pkg_name); // Always add module itself
module_path.assign(std::move(module));
const auto &module_scope_conf = GetConfigPath(module_pkg_name + ".conf");
if (!path_exists<true>(module_scope_conf)) {
Expand All @@ -241,10 +243,7 @@ namespace edxp {
if (!app_pkg_name.empty())
scope.emplace(std::move(app_pkg_name));
}
if (!scope.empty())
scope.insert(module_pkg_name); // Always add module itself
if (IsInstaller(module_pkg_name)) scope.erase("android");
LOGI("scope of %s is:\n%s", module_pkg_name.c_str(), ([&scope = scope]() {
LOGI("scope of %s is:\n %s", module_pkg_name.c_str(), ([&scope = scope]() {
std::ostringstream join;
std::copy(scope.begin(), scope.end(),
std::ostream_iterator<std::string>(join, "\n "));
Expand Down

0 comments on commit 7efb245

Please sign in to comment.