diff --git a/frameworks/napi/power/power.cpp b/frameworks/napi/power/power.cpp index 748596452c8f3782c3bdadef0101d79b91f886e1..a44d4c39756631f96c32dcb8b95695cba1235975 100644 --- a/frameworks/napi/power/power.cpp +++ b/frameworks/napi/power/power.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,12 +13,11 @@ * limitations under the License. */ -#include -#include #include -#include "hilog_wrapper.h" + #include "napi/native_api.h" #include "napi/native_node_api.h" +#include "power_log.h" #include "power_mgr_client.h" using namespace OHOS::PowerMgr; @@ -40,31 +39,30 @@ static PowerMgrClient &g_powerMgrClient = PowerMgrClient::GetInstance(); static napi_value RebootOrShutdown(napi_env env, napi_callback_info info, bool isReboot) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter, %{public}s", __func__, isReboot ? "reboot" : "shutdown"); size_t argc = 1; napi_value args[1] = { 0 }; napi_value jsthis; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, &argc, args, &jsthis, &data); - NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), "failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), "Failed to get cb info"); napi_valuetype type = napi_undefined; NAPI_CALL(env, napi_typeof(env, args[0], &type)); - NAPI_ASSERT(env, type == napi_string, "wrong argument type. string expected."); + NAPI_ASSERT(env, type == napi_string, "Wrong argument type. string expected."); char reason[REASON_MAX] = { 0 }; size_t reasonLen = 0; status = napi_get_value_string_utf8(env, args[0], reason, REASON_MAX - 1, &reasonLen); if (status != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: get reason failed", __func__); + POWER_HILOGE(FEATURE_SHUTDOWN, "Get shutdown reason failed"); return nullptr; } + POWER_HILOGD(FEATURE_SHUTDOWN, "reboot: %{public}d, reason: %{public}s", isReboot, reason); if (isReboot) { g_powerMgrClient.RebootDevice(std::string(reason)); } else { g_powerMgrClient.ShutDownDevice(std::string(reason)); } - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: reason %{public}s, exit", __func__, reason); return nullptr; } @@ -89,8 +87,7 @@ static void IsScreenOnCallBack(napi_env env, PowerAsyncCallbackInfo *asyncCallba [](napi_env env, void *data) { PowerAsyncCallbackInfo *asyncCallbackInfo = (PowerAsyncCallbackInfo *)data; asyncCallbackInfo->screenOn = g_powerMgrClient.IsScreenOn(); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: screen is %{public}s ", __func__, - asyncCallbackInfo->screenOn ? "on" : "off"); + POWER_HILOGD(COMP_FWK, "Screen is %{public}s ", asyncCallbackInfo->screenOn ? "ON" : "OFF"); }, [](napi_env env, napi_status status, void *data) { PowerAsyncCallbackInfo *asyncCallbackInfo = (PowerAsyncCallbackInfo *)data; @@ -116,18 +113,17 @@ static void IsScreenOnCallBack(napi_env env, PowerAsyncCallbackInfo *asyncCallba static napi_value IsScreenOn(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); size_t argc = 1; napi_value args[1] = { 0 }; napi_value jsthis; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, &argc, args, &jsthis, &data); - NAPI_ASSERT(env, (status == napi_ok), "IsScreenOn: failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok), "Failed to get cb info"); auto asyncCallbackInfo = new PowerAsyncCallbackInfo(); if (asyncCallbackInfo == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: new asyncCallbackInfo failed", __func__); + POWER_HILOGE(COMP_FWK, "Failed to create asyncCallbackInfo"); return nullptr; } asyncCallbackInfo->env = env; @@ -136,7 +132,7 @@ static napi_value IsScreenOn(napi_env env, napi_callback_info info) if (argc == 1) { NAPI_CALL(env, napi_typeof(env, args[0], &type)); if (type != napi_function) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: wrong argument type. napi_function expected", __func__); + POWER_HILOGE(COMP_FWK, "Wrong argument type. napi_function expected"); delete asyncCallbackInfo; return nullptr; } @@ -144,14 +140,13 @@ static napi_value IsScreenOn(napi_env env, napi_callback_info info) } napi_value result = nullptr; if (asyncCallbackInfo->callbackRef == nullptr) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is null", __func__); + POWER_HILOGD(COMP_FWK, "callbackRef is null"); napi_create_promise(env, &asyncCallbackInfo->deferred, &result); } else { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is not null", __func__); + POWER_HILOGD(COMP_FWK, "callbackRef is not null"); napi_get_undefined(env, &result); } IsScreenOnCallBack(env, asyncCallbackInfo); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return result; } @@ -161,14 +156,14 @@ EXTERN_C_START */ static napi_value PowerInit(napi_env env, napi_value exports) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); + POWER_HILOGD(COMP_FWK, "Initialize the Power module"); napi_property_descriptor desc[] = { DECLARE_NAPI_FUNCTION("shutdownDevice", ShutdownDevice), DECLARE_NAPI_FUNCTION("rebootDevice", RebootDevice), DECLARE_NAPI_FUNCTION("isScreenOn", IsScreenOn), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); + POWER_HILOGD(COMP_FWK, "The initialization of the Power module is complete"); return exports; } diff --git a/frameworks/napi/power_manager_napi.cpp b/frameworks/napi/power_manager_napi.cpp index 855b28f802f50caa87478b17a27cfa0673088b77..0af47c6503e0bfdd540e9ccd9328605c71a19469 100644 --- a/frameworks/napi/power_manager_napi.cpp +++ b/frameworks/napi/power_manager_napi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,11 +15,9 @@ #include "power_manager_napi.h" -#include -#include #include -#include -#include "power_common.h" + +#include "power_log.h" #include "running_lock_napi.h" using namespace OHOS::PowerMgr; @@ -71,7 +69,7 @@ napi_value PowerManagerNapi::Init(napi_env env, napi_value exports) napi_value PowerManagerNapi::IsRunningLockTypeSupported(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Check whether RunningLockType is supported"); size_t argc = ARG_2; napi_value args[ARG_2] = { 0 }; napi_value jsthis; @@ -99,13 +97,13 @@ napi_value PowerManagerNapi::IsRunningLockTypeSupported(napi_env env, napi_callb [](PowerNapiContext* object) { delete object; } ); - POWER_HILOGD(MODULE_JS_NAPI, "return"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Check the end"); return promise; } napi_value PowerManagerNapi::CreateRunningLock(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Create runninglock begin"); size_t argc = ARG_3; int argcnumber = 2; napi_value args[ARG_3] = { 0 }; @@ -139,13 +137,13 @@ napi_value PowerManagerNapi::CreateRunningLock(napi_env env, napi_callback_info [](PowerNapiContext* object) { delete object; } ); - POWER_HILOGD(MODULE_JS_NAPI, "return"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Create runninglock end"); return promise; } napi_value PowerManagerNapi::ShutdownDevice(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_SHUTDOWN, "Call system shutdown"); uint32_t argc = ARG_2; napi_value args[ARG_2] = { 0 }; napi_value jsthis; @@ -168,14 +166,12 @@ napi_value PowerManagerNapi::ShutdownDevice(napi_env env, napi_callback_info inf }, [](PowerNapiContext* object) { delete object; } ); - - POWER_HILOGD(MODULE_JS_NAPI, "return"); return promise; } napi_value PowerManagerNapi::RebootDevice(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_SHUTDOWN, "Call system reboot"); uint32_t argc = ARG_2; napi_value args[ARG_2] = { 0 }; napi_value jsthis; @@ -198,14 +194,12 @@ napi_value PowerManagerNapi::RebootDevice(napi_env env, napi_callback_info info) }, [](PowerNapiContext* object) { delete object; } ); - - POWER_HILOGD(MODULE_JS_NAPI, "return"); return promise; } napi_value PowerManagerNapi::IsScreenOn(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(COMP_FWK, "Get screen state"); size_t argc = ARG_1; napi_value args[ARG_1] = { 0 }; napi_value jsthis; @@ -225,14 +219,12 @@ napi_value PowerManagerNapi::IsScreenOn(napi_env env, napi_callback_info info) }, [](PowerNapiContext* object) { delete object; } ); - - POWER_HILOGD(MODULE_JS_NAPI, "return"); return promise; } napi_value PowerManagerNapi::GetState(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_POWER_STATE, "Get power state"); size_t argc = ARG_1; napi_value args[ARG_1] = { 0 }; napi_value jsthis; @@ -247,19 +239,18 @@ napi_value PowerManagerNapi::GetState(napi_env env, napi_callback_info info) context->StartAsyncWork("Power::GetState", [context] { PowerState state = PowerMgrClient::GetInstance().GetState(); + POWER_HILOGD(FEATURE_POWER_STATE, "power state: %{public}d", static_cast(state)); napi_create_uint32(context->env_, static_cast(state), &context->outValue_); return true; }, [](PowerNapiContext* object) { delete object; } ); - - POWER_HILOGD(MODULE_JS_NAPI, "return"); return promise; } napi_value PowerManagerNapi::GetMode(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(FEATURE_POWER_MODE, "Get power mode"); size_t argc = ARG_1; napi_value args[ARG_1] = { 0 }; napi_value jsthis; @@ -271,12 +262,12 @@ napi_value PowerManagerNapi::GetMode(napi_env env, napi_callback_info info) context->StartAsyncWork("Power::GetState", [context] { uint32_t mode = PowerMgrClient::GetInstance().GetDeviceMode(); + POWER_HILOGD(FEATURE_POWER_MODE, "power mode: %{public}d", mode); napi_create_uint32(context->env_, mode, &context->outValue_); return true; }, [context](PowerNapiContext* object) { delete context; } ); - POWER_HILOGD(MODULE_JS_NAPI, "return"); return promise; } @@ -388,11 +379,11 @@ EXTERN_C_START */ static napi_value PowerInit(napi_env env, napi_value exports) { - POWER_HILOGD(MODULE_JS_NAPI, "enter"); + POWER_HILOGD(COMP_FWK, "Initialize the PowerManagerNapi module"); napi_value ret = PowerManagerNapi::Init(env, exports); - POWER_HILOGD(MODULE_JS_NAPI, "return"); + POWER_HILOGD(COMP_FWK, "The initialization of the PowerManagerNapi module is complete"); return ret; } diff --git a/frameworks/napi/runninglock/runninglock.cpp b/frameworks/napi/runninglock/runninglock.cpp index 06a741d99b015a3d3c86ce1c4c5ce4006f35dd82..d3551d78e998fe0a9cfeb25363b3a0ab2cb7eaa3 100644 --- a/frameworks/napi/runninglock/runninglock.cpp +++ b/frameworks/napi/runninglock/runninglock.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,12 +13,11 @@ * limitations under the License. */ -#include -#include #include -#include "hilog_wrapper.h" + #include "napi/native_api.h" #include "napi/native_node_api.h" +#include "power_log.h" #include "power_mgr_client.h" #include "running_lock_info.h" @@ -52,7 +51,6 @@ static PowerMgrClient &g_powerMgrClient = PowerMgrClient::GetInstance(); static napi_value Unlock(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); napi_value thisArg = nullptr; void *data = nullptr; @@ -62,76 +60,71 @@ static napi_value Unlock(napi_env env, napi_callback_info info) RunningLockEntity *entity = nullptr; status = napi_unwrap(env, thisArg, (void **)&entity); if (status != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: cannot unwrap for pointer", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Cannot unwrap for pointer"); return nullptr; } if (entity == nullptr || entity->runningLock == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: entity->runningLock is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Entity runningLock is nullptr"); return nullptr; } entity->runningLock->UnLock(); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return nullptr; } static napi_value IsUsed(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); napi_value thisArg = nullptr; napi_value result = nullptr; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, nullptr, nullptr, &thisArg, &data); - NAPI_ASSERT(env, (status == napi_ok), "IsUsed: failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok), "Failed to get cb info"); napi_get_boolean(env, false, &result); RunningLockEntity *entity = nullptr; status = napi_unwrap(env, thisArg, (void **)&entity); if (status != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: cannot unwrap for pointer", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Cannot unwrap for pointer"); return result; } if (entity == nullptr || entity->runningLock == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: entity->runningLock is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Entity runningLock is nullptr"); return result; } bool isUsed = entity->runningLock->IsUsed(); napi_get_boolean(env, isUsed, &result); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return result; } static napi_value Lock(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); size_t argc = 1; napi_value args[1] = { 0 }; napi_value thisArg = nullptr; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, &argc, args, &thisArg, &data); - NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), "Lock: failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), "Failed to get cb info"); napi_valuetype type = napi_undefined; NAPI_CALL(env, napi_typeof(env, args[0], &type)); - NAPI_ASSERT(env, type == napi_number, "Lock: wrong argument type. number expected."); + NAPI_ASSERT(env, type == napi_number, "Wrong argument type. number expected."); uint32_t timeOut; status = napi_get_value_uint32(env, args[0], &timeOut); if (status != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: napi_get_value_uint32 failed", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "napi_get_value_uint32 failed"); return nullptr; } RunningLockEntity *entity = nullptr; status = napi_unwrap(env, thisArg, (void **)&entity); if (status != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: cannot unwrap for pointer", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Cannot unwrap for pointer"); return nullptr; } if (entity == nullptr || entity->runningLock == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: entity->runningLock is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Entity runningLock is nullptr"); return nullptr; } entity->runningLock->Lock(timeOut); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return nullptr; } @@ -143,22 +136,22 @@ static napi_value CreateInstanceForRunningLock(napi_env env, RunningLockAsyncCal RunningLockEntity *entity = nullptr; if (asyncCallbackInfo->runningLock == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: runningLock is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "RunningLock is nullptr"); return nullptr; } callBackStatus = napi_get_reference_value(env, g_runningLockConstructor, &cons); if (callBackStatus != napi_ok) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: napi get reference value failed", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "NAPI failed to create a reference value"); return nullptr; } callBackStatus = napi_new_instance(env, cons, 0, nullptr, &instance); if (callBackStatus != napi_ok || instance == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: napi new reference failed", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "NAPI failed to create a reference"); return nullptr; } callBackStatus = napi_unwrap(env, instance, (void **)&entity); if (callBackStatus != napi_ok || entity == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: cannot unwrap entity from instance", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Cannot unwrap entity from instance"); return nullptr; } entity->runningLock = asyncCallbackInfo->runningLock; @@ -211,19 +204,17 @@ static void CreateRunningLockCallBack(napi_env env, RunningLockAsyncCallbackInfo static napi_value CreateRunningLock(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); size_t argc = CREATRUNNINGLOCK_ARGC; napi_value argv[CREATRUNNINGLOCK_ARGC] = { 0 }; napi_value thisArg = nullptr; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, &argc, argv, &thisArg, &data); - NAPI_ASSERT(env, (status == napi_ok) && (argc >= CREATRUNNINGLOCK_ARGC - 1), - "CreateRunningLock: failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok) && (argc >= CREATRUNNINGLOCK_ARGC - 1), "Failed to get cb info"); auto asyncCallbackInfo = new RunningLockAsyncCallbackInfo(); if (asyncCallbackInfo == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: asyncCallbackInfo is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "asyncCallbackInfo is nullptr"); return nullptr; } asyncCallbackInfo->env = env; @@ -246,14 +237,13 @@ static napi_value CreateRunningLock(napi_env env, napi_callback_info info) } napi_value result = nullptr; if (asyncCallbackInfo->callbackRef == nullptr) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is null", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "callbackRef is null"); napi_create_promise(env, &asyncCallbackInfo->deferred, &result); } else { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is not null", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "callbackRef is not null"); napi_get_undefined(env, &result); } CreateRunningLockCallBack(env, asyncCallbackInfo); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return result; } @@ -274,8 +264,7 @@ static void IsRunningLockTypeSupportedCallBack(napi_env env, } else { asyncCallbackInfo->isSupported = false; } - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: runningLock(%{public}d) isSupported %{public}s", - __func__, + POWER_HILOGD(FEATURE_RUNNING_LOCK, "runningLock: %{public}d, isSupported: %{public}s", asyncCallbackInfo->type, asyncCallbackInfo->isSupported ? "true" : "false"); }, @@ -303,19 +292,17 @@ static void IsRunningLockTypeSupportedCallBack(napi_env env, static napi_value IsRunningLockTypeSupported(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); size_t argc = ISRUNNINGLOCKTYPESUPPORTED_ARGC; napi_value argv[ISRUNNINGLOCKTYPESUPPORTED_ARGC] = { 0 }; napi_value thisArg = nullptr; void *data = nullptr; napi_status status = napi_get_cb_info(env, info, &argc, argv, &thisArg, &data); - NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), - "IsRunningLockTypeSupported: failed to get cb info"); + NAPI_ASSERT(env, (status == napi_ok) && (argc >= 1), "Failed to get cb info"); auto asyncCallbackInfo = new RunningLockAsyncCallbackInfo(); if (asyncCallbackInfo == nullptr) { - POWER_HILOGE(MODULE_JS_NAPI, "%{public}s: asyncCallbackInfo is nullptr", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "asyncCallbackInfo is nullptr"); return nullptr; } asyncCallbackInfo->env = env; @@ -335,32 +322,28 @@ static napi_value IsRunningLockTypeSupported(napi_env env, napi_callback_info in napi_value result = nullptr; if (asyncCallbackInfo->callbackRef == nullptr) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is null", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "callbackRef is null"); napi_create_promise(env, &asyncCallbackInfo->deferred, &result); } else { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: callbackRef is not null", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "callbackRef is not null"); napi_get_undefined(env, &result); } IsRunningLockTypeSupportedCallBack(env, asyncCallbackInfo); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return result; } static napi_value EnumRunningLockTypeConstructor(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); napi_value thisArg = nullptr; void *data = nullptr; napi_get_cb_info(env, info, nullptr, nullptr, &thisArg, &data); napi_value global = nullptr; napi_get_global(env, &global); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return thisArg; } static napi_value CreateEnumRunningLockType(napi_env env, napi_value exports) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); napi_value background = nullptr; napi_value proximityscreencontrol = nullptr; @@ -376,13 +359,11 @@ static napi_value CreateEnumRunningLockType(napi_env env, napi_value exports) sizeof(desc) / sizeof(*desc), desc, &result); napi_set_named_property(env, exports, "RunningLockType", result); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return exports; } static napi_value RunningLockConstructor(napi_env env, napi_callback_info info) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); napi_value thisVar = nullptr; void *data = nullptr; napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, &data); @@ -391,20 +372,17 @@ static napi_value RunningLockConstructor(napi_env env, napi_callback_info info) napi_wrap( env, thisVar, entity, [](napi_env env, void *data, void *hint) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: Destructor", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Destructor"); auto entity = (RunningLockEntity*)data; delete entity; }, nullptr, nullptr); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return thisVar; } static napi_value CreateRunningLockClass(napi_env env, napi_value exports) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); - napi_property_descriptor desc[] = { DECLARE_NAPI_FUNCTION("unlock", Unlock), DECLARE_NAPI_FUNCTION("isUsed", IsUsed), @@ -417,8 +395,6 @@ static napi_value CreateRunningLockClass(napi_env env, napi_value exports) napi_create_reference(env, result, 1, &g_runningLockConstructor); napi_set_named_property(env, exports, "RunningLock", result); - - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); return exports; } @@ -428,8 +404,7 @@ EXTERN_C_START */ static napi_value RunningLockInit(napi_env env, napi_value exports) { - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: enter", __func__); - + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Initialize the RunningLock module"); napi_property_descriptor desc[] = { DECLARE_NAPI_FUNCTION("createRunningLock", CreateRunningLock), DECLARE_NAPI_FUNCTION("isRunningLockTypeSupported", IsRunningLockTypeSupported), @@ -439,7 +414,7 @@ static napi_value RunningLockInit(napi_env env, napi_value exports) CreateRunningLockClass(env, exports); CreateEnumRunningLockType(env, exports); - POWER_HILOGD(MODULE_JS_NAPI, "%{public}s: exit", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "The initialization of the RunningLock module is complete"); return exports; } diff --git a/frameworks/native/power_mgr_client.cpp b/frameworks/native/power_mgr_client.cpp index 00f0226427630367a9e4677dd34401bf79b5b052..e89a6a7d73e5e0bb501db4a912fcb1cf30c89fb0 100644 --- a/frameworks/native/power_mgr_client.cpp +++ b/frameworks/native/power_mgr_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,10 +19,8 @@ #include #include #include -#include #include -#include "permission.h" #include "power_common.h" namespace OHOS { @@ -47,27 +45,27 @@ ErrCode PowerMgrClient::Connect() sptr sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (sam == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "%{public}s:Failed to get Registry!", __func__); + POWER_HILOGE(COMP_FWK, "Failed to obtain SystemAbilityMgr"); return E_GET_SYSTEM_ABILITY_MANAGER_FAILED; } sptr remoteObject_ = sam->CheckSystemAbility(POWER_MANAGER_SERVICE_ID); if (remoteObject_ == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "GetSystemAbility failed!"); + POWER_HILOGE(COMP_FWK, "Check SystemAbility failed"); return E_GET_POWER_SERVICE_FAILED; } deathRecipient_ = sptr(new PowerMgrDeathRecipient()); if (deathRecipient_ == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "%{public}s :Failed to create PowerMgrDeathRecipient!", __func__); + POWER_HILOGE(COMP_FWK, "Failed to create PowerMgrDeathRecipient"); return ERR_NO_MEMORY; } if ((remoteObject_->IsProxyObject()) && (!remoteObject_->AddDeathRecipient(deathRecipient_))) { - POWER_HILOGE(MODULE_INNERKIT, "%{public}s :Add death recipient to PowerMgr service failed.", __func__); + POWER_HILOGE(COMP_FWK, "Add death recipient to PowerMgr service failed"); return E_ADD_DEATH_RECIPIENT_FAILED; } proxy_ = iface_cast(remoteObject_); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s :Connecting PowerMgrService success.", __func__); + POWER_HILOGI(COMP_FWK, "Connecting PowerMgrService success"); return ERR_OK; } @@ -86,25 +84,23 @@ void PowerMgrClient::ResetProxy(const wptr& remote) void PowerMgrClient::PowerMgrDeathRecipient::OnRemoteDied(const wptr& remote) { if (remote == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrDeathRecipient::OnRemoteDied failed, remote is nullptr."); + POWER_HILOGE(COMP_FWK, "OnRemoteDied failed, remote is nullptr"); return; } PowerMgrClient::GetInstance().ResetProxy(remote); - POWER_HILOGI(MODULE_INNERKIT, "PowerMgrDeathRecipient::Recv death notice."); + POWER_HILOGW(COMP_FWK, "Recv death notice"); } void PowerMgrClient::RebootDevice(const std::string& reason) { RETURN_IF(Connect() != ERR_OK); - POWER_HILOGE(MODULE_INNERKIT, "%{public}s called.", __func__); proxy_->RebootDevice(reason); } void PowerMgrClient::ShutDownDevice(const std::string& reason) { RETURN_IF(Connect() != ERR_OK); - POWER_HILOGE(MODULE_INNERKIT, "%{public}s called.", __func__); proxy_->ShutDownDevice(reason); } @@ -112,29 +108,28 @@ void PowerMgrClient::SuspendDevice(SuspendDeviceType reason, bool suspendImmed) { RETURN_IF(Connect() != ERR_OK); proxy_->SuspendDevice(GetTickCount(), reason, suspendImmed); - POWER_HILOGI(MODULE_INNERKIT, " Calling SuspendDevice success."); + POWER_HILOGD(FEATURE_SUSPEND, " Calling SuspendDevice success"); } void PowerMgrClient::WakeupDevice(WakeupDeviceType reason, const std::string& detail) { RETURN_IF(Connect() != ERR_OK); - proxy_->WakeupDevice(GetTickCount(), reason, detail); - POWER_HILOGI(MODULE_INNERKIT, " Calling WakeupDevice success."); + POWER_HILOGD(FEATURE_WAKEUP, " Calling WakeupDevice success"); } void PowerMgrClient::RefreshActivity(UserActivityType type) { - RETURN_IF_WITH_LOG(type == UserActivityType::USER_ACTIVITY_TYPE_ATTENTION, " is not supported!"); + RETURN_IF_WITH_LOG(type == UserActivityType::USER_ACTIVITY_TYPE_ATTENTION, "UserActivityType does not support"); RETURN_IF(Connect() != ERR_OK); - proxy_->RefreshActivity(GetTickCount(), type, true); - POWER_HILOGI(MODULE_INNERKIT, " Calling RefreshActivity Success!"); + POWER_HILOGD(FEATURE_ACTIVITY, "Calling RefreshActivity Success"); } bool PowerMgrClient::IsRunningLockTypeSupported(uint32_t type) { if (type >= static_cast(RunningLockType::RUNNINGLOCK_BUTT)) { + POWER_HILOGW(FEATURE_RUNNING_LOCK, "RunningLockType does not support, type: %{public}d", type); return false; } @@ -146,7 +141,7 @@ bool PowerMgrClient::ForceSuspendDevice() { RETURN_IF_WITH_RET(Connect() != ERR_OK, false); bool ret = proxy_->ForceSuspendDevice(GetTickCount()); - POWER_HILOGI(MODULE_INNERKIT, " Calling ForceSuspendDevice Success!"); + POWER_HILOGD(FEATURE_SUSPEND, "Calling ForceSuspendDevice Success"); return ret; } @@ -155,7 +150,7 @@ bool PowerMgrClient::IsScreenOn() RETURN_IF_WITH_RET(Connect() != ERR_OK, false); bool ret = false; ret = proxy_->IsScreenOn(); - POWER_HILOGI(MODULE_INNERKIT, " Calling IsScreenOn Success!"); + POWER_HILOGD(COMP_FWK, "Calling IsScreenOn Success"); return ret; } @@ -172,28 +167,26 @@ std::shared_ptr PowerMgrClient::CreateRunningLock(const std::string uint32_t nameLen = (name.size() > RunningLock::MAX_NAME_LEN) ? RunningLock::MAX_NAME_LEN : name.size(); std::shared_ptr runningLock = std::make_shared(proxy_, name.substr(0, nameLen), type); if (runningLock == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "%{public}s failed to create new RunningLock record", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Failed to create RunningLock record"); return nullptr; } if (!runningLock->Init()) { - POWER_HILOGE(MODULE_INNERKIT, "%{public}s runningLock->Init failed.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "RunningLock init failed"); return nullptr; } - POWER_HILOGI(MODULE_INNERKIT, "%{public}s :name %{public}s, type = %d", __func__, name.c_str(), type); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "name: %{public}s, type = %{public}d", name.c_str(), type); return runningLock; } void PowerMgrClient::RegisterPowerStateCallback(const sptr& callback) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->RegisterPowerStateCallback(callback); } void PowerMgrClient::UnRegisterPowerStateCallback(const sptr& callback) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->UnRegisterPowerStateCallback(callback); } @@ -201,49 +194,42 @@ void PowerMgrClient::RegisterShutdownCallback(const sptr& cal IShutdownCallback::ShutdownPriority priority) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->RegisterShutdownCallback(priority, callback); } void PowerMgrClient::UnRegisterShutdownCallback(const sptr& callback) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->UnRegisterShutdownCallback(callback); } void PowerMgrClient::RegisterPowerModeCallback(const sptr& callback) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->RegisterPowerModeCallback(callback); } void PowerMgrClient::UnRegisterPowerModeCallback(const sptr& callback) { RETURN_IF((callback == nullptr) || (Connect() != ERR_OK)); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->UnRegisterPowerModeCallback(callback); } void PowerMgrClient::SetDisplaySuspend(bool enable) { RETURN_IF(Connect() != ERR_OK); - POWER_HILOGI(MODULE_INNERKIT, "%{public}s.", __func__); proxy_->SetDisplaySuspend(enable); } void PowerMgrClient::SetDeviceMode(const uint32_t mode) { RETURN_IF(Connect() != ERR_OK); - POWER_HILOGE(MODULE_INNERKIT, "%{public}s called.", __func__); proxy_->SetDeviceMode(mode); } uint32_t PowerMgrClient::GetDeviceMode() { RETURN_IF_WITH_RET(Connect() != ERR_OK, 0); - POWER_HILOGE(MODULE_INNERKIT, "%{public}s called.", __func__); return proxy_->GetDeviceMode(); } @@ -251,7 +237,6 @@ std::string PowerMgrClient::Dump(const std::vector& args) { std::string error = "can't connect service"; RETURN_IF_WITH_RET(Connect() != ERR_OK, error); - POWER_HILOGE(MODULE_INNERKIT, "%{public}s called.", __func__); return proxy_->ShellDump(args, args.size()); } } // namespace PowerMgr diff --git a/frameworks/native/running_lock.cpp b/frameworks/native/running_lock.cpp index 276cbd87d7d34c60d2635ce2d6fea365405e0a58..c869bb44e3fed5640db3fb68d573f70fe5b32ae3 100644 --- a/frameworks/native/running_lock.cpp +++ b/frameworks/native/running_lock.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -40,7 +40,7 @@ bool RunningLock::Init() { token_ = new (std::nothrow)RunningLockTokenStub(); if (token_ == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :creating RunningLockTokenStub error.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Failed to create the RunningLockTokenStub"); return false; } Create(); @@ -49,14 +49,14 @@ bool RunningLock::Init() ErrCode RunningLock::Lock(uint32_t timeOutMs) { - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :timeOutMs = %u.", __func__, timeOutMs); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Lock timeOutMs: %{public}u", timeOutMs); sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return E_GET_POWER_SERVICE_FAILED; } - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :service lock is called", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side Lock call"); proxy->Lock(token_, runningLockInfo_, timeOutMs); return ERR_OK; @@ -64,16 +64,15 @@ ErrCode RunningLock::Lock(uint32_t timeOutMs) ErrCode RunningLock::UnLock() { - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s.", __func__); if (!CheckUsedNoLock()) { return ERR_OK; } sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return E_GET_POWER_SERVICE_FAILED; } - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :really called service UnLock.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side UnLock call"); proxy->UnLock(token_); return ERR_OK; } @@ -82,18 +81,17 @@ bool RunningLock::CheckUsedNoLock() { sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return false; } bool ret = proxy->IsUsed(token_); - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s, ret = %d.", __func__, ret); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Is Used: %{public}d", ret); return ret; } bool RunningLock::IsUsed() { - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s.", __func__); return CheckUsedNoLock(); } @@ -113,10 +111,10 @@ ErrCode RunningLock::SetWorkTriggerList(const WorkTriggerList& workTriggerList) sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return E_GET_POWER_SERVICE_FAILED; } - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :service SetWorkTriggerList is called.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side SetWorkTriggerList call"); proxy->SetWorkTriggerList(token_, runningLockInfo_.workTriggerlist); return ERR_OK; } @@ -128,27 +126,23 @@ const WorkTriggerList& RunningLock::GetWorkTriggerList() const void RunningLock::Create() { - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s", __func__); - sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return; } - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :service lock is called", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side CreateRunningLock call"); proxy->CreateRunningLock(token_, runningLockInfo_); } void RunningLock::Release() { - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s ", __func__); - sptr proxy = proxy_.promote(); if (proxy == nullptr) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLock::%{public}s :proxy nullptr.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Proxy is a null pointer"); return; } - POWER_HILOGI(MODULE_INNERKIT, "RunningLock::%{public}s :service lock is called", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side ReleaseRunningLock call"); proxy->ReleaseRunningLock(token_); } } // namespace PowerMgr diff --git a/frameworks/native/running_lock_info.cpp b/frameworks/native/running_lock_info.cpp index d27ef7b6efa95e3d20c4bdaae6a333ecbb4da835..ce47685f37ca5e67dbb2c90b7e4a5324e31ff053 100644 --- a/frameworks/native/running_lock_info.cpp +++ b/frameworks/native/running_lock_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,8 +15,6 @@ #include "running_lock_info.h" -#include - #include "power_common.h" namespace OHOS { @@ -25,9 +23,10 @@ bool RunningLockInfo::ReadFromParcelWorkTriggerList(Parcel& parcel, WorkTriggerL { uint32_t listSize = 0; if (!parcel.ReadUint32(listSize)) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "WriteUint32 is failed"); return false; } - POWER_HILOGD(MODULE_SERVICE, "RunningLockInfo::%{public}s listSize = %u", __func__, listSize); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "WorkTigger size: %{public}u", listSize); while (listSize > 0) { std::shared_ptr workTrigger(parcel.ReadParcelable()); if (workTrigger == nullptr) { @@ -50,7 +49,6 @@ bool RunningLockInfo::ReadFromParcel(Parcel& parcel) RunningLockInfo* RunningLockInfo::Unmarshalling(Parcel& parcel) { - POWER_HILOGD(MODULE_SERVICE, "RunningLockInfo::%{public}s enter.", __func__); RunningLockInfo* info = new RunningLockInfo(); if (info == nullptr) { return nullptr; @@ -65,18 +63,18 @@ RunningLockInfo* RunningLockInfo::Unmarshalling(Parcel& parcel) bool RunningLockInfo::MarshallingWorkTriggerList(Parcel& parcel, const WorkTriggerList& list) { uint32_t listSize = static_cast(list.size()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "WorkTigger size: %{public}u", listSize); if (!parcel.WriteUint32(listSize)) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLockInfo::%{public}s listSize = %u.", __func__, listSize); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "WriteUint32 is failed"); return false; } - POWER_HILOGD(MODULE_INNERKIT, "RunningLockInfo::%{public}s listSize = %u.", __func__, listSize); for (const auto& templateVal : list) { if (templateVal == nullptr) { continue; } if (!parcel.WriteParcelable(templateVal.get())) { - POWER_HILOGE(MODULE_INNERKIT, "RunningLockInfo::%{public}s templateVal->Marshalling failed.", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "templateVal Marshalling failed"); return false; } } @@ -98,14 +96,13 @@ bool WorkTrigger::ReadFromParcel(Parcel& parcel) READ_PARCEL_WITH_RET(parcel, Int32, pid_, false); READ_PARCEL_WITH_RET(parcel, Int32, abilityId_, false); - POWER_HILOGD(MODULE_SERVICE, "WorkTrigger::%{public}s name_ = %s, uid_ = %d, pid_ = %d, abilityId_ = %d.", __func__, - name_.c_str(), uid_, pid_, abilityId_); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "name_: %{public}s, uid_: %{public}d, \ + pid_: %{public}d, abilityId_: %{public}d", name_.c_str(), uid_, pid_, abilityId_); return true; } WorkTrigger* WorkTrigger::Unmarshalling(Parcel& parcel) { - POWER_HILOGD(MODULE_SERVICE, "WorkTrigger::%{public}s enter.", __func__); WorkTrigger* workTrigger = new WorkTrigger(); if (workTrigger == nullptr) { return nullptr; @@ -124,8 +121,8 @@ bool WorkTrigger::Marshalling(Parcel& parcel) const WRITE_PARCEL_WITH_RET(parcel, Int32, pid_, false); WRITE_PARCEL_WITH_RET(parcel, Int32, abilityId_, false); - POWER_HILOGD(MODULE_INNERKIT, "WorkTrigger::%{public}s name_ = %s, uid_ = %d, pid_ = %d, abilityId_ = %d.", - __func__, name_.c_str(), uid_, pid_, abilityId_); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "name_: %{public}s, uid_: %{public}d, \ + pid_: %{public}d, abilityId_: %{public}d", name_.c_str(), uid_, pid_, abilityId_); return true; } } // namespace PowerMgr diff --git a/services/native/include/power_mgr_service.h b/services/native/include/power_mgr_service.h index 342befe3dd79b701f9068211d8894a1f76f40919..84099a9e288017b0062fd65620edeaa8f597f9f9 100644 --- a/services/native/include/power_mgr_service.h +++ b/services/native/include/power_mgr_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -125,16 +125,16 @@ public: void EnableMock(IDeviceStateAction* stateAction, IDevicePowerAction* powerAction, IRunningLockAction* lockAction) { - POWER_HILOGE(MODULE_SERVICE, "Service EnableMock:%{public}d", mockCount_++); + POWER_HILOGE(LABEL_TEST, "Service EnableMock:%{public}d", mockCount_++); runningLockMgr_->EnableMock(lockAction); powerStateMachine_->EnableMock(stateAction); shutdownService_.EnableMock(powerAction, stateAction); } void MockProximity(uint32_t status) { - POWER_HILOGE(MODULE_SERVICE, "MockProximity: fun is start"); + POWER_HILOGE(LABEL_TEST, "MockProximity: fun is start"); runningLockMgr_->SetProximity(status); - POWER_HILOGE(MODULE_SERVICE, "MockProximity: fun is end"); + POWER_HILOGE(LABEL_TEST, "MockProximity: fun is end"); } void MockSystemWakeup() { diff --git a/services/native/src/actions/default/device_power_action.cpp b/services/native/src/actions/default/device_power_action.cpp index 7759d9d0b343217ecf65578edc8de0ad6384da94..be74f2467137ca1be28a5b5e16522012f6b60471 100644 --- a/services/native/src/actions/default/device_power_action.cpp +++ b/services/native/src/actions/default/device_power_action.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,15 +15,8 @@ #include "device_power_action.h" -#include -#include -#include -#include -#include "parameters.h" -#include "securec.h" - -#include "hilog_wrapper.h" #include "init_reboot.h" +#include "power_log.h" namespace { const std::string UPDATER_CMD = "updater"; @@ -37,13 +30,13 @@ namespace PowerMgr { void DevicePowerAction::Reboot(const std::string& reason) { std::string rebootReason = Updater(reason); - POWER_HILOGI(MODULE_SERVICE, "Reboot executing."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Reboot executing"); DoReboot(rebootReason.c_str()); } void DevicePowerAction::Shutdown(const std::string& reason) { - POWER_HILOGI(MODULE_SERVICE, "Shutdown executing."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Shutdown executing"); DoReboot(SHUTDOWN_CMD.c_str()); } diff --git a/services/native/src/actions/default/device_state_action.cpp b/services/native/src/actions/default/device_state_action.cpp index b6ca6c46a9e614b218791eed6606cc30673537a0..08573c8bf1e83eee56289a9eb868840b19939809 100644 --- a/services/native/src/actions/default/device_state_action.cpp +++ b/services/native/src/actions/default/device_state_action.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,9 +17,9 @@ #include "display_manager.h" #include "display_power_mgr_client.h" +#include "power_log.h" #include "power_state_machine_info.h" #include "system_suspend_controller.h" -#include "hilog_wrapper.h" using namespace std; @@ -57,7 +57,7 @@ void DeviceStateAction::Wakeup(int64_t callTimeMs, WakeupDeviceType type, const DisplayState DeviceStateAction::GetDisplayState() { DisplayPowerMgr::DisplayState state = DisplayPowerMgrClient::GetInstance().GetDisplayState(); - POWER_HILOGI(MODULE_SERVICE, "GetDisplayState: %{public}d", state); + POWER_HILOGI(FEATURE_POWER_STATE, "Get display state: %{public}d", state); DisplayState ret = DisplayState::DISPLAY_ON; switch (state) { case DisplayPowerMgr::DisplayState::DISPLAY_ON: @@ -80,17 +80,17 @@ DisplayState DeviceStateAction::GetDisplayState() uint32_t DeviceStateAction::SetDisplayState(const DisplayState state, StateChangeReason reason) { - POWER_HILOGI(MODULE_SERVICE, "Action: SetDisplayState: %{public}d, %{public}d", + POWER_HILOGI(FEATURE_POWER_STATE, "Action: SetDisplayState: %{public}d, %{public}d", static_cast(state), static_cast(reason)); DisplayState currentState = GetDisplayState(); if (state == currentState) { - POWER_HILOGI(MODULE_SERVICE, "Already in state: %{public}d", static_cast(state)); + POWER_HILOGI(FEATURE_POWER_STATE, "Already ins state: %{public}d", static_cast(state)); return ActionResult::SUCCESS; } if (dispCallback_ == nullptr) { - POWER_HILOGI(MODULE_SERVICE, "Register Callback"); + POWER_HILOGI(FEATURE_POWER_STATE, "Register Callback"); dispCallback_ = new DisplayPowerCallback(); DisplayPowerMgrClient::GetInstance().RegisterCallback(dispCallback_); } @@ -123,7 +123,7 @@ uint32_t DeviceStateAction::SetDisplayState(const DisplayState state, StateChang } dispCallback_->notify_ = actionCallback_; bool ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(dispState, reason); - POWER_HILOGI(MODULE_SERVICE, "SetDisplayState: %{public}d", ret); + POWER_HILOGI(FEATURE_POWER_STATE, "Set display state: %{public}d", ret); return ret ? ActionResult::SUCCESS : ActionResult::FAILED; } @@ -142,10 +142,10 @@ void DeviceStateAction::RegisterCallback(std::function& callback void DeviceStateAction::DisplayPowerCallback::OnDisplayStateChanged(uint32_t displayId, DisplayPowerMgr::DisplayState state) { - POWER_HILOGI(MODULE_SERVICE, "Callback: OnDisplayStateChanged"); + POWER_HILOGD(FEATURE_POWER_STATE, "Callback: OnDisplayStateChanged"); int32_t mainDisp = DisplayPowerMgrClient::GetInstance().GetMainDisplayId(); if (mainDisp < 0 || static_cast(mainDisp) != displayId) { - POWER_HILOGI(MODULE_SERVICE, "It's not main display, skip!"); + POWER_HILOGI(FEATURE_POWER_STATE, "It's not main display, skip!"); return; } switch (state) { diff --git a/services/native/src/actions/default/running_lock_action.cpp b/services/native/src/actions/default/running_lock_action.cpp index ae959935353cd452e8a4c84492e19fa95e8495a9..eff54a4e27a49002660639966861a3608f70e146 100644 --- a/services/native/src/actions/default/running_lock_action.cpp +++ b/services/native/src/actions/default/running_lock_action.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,7 +15,6 @@ #include "running_lock_action.h" -#include "hilog_wrapper.h" #include "system_suspend_controller.h" using namespace std; diff --git a/services/native/src/actions/default/suspend/running_lock_hub.cpp b/services/native/src/actions/default/suspend/running_lock_hub.cpp index ff4bbc15a00c6443c0718a682c8c625d30645c3b..fed65042f62d8f11d97ddaaebdd8f4d8fa074b1d 100644 --- a/services/native/src/actions/default/suspend/running_lock_hub.cpp +++ b/services/native/src/actions/default/suspend/running_lock_hub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,13 +16,9 @@ #include "suspend/running_lock_hub.h" #include -#include #include -#include "errors.h" -#include "pubdef.h" - -#include "hilog_wrapper.h" +#include "power_log.h" namespace OHOS { namespace PowerMgr { @@ -32,12 +28,12 @@ void RunningLockHub::Acquire(const std::string& name) { std::lock_guard lock(mutex_); if (!SaveLockFile(name, true)) { - POWER_HILOGE(MODULE_SERVICE, "Failed to write the lock state!"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Failed to write the lock state"); } runningLockMap_[name]++; } NotifySuspendCounter(true); - POWER_HILOGI(MODULE_SERVICE, "Acquire runningLock, id: %{public}s", name.c_str()); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Acquire runningLock, name: %{public}s", name.c_str()); } void RunningLockHub::Release(const std::string& name) @@ -46,7 +42,7 @@ void RunningLockHub::Release(const std::string& name) std::lock_guard lock(mutex_); if (InitFd()) { if (!SaveStringToFd(unlockFd_, name.c_str())) { - POWER_HILOGE(MODULE_SERVICE, "Failed to write the unlock state!"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Failed to write the unlock state"); } } if (runningLockMap_.find(name) == runningLockMap_.end()) { @@ -58,7 +54,7 @@ void RunningLockHub::Release(const std::string& name) } } NotifySuspendCounter(false); - POWER_HILOGI(MODULE_SERVICE, "Release runningLock, id: %{public}s", name.c_str()); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Release runningLock, name: %{public}s", name.c_str()); } bool RunningLockHub::InitFd() @@ -71,7 +67,7 @@ bool RunningLockHub::InitFd() unlockFd_ = UniqueFd(TEMP_FAILURE_RETRY(open(UNLOCK_PATH, O_RDWR | O_CLOEXEC))); inited = true; if (lockFd_ < 0 || unlockFd_ < 0) { - POWER_HILOGE(MODULE_SERVICE, "Running lock fd initialization failed!"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Running lock fd initialization failed"); return false; } return inited; diff --git a/services/native/src/actions/default/suspend/suspend_controller.cpp b/services/native/src/actions/default/suspend/suspend_controller.cpp index d277a269542a40c40901499c107634e5b56eb221..5ffadd0d5c1c4de93b19a7885a27ca6d2eb60ed6 100644 --- a/services/native/src/actions/default/suspend/suspend_controller.cpp +++ b/services/native/src/actions/default/suspend/suspend_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,10 +18,7 @@ #include #include -#include "errors.h" -#include "pubdef.h" - -#include "hilog_wrapper.h" +#include "power_log.h" namespace OHOS { namespace PowerMgr { @@ -36,30 +33,29 @@ SuspendController::SuspendController() void SuspendController::AutoSuspend::AutoSuspendLoop() { - POWER_HILOGD(MODULE_SERVICE, "AutoSuspendLoop start"); + POWER_HILOGD(FEATURE_SUSPEND, "AutoSuspendLoop start"); while (true) { std::this_thread::sleep_for(waitTime_); if (!started_) { - POWER_HILOGW(MODULE_SERVICE, "AutoSuspend is stopped"); + POWER_HILOGW(FEATURE_SUSPEND, "AutoSuspend is stopped"); break; } const std::string wakeupCount = WaitWakeupCount(); if (wakeupCount.empty()) { - POWER_HILOGD(MODULE_SERVICE, "Can't read wake count, continue"); + POWER_HILOGD(FEATURE_SUSPEND, "Can't read wake count, continue"); continue; } waitingFunc_(); if (!WriteWakeupCount(wakeupCount)) { - POWER_HILOGD(MODULE_SERVICE, "Can't write wake count, continue"); + POWER_HILOGD(FEATURE_SUSPEND, "Can't write wake count, continue"); continue; } if (onSuspend_ != nullptr) { onSuspend_(); } - POWER_HILOGD(MODULE_SERVICE, "SuspendEnter"); bool success = SuspendEnter(); if (!success) { - POWER_HILOGE(MODULE_SERVICE, "Start suspend failed!"); + POWER_HILOGE(FEATURE_SUSPEND, "Start suspend failed"); } if (onWakeup_ != nullptr) { onWakeup_(); @@ -68,66 +64,64 @@ void SuspendController::AutoSuspend::AutoSuspendLoop() } started_ = false; - POWER_HILOGD(MODULE_SERVICE, "AutoSuspendLoop end"); + POWER_HILOGD(FEATURE_SUSPEND, "AutoSuspendLoop end"); } void SuspendController::AutoSuspend::Start(SuspendCallback onSuspend, SuspendCallback onWakeup) { - POWER_HILOGD(MODULE_SERVICE, "AutoSuspend Start"); + POWER_HILOGD(FEATURE_SUSPEND, "AutoSuspend Start"); onSuspend_ = onSuspend; onWakeup_ = onWakeup; if (started_) { - POWER_HILOGW(MODULE_SERVICE, "AutoSuspend is already started"); + POWER_HILOGW(FEATURE_SUSPEND, "AutoSuspend is already started"); return; } daemon_ = std::make_unique(&AutoSuspend::AutoSuspendLoop, this); daemon_->detach(); - POWER_HILOGD(MODULE_SERVICE, "AutoSuspend Start detach"); + POWER_HILOGD(FEATURE_SUSPEND, "AutoSuspend Start detach"); started_ = true; } void SuspendController::AutoSuspend::Stop() { - POWER_HILOGD(MODULE_SERVICE, "AutoSuspend Stop"); + POWER_HILOGD(FEATURE_SUSPEND, "AutoSuspend Stop"); if (started_ && daemon_.get() != nullptr) { - POWER_HILOGD(MODULE_SERVICE, "daemon join start"); + POWER_HILOGD(FEATURE_SUSPEND, "daemon join start"); started_ = false; daemon_->join(); - POWER_HILOGD(MODULE_SERVICE, "daemon join end"); + POWER_HILOGD(FEATURE_SUSPEND, "daemon join end"); } } bool SuspendController::AutoSuspend::SuspendEnter() { - POWER_HILOGE(MODULE_SERVICE, "SuspendController::AutoSuspend::SuspendEnter: fun is start!"); static bool inited = false; static UniqueFd suspendStateFd(TEMP_FAILURE_RETRY(open(SUSPEND_STATE_PATH, O_RDWR | O_CLOEXEC))); if (!inited) { if (suspendStateFd < 0) { - POWER_HILOGE(MODULE_SERVICE, "Failed to open the suspending state fd!"); + POWER_HILOGE(FEATURE_SUSPEND, "Failed to open the suspending state fd"); return false; } inited = true; } - POWER_HILOGE(MODULE_SERVICE, "Before suspend!"); + POWER_HILOGD(FEATURE_SUSPEND, "Before suspend"); bool ret = SaveStringToFd(suspendStateFd, SUSPEND_STATE); - POWER_HILOGE(MODULE_SERVICE, "After suspend!"); + POWER_HILOGD(FEATURE_SUSPEND, "After suspend"); if (!ret) { - POWER_HILOGE(MODULE_SERVICE, "Failed to write the suspending state!"); + POWER_HILOGE(FEATURE_SUSPEND, "Failed to write the suspending state"); } return ret; } std::string SuspendController::AutoSuspend::WaitWakeupCount() { - POWER_HILOGI(MODULE_SERVICE, "SuspendController::AutoSuspend::WaitWakeupCount: fun is start"); if (wakeupCountFd < 0) { wakeupCountFd = UniqueFd(TEMP_FAILURE_RETRY(open(WAKEUP_COUNT_PATH, O_RDWR | O_CLOEXEC))); } std::string wakeupCount; bool ret = LoadStringFromFd(wakeupCountFd, wakeupCount); if (!ret) { - POWER_HILOGW(MODULE_SERVICE, "Read wakeup count failed!"); + POWER_HILOGW(FEATURE_SUSPEND, "Read wakeup count failed"); return std::string(); } return wakeupCount; @@ -135,22 +129,20 @@ std::string SuspendController::AutoSuspend::WaitWakeupCount() bool SuspendController::AutoSuspend::WriteWakeupCount(std::string wakeupCount) { - POWER_HILOGI(MODULE_SERVICE, "SuspendController::AutoSuspend::WriteWakeupCount: fun is start"); if (wakeupCountFd < 0) { return false; } bool ret = SaveStringToFd(wakeupCountFd, wakeupCount.c_str()); if (!ret) { - POWER_HILOGE(MODULE_SERVICE, "Failed to write the wakeup count!"); + POWER_HILOGE(FEATURE_SUSPEND, "Failed to write the wakeup count"); } return ret; } void SuspendController::Suspend(SuspendCallback onSuspend, SuspendCallback onWakeup, bool force) { - POWER_HILOGI(MODULE_SERVICE, "SuspendController::Suspend: fun is start"); if (force) { - POWER_HILOGI(MODULE_SERVICE, "SuspendController Suspend: force"); + POWER_HILOGI(FEATURE_SUSPEND, "SuspendController Suspend: force"); if (onSuspend != nullptr) { onSuspend(); } @@ -159,7 +151,7 @@ void SuspendController::Suspend(SuspendCallback onSuspend, SuspendCallback onWak onWakeup(); } } else { - POWER_HILOGI(MODULE_SERVICE, "SuspendController Suspend: not force"); + POWER_HILOGI(FEATURE_SUSPEND, "SuspendController Suspend: not force"); suspend_->Start(onSuspend, onWakeup); } } @@ -173,14 +165,14 @@ void SuspendController::IncSuspendBlockCounter() { std::lock_guard lock(suspendMutex_); suspendBlockCounter_++; - POWER_HILOGD(MODULE_SERVICE, "Running Lock Counter = %{public}d", suspendBlockCounter_); + POWER_HILOGD(FEATURE_SUSPEND, "Running Lock Counter = %{public}d", suspendBlockCounter_); } void SuspendController::DecSuspendBlockCounter() { std::lock_guard lock(suspendMutex_); suspendBlockCounter_--; - POWER_HILOGD(MODULE_SERVICE, "Running Lock Counter = %{public}d", suspendBlockCounter_); + POWER_HILOGD(FEATURE_SUSPEND, "Running Lock Counter = %{public}d", suspendBlockCounter_); if (SuspendConditionSatisfied()) { suspendCv_.notify_one(); } diff --git a/services/native/src/actions/default/system_suspend_controller.cpp b/services/native/src/actions/default/system_suspend_controller.cpp index 63733bd03e75fe88b1365b9a3946b50d4a220388..2eeba96c8bd45c104e18ffb68825f1441e2bbd4e 100644 --- a/services/native/src/actions/default/system_suspend_controller.cpp +++ b/services/native/src/actions/default/system_suspend_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,11 +15,10 @@ #include "system_suspend_controller.h" -#include "v1_0/power_interface_proxy.h" - -#include "hilog_wrapper.h" +#include "power_log.h" #include "suspend/running_lock_hub.h" #include "suspend/suspend_controller.h" +#include "v1_0/power_interface_proxy.h" using namespace OHOS::HDI::Power::V1_0; @@ -32,7 +31,7 @@ SystemSuspendController::SystemSuspendController() sptr g_callback = new PowerHdiCallbackImpl(); powerInterface = IPowerInterface::Get(); if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } powerInterface->RegisterCallback(g_callback); @@ -48,7 +47,7 @@ void SystemSuspendController::Suspend(const std::function& onSuspend, { #ifndef POWER_SUSPEND_NO_HDI if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } if (force) { @@ -65,7 +64,7 @@ void SystemSuspendController::Wakeup() { #ifndef POWER_SUSPEND_NO_HDI if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } powerInterface->StopSuspend(); @@ -78,7 +77,7 @@ void SystemSuspendController::AcquireRunningLock(const std::string& name) { #ifndef POWER_SUSPEND_NO_HDI if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } powerInterface->SuspendBlock(name); @@ -89,7 +88,7 @@ void SystemSuspendController::ReleaseRunningLock(const std::string& name) { #ifndef POWER_SUSPEND_NO_HDI if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } powerInterface->SuspendUnblock(name); @@ -100,7 +99,7 @@ void SystemSuspendController::Dump(std::string& info) { #ifndef POWER_SUSPEND_NO_HDI if (powerInterface == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "No hdf interface"); + POWER_HILOGE(COMP_SVC, "The hdf interface is null"); return; } powerInterface->PowerDump(info); diff --git a/services/native/src/actions/irunning_lock_action.cpp b/services/native/src/actions/irunning_lock_action.cpp index aeca5be7ff7bbef1cc7583c8690a8d1a03f22e15..d0bb78d21cbf54f469008a8be7c6f4b82b3c1b03 100644 --- a/services/native/src/actions/irunning_lock_action.cpp +++ b/services/native/src/actions/irunning_lock_action.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,7 +15,7 @@ #include "actions/irunning_lock_action.h" -#include "hilog_wrapper.h" +#include "power_log.h" using namespace std; @@ -28,7 +28,7 @@ const array IRunningLoc void IRunningLockAction::Acquire(RunningLockType type) { if (!IsValidType(type)) { - POWER_HILOGE(MODULE_SERVICE, "Invalid runninglock type"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Invalid runninglock type"); return; } @@ -38,25 +38,27 @@ void IRunningLockAction::Acquire(RunningLockType type) Lock(type, GetLockTag(type)); } desc.IncRef(); - POWER_HILOGD(MODULE_SERVICE, "Acquire runninglock, type: %{public}u, refCnt: %{public}u", t, desc.GetRefCnt()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Acquire runninglock, type: %{public}u, refCnt: %{public}u", t, + desc.GetRefCnt()); } void IRunningLockAction::Release(RunningLockType type) { if (!IsValidType(type)) { - POWER_HILOGE(MODULE_SERVICE, "Invalid runninglock type"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Invalid runninglock type"); return; } auto t = ToUnderlying(type); RunningLockDesc& desc = lockDescs_[t]; if (desc.IsRefNone()) { - POWER_HILOGE(MODULE_SERVICE, "Invalid refCnt of wakelock: %{public}u", t); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Invalid refCnt of wakelock: %{public}u", t); return; } desc.DecRef(); - POWER_HILOGD(MODULE_SERVICE, "Release runninglock, type: %{public}u, refCnt: %{public}u", t, desc.GetRefCnt()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Release runninglock, type: %{public}u, refCnt: %{public}u", t, + desc.GetRefCnt()); if (desc.IsRefNone()) { Unlock(type, GetLockTag(type)); } diff --git a/services/native/src/power_mgr_dumper.cpp b/services/native/src/power_mgr_dumper.cpp index 3e28404a14db16c7d6f2d57166abc733111e0c38..2abbd4c820147ec66fe8621ae70a584cf84641ee 100644 --- a/services/native/src/power_mgr_dumper.cpp +++ b/services/native/src/power_mgr_dumper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,7 +15,6 @@ #include "power_mgr_dumper.h" -#include "power_common.h" #include "power_mgr_service.h" #include "system_suspend_controller.h" diff --git a/services/native/src/power_mgr_monitor.cpp b/services/native/src/power_mgr_monitor.cpp index f1e5fe56b65bbb4c016cda5173343334a90fdfc1..43b65369bbe8389b9d547fd31e958f053447cd97 100644 --- a/services/native/src/power_mgr_monitor.cpp +++ b/services/native/src/power_mgr_monitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,9 +19,8 @@ #include #include -#include "power_common.h" +#include "power_log.h" #include "power_mgr_service.h" -#include "power_state_machine.h" using namespace OHOS::AAFwk; using namespace OHOS::EventFwk; @@ -52,7 +51,7 @@ void PowerMgrMonitor::InitEventHandles() return; } for (auto &eh : EVENT_HANDLES) { - POWER_HILOGI(MODULE_SERVICE, "Add event: %{public}s", eh.first.c_str()); + POWER_HILOGI(COMP_SVC, "Add event: %{public}s", eh.first.c_str()); eventHandles_.emplace(eh.first, bind(eh.second, this, placeholders::_1)); } } @@ -79,28 +78,28 @@ bool PowerMgrMonitor::RegisterSubscriber(const sptr& info) if (succeed) { break; } - POWER_HILOGE(MODULE_SERVICE, "Sleep for a while and retry to register subscriber"); + POWER_HILOGE(COMP_SVC, "Sleep for a while and retry to register subscriber"); usleep(50000); // sleep 50ms } if (!succeed) { - POWER_HILOGE(MODULE_SERVICE, "Failed to register subscriber"); + POWER_HILOGE(COMP_SVC, "Failed to register subscriber"); return false; } subscriber_ = s; - POWER_HILOGI(MODULE_SERVICE, "Succeed to register subscriber"); + POWER_HILOGI(COMP_SVC, "Succeed to register subscriber"); return true; } void PowerMgrMonitor::HandleScreenStateChanged(const IntentWant& want) const { bool isScreenOn = want.GetAction() == CommonEventSupport::COMMON_EVENT_SCREEN_ON; - POWER_HILOGD(MODULE_SERVICE, "Screen is %{public}s", isScreenOn ? "on" : "off"); + POWER_HILOGD(COMP_SVC, "Screen is %{public}s", isScreenOn ? "on" : "off"); DelayedSpSingleton::GetInstance()->GetPowerStateMachine()->ReceiveScreenEvent(isScreenOn); } void PowerMgrMonitor::HandleStartUpCompleted(const IntentWant& want __attribute__((__unused__))) const { - POWER_HILOGD(MODULE_SERVICE, "Start up completed"); + POWER_HILOGD(COMP_SVC, "Start up completed"); } void PowerMgrMonitor::EventSubscriber::HandleEvent(const IntentWant& want) @@ -108,10 +107,10 @@ void PowerMgrMonitor::EventSubscriber::HandleEvent(const IntentWant& want) auto action = want.GetAction(); auto it = eventHandles_.find(action); if (it == eventHandles_.end()) { - POWER_HILOGI(MODULE_SERVICE, "Ignore event: %{public}s", action.c_str()); + POWER_HILOGI(COMP_SVC, "Ignore event: %{public}s", action.c_str()); return; } - POWER_HILOGI(MODULE_SERVICE, "Handle event: %{public}s", action.c_str()); + POWER_HILOGI(COMP_SVC, "Handle event: %{public}s", action.c_str()); it->second(want); } } // namespace PowerMgr diff --git a/services/native/src/power_mgr_notify.cpp b/services/native/src/power_mgr_notify.cpp index 521742b72619a03604f7dabce1d200284d3a3168..74378837bf7d6bc15ee0d671c476c63c6c96591e 100644 --- a/services/native/src/power_mgr_notify.cpp +++ b/services/native/src/power_mgr_notify.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,9 +18,8 @@ #include #include #include -#include -#include "power_common.h" +#include "power_log.h" using namespace OHOS::AAFwk; using namespace OHOS::EventFwk; @@ -43,25 +42,27 @@ void PowerMgrNotify::RegisterPublishEvents() void PowerMgrNotify::PublishEvents(int64_t eventTime, sptr want) { if ((want == nullptr) || (publishInfo_ == nullptr)) { - POWER_HILOGE(MODULE_SERVICE, "Invalid parameter"); + POWER_HILOGE(COMP_SVC, "Invalid parameter"); return; } - - POWER_HILOGI(MODULE_SERVICE, "Start to publish event %{public}s at %{public}lld", - want->GetAction().c_str(), static_cast(eventTime)); CommonEventData event(*want); CommonEventManager::PublishCommonEvent(event, *publishInfo_, nullptr); - POWER_HILOGI(MODULE_SERVICE, "Publish event %{public}s done", want->GetAction().c_str()); } void PowerMgrNotify::PublishScreenOffEvents(int64_t eventTime) { + POWER_HILOGI(FEATURE_SUSPEND, "Start to publish event %{public}s at %{public}lld", + screenOffWant_->GetAction().c_str(), static_cast(eventTime)); PublishEvents(eventTime, screenOffWant_); + POWER_HILOGI(FEATURE_SUSPEND, "Publish event %{public}s done", screenOffWant_->GetAction().c_str()); } void PowerMgrNotify::PublishScreenOnEvents(int64_t eventTime) { + POWER_HILOGI(FEATURE_WAKEUP, "Start to publish event %{public}s at %{public}lld", + screenOnWant_->GetAction().c_str(), static_cast(eventTime)); PublishEvents(eventTime, screenOnWant_); + POWER_HILOGI(FEATURE_WAKEUP, "Publish event %{public}s done", screenOnWant_->GetAction().c_str()); } } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/power_mgr_service.cpp b/services/native/src/power_mgr_service.cpp index 33fb70cd083744ac3c6dc927f1070cda966e6700..189ccffdf7ef8c901c9fa0796f242e84bce143b2 100755 --- a/services/native/src/power_mgr_service.cpp +++ b/services/native/src/power_mgr_service.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "input_manager.h" +#include #include #include #include @@ -58,32 +58,32 @@ PowerMgrService::~PowerMgrService() {} void PowerMgrService::OnStart() { - POWER_HILOGI(MODULE_SERVICE, "OnStart enter."); + POWER_HILOGD(COMP_SVC, "Power Management startup"); if (ready_) { - POWER_HILOGE(MODULE_SERVICE, "OnStart is ready, nothing to do."); + POWER_HILOGW(COMP_SVC, "OnStart is ready, nothing to do"); return; } if (!Init()) { - POWER_HILOGE(MODULE_SERVICE, "OnStart call init fail"); + POWER_HILOGE(COMP_SVC, "Call init fail"); return; } if (!Publish(DelayedSpSingleton::GetInstance())) { - POWER_HILOGE(MODULE_SERVICE, "OnStart register to system ability manager failed."); + POWER_HILOGE(COMP_SVC, "Register to system ability manager failed"); return; } ready_ = true; - POWER_HILOGI(MODULE_SERVICE, "OnStart and add system ability success."); + POWER_HILOGI(COMP_SVC, "Add system ability success"); } bool PowerMgrService::Init() { - POWER_HILOGI(MODULE_SERVICE, "Init start"); + POWER_HILOGI(COMP_SVC, "Init start"); if (!eventRunner_) { eventRunner_ = AppExecFwk::EventRunner::Create(POWERMGR_SERVICE_NAME); if (eventRunner_ == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "Init failed due to create EventRunner"); + POWER_HILOGE(COMP_SVC, "Init failed due to create EventRunner"); return false; } } @@ -98,19 +98,19 @@ bool PowerMgrService::Init() runningLockMgr_ = std::make_shared(pms); } if (!runningLockMgr_->Init()) { - POWER_HILOGE(MODULE_SERVICE, "OnStart init fail"); + POWER_HILOGE(COMP_SVC, "Running lock init fail"); return false; } if (!PowerStateMachineInit()) { - POWER_HILOGE(MODULE_SERVICE, "power state machine init fail!"); + POWER_HILOGE(COMP_SVC, "Power state machine init fail"); } if (DelayedSpSingleton::GetInstance()) { powerModeModule_.EnableMode(powerModeModule_.GetModeItem()); } else { - POWER_HILOGE(MODULE_SERVICE, "power mode init fail!"); + POWER_HILOGE(COMP_SVC, "Power mode init fail"); } handler_->SendEvent(PowermsEventHandler::INIT_KEY_MONITOR_MSG, 0, INIT_KEY_MONITOR_DELAY_MS); - POWER_HILOGI(MODULE_SERVICE, "Init success"); + POWER_HILOGI(COMP_SVC, "Init success"); return true; } @@ -119,7 +119,7 @@ bool PowerMgrService::PowerStateMachineInit() if (powerStateMachine_ == nullptr) { powerStateMachine_ = std::make_shared(pms); if (!(powerStateMachine_->Init())) { - POWER_HILOGE(MODULE_SERVICE, "power state machine start fail!"); + POWER_HILOGE(COMP_SVC, "Power state machine start fail!"); return false; } } @@ -138,7 +138,7 @@ class InputCallback : public IInputEventConsumer { void InputCallback::OnInputEvent(std::shared_ptr keyEvent) const { - POWER_HILOGI(MODULE_SERVICE, "OnInputEvent keyEvent"); + POWER_HILOGD(FEATURE_INPUT, "KeyEvent"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -148,7 +148,7 @@ void InputCallback::OnInputEvent(std::shared_ptr keyEvent) const void InputCallback::OnInputEvent(std::shared_ptr pointerEvent) const { - POWER_HILOGI(MODULE_SERVICE, "OnInputEvent pointerEvent"); + POWER_HILOGD(FEATURE_INPUT, "PointerEvent"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -159,7 +159,7 @@ void InputCallback::OnInputEvent(std::shared_ptr pointerEvent) con void InputCallback::OnInputEvent(std::shared_ptr axisEvent) const { - POWER_HILOGI(MODULE_SERVICE, "OnInputEvent axisEvent"); + POWER_HILOGD(FEATURE_INPUT, "AxisEvent"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -168,7 +168,7 @@ void InputCallback::OnInputEvent(std::shared_ptr axisEvent) const void PowerMgrService::KeyMonitorInit() { - POWER_HILOGI(MODULE_SERVICE, "KeyMonitorInit"); + POWER_HILOGD(FEATURE_INPUT, "Initialize the subscription key"); std::shared_ptr keyOption = std::make_shared(); std::set preKeys; @@ -178,11 +178,11 @@ void PowerMgrService::KeyMonitorInit() keyOption->SetFinalKeyDownDuration(LONG_PRESS_DELAY_MS); powerkeyLongPressId_ = InputManager::GetInstance()->SubscribeKeyEvent(keyOption, [this](std::shared_ptr keyEvent) { - POWER_HILOGI(MODULE_SERVICE, "Receive long press powerkey"); + POWER_HILOGI(FEATURE_INPUT, "Receive long press powerkey"); handler_->SendEvent(PowermsEventHandler::SHUTDOWN_REQUEST_MSG); }); if (powerkeyLongPressId_ < 0) { - POWER_HILOGI(MODULE_SERVICE, "SubscribeKeyEvent failed: %{public}d", powerkeyLongPressId_); + POWER_HILOGI(FEATURE_INPUT, "SubscribeKeyEvent failed: %{public}d", powerkeyLongPressId_); handler_->SendEvent(PowermsEventHandler::INIT_KEY_MONITOR_MSG, 0, INIT_KEY_MONITOR_DELAY_MS); return; } @@ -195,10 +195,10 @@ void PowerMgrService::KeyMonitorInit() keyOption->SetFinalKeyDownDuration(0); powerkeyShortPressId_ = InputManager::GetInstance()->SubscribeKeyEvent(keyOption, [this](std::shared_ptr keyEvent) { - POWER_HILOGI(MODULE_SERVICE, "Receive short press powerkey"); + POWER_HILOGI(FEATURE_INPUT, "Receive short press powerkey"); powerkeyPressed_ = true; if (dialogId_ >= 0) { - POWER_HILOGI(MODULE_SERVICE, "Cancel dialog when short press"); + POWER_HILOGI(FEATURE_SHUTDOWN, "Cancel dialog when short press"); Ace::UIServiceMgrClient::GetInstance()->CancelDialog(dialogId_); dialogId_ = -1; } @@ -225,7 +225,7 @@ void PowerMgrService::KeyMonitorInit() keyOption->SetFinalKeyDownDuration(0); doubleClickId_ = InputManager::GetInstance()->SubscribeKeyEvent(keyOption, [this](std::shared_ptr keyEvent) { - POWER_HILOGI(MODULE_SERVICE, "Receive double click"); + POWER_HILOGI(FEATURE_INPUT, "Receive double click"); this->HandleKeyEvent(keyEvent->GetKeyCode()); }); @@ -235,10 +235,10 @@ void PowerMgrService::KeyMonitorInit() void PowerMgrService::KeyMonitorCancel() { - POWER_HILOGI(MODULE_SERVICE, "KeyMonitorCancel"); + POWER_HILOGI(FEATURE_INPUT, "Unsubscribe key information"); InputManager* inputManager = InputManager::GetInstance(); if (inputManager == nullptr) { - POWER_HILOGI(MODULE_SERVICE, "inputManager is NULL"); + POWER_HILOGI(FEATURE_INPUT, "InputManager is null"); return; } if (powerkeyLongPressId_ >= 0) { @@ -266,9 +266,9 @@ public: bool DeviceStatusCallback::OnEventResult(const DevicestatusDataUtils::DevicestatusData& devicestatusData) { - POWER_HILOGI(MODULE_SERVICE, "DeviceStatusCallback OnEventResult"); + POWER_HILOGI(FEATURE_INPUT, "DeviceStatusCallback OnEventResult"); if (devicestatusData.type != DevicestatusDataUtils::DevicestatusType::TYPE_LID_OPEN) { - POWER_HILOGI(MODULE_SERVICE, "OnEventResult, wrong type: %{public}d", devicestatusData.type); + POWER_HILOGI(FEATURE_INPUT, "OnEventResult, wrong type: %{public}d", devicestatusData.type); return false; } auto pms = DelayedSpSingleton::GetInstance(); @@ -277,10 +277,10 @@ bool DeviceStatusCallback::OnEventResult(const DevicestatusDataUtils::Devicestat } int64_t now = static_cast(time(0)); if (devicestatusData.value == DevicestatusDataUtils::DevicestatusValue::VALUE_EXIT) { - POWER_HILOGI(MODULE_SERVICE, "OnEventResult lid close"); + POWER_HILOGI(FEATURE_INPUT, "OnEventResult lid close"); pms->SuspendDevice(now, SuspendDeviceType::SUSPEND_DEVICE_REASON_LID_SWITCH, false); } else if (devicestatusData.value == DevicestatusDataUtils::DevicestatusValue::VALUE_ENTER) { - POWER_HILOGI(MODULE_SERVICE, "OnEventResult lid open"); + POWER_HILOGI(FEATURE_INPUT, "OnEventResult lid open"); std::string reason = "lid open"; pms->WakeupDevice(now, WakeupDeviceType::WAKEUP_DEVICE_LID, reason); } @@ -289,20 +289,20 @@ bool DeviceStatusCallback::OnEventResult(const DevicestatusDataUtils::Devicestat void PowerMgrService::DeviceStatusMonitorInit() { - POWER_HILOGI(MODULE_SERVICE, "DeviceStatusMonitorInit"); + POWER_HILOGI(FEATURE_INPUT, "DeviceStatusMonitorInit"); deviceStatusAgent_ = std::make_shared(); std::shared_ptr agentEvent = std::make_shared(); int32_t ret = deviceStatusAgent_->SubscribeAgentEvent( DevicestatusDataUtils::DevicestatusType::TYPE_LID_OPEN, agentEvent); - POWER_HILOGI(MODULE_SERVICE, "SubscribeAgentEvent for device state: %{public}d", ret); + POWER_HILOGI(FEATURE_INPUT, "SubscribeAgentEvent for device state: %{public}d", ret); } void PowerMgrService::HandleShutdownRequest() { - POWER_HILOGI(MODULE_SERVICE, "HandleShutdown"); + POWER_HILOGI(FEATURE_SHUTDOWN, "HandleShutdown"); if (dialogId_ >= 0) { - POWER_HILOGI(MODULE_SERVICE, "dialog is already showing"); + POWER_HILOGI(FEATURE_SHUTDOWN, "dialog is already showing"); return; } // show dialog @@ -329,7 +329,7 @@ void PowerMgrService::HandleShutdownRequest() width, height, [this](int32_t id, const std::string& event, const std::string& params) { - POWER_HILOGI(MODULE_SERVICE, "Dialog callback: %{public}s, %{public}s", + POWER_HILOGI(FEATURE_SHUTDOWN, "Shutdown dialog callback: %{public}s, %{public}s", event.c_str(), params.c_str()); if (event == "EVENT_SHUTDOWN") { this->ShutDownDevice(REASON_POWER_KEY); @@ -341,9 +341,9 @@ void PowerMgrService::HandleShutdownRequest() } }, &dialogId_); - POWER_HILOGI(MODULE_SERVICE, "show dialog is %{public}d, dialogId=%{public}d", errCode, dialogId_); + POWER_HILOGI(FEATURE_SHUTDOWN, "Show dialog is %{public}d, dialogId=%{public}d", errCode, dialogId_); if (!IsScreenOn()) { - POWER_HILOGI(MODULE_SERVICE, "wakeup when display off"); + POWER_HILOGI(FEATURE_SHUTDOWN, "Wakeup when display off"); int64_t now = static_cast(time(0)); this->WakeupDevice(now, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, REASON_POWER_KEY); } @@ -352,10 +352,10 @@ void PowerMgrService::HandleShutdownRequest() void PowerMgrService::HandlePowerKeyUp() { - POWER_HILOGI(MODULE_SERVICE, "Receive release powerkey"); + POWER_HILOGI(FEATURE_INPUT, "Receive release powerkey"); if (dialogId_ >= 0 || this->shutdownService_.IsShuttingDown()) { - POWER_HILOGI(MODULE_SERVICE, "System is shutting down"); + POWER_HILOGW(FEATURE_INPUT, "System is shutting down"); return; } int64_t now = static_cast(time(0)); @@ -368,19 +368,19 @@ void PowerMgrService::HandlePowerKeyUp() void PowerMgrService::HandleKeyEvent(int32_t keyCode) { - POWER_HILOGI(MODULE_SERVICE, "HandleKeyEvent: %{public}d", keyCode); + POWER_HILOGD(FEATURE_INPUT, "keyCode: %{public}d", keyCode); int64_t now = static_cast(time(0)); if (IsScreenOn()) { this->RefreshActivity(now, UserActivityType::USER_ACTIVITY_TYPE_BUTTON, false); } else { if (keyCode == KeyEvent::KEYCODE_F1) { - POWER_HILOGI(MODULE_SERVICE, "wakeup by double click"); + POWER_HILOGI(FEATURE_WAKEUP, "Wakeup by double click"); std::string reason = "double click"; reason.append(std::to_string(keyCode)); this->WakeupDevice(now, WakeupDeviceType::WAKEUP_DEVICE_DOUBLE_CLICK, reason); } else if (keyCode >= KeyEvent::KEYCODE_0 && keyCode <= KeyEvent::KEYCODE_NUMPAD_RIGHT_PAREN) { - POWER_HILOGI(MODULE_SERVICE, "wakeup by keyboard"); + POWER_HILOGI(FEATURE_WAKEUP, "Wakeup by keyboard"); std::string reason = "keyboard:"; reason.append(std::to_string(keyCode)); this->WakeupDevice(now, WakeupDeviceType::WAKEUP_DEVICE_KEYBOARD, reason); @@ -390,13 +390,14 @@ void PowerMgrService::HandleKeyEvent(int32_t keyCode) void PowerMgrService::HandlePointEvent(int32_t type) { - POWER_HILOGI(MODULE_SERVICE, "HandlePointEvent: %{public}d", type); + POWER_HILOGD(FEATURE_INPUT, "type: %{public}d", type); int64_t now = static_cast(time(0)); if (this->IsScreenOn()) { this->RefreshActivity(now, UserActivityType::USER_ACTIVITY_TYPE_TOUCH, false); } else { if (type == PointerEvent::SOURCE_TYPE_MOUSE) { std::string reason = "mouse click"; + POWER_HILOGI(FEATURE_WAKEUP, "Wakeup by mouse"); this->WakeupDevice(now, WakeupDeviceType::WAKEUP_DEVICE_MOUSE, reason); } } @@ -404,13 +405,13 @@ void PowerMgrService::HandlePointEvent(int32_t type) void PowerMgrService::NotifyDisplayActionDone(uint32_t event) { - POWER_HILOGI(MODULE_SERVICE, "NotifyDisplayActionDone: %{public}d", event); + POWER_HILOGI(COMP_SVC, "NotifyDisplayActionDone: %{public}d", event); handler_->RemoveEvent(PowermsEventHandler::POWER_KEY_TIMEOUT_MSG); } void PowerMgrService::HandlePowerKeyTimeout() { - POWER_HILOGI(MODULE_SERVICE, "HandlePowerKeyTimeout"); + POWER_HILOGD(FEATURE_INPUT, "PowerKey press timeout"); std::string message = "POWER KEY TIMEOUT "; if (powerkeyPressed_) { message.append("WITHOUT KEY UP"); @@ -424,12 +425,12 @@ void PowerMgrService::HandlePowerKeyTimeout() "PACKAGE_NAME", "", "PROCESS_NAME", "", "MSG", message.c_str()); - POWER_HILOGI(MODULE_SERVICE, "PowerKey press Timeout"); + POWER_HILOGD(FEATURE_INPUT, "Send HiSysEvent msg end"); } void PowerMgrService::PowerMgrService::OnStop() { - POWER_HILOGI(MODULE_SERVICE, "stop service"); + POWER_HILOGW(COMP_SVC, "Stop service"); if (!ready_) { return; } @@ -450,20 +451,20 @@ void PowerMgrService::PowerMgrService::OnStop() int32_t PowerMgrService::Dump(int32_t fd, const std::vector& args) { std::lock_guard lock(mutex_); - POWER_HILOGI(MODULE_SERVICE, "Dump service"); + POWER_HILOGI(COMP_SVC, "Dump service"); std::vector argsInStr; std::transform(args.begin(), args.end(), std::back_inserter(argsInStr), [](const std::u16string &arg) { std::string ret = Str16ToStr8(arg); - POWER_HILOGI(MODULE_SERVICE, "arg: %{public}s", ret.c_str()); + POWER_HILOGI(COMP_SVC, "arg: %{public}s", ret.c_str()); return ret; }); std::string result; PowerMgrDumper::Dump(argsInStr, result); if (!SaveStringToFd(fd, result)) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrService::Dump failed, save to fd failed."); - POWER_HILOGE(MODULE_SERVICE, "Dump Info:\n"); - POWER_HILOGE(MODULE_SERVICE, "%{public}s", result.c_str()); + POWER_HILOGE(COMP_SVC, "Dump failed, save to fd failed."); + POWER_HILOGE(COMP_SVC, "Dump Info:\n"); + POWER_HILOGE(COMP_SVC, "%{public}s", result.c_str()); return ERR_OK; } return ERR_OK; @@ -476,21 +477,17 @@ void PowerMgrService::RebootDevice(const std::string& reason) auto uid = IPCSkeleton::GetCallingUid(); if (reason.find("updater") != std::string::npos) { if (!Permission::CheckCallingPermission("ohos.permission.REBOOT_RECOVERY")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, pid); + POWER_HILOGE(FEATURE_SHUTDOWN, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } } else { if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.REBOOT")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, pid); + POWER_HILOGE(FEATURE_SHUTDOWN, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } } - POWER_HILOGI(MODULE_SERVICE, "Cancel auto sleep timer"); + POWER_HILOGI(FEATURE_SHUTDOWN, "Cancel auto sleep timer"); powerStateMachine_->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG); powerStateMachine_->CancelDelayTimer( @@ -498,7 +495,7 @@ void PowerMgrService::RebootDevice(const std::string& reason) powerStateMachine_->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Call %{public}s !", pid, __func__); + POWER_HILOGI(FEATURE_SHUTDOWN, "Do reboot, called pid: %{public}d, uid: %{public}d", pid, uid); shutdownService_.Reboot(reason); } @@ -509,12 +506,10 @@ void PowerMgrService::ShutDownDevice(const std::string& reason) auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.REBOOT")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, pid); + POWER_HILOGE(FEATURE_SHUTDOWN, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGI(MODULE_SERVICE, "Cancel auto sleep timer"); + POWER_HILOGI(FEATURE_SHUTDOWN, "Cancel auto sleep timer"); powerStateMachine_->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG); powerStateMachine_->CancelDelayTimer( @@ -522,7 +517,7 @@ void PowerMgrService::ShutDownDevice(const std::string& reason) powerStateMachine_->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Call %{public}s !", pid, __func__); + POWER_HILOGI(FEATURE_SHUTDOWN, "Do shutdown, called pid: %{public}d, uid: %{public}d", pid, uid); shutdownService_.Shutdown(reason); } @@ -531,18 +526,17 @@ void PowerMgrService::SuspendDevice(int64_t callTimeMs, bool suspendImmed) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, illegal calling uid %{public}d.", - __func__, uid); + POWER_HILOGE(FEATURE_SUSPEND, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } if (shutdownService_.IsShuttingDown()) { - POWER_HILOGI(MODULE_SERVICE, "System is shutting down, can't suspend"); + POWER_HILOGW(FEATURE_SUSPEND, "System is shutting down, can't suspend"); return; } - pid_t pid = IPCSkeleton::GetCallingPid(); + POWER_HILOGI(FEATURE_SUSPEND, "Try to suspend device, pid: %{public}d, uid: %{public}d", pid, uid); powerStateMachine_->SuspendDeviceInner(pid, callTimeMs, reason, suspendImmed); } @@ -551,14 +545,13 @@ void PowerMgrService::WakeupDevice(int64_t callTimeMs, const std::string& details) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, illegal calling uid %{public}d.", - __func__, uid); + POWER_HILOGE(FEATURE_WAKEUP, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - pid_t pid = IPCSkeleton::GetCallingPid(); + POWER_HILOGI(FEATURE_WAKEUP, "Try to wakeup device, pid: %{public}d, uid: %{public}d", pid, uid); powerStateMachine_->WakeupDeviceInner(pid, callTimeMs, reason, details, "OHOS"); } @@ -567,47 +560,47 @@ void PowerMgrService::RefreshActivity(int64_t callTimeMs, bool needChangeBacklight) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.REFRESH_USER_ACTION")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, illegal calling uid %{public}d.", - __func__, uid); + POWER_HILOGE(FEATURE_ACTIVITY, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - pid_t pid = IPCSkeleton::GetCallingPid(); + POWER_HILOGD(FEATURE_ACTIVITY, "Try to refresh activity, pid: %{public}d, uid: %{public}d", pid, uid); powerStateMachine_->RefreshActivityInner(pid, callTimeMs, type, needChangeBacklight); } PowerState PowerMgrService::GetState() { std::lock_guard lock(mutex_); - POWER_HILOGI(MODULE_SERVICE, "GetState"); - return powerStateMachine_->GetState(); + auto state = powerStateMachine_->GetState(); + POWER_HILOGD(FEATURE_POWER_STATE, "state: %{public}d", state); + return state; } bool PowerMgrService::IsScreenOn() { std::lock_guard lock(mutex_); - POWER_HILOGI(MODULE_SERVICE, "IsScreenOn"); - return powerStateMachine_->IsScreenOn(); + auto isScreenOn = powerStateMachine_->IsScreenOn(); + POWER_HILOGI(COMP_SVC, "isScreenOn: %{public}d", isScreenOn); + return isScreenOn; } bool PowerMgrService::ForceSuspendDevice(int64_t callTimeMs) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, illegal calling uid %{public}d.", - __func__, uid); + POWER_HILOGE(FEATURE_SUSPEND, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return false; } if (shutdownService_.IsShuttingDown()) { - POWER_HILOGI(MODULE_SERVICE, "System is shutting down, can't force suspend"); + POWER_HILOGI(FEATURE_SUSPEND, "System is shutting down, can't force suspend"); return false; } - pid_t pid = IPCSkeleton::GetCallingPid(); + POWER_HILOGI(FEATURE_SUSPEND, "Try to force suspend device, pid: %{public}d, uid: %{public}d", pid, uid); return powerStateMachine_->ForceSuspendDeviceInner(pid, callTimeMs); } @@ -621,16 +614,15 @@ void PowerMgrService::CreateRunningLock(const sptr& token, const RunningLockInfo& runningLockInfo) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.RUNNING_LOCK")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGI(MODULE_SERVICE, "%{public}s :name = %s, type = %d", __func__, + POWER_HILOGI(FEATURE_RUNNING_LOCK, "name: %{public}s, type: %{public}d", runningLockInfo.name.c_str(), runningLockInfo.type); UserIPCInfo userIPCInfo; @@ -641,16 +633,14 @@ void PowerMgrService::CreateRunningLock(const sptr& token, void PowerMgrService::ReleaseRunningLock(const sptr& token) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.RUNNING_LOCK")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGI(MODULE_SERVICE, "%{public}s called.", __func__); runningLockMgr_->ReleaseLock(token); } @@ -668,18 +658,16 @@ void PowerMgrService::Lock(const sptr& token, uint32_t timeOutMS) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.RUNNING_LOCK")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGI(MODULE_SERVICE, - "%{public}s :timeOutMS = %{public}d, name = %{public}s, type = %{public}d", - __func__, + POWER_HILOGI(FEATURE_RUNNING_LOCK, + "timeOutMS: %{public}d, name: %{public}s, type: %{public}d", timeOutMS, runningLockInfo.name.c_str(), runningLockInfo.type); @@ -692,23 +680,19 @@ void PowerMgrService::Lock(const sptr& token, void PowerMgrService::UnLock(const sptr& token) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.RUNNING_LOCK")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - - POWER_HILOGI(MODULE_SERVICE, "%{public}s called.", __func__); runningLockMgr_->UnLock(token); } void PowerMgrService::ForceUnLock(const sptr& token) { std::lock_guard lock(mutex_); - POWER_HILOGI(MODULE_SERVICE, "%{public}s called.", __func__); runningLockMgr_->UnLock(token); runningLockMgr_->ReleaseLock(token); } @@ -716,8 +700,9 @@ void PowerMgrService::ForceUnLock(const sptr& token) bool PowerMgrService::IsUsed(const sptr& token) { std::lock_guard lock(mutex_); - POWER_HILOGI(MODULE_SERVICE, "%{public}s called.", __func__); - return runningLockMgr_->IsUsed(token); + auto isUsed = runningLockMgr_->IsUsed(token); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "RunningLock is Used: %{public}d", isUsed); + return isUsed; } void PowerMgrService::NotifyRunningLockChanged(bool isUnLock) @@ -728,9 +713,7 @@ void PowerMgrService::NotifyRunningLockChanged(bool isUnLock) && !powerStateMachine_->IsScreenOn()) { // runninglock is empty and Screen is off, // so we try to suspend device from Z side. - POWER_HILOGI(MODULE_SERVICE, - "%{public}s :RunningLock is empty, try to suspend from Z Side!", - __func__); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RunningLock is empty, try to suspend"); powerStateMachine_->SuspendDeviceInner(getpid(), GetTickCount(), SuspendDeviceType::SUSPEND_DEVICE_REASON_MIN, true, true); } @@ -741,27 +724,24 @@ void PowerMgrService::SetWorkTriggerList(const sptr& token, const WorkTriggerList& workTriggerList) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.RUNNING_LOCK")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGI(MODULE_SERVICE, "%{public}s called.", __func__); runningLockMgr_->SetWorkTriggerList(token, workTriggerList); } void PowerMgrService::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) { std::lock_guard lock(mutex_); + auto calllingPid = IPCSkeleton::GetCallingPid(); auto calllingUid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, illegal calling uid %{public}d.", - __func__, + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Permission check fail, pid: %{public}d, uid: %{public}d", calllingPid, calllingUid); return; } @@ -771,12 +751,11 @@ void PowerMgrService::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) void PowerMgrService::RegisterPowerStateCallback(const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.POWER_MANAGER")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_POWER_STATE, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } powerStateMachine_->RegisterPowerStateCallback(callback); @@ -785,12 +764,11 @@ void PowerMgrService::RegisterPowerStateCallback(const sptr void PowerMgrService::UnRegisterPowerStateCallback(const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.POWER_MANAGER")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_POWER_STATE, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } powerStateMachine_->UnRegisterPowerStateCallback(callback); @@ -800,57 +778,66 @@ void PowerMgrService::RegisterShutdownCallback(IShutdownCallback::ShutdownPriori const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, "Register failed, %{public}d fail", uid); + POWER_HILOGE(FEATURE_SHUTDOWN, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGE(MODULE_SERVICE, "Register shutdown callback: %{public}d", uid); + POWER_HILOGI(FEATURE_SHUTDOWN, "pid: %{public}d, uid: %{public}d, priority: %{public}d, callback: %{public}p", + pid, uid, priority, callback.GetRefPtr()); shutdownService_.AddShutdownCallback(priority, callback); } void PowerMgrService::UnRegisterShutdownCallback(const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, "UnRegister failed, %{public}d fail", uid); + POWER_HILOGE(FEATURE_SHUTDOWN, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGE(MODULE_SERVICE, "UnRegister shutdown callback: %{public}d", uid); + POWER_HILOGI(FEATURE_SHUTDOWN, "pid: %{public}d, uid: %{public}d, callback: %{public}p", pid, uid, + callback.GetRefPtr()); shutdownService_.DelShutdownCallback(callback); } void PowerMgrService::RegisterPowerModeCallback(const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, "Register failed, %{public}d fail", uid); + POWER_HILOGE(FEATURE_POWER_MODE, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGE(MODULE_SERVICE, "Register power mode callback: %{public}d", uid); + POWER_HILOGI(FEATURE_POWER_MODE, "pid: %{public}d, uid: %{public}d, callback: %{public}p", pid, uid, + callback.GetRefPtr()); powerModeModule_.AddPowerModeCallback(callback); } void PowerMgrService::UnRegisterPowerModeCallback(const sptr& callback) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, "UnRegister failed, %{public}d fail", uid); + POWER_HILOGE(FEATURE_POWER_MODE, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } - POWER_HILOGE(MODULE_SERVICE, "UnRegister power mode callback: %{public}d", uid); + POWER_HILOGI(FEATURE_POWER_MODE, "pid: %{public}d, uid: %{public}d, callback: %{public}p", pid, uid, + callback.GetRefPtr()); powerModeModule_.DelPowerModeCallback(callback); } void PowerMgrService::SetDisplaySuspend(bool enable) { std::lock_guard lock(mutex_); + pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); if (!Permission::CheckIsSystemAppByUid(uid)) { - POWER_HILOGE(MODULE_SERVICE, "SetDisplaySuspend failed, %{public}d fail", uid); + POWER_HILOGE(FEATURE_SUSPEND, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } powerStateMachine_->SetDisplaySuspend(enable); @@ -861,12 +848,10 @@ void PowerMgrService::SetDeviceMode(const uint32_t& mode) std::lock_guard lock(mutex_); pid_t pid = IPCSkeleton::GetCallingPid(); auto uid = IPCSkeleton::GetCallingUid(); - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Call %{public}s !", pid, __func__); + POWER_HILOGI(FEATURE_POWER_MODE, "pid: %{public}d, uid: %{public}d, mode: %{public}u", pid, uid, mode); if (!Permission::CheckIsSystemAppByUid(uid) && !Permission::CheckCallingPermission("ohos.permission.POWER_OPTIMIZATION")) { - POWER_HILOGE(MODULE_SERVICE, - "%{public}s Request failed, %{public}d permission check fail", - __func__, uid); + POWER_HILOGE(FEATURE_POWER_MODE, "Permission check fail, pid: %{public}d, uid: %{public}d", pid, uid); return; } powerModeModule_.SetModeItem(mode); @@ -876,19 +861,22 @@ uint32_t PowerMgrService::GetDeviceMode() { std::lock_guard lock(mutex_); pid_t pid = IPCSkeleton::GetCallingPid(); - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Call %{public}s !", pid, __func__); - return powerModeModule_.GetModeItem(); + auto uid = IPCSkeleton::GetCallingUid(); + auto mode = powerModeModule_.GetModeItem(); + POWER_HILOGI(FEATURE_POWER_MODE, "pid: %{public}d, uid: %{public}d, mode: %{public}u", pid, uid, mode); + return mode; } std::string PowerMgrService::ShellDump(const std::vector& args, uint32_t argc) { std::lock_guard lock(mutex_); pid_t pid = IPCSkeleton::GetCallingPid(); - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Call %{public}s !", pid, __func__); + auto uid = IPCSkeleton::GetCallingUid(); + POWER_HILOGI(COMP_SVC, "pid: %{public}d, uid: %{public}d", pid, uid); std::string result; bool ret = PowerMgrDumper::Dump(args, result); - POWER_HILOGI(MODULE_SERVICE, "PowerMgrDumper :%{public}d", ret); + POWER_HILOGI(COMP_SVC, "ret :%{public}d", ret); return result; } @@ -898,15 +886,15 @@ void PowerMgrService::GetDisplayPosition( wideScreen = true; auto display = Rosen::DisplayManager::GetInstance().GetDefaultDisplay(); if (display == nullptr) { - POWER_HILOGI(MODULE_SERVICE, "dialog GetDefaultDisplay fail, try again."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Dialog GetDefaultDisplay fail, try again."); display = Rosen::DisplayManager::GetInstance().GetDefaultDisplay(); } if (display != nullptr) { - POWER_HILOGI(MODULE_SERVICE, "display size: %{public}d x %{public}d", + POWER_HILOGI(FEATURE_SHUTDOWN, "Display size: %{public}d x %{public}d", display->GetWidth(), display->GetHeight()); if (display->GetWidth() < display->GetHeight()) { - POWER_HILOGI(MODULE_SERVICE, "share dialog narrow."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Share dialog narrow."); const int NARROW_WIDTH_N = 3; const int NARROW_WIDTH_D = 4; const int NARROW_HEIGHT_RATE = 8; @@ -914,7 +902,7 @@ void PowerMgrService::GetDisplayPosition( width = display->GetWidth() * NARROW_WIDTH_N / NARROW_WIDTH_D; height = display->GetHeight() / NARROW_HEIGHT_RATE; } else { - POWER_HILOGI(MODULE_SERVICE, "share dialog wide."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Share dialog wide."); const int NARROW_WIDTH_N = 1; const int NARROW_WIDTH_D = 3; const int NARROW_HEIGHT_RATE = 6; @@ -925,15 +913,15 @@ void PowerMgrService::GetDisplayPosition( offsetX = (display->GetWidth() - width) / UI_HALF; offsetY = display->GetHeight() - height - UI_DEFAULT_BUTTOM_CLIP; } else { - POWER_HILOGI(MODULE_SERVICE, "dialog get display fail, use default wide."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Dialog get display fail, use default wide."); wideScreen = false; width = UI_DIALOG_POWER_WIDTH_NARROW; height = UI_DIALOG_POWER_HEIGHT_NARROW; offsetX = (UI_DEFAULT_WIDTH - width) / UI_HALF; offsetY = UI_DEFAULT_HEIGHT - height - UI_DEFAULT_BUTTOM_CLIP; } - POWER_HILOGI(MODULE_SERVICE, "GetDisplayPosition: %{public}d, %{public}d (%{public}d x %{public}d)", - offsetX, offsetY, width, height); + POWER_HILOGI(FEATURE_SHUTDOWN, "GetDisplayPosition: x: %{public}d, y: %{public}d,\ + width:%{public}d, height: %{public}d", offsetX, offsetY, width, height); } } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/power_mode_module.cpp b/services/native/src/power_mode_module.cpp index 695a0a6717e902eaa89caf8a57c1aec37138f3a6..bc80bbeff459fb23cf0d4984da5fe305222a1ca5 100644 --- a/services/native/src/power_mode_module.cpp +++ b/services/native/src/power_mode_module.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,14 +15,10 @@ #include "power_mode_module.h" -#include "hilog_wrapper.h" - #include "display_power_mgr_client.h" -#include "power_common.h" +#include "power_log.h" #include "power_mode_policy.h" #include "power_mgr_service.h" -#include "power_save_mode.h" -#include "power_state_machine.h" #include "singleton.h" @@ -37,7 +33,7 @@ namespace PowerMgr { PowerModeModule::PowerModeModule() : mode_(NORMAL_MODE), lastMode_(LAST_MODE_FLAG), started_(false) { - POWER_HILOGI(MODULE_SERVICE, "PowerModeModule create"); + POWER_HILOGI(FEATURE_POWER_MODE, "Instance create"); callbackMgr_ = new CallbackManager(); auto policy = DelayedSingleton::GetInstance(); policy->AddAction(PowerModePolicy::ServiceType::DISPLAY_OFFTIME, @@ -56,7 +52,7 @@ PowerModeModule::PowerModeModule() void PowerModeModule::SetModeItem(uint32_t mode) { - POWER_HILOGD(MODULE_SERVICE, "Set Mode Item : %{public}u", mode); + POWER_HILOGI(FEATURE_POWER_MODE, "mode_: %{public}u, mode: %{public}u", mode_, mode); /* Same as the previous mode */ if (this->mode_ == mode) { @@ -65,7 +61,7 @@ void PowerModeModule::SetModeItem(uint32_t mode) /* If it's a valid mode */ if (mode < POWER_MODE_MIN || mode > POWER_MODE_MAX) { - POWER_HILOGE(MODULE_SERVICE, "Unknow mode %{public}d", mode); + POWER_HILOGW(FEATURE_POWER_MODE, "Invalid mode %{public}d", mode); return; } @@ -75,7 +71,7 @@ void PowerModeModule::SetModeItem(uint32_t mode) uint32_t PowerModeModule::GetModeItem() { - POWER_HILOGD(MODULE_SERVICE, "Get Mode Item : %{public}u", mode_); + POWER_HILOGD(FEATURE_POWER_MODE, "mode_: %{public}u", mode_); /* get power mode */ return mode_; } @@ -83,7 +79,7 @@ uint32_t PowerModeModule::GetModeItem() void PowerModeModule::EnableMode(uint32_t mode) { if (started_) { - POWER_HILOGE(MODULE_SERVICE, "Power Mode is already running."); + POWER_HILOGW(FEATURE_POWER_MODE, "Power Mode is already running"); return; } @@ -140,7 +136,7 @@ void PowerModeModule::CallbackManager::AddCallback(const sptrAddDeathRecipient(this); } - POWER_HILOGI(MODULE_SERVICE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu," + POWER_HILOGD(FEATURE_POWER_MODE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu," " insertOk = %{public}d", object.GetRefPtr(), callback.GetRefPtr(), callbacks_.size(), retIt.second); } @@ -155,25 +151,25 @@ void PowerModeModule::CallbackManager::RemoveCallback(const sptrRemoveDeathRecipient(this); } - POWER_HILOGI(MODULE_SERVICE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu,", + POWER_HILOGD(FEATURE_POWER_MODE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu,", object.GetRefPtr(), callback.GetRefPtr(), callbacks_.size()); } void PowerModeModule::CallbackManager::OnRemoteDied(const wptr& remote) { - POWER_HILOGI(MODULE_SERVICE, "OnRemoteDied"); + POWER_HILOGW(FEATURE_POWER_MODE, "On remote died"); RETURN_IF(remote.promote() == nullptr); RemoveCallback(iface_cast(remote.promote())); } void PowerModeModule::CallbackManager::WaitingCallback() { - POWER_HILOGD(MODULE_SERVICE, "mode callback started."); + POWER_HILOGD(FEATURE_POWER_MODE, "Mode callback started"); unique_lock lock(mutex_); for (auto &obj : callbacks_) { sptr callback = iface_cast(obj); if (callback != nullptr) { - POWER_HILOGD(MODULE_SERVICE, "callback->PowerModeCallback()"); + POWER_HILOGD(FEATURE_POWER_MODE, "Call IPowerModeCallback: %{public}p", callback.GetRefPtr()); callback->PowerModeCallback(); } } @@ -181,7 +177,7 @@ void PowerModeModule::CallbackManager::WaitingCallback() void PowerModeModule::PublishPowerModeEvent() { - POWER_HILOGD(MODULE_SERVICE, "Start of publishing mode event"); + POWER_HILOGD(FEATURE_POWER_MODE, "Publish power mode module event"); /* send event */ CommonEventPublishInfo publishInfo; publishInfo.SetOrdered(false); @@ -205,19 +201,19 @@ void PowerModeModule::PublishPowerModeEvent() event.SetCode(PowerModeModule::LOWPOWER_MODE); break; default: - POWER_HILOGE(MODULE_SERVICE, "Unknow mode"); + POWER_HILOGW(FEATURE_POWER_MODE, "Unknown mode"); return; } if (!CommonEventManager::PublishCommonEvent(event, publishInfo, nullptr)) { - POWER_HILOGE(MODULE_SERVICE, "Failed to publish the mode event!"); + POWER_HILOGE(FEATURE_POWER_MODE, "Failed to publish the mode event"); return; } - POWER_HILOGD(MODULE_SERVICE, "End of publishing mode event"); + POWER_HILOGD(FEATURE_POWER_MODE, "Publish power mode module event end"); } void PowerModeModule::RunAction() { - POWER_HILOGI(MODULE_SERVICE, "PowerModeModule::RunAction"); + POWER_HILOGD(FEATURE_POWER_MODE, "Run action"); auto policy = DelayedSingleton::GetInstance(); policy->TriggerAllActions(); return; @@ -225,33 +221,32 @@ void PowerModeModule::RunAction() void PowerModeModule::SetDisplayOffTime() { - POWER_HILOGI(MODULE_SERVICE, "PowerModeModule::SetDisplayOffTime"); int32_t time = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::DISPLAY_OFFTIME); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { - POWER_HILOGI(MODULE_SERVICE, "No service instance"); + POWER_HILOGW(FEATURE_POWER_MODE, "No power service instance"); return; } + POWER_HILOGD(FEATURE_POWER_MODE, "Set display off timeout: %{public}d", time); pms->GetPowerStateMachine()->SetDisplayOffTime(static_cast(time)); } void PowerModeModule::SetSleepTime() { - POWER_HILOGI(MODULE_SERVICE, "PowerModeModule::SetSleepTime"); int32_t time = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::SLEEPTIME); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { - POWER_HILOGI(MODULE_SERVICE, "No service instance"); + POWER_HILOGW(FEATURE_POWER_MODE, "No power service instance"); return; } + POWER_HILOGD(FEATURE_POWER_MODE, "Set sleep timeout: %{public}d", time); pms->GetPowerStateMachine()->SetSleepTime(static_cast(time)); } void PowerModeModule::SetAutoAdjustBrightness() { - POWER_HILOGI(MODULE_SERVICE, "PowerModeModule::SetAutoAdjustBrightness"); bool enable = false; int32_t value = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::AUTO_ADJUST_BRIGHTNESS); @@ -259,44 +254,44 @@ void PowerModeModule::SetAutoAdjustBrightness() enable = true; } bool ret = DisplayPowerMgrClient::GetInstance().AutoAdjustBrightness(enable); - POWER_HILOGI(MODULE_SERVICE, "SetAutoAdjustBrightness: %{public}d, result=%{public}d", enable, ret); + POWER_HILOGI(FEATURE_POWER_MODE, "enable: %{public}d, ret: %{public}d", enable, ret); } void PowerModeModule::SetLcdBrightness() { - POWER_HILOGD(MODULE_SERVICE, "set lcd brightness"); int32_t lcdBrightness = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::SMART_BACKLIGHT); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeValuePolicy lcdBrightness=%{public}d", lcdBrightness); + POWER_HILOGD(FEATURE_POWER_MODE, "lcdBrightness: %{public}d", lcdBrightness); if (lcdBrightness != FLAG_FALSE) { // set lastmode value to recoverValue if (lastMode_ == LAST_MODE_FLAG) { - POWER_HILOGD(MODULE_SERVICE, "first set lcdBrightness=%{public}d", lcdBrightness); + POWER_HILOGD(FEATURE_POWER_MODE, "First set lcdBrightness: %{public}d", lcdBrightness); recoverValue[PowerModePolicy::ServiceType::SMART_BACKLIGHT] = lcdBrightness; } else { // get value from setting privider value - POWER_HILOGD(MODULE_SERVICE, "Setting lcdBrightness=%{public}d", SETTINGS_PRIVIDER_VALUE_LCD_BRIGHTNESS); + POWER_HILOGD(FEATURE_POWER_MODE, "Setting lcdBrightness=%{public}d", + SETTINGS_PRIVIDER_VALUE_LCD_BRIGHTNESS); recoverValue[PowerModePolicy::ServiceType::SMART_BACKLIGHT] = SETTINGS_PRIVIDER_VALUE_LCD_BRIGHTNESS; } // set lcd brightness int32_t dispId = DisplayPowerMgrClient::GetInstance().GetMainDisplayId(); bool ret = DisplayPowerMgrClient::GetInstance().SetBrightness(static_cast(lcdBrightness), dispId); - POWER_HILOGI(MODULE_SERVICE, "SetBrightness: %{public}d, result=%{public}d", lcdBrightness, ret); + POWER_HILOGI(FEATURE_POWER_MODE, "SetBrightness: %{public}d, result=%{public}d", lcdBrightness, ret); } else { lcdBrightness = DelayedSingleton::GetInstance() ->GetPowerModeRecoverPolicy(PowerModePolicy::ServiceType::SMART_BACKLIGHT); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeRecoverPolicy lcdBrightness=%{public}d", lcdBrightness); + POWER_HILOGD(FEATURE_POWER_MODE, "GetPowerModeRecoverPolicy lcdBrightness=%{public}d", lcdBrightness); if (lcdBrightness != FLAG_FALSE) { // get recoverValue std::lock_guard lock(mutex_); recoverValueiter = recoverValue.find(PowerModePolicy::ServiceType::SMART_BACKLIGHT); if (recoverValueiter != recoverValue.end()) { lcdBrightness = recoverValueiter->second; - POWER_HILOGD(MODULE_SERVICE, "Get recovervalue lcdBrightness=%{public}d", lcdBrightness); + POWER_HILOGD(FEATURE_POWER_MODE, "Get recovervalue lcdBrightness=%{public}d", lcdBrightness); // delete map recoverValue.erase(recoverValueiter); } - POWER_HILOGD(MODULE_SERVICE, "please set lcdBrightness"); + POWER_HILOGD(FEATURE_POWER_MODE, "Please set lcdBrightness"); } } return; @@ -304,37 +299,36 @@ void PowerModeModule::SetLcdBrightness() void PowerModeModule::SetVibration() { - POWER_HILOGD(MODULE_SERVICE, "set vibration"); int32_t vibration = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::VIBRATORS_STATE); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeValuePolicy vibrate=%{public}d", vibration); + POWER_HILOGD(FEATURE_POWER_MODE, "GetPowerModeValuePolicy vibrate=%{public}d", vibration); if (vibration != FLAG_FALSE) { // set lastmode value to recoverValue if (lastMode_ == LAST_MODE_FLAG) { - POWER_HILOGD(MODULE_SERVICE, "first set vibration=%{public}d", vibration); + POWER_HILOGD(FEATURE_POWER_MODE, "First set vibration=%{public}d", vibration); recoverValue[PowerModePolicy::ServiceType::VIBRATORS_STATE] = vibration; } else { // get value from setting privider value - POWER_HILOGD(MODULE_SERVICE, "Setting vibration=%{public}d", SETTINGS_PRIVIDER_VALUE_VIBRATION); + POWER_HILOGD(FEATURE_POWER_MODE, "Setting vibration=%{public}d", SETTINGS_PRIVIDER_VALUE_VIBRATION); recoverValue[PowerModePolicy::ServiceType::VIBRATORS_STATE] = SETTINGS_PRIVIDER_VALUE_VIBRATION; } // set vibration - POWER_HILOGD(MODULE_SERVICE, "please set vibration"); + POWER_HILOGD(FEATURE_POWER_MODE, "Please set vibration"); } else { vibration = DelayedSingleton::GetInstance() ->GetPowerModeRecoverPolicy(PowerModePolicy::ServiceType::VIBRATORS_STATE); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeRecoverPolicy vibration=%{public}d", vibration); + POWER_HILOGD(FEATURE_POWER_MODE, "GetPowerModeRecoverPolicy vibration=%{public}d", vibration); if (vibration != FLAG_FALSE) { // get recoverValue std::lock_guard lock(mutex_); recoverValueiter = recoverValue.find(PowerModePolicy::ServiceType::VIBRATORS_STATE); if (recoverValueiter != recoverValue.end()) { vibration = recoverValueiter->second; - POWER_HILOGD(MODULE_SERVICE, "Get recovervalue vibration=%{public}d", vibration); + POWER_HILOGD(FEATURE_POWER_MODE, "Get recovervalue vibration=%{public}d", vibration); // delete map recoverValue.erase(recoverValueiter); } - POWER_HILOGD(MODULE_SERVICE, "please set vibration"); + POWER_HILOGD(FEATURE_POWER_MODE, "Please set vibration"); } } return; @@ -342,37 +336,36 @@ void PowerModeModule::SetVibration() void PowerModeModule::OnOffRotation() { - POWER_HILOGD(MODULE_SERVICE, "on or off rotation"); int32_t rotation = DelayedSingleton::GetInstance() ->GetPowerModeValuePolicy(PowerModePolicy::ServiceType::AUTO_WINDOWN_RORATION); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeValuePolicy rotation=%{public}d", rotation); + POWER_HILOGD(FEATURE_POWER_MODE, "GetPowerModeValuePolicy rotation=%{public}d", rotation); if (rotation != FLAG_FALSE) { // set lastmode value to recoverValue if (lastMode_ == LAST_MODE_FLAG) { - POWER_HILOGD(MODULE_SERVICE, "first set rotation=%{public}d", rotation); + POWER_HILOGD(FEATURE_POWER_MODE, "First set rotation=%{public}d", rotation); recoverValue[PowerModePolicy::ServiceType::AUTO_WINDOWN_RORATION] = rotation; } else { // get value from setting privider value - POWER_HILOGD(MODULE_SERVICE, "Setting rotation=%{public}d", SETTINGS_PRIVIDER_VALUE_ROTATION); + POWER_HILOGD(FEATURE_POWER_MODE, "Setting rotation=%{public}d", SETTINGS_PRIVIDER_VALUE_ROTATION); recoverValue[PowerModePolicy::ServiceType::AUTO_WINDOWN_RORATION] = SETTINGS_PRIVIDER_VALUE_ROTATION; } // set lcd vibrate - POWER_HILOGD(MODULE_SERVICE, "please on or off rotation"); + POWER_HILOGD(FEATURE_POWER_MODE, "Please on or off rotation"); } else { rotation = DelayedSingleton::GetInstance() ->GetPowerModeRecoverPolicy(PowerModePolicy::ServiceType::AUTO_WINDOWN_RORATION); - POWER_HILOGD(MODULE_SERVICE, "GetPowerModeRecoverPolicy rotation=%{public}d", rotation); + POWER_HILOGD(FEATURE_POWER_MODE, "GetPowerModeRecoverPolicy rotation=%{public}d", rotation); if (rotation != FLAG_FALSE) { // get recoverValue std::lock_guard lock(mutex_); recoverValueiter = recoverValue.find(PowerModePolicy::ServiceType::VIBRATORS_STATE); if (recoverValueiter != recoverValue.end()) { rotation = recoverValueiter->second; - POWER_HILOGD(MODULE_SERVICE, "Get recovervalue rotation=%{public}d", rotation); + POWER_HILOGD(FEATURE_POWER_MODE, "Get recovervalue rotation=%{public}d", rotation); // delete map recoverValue.erase(recoverValueiter); } - POWER_HILOGD(MODULE_SERVICE, "please on or off rotation"); + POWER_HILOGD(FEATURE_POWER_MODE, "Please on or off rotation"); } } return; diff --git a/services/native/src/power_mode_policy.cpp b/services/native/src/power_mode_policy.cpp index c3029739c947b12af5de9d79b5a63f4cc562aa2b..86b6076f21dc05781ee55950ce26762cc76e8e14 100644 --- a/services/native/src/power_mode_policy.cpp +++ b/services/native/src/power_mode_policy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,9 +15,9 @@ #include "power_mode_policy.h" +#include "power_log.h" #include "power_save_mode.h" #include "singleton.h" -#include "hilog_wrapper.h" using namespace std; @@ -51,7 +51,7 @@ int32_t PowerModePolicy::GetRecoverPolicyFromMap(uint32_t type) recoveriter = recoverModePolicy.find(type); if (recoveriter != recoverModePolicy.end()) { ret = recoveriter->second; - POWER_HILOGD(MODULE_SERVICE, "recover value=%{public}d", ret); + POWER_HILOGD(FEATURE_POWER_MODE, "Recover value: %{public}d", ret); } return ret; } @@ -68,7 +68,7 @@ int32_t PowerModePolicy::GetPowerModeRecoverPolicy(uint32_t type) void PowerModePolicy::SetPowerModePolicy(uint32_t mode, uint32_t lastMode) { - POWER_HILOGD(MODULE_SERVICE, "mode=%{public}d, lastMode=%{public}d", mode, lastMode); + POWER_HILOGD(FEATURE_POWER_MODE, "mode=%{public}d, lastMode=%{public}d", mode, lastMode); if (lastMode != LAST_MODE_FLAG) { ReadRecoverPolicy(lastMode); } @@ -99,7 +99,7 @@ void PowerModePolicy::CompareModeItem(uint32_t mode, uint32_t lastMode) for (recoverlit = recoverPolicy.begin(); recoverlit != recoverPolicy.end(); recoverlit++) { recoverModePolicy[(*recoverlit).id] = (*recoverlit).value; - POWER_HILOGD(MODULE_SERVICE, + POWER_HILOGD(FEATURE_POWER_MODE, "(*recoverlit).id=%{public}d, (*recoverlit).value=%{public}d", (*recoverlit).id, (*recoverlit).value); } @@ -109,7 +109,7 @@ void PowerModePolicy::CompareModeItem(uint32_t mode, uint32_t lastMode) void PowerModePolicy::AddAction(uint32_t type, std::function action) { - POWER_HILOGW(MODULE_SERVICE, "AddAction: type=(%{public}d)", type); + POWER_HILOGD(FEATURE_POWER_MODE, "type=%{public}d", type); actionMap.emplace(type, action); } @@ -117,18 +117,17 @@ void PowerModePolicy::TriggerAction(uint32_t type) { auto iterator = actionMap.find(type); if (iterator == actionMap.end()) { - POWER_HILOGW(MODULE_SERVICE, "TriggerAction: no such type=(%{public}d)", type); + POWER_HILOGD(FEATURE_POWER_MODE, "No such type=(%{public}d)", type); return; } - POWER_HILOGW(MODULE_SERVICE, "TriggerAction: type=(%{public}d)", type); + POWER_HILOGI(FEATURE_POWER_MODE, "type=%{public}d", type); iterator->second(); } void PowerModePolicy::TriggerAllActions() { - POWER_HILOGW(MODULE_SERVICE, "TriggerAllActions start"); for (auto iterator = actionMap.begin(); iterator != actionMap.end(); iterator++) { - POWER_HILOGW(MODULE_SERVICE, "TriggerAllActions: type=(%{public}d)", iterator->first); + POWER_HILOGD(FEATURE_POWER_MODE, "type=%{public}d", iterator->first); iterator->second(); } } @@ -137,11 +136,9 @@ bool PowerModePolicy::IsValidType(uint32_t type) { auto iterator = actionMap.find(type); if (iterator == actionMap.end()) { - POWER_HILOGW(MODULE_SERVICE, "IsValidType: false (%{public}d)", type); + POWER_HILOGW(FEATURE_POWER_MODE, "Invalid type: %{public}d", type); return false; } - - POWER_HILOGW(MODULE_SERVICE, "IsValidType: true (%{public}d)", type); return true; } } // namespace PowerMgr diff --git a/services/native/src/power_save_mode.cpp b/services/native/src/power_save_mode.cpp index e61794a4275945001507e8137674b68f1d64d681..52da826b7990032ff55bb9671370ac83b905be0a 100644 --- a/services/native/src/power_save_mode.cpp +++ b/services/native/src/power_save_mode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,11 +14,10 @@ */ #include "power_save_mode.h" + #include "libxml/parser.h" #include "libxml/tree.h" -#include "hilog_wrapper.h" - -#include +#include "power_log.h" namespace OHOS { namespace PowerMgr { @@ -31,9 +30,9 @@ constexpr uint32_t SLEEP_FILTER = SLEEP_FILTER_VALUE; PowerSaveMode::PowerSaveMode() { - POWER_HILOGD(MODULE_SERVICE, "Start to parse power_mode_config.xml"); + POWER_HILOGD(FEATURE_POWER_MODE, "Start to parse power_mode_config.xml"); if (!StartXMlParse(VENDOR_CONFIG)) { - POWER_HILOGI(MODULE_SERVICE, "No vendor power_mode_config.xml, start to parse system config"); + POWER_HILOGI(FEATURE_POWER_MODE, "No vendor power_mode_config.xml, start to parse system config"); StartXMlParse(SYSTEM_CONFIG); } } @@ -49,18 +48,19 @@ bool PowerSaveMode::StartXMlParse(std::string path) std::unique_ptr docPtr( xmlReadFile(path.c_str(), nullptr, XML_PARSE_NOBLANKS), xmlFreeDoc); if (docPtr == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "Parse failed, read file failed."); + POWER_HILOGE(FEATURE_POWER_MODE, "Parse failed, read file failed."); return false; } auto rootPtr = xmlDocGetRootElement(docPtr.get()); if (!IsNodeLegal(rootPtr, TAG_ROOT)) { - POWER_HILOGE(MODULE_SERVICE, "Parse failed, root node is illegal."); + POWER_HILOGE(FEATURE_POWER_MODE, "Parse failed, root node is illegal."); return false; } for (auto nodePtr = rootPtr->xmlChildrenNode; nodePtr != nullptr; nodePtr = nodePtr->next) { int32_t policyId = atoi((char *)xmlGetProp(nodePtr, BAD_CAST("id"))); + POWER_HILOGD(FEATURE_POWER_MODE, "policyId: %{public}d.", policyId); std::list listPolicy; for (auto policyNodePtr = nodePtr->xmlChildrenNode; policyNodePtr != nullptr; policyNodePtr = policyNodePtr->next) { @@ -69,13 +69,11 @@ bool PowerSaveMode::StartXMlParse(std::string path) pmp.recover_flag = atoi((char *)xmlGetProp(policyNodePtr, BAD_CAST("recover_flag"))); pmp.value = atoi((char *)xmlGetProp(policyNodePtr, BAD_CAST("value"))); listPolicy.push_back(pmp); - POWER_HILOGE(MODULE_SERVICE, "id=%{public}d", pmp.id); - POWER_HILOGE(MODULE_SERVICE, "value=%{public}d", pmp.value); - POWER_HILOGE(MODULE_SERVICE, "recover_flag=%{public}d", pmp.recover_flag); + POWER_HILOGD(FEATURE_POWER_MODE, "id=%{public}d, value=%{public}d, recover_flag=%{public}d", pmp.id, + pmp.value, pmp.recover_flag); } std::pair> policyPair(policyId, listPolicy); this->policyCache_.insert(policyPair); - POWER_HILOGI(MODULE_SERVICE, "policyId = %{public}d.", policyId); } return true; } diff --git a/services/native/src/power_state_machine.cpp b/services/native/src/power_state_machine.cpp index 6466a39c108e625c22bfc2270fe88d2a452168bf..74da5606ea32605e042303582bc9752efc0e4dac 100644 --- a/services/native/src/power_state_machine.cpp +++ b/services/native/src/power_state_machine.cpp @@ -15,17 +15,10 @@ #include "power_state_machine.h" -#include - #include -#include #include -#include -#include -#include #include "powerms_event_handler.h" -#include "power_mgr_client.h" #include "power_mgr_factory.h" #include "power_mgr_service.h" @@ -34,7 +27,7 @@ namespace PowerMgr { PowerStateMachine::PowerStateMachine(const wptr& pms) : pms_(pms), currentState_(PowerState::UNKNOWN) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine_currentState: func is Start."); + POWER_HILOGD(FEATURE_POWER_STATE, "Instance start"); // NOTICE Need get screen state when device startup, // rightnow we set screen is on as default mDeviceState_.screenState.lastOnTime = GetTickCount(); @@ -60,14 +53,14 @@ PowerStateMachine::PowerStateMachine(const wptr& pms) lockMap_.emplace(PowerState::SLEEP, std::make_shared>(sleepBlocker)); - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine_currentState: func is End."); + POWER_HILOGD(FEATURE_POWER_STATE, "Instance end"); } PowerStateMachine::~PowerStateMachine() {} bool PowerStateMachine::Init() { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine:: Init start"); + POWER_HILOGD(FEATURE_POWER_STATE, "Start init"); stateAction_ = PowerMgrFactory::GetDeviceStateAction(); std::function callback = std::bind(&PowerStateMachine::ActionCallback, @@ -80,7 +73,7 @@ bool PowerStateMachine::Init() } if (!powerMgrMonitor_.Start()) { - POWER_HILOGE(MODULE_SERVICE, "Failed to start monitor"); + POWER_HILOGE(FEATURE_POWER_STATE, "Failed to start monitor"); return false; } @@ -89,7 +82,7 @@ bool PowerStateMachine::Init() } else { SetState(PowerState::INACTIVE, StateChangeReason::STATE_CHANGE_REASON_INIT, true); } - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine:: Init success!"); + POWER_HILOGD(FEATURE_POWER_STATE, "Init success"); return true; } @@ -98,12 +91,13 @@ void PowerStateMachine::EmplaceAwake() controllerMap_.emplace(PowerState::AWAKE, std::make_shared(PowerState::AWAKE, shared_from_this(), [this](StateChangeReason reason) { + POWER_HILOGI(FEATURE_POWER_STATE, "StateController_AWAKE lambda start"); mDeviceState_.screenState.lastOnTime = GetTickCount(); uint32_t ret = this->stateAction_->SetDisplayState(DisplayState::DISPLAY_ON, reason); // Display power service maybe not ready when init if (ret != ActionResult::SUCCESS && reason != StateChangeReason::STATE_CHANGE_REASON_INIT) { - POWER_HILOGE(MODULE_SERVICE, "Failed to go to AWAKE, Display Err"); + POWER_HILOGE(FEATURE_POWER_STATE, "Failed to go to AWAKE, display error, ret: %{public}u", ret); return TransitResult::DISPLAY_ON_ERR; } ResetInactiveTimer(); @@ -116,18 +110,18 @@ void PowerStateMachine::EmplaceInactive() controllerMap_.emplace(PowerState::INACTIVE, std::make_shared(PowerState::INACTIVE, shared_from_this(), [this](StateChangeReason reason) { - POWER_HILOGI(MODULE_SERVICE, "StateController_INACTIVE: func is Start."); + POWER_HILOGI(FEATURE_POWER_STATE, "StateController_INACTIVE lambda start"); mDeviceState_.screenState.lastOffTime = GetTickCount(); DisplayState state = DisplayState::DISPLAY_OFF; if (enableDisplaySuspend_) { - POWER_HILOGI(MODULE_SERVICE, "display suspend enabled"); + POWER_HILOGI(FEATURE_POWER_STATE, "Display suspend enabled"); state = DisplayState::DISPLAY_SUSPEND; } uint32_t ret = this->stateAction_->SetDisplayState(state, reason); // Display power service maybe not ready when init if (ret != ActionResult::SUCCESS && reason != StateChangeReason::STATE_CHANGE_REASON_INIT) { - POWER_HILOGE(MODULE_SERVICE, "Failed to go to INACTIVE, Display Err"); + POWER_HILOGE(FEATURE_POWER_STATE, "Failed to go to INACTIVE, display error, ret: %{public}u", ret); return TransitResult::DISPLAY_OFF_ERR; } ResetSleepTimer(); @@ -140,14 +134,15 @@ void PowerStateMachine::EmplaceSleep() controllerMap_.emplace(PowerState::SLEEP, std::make_shared(PowerState::SLEEP, shared_from_this(), [this](StateChangeReason reason) { + POWER_HILOGI(FEATURE_POWER_STATE, "StateController_SLEEP lambda start"); DisplayState state = DisplayState::DISPLAY_OFF; if (enableDisplaySuspend_) { - POWER_HILOGI(MODULE_SERVICE, "display suspend enabled"); + POWER_HILOGI(FEATURE_POWER_STATE, "Display suspend enabled"); state = DisplayState::DISPLAY_SUSPEND; } uint32_t ret = this->stateAction_->GoToSleep(onSuspend, onWakeup, false); if (ret != ActionResult::SUCCESS) { - POWER_HILOGE(MODULE_SERVICE, "Failed to go to SLEEP, Sleep Err"); + POWER_HILOGE(FEATURE_POWER_STATE, "Failed to go to SLEEP, sleep error, ret: %{public}u", ret); return TransitResult::HDI_ERR; } return TransitResult::SUCCESS; @@ -172,19 +167,19 @@ void PowerStateMachine::ActionCallback(uint32_t event) void PowerStateMachine::onSuspend() { - POWER_HILOGI(MODULE_SERVICE, "System is suspending"); + POWER_HILOGI(FEATURE_SUSPEND, "System is suspending"); } void PowerStateMachine::onWakeup() { - POWER_HILOGI(MODULE_SERVICE, "System is awake"); + POWER_HILOGI(FEATURE_WAKEUP, "System is awaking"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; } auto handler = pms->GetHandler(); if (handler == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "SetDelayTimer handler is null"); + POWER_HILOGE(FEATURE_WAKEUP, "Handler is null"); return; } handler->SendEvent(PowermsEventHandler::SYSTEM_WAKE_UP_MSG, 0, 0); @@ -196,9 +191,8 @@ void PowerStateMachine::SuspendDeviceInner(pid_t pid, bool suspendImmed, bool ignoreScreenState) { - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Try to Suspend Device!!", pid); if (type > SuspendDeviceType::SUSPEND_DEVICE_REASON_MAX) { - POWER_HILOGE(MODULE_SERVICE, "Invalid type: %{public}d", type); + POWER_HILOGW(FEATURE_SUSPEND, "Invalid type: %{public}d", type); return; } // Check the screen state @@ -208,13 +202,13 @@ void PowerStateMachine::SuspendDeviceInner(pid_t pid, SUSPEND_DEVICE_IMMEDIATELY : SUSPEND_DEVICE_NEED_DOZE); } mDeviceState_.lastSuspendDeviceTime = callTimeMs; - POWER_HILOGD(MODULE_SERVICE, "Suspend Device Call Binder Success!!"); + POWER_HILOGD(FEATURE_SUSPEND, "Suspend device success"); } else { - POWER_HILOGE(MODULE_SERVICE, "Suspend Device Failed, Screen State is ignored!"); + POWER_HILOGD(FEATURE_SUSPEND, "Do not suspend device, screen state is ignored"); } SetState(PowerState::INACTIVE, GetReasionBySuspendType(type), true); - POWER_HILOGI(MODULE_SERVICE, "SuspendDeviceInner: fun is End!"); + POWER_HILOGD(FEATURE_SUSPEND, "Suspend device finish"); } void PowerStateMachine::WakeupDeviceInner(pid_t pid, @@ -223,9 +217,8 @@ void PowerStateMachine::WakeupDeviceInner(pid_t pid, const std::string& details, const std::string& pkgName) { - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Try to Wakeup Device!!", pid); if (type > WakeupDeviceType::WAKEUP_DEVICE_MAX) { - POWER_HILOGE(MODULE_SERVICE, "Invalid type: %{public}d", type); + POWER_HILOGW(FEATURE_WAKEUP, "Invalid type: %{public}d", type); return; } // Call legacy wakeup, Check the screen state @@ -237,7 +230,7 @@ void PowerStateMachine::WakeupDeviceInner(pid_t pid, ResetInactiveTimer(); SetState(PowerState::AWAKE, GetReasonByWakeType(type), true); - POWER_HILOGD(MODULE_SERVICE, "Wakeup Device Call"); + POWER_HILOGD(FEATURE_WAKEUP, "Wakeup device finish"); } void PowerStateMachine::RefreshActivityInner(pid_t pid, @@ -245,15 +238,14 @@ void PowerStateMachine::RefreshActivityInner(pid_t pid, UserActivityType type, bool needChangeBacklight) { - POWER_HILOGI(MODULE_SERVICE, "PID: %{public}d Start to RefreshActivity!!", pid); if (type > UserActivityType::USER_ACTIVITY_TYPE_MAX) { - POWER_HILOGE(MODULE_SERVICE, "Invalid type: %{public}d", type); + POWER_HILOGW(FEATURE_ACTIVITY, "Invalid type: %{public}d", type); return; } // The minimum refreshactivity interval is 100ms!! int64_t now = GetTickCount(); if ((mDeviceState_.lastRefreshActivityTime + MIN_TIME_MS_BETWEEN_USERACTIVITIES) > now) { - POWER_HILOGW(MODULE_SERVICE, "RefreshActivity Failed, refresh too fast!"); + POWER_HILOGD(FEATURE_ACTIVITY, "Refresh activity too fast"); return; } mDeviceState_.lastRefreshActivityTime = now; @@ -267,22 +259,20 @@ void PowerStateMachine::RefreshActivityInner(pid_t pid, } // reset timer ResetInactiveTimer(); - POWER_HILOGD(MODULE_SERVICE, "Refresh Activity Call Binder Success!!"); + POWER_HILOGD(FEATURE_ACTIVITY, "Refresh activity success"); } else { - POWER_HILOGE(MODULE_SERVICE, "RefreshActivity Failed, Screen is Off!"); + POWER_HILOGE(FEATURE_ACTIVITY, "Ignore refresh activity, screen is off"); } - POWER_HILOGI(MODULE_SERVICE, "RefreshActivityInner: fun is End!"); } bool PowerStateMachine::ForceSuspendDeviceInner(pid_t pid, int64_t callTimeMs) { - POWER_HILOGI(MODULE_SERVICE, "ForceSuspendDeviceInner: fun is Start!"); if (stateAction_ != nullptr) { currentState_ = PowerState::SLEEP; stateAction_->GoToSleep(onSuspend, onWakeup, true); } - POWER_HILOGI(MODULE_SERVICE, "ForceSuspendDeviceInner: fun is End!"); + POWER_HILOGI(FEATURE_SUSPEND, "Force suspend finish"); return true; } @@ -291,16 +281,16 @@ bool PowerStateMachine::IsScreenOn() DisplayState state = stateAction_->GetDisplayState(); if (state == DisplayState::DISPLAY_ON || state == DisplayState::DISPLAY_DIM) { - POWER_HILOGI(MODULE_SERVICE, "Current Screen State: On!"); + POWER_HILOGD(FEATURE_POWER_STATE, "Current screen is on, state: %{public}u", state); return true; } - POWER_HILOGI(MODULE_SERVICE, "Current Screen State: Off!"); + POWER_HILOGD(FEATURE_POWER_STATE, "Current screen is off, state: %{public}u", state); return false; } void PowerStateMachine::ReceiveScreenEvent(bool isScreenOn) { - POWER_HILOGI(MODULE_SERVICE, "ReceiveScreenEvent: fun is Start!"); + POWER_HILOGD(FEATURE_POWER_STATE, "Enter"); std::lock_guard lock(mutex_); auto prestate = mDeviceState_.screenState.state; if (isScreenOn) { @@ -315,7 +305,6 @@ void PowerStateMachine::ReceiveScreenEvent(bool isScreenOn) void PowerStateMachine::RegisterPowerStateCallback(const sptr& callback) { - POWER_HILOGI(MODULE_SERVICE, "RegisterPowerStateCallback: fun is Start!"); std::lock_guard lock(mutex_); RETURN_IF(callback == nullptr); auto object = callback->AsObject(); @@ -324,10 +313,8 @@ void PowerStateMachine::RegisterPowerStateCallback(const sptrAddDeathRecipient(powerStateCBDeathRecipient_); } - POWER_HILOGI(MODULE_SERVICE, - "%{public}s, object = %{public}p, callback = %{public}p, listeners.size = %{public}d," - " insertOk = %{public}d", - __func__, + POWER_HILOGD(FEATURE_POWER_STATE, + "object = %{public}p, callback = %{public}p, listeners.size = %{public}d, insertOk = %{public}d", object.GetRefPtr(), callback.GetRefPtr(), static_cast(powerStateListeners_.size()), @@ -336,7 +323,6 @@ void PowerStateMachine::RegisterPowerStateCallback(const sptr& callback) { - POWER_HILOGI(MODULE_SERVICE, "UnRegisterPowerStateCallback: fun is Start!"); std::lock_guard lock(mutex_); RETURN_IF(callback == nullptr); auto object = callback->AsObject(); @@ -345,10 +331,8 @@ void PowerStateMachine::UnRegisterPowerStateCallback(const sptrRemoveDeathRecipient(powerStateCBDeathRecipient_); } - POWER_HILOGI(MODULE_SERVICE, - "%{public}s, object = %{public}p, callback = %{public}p, listeners.size = %{public}d," - " eraseNum = %zu", - __func__, + POWER_HILOGD(FEATURE_POWER_STATE, + "object = %{public}p, callback = %{public}p, listeners.size = %{public}d, eraseNum = %{public}zu", object.GetRefPtr(), callback.GetRefPtr(), static_cast(powerStateListeners_.size()), @@ -445,7 +429,6 @@ static const std::string GetRunningLockTypeString(RunningLockType type) void PowerStateMachine::EnableMock(IDeviceStateAction* mockAction) { - POWER_HILOGI(MODULE_SERVICE, "enableMock: fun is Start!"); std::lock_guard lock(mutex_); // reset to awake state when mock and default off/sleep time currentState_ = PowerState::AWAKE; @@ -460,11 +443,8 @@ void PowerStateMachine::EnableMock(IDeviceStateAction* mockAction) void PowerStateMachine::NotifyPowerStateChanged(PowerState state) { - POWER_HILOGI(MODULE_SERVICE, - "%{public}s state = %u, listeners.size = %{public}d", - __func__, - static_cast(state), - static_cast(powerStateListeners_.size())); + POWER_HILOGI(FEATURE_POWER_STATE, "state = %{public}u, listeners.size = %{public}zu", + state, powerStateListeners_.size()); std::lock_guard lock(mutex_); int64_t now = GetTickCount(); // Send Notification event @@ -478,15 +458,14 @@ void PowerStateMachine::NotifyPowerStateChanged(PowerState state) void PowerStateMachine::SendEventToPowerMgrNotify(PowerState state, int64_t callTime) { - POWER_HILOGD(MODULE_SERVICE, "SendEventToPowerMgrNotify: fun is Start!"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "SendEventToPowerMgrNotify pms is Null, Fail!!"); + POWER_HILOGE(FEATURE_POWER_STATE, "Pms is nullptr"); return; } auto notify = pms->GetPowerMgrNotify(); if (notify == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "SendEventToPowerMgrNotify notify is Null, Fail!!"); + POWER_HILOGE(FEATURE_POWER_STATE, "Notify is null"); return; } if (state == PowerState::AWAKE) { @@ -494,9 +473,8 @@ void PowerStateMachine::SendEventToPowerMgrNotify(PowerState state, int64_t call } else if (state == PowerState::INACTIVE) { notify->PublishScreenOffEvents(callTime); } else { - POWER_HILOGI(MODULE_SERVICE, "No need to publish event, state:%{public}d", state); + POWER_HILOGI(FEATURE_POWER_STATE, "No need to publish event, state:%{public}u", state); } - POWER_HILOGD(MODULE_SERVICE, "SendEventToPowerMgrNotify: fun is End!"); } const std::string TASK_UNREG_POWER_STATE_CALLBACK = "PowerState_UnRegPowerStateCB"; @@ -504,67 +482,66 @@ const std::string TASK_UNREG_POWER_STATE_CALLBACK = "PowerState_UnRegPowerStateC void PowerStateMachine::PowerStateCallbackDeathRecipient::OnRemoteDied( const wptr& remote) { - POWER_HILOGD(MODULE_SERVICE, "OnRemoteDied: fun is Start!"); if (remote == nullptr || remote.promote() == nullptr) { return; } - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine::%{public}s remote = %p", __func__, - remote.promote().GetRefPtr()); + POWER_HILOGI(FEATURE_POWER_STATE, "remote = %{public}p", remote.promote().GetRefPtr()); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGE(FEATURE_POWER_STATE, "Pms is nullptr"); return; } auto handler = pms->GetHandler(); if (handler == nullptr) { + POWER_HILOGE(FEATURE_POWER_STATE, "Handler is nullptr"); return; } sptr callback = iface_cast(remote.promote()); std::function unRegFunc = std::bind(&PowerMgrService::UnRegisterPowerStateCallback, pms, callback); handler->PostTask(unRegFunc, TASK_UNREG_POWER_STATE_CALLBACK); - POWER_HILOGD(MODULE_SERVICE, "OnRemoteDied: fun is End!"); } void PowerStateMachine::SetDelayTimer(int64_t delayTime, int32_t event) { - POWER_HILOGD(MODULE_SERVICE, "SetDelayTimer: fun is Start!"); + POWER_HILOGD(FEATURE_ACTIVITY, "Set delay timer, delayTime: %{public}s, event: %{public}d", + std::to_string(delayTime).c_str(), event); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGE(FEATURE_ACTIVITY, "Pms is nullptr"); return; } auto handler = pms->GetHandler(); if (handler == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "SetDelayTimer handler is null"); + POWER_HILOGE(FEATURE_ACTIVITY, "Handler is nullptr"); return; } handler->SendEvent(event, 0, delayTime); - POWER_HILOGD(MODULE_SERVICE, "SetDelayTimer: fun is End!"); } void PowerStateMachine::CancelDelayTimer(int32_t event) { - POWER_HILOGD(MODULE_SERVICE, "CancelDelayTimer (%{public}d): fun is Start!", event); + POWER_HILOGD(FEATURE_ACTIVITY, "Cancel delay timer, event: %{public}d", event); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGE(FEATURE_ACTIVITY, "Pms is nullptr"); return; } auto handler = pms->GetHandler(); if (handler == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "CancelDelayTimer handler is null"); + POWER_HILOGE(FEATURE_ACTIVITY, "Handler is nullptr"); return; } handler->RemoveEvent(event); - POWER_HILOGD(MODULE_SERVICE, "CancelDelayTimer: fun is End!"); } void PowerStateMachine::ResetInactiveTimer() { - POWER_HILOGD(MODULE_SERVICE, "ResetInactiveTimer: fun is Start!"); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_OFF_TIMEOUT_MSG); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); if (this->GetDisplayOffTime() < 0) { - POWER_HILOGI(MODULE_SERVICE, "Display Auto OFF is disabled"); + POWER_HILOGD(FEATURE_ACTIVITY, "Auto display off is disabled"); return; } @@ -574,17 +551,15 @@ void PowerStateMachine::ResetInactiveTimer() this->SetDelayTimer(this->GetDisplayOffTime() * TWO / THREE, PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG); } - POWER_HILOGD(MODULE_SERVICE, "ResetInactiveTimer: fun is End!"); } void PowerStateMachine::ResetSleepTimer() { - POWER_HILOGD(MODULE_SERVICE, "ResetSleepTimer: fun is Start!"); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_OFF_TIMEOUT_MSG); CancelDelayTimer(PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); if (this->GetSleepTime() < 0) { - POWER_HILOGI(MODULE_SERVICE, "Auto Sleep is disabled"); + POWER_HILOGD(FEATURE_ACTIVITY, "Auto sleep is disabled"); return; } @@ -592,12 +567,11 @@ void PowerStateMachine::ResetSleepTimer() this->SetDelayTimer(this->GetSleepTime(), PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); } - POWER_HILOGD(MODULE_SERVICE, "ResetSleepTimer: fun is End!"); } void PowerStateMachine::HandleDelayTimer(int32_t event) { - POWER_HILOGD(MODULE_SERVICE, "handle delay timer: (%{public}d)", event); + POWER_HILOGD(FEATURE_ACTIVITY, "Enter, event = %{public}d", event); switch (event) { case PowermsEventHandler::CHECK_USER_ACTIVITY_TIMEOUT_MSG: HandleActivityTimeout(); @@ -614,42 +588,37 @@ void PowerStateMachine::HandleDelayTimer(int32_t event) default: break; } - POWER_HILOGD(MODULE_SERVICE, "ResetSleepTimer: fun is End!"); } void PowerStateMachine::HandleActivityTimeout() { - POWER_HILOGI(MODULE_SERVICE, "HandleActivityTimeout (%{public}d)", - stateAction_->GetDisplayState()); + POWER_HILOGD(FEATURE_ACTIVITY, "Enter, displayState = %{public}d", stateAction_->GetDisplayState()); DisplayState dispState = stateAction_->GetDisplayState(); const uint32_t THREE = 3; if (!this->CheckRunningLock(PowerState::INACTIVE)) { - POWER_HILOGW(MODULE_SERVICE, "RunningLock is blocking to transit to INACTIVE"); + POWER_HILOGI(FEATURE_ACTIVITY, "RunningLock is blocking to transit to INACTIVE"); return; } if (dispState == DisplayState::DISPLAY_ON) { stateAction_->SetDisplayState(DisplayState::DISPLAY_DIM, StateChangeReason::STATE_CHANGE_REASON_TIMEOUT); if (this->GetDisplayOffTime() < 0) { - POWER_HILOGI(MODULE_SERVICE, "Display Auto OFF is disabled"); + POWER_HILOGD(FEATURE_ACTIVITY, "Auto display off is disabled"); return; } else { SetDelayTimer(GetDisplayOffTime() / THREE, PowermsEventHandler::CHECK_USER_ACTIVITY_OFF_TIMEOUT_MSG); } } else { - POWER_HILOGW(MODULE_SERVICE, - "HandleActivityTimeout when display: %{public}d", dispState); + POWER_HILOGW(FEATURE_ACTIVITY, "Display is not on, ignore activity timeout, state = %{public}d", dispState); } - POWER_HILOGI(MODULE_SERVICE, "HandleActivityTimeout: fun is End!"); } void PowerStateMachine::HandleActivityOffTimeout() { - POWER_HILOGI(MODULE_SERVICE, "HandleActivityOffTimeout (%{public}d)", - stateAction_->GetDisplayState()); + POWER_HILOGD(FEATURE_ACTIVITY, "Enter, displayState = %{public}d", stateAction_->GetDisplayState()); if (!this->CheckRunningLock(PowerState::INACTIVE)) { - POWER_HILOGW(MODULE_SERVICE, "RunningLock is blocking to transit to INACTIVE"); + POWER_HILOGI(FEATURE_POWER_STATE, "RunningLock is blocking to transit to INACTIVE"); return; } DisplayState dispState = stateAction_->GetDisplayState(); @@ -658,34 +627,28 @@ void PowerStateMachine::HandleActivityOffTimeout() || dispState == DisplayState::DISPLAY_DIM) { SetState(PowerState::INACTIVE, StateChangeReason::STATE_CHANGE_REASON_TIMEOUT); } else { - POWER_HILOGW(MODULE_SERVICE, - "HandleActivityOffTimeout when display: %{public}d", dispState); + POWER_HILOGW(FEATURE_ACTIVITY, "Display is off, ignore activity off timeout, state = %{public}d", dispState); } - POWER_HILOGI(MODULE_SERVICE, "HandleActivityOffTimeOut: fun is End!"); } void PowerStateMachine::HandleActivitySleepTimeout() { - POWER_HILOGI(MODULE_SERVICE, "HandleActivitySleepTimeout (%{public}d)", - stateAction_->GetDisplayState()); + POWER_HILOGD(FEATURE_ACTIVITY, "Enter, displayState = %{public}d", stateAction_->GetDisplayState()); if (!this->CheckRunningLock(PowerState::SLEEP)) { - POWER_HILOGW(MODULE_SERVICE, "RunningLock is blocking to transit to SLEEP"); + POWER_HILOGW(FEATURE_POWER_STATE, "RunningLock is blocking to transit to SLEEP"); return; } DisplayState dispState = stateAction_->GetDisplayState(); if (dispState == DisplayState::DISPLAY_OFF) { SetState(PowerState::SLEEP, StateChangeReason::STATE_CHANGE_REASON_TIMEOUT); } else { - POWER_HILOGW(MODULE_SERVICE, - "HandleActivitySleepTimeout when display: %{public}d", dispState); + POWER_HILOGW(FEATURE_ACTIVITY, "Display is on, ignore activity sleep timeout, state = %{public}d", dispState); } - POWER_HILOGI(MODULE_SERVICE, "HandleActivitySleepTimeout: fun is End!"); } void PowerStateMachine::HandleSystemWakeup() { - POWER_HILOGI(MODULE_SERVICE, "HandleSystemWakeup (%{public}d)", - stateAction_->GetDisplayState()); + POWER_HILOGD(FEATURE_WAKEUP, "Enter, displayState = %{public}d", stateAction_->GetDisplayState()); if (IsScreenOn()) { SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_SYSTEM, true); } else { @@ -695,21 +658,21 @@ void PowerStateMachine::HandleSystemWakeup() bool PowerStateMachine::CheckRunningLock(PowerState state) { - POWER_HILOGI(MODULE_SERVICE, "CheckRunningLock: fun is Start!"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Enter, state = %{public}u", state); auto pms = pms_.promote(); if (pms == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "CheckRunningLock: promote failed!"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Pms is nullptr"); return false; } auto runningLockMgr = pms->GetRunningLockMgr(); if (runningLockMgr == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "CheckRunningLock: GetRunningLockMgr failed!"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "RunningLockMgr is nullptr"); return false; } auto iterator = lockMap_.find(state); if (iterator == lockMap_.end()) { - POWER_HILOGE(MODULE_SERVICE, "CheckRunningLock: map find failed!"); - return false; + POWER_HILOGI(FEATURE_RUNNING_LOCK, "No specific lock in lockMap_ for state: %{public}u", state); + return true; } std::shared_ptr> pLock = iterator->second; @@ -717,7 +680,7 @@ bool PowerStateMachine::CheckRunningLock(PowerState state) iter != pLock->end(); ++iter) { uint32_t count = runningLockMgr->GetValidRunningLockNum(*iter); if (count > 0) { - POWER_HILOGE(MODULE_SERVICE, + POWER_HILOGI(FEATURE_POWER_STATE, "RunningLock %{public}s is locking (count=%{public}d), blocking %{public}s", GetRunningLockTypeString(*iter).c_str(), count, @@ -726,7 +689,7 @@ bool PowerStateMachine::CheckRunningLock(PowerState state) } } - POWER_HILOGI(MODULE_SERVICE, "No RunningLock block for state (%{public}d)", state); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "No specific lock for state: %{public}u", state); return true; } @@ -758,8 +721,7 @@ int64_t PowerStateMachine::GetSleepTime() bool PowerStateMachine::SetState(PowerState state, StateChangeReason reason, bool force) { - POWER_HILOGI(MODULE_SERVICE, - "SetState state=%{public}d, reason=%{public}d, force=%{public}d", + POWER_HILOGD(FEATURE_POWER_STATE, "state=%{public}d, reason=%{public}d, force=%{public}d", state, reason, force); auto iterator = controllerMap_.find(state); if (iterator == controllerMap_.end()) { @@ -767,20 +729,20 @@ bool PowerStateMachine::SetState(PowerState state, StateChangeReason reason, boo } std::shared_ptr pController = iterator->second; if (pController == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "AWAKE State not initiated"); + POWER_HILOGW(FEATURE_POWER_STATE, "StateController is not init"); return false; } TransitResult ret = pController->TransitTo(reason, true); - POWER_HILOGI(MODULE_SERVICE, "SetState: fun is End!"); + POWER_HILOGI(FEATURE_POWER_STATE, "StateController::TransitTo ret: %{public}d", ret); return (ret == TransitResult::SUCCESS || ret == TransitResult::ALREADY_IN_STATE); } void PowerStateMachine::SetDisplaySuspend(bool enable) { - POWER_HILOGI(MODULE_SERVICE, "SetDisplaySuspend:%{public}d", enable); + POWER_HILOGD(FEATURE_POWER_STATE, "enable: %{public}d", enable); enableDisplaySuspend_ = enable; if (GetState() == PowerState::INACTIVE) { - POWER_HILOGI(MODULE_SERVICE, "Change display state"); + POWER_HILOGI(FEATURE_POWER_STATE, "Change display state"); if (enable) { stateAction_->SetDisplayState(DisplayState::DISPLAY_SUSPEND, StateChangeReason::STATE_CHANGE_REASON_APPLICATION); @@ -793,7 +755,7 @@ void PowerStateMachine::SetDisplaySuspend(bool enable) StateChangeReason PowerStateMachine::GetReasonByUserActivity(UserActivityType type) { - POWER_HILOGI(MODULE_SERVICE, "GetReasonByUserActivity Start:%{public}d", type); + POWER_HILOGD(FEATURE_ACTIVITY, "UserActivityType: %{public}u", type); StateChangeReason ret = StateChangeReason::STATE_CHANGE_REASON_UNKNOWN; switch (type) { case UserActivityType::USER_ACTIVITY_TYPE_BUTTON: @@ -813,13 +775,13 @@ StateChangeReason PowerStateMachine::GetReasonByUserActivity(UserActivityType ty default: break; } - POWER_HILOGI(MODULE_SERVICE, "GetReasonByUserActivity: fun is End!"); + POWER_HILOGD(FEATURE_ACTIVITY, "StateChangeReason: %{public}u", ret); return ret; } StateChangeReason PowerStateMachine::GetReasonByWakeType(WakeupDeviceType type) { - POWER_HILOGI(MODULE_SERVICE, "GetReasonByWakeType Start:%{public}d", type); + POWER_HILOGD(FEATURE_WAKEUP, "WakeupDeviceType :%{public}u", type); StateChangeReason ret = StateChangeReason::STATE_CHANGE_REASON_UNKNOWN; switch (type) { case WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON: @@ -860,13 +822,13 @@ StateChangeReason PowerStateMachine::GetReasonByWakeType(WakeupDeviceType type) default: break; } - POWER_HILOGI(MODULE_SERVICE, "GetReasonByWakeType: fun is End!"); + POWER_HILOGD(FEATURE_WAKEUP, "StateChangeReason: %{public}u", ret); return ret; } StateChangeReason PowerStateMachine::GetReasionBySuspendType(SuspendDeviceType type) { - POWER_HILOGI(MODULE_SERVICE, "GetReasionBySuspendType Start:%{public}d", type); + POWER_HILOGD(FEATURE_SUSPEND, "SuspendDeviceType: %{public}u", type); StateChangeReason ret = StateChangeReason::STATE_CHANGE_REASON_UNKNOWN; switch (type) { case SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION: @@ -897,7 +859,7 @@ StateChangeReason PowerStateMachine::GetReasionBySuspendType(SuspendDeviceType t default: break; } - POWER_HILOGI(MODULE_SERVICE, "GetReasionBySuspendType: fun is End!"); + POWER_HILOGD(FEATURE_SUSPEND, "StateChangeReason: %{public}u", ret); return ret; } @@ -955,13 +917,13 @@ TransitResult PowerStateMachine::StateController::TransitTo( StateChangeReason reason, bool ignoreLock) { - POWER_HILOGI(MODULE_SERVICE, "TransitTo start"); + POWER_HILOGD(FEATURE_POWER_STATE, "Start"); std::shared_ptr owner = owner_.lock(); if (owner == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "TransitTo: no owner"); + POWER_HILOGW(FEATURE_POWER_STATE, "owner is nullptr"); return TransitResult::OTHER_ERR; } - POWER_HILOGI(MODULE_SERVICE, + POWER_HILOGI(FEATURE_POWER_STATE, "Transit from %{public}s to %{public}s for %{public}s ignoreLock=%{public}d", GetPowerStateString(owner->currentState_).c_str(), GetPowerStateString(this->state_).c_str(), @@ -969,13 +931,12 @@ TransitResult PowerStateMachine::StateController::TransitTo( ignoreLock); TransitResult ret = TransitResult::OTHER_ERR; if (!CheckState()) { - POWER_HILOGE(MODULE_SERVICE, "TransitTo: already in %{public}d", - owner->currentState_); + POWER_HILOGD(FEATURE_POWER_STATE, "Already in state: %{public}d", owner->currentState_); RecordFailure(owner->currentState_, reason, TransitResult::ALREADY_IN_STATE); return TransitResult::ALREADY_IN_STATE; } if (!ignoreLock && !owner->CheckRunningLock(GetState())) { - POWER_HILOGE(MODULE_SERVICE, "TransitTo: running lock block"); + POWER_HILOGD(FEATURE_POWER_STATE, "Running lock block"); RecordFailure(owner->currentState_, reason, TransitResult::LOCKING); return TransitResult::LOCKING; } @@ -989,19 +950,20 @@ TransitResult PowerStateMachine::StateController::TransitTo( RecordFailure(owner->currentState_, reason, ret); } - POWER_HILOGI(MODULE_SERVICE, "Transit End, result=%{public}d", ret); + POWER_HILOGD(FEATURE_POWER_STATE, "Finish, result: %{public}d", ret); return ret; } bool PowerStateMachine::StateController::CheckState() { - POWER_HILOGI(MODULE_SERVICE, "CheckState: fun is Start!"); std::shared_ptr owner = owner_.lock(); if (owner == nullptr) { + POWER_HILOGW(FEATURE_POWER_STATE, "Owner is nullptr"); return false; } - POWER_HILOGI(MODULE_SERVICE, "CheckState: fun is End!"); - return !(GetState() == owner->currentState_); + auto state = GetState(); + POWER_HILOGD(FEATURE_POWER_STATE, "state: %{public}u, currentState_: %{public}u", state, owner->currentState_); + return state != owner->currentState_; } void PowerStateMachine::StateController::RecordFailure(PowerState from, @@ -1052,7 +1014,7 @@ void PowerStateMachine::StateController::RecordFailure(PowerState from, tag, "MESSAGE", message); - POWER_HILOGI(MODULE_SERVICE, "RecordFailure: %{public}s", message.c_str()); + POWER_HILOGI(FEATURE_POWER_STATE, "RecordFailure: %{public}s", message.c_str()); } } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/powerms_event_handler.cpp b/services/native/src/powerms_event_handler.cpp index c0878d847a82807bf7a987e74668b1b605a54934..055ce161adeae46ce86244a54504e5bd2cc5e79c 100644 --- a/services/native/src/powerms_event_handler.cpp +++ b/services/native/src/powerms_event_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,7 +15,7 @@ #include "powerms_event_handler.h" -#include "power_common.h" +#include "power_log.h" #include "power_mgr_service.h" namespace OHOS { @@ -24,17 +24,17 @@ PowermsEventHandler::PowermsEventHandler(const std::shared_ptr& service) : AppExecFwk::EventHandler(runner), service_(service) { - POWER_HILOGD(MODULE_SERVICE, "PowermsEventHandler::PowermsEventHandler instance created."); + POWER_HILOGD(COMP_SVC, "Instance created"); } void PowermsEventHandler::ProcessEvent([[maybe_unused]] const AppExecFwk::InnerEvent::Pointer& event) { auto pmsptr = service_.promote(); if (pmsptr == nullptr) { + POWER_HILOGE(COMP_SVC, "Power service is nullptr"); return; } - POWER_HILOGI(MODULE_SERVICE, "PowermsEventHandler::%{public}s ,eventid = %d", __func__, - event->GetInnerEventId()); + POWER_HILOGI(COMP_SVC, "Start to process, eventId: %{public}d", event->GetInnerEventId()); switch (event->GetInnerEventId()) { case INIT_KEY_MONITOR_MSG: { pmsptr->KeyMonitorInit(); @@ -69,7 +69,7 @@ void PowermsEventHandler::ProcessEvent([[maybe_unused]] const AppExecFwk::InnerE break; } default: - POWER_HILOGD(MODULE_SERVICE, "PowermsEventHandler::no event id matched."); + POWER_HILOGW(COMP_SVC, "No matched event id"); } } } // namespace PowerMgr diff --git a/services/native/src/running_lock_inner.cpp b/services/native/src/running_lock_inner.cpp index eb924506ec5f64e25f2e327f04c8a97611edc722..538ea3423922c50730d52b57a8b54ab464c684ab 100644 --- a/services/native/src/running_lock_inner.cpp +++ b/services/native/src/running_lock_inner.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,7 +17,7 @@ #include -#include "power_common.h" +#include "power_log.h" namespace OHOS { namespace PowerMgr { @@ -36,11 +36,11 @@ std::shared_ptr RunningLockInner::CreateRunningLockInner(const std::shared_ptr runningLockInner = std::make_shared(runningLockInfo, userIPCinfo); if (runningLockInner == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "failed to create new RunningLockInner record"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "RunningLockInner is nullptr"); return nullptr; } - POWER_HILOGI(MODULE_SERVICE, "RunningLockInner::%{public}s : name = %s, type = %d", __func__, - runningLockInfo.name.c_str(), runningLockInfo.type); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "name: %{public}s, type: %{public}d", runningLockInfo.name.c_str(), + runningLockInfo.type); return runningLockInner; } @@ -54,13 +54,13 @@ void RunningLockInner::SetWorkTriggerList(const WorkTriggerList& workTriggerList void RunningLockInner::DumpInfo(const std::string& description) { // this statement used to debug, can't find isDebugEnabled() interface. will be replaced later. - POWER_HILOGD(MODULE_SERVICE, "RunningLockInner::%{public}s :description = %s, name = %s, type = %d,", __func__, + POWER_HILOGD(FEATURE_RUNNING_LOCK, "description: %{public}s, name: %{public}s, type: %{public}d,", description.c_str(), runningLockInfo_.name.c_str(), runningLockInfo_.type); auto& list = runningLockInfo_.workTriggerlist; for (auto& worker : list) { - POWER_HILOGD(MODULE_SERVICE, "usecount = %ld, name = %s, uid = %d," - " pid = %d, abilityid = %d", worker.use_count(), worker->GetName().c_str(), + POWER_HILOGD(FEATURE_RUNNING_LOCK, "use_count: %{public}ld, name: %{public}s, uid: %{public}d,\ + pid: %{public}d, abilityId: %{public}d", worker.use_count(), worker->GetName().c_str(), worker->GetUid(), worker->GetPid(), worker->GetAbilityId()); } } diff --git a/services/native/src/running_lock_mgr.cpp b/services/native/src/running_lock_mgr.cpp index 61883b5f054491a5ab97d1f5be5815d713d813a9..edf8b7bb047f783176b8c9a034285d4dd0a87b8b 100644 --- a/services/native/src/running_lock_mgr.cpp +++ b/services/native/src/running_lock_mgr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,9 +20,8 @@ #include #include #include -#include -#include "power_common.h" +#include "power_log.h" #include "power_mgr_factory.h" #include "power_mgr_service.h" @@ -38,7 +37,7 @@ RunningLockMgr::~RunningLockMgr() {} bool RunningLockMgr::Init() { - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::Init start"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Init start"); std::lock_guard lock(mutex_); if (runningLockDeathRecipient_ == nullptr) { runningLockDeathRecipient_ = new RunningLockDeathRecipient(); @@ -46,13 +45,13 @@ bool RunningLockMgr::Init() if (runningLockAction_ == nullptr) { runningLockAction_ = PowerMgrFactory::GetRunningLockAction(); if (!runningLockAction_) { - POWER_HILOGE(MODULE_SERVICE, - "RunningLockMgr::Init create RunningLockMgr fail"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Get running lock action fail"); return false; } } auto pmsptr = pms_.promote(); if (pmsptr == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Power manager service is null"); return false; } handler_ = pmsptr->GetHandler(); @@ -64,7 +63,7 @@ bool RunningLockMgr::Init() bool ret = InitLocks(); - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::Init success"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Init success"); return ret; } @@ -81,7 +80,7 @@ void RunningLockMgr::InitLocksTypeScreen() lockCounters_.emplace(RunningLockType::RUNNINGLOCK_SCREEN, std::make_shared( RunningLockType::RUNNINGLOCK_SCREEN, [this](bool active) { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_SCREEN action start!"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_SCREEN action start"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -91,7 +90,7 @@ void RunningLockMgr::InitLocksTypeScreen() return; } if (active) { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_SCREEN active!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_SCREEN active"); stateMachine->SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_RUNNING_LOCK); stateMachine->CancelDelayTimer( @@ -99,12 +98,11 @@ void RunningLockMgr::InitLocksTypeScreen() stateMachine->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_OFF_TIMEOUT_MSG); } else { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_SCREEN inactive!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_SCREEN inactive"); if (stateMachine->GetState() == PowerState::AWAKE) { stateMachine->ResetInactiveTimer(); } else { - POWER_HILOGD(MODULE_SERVICE, - "Screen On unlock in state: %{public}d", + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Screen unlock in state: %{public}d", stateMachine->GetState()); } } @@ -117,7 +115,7 @@ void RunningLockMgr::InitLocksTypeBackground() lockCounters_.emplace(RunningLockType::RUNNINGLOCK_BACKGROUND, std::make_shared( RunningLockType::RUNNINGLOCK_BACKGROUND, [this](bool active) { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_BACKGROUND action start!"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_BACKGROUND action start"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -132,17 +130,16 @@ void RunningLockMgr::InitLocksTypeBackground() } std::shared_ptr pSysLock = iterator->second; if (active) { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_BACKGROUND active!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_BACKGROUND active"); stateMachine->CancelDelayTimer( PowermsEventHandler::CHECK_USER_ACTIVITY_SLEEP_TIMEOUT_MSG); pSysLock->Lock(); } else { - POWER_HILOGI(MODULE_SERVICE, "RUNNINGLOCK_BACKGROUND inactive!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_BACKGROUND inactive"); if (stateMachine->GetState() == PowerState::INACTIVE) { stateMachine->ResetSleepTimer(); } else { - POWER_HILOGD(MODULE_SERVICE, - "Background unlock in state: %{public}d", + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Background unlock in state: %{public}d", stateMachine->GetState()); } pSysLock->Unlock(); @@ -156,8 +153,7 @@ void RunningLockMgr::InitLocksTypeProximity() lockCounters_.emplace(RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL, std::make_shared( RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL, [this](bool active) { - POWER_HILOGI(MODULE_SERVICE, - "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL action start!"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL action start"); auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { return; @@ -172,15 +168,14 @@ void RunningLockMgr::InitLocksTypeProximity() } std::shared_ptr pSysLock = iterator->second; if (active) { - POWER_HILOGI(MODULE_SERVICE, - "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL active!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL active"); proximityController_.Enable(); if (proximityController_.IsClose()) { - POWER_HILOGI(MODULE_SERVICE, "INACTIVE when close"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "INACTIVE when proximity is closed"); stateMachine->SetState(PowerState::INACTIVE, StateChangeReason::STATE_CHANGE_REASON_RUNNING_LOCK, true); } else { - POWER_HILOGI(MODULE_SERVICE, "AWAKE when away"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "AWAKE when proximity is away"); stateMachine->SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_RUNNING_LOCK, true); } @@ -190,8 +185,7 @@ void RunningLockMgr::InitLocksTypeProximity() PowermsEventHandler::CHECK_USER_ACTIVITY_OFF_TIMEOUT_MSG); pSysLock->Lock(); } else { - POWER_HILOGI(MODULE_SERVICE, - "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL inactive!"); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL inactive"); stateMachine->SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_RUNNING_LOCK); stateMachine->ResetInactiveTimer(); @@ -208,8 +202,7 @@ std::shared_ptr RunningLockMgr::GetRunningLockInner( std::lock_guard lock(mutex_); auto iterator = runningLocks_.find(token); if (iterator != runningLocks_.end()) { - POWER_HILOGD(MODULE_SERVICE, "RunningLockMgr::%{public}s :find by token.", __func__); - return iterator->second; + return iterator->second; } return nullptr; } @@ -223,11 +216,8 @@ std::shared_ptr RunningLockMgr::CreateRunningLock( if (lockInner == nullptr) { return nullptr; } - POWER_HILOGD(MODULE_SERVICE, - "RunningLockMgr::%{public}s : ok,name = %{public}s,type = %{public}d", - __func__, - runningLockInfo.name.c_str(), - runningLockInfo.type); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Create lock success, token=%{public}p, name=%{public}s, type=%{public}d", + token.GetRefPtr(), runningLockInfo.name.c_str(), runningLockInfo.type); mutex_.lock(); runningLocks_.emplace(token, lockInner); @@ -238,8 +228,7 @@ std::shared_ptr RunningLockMgr::CreateRunningLock( void RunningLockMgr::ReleaseLock(const sptr token) { - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s :token = %{public}p", - __func__, token.GetRefPtr()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "token=%{public}p", token.GetRefPtr()); auto lockInner = GetRunningLockInner(token); if (lockInner == nullptr) { return; @@ -258,15 +247,12 @@ void RunningLockMgr::RemoveAndPostUnlockTask( { auto handler = handler_.lock(); if (handler == nullptr) { + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Handler is nullptr"); return; } const string& tokenStr = to_string(reinterpret_cast(token.GetRefPtr())); - POWER_HILOGI(MODULE_SERVICE, - "RunningLockMgr::%{public}s :token = %p,tokenStr = %s,timeOutMS = %d", - __func__, - token.GetRefPtr(), - tokenStr.c_str(), - timeOutMS); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "token=%{public}p, tokenStr=%{public}s, timeOutMS=%{public}d", + token.GetRefPtr(), tokenStr.c_str(), timeOutMS); handler->RemoveTask(tokenStr); if (timeOutMS != 0) { std::function unLockFunc = std::bind(&RunningLockMgr::UnLock, this, token); @@ -278,38 +264,29 @@ void RunningLockMgr::Lock(const sptr& token, const RunningLockInfo& runningLockInfo, const UserIPCInfo& userIPCinfo, uint32_t timeOutMS) { - POWER_HILOGI(MODULE_SERVICE, - "RunningLockMgr::%{public}s :token = %p,name = %s,type = %d", - __func__, - token.GetRefPtr(), - runningLockInfo.name.c_str(), - runningLockInfo.type); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "token=%{public}p, name=%{public}s, type=%{public}d", + token.GetRefPtr(), runningLockInfo.name.c_str(), runningLockInfo.type); auto lockInner = GetRunningLockInner(token); if (lockInner == nullptr) { - POWER_HILOGD(MODULE_SERVICE, "RunningLockMgr::Lock failed, can't find %{public}p", - token.GetRefPtr()); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "LockInner is nullptr, token=%{public}p", token.GetRefPtr()); return; } if (!lockInner->GetDisabled()) { - POWER_HILOGD(MODULE_SERVICE, "RunningLockMgr::Lock, this lock(%s) is already on", - lockInner->GetRunningLockName().c_str()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Lock is already enabled, token=%{public}p", token.GetRefPtr()); return; } lockInner->SetDisabled(false); auto iterator = lockCounters_.find(lockInner->GetRunningLockType()); if (iterator == lockCounters_.end()) { - POWER_HILOGD(MODULE_SERVICE, - "RunningLockMgr::Lock failed, unsupported type %{public}d", - lockInner->GetRunningLockType()); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Lock failed unsupported type, token=%{public}p, type=%{public}d", + token.GetRefPtr(), lockInner->GetRunningLockType()); return; } std::shared_ptr counter = iterator->second; counter->Increase(); - POWER_HILOGD(MODULE_SERVICE, - "LockCounter: %{public}d, %{public}d", - lockInner->GetRunningLockType(), + POWER_HILOGD(FEATURE_RUNNING_LOCK, "LockCounter type=%{public}d, count=%{public}d", lockInner->GetRunningLockType(), counter->GetCount()); if (timeOutMS > 0) { RemoveAndPostUnlockTask(token, timeOutMS); @@ -318,17 +295,17 @@ void RunningLockMgr::Lock(const sptr& token, void RunningLockMgr::UnLock(const sptr token) { - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s :token = %p", - __func__, token.GetRefPtr()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "token=%{public}p", token.GetRefPtr()); auto lockInner = GetRunningLockInner(token); if (lockInner == nullptr) { return; } + POWER_HILOGI(FEATURE_RUNNING_LOCK, "LockInner token=%{public}p, name=%{public}s, type=%{public}d", + token.GetRefPtr(), lockInner->GetRunningLockName().c_str(), lockInner->GetRunningLockType()); if (lockInner->GetDisabled()) { - POWER_HILOGD(MODULE_SERVICE, - "RunningLockMgr::Unlock, this lock(%{public}s) is already off", - lockInner->GetRunningLockName().c_str()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Lock is already disabled, token=%{public}p, name=%{public}s", + token.GetRefPtr(), lockInner->GetRunningLockName().c_str()); return; } lockInner->SetDisabled(true); @@ -336,13 +313,14 @@ void RunningLockMgr::UnLock(const sptr token) auto iterator = lockCounters_.find(lockInner->GetRunningLockType()); if (iterator == lockCounters_.end()) { - POWER_HILOGD(MODULE_SERVICE, - "RunningLockMgr::Unlock failed, unsupported type %{public}d", - lockInner->GetRunningLockType()); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Unlock failed unsupported type, token=%{public}p, type=%{public}d", + token.GetRefPtr(), lockInner->GetRunningLockType()); return; } std::shared_ptr counter = iterator->second; counter->Decrease(); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "LockCounter type=%{public}d, count=%{public}d", lockInner->GetRunningLockType(), + counter->GetCount()); } bool RunningLockMgr::IsUsed(const sptr& token) @@ -370,8 +348,7 @@ uint32_t RunningLockMgr::GetValidRunningLockNum(RunningLockType type) { auto iterator = lockCounters_.find(type); if (iterator == lockCounters_.end()) { - POWER_HILOGD(MODULE_SERVICE, - "GetValidRunningLockNum failed, unsupported type %d", type); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "No specific lock, type=%{public}d", type); return 0; } std::shared_ptr counter = iterator->second; @@ -394,9 +371,7 @@ bool RunningLockMgr::ExistValidRunningLock() void RunningLockMgr::SetWorkTriggerList(const sptr& token, const WorkTriggerList& workTriggerList) { - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s :token = %p", - __func__, - token.GetRefPtr()); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "token=%{public}p", token.GetRefPtr()); auto lockInner = GetRunningLockInner(token); if (lockInner == nullptr) { @@ -449,10 +424,7 @@ void RunningLockMgr::CheckOverTime() } int64_t curTime = GetTickCount(); int64_t detectTime = curTime - CHECK_TIMEOUT_INTERVAL_MS; - POWER_HILOGI(MODULE_SERVICE, - "RunningLockMgr::%{public}s :cur = %" PRId64 " detectTime=%" PRId64 "", - __func__, - curTime, + POWER_HILOGI(FEATURE_RUNNING_LOCK, "curTime=%{public}" PRId64 " detectTime=%{public}" PRId64 "", curTime, detectTime); if (detectTime < 0) { return; @@ -483,9 +455,7 @@ void RunningLockMgr::SendCheckOverTimeMsg(int64_t delayTime) if (handler == nullptr) { return; } - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s ,delay = %" PRId64 "", - __func__, - delayTime); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "delayTime=%{public}" PRId64 "", delayTime); handler->SendEvent(PowermsEventHandler::CHECK_RUNNINGLOCK_OVERTIME_MSG, 0, delayTime); } @@ -498,24 +468,24 @@ void RunningLockMgr::NotifyRunningLockChanged(const sptr& token, const string& tokenStr = to_string(reinterpret_cast(token.GetRefPtr())); switch (changeType) { case NOTIFY_RUNNINGLOCK_ADD: { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Add token=%{public}s", tokenStr.c_str()); NotifyHiViewRunningLockInfo(tokenStr, *lockInner, changeType); SendCheckOverTimeMsg(CHECK_TIMEOUT_INTERVAL_MS); break; } case NOTIFY_RUNNINGLOCK_REMOVE: { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Remove token=%{public}s", tokenStr.c_str()); string str = "token=" + tokenStr; NotifyHiView(changeType, str); break; } case NOTIFY_RUNNINGLOCK_WORKTRIGGER_CHANGED: { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "WorkTriggerChanged token=%{public}s", tokenStr.c_str()); NotifyHiViewRunningLockInfo(tokenStr, *lockInner, changeType); break; } case NOTIFY_RUNNINGLOCK_OVERTIME: { - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s :%s token=%s", - __func__, - runninglockNotifyStr_.at(changeType).c_str(), - tokenStr.c_str()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Overtime token=%{public}s", tokenStr.c_str()); break; } default: { @@ -526,39 +496,26 @@ void RunningLockMgr::NotifyRunningLockChanged(const sptr& token, bool RunningLockMgr::MatchProxyMap(const UserIPCInfo& userIPCinfo) { if (proxyMap_.empty()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s ret false by proxyMap_.empty(), useripcinfo uid = %d pid = %d.", - __func__, - userIPCinfo.uid, - userIPCinfo.pid); + POWER_HILOGW(FEATURE_RUNNING_LOCK, "ProxyMap_ is empty, uid = %{public}d, pid = %{public}d", + userIPCinfo.uid, userIPCinfo.pid); return false; } auto it = proxyMap_.find(userIPCinfo.uid); // 1. Find pidset by uid. if (it == proxyMap_.end()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s not find uidmap, useripcinfo uid = %d pid = %d.", - __func__, - userIPCinfo.uid, - userIPCinfo.pid); + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Pid set not match, uid = %{public}d, pid = %{public}d", + userIPCinfo.uid, userIPCinfo.pid); return false; } auto& pidset = it->second; // 2. Count by owner pid. if (pidset.count(userIPCinfo.pid) > 0) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s find uidmap and count pid > 1, useripcinfo uid = %d pid = %d.", - __func__, - userIPCinfo.uid, - userIPCinfo.pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Pid set match and count > 0, uid = %{public}d, pid = %{public}d", + userIPCinfo.uid, userIPCinfo.pid); return true; } - POWER_HILOGD(MODULE_SERVICE, - "%{public}s find uidmap and count pid = 0,count(-1) = %d, useripcinfo uid = %d " - "pid = %d.", __func__, - static_cast(pidset.count(INVALID_PID)), - userIPCinfo.uid, - userIPCinfo.pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Pid set match and count(-1) = %{public}d, uid = %{public}d, pid = %{public}d", + static_cast(pidset.count(INVALID_PID)), userIPCinfo.uid, userIPCinfo.pid); // 3. Count by INVALID_PID, return true when proxy (uid, -1). return (pidset.count(INVALID_PID) > 0); } @@ -574,8 +531,7 @@ void RunningLockMgr::SetRunningLockDisableFlag( * because we update the proxy map before, so we should refresh * all of the runninglock disable flag always. */ - POWER_HILOGD(MODULE_SERVICE, - "%{public}s ret false by proxyMap_.empty() and forceRefresh = false", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Set lock enable, proxyMap_ is empty and forceRefresh is false"); lockInner->SetDisabled(false); return; } @@ -584,9 +540,8 @@ void RunningLockMgr::SetRunningLockDisableFlag( if (matched) { // Matched the lock owner useripcinfo, set disabled directly. lockInner->SetDisabled(true); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s MatchProxyMap matched by useripcinfo uid = %d pid = %d.", - __func__, userIPCinfo.uid, userIPCinfo.pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Lock and ipc matched, uid = %{public}d, pid = %{public}d", + userIPCinfo.uid, userIPCinfo.pid); return; } const RunningLockInfo& runningLockInfo = lockInner->GetRunningLockInfo(); @@ -594,8 +549,7 @@ void RunningLockMgr::SetRunningLockDisableFlag( if (list.empty()) { // Not matched, and no trigger list. lockInner->SetDisabled(false); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s useripcinfo not matched and list is empty().", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Work trigger list is empty"); return; } bool triggerMatched = true; @@ -605,40 +559,32 @@ void RunningLockMgr::SetRunningLockDisableFlag( UserIPCInfo triggerIPCInfo {workTrigger->GetUid(), workTrigger->GetPid()}; if (!MatchProxyMap(triggerIPCInfo)) { triggerMatched = false; - POWER_HILOGD(MODULE_SERVICE, - "%{public}s workTrigger not matched uid = %d, pid = %d.", - __func__, - triggerIPCInfo.uid, - triggerIPCInfo.pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "WorkTrigger not matched uid = %{public}d, pid = %{public}d", + triggerIPCInfo.uid, triggerIPCInfo.pid); break; } } + POWER_HILOGD(FEATURE_RUNNING_LOCK, "TriggerMatched = %{public}d, uid = %{public}d, pid = %{public}d", + userIPCinfo.uid, userIPCinfo.pid, triggerMatched); lockInner->SetDisabled(triggerMatched); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s useripcinfo uid = %d pid = %d, triggerMatched = %d.", - __func__, - userIPCinfo.uid, - userIPCinfo.pid, - triggerMatched); } void RunningLockMgr::LockReally(const sptr& token, std::shared_ptr& lockInner) { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Start"); if (lockInner->GetReallyLocked()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :return by lockInner->GetReallyLocked() == true.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "lockInner->GetReallyLocked() is true, return"); return; } if (lockInner->GetDisabled()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :return by lockInner->GetDisabled() == true.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "lockInner->GetDisabled() is true, return"); return; } runningLockAction_->Acquire(lockInner->GetRunningLockType()); lockInner->SetReallyLocked(true); NotifyRunningLockChanged(token, lockInner, NOTIFY_RUNNINGLOCK_ADD); - POWER_HILOGD(MODULE_SERVICE, "%{public}s :called end.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Finish"); } void RunningLockMgr::UnLockReally(const sptr& token, std::shared_ptr& lockInner) @@ -652,21 +598,20 @@ void RunningLockMgr::UnLockReally(const sptr& token, * and then PGManager Proxyed it, * At this time, lock should be unlocked to kernel because we have locked to kernel for it. */ + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Start"); if (!lockInner->GetReallyLocked()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :return by lockInner->GetReallyLocked() == false.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "lockInner->GetReallyLocked() is false, return"); return; } // If disabled, unlock to the kernel. if (!lockInner->GetDisabled()) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :return by lockInner->GetDisabled() == false.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "lockInner->GetDisabled() is false, return"); return; } runningLockAction_->Release(lockInner->GetRunningLockType()); lockInner->SetReallyLocked(false); NotifyRunningLockChanged(token, lockInner, NOTIFY_RUNNINGLOCK_REMOVE); - POWER_HILOGD(MODULE_SERVICE, "%{public}s :called end.", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Finish"); } void RunningLockMgr::ProxyRunningLockInner(bool proxyLock) @@ -686,8 +631,7 @@ void RunningLockMgr::ProxyRunningLockInner(bool proxyLock) void RunningLockMgr::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) { - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = %d, uid = %d, pid = %d", __func__, + POWER_HILOGD(FEATURE_RUNNING_LOCK, "proxyLock = %{public}d, uid = %{public}d, pid = %{public}d", proxyLock, uid, pid); auto it = proxyMap_.find(uid); if (proxyLock) { @@ -695,48 +639,40 @@ void RunningLockMgr::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) if (it == proxyMap_.end()) { unordered_set pidset({pid}); proxyMap_.emplace(uid, pidset); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = true first emplace {uid = %d, pid = %d}", - __func__, uid, pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Emplace first proxyMap_ {uid = %{public}d, pid = %{public}d}", + uid, pid); } else { if (pid == INVALID_PID) { // Insert uid, pid = -1,remove other pid proxyMap_.erase(uid); unordered_set pidset({pid}); proxyMap_.emplace(uid, pidset); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Re-emplace proxyMap_ {uid = %{public}d, pid = %{public}d}", + uid, pid); } else { auto& pidset = it->second; pidset.insert(pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Insert proxyMap_ {uid = %{public}d, pid = %{public}d}", uid, pid); } - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = true uid = %d exist insert pid = %d", - __func__, uid, pid); } // 1. Set the matched runninglock inner disabled flag. } else { if (it == proxyMap_.end()) { // No insert proxy info, nothing to erase. - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = false not find by uid = %d", - __func__, uid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "No uid in proxyMap_, uid = %{public}d", uid); return; } // 1. Clear the runninglock inner disabled flag 2.removed from proxyMap_ if (pid == INVALID_PID) { proxyMap_.erase(uid); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = false pid = -1 rmv uid = %d map", - __func__, uid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "pid = -1, erase from proxyMap_, uid = %{public}d", uid); } else { auto& pidset = it->second; pidset.erase(pid); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :proxyLock = false uid = %d erase single pid = %d", - __func__, uid, pid); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Erase from proxyMap_, uid = %{public}d, pid = %{public}d", uid, pid); if (pidset.size() == 0) { proxyMap_.erase(uid); - POWER_HILOGD(MODULE_SERVICE, - "%{public}s :pidset.size()=0 erase uid keymap", __func__); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Pidset is empty erase uid from proxyMap_, uid = %{public}d", uid); } } } @@ -759,10 +695,7 @@ void RunningLockMgr::NotifyHiView(RunningLockChangedType changeType, tag, "MESSAGE", msg); - POWER_HILOGI(MODULE_SERVICE, "RunningLockMgr::%{public}s: %s %s", - __func__, - tag.c_str(), - msg.c_str()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "tag=%{public}s, msg=%{public}s", tag.c_str(), msg.c_str()); } void RunningLockMgr::EnableMock(IRunningLockAction* mockAction) @@ -855,22 +788,22 @@ void RunningLockMgr::DumpInfo(std::string& result) void RunningLockMgr::RunningLockDeathRecipient::OnRemoteDied(const wptr& remote) { if (remote.promote() == nullptr) { + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Remote is nullptr"); return; } auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Power service is nullptr"); return; } auto handler = pms->GetHandler(); if (handler == nullptr) { + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Handler is nullptr"); return; } std::function forceUnLockFunc = std::bind(&PowerMgrService::ForceUnLock, pms, remote.promote()); - POWER_HILOGI(MODULE_SERVICE, - "RunningLockDeathRecipient::%{public}s :remote.promote() = %p", - __func__, - remote.promote().GetRefPtr()); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Remote.promote() = %{public}p", remote.promote().GetRefPtr()); handler->PostTask(forceUnLockFunc, TASK_RUNNINGLOCK_FORCEUNLOCK); } @@ -915,24 +848,24 @@ void RunningLockMgr::LockCounter::Clear() void RunningLockMgr::ProximityController::RecordSensorCallback(SensorEvent *event) { - POWER_HILOGD(MODULE_SERVICE, "Sensor Callback come in"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Sensor Callback come in"); if (event == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "SensorEvent *event is nullptr"); + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Sensor event is nullptr"); return; } if (event->sensorTypeId != SENSOR_TYPE_ID_PROXIMITY) { - POWER_HILOGE(MODULE_SERVICE, "Sensor Callback is not PROXIMITY"); + POWER_HILOGW(FEATURE_RUNNING_LOCK, "Sensor type is not PROXIMITY"); return; } auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrService::GetInstance()"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Power service is nullptr"); return; } auto runningLock = pms->GetRunningLockMgr(); ProximityData* data = (ProximityData*)event->data; - POWER_HILOGD(MODULE_SERVICE, "Sensor Callback %{public}d", data->scalar); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY data->scalar=%{public}d", data->scalar); if (data->scalar == PROXIMITY_CLOSE_SCALAR) { runningLock->SetProximity(PROXIMITY_CLOSE); } else if (data->scalar == PROXIMITY_AWAY_SCALAR) { @@ -942,28 +875,28 @@ void RunningLockMgr::ProximityController::RecordSensorCallback(SensorEvent *even RunningLockMgr::ProximityController::ProximityController() { - POWER_HILOGD(MODULE_SERVICE, "ProximityController Create"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Instance enter"); SensorInfo* sensorInfo = nullptr; int32_t count; int ret = GetAllSensors(&sensorInfo, &count); if (ret != 0 || sensorInfo == nullptr) { - POWER_HILOGE(MODULE_SERVICE, "Can't get sensors"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Get sensors fail, ret=%{public}d", ret); return; } for (int32_t i = 0; i < count; i++) { if (sensorInfo[i].sensorId == SENSOR_TYPE_ID_PROXIMITY) { - POWER_HILOGD(MODULE_SERVICE, "ProximityController Support"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Support PROXIMITY sensor"); support_ = true; break; } } if (!support_) { - POWER_HILOGE(MODULE_SERVICE, "ProximityController not support"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "PROXIMITY sensor not support"); free(sensorInfo); return; } if (strcpy_s(user_.name, sizeof(user_.name), "RunningLock") != EOK) { - POWER_HILOGE(MODULE_SERVICE, "ProximityController strcpy_s err"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "strcpy_s error"); return; } user_.userData = nullptr; @@ -981,10 +914,10 @@ RunningLockMgr::ProximityController::~ProximityController() void RunningLockMgr::ProximityController::Enable() { - POWER_HILOGD(MODULE_SERVICE, "ProximityController Enable"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Enter"); enabled_ = true; if (!support_) { - POWER_HILOGE(MODULE_SERVICE, "ProximityController not support"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "PROXIMITY sensor not support"); return; } @@ -995,10 +928,10 @@ void RunningLockMgr::ProximityController::Enable() void RunningLockMgr::ProximityController::Disable() { - POWER_HILOGD(MODULE_SERVICE, "ProximityController Disable"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Enter"); enabled_ = false; if (!support_) { - POWER_HILOGE(MODULE_SERVICE, "ProximityController not support"); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "PROXIMITY sensor not support"); return; } @@ -1007,28 +940,32 @@ void RunningLockMgr::ProximityController::Disable() bool RunningLockMgr::ProximityController::IsClose() { - POWER_HILOGD(MODULE_SERVICE, "IsClose:%{public}d", isClose); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY IsClose: %{public}d", isClose); return isClose; } void RunningLockMgr::ProximityController::OnClose() { if (!enabled_ || IsClose()) { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY is disabled or closed already"); return; } auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Power service is nullptr"); return; } auto stateMachine = pms->GetPowerStateMachine(); if (stateMachine == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "state machine is nullptr"); return; } isClose = true; + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY is closed"); auto runningLock = pms->GetRunningLockMgr(); if (runningLock->GetValidRunningLockNum( RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL) > 0) { - POWER_HILOGD(MODULE_SERVICE, "Change to INACITVE when come close"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Change state to INACITVE when holding PROXIMITY LOCK"); stateMachine->SetState(PowerState::INACTIVE, StateChangeReason::STATE_CHANGE_REASON_SENSOR, true); @@ -1038,21 +975,25 @@ void RunningLockMgr::ProximityController::OnClose() void RunningLockMgr::ProximityController::OnAway() { if (!enabled_ || !IsClose()) { + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY is disabled or away already"); return; } auto pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Power service is nullptr"); return; } auto stateMachine = pms->GetPowerStateMachine(); if (stateMachine == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "state machine is nullptr"); return; } isClose = false; + POWER_HILOGD(FEATURE_RUNNING_LOCK, "PROXIMITY is away"); auto runningLock = pms->GetRunningLockMgr(); if (runningLock->GetValidRunningLockNum( RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL) > 0) { - POWER_HILOGD(MODULE_SERVICE, "Change to AWAKE when go away"); + POWER_HILOGD(FEATURE_RUNNING_LOCK, "Change state to AWAKE when holding PROXIMITY LOCK"); stateMachine->SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_SENSOR, true); diff --git a/services/native/src/shutdown_service.cpp b/services/native/src/shutdown_service.cpp index a21eca0dcd65dd9934bf4ad664157728ea4f7ce3..978b718865818c7dab1b154f26b7efec86201ea7 100644 --- a/services/native/src/shutdown_service.cpp +++ b/services/native/src/shutdown_service.cpp @@ -24,8 +24,9 @@ #include #include #include +#include -#include "hilog_wrapper.h" +#include "power_log.h" #include "power_mgr_factory.h" using namespace OHOS::AAFwk; @@ -39,6 +40,7 @@ const time_t MAX_TIMEOUT_SEC = 30; } ShutdownService::ShutdownService() : started_(false) { + POWER_HILOGD(FEATURE_SHUTDOWN, "Instance create"); devicePowerAction_ = PowerMgrFactory::GetDevicePowerAction(); deviceStateAction_ = PowerMgrFactory::GetDeviceStateAction(); highCallbackMgr_ = new CallbackManager(); @@ -83,21 +85,21 @@ void ShutdownService::DelShutdownCallback(const sptr& callbac bool ShutdownService::IsShuttingDown() { - POWER_HILOGD(MODULE_SERVICE, "IsShuttingDown"); return started_; } void ShutdownService::RebootOrShutdown(const std::string& reason, bool isReboot) { if (started_) { - POWER_HILOGE(MODULE_SERVICE, "Shutdown is already running."); + POWER_HILOGW(FEATURE_SHUTDOWN, "Shutdown is already running"); return; } started_ = true; + POWER_HILOGI(FEATURE_SHUTDOWN, "Start to detach shutdown thread"); make_unique([=] { Prepare(); TurnOffScreen(); - POWER_HILOGD(MODULE_SERVICE, "reason = %{public}s, reboot = %{public}d", reason.c_str(), isReboot); + POWER_HILOGD(FEATURE_SHUTDOWN, "reason = %{public}s, reboot = %{public}d", reason.c_str(), isReboot); if (devicePowerAction_ != nullptr) { isReboot ? devicePowerAction_->Reboot(reason) : devicePowerAction_->Shutdown(reason); } @@ -108,29 +110,32 @@ void ShutdownService::RebootOrShutdown(const std::string& reason, bool isReboot) void ShutdownService::Prepare() { PublishShutdownEvent(); + POWER_HILOGD(FEATURE_SHUTDOWN, "High priority shutdown callback started"); highCallbackMgr_->WaitingCallback(); + POWER_HILOGD(FEATURE_SHUTDOWN, "Default priority shutdown callback started"); defaultCallbackMgr_->WaitingCallback(); + POWER_HILOGD(FEATURE_SHUTDOWN, "Low priority shutdown callback started"); lowCallbackMgr_->WaitingCallback(); } void ShutdownService::PublishShutdownEvent() const { - POWER_HILOGD(MODULE_SERVICE, "Start of publishing shutdown event"); + POWER_HILOGD(FEATURE_SHUTDOWN, "Start of publishing shutdown event"); CommonEventPublishInfo publishInfo; publishInfo.SetOrdered(false); IntentWant shutdownWant; shutdownWant.SetAction(CommonEventSupport::COMMON_EVENT_SHUTDOWN); CommonEventData event(shutdownWant); if (!CommonEventManager::PublishCommonEvent(event, publishInfo, nullptr)) { - POWER_HILOGE(MODULE_SERVICE, "Failed to publish the shutdown event!"); + POWER_HILOGE(FEATURE_SHUTDOWN, "Publish the shutdown event fail"); return; } - POWER_HILOGD(MODULE_SERVICE, "End of publishing shutdown event"); + POWER_HILOGD(FEATURE_SHUTDOWN, "End of publishing shutdown event"); } void ShutdownService::TurnOffScreen() { - POWER_HILOGD(MODULE_SERVICE, "turn off screen before shutdown"); + POWER_HILOGD(FEATURE_SHUTDOWN, "Turn off screen before shutdown"); deviceStateAction_->SetDisplayState(DisplayState::DISPLAY_OFF, StateChangeReason::STATE_CHANGE_REASON_INIT); } @@ -143,9 +148,8 @@ void ShutdownService::CallbackManager::AddCallback(const sptr if (retIt.second) { object->AddDeathRecipient(this); } - POWER_HILOGI(MODULE_SERVICE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu," - " insertOk = %{public}d", object.GetRefPtr(), - callback.GetRefPtr(), callbacks_.size(), retIt.second); + POWER_HILOGD(FEATURE_SHUTDOWN, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu," + " insertOk = %{public}d", object.GetRefPtr(), callback.GetRefPtr(), callbacks_.size(), retIt.second); } void ShutdownService::CallbackManager::RemoveCallback(const sptr& callback) @@ -158,25 +162,29 @@ void ShutdownService::CallbackManager::RemoveCallback(const sptrRemoveDeathRecipient(this); } - POWER_HILOGI(MODULE_SERVICE, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu,", + POWER_HILOGD(FEATURE_SHUTDOWN, "object = %{public}p, callback = %{public}p, callbacks.size = %{public}zu,", object.GetRefPtr(), callback.GetRefPtr(), callbacks_.size()); } void ShutdownService::CallbackManager::OnRemoteDied(const wptr& remote) { + POWER_HILOGW(FEATURE_SHUTDOWN, "Enter, remote=%{public}p", remote.GetRefPtr()); RETURN_IF(remote.promote() == nullptr); RemoveCallback(iface_cast(remote.promote())); } void ShutdownService::CallbackManager::WaitingCallback() { - POWER_HILOGD(MODULE_SERVICE, "Shutdown callback started."); auto callbackStart = [&]() { unique_lock lock(mutex_); for (auto &obj : callbacks_) { sptr callback = iface_cast(obj); if (callback != nullptr) { + int64_t start = GetTickCount(); callback->ShutdownCallback(); + int64_t cost = GetTickCount() - start; + POWER_HILOGD(FEATURE_SHUTDOWN, "Callback finished, callback=%{public}p, cost=%{public}" PRId64 "", + callback.GetRefPtr(), cost); } } }; @@ -185,12 +193,12 @@ void ShutdownService::CallbackManager::WaitingCallback() future fut = callbackTask.get_future(); make_unique(std::move(callbackTask))->detach(); - POWER_HILOGI(MODULE_SERVICE, "Waiting for the callback execution is complete..."); + POWER_HILOGI(FEATURE_SHUTDOWN, "Waiting for the callback execution complete..."); future_status status = fut.wait_for(std::chrono::seconds(MAX_TIMEOUT_SEC)); if (status == future_status::timeout) { - POWER_HILOGW(MODULE_SERVICE, "Shutdown callback execution timedout!"); + POWER_HILOGW(FEATURE_SHUTDOWN, "Shutdown callback execution timeout"); } - POWER_HILOGI(MODULE_SERVICE, "The callback execution is complete. "); + POWER_HILOGI(FEATURE_SHUTDOWN, "The callback execution is complete"); } } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/test/unittest/src/ces_system_test.cpp b/services/native/test/unittest/src/ces_system_test.cpp index 3a0f53a731f70d773e769446bfc4feb8da649f3e..260395adc11937dc7004965f83ed065184ab0400 100644 --- a/services/native/test/unittest/src/ces_system_test.cpp +++ b/services/native/test/unittest/src/ces_system_test.cpp @@ -51,9 +51,9 @@ void CesSystemTest::CommonEventServiCesSystemTest::OnReceiveEvent(const CommonEv { std::string action = data.GetWant().GetAction(); if (action == CommonEventSupport::COMMON_EVENT_SHUTDOWN) { - POWER_HILOGD(MODULE_SERVICE, "CommonEventServiCesSystemTest::OnReceiveEvent."); + POWER_HILOGD(LABEL_TEST, "CommonEventServiCesSystemTest::OnReceiveEvent."); } - POWER_HILOGD(MODULE_SERVICE, "CommonEventServiCesSystemTest::OnReceiveEvent other."); + POWER_HILOGD(LABEL_TEST, "CommonEventServiCesSystemTest::OnReceiveEvent other."); } void CesSystemTest::SetUpTestCase() diff --git a/services/native/test/unittest/src/power_device_mode_test.cpp b/services/native/test/unittest/src/power_device_mode_test.cpp index 8b5776b4fb758234e61d3f5ac2ddead9ed23ebcd..7ed666175115a50cd7e55d397efedfd9376af35e 100644 --- a/services/native/test/unittest/src/power_device_mode_test.cpp +++ b/services/native/test/unittest/src/power_device_mode_test.cpp @@ -37,12 +37,12 @@ using namespace std; void PowerDeviceModeTest::PowerModeTest1Callback::PowerModeCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerModeTest1Callback::PowerModeCallback."); + POWER_HILOGD(LABEL_TEST, "PowerModeTest1Callback::PowerModeCallback."); } void PowerDeviceModeTest::PowerModeTest2Callback::PowerModeCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerModeTest2Callback::PowerModeCallback."); + POWER_HILOGD(LABEL_TEST, "PowerModeTest2Callback::PowerModeCallback."); } namespace { @@ -56,18 +56,18 @@ HWTEST_F (PowerDeviceModeTest, PowerDeviceModeCallback001, TestSize.Level0) auto& powerMgrClient = PowerMgrClient::GetInstance(); sptr cb1 = new PowerModeTest1Callback(); powerMgrClient.RegisterPowerModeCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerDeviceModeCallback001 1."); + POWER_HILOGD(LABEL_TEST, "PowerDeviceModeCallback001 1."); { sptr cb2 = new PowerModeTest2Callback(); powerMgrClient.UnRegisterPowerModeCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerDeviceModeCallback001 2."); + POWER_HILOGD(LABEL_TEST, "PowerDeviceModeCallback001 2."); powerMgrClient.RegisterPowerModeCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerDeviceModeCallback001 3."); + POWER_HILOGD(LABEL_TEST, "PowerDeviceModeCallback001 3."); powerMgrClient.RegisterPowerModeCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerDeviceModeCallback001 4."); + POWER_HILOGD(LABEL_TEST, "PowerDeviceModeCallback001 4."); } powerMgrClient.UnRegisterPowerModeCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerDeviceModeTest::PowerDeviceModeCallback001 end."); + POWER_HILOGD(LABEL_TEST, "PowerDeviceModeTest::PowerDeviceModeCallback001 end."); } /** diff --git a/services/native/test/unittest/src/power_mgr_fail_check_test.cpp b/services/native/test/unittest/src/power_mgr_fail_check_test.cpp index bcd09a30949cbcf9c825e153d0857a8ab901fef2..e4033cf0e5098f35ead08e11bbb441ad361f96c0 100644 --- a/services/native/test/unittest/src/power_mgr_fail_check_test.cpp +++ b/services/native/test/unittest/src/power_mgr_fail_check_test.cpp @@ -28,7 +28,7 @@ static MockLockAction* g_lockAction; static void ResetMockAction() { - POWER_HILOGD(MODULE_SERVICE, "ResetMockAction:Start."); + POWER_HILOGD(LABEL_TEST, "ResetMockAction:Start."); g_stateAction = new MockStateAction(); g_powerAction = new MockPowerAction(); g_lockAction = new MockLockAction(); @@ -70,7 +70,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrFailCheck001, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrFailCheck001: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrFailCheck001:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrFailCheck001:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -89,7 +89,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrFailCheck001, TestSize.Level2) GTEST_LOG_(INFO) << dumpInfo; ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrFailCheck001:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrFailCheck001:End."); GTEST_LOG_(INFO) << "PowerMgrFailCheck001: end."; } @@ -102,7 +102,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrFailCheck002, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrFailCheck002: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrFailCheck002:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrFailCheck002:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -122,7 +122,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrFailCheck002, TestSize.Level2) GTEST_LOG_(INFO) << dumpInfo; ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrFailCheck002:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrFailCheck002:End."); GTEST_LOG_(INFO) << "PowerMgrFailCheck002: end."; } } \ No newline at end of file diff --git a/services/native/test/unittest/src/power_mgr_mock_test.cpp b/services/native/test/unittest/src/power_mgr_mock_test.cpp index de26dfc8d6dec6e4672a1203a1e801c84e2f96d1..d45250a87a2002b053af3f4d29ea4b765a721c72 100644 --- a/services/native/test/unittest/src/power_mgr_mock_test.cpp +++ b/services/native/test/unittest/src/power_mgr_mock_test.cpp @@ -28,7 +28,7 @@ static MockLockAction* g_lockAction; static void ResetMockAction() { - POWER_HILOGD(MODULE_SERVICE, "ResetMockAction:Start."); + POWER_HILOGD(LABEL_TEST, "ResetMockAction:Start."); g_stateAction = new MockStateAction(); g_powerAction = new MockPowerAction(); g_lockAction = new MockLockAction(); @@ -70,7 +70,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest001, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest001: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest001:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest001:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -84,7 +84,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest001, TestSize.Level2) sleep(ASYNC_WAIT_TIME_S); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest001:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest001:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest001: end."; } @@ -97,7 +97,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest002, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest002: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest002:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest002:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -111,7 +111,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest002, TestSize.Level2) sleep(ASYNC_WAIT_TIME_S); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest002:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest002:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest002: end."; } @@ -126,23 +126,23 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest003, TestSize.Level2) sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest003: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest003:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest003:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { GTEST_LOG_(INFO) << "PowerMgrUnittest003: Failed to get PowerMgrService"; } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest003:Start mock."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest003:Start mock."); EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, Suspend(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false)); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest003:Start suspend."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest003:Start suspend."); pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest003:end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest003:end."); GTEST_LOG_(INFO) << "PowerMgrUnittest003: end."; } @@ -155,7 +155,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest004, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest004: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest004:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest004:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -170,7 +170,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest004, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_DEVICE_ADMIN, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest004:End ."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest004:End ."); GTEST_LOG_(INFO) << "PowerMgrUnittest004: end."; } @@ -183,7 +183,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest005, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest005: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest005:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest005:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -198,7 +198,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest005, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_TIMEOUT, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest005:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest005:End"); GTEST_LOG_(INFO) << "PowerMgrUnittest005: end."; } @@ -211,7 +211,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest006, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest006: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest006:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest006:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -226,7 +226,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest006, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_LID_SWITCH, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest006:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest006:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest006: end."; } @@ -239,7 +239,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest007, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest007: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest007:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest007:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -254,7 +254,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest007, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_POWER_BUTTON, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest007:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest007:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest007: end."; } @@ -267,7 +267,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest008, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest008: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest008:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest008:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -282,7 +282,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest008, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_HDMI, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest008:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest008:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest008: end."; } @@ -295,7 +295,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest009, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest009: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest009:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest009:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -310,7 +310,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest009, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_SLEEP_BUTTON, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest009:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest009:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest009: end."; } @@ -323,7 +323,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest010, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest010: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest010:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest010:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -338,7 +338,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest010, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_ACCESSIBILITY, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest010:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest010:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest010: end."; } @@ -351,7 +351,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest011, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest011: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest011:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest011:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -366,7 +366,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest011, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_FORCE_SUSPEND, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest011:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest011:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest011: end."; } @@ -379,7 +379,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest012, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest012: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest012:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest012:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -396,7 +396,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest012, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest012:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest012:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest012: end."; } @@ -409,7 +409,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest013, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest013: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest013:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest013:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -426,7 +426,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest013, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest013:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest013:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest013: end."; } @@ -439,7 +439,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest014, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest014: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest014:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest014:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -456,7 +456,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest014, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest014:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest014:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest014: end."; } @@ -469,7 +469,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest015, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest015: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest015:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest015:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -486,7 +486,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest015, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_PLUGGED_IN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest015:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest015:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest015: end."; } @@ -499,7 +499,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest016, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest016: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest016:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest016:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -516,7 +516,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest016, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_GESTURE, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest016:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest016:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest016: end."; } @@ -529,7 +529,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest017, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest017: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest017:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest017:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -546,7 +546,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest017, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_CAMERA_LAUNCH, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest017:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest017:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest017: end."; } @@ -559,7 +559,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest018, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest018: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest018:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest018:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -576,7 +576,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest018, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_KEY, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest018:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest018:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest018: end."; } @@ -589,7 +589,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest019, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest019: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest019:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest019:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -606,7 +606,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest019, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_MOTION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest019:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest019:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest019: end."; } @@ -619,7 +619,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest020, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest020: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest020:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest020:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -636,7 +636,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest020, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_HDMI, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest020:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest020:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest020: end."; } @@ -649,7 +649,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest021, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest021: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest021:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest021:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -666,7 +666,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest021, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_LID, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest021:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest021:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest021: end."; } @@ -679,7 +679,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest022, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest022: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest022:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest022:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -701,7 +701,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest022, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest022:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest022:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest022: end."; } @@ -714,7 +714,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest023, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest023: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest023:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest023:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -736,7 +736,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest023, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest023:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest023:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest023: end."; } @@ -749,7 +749,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest024, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest024: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest024:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest024:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -768,7 +768,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest024, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest024:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest024:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest024: end."; } @@ -781,7 +781,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest025, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest025: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest025:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest025:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -794,7 +794,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest025, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest025:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest025:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest025: end."; } @@ -807,7 +807,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest026, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest026: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest026:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest026:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -820,7 +820,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest026, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest026:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest026:End"); GTEST_LOG_(INFO) << "PowerMgrUnittest026: end."; } @@ -833,7 +833,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest027, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest027: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest027:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest027:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -846,7 +846,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest027, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest027:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest027:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest027: end."; } @@ -859,7 +859,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest028, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest028: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest028:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest028:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -872,7 +872,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest028, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest028:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest028:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest028: end."; } @@ -885,7 +885,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest029, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest029: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest029:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest029:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -898,7 +898,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest029, TestSize.Level2) EXPECT_EQ(pms->ForceSuspendDevice(0), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest029:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest029:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest029: end."; } @@ -911,7 +911,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest030, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest030: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest030:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest030:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -931,7 +931,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest030, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest030:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest030:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest030: end."; } @@ -944,7 +944,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest031, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest031: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest031:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest031:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -968,7 +968,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest031, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest031:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest031:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest031: end."; } @@ -981,7 +981,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest032, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest032: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest032:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest032:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1005,7 +1005,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest032, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest032:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest032:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest032: end."; } @@ -1018,7 +1018,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest033, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest033: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest033:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest033:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1035,7 +1035,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest033, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest033:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest033:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest033: end."; } @@ -1048,7 +1048,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest034, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest034: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest034:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest034:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1067,7 +1067,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest034, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest034:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest034:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest034: end."; } @@ -1080,7 +1080,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest035, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest035: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest035:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest035:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1099,7 +1099,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest035, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest035:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest035:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest035: end."; } @@ -1112,7 +1112,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest036, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest036: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest036:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest036:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1131,7 +1131,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest036, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest036:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest036:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest036: end."; } @@ -1144,7 +1144,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest037, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest037: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest037:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest037:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1163,7 +1163,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest037, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest037:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest037:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest037: end."; } @@ -1176,7 +1176,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest038, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest038: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest038:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest038:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1195,7 +1195,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest038, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest038:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest038:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest038: end."; } @@ -1209,7 +1209,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest039, TestSize.Level2) UserActivityType abnormaltype = {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest039: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest039:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest039:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1227,7 +1227,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest039, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest039:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest039:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest039: end."; } @@ -1241,7 +1241,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest040, TestSize.Level2) UserActivityType abnormaltype=UserActivityType(6); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest040: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest040:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest040:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1263,7 +1263,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest040, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest040:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest040:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest040: end."; } @@ -1278,7 +1278,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest041, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(wakeupReason); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest041: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest041:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest041:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1295,7 +1295,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest041, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest041:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest041:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest041: end."; } @@ -1309,7 +1309,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest042, TestSize.Level2) WakeupDeviceType abnormaltype=WakeupDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest042: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest042:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest042:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1326,7 +1326,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest042, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest042:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest042:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest042: end."; } @@ -1339,7 +1339,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest043, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest043: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest043:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest043:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1358,7 +1358,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest043, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest043:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest043:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest043: end."; } @@ -1373,7 +1373,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest044, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(wakeupReason); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest044: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest044:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest044:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1392,7 +1392,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest044, TestSize.Level2) ResetMockAction(); GTEST_LOG_(INFO) << "PowerMgrUnittest044: end."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest044:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest044:End."); } /** @@ -1405,7 +1405,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest045, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest045: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest045:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest045:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1426,7 +1426,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest045, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3)/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest045:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest045:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest045: end."; } @@ -1440,7 +1440,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest046, TestSize.Level2) UserActivityType abnormaltype = UserActivityType(6); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest046: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest046:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest046:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1457,7 +1457,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest046, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest046:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest046:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest046: end."; } @@ -1471,7 +1471,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest047, TestSize.Level2) UserActivityType abnormaltype = {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest047: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest047:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest047:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1488,7 +1488,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest047, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest047:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest047:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest047: end."; } @@ -1501,7 +1501,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest048, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest048: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest048:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest048:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1523,7 +1523,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest048, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest048:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest048:End"); GTEST_LOG_(INFO) << "PowerMgrUnittest048: end."; } @@ -1537,7 +1537,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest049, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(10); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest049: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest049:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest049:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1552,7 +1552,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest049, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest049:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest049:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest049: end."; } @@ -1566,7 +1566,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest050, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest050: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest050:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest050:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1581,7 +1581,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest050, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest050:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest050:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest050: end."; } @@ -1594,7 +1594,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest051, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest051: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest051:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest051:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1616,7 +1616,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest051, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest051:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest051:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest051: end."; } @@ -1630,7 +1630,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest052, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(10); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest052: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest052:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest052:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1644,7 +1644,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest052, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest052:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest052:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest052: end."; } @@ -1658,7 +1658,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest053, TestSize.Level2) SuspendDeviceType abnormaltype = {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest053: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest053:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest053:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1672,7 +1672,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest053, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest053:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest053:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest053: end."; } @@ -1685,7 +1685,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest054, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest054: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest054:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest054:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1701,7 +1701,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest054, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest054:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest054:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest054: end."; } @@ -1714,7 +1714,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest055, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest055: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest055:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest055:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1736,7 +1736,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest055, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest055:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest055:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest055: end."; } @@ -1749,7 +1749,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest056, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest056: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest056:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest056:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1773,7 +1773,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest056, TestSize.Level2) pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest056:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest056:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest056: end."; } @@ -1786,7 +1786,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest057, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest057: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest057:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest057:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1807,7 +1807,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest057, TestSize.Level2) pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest057:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest057:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest057: end."; } @@ -1853,7 +1853,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest059, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest059: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest059:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest059:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1873,7 +1873,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest059, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest059:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest059:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest059: end."; } @@ -1886,7 +1886,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest060, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest060: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest060:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest060:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1907,7 +1907,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest060, TestSize.Level2) ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest060:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest060:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest060: end."; } @@ -1921,7 +1921,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest061, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest061: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest061:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest061:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1945,7 +1945,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest061, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest061:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest061:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest061: end."; } @@ -1958,7 +1958,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest062, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest062: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest062:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest062:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1986,7 +1986,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest062, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest062:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest062:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest062: end."; } @@ -1999,7 +1999,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest063, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest063: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest063:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest063:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2025,7 +2025,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest063, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest063:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest063:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest063: end."; } @@ -2038,7 +2038,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest064, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest064: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest063:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest063:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2063,7 +2063,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest064, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest064:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest064:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest064: end."; } @@ -2076,7 +2076,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest065, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest065: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest065:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest065:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2100,7 +2100,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest065, TestSize.Level2) pms->UnLock(token); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest065:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest065:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest065: end."; } @@ -2113,7 +2113,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest066, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest066: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest066:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest066:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2144,7 +2144,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest066, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest066:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest066:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest066: end."; } @@ -2157,7 +2157,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest067, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest067: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest067:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest067:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2187,7 +2187,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest067, TestSize.Level2) ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest067:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest067:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest067: end."; } @@ -2201,7 +2201,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest068, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest068: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest068:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest068:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2238,7 +2238,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest068, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest068:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest068:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest068: end."; } @@ -2251,7 +2251,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest069, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest069: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest069:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest069:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2279,7 +2279,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest069, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest069:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest069:End"); GTEST_LOG_(INFO) << "PowerMgrUnittest069: end."; } @@ -2292,7 +2292,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest070, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest070: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest070:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest070:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2318,7 +2318,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest070, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest070:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest070:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest070: end."; } @@ -2331,7 +2331,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest071, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest071: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest071:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest071:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2357,7 +2357,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest071, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest071:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest071:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest071: end."; } @@ -2371,7 +2371,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest072, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest072: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest072:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest072:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2397,7 +2397,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest072, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest072:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest072:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest072: end."; } @@ -2410,7 +2410,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest073, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest073: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest073:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest073:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2444,7 +2444,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest073, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest073:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest073:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest073: end."; } @@ -2457,7 +2457,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest074, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest074: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest074:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest074:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2479,7 +2479,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest074, TestSize.Level2) pms->MockProximity(RunningLockMgr::PROXIMITY_CLOSE); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest074:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest074:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest074: end."; } @@ -2492,7 +2492,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest075, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest075: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest075:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest075:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2515,7 +2515,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest075, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest075:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest075:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest075: end."; } @@ -2529,7 +2529,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest076, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest076: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest076:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest076:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2557,7 +2557,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest076, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest076:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest076:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest076: end."; } @@ -2570,7 +2570,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest077, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest077: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest077:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest077:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2602,7 +2602,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest077, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest077:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest077:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest077: end."; } @@ -2615,7 +2615,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest078, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest078: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest078:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest078:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2638,7 +2638,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest078, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest078:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest078:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest078: end."; } @@ -2651,7 +2651,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest079, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest079: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest079:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest079:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2669,7 +2669,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest079, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest079:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest079:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest079: end."; } @@ -2683,7 +2683,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest080, TestSize.Level2) int64_t time =15000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest080: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest080:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest080:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2708,7 +2708,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest080, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S+1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest080:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest080:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrUnittest080: end."; } @@ -2723,7 +2723,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest081, TestSize.Level2) int64_t time =30000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest081: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest081:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest081:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2748,7 +2748,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest081, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S+1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest081:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest081:End"); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrUnittest081: end."; } @@ -2915,7 +2915,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest086, TestSize.Level2) int64_t time =15000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest086: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest086:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2923,7 +2923,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest086, TestSize.Level2) } pms->SetDisplayOffTime(time); pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:DeviceStateAction::SetDisplayState."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest086:DeviceStateAction::SetDisplayState."); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) @@ -2932,15 +2932,15 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest086, TestSize.Level2) EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:Start sleep."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest086:Start sleep."); sleep(time/1000-2); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); sleep(3); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086: sleep end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest086: sleep end."); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest086:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrUnittest086: end."; } @@ -2955,7 +2955,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest087, TestSize.Level2) int64_t time =30000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest087: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest0087:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest0087:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2976,7 +2976,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest087, TestSize.Level2) sleep(3); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest087:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest087:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrUnittest087: end."; } @@ -3092,7 +3092,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest091, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrUnittest091: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest091:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest091:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3119,7 +3119,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest091, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest091:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnittest091:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest091: end."; } } diff --git a/services/native/test/unittest/src/power_mgr_service_test.cpp b/services/native/test/unittest/src/power_mgr_service_test.cpp index db8b1f9d93e0c4f8d45d162d77e0853f0b139b5e..6d786482e58983333b3c1647741ca4e86144d142 100644 --- a/services/native/test/unittest/src/power_mgr_service_test.cpp +++ b/services/native/test/unittest/src/power_mgr_service_test.cpp @@ -97,7 +97,7 @@ HWTEST_F (PowerMgrServiceTest, PowerMgrService003, TestSize.Level0) runningLock1->Lock(); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrServiceTest::PowerMgrService003 end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrServiceTest::PowerMgrService003 end."); } /** @@ -111,5 +111,5 @@ HWTEST_F (PowerMgrServiceTest, PowerMgrService004, TestSize.Level0) auto& powerMgrClient = PowerMgrClient::GetInstance(); powerMgrClient.RebootDevice("test"); } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrServiceTest::PowerMgrService004 end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrServiceTest::PowerMgrService004 end."); } diff --git a/services/native/test/unittest/src/power_register_callback_mode_test.cpp b/services/native/test/unittest/src/power_register_callback_mode_test.cpp index d9d8b9a2063d1c90eb52453c5d062d2486cd138c..0e3ccb7c65b9fc17c6060d7db0089e0a96105e2f 100644 --- a/services/native/test/unittest/src/power_register_callback_mode_test.cpp +++ b/services/native/test/unittest/src/power_register_callback_mode_test.cpp @@ -37,7 +37,7 @@ using namespace std; void PowerRegisterCallbackModeTest::PowerModeTest1Callback::PowerModeCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerModeTest1Callback::PowerModeCallback."); + POWER_HILOGD(LABEL_TEST, "PowerModeTest1Callback::PowerModeCallback."); } namespace { @@ -54,6 +54,6 @@ HWTEST_F (PowerRegisterCallbackModeTest, PowerRegisterCallbackModeCallback001, T sleep(SLEEP_WAIT_TIME_S); uint32_t mode = 601; powerMgrClient.SetDeviceMode(mode); - POWER_HILOGD(MODULE_SERVICE, "PowerRegisterCallbackModeCallback001 1."); + POWER_HILOGD(LABEL_TEST, "PowerRegisterCallbackModeCallback001 1."); } } \ No newline at end of file diff --git a/services/native/test/unittest/src/power_shutdown_callback_test.cpp b/services/native/test/unittest/src/power_shutdown_callback_test.cpp index b1a5fb0a12a55149f117d195da8c023d13177ef6..fa37d2b7901ec45f5aafe5b1ae2710de28c425b5 100644 --- a/services/native/test/unittest/src/power_shutdown_callback_test.cpp +++ b/services/native/test/unittest/src/power_shutdown_callback_test.cpp @@ -37,12 +37,12 @@ using namespace std; void PowerShutdownCallbackTest::PowerShutdownTest1Callback::ShutdownCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownTest1Callback::ShutdownCallback."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownTest1Callback::ShutdownCallback."); } void PowerShutdownCallbackTest::PowerShutdownTest2Callback::ShutdownCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownTest2Callback::ShutdownCallback."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownTest2Callback::ShutdownCallback."); } namespace { @@ -60,6 +60,6 @@ HWTEST_F (PowerShutdownCallbackTest, PowerShutdownCallback001, TestSize.Level0) if (false) { powerMgrClient.ShutDownDevice(string("ShutDownDeviceTest001")); } - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallback001 1."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownCallback001 1."); } } \ No newline at end of file diff --git a/services/native/test/unittest/src/power_shutdown_test.cpp b/services/native/test/unittest/src/power_shutdown_test.cpp index 253c1ed64b7772d7c86fd11318dd1840af383b48..b10e10b97763fb540484269c9ecb6fcd5dbe1e98 100644 --- a/services/native/test/unittest/src/power_shutdown_test.cpp +++ b/services/native/test/unittest/src/power_shutdown_test.cpp @@ -37,12 +37,12 @@ using namespace std; void PowerShutdownTest::PowerShutdownTest1Callback::ShutdownCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownTest1Callback::ShutdownCallback."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownTest1Callback::ShutdownCallback."); } void PowerShutdownTest::PowerShutdownTest2Callback::ShutdownCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownTest2Callback::ShutdownCallback."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownTest2Callback::ShutdownCallback."); } namespace { @@ -56,18 +56,18 @@ HWTEST_F (PowerShutdownTest, PowerShutdownCallback001, TestSize.Level0) auto& powerMgrClient = PowerMgrClient::GetInstance(); sptr cb1 = new PowerShutdownTest1Callback(); powerMgrClient.RegisterShutdownCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallback001 1."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownCallback001 1."); { sptr cb2 = new PowerShutdownTest2Callback(); powerMgrClient.UnRegisterShutdownCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallback001 2."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownCallback001 2."); powerMgrClient.RegisterShutdownCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallback001 3."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownCallback001 3."); powerMgrClient.RegisterShutdownCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallback001 4."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownCallback001 4."); } powerMgrClient.UnRegisterShutdownCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownTest::PowerShutdownCallback001 end."); + POWER_HILOGD(LABEL_TEST, "PowerShutdownTest::PowerShutdownCallback001 end."); } /** diff --git a/services/native/test/unittest/src/power_state_machine_test.cpp b/services/native/test/unittest/src/power_state_machine_test.cpp index 937684737b3553b45954e9799341b7d058fa9574..db85431fafaef06cfde913525cfa7cab242280fc 100644 --- a/services/native/test/unittest/src/power_state_machine_test.cpp +++ b/services/native/test/unittest/src/power_state_machine_test.cpp @@ -65,9 +65,9 @@ namespace { */ HWTEST_F (PowerStateMachineTest, PowerStateMachine003, TestSize.Level0) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine003::fun is start!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine003::fun is start!"); if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine003::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine003::test is not supported, do nothing!"); return; } @@ -87,7 +87,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine003, TestSize.Level0) sleep(REFRESHACTIVITY_WAIT_TIME_S); EXPECT_EQ(powerMgrClient.IsScreenOn(), false) << "PowerStateMachine003: Suspend Device Fail, Screen is On"; - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine003::fun is end!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine003::fun is end!"); GTEST_LOG_(INFO) << "PowerStateMachine003: Suspend Device end."; } @@ -98,9 +98,9 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine003, TestSize.Level0) */ HWTEST_F (PowerStateMachineTest, PowerStateMachine004, TestSize.Level0) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine004::fun is start!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine004::fun is start!"); if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine004::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine004::test is not supported, do nothing!"); return; } @@ -120,7 +120,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine004, TestSize.Level0) sleep(SLEEP_WAIT_TIME_S); EXPECT_EQ(powerMgrClient.IsScreenOn(), true) << "PowerStateMachine004: Wakeup Device Fail, Screen is Off"; - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine004::fun is end!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine004::fun is end!"); GTEST_LOG_(INFO) << "PowerStateMachine004: Wakeup Device end."; } @@ -132,7 +132,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine004, TestSize.Level0) HWTEST_F (PowerStateMachineTest, PowerStateMachine005, TestSize.Level0) { if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine005::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine005::test is not supported, do nothing!"); return; } @@ -165,7 +165,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine005, TestSize.Level0) HWTEST_F (PowerStateMachineTest, PowerStateMachine006, TestSize.Level0) { if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine006::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine006::test is not supported, do nothing!"); return; } @@ -223,13 +223,13 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine007, TestSize.Level2) void PowerStateMachineTest::PowerStateTest1Callback::OnPowerStateChanged(PowerState state) { - POWER_HILOGD(MODULE_SERVICE, "PowerStateTest1Callback::OnPowerStateChanged state = %u.", + POWER_HILOGD(LABEL_TEST, "PowerStateTest1Callback::OnPowerStateChanged state = %u.", static_cast(state)); } void PowerStateMachineTest::PowerStateTest2Callback::OnPowerStateChanged(PowerState state) { - POWER_HILOGD(MODULE_SERVICE, "PowerStateTest2Callback::OnPowerStateChanged state = %u.", + POWER_HILOGD(LABEL_TEST, "PowerStateTest2Callback::OnPowerStateChanged state = %u.", static_cast(state)); } @@ -244,18 +244,18 @@ HWTEST_F (PowerStateMachineTest, PowerStateCallback001, TestSize.Level0) auto& powerMgrClient = PowerMgrClient::GetInstance(); sptr cb1 = new PowerStateTest1Callback(); powerMgrClient.RegisterPowerStateCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerStateCallback001 1."); + POWER_HILOGD(LABEL_TEST, "PowerStateCallback001 1."); { sptr cb2 = new PowerStateTest2Callback(); powerMgrClient.UnRegisterPowerStateCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerStateCallback001 2."); + POWER_HILOGD(LABEL_TEST, "PowerStateCallback001 2."); powerMgrClient.RegisterPowerStateCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerStateCallback001 3."); + POWER_HILOGD(LABEL_TEST, "PowerStateCallback001 3."); powerMgrClient.RegisterPowerStateCallback(cb2); - POWER_HILOGD(MODULE_SERVICE, "PowerStateCallback001 4."); + POWER_HILOGD(LABEL_TEST, "PowerStateCallback001 4."); } powerMgrClient.UnRegisterPowerStateCallback(cb1); - POWER_HILOGD(MODULE_SERVICE, "PowerStateTestCallback::PowerStateCallback001 end."); + POWER_HILOGD(LABEL_TEST, "PowerStateTestCallback::PowerStateCallback001 end."); } /** @@ -334,9 +334,9 @@ namespace { */ HWTEST_F (PowerStateMachineTest, PowerStateMachine010, TestSize.Level0) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine010::fun is start!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine010::fun is start!"); if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine010::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine010::test is not supported, do nothing!"); return; } @@ -358,7 +358,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine010, TestSize.Level0) sleep(NEXT_WAIT_TIME_S); EXPECT_EQ(powerMgrClient.IsScreenOn(), true) << "PowerStateMachine010: Wakeup Device Lock Fail, Screen is Off"; - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine010::fun is end!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine010::fun is end!"); GTEST_LOG_(INFO) << "PowerStateMachine010: Suspend Device end."; } @@ -369,9 +369,9 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine010, TestSize.Level0) */ HWTEST_F (PowerStateMachineTest, PowerStateMachine011, TestSize.Level0) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine011::fun is start!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine011::fun is start!"); if (!PowerStateMachineTest::IsTestSupported()) { - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine011::test is not supported, do nothing!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine011::test is not supported, do nothing!"); return; } @@ -392,7 +392,7 @@ HWTEST_F (PowerStateMachineTest, PowerStateMachine011, TestSize.Level0) sleep(NEXT_WAIT_TIME_S); EXPECT_EQ(powerMgrClient.IsScreenOn(), false) << "PowerStateMachine011: SuspendDevice Lock Fail, Screen is Off"; - POWER_HILOGI(MODULE_SERVICE, "PowerStateMachine011::fun is end!"); + POWER_HILOGI(LABEL_TEST, "PowerStateMachine011::fun is end!"); GTEST_LOG_(INFO) << "PowerStateMachine011: Suspend Device end."; } } diff --git a/services/native/test/unittest/src/running_lock_test.cpp b/services/native/test/unittest/src/running_lock_test.cpp index bce6de1bf4048523b1d0413edb9943ae747ffbce..4d7ea209b020c83d78d66fda45afa70f10f525d0 100644 --- a/services/native/test/unittest/src/running_lock_test.cpp +++ b/services/native/test/unittest/src/running_lock_test.cpp @@ -61,7 +61,7 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit000, TestSize.Level0) runningLock1->SetWorkTriggerList(worklist); auto& list2 = runningLock1->GetWorkTriggerList(); ASSERT_TRUE(list2.empty()); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit01 end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit01 end."); } /** @@ -79,18 +79,18 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit001, TestSize.Level0) std::shared_ptr worker3 = std::make_shared(3, "worker3", 30); std::shared_ptr worker4 = std::make_shared(); WorkTriggerList worklist; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit02, 1 usecount = %ld", worker1.use_count()); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit02, 1 usecount = %ld", worker1.use_count()); runningLock->Lock(); worklist.push_back(worker1); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit02, 2 usecount = %ld", worker1.use_count()); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit02, 2 usecount = %ld", worker1.use_count()); worklist.push_back(worker2); worklist.push_back(worker3); runningLock->SetWorkTriggerList(worklist); { auto& list = runningLock->GetWorkTriggerList(); for (auto& worker : list) { - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit02, 3 usecount = %ld, name = %s, " + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit02, 3 usecount = %ld, name = %s, " "uid = %d, pid = %d, abilityid = %d", worker.use_count(), worker->GetName().c_str(), worker->GetUid(), worker->GetPid(), worker->GetAbilityId()); } @@ -102,7 +102,7 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit001, TestSize.Level0) { auto& list2 = runningLock->GetWorkTriggerList(); for (auto& worker : list2) { - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit02, 4 usecount = %ld, name = %s, " + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit02, 4 usecount = %ld, name = %s, " "uid = %d, pid = %d, abilityid = %d", worker.use_count(), worker->GetName().c_str(), worker->GetUid(), worker->GetPid(), worker->GetAbilityId()); } @@ -112,13 +112,13 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit001, TestSize.Level0) { auto& list2 = runningLock->GetWorkTriggerList(); for (auto& worker : list2) { - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit02, 5 usecount = %ld, name = %s," + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit02, 5 usecount = %ld, name = %s," "uid = %d, pid = %d, abilityid = %d", worker.use_count(), worker->GetName().c_str(), worker->GetUid(), worker->GetPid(), worker->GetAbilityId()); } } runningLock->Lock(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit002 end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit002 end."); } /** @@ -136,14 +136,14 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit002, TestSize.Level1) ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; runningLock1->UnLock(); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit003 1."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit003 1."); // lock 50ms runningLock1->Lock(50); usleep(4000); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit003 2."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit003 2."); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; usleep(1000); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit003 3."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit003 3."); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; // wait 60ms usleep(60000); @@ -171,7 +171,7 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit002, TestSize.Level1) ASSERT_TRUE((*it1)->GetAbilityId() == (*it2)->GetAbilityId()) << "it1->GetAbilityId() == it2->GetAbilityId()"; ASSERT_TRUE((*it1)->GetName() == (*it2)->GetName()) << "it1->GetName() == it2->GetName()"; } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit003 end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit003 end."); } /** @@ -190,28 +190,28 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit004, TestSize.Level1) // after 8ms unlock runningLock1->Lock(30); runningLock1->Lock(80); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit005 1."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit005 1."); usleep(50000); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; usleep(50000); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; // no unlock - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit005 2."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit005 2."); runningLock1->Lock(2); runningLock1->Lock(3); runningLock1->Lock(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit005 3."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit005 3."); usleep(8000); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; // after 3ms unlock runningLock1->Lock(30); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit005 4."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit005 4."); usleep(50000); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; runningLock1->Lock(5); runningLock1->UnLock(); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit005 5."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit005 5."); } } @@ -230,28 +230,28 @@ HWTEST_F (RunningLockTest, RunningLockInnerKit003, TestSize.Level0) // after 8ms unlock runningLock1->Lock(30); runningLock1->Lock(80); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit004 1."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit004 1."); usleep(50000); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; usleep(50000); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; // no unlock - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit004 2."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit004 2."); runningLock1->Lock(2); runningLock1->Lock(3); runningLock1->Lock(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit004 3."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit004 3."); usleep(8000); ASSERT_TRUE(runningLock1->IsUsed()) << "runningLock1->IsUsed() != true"; // after 3ms unlock runningLock1->Lock(30); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit004 4."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit004 4."); usleep(50000); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; runningLock1->Lock(5); runningLock1->UnLock(); ASSERT_TRUE(!runningLock1->IsUsed()) << "runningLock1->IsUsed() != false"; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnitTest::RunningLockInnerKit004 5."); + POWER_HILOGD(LABEL_TEST, "PowerMgrUnitTest::RunningLockInnerKit004 5."); } /** @@ -292,7 +292,7 @@ HWTEST_F (RunningLockTest, RunningLockMgr001, TestSize.Level0) ASSERT_TRUE(0 == runningLockMgr_->GetRunningLockNum(RunningLockType::RUNNINGLOCK_SCREEN)); ASSERT_TRUE(0 == runningLockMgr_->GetRunningLockNum(RunningLockType::RUNNINGLOCK_BACKGROUND)); } - POWER_HILOGD(MODULE_SERVICE, "RunningLockTest::RunningLockMgr001 end."); + POWER_HILOGD(LABEL_TEST, "RunningLockTest::RunningLockMgr001 end."); } /** @@ -333,7 +333,7 @@ HWTEST_F (RunningLockTest, RunningLockMgr002, TestSize.Level0) ASSERT_TRUE(0 == runningLockMgr_->GetRunningLockNum(RunningLockType::RUNNINGLOCK_SCREEN)); ASSERT_TRUE(0 == runningLockMgr_->GetRunningLockNum(RunningLockType::RUNNINGLOCK_BACKGROUND)); } - POWER_HILOGD(MODULE_SERVICE, "RunningLockTest::RunningLockMgr002 end."); + POWER_HILOGD(LABEL_TEST, "RunningLockTest::RunningLockMgr002 end."); } @@ -388,7 +388,7 @@ HWTEST_F (RunningLockTest, RunningLockMgr003, TestSize.Level0) } runningLockMgr_->UnLock(token1); runningLockMgr_->UnLock(token2); - POWER_HILOGD(MODULE_SERVICE, "RunningLockTest::RunningLockMgr003 end."); + POWER_HILOGD(LABEL_TEST, "RunningLockTest::RunningLockMgr003 end."); } /** @@ -445,7 +445,7 @@ HWTEST_F (RunningLockTest, RunningLockMgr004, TestSize.Level0) } runningLockMgr_->UnLock(token3); runningLockMgr_->UnLock(token4); - POWER_HILOGD(MODULE_SERVICE, "RunningLockTest::RunningLockMgr004 end."); + POWER_HILOGD(LABEL_TEST, "RunningLockTest::RunningLockMgr004 end."); } /** @@ -503,7 +503,7 @@ HWTEST_F (RunningLockTest, RunningLockMgr005, TestSize.Level0) ASSERT_TRUE(proxymap.empty()); } runningLockMgr_->UnLock(token); - POWER_HILOGD(MODULE_SERVICE, "RunningLockTest::RunningLockMgr005 end."); + POWER_HILOGD(LABEL_TEST, "RunningLockTest::RunningLockMgr005 end."); } #endif // IPC_AVAILABLE } diff --git a/services/zidl/src/power_mgr_proxy.cpp b/services/zidl/src/power_mgr_proxy.cpp index 9f49284d9bcfb096c989e190fe0fa0e8a4662883..53363bfd82f81018da28aad4456dacdcd3c4d08c 100644 --- a/services/zidl/src/power_mgr_proxy.cpp +++ b/services/zidl/src/power_mgr_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +33,7 @@ void PowerMgrProxy::CreateRunningLock(const sptr& token, const Ru MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -43,7 +43,7 @@ void PowerMgrProxy::CreateRunningLock(const sptr& token, const Ru int ret = remote->SendRequest(static_cast(IPowerMgr::CREATE_RUNNINGLOCK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -58,7 +58,7 @@ void PowerMgrProxy::ReleaseRunningLock(const sptr& token) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -67,7 +67,7 @@ void PowerMgrProxy::ReleaseRunningLock(const sptr& token) int ret = remote->SendRequest(static_cast(IPowerMgr::RELEASE_RUNNINGLOCK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -83,19 +83,19 @@ bool PowerMgrProxy::IsRunningLockTypeSupported(uint32_t type) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return result; } WRITE_PARCEL_WITH_RET(data, Uint32, static_cast(type), false); int ret = remote->SendRequest(static_cast(IPowerMgr::IS_RUNNINGLOCK_TYPE_SUPPORTED), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return result; } if (!reply.ReadBool(result)) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Readback fail!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "ReadBool fail"); } return result; @@ -111,7 +111,7 @@ void PowerMgrProxy::Lock(const sptr& token, const RunningLockInfo MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -122,7 +122,7 @@ void PowerMgrProxy::Lock(const sptr& token, const RunningLockInfo int ret = remote->SendRequest(static_cast(IPowerMgr::RUNNINGLOCK_LOCK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -137,7 +137,7 @@ void PowerMgrProxy::UnLock(const sptr& token) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -146,7 +146,7 @@ void PowerMgrProxy::UnLock(const sptr& token) int ret = remote->SendRequest(static_cast(IPowerMgr::RUNNINGLOCK_UNLOCK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -161,7 +161,7 @@ bool PowerMgrProxy::IsUsed(const sptr& token) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return false; } @@ -169,7 +169,7 @@ bool PowerMgrProxy::IsUsed(const sptr& token) int ret = remote->SendRequest(static_cast(IPowerMgr::RUNNINGLOCK_ISUSED), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return false; } bool used = false; @@ -187,7 +187,7 @@ void PowerMgrProxy::SetWorkTriggerList(const sptr& token, const W MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -196,7 +196,7 @@ void PowerMgrProxy::SetWorkTriggerList(const sptr& token, const W int ret = remote->SendRequest(static_cast(IPowerMgr::RUNNINGLOCK_SET_WORK_TRIGGER_LIST), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -211,7 +211,7 @@ void PowerMgrProxy::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "Write descriptor failed"); return; } @@ -221,7 +221,7 @@ void PowerMgrProxy::ProxyRunningLock(bool proxyLock, pid_t uid, pid_t pid) int ret = remote->SendRequest(static_cast(IPowerMgr::PROXY_RUNNINGLOCK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_RUNNING_LOCK, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -236,7 +236,7 @@ void PowerMgrProxy::RebootDevice(const std::string& reason) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SHUTDOWN, "Write descriptor failed"); return; } @@ -244,7 +244,7 @@ void PowerMgrProxy::RebootDevice(const std::string& reason) int ret = remote->SendRequest(static_cast(IPowerMgr::REBOOT_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Transact is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_SHUTDOWN, "SendRequest is failed, ret: %{public}d", ret); } } @@ -258,7 +258,7 @@ void PowerMgrProxy::ShutDownDevice(const std::string& reason) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SHUTDOWN, "Write descriptor failed"); return; } @@ -266,7 +266,7 @@ void PowerMgrProxy::ShutDownDevice(const std::string& reason) int ret = remote->SendRequest(static_cast(IPowerMgr::SHUTDOWN_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Transact is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_SHUTDOWN, "SendRequest is failed, ret: %{public}d", ret); } } @@ -280,7 +280,7 @@ void PowerMgrProxy::SuspendDevice(int64_t callTimeMs, SuspendDeviceType reason, MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SUSPEND, "Write descriptor failed"); return; } @@ -290,7 +290,7 @@ void PowerMgrProxy::SuspendDevice(int64_t callTimeMs, SuspendDeviceType reason, int ret = remote->SendRequest(static_cast(IPowerMgr::SUSPEND_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_SUSPEND, "SendRequest is failed, ret: %{public}d", ret); } } @@ -304,7 +304,7 @@ void PowerMgrProxy::WakeupDevice(int64_t callTimeMs, WakeupDeviceType reason, co MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_WAKEUP, "Write descriptor failed"); return; } @@ -314,7 +314,7 @@ void PowerMgrProxy::WakeupDevice(int64_t callTimeMs, WakeupDeviceType reason, co int ret = remote->SendRequest(static_cast(IPowerMgr::WAKEUP_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_WAKEUP, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -329,7 +329,7 @@ void PowerMgrProxy::RefreshActivity(int64_t callTimeMs, UserActivityType type, b MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_ACTIVITY, "Write descriptor failed"); return; } @@ -339,7 +339,7 @@ void PowerMgrProxy::RefreshActivity(int64_t callTimeMs, UserActivityType type, b int ret = remote->SendRequest(static_cast(IPowerMgr::REFRESH_ACTIVITY), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_ACTIVITY, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -355,7 +355,7 @@ bool PowerMgrProxy::ForceSuspendDevice(int64_t callTimeMs) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SUSPEND, "Write descriptor failed"); return result; } @@ -363,11 +363,11 @@ bool PowerMgrProxy::ForceSuspendDevice(int64_t callTimeMs) int ret = remote->SendRequest(static_cast(IPowerMgr::FORCE_DEVICE_SUSPEND), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_SUSPEND, "SendRequest is failed, ret: %{public}d", ret); return result; } if (!reply.ReadBool(result)) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Readback fail!", __func__); + POWER_HILOGE(FEATURE_SUSPEND, "ReadBool fail"); } return result; @@ -384,17 +384,17 @@ PowerState PowerMgrProxy::GetState() MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); return PowerState::UNKNOWN; } int ret = remote->SendRequest(static_cast(IPowerMgr::GET_STATE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_STATE, "SendRequest is failed, ret: %{public}d", ret); return PowerState::UNKNOWN; } if (!reply.ReadUint32(result)) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Readback fail!", __func__); + POWER_HILOGE(FEATURE_POWER_STATE, "ReadUint32 failed"); return PowerState::UNKNOWN; } @@ -412,17 +412,17 @@ bool PowerMgrProxy::IsScreenOn() MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(COMP_FWK, "Write descriptor failed"); return result; } int ret = remote->SendRequest(static_cast(IPowerMgr::IS_SCREEN_ON), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(COMP_FWK, "SendRequest is failed, ret: %{public}d", ret); return result; } if (!reply.ReadBool(result)) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Readback fail!", __func__); + POWER_HILOGE(COMP_FWK, "ReadBool fail"); } return result; @@ -438,7 +438,7 @@ void PowerMgrProxy::RegisterPowerStateCallback(const sptr& MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); return; } @@ -446,7 +446,7 @@ void PowerMgrProxy::RegisterPowerStateCallback(const sptr& int ret = remote->SendRequest(static_cast(IPowerMgr::REG_POWER_STATE_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_STATE, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -461,7 +461,7 @@ void PowerMgrProxy::UnRegisterPowerStateCallback(const sptr MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); return; } @@ -469,7 +469,7 @@ void PowerMgrProxy::UnRegisterPowerStateCallback(const sptr int ret = remote->SendRequest(static_cast(IPowerMgr::UNREG_POWER_STATE_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_STATE, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -485,7 +485,7 @@ void PowerMgrProxy::RegisterShutdownCallback(IShutdownCallback::ShutdownPriority MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "Write descriptor failed!"); + POWER_HILOGE(FEATURE_SHUTDOWN, "Write descriptor failed"); return; } @@ -494,7 +494,7 @@ void PowerMgrProxy::RegisterShutdownCallback(IShutdownCallback::ShutdownPriority int ret = remote->SendRequest(static_cast(IPowerMgr::REG_SHUTDOWN_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "SendRequest is failed, error code: %{public}d", ret); + POWER_HILOGE(FEATURE_SHUTDOWN, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -509,7 +509,7 @@ void PowerMgrProxy::UnRegisterShutdownCallback(const sptr& ca MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "Write descriptor failed!"); + POWER_HILOGE(FEATURE_SHUTDOWN, "Write descriptor failed"); return; } @@ -517,7 +517,7 @@ void PowerMgrProxy::UnRegisterShutdownCallback(const sptr& ca int ret = remote->SendRequest(static_cast(IPowerMgr::UNREG_SHUTDOWN_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "SendRequest is failed, error code: %{public}d", ret); + POWER_HILOGE(FEATURE_SHUTDOWN, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -532,7 +532,7 @@ void PowerMgrProxy::RegisterPowerModeCallback(const sptr& ca MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "Write descriptor failed!"); + POWER_HILOGE(FEATURE_POWER_MODE, "Write descriptor failed"); return; } @@ -540,7 +540,7 @@ void PowerMgrProxy::RegisterPowerModeCallback(const sptr& ca int ret = remote->SendRequest(static_cast(IPowerMgr::REG_POWER_MODE_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "SendRequest is failed, error code: %{public}d", ret); + POWER_HILOGE(FEATURE_POWER_MODE, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -555,7 +555,7 @@ void PowerMgrProxy::UnRegisterPowerModeCallback(const sptr& MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "Write descriptor failed!"); + POWER_HILOGE(FEATURE_POWER_MODE, "Write descriptor failed"); return; } @@ -563,7 +563,7 @@ void PowerMgrProxy::UnRegisterPowerModeCallback(const sptr& int ret = remote->SendRequest(static_cast(IPowerMgr::UNREG_POWER_MODE_CALLBACK), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "SendRequest is failed, error code: %{public}d", ret); + POWER_HILOGE(FEATURE_POWER_MODE, "SendRequest is failed, ret: %{public}d", ret); return; } } @@ -578,7 +578,7 @@ void PowerMgrProxy::SetDisplaySuspend(bool enable) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SUSPEND, "Write descriptor failed"); return; } @@ -586,7 +586,7 @@ void PowerMgrProxy::SetDisplaySuspend(bool enable) int ret = remote->SendRequest(static_cast(IPowerMgr::SET_DISPLAY_SUSPEND), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Transact is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_SUSPEND, "SendRequest is failed, ret: %{public}d", ret); } } @@ -600,7 +600,7 @@ void PowerMgrProxy::SetDeviceMode(const uint32_t& mode) MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_MODE, "Write descriptor failed"); return; } @@ -608,7 +608,7 @@ void PowerMgrProxy::SetDeviceMode(const uint32_t& mode) int ret = remote->SendRequest(static_cast(IPowerMgr::SETMODE_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Transact is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_MODE, "SendRequest is failed, ret: %{public}d", ret); } } @@ -622,23 +622,21 @@ uint32_t PowerMgrProxy::GetDeviceMode() MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_MODE, "Write descriptor failed"); return 0; } int ret = remote->SendRequest(static_cast(IPowerMgr::GETMODE_DEVICE), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, - "PowerMgrProxy::%{public}s SendRequest is failed, error code: %{public}d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_MODE, "SendRequest is failed, ret: %{public}d", ret); return 0; } uint32_t used = 0; if (!reply.ReadUint32(used)) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s Readback fail!", __func__); + POWER_HILOGE(FEATURE_POWER_MODE, "ReadUint32 fail"); } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrStub::GetDeviceMode, cmd = %{public}u.", used); return used; } @@ -653,8 +651,8 @@ std::string PowerMgrProxy::ShellDump(const std::vector& args, uint3 MessageOption option; if (!data.WriteInterfaceToken(PowerMgrProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); - return 0; + POWER_HILOGE(COMP_FWK, "Write descriptor failed"); + return result; } data.WriteUint32(argc); @@ -664,8 +662,7 @@ std::string PowerMgrProxy::ShellDump(const std::vector& args, uint3 int ret = remote->SendRequest(static_cast(IPowerMgr::SHELL_DUMP), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, - "PowerMgrProxy::%{public}s SendRequest is failed, error code: %{public}d", __func__, ret); + POWER_HILOGE(COMP_FWK, "SendRequest is failed, ret: %{public}d", ret); return result; } result = reply.ReadString(); diff --git a/services/zidl/src/power_mgr_stub.cpp b/services/zidl/src/power_mgr_stub.cpp index d57ba962cec89ce1ba997be7660e34bb0b477d84..c2f1630fc114f87544f79e896617a214d2320b27 100644 --- a/services/zidl/src/power_mgr_stub.cpp +++ b/services/zidl/src/power_mgr_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -29,13 +29,11 @@ namespace PowerMgr { int PowerMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - POWER_HILOGD(MODULE_SERVICE, - "PowerMgrStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d", code, option.GetFlags()); + POWER_HILOGD(COMP_FWK, "cmd = %{public}u, flags= %{public}d", code, option.GetFlags()); std::u16string descripter = PowerMgrStub::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - POWER_HILOGE(MODULE_SERVICE, - "PowerMgrStub::OnRemoteRequest failed, descriptor is not matched!"); + POWER_HILOGE(COMP_FWK, "Descriptor is not matched"); return E_GET_POWER_SERVICE_FAILED; } const int DFX_DELAY_MS = 10000; @@ -270,7 +268,7 @@ int32_t PowerMgrStub::ForceSuspendDeviceStub(MessageParcel& data, MessageParcel& ret = ForceSuspendDevice(time); if (!reply.WriteBool(ret)) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub:: ForceSuspendDevice Writeback Fail!"); + POWER_HILOGE(FEATURE_SUSPEND, "WriteBool fail"); return E_WRITE_PARCEL_ERROR; } return ERR_OK; @@ -280,7 +278,7 @@ int32_t PowerMgrStub::GetStateStub(MessageParcel& reply) { PowerState ret = GetState(); if (!reply.WriteUint32(static_cast(ret))) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub:: GetStateStub Writeback Fail!"); + POWER_HILOGE(FEATURE_POWER_STATE, "WriteUint32 fail"); return E_WRITE_PARCEL_ERROR; } return ERR_OK; @@ -291,7 +289,7 @@ int32_t PowerMgrStub::IsScreeOnStub(MessageParcel& reply) bool ret = false; ret = IsScreenOn(); if (!reply.WriteBool(ret)) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub:: IsScreenOn Writeback Fail!"); + POWER_HILOGE(COMP_FWK, "WriteBool fail"); return E_WRITE_PARCEL_ERROR; } return ERR_OK; @@ -379,9 +377,8 @@ int32_t PowerMgrStub::GetDeviceModeStub(MessageParcel& reply) { uint32_t ret = 0; ret = GetDeviceMode(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrStub::GetDeviceModeStub, cmd = %{public}u.", ret); if (!reply.WriteUint32(static_cast(ret))) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub:: Get device mode Fail!"); + POWER_HILOGE(FEATURE_POWER_MODE, "WriteUint32 fail"); return E_WRITE_PARCEL_ERROR; } return ERR_OK; @@ -393,7 +390,7 @@ int32_t PowerMgrStub::ShellDumpStub(MessageParcel& data, MessageParcel& reply) std::vector args; if (!data.ReadUint32(argc)) { - POWER_HILOGE(MODULE_INNERKIT, "Readback fail!"); + POWER_HILOGE(COMP_FWK, "ReadUint32 fail"); return E_READ_PARCEL_ERROR; } @@ -402,13 +399,13 @@ int32_t PowerMgrStub::ShellDumpStub(MessageParcel& data, MessageParcel& reply) if (!arg.empty()) { args.push_back(arg); } else { - POWER_HILOGE(MODULE_INNERKIT, "read value fail: %{public}d", i); + POWER_HILOGE(COMP_FWK, "read args fail, arg index: %{public}d", i); } } std::string ret = ShellDump(args, argc); if (!reply.WriteString(ret)) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub:: Dump Writeback Fail!"); + POWER_HILOGE(COMP_FWK, "WriteString fail"); return E_WRITE_PARCEL_ERROR; } return ERR_OK; diff --git a/services/zidl/src/power_mode_callback_proxy.cpp b/services/zidl/src/power_mode_callback_proxy.cpp index 159f204722a234511c5b0340ac3c95a6dfa5095d..c19c912e58ecfaaa6b0188c004255eace2ee2d10 100644 --- a/services/zidl/src/power_mode_callback_proxy.cpp +++ b/services/zidl/src/power_mode_callback_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,15 +33,14 @@ void PowerModeCallbackProxy::PowerModeCallback() MessageOption option; if (!data.WriteInterfaceToken(PowerModeCallbackProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_MODE, "Write descriptor failed"); return; } int ret = remote->SendRequest(static_cast(IPowerModeCallback::POWER_MODE_CHANGED), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, - "PowerMgrProxy::%{public}s SendRequest is failed, error code: %{private}d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_MODE, "SendRequest is failed, ret: %{public}d", ret); } } } // namespace PowerMgr diff --git a/services/zidl/src/power_mode_callback_stub.cpp b/services/zidl/src/power_mode_callback_stub.cpp index d1511f8a7daec025fac8becc21a3ad8c308cd393..ddc6a68679b270190d69f49ad38b637fbb67222b 100644 --- a/services/zidl/src/power_mode_callback_stub.cpp +++ b/services/zidl/src/power_mode_callback_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,15 +26,14 @@ namespace PowerMgr { int PowerModeCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - POWER_HILOGD(MODULE_SERVICE, "PowerModeCallbackStub::OnRemoteRequest, cmd = %d, flags= %d", - code, option.GetFlags()); + POWER_HILOGD(COMP_SVC, "cmd = %{public}d, flags= %{public}d", code, option.GetFlags()); const int DFX_DELAY_MS = 10000; int id = HiviewDFX::XCollie::GetInstance().SetTimer("PowerModeCallbackStub", DFX_DELAY_MS, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_NOOP); std::u16string descripter = PowerModeCallbackStub::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub::OnRemoteRequest failed, descriptor is not matched!"); + POWER_HILOGE(COMP_SVC, "Descriptor is not match"); return E_GET_POWER_SERVICE_FAILED; } diff --git a/services/zidl/src/power_shutdown_callback_proxy.cpp b/services/zidl/src/power_shutdown_callback_proxy.cpp index 57733a6107b81e355cfa88e6a887255db2646715..236c90374030e2205365fc2f3e1ac0bca1299bb2 100644 --- a/services/zidl/src/power_shutdown_callback_proxy.cpp +++ b/services/zidl/src/power_shutdown_callback_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,15 +33,14 @@ void PowerShutdownCallbackProxy::ShutdownCallback() MessageOption option; if (!data.WriteInterfaceToken(PowerShutdownCallbackProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_SHUTDOWN, "Write descriptor failed"); return; } int ret = remote->SendRequest(static_cast(IShutdownCallback::POWER_SHUTDOWN_CHANGED), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, - "PowerMgrProxy::%{public}s SendRequest is failed, error code: %{private}d", __func__, ret); + POWER_HILOGE(FEATURE_SHUTDOWN, "SendRequest is failed, ret: %{public}d", ret); } } } // namespace PowerMgr diff --git a/services/zidl/src/power_shutdown_callback_stub.cpp b/services/zidl/src/power_shutdown_callback_stub.cpp index f5dc59069eb280af0b5bd10b39bd4581df0082bd..0aa7ee5f550b184213283a2ee821d1368a10355f 100644 --- a/services/zidl/src/power_shutdown_callback_stub.cpp +++ b/services/zidl/src/power_shutdown_callback_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,15 +26,14 @@ namespace PowerMgr { int PowerShutdownCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - POWER_HILOGD(MODULE_SERVICE, "PowerShutdownCallbackStub::OnRemoteRequest, cmd = %d, flags= %d", - code, option.GetFlags()); + POWER_HILOGD(COMP_SVC, "cmd = %{public}d, flags= %{public}d", code, option.GetFlags()); const int DFX_DELAY_MS = 10000; int id = HiviewDFX::XCollie::GetInstance().SetTimer("PowerShutdownCallback", DFX_DELAY_MS, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_NOOP); std::u16string descripter = PowerShutdownCallbackStub::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub::OnRemoteRequest failed, descriptor is not matched!"); + POWER_HILOGE(COMP_SVC, "Descriptor is not match"); return E_GET_POWER_SERVICE_FAILED; } diff --git a/services/zidl/src/power_state_callback_proxy.cpp b/services/zidl/src/power_state_callback_proxy.cpp index ba02d3e982b66fd3b508e4693ddd8097828221b0..4f4911365fe7999929ee4d7b7b44884bb007a4b3 100644 --- a/services/zidl/src/power_state_callback_proxy.cpp +++ b/services/zidl/src/power_state_callback_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,7 +32,7 @@ void PowerStateCallbackProxy::OnPowerStateChanged(PowerState state) MessageOption option; if (!data.WriteInterfaceToken(PowerStateCallbackProxy::GetDescriptor())) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s write descriptor failed!", __func__); + POWER_HILOGE(FEATURE_POWER_STATE, "Write descriptor failed"); return; } @@ -41,7 +41,7 @@ void PowerStateCallbackProxy::OnPowerStateChanged(PowerState state) int ret = remote->SendRequest(static_cast(IPowerStateCallback::POWER_STATE_CHANGED), data, reply, option); if (ret != ERR_OK) { - POWER_HILOGE(MODULE_INNERKIT, "PowerMgrProxy::%{public}s SendRequest is failed, error code: %d", __func__, ret); + POWER_HILOGE(FEATURE_POWER_STATE, "SendRequest is failed, ret: %{public}d", ret); } } } // namespace PowerMgr diff --git a/services/zidl/src/power_state_callback_stub.cpp b/services/zidl/src/power_state_callback_stub.cpp index 83346c9d76ea128a0e4ac34529f37529e2352d07..db683fd50f5661e04a21b64f981b3797a0942ee5 100644 --- a/services/zidl/src/power_state_callback_stub.cpp +++ b/services/zidl/src/power_state_callback_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,15 +26,14 @@ namespace PowerMgr { int PowerStateCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - POWER_HILOGD(MODULE_SERVICE, "PowerStateCallbackStub::OnRemoteRequest, cmd = %d, flags= %d", - code, option.GetFlags()); + POWER_HILOGD(COMP_SVC, "cmd = %{public}d, flags= %{public}d", code, option.GetFlags()); const int DFX_DELAY_MS = 10000; int id = HiviewDFX::XCollie::GetInstance().SetTimer("PowerStateCallbackStub", DFX_DELAY_MS, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_NOOP); std::u16string descripter = PowerStateCallbackStub::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - POWER_HILOGE(MODULE_SERVICE, "PowerMgrStub::OnRemoteRequest failed, descriptor is not matched!"); + POWER_HILOGE(COMP_SVC, "Descriptor is not match"); return E_GET_POWER_SERVICE_FAILED; } diff --git a/test/systemtest/src/power_mgr_mock_system_test.cpp b/test/systemtest/src/power_mgr_mock_system_test.cpp index d620b48b4d49f59c28739d1d7b9963bf8ca976b9..027a946c04bc2abf7ce944118b41c1ee878b43d5 100644 --- a/test/systemtest/src/power_mgr_mock_system_test.cpp +++ b/test/systemtest/src/power_mgr_mock_system_test.cpp @@ -28,7 +28,7 @@ static MockLockAction* g_lockAction; static void ResetMockAction() { - POWER_HILOGD(MODULE_SERVICE, "ResetMockAction:Start."); + POWER_HILOGD(LABEL_TEST, "ResetMockAction:Start."); g_stateAction = new MockStateAction(); g_powerAction = new MockPowerAction(); g_lockAction = new MockLockAction(); @@ -71,24 +71,24 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock102, TestSize.Level2) sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock102: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock102:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock102:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { GTEST_LOG_(INFO) << "PowerMgrMock102: Failed to get PowerMgrService"; } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock102:Start mock."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock102:Start mock."); EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, Suspend(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false)); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock102:Start suspend."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock102:Start suspend."); pms->SetDisplaySuspend(true); pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock102:end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock102:end."); GTEST_LOG_(INFO) << "PowerMgrMock102: end."; } @@ -101,7 +101,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock103, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock103: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock103:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock103:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -119,7 +119,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock103, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock103:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock103:End."); GTEST_LOG_(INFO) << "PowerMgrMock103: end."; } @@ -132,7 +132,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock104, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock104: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock104:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock104:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -152,7 +152,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock104, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock104:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock104:End."); GTEST_LOG_(INFO) << "PowerMgrMock104: end."; } @@ -166,7 +166,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock105, TestSize.Level2) int64_t time =30000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock105: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock105:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock105:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -187,7 +187,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock105, TestSize.Level2) ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock105:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock105:End"); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrMock105: end."; } @@ -201,7 +201,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock106, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock106: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock106:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock106:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -224,7 +224,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock106, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock106:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock106:End."); GTEST_LOG_(INFO) << "PowerMgrMock106: end."; } @@ -237,7 +237,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock107, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock107: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock107:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock107:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -263,7 +263,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock107, TestSize.Level2) pms->UnLock(token); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock107:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock107:End."); GTEST_LOG_(INFO) << "PowerMgrMock107: end."; } } \ No newline at end of file diff --git a/test/systemtest/src/power_mgr_powersavemode_test.cpp b/test/systemtest/src/power_mgr_powersavemode_test.cpp index 2c703418d17263b81e716e724b06f47e38caa85c..9fce446d5180969a242356a058e92109d9f0deb1 100644 --- a/test/systemtest/src/power_mgr_powersavemode_test.cpp +++ b/test/systemtest/src/power_mgr_powersavemode_test.cpp @@ -40,7 +40,7 @@ using namespace std; void PowerMgrPowerSavemodeTest::PowerModeTest1Callback::PowerModeCallback() { - POWER_HILOGD(MODULE_SERVICE, "PowerModeTest1Callback::PowerModeCallback."); + POWER_HILOGD(LABEL_TEST, "PowerModeTest1Callback::PowerModeCallback."); } void PowerMgrPowerSavemodeTest::SetUpTestCase(void) @@ -286,7 +286,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_032, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_032 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_032 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_032 1."); } /** @@ -299,7 +299,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_033, TestSize.Level0) GTEST_LOG_(INFO) << "PowerSavemode_033: RegisterPowerModeCallback start."; auto& powerMgrClient = PowerMgrClient::GetInstance(); - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_033 Start."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_033 Start."); const sptr cb1 = new PowerModeTest1Callback(); powerMgrClient.RegisterPowerModeCallback(cb1); sleep(SLEEP_WAIT_TIME_S); @@ -309,7 +309,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_033, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_NE(mode, mode1) << "PowerSavemode_033 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_033 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_033 1."); } /** @@ -331,7 +331,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_034, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_034 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_034 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_034 1."); } /** @@ -356,7 +356,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_035, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_035 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_035 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_035 1."); } /** @@ -378,7 +378,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_036, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_036 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_036 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_036 1."); } /** @@ -400,7 +400,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_037, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_NE(mode, mode1) << "PowerSavemode_036 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_037 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_037 1."); } /** @@ -422,7 +422,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_038, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_036 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_038 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_038 1."); } /** @@ -447,7 +447,7 @@ HWTEST_F (PowerMgrPowerSavemodeTest, PowerSavemode_039, TestSize.Level0) mode = powerMgrClient.GetDeviceMode(); EXPECT_EQ(mode, mode1) << "PowerSavemode_036 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_039 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_039 1."); } } @@ -463,12 +463,12 @@ void PowerMgrPowerSavemodeTest::CommonEventServiCesSystemTest::OnReceiveEvent(co { std::string action = data.GetWant().GetAction(); if (action == CommonEventSupport::COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED) { - POWER_HILOGD(MODULE_SERVICE, "CommonEventServiCesSystemTest::OnReceiveEvent."); + POWER_HILOGD(LABEL_TEST, "CommonEventServiCesSystemTest::OnReceiveEvent."); g_i = g_judgeNum; } uint32_t j = 2; EXPECT_EQ(g_i, j) << "PowerSavemode_022 fail to PowerModeCallback"; - POWER_HILOGD(MODULE_SERVICE, "CommonEventServiCesSystemTest::OnReceiveEvent other."); + POWER_HILOGD(LABEL_TEST, "CommonEventServiCesSystemTest::OnReceiveEvent other."); } namespace { @@ -495,7 +495,7 @@ HWTEST_F(PowerMgrPowerSavemodeTest, PowerSavemode_022, TestSize.Level0) sleep(SLEEP_WAIT_TIME_S); CommonEventManager::UnSubscribeCommonEvent(subscriberPtr); - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_022 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_022 1."); } /** @@ -521,7 +521,7 @@ HWTEST_F(PowerMgrPowerSavemodeTest, PowerSavemode_023, TestSize.Level0) sleep(SLEEP_WAIT_TIME_S); CommonEventManager::UnSubscribeCommonEvent(subscriberPtr); - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_023 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_023 1."); } /** @@ -547,7 +547,7 @@ HWTEST_F(PowerMgrPowerSavemodeTest, PowerSavemode_024, TestSize.Level0) sleep(SLEEP_WAIT_TIME_S); CommonEventManager::UnSubscribeCommonEvent(subscriberPtr); - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_024 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_024 1."); } /** @@ -573,6 +573,6 @@ HWTEST_F(PowerMgrPowerSavemodeTest, PowerSavemode_025, TestSize.Level0) sleep(SLEEP_WAIT_TIME_S); CommonEventManager::UnSubscribeCommonEvent(subscriberPtr); - POWER_HILOGD(MODULE_SERVICE, "PowerSavemode_025 1."); + POWER_HILOGD(LABEL_TEST, "PowerSavemode_025 1."); } } \ No newline at end of file diff --git a/test/systemtest/src/power_mgr_st_mock_test.cpp b/test/systemtest/src/power_mgr_st_mock_test.cpp index f675f03cc7b89ec83123ed0138e56f03730dda94..dde65959ef8725ae829a000afd024f21d6708b34 100644 --- a/test/systemtest/src/power_mgr_st_mock_test.cpp +++ b/test/systemtest/src/power_mgr_st_mock_test.cpp @@ -28,7 +28,7 @@ static MockLockAction* g_lockAction; static void ResetMockAction() { - POWER_HILOGD(MODULE_SERVICE, "ResetMockAction:Start."); + POWER_HILOGD(LABEL_TEST, "ResetMockAction:Start."); g_stateAction = new MockStateAction(); g_powerAction = new MockPowerAction(); g_lockAction = new MockLockAction(); @@ -70,7 +70,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock001, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock001: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock001:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock001:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -85,7 +85,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock001, TestSize.Level2) sleep(ASYNC_WAIT_TIME_S); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock001:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock001:End."); GTEST_LOG_(INFO) << "PowerMgrMock001: end."; } @@ -98,7 +98,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock002, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock002: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock002:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock002:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -112,7 +112,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock002, TestSize.Level2) sleep(ASYNC_WAIT_TIME_S); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock002:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock002:End."); GTEST_LOG_(INFO) << "PowerMgrMock002: end."; } @@ -127,23 +127,23 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock003, TestSize.Level2) sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock003: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock003:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock003:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { GTEST_LOG_(INFO) << "PowerMgrMock003: Failed to get PowerMgrService"; } - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock003:Start mock."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock003:Start mock."); EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, Suspend(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false)); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock003:Start suspend."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock003:Start suspend."); pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock003:end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock003:end."); GTEST_LOG_(INFO) << "PowerMgrMock003: end."; } @@ -156,7 +156,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock004, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock004: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock004:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock004:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -171,7 +171,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock004, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_DEVICE_ADMIN, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock004:End ."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock004:End ."); GTEST_LOG_(INFO) << "PowerMgrMock004: end."; } @@ -184,7 +184,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock005, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock005: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock005:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock005:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -199,7 +199,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock005, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_TIMEOUT, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock005:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock005:End"); GTEST_LOG_(INFO) << "PowerMgrMock005: end."; } @@ -212,7 +212,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock006, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock006: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock006:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock006:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -227,7 +227,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock006, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_LID_SWITCH, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock006:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock006:End."); GTEST_LOG_(INFO) << "PowerMgrMock006: end."; } @@ -240,7 +240,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock007, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock007: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock007:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock007:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -255,7 +255,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock007, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_POWER_BUTTON, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock007:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock007:End."); GTEST_LOG_(INFO) << "PowerMgrMock007: end."; } @@ -268,7 +268,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock008, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock008: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock008:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock008:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -283,7 +283,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock008, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_HDMI, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock008:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock008:End."); GTEST_LOG_(INFO) << "PowerMgrMock008: end."; } @@ -296,7 +296,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock009, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock009: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock009:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock009:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -311,7 +311,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock009, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_SLEEP_BUTTON, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock009:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock009:End."); GTEST_LOG_(INFO) << "PowerMgrMock009: end."; } @@ -324,7 +324,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock010, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock010: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock010:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock010:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -339,7 +339,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock010, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_ACCESSIBILITY, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock010:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock010:End."); GTEST_LOG_(INFO) << "PowerMgrMock010: end."; } @@ -352,7 +352,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock011, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock011: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock011:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock011:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -367,7 +367,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock011, TestSize.Level2) pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_FORCE_SUSPEND, false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock011:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock011:End."); GTEST_LOG_(INFO) << "PowerMgrMock011: end."; } @@ -380,7 +380,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock012, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock012: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock012:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock012:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -397,7 +397,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock012, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock012:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock012:End."); GTEST_LOG_(INFO) << "PowerMgrMock012: end."; } @@ -410,7 +410,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock013, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock013: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock013:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock013:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -427,7 +427,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock013, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock013:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock013:End."); GTEST_LOG_(INFO) << "PowerMgrMock013: end."; } @@ -440,7 +440,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock014, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock014: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock014:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock014:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -457,7 +457,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock014, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock014:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock014:End."); GTEST_LOG_(INFO) << "PowerMgrMock014: end."; } @@ -470,7 +470,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock015, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock015: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock015:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock015:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -487,7 +487,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock015, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_PLUGGED_IN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock015:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock015:End."); GTEST_LOG_(INFO) << "PowerMgrMock015: end."; } @@ -500,7 +500,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock016, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock016: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock016:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock016:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -517,7 +517,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock016, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_GESTURE, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock016:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock016:End."); GTEST_LOG_(INFO) << "PowerMgrMock016: end."; } @@ -530,7 +530,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock017, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock017: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock017:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock017:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -547,7 +547,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock017, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_CAMERA_LAUNCH, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock017:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock017:End."); GTEST_LOG_(INFO) << "PowerMgrMock017: end."; } @@ -560,7 +560,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock018, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock018: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock018:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock018:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -577,7 +577,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock018, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_KEY, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock018:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock018:End."); GTEST_LOG_(INFO) << "PowerMgrMock018: end."; } @@ -590,7 +590,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock019, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock019: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock019:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock019:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -607,7 +607,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock019, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_MOTION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock019:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock019:End."); GTEST_LOG_(INFO) << "PowerMgrMock019: end."; } @@ -620,7 +620,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock020, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock020: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock020:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock020:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -637,7 +637,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock020, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_HDMI, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock020:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock020:End."); GTEST_LOG_(INFO) << "PowerMgrMock020: end."; } @@ -650,7 +650,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock021, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock021: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock021:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock021:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -667,7 +667,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock021, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_LID, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock021:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock021:End."); GTEST_LOG_(INFO) << "PowerMgrMock021: end."; } @@ -680,7 +680,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock022, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock022: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock022:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock022:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -702,7 +702,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock022, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock022:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock022:End."); GTEST_LOG_(INFO) << "PowerMgrMock022: end."; } @@ -715,7 +715,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock023, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock023: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock023:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock023:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -737,7 +737,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock023, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock023:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock023:End."); GTEST_LOG_(INFO) << "PowerMgrMock023: end."; } @@ -750,7 +750,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock024, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock024: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock024:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock024:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -769,7 +769,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock024, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock024:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock024:End."); GTEST_LOG_(INFO) << "PowerMgrMock024: end."; } @@ -782,7 +782,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock025, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock025: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock025:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock025:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -795,7 +795,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock025, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock025:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock025:End."); GTEST_LOG_(INFO) << "PowerMgrMock025: end."; } @@ -808,7 +808,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock026, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock026: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock026:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock026:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -821,7 +821,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock026, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock026:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock026:End"); GTEST_LOG_(INFO) << "PowerMgrMock026: end."; } @@ -834,7 +834,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock027, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock027: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock027:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock027:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -847,7 +847,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock027, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock027:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock027:End."); GTEST_LOG_(INFO) << "PowerMgrMock027: end."; } @@ -860,7 +860,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock028, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock028: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock028:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock028:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -873,7 +873,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock028, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock028:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock028:End."); GTEST_LOG_(INFO) << "PowerMgrMock028: end."; } @@ -886,7 +886,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock029, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock029: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock029:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock029:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -899,7 +899,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock029, TestSize.Level2) EXPECT_EQ(pms->ForceSuspendDevice(0), true); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock029:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock029:End."); GTEST_LOG_(INFO) << "PowerMgrMock029: end."; } @@ -912,7 +912,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock030, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock030: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock030:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock030:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -932,7 +932,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock030, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock030:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock030:End."); GTEST_LOG_(INFO) << "PowerMgrMock030: end."; } @@ -945,7 +945,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock031, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock031: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock031:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock031:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -969,7 +969,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock031, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock031:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock031:End."); GTEST_LOG_(INFO) << "PowerMgrMock031: end."; } @@ -982,7 +982,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock032, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock032: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock032:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock032:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1006,7 +1006,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock032, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock032:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock032:End."); GTEST_LOG_(INFO) << "PowerMgrMock032: end."; } @@ -1019,7 +1019,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock033, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock033: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock033:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock033:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1036,7 +1036,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock033, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock033:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock033:End."); GTEST_LOG_(INFO) << "PowerMgrMock033: end."; } @@ -1049,7 +1049,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock034, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock034: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock034:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock034:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1068,7 +1068,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock034, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock034:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock034:End."); GTEST_LOG_(INFO) << "PowerMgrMock034: end."; } @@ -1081,7 +1081,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock035, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock035: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock035:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock035:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1100,7 +1100,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock035, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock035:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock035:End."); GTEST_LOG_(INFO) << "PowerMgrMock035: end."; } @@ -1113,7 +1113,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock036, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock036: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock036:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock036:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1132,7 +1132,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock036, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock036:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock036:End."); GTEST_LOG_(INFO) << "PowerMgrMock036: end."; } @@ -1145,7 +1145,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock037, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock037: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock037:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock037:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1164,7 +1164,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock037, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock037:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock037:End."); GTEST_LOG_(INFO) << "PowerMgrMock037: end."; } @@ -1177,7 +1177,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock038, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock038: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock038:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock038:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1196,7 +1196,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock038, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock038:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock038:End."); GTEST_LOG_(INFO) << "PowerMgrMock038: end."; } @@ -1210,7 +1210,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock039, TestSize.Level2) UserActivityType abnormaltype= {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock039: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock039:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock039:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1228,7 +1228,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock039, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock039:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock039:End."); GTEST_LOG_(INFO) << "PowerMgrMock039: end."; } @@ -1242,7 +1242,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock040, TestSize.Level2) UserActivityType abnormaltype=UserActivityType(6); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock040: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock040:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock040:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1263,7 +1263,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock040, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock040:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock040:End."); GTEST_LOG_(INFO) << "PowerMgrMock040: end."; } @@ -1278,7 +1278,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock041, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(wakeupReason); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock041: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock041:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock041:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1295,7 +1295,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock041, TestSize.Level2) EXPECT_EQ(pms->IsScreenOn(), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock041:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock041:End."); GTEST_LOG_(INFO) << "PowerMgrMock041: end."; } @@ -1309,7 +1309,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock042, TestSize.Level2) WakeupDeviceType abnormaltype=WakeupDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock042: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock042:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock042:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1326,7 +1326,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock042, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock042:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock042:End."); GTEST_LOG_(INFO) << "PowerMgrMock042: end."; } @@ -1339,7 +1339,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock043, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock043: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock043:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock043:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1358,7 +1358,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock043, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock043:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock043:End."); GTEST_LOG_(INFO) << "PowerMgrMock043: end."; } @@ -1373,7 +1373,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock044, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(wakeupReason); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock044: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock044:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock044:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1392,7 +1392,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock044, TestSize.Level2) ResetMockAction(); GTEST_LOG_(INFO) << "PowerMgrMock044: end."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock044:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock044:End."); } /** @@ -1405,7 +1405,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock045, TestSize.Level2) WakeupDeviceType abnormaltype = WakeupDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock045: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock045:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock045:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1426,7 +1426,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock045, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3)/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock045:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock045:End."); GTEST_LOG_(INFO) << "PowerMgrMock045: end."; } @@ -1440,7 +1440,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock046, TestSize.Level2) UserActivityType abnormaltype = UserActivityType(6); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock046: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock046:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock046:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1457,7 +1457,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock046, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock046:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock046:End."); GTEST_LOG_(INFO) << "PowerMgrMock046: end."; } @@ -1471,7 +1471,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock047, TestSize.Level2) UserActivityType abnormaltype = {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock047: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock047:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock047:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1488,7 +1488,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock047, TestSize.Level2) sleep(SCREEN_OFF_WAIT_TIME_S + SLEEP_WAIT_TIME_S/2 + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock047:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock047:End."); GTEST_LOG_(INFO) << "PowerMgrMock047: end."; } @@ -1501,7 +1501,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock048, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock048: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock048:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock048:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1523,7 +1523,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock048, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock048:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock048:End"); GTEST_LOG_(INFO) << "PowerMgrMock048: end."; } @@ -1537,7 +1537,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock049, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(10); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock049: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock049:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock049:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1552,7 +1552,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock049, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock049:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock049:End."); GTEST_LOG_(INFO) << "PowerMgrMock049: end."; } @@ -1566,7 +1566,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock050, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(999); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock050: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock050:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock050:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1581,7 +1581,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock050, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock050:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock050:End."); GTEST_LOG_(INFO) << "PowerMgrMock050: end."; } @@ -1595,7 +1595,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock052, TestSize.Level2) SuspendDeviceType abnormaltype = SuspendDeviceType(10); sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock052: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock052:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock052:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1609,7 +1609,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock052, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock052:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock052:End."); GTEST_LOG_(INFO) << "PowerMgrMock052: end."; } @@ -1623,7 +1623,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock053, TestSize.Level2) SuspendDeviceType abnormaltype = {}; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock053: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock053:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock053:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1637,7 +1637,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock053, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock053:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock053:End."); GTEST_LOG_(INFO) << "PowerMgrMock053: end."; } @@ -1650,7 +1650,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock054, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock054: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock054:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock054:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1666,7 +1666,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock054, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock054:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock054:End."); GTEST_LOG_(INFO) << "PowerMgrMock054: end."; } @@ -1679,7 +1679,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock055, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock055: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock055:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock055:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1701,7 +1701,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock055, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock055:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock055:End."); GTEST_LOG_(INFO) << "PowerMgrMock055: end."; } @@ -1714,7 +1714,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock056, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock056: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock056:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock056:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1738,7 +1738,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock056, TestSize.Level2) pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock056:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock056:End."); GTEST_LOG_(INFO) << "PowerMgrMock056: end."; } @@ -1751,7 +1751,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock057, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock057: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock057:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock057:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1772,7 +1772,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock057, TestSize.Level2) pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock057:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock057:End."); GTEST_LOG_(INFO) << "PowerMgrMock057: end."; } @@ -1818,7 +1818,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock059, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock059: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock059:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock059:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1837,7 +1837,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock059, TestSize.Level2) pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock059:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock059:End."); GTEST_LOG_(INFO) << "PowerMgrMock059: end."; } @@ -1850,7 +1850,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock060, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock060: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock060:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock060:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1869,7 +1869,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock060, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock060:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock060:End."); GTEST_LOG_(INFO) << "PowerMgrMock060: end."; } @@ -1883,7 +1883,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock061, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock061: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock061:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock061:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1905,7 +1905,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock061, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock061:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock061:End."); GTEST_LOG_(INFO) << "PowerMgrMock061: end."; } @@ -1918,7 +1918,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock062, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock062: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock062:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock062:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1946,7 +1946,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock062, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock062:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock062:End."); GTEST_LOG_(INFO) << "PowerMgrMock062: end."; } @@ -1959,7 +1959,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock063, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock063: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock063:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock063:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -1985,7 +1985,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock063, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock063:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock063:End."); GTEST_LOG_(INFO) << "PowerMgrMock063: end."; } @@ -1998,7 +1998,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock064, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock064: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock063:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock063:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2023,7 +2023,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock064, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock064:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock064:End."); GTEST_LOG_(INFO) << "PowerMgrMock064: end."; } @@ -2036,7 +2036,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock065, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock065: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock065:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock065:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2059,7 +2059,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock065, TestSize.Level2) pms->UnLock(token); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock065:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock065:End."); GTEST_LOG_(INFO) << "PowerMgrMock065: end."; } @@ -2072,7 +2072,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock066, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock066: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock066:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock066:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2103,7 +2103,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock066, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock066:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock066:End."); GTEST_LOG_(INFO) << "PowerMgrMock066: end."; } @@ -2116,7 +2116,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock067, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock067: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock067:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock067:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2143,7 +2143,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock067, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock067:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock067:End."); GTEST_LOG_(INFO) << "PowerMgrMock067: end."; } @@ -2157,7 +2157,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock068, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock068: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock068:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock068:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2194,7 +2194,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock068, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock068:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock068:End."); GTEST_LOG_(INFO) << "PowerMgrMock068: end."; } @@ -2207,7 +2207,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock069, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock069: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock069:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock069:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2236,7 +2236,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock069, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock069:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock069:End"); GTEST_LOG_(INFO) << "PowerMgrMock069: end."; } @@ -2249,7 +2249,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock070, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock070: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock070:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock070:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2277,7 +2277,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock070, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock070:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock070:End."); GTEST_LOG_(INFO) << "PowerMgrMock070: end."; } @@ -2290,7 +2290,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock071, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock071: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock071:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock071:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2317,7 +2317,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock071, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock071:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock071:End."); GTEST_LOG_(INFO) << "PowerMgrMock071: end."; } @@ -2331,7 +2331,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock072, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock072: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock072:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock072:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2357,7 +2357,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock072, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock072:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock072:End."); GTEST_LOG_(INFO) << "PowerMgrMock072: end."; } @@ -2370,7 +2370,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock073, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock073: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock073:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock073:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2405,7 +2405,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock073, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock073:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock073:End."); GTEST_LOG_(INFO) << "PowerMgrMock073: end."; } @@ -2418,7 +2418,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock074, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock074: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock074:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock074:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2441,7 +2441,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock074, TestSize.Level2) pms->MockProximity(RunningLockMgr::PROXIMITY_CLOSE); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock074:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock074:End."); GTEST_LOG_(INFO) << "PowerMgrMock074: end."; } @@ -2454,7 +2454,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock075, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock075: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock075:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock075:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2476,7 +2476,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock075, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock075:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock075:End."); GTEST_LOG_(INFO) << "PowerMgrMock075: end."; } @@ -2490,7 +2490,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock076, TestSize.Level2) int i; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock076: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock076:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock076:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2518,7 +2518,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock076, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock076:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock076:End."); GTEST_LOG_(INFO) << "PowerMgrMock076: end."; } @@ -2531,7 +2531,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock077, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock077: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock077:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock077:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2563,7 +2563,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock077, TestSize.Level2) EXPECT_EQ(PowerState::SLEEP, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock077:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock077:End."); GTEST_LOG_(INFO) << "PowerMgrMock077: end."; } @@ -2576,7 +2576,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock078, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock078: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock078:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock078:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2601,7 +2601,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock078, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), false); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock078:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock078:End."); GTEST_LOG_(INFO) << "PowerMgrMock078: end."; } @@ -2614,7 +2614,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock079, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock079: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock079:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock079:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2634,7 +2634,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock079, TestSize.Level2) EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock079:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock079:End."); GTEST_LOG_(INFO) << "PowerMgrMock079: end."; } @@ -2648,7 +2648,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock080, TestSize.Level2) int64_t time =15000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock080: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock080:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock080:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2673,7 +2673,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock080, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S+1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock080:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock080:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrMock080: end."; } @@ -2688,7 +2688,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock081, TestSize.Level2) int64_t time =30000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock081: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock081:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock081:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2713,7 +2713,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock081, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S+1); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock081:End"); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock081:End"); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrMock081: end."; } @@ -2880,7 +2880,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock086, TestSize.Level2) int64_t time =15000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock086: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock086:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2888,7 +2888,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock086, TestSize.Level2) } pms->SetDisplayOffTime(time); pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:DeviceStateAction::SetDisplayState."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock086:DeviceStateAction::SetDisplayState."); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) @@ -2897,15 +2897,15 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock086, TestSize.Level2) EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:Start sleep."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock086:Start sleep."); sleep(time/1000-2); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); sleep(3); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086: sleep end."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock086: sleep end."); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock086:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrMock086: end."; } @@ -2920,7 +2920,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock087, TestSize.Level2) int64_t time =30000; sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock087: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock0087:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock0087:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -2941,7 +2941,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock087, TestSize.Level2) sleep(3); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock087:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock087:End."); pms->SetDisplayOffTime(DEFAULT_DISPLAY_OFF_TIME); GTEST_LOG_(INFO) << "PowerMgrMock087: end."; } @@ -3057,7 +3057,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock091, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock091: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock091:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock091:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3084,7 +3084,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock091, TestSize.Level2) EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock091:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock091:End."); GTEST_LOG_(INFO) << "PowerMgrMock091: end."; } @@ -3097,7 +3097,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock092, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock092: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock092:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock092:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3118,7 +3118,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock092, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock092:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock092:End."); GTEST_LOG_(INFO) << "PowerMgrMock092: end."; } @@ -3131,7 +3131,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock093, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock093: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock093:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock093:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3152,7 +3152,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock093, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock093:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock093:End."); GTEST_LOG_(INFO) << "PowerMgrMock093: end."; } @@ -3165,7 +3165,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock094, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock094: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock094:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock094:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3186,7 +3186,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock094, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock094:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock094:End."); GTEST_LOG_(INFO) << "PowerMgrMock094: end."; } @@ -3199,7 +3199,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock095, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock095: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock095:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock095:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3220,7 +3220,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock095, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_PLUGGED_IN, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock095:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock095:End."); GTEST_LOG_(INFO) << "PowerMgrMock095: end."; } @@ -3233,7 +3233,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock096, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock096: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock096:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock096:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3254,7 +3254,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock096, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_GESTURE, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock096:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock096:End."); GTEST_LOG_(INFO) << "PowerMgrMock096: end."; } @@ -3267,7 +3267,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock097, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock097: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock097:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock097:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3288,7 +3288,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock097, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_CAMERA_LAUNCH, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock097:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock097:End."); GTEST_LOG_(INFO) << "PowerMgrMock097: end."; } @@ -3301,7 +3301,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock098, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock098: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock098:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock098:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3322,7 +3322,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock098, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_KEY, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock098:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock098:End."); GTEST_LOG_(INFO) << "PowerMgrMock098: end."; } @@ -3335,7 +3335,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock099, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock099: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock099:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock099:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3356,7 +3356,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock099, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_WAKE_MOTION, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock099:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock099:End."); GTEST_LOG_(INFO) << "PowerMgrMock099: end."; } @@ -3369,7 +3369,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock100, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock100: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock100:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock100:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3390,7 +3390,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock100, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_HDMI, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock100:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock100:End."); GTEST_LOG_(INFO) << "PowerMgrMock100: end."; } @@ -3403,7 +3403,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock101, TestSize.Level2) { sleep(NEXT_WAIT_TIME_S); GTEST_LOG_(INFO) << "PowerMgrMock101: start."; - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock101:Start."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock101:Start."); sptr pms = DelayedSpSingleton::GetInstance(); if (pms == nullptr) { @@ -3424,7 +3424,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock101, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_LID, std::string("test")); ResetMockAction(); - POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock101:End."); + POWER_HILOGD(LABEL_TEST, "PowerMgrMock101:End."); GTEST_LOG_(INFO) << "PowerMgrMock101: end."; } } diff --git a/utils/native/include/hilog_wrapper.h b/utils/native/include/hilog_wrapper.h deleted file mode 100644 index fda46d888bfa4a519313ed69945c4481df93b790..0000000000000000000000000000000000000000 --- a/utils/native/include/hilog_wrapper.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWERMGR_HILOG_WRAPPER_H -#define POWERMGR_HILOG_WRAPPER_H - -#define CONFIG_HILOG -#ifdef CONFIG_HILOG -#include "hilog/log.h" -namespace OHOS { -namespace PowerMgr { -#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) -#define __FORMATED(fmt, ...) "[%{public}s] %{public}s# " fmt, __FILENAME__, __FUNCTION__, ##__VA_ARGS__ - -#ifdef POWER_HILOGF -#undef POWER_HILOGF -#endif - -#ifdef POWER_HILOGE -#undef POWER_HILOGE -#endif - -#ifdef POWER_HILOGW -#undef POWER_HILOGW -#endif - -#ifdef POWER_HILOGI -#undef POWER_HILOGI -#endif - -#ifdef POWER_HILOGD -#undef POWER_HILOGD -#endif - -// param of log interface, such as POWER_HILOGF. -enum PowerMgrSubModule { - MODULE_INNERKIT = 0, - MODULE_SERVICE, - MODULE_JAVAKIT, // java kit, defined to avoid repeated use of domain. - MODULE_JNI, - MODULE_BATT_INNERKIT, // below used by battery service - MODULE_BATT_SERVICE, - MODULE_BATTERYD, - MODULE_COMMON, // used both by battery and powermgr - MODULE_JS_NAPI, - POWERMGR_MODULE_BUTT, -}; - -// 0xD002900: subsystem:PowerMgr module:PowerManager, 8 bits reserved. -static constexpr unsigned int BASE_POWERMGR_DOMAIN_ID = 0xD002900; - -enum PowerMgrDomainId { - POWERMGR_INNERKIT_DOMAIN = BASE_POWERMGR_DOMAIN_ID + MODULE_INNERKIT, - POWERMGR_SERVICE_DOMAIN, - POWERMGR_JAVAKIT_DOMAIN, - BATT_INNERKIT_DOMAIN, - BATT_SERVICE_DOMAIN, - BATTERYD_DOMAIN, - COMMON_DOMAIN, - POWERMGR_JS_NAPI, - POWERMGR_BUTT, -}; - -static constexpr OHOS::HiviewDFX::HiLogLabel POWER_MGR_LABEL[POWERMGR_MODULE_BUTT] = { - {LOG_CORE, POWERMGR_INNERKIT_DOMAIN, "PowerMgrClient"}, - {LOG_CORE, POWERMGR_SERVICE_DOMAIN, "PowerMgrService"}, - {LOG_CORE, POWERMGR_JAVAKIT_DOMAIN, "PowerMgrJavaService"}, - {LOG_CORE, POWERMGR_INNERKIT_DOMAIN, "PowerMgrJni"}, - {LOG_CORE, BATT_INNERKIT_DOMAIN, "BatterySrvClient"}, - {LOG_CORE, BATT_SERVICE_DOMAIN, "BatteryService"}, - {LOG_CORE, BATTERYD_DOMAIN, "Batteryd"}, - {LOG_CORE, COMMON_DOMAIN, "PowerMgrCommon"}, - {LOG_CORE, POWERMGR_JS_NAPI, "PowerMgrJSNAPI"}, -}; - -// In order to improve performance, do not check the module range. -// Besides, make sure module is less than POWERMGR_MODULE_BUTT. -#define POWER_HILOGF(module, ...) (void)OHOS::HiviewDFX::HiLog::Fatal(POWER_MGR_LABEL[module], __FORMATED(__VA_ARGS__)) -#define POWER_HILOGE(module, ...) (void)OHOS::HiviewDFX::HiLog::Error(POWER_MGR_LABEL[module], __FORMATED(__VA_ARGS__)) -#define POWER_HILOGW(module, ...) (void)OHOS::HiviewDFX::HiLog::Warn(POWER_MGR_LABEL[module], __FORMATED(__VA_ARGS__)) -#define POWER_HILOGI(module, ...) (void)OHOS::HiviewDFX::HiLog::Info(POWER_MGR_LABEL[module], __FORMATED(__VA_ARGS__)) -#define POWER_HILOGD(module, ...) (void)OHOS::HiviewDFX::HiLog::Debug(POWER_MGR_LABEL[module], __FORMATED(__VA_ARGS__)) - -} // namespace PowerMgr -} // namespace OHOS - -#else - -#define POWER_HILOGF(...) -#define POWER_HILOGE(...) -#define POWER_HILOGW(...) -#define POWER_HILOGI(...) -#define POWER_HILOGD(...) - -#endif // CONFIG_HILOG - -#endif // POWERMGR_HILOG_WRAPPER_H diff --git a/utils/native/include/power_common.h b/utils/native/include/power_common.h index 2b4f49602658575b92a2eaab17c26a65d5bf4a17..8c09f0d5dfbc88a8755450c9990d1691f44be6d6 100644 --- a/utils/native/include/power_common.h +++ b/utils/native/include/power_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,7 +19,7 @@ #include #include -#include "hilog_wrapper.h" +#include "power_log.h" #include "power_mgr_errors.h" namespace OHOS { @@ -29,7 +29,7 @@ namespace PowerMgr { #define RETURN_IF_WITH_LOG(cond, loginfo) \ do { \ if (cond) { \ - POWER_HILOGE(MODULE_COMMON, "%{public}s "#loginfo" ", __func__); \ + POWER_HILOGE(COMP_FWK, #loginfo); \ return; \ } \ } while (0) \ @@ -37,7 +37,7 @@ namespace PowerMgr { #define READ_PARCEL_NO_RET(parcel, type, out) \ do { \ if (!(parcel).Read##type(out)) { \ - POWER_HILOGE(MODULE_COMMON, "%{public}s read "#out" failed", __func__); \ + POWER_HILOGE(COMP_FWK, "read "#out" failed"); \ return; \ } \ } while (0) \ @@ -45,7 +45,7 @@ namespace PowerMgr { #define WRITE_PARCEL_NO_RET(parcel, type, data) \ do { \ if (!(parcel).Write##type(data)) { \ - POWER_HILOGE(MODULE_COMMON, "%{public}s write "#data" failed", __func__); \ + POWER_HILOGE(COMP_FWK, "write "#data" failed"); \ return; \ } \ } while (0) \ @@ -53,7 +53,7 @@ namespace PowerMgr { #define READ_PARCEL_WITH_RET(parcel, type, out, retval) \ do { \ if (!(parcel).Read##type(out)) { \ - POWER_HILOGE(MODULE_COMMON, "%{public}s read "#out" failed", __func__); \ + POWER_HILOGE(COMP_FWK, "read "#out" failed"); \ return (retval); \ } \ } while (0) \ @@ -61,7 +61,7 @@ namespace PowerMgr { #define WRITE_PARCEL_WITH_RET(parcel, type, data, retval) \ do { \ if (!(parcel).Write##type(data)) { \ - POWER_HILOGE(MODULE_COMMON, "%{public}s write "#data" failed", __func__); \ + POWER_HILOGE(COMP_FWK, "write "#data" failed"); \ return (retval); \ } \ } while (0) diff --git a/utils/native/include/power_log.h b/utils/native/include/power_log.h new file mode 100755 index 0000000000000000000000000000000000000000..555dd74822958e54769f83a0fe727fd6b46068aa --- /dev/null +++ b/utils/native/include/power_log.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef POWER_LOG_H +#define POWER_LOG_H + +#define CONFIG_HILOG +#ifdef CONFIG_HILOG + +#include "hilog/log.h" + +namespace OHOS { +namespace PowerMgr { +#define FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) +#define FORMATED(fmt, ...) \ + "[%{public}s:%{public}d] %{public}s# " fmt, FILENAME, __LINE__, __FUNCTION__, ##__VA_ARGS__ + +#ifdef POWER_HILOGF +#undef POWER_HILOGF +#endif + +#ifdef POWER_HILOGE +#undef POWER_HILOGE +#endif + +#ifdef POWER_HILOGW +#undef POWER_HILOGW +#endif + +#ifdef POWER_HILOGI +#undef POWER_HILOGI +#endif + +#ifdef POWER_HILOGD +#undef POWER_HILOGD +#endif + +namespace { +// Power manager reserved domain id range +constexpr unsigned int POWER_DOMAIN_ID_START = 0xD002900; +constexpr unsigned int POWER_DOMAIN_ID_END = POWER_DOMAIN_ID_START + 32; +constexpr unsigned int TEST_DOMAIN_ID = 0xD000F00; +} + +enum PowerManagerLogLabel { + // Component labels, you can add if needed + COMP_APP = 0, + COMP_FWK = 1, + COMP_SVC = 2, + COMP_HDI = 3, + COMP_DRV = 4, + // Feature labels, use to mark major features + FEATURE_WAKEUP, + FEATURE_SUSPEND, + FEATURE_RUNNING_LOCK, + FEATURE_ACTIVITY, + FEATURE_POWER_STATE, + FEATURE_POWER_MODE, + FEATURE_SHUTDOWN, + FEATURE_INPUT, + // Test label + LABEL_TEST, + // The end of labels, max to the domain id range length 32 + LABEL_END, +}; + +enum PowerManagerLogDomain { + DOMAIN_APP = POWER_DOMAIN_ID_START + COMP_APP, // 0xD002900 + DOMAIN_FRAMEWORK, // 0xD002921 + DOMAIN_SERVICE, // 0xD002922 + DOMAIN_HDI, // 0xD002923 + DOMAIN_DRIVER, // 0xD002924 + DOMAIN_FEATURE_WAKEUP, + DOMAIN_FEATURE_SUSPEND, + DOMAIN_FEATURE_RUNNING_LOCK, + DOMAIN_FEATURE_ACTIVITY, + DOMAIN_FEATURE_POWER_STATE, + DOMAIN_FEATURE_POWER_MODE, + DOMAIN_FEATURE_SHUTDOWN, + DOMAIN_FEATURE_INPUT, + DOMAIN_TEST = TEST_DOMAIN_ID, // 0xD000F00 + DOMAIN_END = POWER_DOMAIN_ID_END, // Max to 0xD002920, keep the sequence and length same as PowerManagerLogLabel +}; + +// Keep the sequence and length same as PowerManagerLogDomain +static constexpr OHOS::HiviewDFX::HiLogLabel POWER_LABEL[LABEL_END] = { + {LOG_CORE, DOMAIN_APP, "PowerApp"}, + {LOG_CORE, DOMAIN_FRAMEWORK, "PowerFwk"}, + {LOG_CORE, DOMAIN_SERVICE, "PowerSvc"}, + {LOG_CORE, DOMAIN_HDI, "PowerHdi"}, + {LOG_CORE, DOMAIN_DRIVER, "PowerDrv"}, + {LOG_CORE, DOMAIN_FEATURE_WAKEUP, "PowerWakeup"}, + {LOG_CORE, DOMAIN_FEATURE_SUSPEND, "PowerSuspend"}, + {LOG_CORE, DOMAIN_FEATURE_RUNNING_LOCK, "PowerRunningLock"}, + {LOG_CORE, DOMAIN_FEATURE_ACTIVITY, "PowerActivity"}, + {LOG_CORE, DOMAIN_FEATURE_POWER_STATE, "PowerState"}, + {LOG_CORE, DOMAIN_FEATURE_POWER_MODE, "PowerMode"}, + {LOG_CORE, DOMAIN_FEATURE_SHUTDOWN, "PowerShutdown"}, + {LOG_CORE, DOMAIN_FEATURE_INPUT, "PowerInput"}, + {LOG_CORE, DOMAIN_TEST, "PowerTest"}, +}; + +#define POWER_HILOGF(domain, ...) (void)OHOS::HiviewDFX::HiLog::Fatal(POWER_LABEL[domain], FORMATED(__VA_ARGS__)) +#define POWER_HILOGE(domain, ...) (void)OHOS::HiviewDFX::HiLog::Error(POWER_LABEL[domain], FORMATED(__VA_ARGS__)) +#define POWER_HILOGW(domain, ...) (void)OHOS::HiviewDFX::HiLog::Warn(POWER_LABEL[domain], FORMATED(__VA_ARGS__)) +#define POWER_HILOGI(domain, ...) (void)OHOS::HiviewDFX::HiLog::Info(POWER_LABEL[domain], FORMATED(__VA_ARGS__)) +#define POWER_HILOGD(domain, ...) (void)OHOS::HiviewDFX::HiLog::Debug(POWER_LABEL[domain], FORMATED(__VA_ARGS__)) + +} // namespace PowerMgr +} // namespace OHOS + +#else + +#define POWER_HILOGF(...) +#define POWER_HILOGE(...) +#define POWER_HILOGW(...) +#define POWER_HILOGI(...) +#define POWER_HILOGD(...) + +#endif // CONFIG_HILOG + +#endif // POWER_LOG_H diff --git a/utils/native/src/permission.cpp b/utils/native/src/permission.cpp index e7f65bd1c4b79b2d2f4067e7d39aeaf689050d57..16fe5ebddc546d0c41ef97684e2fa0cc3857bd06 100644 --- a/utils/native/src/permission.cpp +++ b/utils/native/src/permission.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +22,7 @@ #include "iservice_registry.h" #include "system_ability_definition.h" -#include "hilog_wrapper.h" +#include "power_log.h" using namespace std; using namespace OHOS; @@ -48,13 +48,13 @@ bool Permission::CheckCallingPermission(const string& perm) } else if (type == ATokenTypeEnum::TOKEN_HAP) { result = AccessTokenKit::VerifyAccessToken(tokenId, perm); } else { - POWER_HILOGW(MODULE_SERVICE, + POWER_HILOGW(COMP_SVC, "Access token type error, type=%{public}d, pid=%{public}d, uid=%{public}d, perm=%{public}s", type, pid, uid, perm.c_str()); return false; } bool isPermissionGranted = (result == PermissionState::PERMISSION_GRANTED); - POWER_HILOGI(MODULE_SERVICE, "isPermissionGranted=%{public}d, pid=%{public}d, uid=%{public}d, perm=%{public}s", + POWER_HILOGI(COMP_SVC, "isPermissionGranted=%{public}d, pid=%{public}d, uid=%{public}d, perm=%{public}s", isPermissionGranted, pid, uid, perm.c_str()); return isPermissionGranted; } @@ -66,17 +66,17 @@ sptr GetBundleMgr() } auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (sam == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "GetSystemAbilityManager return nullptr"); + POWER_HILOGW(COMP_SVC, "GetSystemAbilityManager return nullptr"); return nullptr; } auto bundleMgrSa = sam->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); if (bundleMgrSa == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "GetSystemAbility return nullptr"); + POWER_HILOGW(COMP_SVC, "GetSystemAbility return nullptr"); return nullptr; } auto bundleMgr = iface_cast(bundleMgrSa); if (bundleMgr == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "iface_cast return nullptr"); + POWER_HILOGW(COMP_SVC, "iface_cast return nullptr"); } g_bundleMgr = bundleMgr; return g_bundleMgr; @@ -86,7 +86,7 @@ bool Permission::CheckIsSystemAppByUid(int32_t uid) { auto bundleMgr = GetBundleMgr(); if (bundleMgr == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "bundleMgr is nullptr, return false"); + POWER_HILOGW(COMP_SVC, "BundleMgr is nullptr, return false"); return false; } return bundleMgr->CheckIsSystemAppByUid(uid);