diff --git a/frameworks/kitsimpl/src/coauth_proxy.cpp b/frameworks/kitsimpl/src/coauth_proxy.cpp index 1eede8e67a19848f9064e6250fc9dfdcd1c03379..337ec875826a5ff9ad5f212f1ff82e666599436d 100644 --- a/frameworks/kitsimpl/src/coauth_proxy.cpp +++ b/frameworks/kitsimpl/src/coauth_proxy.cpp @@ -144,13 +144,13 @@ void CoAuthProxy::BeginSchedule(uint64_t scheduleId, AuthInfo &authInfo, const s uint64_t callerUid; authInfo.GetCallerUid(callerUid); data.WriteUint64(callerUid); - COAUTH_HILOGD(MODULE_INNERKIT, "write callerUid: %{public}" PRIu64, callerUid); + COAUTH_HILOGD(MODULE_INNERKIT, "write callerUid: 0xXXXX%{public}" PRIx64, MASK & callerUid); if (!data.WriteUint64(scheduleId)) { COAUTH_HILOGE(MODULE_INNERKIT, "write scheduleId failed"); return; } - COAUTH_HILOGD(MODULE_INNERKIT, "write scheduleId: %{public}" PRIu64, scheduleId); + COAUTH_HILOGD(MODULE_INNERKIT, "write scheduleId: 0xXXXX%{public}" PRIx64, MASK & scheduleId); if (!data.WriteRemoteObject(callback->AsObject())) { COAUTH_HILOGE(MODULE_INNERKIT, "write callback failed"); diff --git a/interfaces/innerkits/src/auth_attributes.cpp b/interfaces/innerkits/src/auth_attributes.cpp index 00876b837c6bc9be98cd25424db955a904a33930..4bf09827bd41fd245e2dc5aa423648369cb27d2e 100644 --- a/interfaces/innerkits/src/auth_attributes.cpp +++ b/interfaces/innerkits/src/auth_attributes.cpp @@ -14,7 +14,6 @@ */ #include "auth_attributes.h" -#include namespace OHOS { namespace UserIAM { @@ -334,7 +333,6 @@ std::vector AuthAttributes::GetUint32ArrayFromUint8(std::vector AuthAttributes::GetUint64ArrayFromUint8(std::vector executorInfo, sptr messenger = new UserIAM::AuthResPool::ExecutorMessenger(&coAuthResPool_); callback->OnMessengerReady(messenger); - COAUTH_HILOGD(MODULE_SERVICE, "register is successful, exeID is XXXX%{public}04" PRIx64, executorId); + COAUTH_HILOGD(MODULE_SERVICE, "register is successfull, exeID is 0xXXXX%{public}04" PRIx64, MASK & executorId); return executorId; } diff --git a/services/src/auth_res_pool.cpp b/services/src/auth_res_pool.cpp index 152277f38ff24195cdf4ad2191d8c64bde9c20af..72cba7c74c195e5593eb9a1cd0baac189a755df3 100644 --- a/services/src/auth_res_pool.cpp +++ b/services/src/auth_res_pool.cpp @@ -94,7 +94,7 @@ int32_t AuthResPool::DeleteExecutorCallback(uint64_t executorID) return FAIL; } authResPool_.erase(iter); - COAUTH_HILOGI(MODULE_SERVICE, "delete executor callback XXXX%{public}" PRIx64 " success", executorID); + COAUTH_HILOGI(MODULE_SERVICE, "delete executor callback 0xXXXX%{public}04" PRIx64 " success", MASK & executorID); return SUCCESS; } diff --git a/services/src/call_monitor.cpp b/services/src/call_monitor.cpp index eba46450e98e331b5051b2336427eff4bf9d0381..9cc04f759156fcc3b537ba186dd28cf1d9a6ec1b 100644 --- a/services/src/call_monitor.cpp +++ b/services/src/call_monitor.cpp @@ -14,6 +14,9 @@ */ #include "call_monitor.h" + +#include + #include "inner_event.h" #include "event_runner.h" @@ -40,7 +43,8 @@ void CallMonitor::MonitorCall(int64_t waitTime, uint64_t scheduleId, Callback &t return; } std::string name = std::to_string(scheduleId); - COAUTH_HILOGI(MODULE_SERVICE, "CallMonitor MonitorCall is called, name is %{public}s", name.c_str()); + COAUTH_HILOGI(MODULE_SERVICE, + "CallMonitor MonitorCall is called, name is 0xXXXX%{public}04" PRIx64, MASK & scheduleId); eventHandler_->PostHighPriorityTask(timeoutFun, name, waitTime); } @@ -51,7 +55,8 @@ void CallMonitor::MonitorRemoveCall(uint64_t scheduleId) return; } std::string name = std::to_string(scheduleId); - COAUTH_HILOGI(MODULE_SERVICE, "CallMonitor MonitorRemoveCall is called, name is %{public}s", name.c_str()); + COAUTH_HILOGI(MODULE_SERVICE, + "CallMonitor MonitorRemoveCall is called, name is 0xXXXX%{public}04" PRIx64, MASK & scheduleId); eventHandler_->RemoveTask(name); } } // namespace PinAuth diff --git a/services/src/coauth_service.cpp b/services/src/coauth_service.cpp index 85237a063bfc3c621deb1e5fb3ccb697bbf90f53..3095f9b2812ba6cdfeb7b648d391e2bcb1b6c897 100644 --- a/services/src/coauth_service.cpp +++ b/services/src/coauth_service.cpp @@ -106,7 +106,7 @@ uint64_t CoAuthService::Register(std::shared_ptr executorInfo, } uint64_t exeID = authResMgr_.Register(executorInfo, callback); - COAUTH_HILOGD(MODULE_SERVICE, "exeID is XXXX%{public}4" PRIx64, exeID); + COAUTH_HILOGD(MODULE_SERVICE, "exeID is 0xXXXX%{public}04" PRIx64, MASK & exeID); return exeID; } diff --git a/services/src/coauth_stub.cpp b/services/src/coauth_stub.cpp index 24882100b6e8eea9e98e69498be4b6f944edd92c..04abc976c69c91e6b709a602de37c6ed4fa408f6 100644 --- a/services/src/coauth_stub.cpp +++ b/services/src/coauth_stub.cpp @@ -118,10 +118,10 @@ int32_t CoAuthStub::BeginScheduleStub(MessageParcel& data, MessageParcel& reply) authInfo.SetPkgName(GetPkgName); uint64_t GetCallerUid = data.ReadUint64(); authInfo.SetCallerUid(GetCallerUid); - COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64,GetCallerUid:%{public}" PRIu64, GetCallerUid); + COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64,GetCallerUid:0xXXXX%{public}04" PRIx64, MASK & GetCallerUid); uint64_t scheduleId = data.ReadUint64(); - COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64,scheduleId:%{public}" PRIu64, scheduleId); + COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64,scheduleId:0xXXXX%{public}04" PRIx64, MASK & scheduleId); sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { @@ -139,7 +139,7 @@ int32_t CoAuthStub::CancelStub(MessageParcel& data, MessageParcel& reply) COAUTH_HILOGI(MODULE_SERVICE, "CoAuthStub: CancelStub start"); uint64_t scheduleId = data.ReadUint64(); - COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64 scheduleId:%{public}" PRIu64, scheduleId); + COAUTH_HILOGD(MODULE_SERVICE, "ReadUint64 scheduleId:0xXXXX%{public}04" PRIx64, MASK & scheduleId); int ret = Cancel(scheduleId); if (!reply.WriteInt32(ret)) { diff --git a/utils/native/include/coauth_hilog_wrapper.h b/utils/native/include/coauth_hilog_wrapper.h index 9524fa785689c7d90a9052b92007f05764bc6faa..32ac3ff6ec2cfee3d681dddd2e851fdd2078d1cd 100644 --- a/utils/native/include/coauth_hilog_wrapper.h +++ b/utils/native/include/coauth_hilog_wrapper.h @@ -16,8 +16,6 @@ #ifndef COAUTH_HILOG_WRAPPER_H #define COAUTH_HILOG_WRAPPER_H -#define CONFIG_HILOG -#ifdef CONFIG_HILOG #include "hilog/log.h" namespace OHOS { namespace UserIAM { @@ -78,17 +76,9 @@ static constexpr OHOS::HiviewDFX::HiLogLabel COAUTH_LABEL[COAUTH_MODULE_BUTT] = #define COAUTH_HILOGW(module, ...) (void)OHOS::HiviewDFX::HiLog::Warn(COAUTH_LABEL[module], FORMATTED(__VA_ARGS__)) #define COAUTH_HILOGI(module, ...) (void)OHOS::HiviewDFX::HiLog::Info(COAUTH_LABEL[module], FORMATTED(__VA_ARGS__)) #define COAUTH_HILOGD(module, ...) (void)OHOS::HiviewDFX::HiLog::Debug(COAUTH_LABEL[module], FORMATTED(__VA_ARGS__)) + +constexpr uint64_t MASK = 0x0000FFFF; } // namespace UserIAM } // namespace OHOS -#else - -#define COAUTH_HILOGF(...) -#define COAUTH_HILOGE(...) -#define COAUTH_HILOGW(...) -#define COAUTH_HILOGI(...) -#define COAUTH_HILOGD(...) - -#endif // CONFIG_HILOG - #endif // COAUTH_HILOG_WRAPPER_H