From 35bf78b285daef68e000bb13eea05975e97ed22b Mon Sep 17 00:00:00 2001 From: m00512953 Date: Thu, 25 Aug 2022 10:21:32 +0800 Subject: [PATCH] mingxihua@huawei.com.cn Signed-off-by: m00512953 --- .../ability_runtime/context/context_impl.cpp | 3 +-- .../context/js_application_context_utils.cpp | 18 +++++++++--------- .../context/js_context_utils.cpp | 8 ++++---- frameworks/native/runtime/js_timer.cpp | 2 +- .../connection_observer_test.cpp | 10 +++++----- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp index d2bb51e56a..d764870259 100644 --- a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp +++ b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp @@ -346,8 +346,7 @@ void ContextImpl::InitResourceManager(const AppExecFwk::BundleInfo &bundleInfo, return; } - HILOG_DEBUG( - "ContextImpl::InitResourceManager moduleResPaths count: %{public}zu", bundleInfo.moduleResPaths.size()); + HILOG_DEBUG("ContextImpl::InitResourceManager moduleResPaths count: %{public}zu", bundleInfo.moduleResPaths.size()); std::vector moduleResPaths; std::string inner(std::string(ABS_CODE_PATH) + std::string(FILE_SEPARATOR) + GetBundleName()); std::string outer(ABS_CODE_PATH); diff --git a/frameworks/native/appkit/ability_runtime/context/js_application_context_utils.cpp b/frameworks/native/appkit/ability_runtime/context/js_application_context_utils.cpp index 7257832ecd..581a0a9bb6 100644 --- a/frameworks/native/appkit/ability_runtime/context/js_application_context_utils.cpp +++ b/frameworks/native/appkit/ability_runtime/context/js_application_context_utils.cpp @@ -34,6 +34,7 @@ constexpr size_t ARGC_TWO = 2; constexpr size_t INDEX_ZERO = 0; constexpr size_t INDEX_ONE = 1; constexpr int32_t ERROR_CODE_ONE = 1; +const char* MD_NAME = "JsApplicationContextUtils"; class JsApplicationContextUtils { public: @@ -638,19 +639,18 @@ NativeValue *CreateJsApplicationContext(NativeEngine &engine, std::shared_ptrGet(); @@ -444,7 +444,7 @@ NativeValue* JsBaseContext::OnGetApplicationContext(NativeEngine& engine, Native NativeValue* value = CreateJsApplicationContext(engine, applicationContext, nullptr, nullptr, true); auto systemModule = JsRuntime::LoadSystemModuleByEngine(&engine, "application.ApplicationContext", &value, 1); if (systemModule == nullptr) { - HILOG_WARN("invalid systemModule."); + HILOG_WARN("OnGetApplicationContext, invalid systemModule."); return engine.CreateUndefined(); } auto contextObj = systemModule->Get(); @@ -482,13 +482,13 @@ NativeValue* AttachBaseContext(NativeEngine* engine, void* value, void*) NativeValue* object = CreateJsBaseContext(*engine, ptr, nullptr, nullptr, true); auto systemModule = JsRuntime::LoadSystemModuleByEngine(engine, "application.Context", &object, 1); if (systemModule == nullptr) { - HILOG_WARN("invalid systemModule."); + HILOG_WARN("AttachBaseContext, invalid systemModule."); return nullptr; } auto contextObj = systemModule->Get(); NativeObject *nObject = ConvertNativeValueTo(contextObj); if (nObject == nullptr) { - HILOG_WARN("invalid nObject."); + HILOG_WARN("AttachBaseContext, invalid nObject."); return nullptr; } nObject->ConvertToNativeBindingObject(engine, DetachCallbackFunc, AttachBaseContext, value, nullptr); diff --git a/frameworks/native/runtime/js_timer.cpp b/frameworks/native/runtime/js_timer.cpp index cd9c11584d..b8dc9e5fbb 100644 --- a/frameworks/native/runtime/js_timer.cpp +++ b/frameworks/native/runtime/js_timer.cpp @@ -120,7 +120,7 @@ private: NativeValue* StartTimeoutOrInterval(NativeEngine* engine, NativeCallbackInfo* info, bool isInterval) { if (engine == nullptr || info == nullptr) { - HILOG_ERROR("Start timeout or interval failed with engine or callback info is nullptr."); + HILOG_ERROR("StartTimeoutOrInterval, engine or callback info is nullptr."); return nullptr; } diff --git a/test/unittest/connection_observer_test/connection_observer_test.cpp b/test/unittest/connection_observer_test/connection_observer_test.cpp index 2fa6d961c7..792ef833a9 100644 --- a/test/unittest/connection_observer_test/connection_observer_test.cpp +++ b/test/unittest/connection_observer_test/connection_observer_test.cpp @@ -71,27 +71,27 @@ public: isServiceDied_ = true; } - bool IsExtensionConnected() + bool IsExtensionConnected() const { return isExtensionConnected_; } - bool IsExtensionDisconnected() + bool IsExtensionDisconnected() const { return isExtensionDisconnected_; } - bool IsDlpAbilityOpened() + bool IsDlpAbilityOpened() const { return isDlpAbilityOpened_; } - bool IsDlpAbilityClosed() + bool IsDlpAbilityClosed() const { return isDlpAbilityClosed_; } - bool IsServiceDied() + bool IsServiceDied() const { return isServiceDied_; }