Skip to content

Commit 7efb245

Browse files
committed
Force put module to its scope
And remove something bad
1 parent 1212e45 commit 7efb245

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

edxp-core/src/main/cpp/main/src/config_manager.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* Permission:
3939
* /data/adb/edxp should be accessible by zygote by sepolicy
4040
* /data/misc/$misc_path is random path, and mounted by magisk
41-
* it should have context `u:object_r:shell_data_file:s0`, which should be readable by normal app
41+
* it should have context `u:object_r:magisk_data_file:s0`, which should be readable by normal app
4242
* and zygote
4343
*
4444
* /data/misc/$misc_path's owner should be root:root, with permission 771
@@ -123,6 +123,7 @@ namespace edxp {
123123

124124
std::string ConfigManager::GetPackageNameFromBaseApkPath(const fs::path &path) {
125125
std::vector<std::string> paths(path.begin(), path.end());
126+
if (paths.empty()) return {};
126127
auto base_apk = paths.back(); // base.apk
127128
if (base_apk != "base.apk") return {};
128129
paths.pop_back();
@@ -225,6 +226,7 @@ namespace edxp {
225226
while (std::getline(ifs, module)) {
226227
const auto &module_pkg_name = GetPackageNameFromBaseApkPath(module);
227228
auto &[module_path, scope] = modules_list[module_pkg_name];
229+
scope.insert(module_pkg_name); // Always add module itself
228230
module_path.assign(std::move(module));
229231
const auto &module_scope_conf = GetConfigPath(module_pkg_name + ".conf");
230232
if (!path_exists<true>(module_scope_conf)) {
@@ -241,10 +243,7 @@ namespace edxp {
241243
if (!app_pkg_name.empty())
242244
scope.emplace(std::move(app_pkg_name));
243245
}
244-
if (!scope.empty())
245-
scope.insert(module_pkg_name); // Always add module itself
246-
if (IsInstaller(module_pkg_name)) scope.erase("android");
247-
LOGI("scope of %s is:\n%s", module_pkg_name.c_str(), ([&scope = scope]() {
246+
LOGI("scope of %s is:\n %s", module_pkg_name.c_str(), ([&scope = scope]() {
248247
std::ostringstream join;
249248
std::copy(scope.begin(), scope.end(),
250249
std::ostream_iterator<std::string>(join, "\n "));

0 commit comments

Comments
 (0)