64位数掩码打印

Signed-off-by: baiwei <hanzhen10@huawei.com>
This commit is contained in:
baiwei
2022-03-30 17:47:44 +08:00
parent 22041fc7a4
commit c4ec7aca2d
8 changed files with 17 additions and 25 deletions
+2 -2
View File
@@ -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");
@@ -14,7 +14,6 @@
*/
#include "auth_attributes.h"
#include <cinttypes>
namespace OHOS {
namespace UserIAM {
@@ -334,7 +333,6 @@ std::vector<uint32_t> AuthAttributes::GetUint32ArrayFromUint8(std::vector<uint8_
for (uint32_t i = 0; i < len / sizeof(uint32_t); i++) {
uint32_t uint32data = GetUint32FromUint8(data, begin + i * sizeof(uint32_t));
tmp.push_back(uint32data);
COAUTH_HILOGD(MODULE_INNERKIT, "buffer read uint32ArrayValue : %{public}u.", uint32data);
}
return tmp;
}
@@ -345,7 +343,6 @@ std::vector<uint64_t> AuthAttributes::GetUint64ArrayFromUint8(std::vector<uint8_
for (uint32_t i = 0; i < len / sizeof(uint64_t); i++) {
uint64_t uint64data = GetUint64FromUint8(data, begin + i * sizeof(uint64_t));
tmp.push_back(uint64data);
COAUTH_HILOGD(MODULE_INNERKIT, "buffer read uint64ArrayValue : %{public}" PRIu64, uint64data);
}
return tmp;
}
+1 -1
View File
@@ -70,7 +70,7 @@ uint64_t AuthResManager::Register(std::shared_ptr<ResAuthExecutor> executorInfo,
sptr<UserIAM::AuthResPool::IExecutorMessenger> 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;
}
+1 -1
View File
@@ -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;
}
+7 -2
View File
@@ -14,6 +14,9 @@
*/
#include "call_monitor.h"
#include <cinttypes>
#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
+1 -1
View File
@@ -106,7 +106,7 @@ uint64_t CoAuthService::Register(std::shared_ptr<ResAuthExecutor> 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;
}
+3 -3
View File
@@ -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<ICoAuthCallback> callback = iface_cast<ICoAuthCallback>(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)) {
+2 -12
View File
@@ -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