From 8ce4030f68bc2f2b98153f3979a19f82a533af49 Mon Sep 17 00:00:00 2001 From: guozejun Date: Mon, 27 Sep 2021 10:37:17 +0800 Subject: [PATCH] fixed 0c0b710 from https://gitee.com/guozejun/startup_appspawn/pulls/41 Fix Ace library load micro define problem Signed-off-by: guozejun Change-Id: I68b3d7bea3d9632aadde6e6f4daf78e43b345e0d --- include/appspawn_server.h | 7 ------ src/appspawn_server.cpp | 23 ++++++------------- .../app_spawn_server_override_test.cpp | 2 ++ 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/include/appspawn_server.h b/include/appspawn_server.h index b210bc59..c73cf79f 100644 --- a/include/appspawn_server.h +++ b/include/appspawn_server.h @@ -143,13 +143,6 @@ private: */ bool CheckAppProperty(const ClientSocket::AppProperty *appProperty); -#ifdef ACEABILITY_LIBRARY_LOADER - /** - * Load libace.z.so library when boot the devices - */ - void LoadAceLib(); -#endif - private: const std::string deviceNull_ = "/dev/null"; std::string socketName_ {}; diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index 2959d920..0c5f7588 100644 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -28,10 +28,8 @@ #include "main_thread.h" #include "securec.h" -#if defined(ABILITY_LIBRARY_LOADER) || defined(APPLICATION_LIBRARY_LOADER) #include #include -#endif #define GRAPHIC_PERMISSION_CHECK constexpr static size_t ERR_STRING_SZ = 64; @@ -159,9 +157,14 @@ void AppSpawnServer::ConnectionPeer() } } -#ifdef ACEABILITY_LIBRARY_LOADER -void AppSpawnServer::LoadAceLib() +bool AppSpawnServer::ServerMain(char *longProcName, int64_t longProcNameLen) { + if (socket_->RegisterServerSocket() != 0) { + HiLog::Error(LABEL, "AppSpawnServer::Failed to register server socket"); + return false; + } + std::thread(&AppSpawnServer::ConnectionPeer, this).detach(); + std::string acelibdir("/system/lib/libace.z.so"); void *AceAbilityLib = nullptr; HiLog::Info(LABEL, "MainThread::LoadAbilityLibrary. Start calling dlopen acelibdir."); @@ -172,19 +175,7 @@ void AppSpawnServer::LoadAceLib() HiLog::Info(LABEL, "Success to dlopen %{public}s", acelibdir.c_str()); } HiLog::Info(LABEL, "MainThread::LoadAbilityLibrary. End calling dlopen."); -} -#endif -bool AppSpawnServer::ServerMain(char *longProcName, int64_t longProcNameLen) -{ - if (socket_->RegisterServerSocket() != 0) { - HiLog::Error(LABEL, "AppSpawnServer::Failed to register server socket"); - return false; - } - std::thread(&AppSpawnServer::ConnectionPeer, this).detach(); -#ifdef ACEABILITY_LIBRARY_LOADER - LoadAceLib(); -#endif while (isRunning_) { std::unique_lock lock(mut_); dataCond_.wait(lock, [this] { return !this->appQueue_.empty(); }); diff --git a/test/unittest/app_spawn_server_test/app_spawn_server_override_test.cpp b/test/unittest/app_spawn_server_test/app_spawn_server_override_test.cpp index 33422757..03a2f5a0 100644 --- a/test/unittest/app_spawn_server_test/app_spawn_server_override_test.cpp +++ b/test/unittest/app_spawn_server_test/app_spawn_server_override_test.cpp @@ -21,6 +21,8 @@ #define private public #define protected public #include "appspawn_server.h" +#include +#include #undef private #undef protected -- Gitee