diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index e5679e6a08d39c2421efb6aa53601afad5e3c158..7597f058e880dbbe13a480314ea0371f3d823f32 100644 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -40,6 +40,7 @@ #include "system_ability_definition.h" #include "token_setproc.h" #include "parameter.h" +#include "parameters.h" #include "beget_ext.h" #ifdef WITH_SELINUX #include "hap_restorecon.h" @@ -67,7 +68,7 @@ constexpr int32_t WAIT_DELAY_US = 100 * 1000; // 100ms constexpr int32_t GID_USER_DATA_RW = 1008; constexpr int32_t MAX_GIDS = 64; constexpr int32_t UID_BASE = 200000; -constexpr int32_t WAIT_PARAM_TIME = 1000; +constexpr int32_t WAIT_PARAM_TIME = 5; constexpr std::string_view BUNDLE_NAME_MEDIA_LIBRARY("com.ohos.medialibrary.MediaLibraryDataA"); constexpr std::string_view BUNDLE_NAME_SCANNER("com.ohos.medialibrary.MediaScannerAbilityA"); @@ -171,12 +172,20 @@ void AppSpawnServer::WaitRebootEvent() { APPSPAWN_LOGI("wait 'startup.device.ctl' event"); while (isRunning_) { - int ret = WaitParameter("startup.device.ctl", "stop", WAIT_PARAM_TIME); + int ret = WaitParameter("startup.device.ctl", "stop", WAIT_PARAM_TIME); if (ret == 0) { std::lock_guard lock(mut_); isStop_ = true; dataCond_.notify_one(); break; + } else { + std::string value = OHOS::system::GetParameter("startup.device.ctl", ""); + if (value == "stop") { + std::lock_guard lock(mut_); + isStop_ = true; + dataCond_.notify_one(); + break; + } } } }