ndk nameapace

Signed-off-by: zhuhan <zhuhan10@huawei.com>
Change-Id: I146e95060f9cd7fec9ea3769be532e7a91dd8390
This commit is contained in:
zhuhan
2023-04-13 11:27:10 +08:00
parent f565dd6c10
commit f6cfe69eae
3 changed files with 11 additions and 8 deletions
+8 -5
View File
@@ -136,9 +136,6 @@ void GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &hspList, AppL
for (auto &hapInfo : bundleInfo.hapModuleInfos) {
HILOG_DEBUG("name: %{public}s, isLibIsolated: %{public}d, nativeLibraryPath: %{public}s",
hapInfo.name.c_str(), hapInfo.isLibIsolated, hapInfo.nativeLibraryPath.c_str());
if (!hapInfo.isLibIsolated) {
continue;
}
std::string appLibPathKey = hapInfo.bundleName + "/" + hapInfo.moduleName;
// libraries in patch lib path has a higher priority when loading.
@@ -151,7 +148,11 @@ void GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &hspList, AppL
}
std::string libPath = LOCAL_CODE_PATH;
libPath += (libPath.back() == '/') ? hapInfo.nativeLibraryPath : "/" + hapInfo.nativeLibraryPath;
if (hapInfo.isLibIsolated) {
libPath += (libPath.back() == '/') ? hapInfo.nativeLibraryPath : "/" + hapInfo.nativeLibraryPath;
} else {
libPath += (libPath.back() == '/') ? nativeLibraryPath : "/" + nativeLibraryPath;
}
HILOG_DEBUG("appLibPathKey: %{private}s, libPath: %{private}s", appLibPathKey.c_str(), libPath.c_str());
appLibPaths[appLibPathKey].emplace_back(libPath);
}
@@ -1193,7 +1194,9 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
}
AppLibPathMap appLibPaths {};
GetNativeLibPath(bundleInfo, hspList, appLibPaths);
AbilityRuntime::JsRuntime::SetAppLibPath(appLibPaths);
bool isSystemApp = bundleInfo.applicationInfo.isSystemApp;
HILOG_DEBUG("the application isSystemApp: %{public}d", isSystemApp);
AbilityRuntime::JsRuntime::SetAppLibPath(appLibPaths, isSystemApp);
if (isStageBased) {
// Create runtime
+2 -2
View File
@@ -607,7 +607,7 @@ bool JsRuntime::InitLoop(const std::shared_ptr<AppExecFwk::EventRunner>& eventRu
return true;
}
void JsRuntime::SetAppLibPath(const AppLibPathMap& appLibPaths)
void JsRuntime::SetAppLibPath(const AppLibPathMap& appLibPaths, const bool& isSystemApp)
{
HILOG_DEBUG("Set library path.");
@@ -623,7 +623,7 @@ void JsRuntime::SetAppLibPath(const AppLibPathMap& appLibPaths)
}
for (const auto &appLibPath : appLibPaths) {
moduleManager->SetAppLibPath(appLibPath.first, appLibPath.second);
moduleManager->SetAppLibPath(appLibPath.first, appLibPath.second, isSystemApp);
}
}
@@ -61,7 +61,7 @@ public:
static std::unique_ptr<NativeReference> LoadSystemModuleByEngine(NativeEngine* engine,
const std::string& moduleName, NativeValue* const* argv, size_t argc);
static void SetAppLibPath(const AppLibPathMap& appLibPaths);
static void SetAppLibPath(const AppLibPathMap& appLibPaths, const bool& isSystemApp = false);
static bool ReadSourceMapData(const std::string& hapPath, std::string& content);