From 30741be572150e77caaf0a21b0855cab75628c20 Mon Sep 17 00:00:00 2001 From: luo-wei246 Date: Wed, 19 Jul 2023 01:51:47 -0700 Subject: [PATCH] fix:Code review for corrections Signed-off-by: luo-wei246 --- services/native/src/usb_right_manager.cpp | 4 ++-- services/native/src/usb_service.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/native/src/usb_right_manager.cpp b/services/native/src/usb_right_manager.cpp index 2ef9cedb..6c375fca 100644 --- a/services/native/src/usb_right_manager.cpp +++ b/services/native/src/usb_right_manager.cpp @@ -119,7 +119,7 @@ bool UsbRightManager::HasRight(const std::string &deviceName, const std::string int32_t uid = USB_RIGHT_USERID_INVALID; GetCurrentUserId(uid); if (uid == USB_RIGHT_USERID_CONSOLE) { - USB_HILOGE(MODULE_USB_SERVICE, "console called, bypass"); + USB_HILOGW(MODULE_USB_SERVICE, "console called, bypass"); return true; } uint64_t nowTime = GetCurrentTimestamp(); @@ -139,7 +139,7 @@ int32_t UsbRightManager::RequestRight( USB_HILOGD(MODULE_USB_SERVICE, "RequestRight: busdev=%{private}s device=%{public}s app=%{public}s", busDev.c_str(), deviceName.c_str(), bundleName.c_str()); if (HasRight(deviceName, bundleName)) { - USB_HILOGE(MODULE_USB_SERVICE, "device has Right "); + USB_HILOGW(MODULE_USB_SERVICE, "device has Right "); return UEC_OK; } if (!GetUserAgreementByDiag(busDev, deviceName, bundleName)) { diff --git a/services/native/src/usb_service.cpp b/services/native/src/usb_service.cpp index a85fd4c8..7886fe28 100644 --- a/services/native/src/usb_service.cpp +++ b/services/native/src/usb_service.cpp @@ -59,7 +59,7 @@ constexpr int32_t SERVICE_STARTUP_MAX_TIME = 30; constexpr uint32_t UNLOAD_SA_TIMER_INTERVAL = 30 * 1000; } // namespace -auto pms = DelayedSpSingleton::GetInstance(); +auto g_serviceInstance = DelayedSpSingleton::GetInstance(); const bool G_REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(DelayedSpSingleton::GetInstance().GetRefPtr()); @@ -184,9 +184,9 @@ bool UsbService::Init() } } if (handler_ == nullptr) { - handler_ = std::make_shared(eventRunner_, pms); + handler_ = std::make_shared(eventRunner_, g_serviceInstance); - if (!Publish(pms)) { + if (!Publish(g_serviceInstance)) { USB_HILOGE(MODULE_USB_SERVICE, "OnStart register to system ability manager failed."); return false; } @@ -879,7 +879,7 @@ bool UsbService::AddDevice(uint8_t busNum, uint8_t devAddr) { UsbDevice *devInfo = new (std::nothrow) UsbDevice(); if (devInfo == nullptr) { - USB_HILOGI(MODULE_USB_SERVICE, "new failed"); + USB_HILOGE(MODULE_USB_SERVICE, "new failed"); return false; } -- Gitee