diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index f6190e4998a4eeb6dea7f71b504ac7251172595c..8c1b0ffcb7aa113e6273c582f82c8d7d8ed70fe9 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -61,7 +61,7 @@ int32_t InputHub::Initialize() { epollFd_ = epoll_create1(EPOLL_CLOEXEC); if (epollFd_ < 0) { - DHLOGE("Could not create epoll instance: %{public}s", ConvertErrNo().c_str()); + DHLOGE("Could not create epoll instance: %s", ConvertErrNo().c_str()); return ERR_DH_INPUT_HUB_EPOLL_INIT_FAIL; } @@ -70,7 +70,7 @@ int32_t InputHub::Initialize() iNotifyFd_ = inotify_init(); inputWd_ = inotify_add_watch(iNotifyFd_, DEVICE_PATH, IN_DELETE | IN_CREATE); if (inputWd_ < 0) { - DHLOGE("Could not register INotify for %{public}s: %{public}s", DEVICE_PATH, ConvertErrNo().c_str()); + DHLOGE("Could not register INotify for %s: %s", DEVICE_PATH, ConvertErrNo().c_str()); return ERR_DH_INPUT_HUB_EPOLL_INIT_FAIL; } @@ -79,7 +79,7 @@ int32_t InputHub::Initialize() eventItem.data.fd = iNotifyFd_; int result = epoll_ctl(epollFd_, EPOLL_CTL_ADD, iNotifyFd_, &eventItem); if (result != 0) { - DHLOGE("Could not add INotify to epoll instance. errno=%{public}d", errno); + DHLOGE("Could not add INotify to epoll instance. errno=%d", errno); return ERR_DH_INPUT_HUB_EPOLL_INIT_FAIL; } } else { @@ -138,12 +138,12 @@ void InputHub::ScanAndRecordInputDevices() while (!openingDevices_.empty()) { std::unique_ptr device = std::move(*openingDevices_.rbegin()); openingDevices_.pop_back(); - DHLOGI("Reporting device opened: path=%{public}s, name=%{public}s\n", + DHLOGI("Reporting device opened: path=%s, name=%s\n", device->path.c_str(), device->identifier.name.c_str()); std::string devPath = device->path; auto [dev_it, inserted] = devices_.insert_or_assign(device->path, std::move(device)); if (!inserted) { - DHLOGI("Device with this path %{public}s exists, replaced. \n", devPath.c_str()); + DHLOGI("Device with this path %s exists, replaced. \n", devPath.c_str()); } } } @@ -190,12 +190,12 @@ size_t InputHub::GetEvents(RawEvent *buffer, size_t bufferSize) size_t count = ReadInputEvent(readSize, *GetDeviceByFdLocked(eventItem.data.fd)); Device* device = GetSupportDeviceByFd(eventItem.data.fd); if (!device) { - DHLOGE("Can not find device by fd: %{public}d", eventItem.data.fd); + DHLOGE("Can not find device by fd: %d", eventItem.data.fd); continue; } if (!sharedDHIds_[device->identifier.descriptor]) { RecordDeviceChangeStates(device, readBuffer, count); - DHLOGD("Not in sharing stat, device descriptor: %{public}s", + DHLOGD("Not in sharing stat, device descriptor: %s", GetAnonyString(device->identifier.descriptor).c_str()); continue; } @@ -207,7 +207,7 @@ size_t InputHub::GetEvents(RawEvent *buffer, size_t bufferSize) break; } } else if (eventItem.events & EPOLLHUP) { - DHLOGI("Removing device %{public}s due to epoll hang-up event.", device->identifier.name.c_str()); + DHLOGI("Removing device %s due to epoll hang-up event.", device->identifier.name.c_str()); CloseDeviceLocked(*device); } } @@ -265,7 +265,7 @@ void InputHub::DealNormalKeyEvent(Device *device, const RawEvent &event) // Deal mouse left keydown reset if (IsCuror(device) && event.code == BTN_MOUSE && !DInputSinkState::GetInstance().IsDhIdDown(event.descriptor)) { - DHLOGI("Find mouse BTN_MOUSE UP state that not down effective at sink side, dhId: %{public}s", + DHLOGI("Find mouse BTN_MOUSE UP state that not down effective at sink side, dhId: %s", GetAnonyString(event.descriptor).c_str()); DInputSinkState::GetInstance().SimulateMouseBtnMouseUpState(event.descriptor, event); } @@ -335,15 +335,16 @@ size_t InputHub::ReadInputEvent(int32_t readSize, Device &device) size_t count = 0; if (readSize == 0 || (readSize < 0 && errno == ENODEV)) { // Device was removed before INotify noticed. - DHLOGE("could not get event, removed? (fd: %{public}d size: %{public}d, errno: %{public}d)\n", + DHLOGE("could not get event, removed? (fd: %d size: %d" + " errno: %d)\n", device.fd, readSize, errno); CloseDeviceLocked(device); } else if (readSize < 0) { if (errno != EAGAIN && errno != EINTR) { - DHLOGW("could not get event (errno=%{public}d)", errno); + DHLOGW("could not get event (errno=%d)", errno); } } else if ((readSize % sizeof(struct input_event)) != 0) { - DHLOGW("could not get event (wrong size: %{public}d)", readSize); + DHLOGW("could not get event (wrong size: %d)", readSize); } else { count = size_t(readSize) / sizeof(struct input_event); return count; @@ -360,8 +361,7 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize) std::lock_guard deviceLock(devicesMutex_); for (auto it = closingDevices_.begin(); it != closingDevices_.end();) { std::unique_ptr device = std::move(*it); - DHLOGI("Reporting device closed: id=%{public}s, name=%{public}s", - device->path.c_str(), device->identifier.name.c_str()); + DHLOGI("Reporting device closed: id=%s, name=%s", device->path.c_str(), device->identifier.name.c_str()); event->type = DeviceType::DEVICE_REMOVED; event->deviceInfo = device->identifier; event += 1; @@ -383,8 +383,7 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize) while (!openingDevices_.empty()) { std::unique_ptr device = std::move(*openingDevices_.rbegin()); openingDevices_.pop_back(); - DHLOGI("Reporting device opened: id=%{public}s, name=%{public}s", - device->path.c_str(), device->identifier.name.c_str()); + DHLOGI("Reporting device opened: id=%s, name=%s", device->path.c_str(), device->identifier.name.c_str()); event->type = DeviceType::DEVICE_ADDED; event->deviceInfo = device->identifier; event += 1; @@ -392,7 +391,7 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize) std::string devPath = device->path; auto [dev_it, inserted] = devices_.insert_or_assign(device->path, std::move(device)); if (!inserted) { - DHLOGI("Device path %{public}s exists, replaced.", devPath.c_str()); + DHLOGI("Device path %s exists, replaced.", devPath.c_str()); } if (capacity == 0) { break; @@ -457,11 +456,11 @@ void InputHub::GetDeviceHandler() if (eventItem.events & EPOLLHUP) { Device* device = GetDeviceByFdLocked(eventItem.data.fd); if (!device) { - DHLOGE("Received unexpected epoll event 0x%{public}08x for unknown fd %{public}d.", + DHLOGE("Received unexpected epoll event 0x%08x for unknown fd %d.", eventItem.events, eventItem.data.fd); continue; } - DHLOGI("Removing device %{public}s due to epoll hang-up event.", device->identifier.name.c_str()); + DHLOGI("Removing device %s due to epoll hang-up event.", device->identifier.name.c_str()); deviceChanged_ = true; CloseDeviceLocked(*device); } @@ -485,7 +484,7 @@ int32_t InputHub::RefreshEpollItem(bool isSleep) // Sleep after errors to avoid locking up the system. // Hopefully the error is transient. if (errno != EINTR) { - DHLOGE("poll failed (errno=%{public}d)\n", errno); + DHLOGE("poll failed (errno=%d)\n", errno); usleep(SLEEP_TIME_US); } } else { @@ -525,7 +524,7 @@ bool InputHub::IsDeviceRegistered(const std::string &devicePath) std::lock_guard deviceLock(devicesMutex_); for (const auto &[deviceId, device] : devices_) { if (device->path == devicePath) { - DHLOGI("Device node already registered, node path: %{public}s", device->path.c_str()); + DHLOGI("Device node already registered, node path: %s", device->path.c_str()); return true; // device was already registered } } @@ -539,10 +538,10 @@ int32_t InputHub::OpenInputDeviceLocked(const std::string &devicePath) } std::lock_guard my_lock(operationMutex_); - DHLOGD("Opening device start: %{public}s", devicePath.c_str()); + DHLOGD("Opening device start: %s", devicePath.c_str()); int fd = OpenInputDeviceFdByPath(devicePath); if (fd == UN_INIT_FD_VALUE) { - DHLOGE("The fd open failed, devicePath %{public}s.", devicePath.c_str()); + DHLOGE("The fd open failed, devicePath %s.", devicePath.c_str()); return ERR_DH_INPUT_HUB_OPEN_DEVICEPATH_FAIL; } @@ -559,11 +558,11 @@ int32_t InputHub::OpenInputDeviceLocked(const std::string &devicePath) if (MakeDevice(fd, std::move(device)) < 0) { CloseFd(fd); - DHLOGI("Opening device error: %{public}s", devicePath.c_str()); + DHLOGI("Opening device error: %s", devicePath.c_str()); return ERR_DH_INPUT_HUB_MAKE_DEVICE_FAIL; } - DHLOGI("Opening device finish: %{public}s", devicePath.c_str()); + DHLOGI("Opening device finish: %s", devicePath.c_str()); return DH_SUCCESS; } @@ -584,12 +583,12 @@ int32_t InputHub::QueryInputDeviceInfo(int fd, std::unique_ptr &device) char buffer[INPUT_EVENT_BUFFER_SIZE] = {0}; // Get device name. if (ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer) < 1) { - DHLOGE("Could not get device name for %{public}s", ConvertErrNo().c_str()); + DHLOGE("Could not get device name for %s", ConvertErrNo().c_str()); } else { buffer[sizeof(buffer) - 1] = '\0'; device->identifier.name = buffer; } - DHLOGD("QueryInputDeviceInfo deviceName: %{public}s", buffer); + DHLOGD("QueryInputDeviceInfo deviceName: %s", buffer); // If the device is already a virtual device, don't monitor it. if (device->identifier.name.find(VIRTUAL_DEVICE_NAME) != std::string::npos) { DHLOGE("this is a virtual driver, skip it."); @@ -599,14 +598,14 @@ int32_t InputHub::QueryInputDeviceInfo(int fd, std::unique_ptr &device) // Get device driver version. int driverVersion; if (ioctl(fd, EVIOCGVERSION, &driverVersion)) { - DHLOGE("could not get driver version for %{public}s\n", ConvertErrNo().c_str()); + DHLOGE("could not get driver version for %s\n", ConvertErrNo().c_str()); RecordSkipDevicePath(device->path); return ERR_DH_INPUT_HUB_QUERY_INPUT_DEVICE_INFO_FAIL; } // Get device identifier. struct input_id inputId; if (ioctl(fd, EVIOCGID, &inputId)) { - DHLOGE("could not get device input id for %{public}s\n", ConvertErrNo().c_str()); + DHLOGE("could not get device input id for %s\n", ConvertErrNo().c_str()); RecordSkipDevicePath(device->path); return ERR_DH_INPUT_HUB_QUERY_INPUT_DEVICE_INFO_FAIL; } @@ -616,14 +615,14 @@ int32_t InputHub::QueryInputDeviceInfo(int fd, std::unique_ptr &device) device->identifier.version = inputId.version; // Get device physical physicalPath. if (ioctl(fd, EVIOCGPHYS(sizeof(buffer) - 1), &buffer) < 1) { - DHLOGE("could not get physicalPath for %{public}s\n", ConvertErrNo().c_str()); + DHLOGE("could not get physicalPath for %s\n", ConvertErrNo().c_str()); } else { buffer[sizeof(buffer) - 1] = '\0'; device->identifier.physicalPath = buffer; } // Get device unique id. if (ioctl(fd, EVIOCGUNIQ(sizeof(buffer) - 1), &buffer) < 1) { - DHLOGE("could not get idstring for %{public}s\n", ConvertErrNo().c_str()); + DHLOGE("could not get idstring for %s\n", ConvertErrNo().c_str()); } else { buffer[sizeof(buffer) - 1] = '\0'; device->identifier.uniqueId = buffer; @@ -635,7 +634,7 @@ int32_t InputHub::QueryInputDeviceInfo(int fd, std::unique_ptr &device) void InputHub::QueryEventInfo(int fd, std::unique_ptr &device) { - DHLOGI("QueryEventInfo: devName: %{public}s, dhId: %{public}s!", device->identifier.name.c_str(), + DHLOGI("QueryEventInfo: devName: %s, dhId: %s!", device->identifier.name.c_str(), GetAnonyString(device->identifier.descriptor).c_str()); struct libevdev *dev = GetLibEvDev(fd); if (dev == nullptr) { @@ -672,7 +671,7 @@ void InputHub::GetMSCBits(int fd, std::unique_ptr &device) for (uint32_t msc = MSC_SERIAL; msc < MSC_MAX; ++msc) { if (TestBit(EV_MSC, device->evBitmask) && TestBit(msc, mscBitmask)) { - DHLOGI("Get MSC event: %{public}d", msc); + DHLOGI("Get MSC event: %d", msc); device->identifier.miscellaneous.push_back(msc); } } @@ -684,7 +683,7 @@ void InputHub::GetLEDBits(int fd, std::unique_ptr &device) GetEventMask(fd, "led", EV_LED, sizeof(ledBitmask), ledBitmask); for (uint32_t led = LED_NUML; led < LED_MAX; ++led) { if (TestBit(EV_LED, device->evBitmask) && TestBit(led, ledBitmask)) { - DHLOGI("Get LED event: %{public}d", led); + DHLOGI("Get LED event: %d", led); device->identifier.leds.push_back(led); } } @@ -697,7 +696,7 @@ void InputHub::GetSwitchBits(int fd, std::unique_ptr &device) for (uint32_t sw = SW_LID; sw < SW_MAX; ++sw) { if (TestBit(EV_SW, device->evBitmask) && TestBit(sw, switchBitmask)) { - DHLOGI("Get Switch event: %{public}d", sw); + DHLOGI("Get Switch event: %d", sw); device->identifier.switchs.push_back(sw); } } @@ -710,7 +709,7 @@ void InputHub::GetRepeatBits(int fd, std::unique_ptr &device) for (uint32_t rep = REP_DELAY; rep < REP_MAX; ++rep) { if (TestBit(EV_REP, device->evBitmask) && TestBit(rep, repBitmask)) { - DHLOGI("Get Repeat event: %{public}d", rep); + DHLOGI("Get Repeat event: %d", rep); device->identifier.repeats.push_back(rep); } } @@ -722,7 +721,7 @@ struct libevdev* InputHub::GetLibEvDev(int fd) int rc = 1; rc = libevdev_new_from_fd(fd, &dev); if (rc < 0) { - DHLOGE("Failed to init libevdev (%{public}s)", strerror(-rc)); + DHLOGE("Failed to init libevdev (%s)", strerror(-rc)); return nullptr; } return dev; @@ -732,7 +731,7 @@ void InputHub::GetEventTypes(struct libevdev *dev, InputDevice &identifier) { for (uint32_t eventType = 0; eventType < EV_CNT; eventType++) { if (!libevdev_has_event_type(dev, eventType)) { - DHLOGD("The device is not support eventType: %{public}d", eventType); + DHLOGD("The device is not support eventType: %d", eventType); continue; } identifier.eventTypes.push_back(eventType); @@ -747,7 +746,7 @@ int32_t InputHub::GetEventKeys(struct libevdev *dev, InputDevice &identifier) } for (uint32_t eventKey = 0; eventKey < KEY_CNT; eventKey++) { if (!libevdev_has_event_code(dev, EV_KEY, eventKey)) { - DHLOGD("The device is not support eventKey: %{public}d", eventKey); + DHLOGD("The device is not support eventKey: %d", eventKey); continue; } identifier.eventKeys.push_back(eventKey); @@ -761,11 +760,11 @@ int32_t InputHub::GetABSInfo(struct libevdev *dev, InputDevice &identifier) DHLOGE("The device doesn't has EV_ABS type!"); return ERR_DH_INPUT_HUB_QUERY_INPUT_DEVICE_INFO_FAIL; } - DHLOGI("The device has abs info, devName: %{public}s, dhId: %{public}s!", + DHLOGI("The device has abs info, devName: %s, dhId: %s!", identifier.name.c_str(), GetAnonyString(identifier.descriptor).c_str()); for (uint32_t absType = 0; absType < ABS_CNT; absType++) { if (!libevdev_has_event_code(dev, EV_ABS, absType)) { - DHLOGD("The device is not support absType: %{public}d", absType); + DHLOGD("The device is not support absType: %d", absType); continue; } identifier.absTypes.push_back(absType); @@ -792,7 +791,7 @@ int32_t InputHub::GetRELTypes(struct libevdev *dev, InputDevice &identifier) } for (uint32_t code = 0; code < REL_CNT; code++) { if (!libevdev_has_event_code(dev, EV_REL, code)) { - DHLOGD("The device is not support rel code: %{public}d", code); + DHLOGD("The device is not support rel code: %d", code); continue; } identifier.relTypes.push_back(code); @@ -804,7 +803,7 @@ void InputHub::GetProperties(struct libevdev *dev, InputDevice &identifier) { for (uint32_t prop = 0; prop < INPUT_PROP_CNT; prop++) { if (libevdev_has_property(dev, prop)) { - DHLOGI("QueryInputDeviceInfo rel prop: %{public}d", prop); + DHLOGI("QueryInputDeviceInfo rel prop: %d", prop); identifier.properties.push_back(prop); } } @@ -844,7 +843,7 @@ int32_t InputHub::MakeDevice(int fd, std::unique_ptr device) // If the device isn't recognized as something we handle, don't monitor it. if (device->classes == 0) { - DHLOGI("Dropping device: name='%{public}s'", device->identifier.name.c_str()); + DHLOGI("Dropping device: name='%s'", device->identifier.name.c_str()); return ERR_DH_INPUT_HUB_MAKE_DEVICE_FAIL; } @@ -854,8 +853,8 @@ int32_t InputHub::MakeDevice(int fd, std::unique_ptr device) device->identifier.classes = device->classes; - DHLOGI("inputType=%{public}d", inputTypes_.load()); - DHLOGI("New device: fd=%{public}d, name='%{public}s', classes=0x%{public}x", fd, device->identifier.name.c_str(), + DHLOGI("inputType=%d", inputTypes_.load()); + DHLOGI("New device: fd=%d, name='%s', classes=0x%x", fd, device->identifier.name.c_str(), device->classes); AddDeviceLocked(std::move(device)); @@ -953,7 +952,7 @@ void InputHub::GenerateDescriptor(InputDevice &identifier) const } identifier.descriptor = DH_ID_PREFIX + Sha256(rawDescriptor); - DHLOGI("Created descriptor: raw=%{public}s, cooked=%{public}s", rawDescriptor.c_str(), + DHLOGI("Created descriptor: raw=%s, cooked=%s", rawDescriptor.c_str(), GetAnonyString(identifier.descriptor).c_str()); } @@ -961,7 +960,7 @@ int32_t InputHub::RegisterDeviceForEpollLocked(const Device &device) { int32_t result = RegisterFdForEpoll(device.fd); if (result != DH_SUCCESS) { - DHLOGE("Could not add input device fd to epoll for device, path: %{public}s", device.path.c_str()); + DHLOGE("Could not add input device fd to epoll for device, path: %s", device.path.c_str()); return result; } return result; @@ -973,7 +972,7 @@ int32_t InputHub::RegisterFdForEpoll(int fd) eventItem.events = EPOLLIN | EPOLLWAKEUP; eventItem.data.fd = fd; if (epoll_ctl(epollFd_, EPOLL_CTL_ADD, fd, &eventItem)) { - DHLOGE("Could not add fd to epoll instance: %{public}s", ConvertErrNo().c_str()); + DHLOGE("Could not add fd to epoll instance: %s", ConvertErrNo().c_str()); return -errno; } return DH_SUCCESS; @@ -987,7 +986,7 @@ void InputHub::AddDeviceLocked(std::unique_ptr device) void InputHub::CloseDeviceLocked(Device &device) { - DHLOGI("Removed device: path=%{public}s name=%{public}s fd=%{public}d classes=0x%{public}x", + DHLOGI("Removed device: path=%s name=%s fd=%d classes=0x%x", device.path.c_str(), device.identifier.name.c_str(), device.fd, device.classes); UnregisterDeviceFromEpollLocked(device); @@ -1001,7 +1000,7 @@ void InputHub::CloseDeviceLocked(Device &device) void InputHub::CloseDeviceForAllLocked(Device &device) { - DHLOGI("Removed device: path=%{public}s name=%{public}s fd=%{public}d classes=0x%{public}x", + DHLOGI("Removed device: path=%s name=%s fd=%d classes=0x%x", device.path.c_str(), device.identifier.name.c_str(), device.fd, device.classes); UnregisterDeviceFromEpollLocked(device); @@ -1015,7 +1014,7 @@ int32_t InputHub::UnregisterDeviceFromEpollLocked(const Device &device) const if (device.HasValidFd()) { int32_t result = UnregisterFdFromEpoll(device.fd); if (result != DH_SUCCESS) { - DHLOGE("Could not remove input device fd from epoll for device, path: %{public}s", device.path.c_str()); + DHLOGE("Could not remove input device fd from epoll for device, path: %s", device.path.c_str()); return result; } } @@ -1025,7 +1024,7 @@ int32_t InputHub::UnregisterDeviceFromEpollLocked(const Device &device) const int32_t InputHub::UnregisterFdFromEpoll(int fd) const { if (epoll_ctl(epollFd_, EPOLL_CTL_DEL, fd, nullptr)) { - DHLOGE("Could not remove fd from epoll instance: %{public}s", ConvertErrNo().c_str()); + DHLOGE("Could not remove fd from epoll instance: %s", ConvertErrNo().c_str()); return ERR_DH_INPUT_HUB_UNREGISTER_FD_FAIL; } return DH_SUCCESS; @@ -1037,13 +1036,13 @@ int32_t InputHub::ReadNotifyLocked() char eventBuf[512]; struct inotify_event *event; - DHLOGI("readNotify nfd: %{public}d\n", iNotifyFd_); + DHLOGI("readNotify nfd: %d\n", iNotifyFd_); res = static_cast(read(iNotifyFd_, eventBuf, sizeof(eventBuf))); if (res < sizeof(*event)) { if (errno == EINTR) { return DH_SUCCESS; } - DHLOGE("could not get event, %{public}s\n", ConvertErrNo().c_str()); + DHLOGE("could not get event, %s\n", ConvertErrNo().c_str()); return ERR_DH_INPUT_HUB_GET_EVENT_FAIL; } @@ -1069,7 +1068,7 @@ void InputHub::JudgeDeviceOpenOrClose(const inotify_event &event) if (event.mask & IN_CREATE) { OpenInputDeviceLocked(filename); } else { - DHLOGI("Removing device '%{public}s' due to inotify event\n", filename.c_str()); + DHLOGI("Removing device '%s' due to inotify event\n", filename.c_str()); CloseDeviceByPathLocked(filename); } } else { @@ -1085,7 +1084,7 @@ void InputHub::CloseDeviceByPathLocked(const std::string &devicePath) CloseDeviceLocked(*device); return; } - DHLOGI("Remove device: %{public}s not found, device may already have been removed.", devicePath.c_str()); + DHLOGI("Remove device: %s not found, device may already have been removed.", devicePath.c_str()); } void InputHub::CloseAllDevicesLocked() @@ -1179,8 +1178,7 @@ AffectDhIds InputHub::SetSupportInputType(bool enabled, const uint32_t &inputTyp for (const auto &[id, device] : devices_) { if (device->classes & inputTypes_) { device->isShare = enabled; - DHLOGW("ByType dhid:%{public}s, isshare:%{public}d", - GetAnonyString(device->identifier.descriptor).c_str(), enabled); + DHLOGW("ByType dhid:%s, isshare:%d", GetAnonyString(device->identifier.descriptor).c_str(), enabled); SaveAffectDhId(enabled, device->identifier.descriptor, affDhIds); } } @@ -1194,16 +1192,15 @@ AffectDhIds InputHub::SetSharingDevices(bool enabled, std::vector d std::lock_guard deviceLock(devicesMutex_); DHLOGI("SetSharingDevices start"); for (auto dhId : dhIds) { - DHLOGI("SetSharingDevices dhId: %{public}s, size: %{public}zu, enabled: %{public}d", - GetAnonyString(dhId).c_str(), devices_.size(), enabled); + DHLOGI("SetSharingDevices dhId: %s, size: %d, enabled: %d", GetAnonyString(dhId).c_str(), devices_.size(), + enabled); sharedDHIds_[dhId] = enabled; for (const auto &[id, device] : devices_) { - DHLOGI("deviceName %{public}s ,dhId: %{public}s ", device->identifier.name.c_str(), + DHLOGI("deviceName %s ,dhId: %s ", device->identifier.name.c_str(), GetAnonyString(device->identifier.descriptor).c_str()); if (device->identifier.descriptor == dhId) { device->isShare = enabled; - DHLOGW("dhid:%{public}s, isshare:%{public}d", - GetAnonyString(device->identifier.descriptor).c_str(), enabled); + DHLOGW("dhid:%s, isshare:%d", GetAnonyString(device->identifier.descriptor).c_str(), enabled); SaveAffectDhId(enabled, device->identifier.descriptor, affDhIds); break; } @@ -1219,7 +1216,7 @@ std::vector InputHub::GetSharingDevices() std::lock_guard deviceLock(devicesMutex_); for (const auto &[id, device] : devices_) { if (device->isShare) { - DHLOGI("Find sharing dhid: %{public}s", GetAnonyString(device->identifier.descriptor).c_str()); + DHLOGI("Find sharing dhid: %s", GetAnonyString(device->identifier.descriptor).c_str()); sharingDevices.push_back(device->identifier.descriptor); } } @@ -1229,7 +1226,7 @@ std::vector InputHub::GetSharingDevices() void InputHub::GetSharedMousePathByDhId(const std::vector &dhIds, std::string &sharedMousePath, std::string &sharedMouseDhId) { - DHLOGI("GetSharedMousePathByDhId: devices_.size:%{public}zu,", devices_.size()); + DHLOGI("GetSharedMousePathByDhId: devices_.size:%d,", devices_.size()); std::lock_guard deviceLock(devicesMutex_); for (const auto &dhId : dhIds) { for (const auto &[id, device] : devices_) { @@ -1237,8 +1234,8 @@ void InputHub::GetSharedMousePathByDhId(const std::vector &dhIds, s DHLOGE("device is nullptr"); continue; } - DHLOGI("descriptor:%{public}s, isShare[%{public}d], type[%{public}d]", - GetAnonyString(device->identifier.descriptor).c_str(), device->isShare, device->classes); + DHLOGI("descriptor:%s, isShare[%d], type[%d]", GetAnonyString(device->identifier.descriptor).c_str(), + device->isShare, device->classes); if ((device->identifier.descriptor == dhId) && ((device->classes & INPUT_DEVICE_CLASS_CURSOR) != 0 || (device->classes & INPUT_DEVICE_CLASS_TOUCH) != 0 || ((device->classes & INPUT_DEVICE_CLASS_TOUCH_MT) != 0 && IsTouchPad(device->identifier)))) { @@ -1253,7 +1250,7 @@ void InputHub::GetSharedMousePathByDhId(const std::vector &dhIds, s void InputHub::GetSharedKeyboardPathsByDhIds(const std::vector &dhIds, std::vector &sharedKeyboardPaths, std::vector &sharedKeyboardDhIds) { - DHLOGI("GetSharedKeyboardPathsByDhIds: devices_.size:%{public}zu,", devices_.size()); + DHLOGI("GetSharedKeyboardPathsByDhIds: devices_.size:%d,", devices_.size()); std::lock_guard deviceLock(devicesMutex_); for (const auto &dhId : dhIds) { for (const auto &[id, device] : devices_) { @@ -1261,8 +1258,8 @@ void InputHub::GetSharedKeyboardPathsByDhIds(const std::vector &dhI DHLOGE("device is nullptr"); continue; } - DHLOGI("descriptor:%{public}s, isShare[%{public}d], type[%{public}d]", - GetAnonyString(device->identifier.descriptor).c_str(), device->isShare, device->classes); + DHLOGI("descriptor:%s, isShare[%d], type[%d]", GetAnonyString(device->identifier.descriptor).c_str(), + device->isShare, device->classes); if ((device->identifier.descriptor == dhId) && ((device->classes & INPUT_DEVICE_CLASS_KEYBOARD) != 0)) { sharedKeyboardDhIds.push_back(dhId); @@ -1312,7 +1309,7 @@ bool InputHub::IsAllDevicesStoped() { std::lock_guard deviceLock(devicesMutex_); for (const auto &[dhId, isShared] : sharedDHIds_) { - DHLOGI("the dhId: %{public}s, isShared: %{public}d", GetAnonyString(dhId).c_str(), isShared); + DHLOGI("the dhId: %s, isShared: %d", GetAnonyString(dhId).c_str(), isShared); if (isShared) { return false; } @@ -1322,16 +1319,16 @@ bool InputHub::IsAllDevicesStoped() void InputHub::RecordDeviceLog(const std::string &devicePath, const InputDevice &identifier) { - DHLOGI("add device: %{public}s\n", devicePath.c_str()); - DHLOGI(" bus: %{public}04x\n" - " vendor %{public}04x\n" - " product %{public}04x\n" - " version %{public}04x\n", + DHLOGI("add device: %s\n", devicePath.c_str()); + DHLOGI(" bus: %04x\n" + " vendor %04x\n" + " product %04x\n" + " version %04x\n", identifier.bus, identifier.vendor, identifier.product, identifier.version); - DHLOGI(" name: \"%{public}s\"\n", identifier.name.c_str()); - DHLOGI(" physicalPath: \"%{public}s\"\n", identifier.physicalPath.c_str()); - DHLOGI(" unique id: \"%{public}s\"\n", identifier.uniqueId.c_str()); - DHLOGI(" descriptor: \"%{public}s\"\n", GetAnonyString(identifier.descriptor).c_str()); + DHLOGI(" name: \"%s\"\n", identifier.name.c_str()); + DHLOGI(" physicalPath: \"%s\"\n", identifier.physicalPath.c_str()); + DHLOGI(" unique id: \"%s\"\n", identifier.uniqueId.c_str()); + DHLOGI(" descriptor: \"%s\"\n", GetAnonyString(identifier.descriptor).c_str()); } void InputHub::RecordChangeEventLog(const RawEvent &event) @@ -1354,9 +1351,9 @@ void InputHub::RecordChangeEventLog(const RawEvent &event) eventType = "other type " + std::to_string(event.type); break; } - DHLOGI("0.E2E-Test Sink collect change event, EventType: %{public}s, Code: %{public}d, Value: %{public}d, " - "Path: %{public}s, descriptor: %{public}s, When: %{public}" PRId64 "", eventType.c_str(), event.code, - event.value, event.path.c_str(), GetAnonyString(event.descriptor).c_str(), event.when); + DHLOGI("0.E2E-Test Sink collect change event, EventType: %s, Code: %d, Value: %d, Path: %s, descriptor: %s," + "When:%" PRId64 "", eventType.c_str(), event.code, event.value, event.path.c_str(), + GetAnonyString(event.descriptor).c_str(), event.when); } void InputHub::RecordEventLog(const RawEvent *event) @@ -1379,9 +1376,9 @@ void InputHub::RecordEventLog(const RawEvent *event) eventType = "other type " + std::to_string(event->type); break; } - DHLOGD("1.E2E-Test Sink collect event, EventType: %{public}s, Code: %{public}d, Value: %{public}d, " - "Path: %{public}s, descriptor: %{public}s, When: %{public}" PRId64 "", eventType.c_str(), event->code, - event->value, event->path.c_str(), GetAnonyString(event->descriptor).c_str(), event->when); + DHLOGD("1.E2E-Test Sink collect event, EventType: %s, Code: %d, Value: %d, Path: %s, descriptor: %s," + "When:%" PRId64 "", eventType.c_str(), event->code, event->value, event->path.c_str(), + GetAnonyString(event->descriptor).c_str(), event->when); } void InputHub::HandleTouchScreenEvent(struct input_event readBuffer[], const size_t count, @@ -1465,7 +1462,7 @@ std::vector InputHub::CollectTargetDevices() ((dev.second->classes & INPUT_DEVICE_CLASS_TOUCH_MT) != 0) || ((dev.second->classes & INPUT_DEVICE_CLASS_CURSOR) != 0) || ((dev.second->classes & INPUT_DEVICE_CLASS_KEYBOARD) != 0)) { - DHLOGI("Find target devs need check stat, path: %{public}s, name: %{public}s", + DHLOGI("Find target devs need check stat, path: %s, name: %s", dev.first.c_str(), dev.second->identifier.name.c_str()); tarVec.push_back(dev.second.get()); } @@ -1484,14 +1481,14 @@ void InputHub::SavePressedKeyState(const InputHub::Device *dev, int32_t keyCode) .path = dev->path }; DInputSinkState::GetInstance().AddKeyDownState(event); - DHLOGI("Find Pressed key: %{public}d, device path: %{public}s, dhId: %{public}s", keyCode, dev->path.c_str(), + DHLOGI("Find Pressed key: %d, device path: %s, dhId: %s", keyCode, dev->path.c_str(), GetAnonyString(dev->identifier.descriptor).c_str()); } bool InputHub::IsLengthExceeds(const unsigned long *keyState, const unsigned long len, int keyIndex) { if (len < (keyIndex / LONG_BITS) + 1) { - DHLOGE("Length exceeds for key index: %{public}d", keyIndex); + DHLOGE("Length exceeds for key index: %d", keyIndex); return true; } return false; @@ -1561,7 +1558,7 @@ void InputHub::CheckTargetDevicesState(std::vector targetDevi // Query all key state int rc = ioctl(dev->fd, EVIOCGKEY(sizeof(keyState)), keyState); if (rc < 0) { - DHLOGE("read all key state failed, rc=%{public}d", rc); + DHLOGE("read all key state failed, rc=%d", rc); count += 1; std::this_thread::sleep_for(std::chrono::milliseconds(READ_SLEEP_TIME_MS)); continue; @@ -1577,7 +1574,7 @@ void InputHub::RecordDeviceStates() DHLOGI("Start Record keys states"); ScanAndRecordInputDevices(); std::vector tarDevices = CollectTargetDevices(); - DHLOGI("Check target states device num: %{public}zu", tarDevices.size()); + DHLOGI("Check target states device num: %d", tarDevices.size()); CheckTargetDevicesState(tarDevices); DHLOGI("Finish Record Keys states"); } @@ -1599,7 +1596,7 @@ InputHub::Device::Device(int fd, const std::string &path) : next(nullptr), fd(fd), path(path), identifier({}), classes(0), enabled(false), isShare(false), isVirtual(fd < 0) { // Figure out the kinds of events the device reports. - DHLOGI("Ctor Device for get event mask, fd: %{public}d, path: %{public}s", fd, path.c_str()); + DHLOGI("Ctor Device for get event mask, fd: %d, path: %s", fd, path.c_str()); ioctl(fd, EVIOCGBIT(0, sizeof(evBitmask)), evBitmask); ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keyBitmask)), keyBitmask); ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absBitmask)), absBitmask); @@ -1624,12 +1621,12 @@ int32_t InputHub::Device::Enable() char canonicalPath[PATH_MAX + 1] = {0x00}; if (path.length() == 0 || path.length() > PATH_MAX || realpath(path.c_str(), canonicalPath) == nullptr) { - DHLOGE("path check fail, error path: %{public}s", path.c_str()); + DHLOGE("path check fail, error path: %s", path.c_str()); return ERR_DH_INPUT_HUB_DEVICE_ENABLE_FAIL; } fd = open(canonicalPath, O_RDWR | O_CLOEXEC | O_NONBLOCK); if (fd < 0) { - DHLOGE("could not open %{public}s, %{public}s\n", path.c_str(), ConvertErrNo().c_str()); + DHLOGE("could not open %s, %s\n", path.c_str(), ConvertErrNo().c_str()); return ERR_DH_INPUT_HUB_DEVICE_ENABLE_FAIL; } enabled = true; diff --git a/common/include/test/whitelistunittest/BUILD.gn b/common/include/test/whitelistunittest/BUILD.gn index fedf15fb5d535e5f9e3319cab6796e3508d07423..f305114dd94f304398170f5b86744b53491bd05d 100755 --- a/common/include/test/whitelistunittest/BUILD.gn +++ b/common/include/test/whitelistunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -66,7 +66,6 @@ ohos_unittest("distributed_input_white_list_test") { "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", ] diff --git a/common/include/white_list_util.cpp b/common/include/white_list_util.cpp index 07cb3e88c43ff01f61fc4d44aeee2ff319d69e0f..f44c4038981f71d7fd42da8d7c3be8f71b7ab4a9 100644 --- a/common/include/white_list_util.cpp +++ b/common/include/white_list_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -72,7 +72,7 @@ int32_t WhiteListUtil::Init() } std::ifstream inFile(path, std::ios::in | std::ios::binary); if (!inFile.is_open()) { - DHLOGE("WhiteListUtil Init error, file open fail path=%{public}s", path); + DHLOGE("WhiteListUtil Init error, file open fail path=%s", path); return ERR_DH_INPUT_WHILTELIST_INIT_FAIL; } @@ -83,7 +83,7 @@ int32_t WhiteListUtil::Init() std::size_t lineNum = 0; while (getline(inFile, line)) { if ((++lineNum > MAX_LINE_NUM) || !IsValidLine(line)) { - DHLOGE("whitelist cfg file has too many lines or too complicated. lineNum is %{public}zu", lineNum); + DHLOGE("whitelist cfg file has too many lines or too complicated. lineNum is %d", lineNum); break; } vecKeyCode.clear(); @@ -117,15 +117,15 @@ int32_t WhiteListUtil::Init() bool WhiteListUtil::IsValidLine(const std::string &line) const { if (line.size() > MAX_CHAR_PER_LINE_NUM) { - DHLOGE("This line is too long, size is %{public}zu", line.size()); + DHLOGE("This line is too long, size is %d", line.size()); return false; } if (std::count(line.begin(), line.end(), SPLIT_COMMA[0]) > MAX_SPLIT_COMMA_NUM) { - DHLOGE("This line %{public}s has too many SPLIT_COMMA", line.c_str()); + DHLOGE("This line %s has too many SPLIT_COMMA", line.c_str()); return false; } if (std::count(line.begin(), line.end(), SPLIT_LINE[0]) > MAX_SPLIT_LINE_NUM) { - DHLOGE("This line %{public}s has too many SPLIT_LINE", line.c_str()); + DHLOGE("This line %s has too many SPLIT_LINE", line.c_str()); return false; } return true; @@ -134,12 +134,12 @@ bool WhiteListUtil::IsValidLine(const std::string &line) const bool WhiteListUtil::CheckIsNumber(const std::string &str) const { if (str.empty() || str.size() > MAX_KEY_CODE_NUM) { - DHLOGE("KeyCode size %{public}zu, is zero or too long.", str.size()); + DHLOGE("KeyCode size %d, is zero or too long.", str.size()); return false; } for (char const &c : str) { if (std::isdigit(c) == 0) { - DHLOGE("Check KeyCode format fail, %{public}s.", str.c_str()); + DHLOGE("Check KeyCode format fail, %s.", str.c_str()); return false; } } @@ -191,7 +191,7 @@ void WhiteListUtil::SplitCombinationKey(std::string &line, TYPE_KEY_CODE_VEC &ve int32_t WhiteListUtil::SyncWhiteList(const std::string &deviceId, const TYPE_WHITE_LIST_VEC &vecWhiteList) { - DHLOGI("deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("deviceId=%s", GetAnonyString(deviceId).c_str()); std::lock_guard lock(mutex_); mapDeviceWhiteList_[deviceId] = vecWhiteList; @@ -252,7 +252,7 @@ void WhiteListUtil::GetAllComb(TYPE_COMBINATION_KEY_VEC vecs, WhiteListItemHash int32_t WhiteListUtil::ClearWhiteList(const std::string &deviceId) { - DHLOGI("deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("deviceId=%s", GetAnonyString(deviceId).c_str()); std::lock_guard lock(mutex_); mapDeviceWhiteList_.erase(deviceId); @@ -268,17 +268,17 @@ int32_t WhiteListUtil::ClearWhiteList(void) int32_t WhiteListUtil::GetWhiteList(const std::string &deviceId, TYPE_WHITE_LIST_VEC &vecWhiteList) { - DHLOGI("GetWhiteList start, deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("GetWhiteList start, deviceId=%s", GetAnonyString(deviceId).c_str()); std::lock_guard lock(mutex_); TYPE_DEVICE_WHITE_LIST_MAP::const_iterator iter = mapDeviceWhiteList_.find(deviceId); if (iter != mapDeviceWhiteList_.end()) { vecWhiteList = iter->second; - DHLOGI("GetWhiteList success, deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("GetWhiteList success, deviceId=%s", GetAnonyString(deviceId).c_str()); return DH_SUCCESS; } - DHLOGI("GetWhiteList fail, deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("GetWhiteList fail, deviceId=%s", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_WHILTELIST_GET_WHILTELIST_FAIL; } @@ -296,7 +296,7 @@ std::string WhiteListUtil::GetBusinessEventHash(const BusinessEvent &event) bool WhiteListUtil::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { - DHLOGI("IsNeedFilterOut start, deviceId=%{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("IsNeedFilterOut start, deviceId=%s", GetAnonyString(deviceId).c_str()); std::lock_guard lock(mutex_); if (combKeysHashMap_.empty()) { @@ -311,7 +311,7 @@ bool WhiteListUtil::IsNeedFilterOut(const std::string &deviceId, const BusinessE } std::string hash = GetBusinessEventHash(event); - DHLOGI("Searched business event hash: %{public}s", hash.c_str()); + DHLOGI("Searched business event hash: %s", hash.c_str()); return combKeysHashMap_[deviceId].find(hash) != combKeysHashMap_[deviceId].end(); } diff --git a/dfx_utils/BUILD.gn b/dfx_utils/BUILD.gn index 7e020bc616a48d2a76411be6344c721067077371..baff9a81de8b2e9f5a9b0be072aef82abc045a93 100755 --- a/dfx_utils/BUILD.gn +++ b/dfx_utils/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -37,6 +37,7 @@ ohos_shared_library("libdinput_dfx_utils") { ] sources = [ + "${utils_path}/src/dinput_log.cpp", "src/hidumper.cpp", "src/hisysevent_util.cpp", ] diff --git a/dfx_utils/src/hidumper.cpp b/dfx_utils/src/hidumper.cpp index fe2de7a93caaf9c357e6ba4e059ed2dd9cb4317e..a7febfc0a7f2af547347ac87dd5be7ef941b3a2a 100644 --- a/dfx_utils/src/hidumper.cpp +++ b/dfx_utils/src/hidumper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -53,7 +53,7 @@ bool HiDumper::HiDump(const std::vector &args, std::string &result) result.clear(); int32_t argsSize = static_cast(args.size()); for (int32_t i = 0; i < argsSize; i++) { - DHLOGI("HiDumper Dump args[%{public}d]: %{public}s.", i, args.at(i).c_str()); + DHLOGI("HiDumper Dump args[%d]: %s.", i, args.at(i).c_str()); } if (ProcessDump(args[0], result) != DH_SUCCESS) { return false; diff --git a/dfx_utils/src/hisysevent_util.cpp b/dfx_utils/src/hisysevent_util.cpp index 1f0cbf73ba5b5d00b52aa3efdab49b3b7a2806b0..0604b061eac63a005518866f520c2dc9afea7fd5 100644 --- a/dfx_utils/src/hisysevent_util.cpp +++ b/dfx_utils/src/hisysevent_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 HisyseventUtil::SysEventWriteBehavior(std::string status, std::string msg) OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } @@ -45,7 +45,7 @@ void HisyseventUtil::SysEventWriteBehavior(std::string status, std::string devId "DEVID", GetAnonyString(devId), "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } @@ -59,7 +59,7 @@ void HisyseventUtil::SysEventWriteBehavior(std::string status, std::string devId "DHID", GetAnonyString(dhId), "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } @@ -71,7 +71,7 @@ void HisyseventUtil::SysEventWriteFault(std::string status, std::string msg) OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } @@ -85,7 +85,7 @@ void HisyseventUtil::SysEventWriteFault(std::string status, std::string devId, i "ERROR_CODE", errorCode, "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } @@ -101,7 +101,7 @@ void HisyseventUtil::SysEventWriteFault(std::string status, std::string devId, s "ERROR_CODE", errorCode, "MSG", msg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%{public}d", res); + DHLOGE("Write HiSysEvent error, res:%d", res); } } } // namespace DistributedInput diff --git a/dfx_utils/test/dfxtest/BUILD.gn b/dfx_utils/test/dfxtest/BUILD.gn index 79e3337c149259549ca80561378e2e1c4cc88398..354c2197187d6aec2c6ae52fa73e94c11084132c 100644 --- a/dfx_utils/test/dfxtest/BUILD.gn +++ b/dfx_utils/test/dfxtest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -42,6 +42,7 @@ ohos_unittest("distributed_input_dfx_test") { sources = [ "${dfx_utils_path}/src/hidumper.cpp", "${dfx_utils_path}/src/hisysevent_util.cpp", + "${utils_path}/src/dinput_log.cpp", "distributed_input_dfx_test.cpp", ] diff --git a/inputdevicehandler/BUILD.gn b/inputdevicehandler/BUILD.gn index 4d171b6fcaa0793df3bc3c7e424719485a73a7d2..963087df245ae9724e4ace4fe5f0fbb4467d0323 100755 --- a/inputdevicehandler/BUILD.gn +++ b/inputdevicehandler/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -61,7 +61,6 @@ ohos_shared_library("libdinput_handler") { external_deps = [ "c_utils:utils", "dsoftbus:softbus_client", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index 3d6aa414cfae72b09977649a837ee20ab185bb44..6f2e6c47e2c78e420f4dd6c1f95ff7d1d8d69e00 100644 --- a/inputdevicehandler/src/distributed_input_handler.cpp +++ b/inputdevicehandler/src/distributed_input_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -55,8 +55,8 @@ DistributedInputHandler::~DistributedInputHandler() void DistributedInputHandler::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) { - DHLOGI("[%{public}s] %{public}d, %{public}d, %{public}d, %{public}d, %{public}s.\n", (pBuf.name).c_str(), - pBuf.bus, pBuf.vendor, pBuf.product, pBuf.version, GetAnonyString(pBuf.descriptor).c_str()); + DHLOGI("[%s] %d, %d, %d, %d, %s.\n", (pBuf.name).c_str(), pBuf.bus, pBuf.vendor, pBuf.product, pBuf.version, + GetAnonyString(pBuf.descriptor).c_str()); nlohmann::json tmpJson; tmpJson[DEVICE_NAME] = pBuf.name; tmpJson[PHYSICAL_PATH] = pBuf.physicalPath; @@ -82,7 +82,7 @@ void DistributedInputHandler::StructTransJson(const InputDevice &pBuf, std::stri std::ostringstream stream; stream << tmpJson.dump(); strDescriptor = stream.str(); - DHLOGI("Record InputDevice json info: %{public}s", strDescriptor.c_str()); + DHLOGI("Record InputDevice json info: %s", strDescriptor.c_str()); return; } @@ -159,7 +159,7 @@ bool DistributedInputHandler::InitCollectEventsThread() collectThreadID_ = -1; int32_t ret = pthread_create(&collectThreadID_, &attr, CollectEventsThread, this); if (ret != 0) { - DHLOGE("DistributedInputHandler::InitCollectEventsThread create thread failed:%{public}d \n", ret); + DHLOGE("DistributedInputHandler::InitCollectEventsThread create thread failed:%d \n", ret); pthread_attr_destroy(&attr); collectThreadID_ = -1; isCollectingEvents_ = false; @@ -189,7 +189,7 @@ void DistributedInputHandler::StartInputMonitorDeviceThread() while (isCollectingEvents_) { size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, inputDeviceBufferSize); if (count > 0) { - DHLOGI("Count: %{public}zu", count); + DHLOGI("Count: %zu", count); for (size_t iCnt = 0; iCnt < count; iCnt++) { NotifyHardWare(iCnt); } diff --git a/inputdevicehandler/test/inputhandlertest/BUILD.gn b/inputdevicehandler/test/inputhandlertest/BUILD.gn index 9388098d116ea99435f3dbf4bd990576ca5b930c..f770e8dbc335b252d541fac724e84702b49710a3 100644 --- a/inputdevicehandler/test/inputhandlertest/BUILD.gn +++ b/inputdevicehandler/test/inputhandlertest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -71,7 +71,6 @@ ohos_unittest("distributed_input_handler_test") { external_deps = [ "c_utils:utils", "dsoftbus:softbus_client", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index 92bc5d8f1385c223ec57b3caef7d9be630381fbd..840aa3b137cf79d851ab1079a7019df3a8a4f78b 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -103,7 +103,6 @@ ohos_shared_library("libdinput_sdk") { "config_policy:configpolicy_util", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/inner_kits/test/unittest/BUILD.gn b/interfaces/inner_kits/test/unittest/BUILD.gn index 8e373278078ae291af080a5d9719de982fa6479b..c866c1cef995ef79525230cca1119d82aa63100e 100644 --- a/interfaces/inner_kits/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -103,7 +103,6 @@ ohos_unittest("distributed_input_inner_test") { "c_utils:utils", "config_policy:configpolicy_util", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", ] diff --git a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp index a466428ec33d46d47b81ce525d56373ac8da76f3..d48faf2ef7a6caa973676e5b010f72c733c0fc5d 100644 --- a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp +++ b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -73,7 +73,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%{public}zu.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } @@ -198,8 +198,8 @@ bool DistributedInputClient::IsTouchEventNeedFilterOut(const TouchScreenEvent &e for (const auto &[id, sinkInfo] : sinkInfos) { auto info = sinkInfo.transformInfo; - DHLOGI("event.absX:%{public}d, info.sinkWinPhyX:%{public}d, info.sinkProjPhyWidth:%{public}d\n", event.absX, - info.sinkWinPhyX, info.sinkProjPhyWidth); + DHLOGI("event.absX:%d, info.sinkWinPhyX:%d, info.sinkProjPhyWidth:%d\n", event.absX, info.sinkWinPhyX, + info.sinkProjPhyWidth); if ((event.absX >= info.sinkWinPhyX) && (event.absX <= (info.sinkWinPhyX + info.sinkProjPhyWidth)) && (event.absY >= info.sinkWinPhyY) && (event.absY <= (info.sinkWinPhyY + info.sinkProjPhyHeight))) { return true; diff --git a/interfaces/ipc/src/dinput_sa_manager.cpp b/interfaces/ipc/src/dinput_sa_manager.cpp index 9f03e486f51a3b73144a30f42576e22255f101f1..243ec7e69e74550cefbf995c20a20b99090abdc4 100644 --- a/interfaces/ipc/src/dinput_sa_manager.cpp +++ b/interfaces/ipc/src/dinput_sa_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * 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 @@ -64,7 +64,7 @@ void DInputSAManager::SystemAbilityListener::OnRemoveSystemAbility(int32_t syste } } } - DHLOGI("sa %{public}d is removed.", systemAbilityId); + DHLOGI("sa %d is removed.", systemAbilityId); } void DInputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) @@ -92,7 +92,7 @@ void DInputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAb DINPUT_CLIENT_HANDLER_MSG_DELAY_TIME, AppExecFwk::EventQueue::Priority::IMMEDIATE); } } - DHLOGI("sa %{public}d is added.", systemAbilityId); + DHLOGI("sa %d is added.", systemAbilityId); } void DInputSAManager::Init() @@ -107,22 +107,22 @@ void DInputSAManager::Init() } if (!isSubscribeSrcSAChangeListener.load()) { - DHLOGI("try subscribe source sa change listener, saId:%{public}d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); + DHLOGI("try subscribe source sa change listener, sa id: %d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); int32_t ret = systemAbilityManager->SubscribeSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, saListenerCallback); if (ret != DH_SUCCESS) { - DHLOGE("subscribe source sa change failed: %{public}d", ret); + DHLOGE("subscribe source sa change failed: %d", ret); return; } isSubscribeSrcSAChangeListener.store(true); } if (!isSubscribeSinkSAChangeListener.load()) { - DHLOGI("try subscribe sink sa change listener, saId:%{public}d", DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID); + DHLOGI("try subscribe sink sa change listener, sa id: %d", DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID); int32_t ret = systemAbilityManager->SubscribeSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, saListenerCallback); if (ret != DH_SUCCESS) { - DHLOGE("subscribe sink sa change failed: %{public}d", ret); + DHLOGE("subscribe sink sa change failed: %d", ret); return; } isSubscribeSinkSAChangeListener.store(true); @@ -147,11 +147,11 @@ bool DInputSAManager::GetDInputSourceProxy() return false; } - DHLOGI("try subscribe source sa change listener, saId:%{public}d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); + DHLOGI("try subscribe source sa change listener, sa id: %d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); int32_t ret = systemAbilityManager->SubscribeSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, saListenerCallback); if (ret != DH_SUCCESS) { - DHLOGE("subscribe source sa change failed: %{public}d", ret); + DHLOGE("subscribe source sa change failed: %d", ret); return false; } isSubscribeSrcSAChangeListener.store(true); @@ -171,7 +171,7 @@ bool DInputSAManager::GetDInputSourceProxy() return false; } - DHLOGI("try get sa: %{public}d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); + DHLOGI("try get sa: %d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); sptr remoteObject = systemAbilityManager->GetSystemAbility( DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); if (!remoteObject) { @@ -218,11 +218,11 @@ bool DInputSAManager::GetDInputSinkProxy() return false; } - DHLOGI("try subscribe sink sa change listener, sa id: %{public}d", DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID); + DHLOGI("try subscribe sink sa change listener, sa id: %d", DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID); int32_t ret = systemAbilityManager->SubscribeSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, saListenerCallback); if (ret != DH_SUCCESS) { - DHLOGE("subscribe sink sa change failed: %{public}d", ret); + DHLOGE("subscribe sink sa change failed: %d", ret); return false; } isSubscribeSinkSAChangeListener.store(true); @@ -295,7 +295,7 @@ int32_t DInputSAManager::RestoreRegisterListenerAndCallback() int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterSimulationEventListener(listener); if (ret != DH_SUCCESS) { result = ret; - DHLOGE("SA execute RegisterSimulationEventListener fail, ret = %{public}d", ret); + DHLOGE("SA execute RegisterSimulationEventListener fail, ret = %d", ret); } } } @@ -310,7 +310,7 @@ int32_t DInputSAManager::RestoreRegisterListenerAndCallback() int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterSessionStateCb(callback); if (ret != DH_SUCCESS) { result = ret; - DHLOGE("SA execute RegisterSessionStateCb fail, ret = %{public}d", ret); + DHLOGE("SA execute RegisterSessionStateCb fail, ret = %d", ret); } } } diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index 36948f40c2c1dbe64f6596a75c40bd31765a09f7..7f8376697ee8616866dbb4b73e0e93e8111f10e5 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -104,7 +104,7 @@ void DistributedInputClient::GetSinkScreenInfosCb::OnResult(const std::string &s int32_t DistributedInputClient::SharingDhIdListenerCb::OnSharing(std::string dhId) { std::lock_guard lock(DistributedInputClient::GetInstance().sharingDhIdsMtx_); - DHLOGI("Add Sharing Local dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("Add Sharing Local dhId: %s", GetAnonyString(dhId).c_str()); DistributedInputClient::GetInstance().sharingDhIds_.insert(dhId); return DH_SUCCESS; } @@ -112,7 +112,7 @@ int32_t DistributedInputClient::SharingDhIdListenerCb::OnSharing(std::string dhI int32_t DistributedInputClient::SharingDhIdListenerCb::OnNoSharing(std::string dhId) { std::lock_guard lock(DistributedInputClient::GetInstance().sharingDhIdsMtx_); - DHLOGI("Remove No Sharing Local dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("Remove No Sharing Local dhId: %s", GetAnonyString(dhId).c_str()); DistributedInputClient::GetInstance().sharingDhIds_.erase(dhId); return DH_SUCCESS; } @@ -126,12 +126,12 @@ DistributedInputClient::DInputClientEventHandler::DInputClientEventHandler( void DistributedInputClient::DInputClientEventHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) { uint32_t eventId = event->GetInnerEventId(); - DHLOGI("DInputClientEventHandler ProcessEvent start eventId:%{public}d.", eventId); + DHLOGI("DInputClientEventHandler ProcessEvent start eventId:%d.", eventId); if (eventId == DINPUT_CLIENT_CHECK_SOURCE_CALLBACK_REGISTER_MSG) { DistributedInputClient::GetInstance().CheckSourceRegisterCallback(); int32_t result = DInputSAManager::GetInstance().RestoreRegisterListenerAndCallback(); if (result != DH_SUCCESS) { - DHLOGE("source sa execute RestoreRegisterListenerAndCallback fail, result = %{public}d", result); + DHLOGE("source sa execute RestoreRegisterListenerAndCallback fail, result = %d", result); } return; } @@ -159,8 +159,8 @@ void DistributedInputClient::DInputClientEventHandler::ProcessEvent(const AppExe void DistributedInputClient::CheckSourceRegisterCallback() { - DHLOGI("CheckSourceRegisterCallback called, isAddWhiteListCbReg[%{public}d], isDelWhiteListCbReg[%{public}d], " - "isNodeMonitorCbReg[%{public}d], isSimulationEventCbReg[%{public}d]", + DHLOGI("CheckSourceRegisterCallback called, isAddWhiteListCbReg[%d], isDelWhiteListCbReg[%d]," + "isNodeMonitorCbReg[%d], isSimulationEventCbReg[%d]", isAddWhiteListCbReg.load(), isDelWhiteListCbReg.load(), isNodeMonitorCbReg.load(), isSimulationEventCbReg.load()); @@ -170,7 +170,7 @@ void DistributedInputClient::CheckSourceRegisterCallback() void DistributedInputClient::CheckSinkRegisterCallback() { - DHLOGI("CheckSinkRegisterCallback called, isSharingDhIdsReg[%{public}d]", isSharingDhIdsReg.load()); + DHLOGI("CheckSinkRegisterCallback called, isSharingDhIdsReg[%d]", isSharingDhIdsReg.load()); CheckSharingDhIdsCallback(); CheckSinkScreenInfoCallback(); } @@ -315,7 +315,7 @@ int32_t DistributedInputClient::ReleaseSink() int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const std::string ¶meters, const std::shared_ptr &callback) { - DHLOGI("DinputRegister called, deviceId: %{public}s, dhId: %{public}s, parameters: %{public}s.", + DHLOGI("DinputRegister called, deviceId: %s, dhId: %s, parameters: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), SetAnonyId(parameters).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputRegister client fail."); @@ -342,7 +342,7 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &d int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, const std::shared_ptr &callback) { - DHLOGI("DinputUnregister called, deviceId: %{public}s, dhId: %{public}s.", + DHLOGI("DinputUnregister called, deviceId: %s, dhId: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputUnregister client fail."); @@ -368,7 +368,7 @@ int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string int32_t DistributedInputClient::PrepareRemoteInput(const std::string &deviceId, sptr callback) { - DHLOGI("DinputPrepare called, deviceId: %{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGI("DinputPrepare called, deviceId: %s.", GetAnonyString(deviceId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputPrepare client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -382,7 +382,7 @@ int32_t DistributedInputClient::PrepareRemoteInput(const std::string &deviceId, int32_t DistributedInputClient::UnprepareRemoteInput(const std::string &deviceId, sptr callback) { - DHLOGI("DinputUnprepare called, deviceId: %{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGI("DinputUnprepare called, deviceId: %s.", GetAnonyString(deviceId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputUnprepare client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -396,8 +396,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput(const std::string &deviceId int32_t DistributedInputClient::StartRemoteInput( const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { - DHLOGI("DinputStart called, deviceId: %{public}s, inputTypes: %{public}d.", - GetAnonyString(deviceId).c_str(), inputTypes); + DHLOGI("DinputStart called, deviceId: %s, inputTypes: %d.", GetAnonyString(deviceId).c_str(), inputTypes); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStart client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -411,8 +410,7 @@ int32_t DistributedInputClient::StartRemoteInput( int32_t DistributedInputClient::StopRemoteInput(const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { - DHLOGI("DinputStop called, deviceId: %{public}s, inputTypes: %{public}d.", - GetAnonyString(deviceId).c_str(), inputTypes); + DHLOGI("DinputStop called, deviceId: %s, inputTypes: %d.", GetAnonyString(deviceId).c_str(), inputTypes); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStop client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -426,8 +424,8 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &deviceId, con int32_t DistributedInputClient::StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) { - DHLOGI("DinputStart called, srcId: %{public}s, sinkId: %{public}s, inputTypes: %{public}d.", - GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str(), inputTypes); + DHLOGI("DinputStart called, srcId: %s, sinkId: %s, inputTypes: %d.", GetAnonyString(srcId).c_str(), + GetAnonyString(sinkId).c_str(), inputTypes); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStart relay type client fail."); @@ -442,8 +440,8 @@ int32_t DistributedInputClient::StartRemoteInput(const std::string &srcId, const int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) { - DHLOGI("DinputStop called, srcId: %{public}s, sinkId: %{public}s, inputTypes: %{public}d.", - GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str(), inputTypes); + DHLOGI("DinputStop called, srcId: %s, sinkId: %s, inputTypes: %d.", GetAnonyString(srcId).c_str(), + GetAnonyString(sinkId).c_str(), inputTypes); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStop relay type client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -457,7 +455,7 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const int32_t DistributedInputClient::PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) { - DHLOGI("DinputPrepare called, srcId: %{public}s, sinkId: %{public}s.", GetAnonyString(srcId).c_str(), + DHLOGI("DinputPrepare called, srcId: %s, sinkId: %s.", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputPrepare relay proxy error, client fail."); @@ -472,7 +470,7 @@ int32_t DistributedInputClient::PrepareRemoteInput(const std::string &srcId, con int32_t DistributedInputClient::UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) { - DHLOGI("DinputUnprepare called, srcId: %{public}s, sinkId: %{public}s.", GetAnonyString(srcId).c_str(), + DHLOGI("DinputUnprepare called, srcId: %s, sinkId: %s.", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputUnprepare relay proxy error, client fail."); @@ -487,7 +485,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput(const std::string &srcId, c int32_t DistributedInputClient::StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) { - DHLOGI("DinputStart called, sinkId: %{public}s.", GetAnonyString(sinkId).c_str()); + DHLOGI("DinputStart called, sinkId: %s.", GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStart dhid proxy error, client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -501,7 +499,7 @@ int32_t DistributedInputClient::StartRemoteInput(const std::string &sinkId, cons int32_t DistributedInputClient::StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) { - DHLOGI("DinputStop called, sinkId: %{public}s.", GetAnonyString(sinkId).c_str()); + DHLOGI("DinputStop called, sinkId: %s.", GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStop dhid proxy error, client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -515,8 +513,7 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &sinkId, const int32_t DistributedInputClient::StartRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) { - DHLOGI("DinputStart called, srcId: %{public}s, sinkId: %{public}s.", GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("DinputStart called, srcId: %s, sinkId: %s.", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStart proxy error, client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -530,8 +527,7 @@ int32_t DistributedInputClient::StartRemoteInput(const std::string &srcId, const int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) { - DHLOGI("DinputStop called, srcId: %{public}s, sinkId: %{public}s.", GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("DinputStop called, srcId: %s, sinkId: %s.", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("DinputStop proxy error, client fail."); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; @@ -544,7 +540,7 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const bool DistributedInputClient::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { - DHLOGI("IsNeedFilterOut called, deviceId: %{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("IsNeedFilterOut called, deviceId: %s", GetAnonyString(deviceId).c_str()); if (deviceId.empty() || (deviceId.size() > DEV_ID_LENGTH_MAX)) { DHLOGE("IsNeedFilterOut param deviceId is empty."); return false; @@ -556,8 +552,7 @@ bool DistributedInputClient::IsTouchEventNeedFilterOut(const TouchScreenEvent &e { std::lock_guard lock(operationMutex_); for (const auto &info : screenTransInfos) { - DHLOGI("sinkProjPhyWidth: %{public}d sinkProjPhyHeight: %{public}d", info.sinkProjPhyWidth, - info.sinkProjPhyHeight); + DHLOGI("sinkProjPhyWidth: %d sinkProjPhyHeight: %d", info.sinkProjPhyWidth, info.sinkProjPhyHeight); if ((event.absX >= info.sinkWinPhyX) && (event.absX <= (info.sinkWinPhyX + info.sinkProjPhyWidth)) && (event.absY >= info.sinkWinPhyY) && (event.absY <= (info.sinkWinPhyY + info.sinkProjPhyHeight))) { return true; @@ -597,7 +592,7 @@ int32_t DistributedInputClient::RegisterSimulationEventListener(sptrUnregisterSimulationEventListener(listener); if (ret != DH_SUCCESS) { - DHLOGE("UnregisterSimulationEventListener Failed, ret = %{public}d", ret); + DHLOGE("UnregisterSimulationEventListener Failed, ret = %d", ret); } DInputSAManager::GetInstance().RemoveSimEventListenerFromCache(listener); return ret; @@ -655,7 +650,7 @@ void DistributedInputClient::AddWhiteListInfos(const std::string &deviceId, cons return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult deviceId: %{public}s, json str: %{public}s, json size:%{public}zu.\n", + DHLOGI("AddWhiteListInfosCb OnResult deviceId: %s, json str: %s, json size:%zu.\n", GetAnonyString(deviceId).c_str(), GetAnonyString(strJson).c_str(), jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); @@ -680,16 +675,16 @@ void DistributedInputClient::UpdateSinkScreenInfos(const std::string &strJson) return; } size_t jsonSize = inputData.size(); - DHLOGI("OnResult json str: %{public}s, json size:%{public}zu.\n", GetAnonyString(strJson).c_str(), jsonSize); + DHLOGI("OnResult json str: %s, json size:%zu.\n", GetAnonyString(strJson).c_str(), jsonSize); std::vector> transInfos = inputData; for (auto info : transInfos) { if (info.size() != SINK_SCREEN_INFO_SIZE) { - DHLOGE("get sinkScreenInfo failed, info size is %{public}zu", info.size()); + DHLOGE("get sinkScreenInfo failed, info size is %d", info.size()); continue; } TransformInfo tmp{info[0], info[1], info[2], info[3]}; screenTransInfos.emplace_back(tmp); - DHLOGI("screenTransInfos size %{public}zu", screenTransInfos.size()); + DHLOGI("screenTransInfos size %d", screenTransInfos.size()); } } @@ -698,20 +693,20 @@ int32_t DistributedInputClient::NotifyStartDScreen(const std::string &sinkDevId, { sptr remoteDInput = GetRemoteDInput(sinkDevId); if (remoteDInput == nullptr || !remoteDInput->AsObject()) { - DHLOGE("GetRemoteDInput failed, networkId = %{public}s", GetAnonyString(sinkDevId).c_str()); + DHLOGE("GetRemoteDInput failed, networkId = %s", GetAnonyString(sinkDevId).c_str()); return ERR_DH_INPUT_RPC_GET_REMOTE_DINPUT_FAIL; } std::string srcScreenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(srcDevId, srcWinId); SrcScreenInfo srcScreenInfo = DInputContext::GetInstance().GetSrcScreenInfo(srcScreenInfoKey); - DHLOGI("DinputSinkProxy the data: devId: %{public}s, sourceWinId: %{public}" PRIu64 ", sourceWinWidth: %{public}d, " - "sourceWinHeight: %{public}d, sourcePhyId: %{public}s, sourcePhyFd: %{public}d, sourcePhyWidth: %{public}d, " - "sourcePhyHeight: %{public}d", GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, - srcScreenInfo.sourceWinWidth, srcScreenInfo.sourceWinHeight, GetAnonyString(srcScreenInfo.sourcePhyId).c_str(), - srcScreenInfo.sourcePhyFd, srcScreenInfo.sourcePhyWidth, srcScreenInfo.sourcePhyHeight); + DHLOGI("DistributedInputSinkProxy the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d, sourceWinHeight: %d," + "sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", + GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, srcScreenInfo.sourceWinWidth, + srcScreenInfo.sourceWinHeight, GetAnonyString(srcScreenInfo.sourcePhyId).c_str(), srcScreenInfo.sourcePhyFd, + srcScreenInfo.sourcePhyWidth, srcScreenInfo.sourcePhyHeight); auto ret = remoteDInput->NotifyStartDScreen(srcScreenInfo); - DHLOGI("NotifyStartDScreen, retCode = %{public}d", ret); + DHLOGI("NotifyStartDScreen, retCode = %d", ret); if (ret != DH_SUCCESS) { - DHLOGE("NotifyStartDScreen failed, errCode = %{public}d", ret); + DHLOGE("NotifyStartDScreen failed, errCode = %d", ret); } return ret; } @@ -720,20 +715,20 @@ int32_t DistributedInputClient::NotifyStopDScreen(const std::string &networkId, { sptr remoteDInput = GetRemoteDInput(networkId); if (remoteDInput == nullptr || !remoteDInput->AsObject()) { - DHLOGE("GetRemoteDInput failed, networkId = %{public}s", GetAnonyString(networkId).c_str()); + DHLOGE("GetRemoteDInput failed, networkId = %s", GetAnonyString(networkId).c_str()); return ERR_DH_INPUT_RPC_GET_REMOTE_DINPUT_FAIL; } auto ret = remoteDInput->NotifyStopDScreen(srcScreenInfoKey); - DHLOGI("NotifyStopDScreen, retCode = %{public}d", ret); + DHLOGI("NotifyStopDScreen, retCode = %d", ret); if (ret != DH_SUCCESS) { - DHLOGE("NotifyStopDScreen failed, errCode = %{public}d", ret); + DHLOGE("NotifyStopDScreen failed, errCode = %d", ret); } return ret; } sptr DistributedInputClient::GetRemoteDInput(const std::string &networkId) const { - DHLOGI("GetRemoteDInput start, networkId = %{public}s", GetAnonyString(networkId).c_str()); + DHLOGI("GetRemoteDInput start, networkId = %s", GetAnonyString(networkId).c_str()); if (networkId.empty()) { DHLOGE("networkId is empty"); return nullptr; diff --git a/interfaces/ipc/src/distributed_input_sink_proxy.cpp b/interfaces/ipc/src/distributed_input_sink_proxy.cpp index 6af28e2a3d9229a42a8ed5575b17646fefc84418..e8962deaf702b73a1943473d2edf2a9fe14e4f34 100644 --- a/interfaces/ipc/src/distributed_input_sink_proxy.cpp +++ b/interfaces/ipc/src/distributed_input_sink_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -99,12 +99,11 @@ int32_t DistributedInputSinkProxy::NotifyStartDScreen(const SrcScreenInfo &remot DHLOGE("WriteInterfaceToken fail!"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } - DHLOGI("DinputSinkProxy the data: devId: %{public}s, sourceWinId: %{public}" PRIu64 ", sourceWinWidth: %{public}d, " - "sourceWinHeight: %{public}d, sourcePhyId: %{public}s, sourcePhyFd: %{public}d, sourcePhyWidth: %{public}d, " - "sourcePhyHeight: %{public}d", GetAnonyString(remoteCtrlInfo.devId).c_str(), remoteCtrlInfo.sourceWinId, - remoteCtrlInfo.sourceWinWidth, remoteCtrlInfo.sourceWinHeight, - GetAnonyString(remoteCtrlInfo.sourcePhyId).c_str(), remoteCtrlInfo.sourcePhyFd, - remoteCtrlInfo.sourcePhyWidth, remoteCtrlInfo.sourcePhyHeight); + DHLOGI("DistributedInputSinkProxy the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d, sourceWinHeight: %d, " + "sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", + GetAnonyString(remoteCtrlInfo.devId).c_str(), remoteCtrlInfo.sourceWinId, remoteCtrlInfo.sourceWinWidth, + remoteCtrlInfo.sourceWinHeight, GetAnonyString(remoteCtrlInfo.sourcePhyId).c_str(), + remoteCtrlInfo.sourcePhyFd, remoteCtrlInfo.sourcePhyWidth, remoteCtrlInfo.sourcePhyHeight); if (!data.WriteString(remoteCtrlInfo.devId) || !data.WriteInt32(remoteCtrlInfo.sessionId) || !data.WriteString(remoteCtrlInfo.uuid) || !data.WriteUint64(remoteCtrlInfo.sourceWinId) || !data.WriteUint32(remoteCtrlInfo.sourceWinWidth) || !data.WriteUint32(remoteCtrlInfo.sourceWinHeight) || diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index dfc0694101e3833387609f354c238df0469aad49..819ca787c26c9d609c7853c006c9800505e42102 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -68,7 +68,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel & } auto iter = memberFuncMap_.find(code); if (iter == memberFuncMap_.end()) { - DHLOGE("invalid request code is %{public}d.", code); + DHLOGE("invalid request code is %d.", code); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } DistributedInputSinkFunc &func = iter->second; @@ -84,7 +84,7 @@ int32_t DistributedInputSinkStub::InitInner(MessageParcel &data, MessageParcel & DHLOGI("DistributedInputSinkStub InitInner start"); int32_t ret = Init(); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSinkStub write ret failed, ret = %{public}d", ret); + DHLOGE("DistributedInputSinkStub write ret failed, ret = %d", ret); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } return ret; @@ -98,7 +98,7 @@ int32_t DistributedInputSinkStub::ReleaseInner(MessageParcel &data, MessageParce } int32_t ret = Release(); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSinkStub write ret failed, ret = %{public}d", ret); + DHLOGE("DistributedInputSinkStub write ret failed, ret = %d", ret); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } return ret; @@ -117,10 +117,10 @@ int32_t DistributedInputSinkStub::NotifyStartDScreenInner(MessageParcel &data, M uint32_t sourcePhyFd = data.ReadUint32(); uint32_t sourcePhyWidth = data.ReadUint32(); uint32_t sourcePhyHeight = data.ReadUint32(); - DHLOGI("OnRemoteRequest the data: devId: %{public}s, sourceWinId: %{public}" PRIu64 ", sourceWinWidth: %{public}d, " - "sourceWinHeight: %{public}d, sourcePhyId: %{public}s, sourcePhyFd: %{public}d, sourcePhyWidth: %{public}d, " - "sourcePhyHeight: %{public}d", GetAnonyString(devId).c_str(), sourceWinId, sourceWinWidth, sourceWinHeight, - GetAnonyString(sourcePhyId).c_str(), sourcePhyFd, sourcePhyWidth, sourcePhyHeight); + DHLOGI("OnRemoteRequest the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d, sourceWinHeight: %d," + "sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", GetAnonyString(devId).c_str(), + sourceWinId, sourceWinWidth, sourceWinHeight, GetAnonyString(sourcePhyId).c_str(), sourcePhyFd, sourcePhyWidth, + sourcePhyHeight); SrcScreenInfo srcScreenInfo = { .devId = devId, .sessionId = sessionId, @@ -135,7 +135,7 @@ int32_t DistributedInputSinkStub::NotifyStartDScreenInner(MessageParcel &data, M }; int32_t ret = NotifyStartDScreen(srcScreenInfo); if (!reply.WriteInt32(ret)) { - DHLOGE("write reply failed ret = %{public}d", ret); + DHLOGE("write reply failed ret = %d", ret); return ERR_DH_INPUT_RPC_REPLY_FAIL; } return ret; @@ -145,10 +145,10 @@ int32_t DistributedInputSinkStub::NotifyStopDScreenInner(MessageParcel &data, Me MessageOption &option) { std::string srcScreenInfoKey = data.ReadString(); - DHLOGI("OnRemoteRequest srcScreenInfoKey: %{public}s", GetAnonyString(srcScreenInfoKey).c_str()); + DHLOGI("OnRemoteRequest srcScreenInfoKey: %s", GetAnonyString(srcScreenInfoKey).c_str()); int ret = NotifyStopDScreen(srcScreenInfoKey); if (!reply.WriteInt32(ret)) { - DHLOGE("write version failed, ret = %{public}d", ret); + DHLOGE("write version failed, ret = %d", ret); return ERR_DH_INPUT_RPC_REPLY_FAIL; } return ret; @@ -164,7 +164,7 @@ int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel } int32_t ret = RegisterSharingDhIdListener(listener); if (!reply.WriteInt32(ret)) { - DHLOGE("RegisterSharingDhIdListenerInner write ret failed, ret = %{public}d", ret); + DHLOGE("RegisterSharingDhIdListenerInner write ret failed, ret = %d", ret); return ERR_DH_INPUT_SINK_STUB_REGISTER_SHARING_DHID_LISTENER_FAIL; } @@ -182,7 +182,7 @@ int32_t DistributedInputSinkStub::RegisterGetSinkScreenInfosInner(MessageParcel } int32_t ret = RegisterGetSinkScreenInfosCallback(callback); if (!reply.WriteInt32(ret)) { - DHLOGE("write ret failed, ret = %{public}d", ret); + DHLOGE("write ret failed, ret = %d", ret); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } return ret; diff --git a/interfaces/ipc/src/distributed_input_source_proxy.cpp b/interfaces/ipc/src/distributed_input_source_proxy.cpp index 8a848e98b8b13514972305028455640e7b6a16a8..67134e20574f478332ecbf868ee932913e6ecc8b 100644 --- a/interfaces/ipc/src/distributed_input_source_proxy.cpp +++ b/interfaces/ipc/src/distributed_input_source_proxy.cpp @@ -146,7 +146,7 @@ int32_t DistributedInputSourceProxy::PrepareRemoteInput( if (ret) { result = reply.ReadInt32(); } - DHLOGI("PrepareRemoteInput end, result:%{public}d", result); + DHLOGI("PrepareRemoteInput end, result:%d", result); return result; } @@ -172,7 +172,7 @@ int32_t DistributedInputSourceProxy::UnprepareRemoteInput(const std::string &dev if (ret) { result = reply.ReadInt32(); } - DHLOGE("UnprepareRemoteInput end, result=%{public}d", result); + DHLOGE("UnprepareRemoteInput end, result=%d", result); return result; } @@ -203,7 +203,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput( if (ret) { result = reply.ReadInt32(); } - DHLOGI("source proxy StartRemoteInput end, result:%{public}d.", result); + DHLOGI("source proxy StartRemoteInput end, result:%d.", result); return result; } @@ -268,7 +268,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &srcId, if (ret) { result = reply.ReadInt32(); } - DHLOGI("source proxy StartRemoteInput end, result:%{public}d.", result); + DHLOGI("source proxy StartRemoteInput end, result:%d.", result); return result; } @@ -333,7 +333,7 @@ int32_t DistributedInputSourceProxy::PrepareRemoteInput(const std::string &srcId if (ret) { result = reply.ReadInt32(); } - DHLOGI("PrepareRemoteInput relay result:%{public}d", result); + DHLOGI("PrepareRemoteInput relay result:%d", result); return result; } @@ -364,7 +364,7 @@ int32_t DistributedInputSourceProxy::UnprepareRemoteInput(const std::string &src if (ret) { result = reply.ReadInt32(); } - DHLOGI("UnprepareRemoteInput relay result:%{public}d", result); + DHLOGI("UnprepareRemoteInput relay result:%d", result); return result; } @@ -402,7 +402,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &sinkId, if (ret) { result = reply.ReadInt32(); } - DHLOGI("Source proxy StartRemoteInput dhid end, result:%{public}d.", result); + DHLOGI("Source proxy StartRemoteInput dhid end, result:%d.", result); return result; } @@ -440,7 +440,7 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string &sinkId, if (ret) { result = reply.ReadInt32(); } - DHLOGI("Source proxy StopRemoteInput dhid end, result:%{public}d.", result); + DHLOGI("Source proxy StopRemoteInput dhid end, result:%d.", result); return result; } @@ -483,7 +483,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &srcId, if (ret) { result = reply.ReadInt32(); } - DHLOGI("Source proxy StartRemoteInput relay dhid end, result:%{public}d.", result); + DHLOGI("Source proxy StartRemoteInput relay dhid end, result:%d.", result); return result; } @@ -526,7 +526,7 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string &srcId, c if (ret) { result = reply.ReadInt32(); } - DHLOGI("Source proxy StopRemoteInput relay dhid end, result:%{public}d.", result); + DHLOGI("Source proxy StopRemoteInput relay dhid end, result:%d.", result); return result; } @@ -678,7 +678,7 @@ bool DistributedInputSourceProxy::SendRequest(const uint32_t code, MessageParcel MessageOption option(MessageOption::TF_SYNC); int32_t result = remote->SendRequest(static_cast(code), data, reply, option); if (result != DH_SUCCESS) { - DHLOGE("DistributedInputSourceProxy SendRequest error, result:%{public}d.", result); + DHLOGE("DistributedInputSourceProxy SendRequest error, result:%d.", result); return false; } return true; diff --git a/interfaces/ipc/src/distributed_input_source_stub.cpp b/interfaces/ipc/src/distributed_input_source_stub.cpp index e1f5292f274f9d445354882b8833d4c896edbbdb..624aabc0638fe3cd845d8abc86d3ff89bc26c7c0 100644 --- a/interfaces/ipc/src/distributed_input_source_stub.cpp +++ b/interfaces/ipc/src/distributed_input_source_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -537,7 +537,7 @@ int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(Messag } int32_t ret = RegisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { - DHLOGE("HandleRegisterSimulationEventListener write ret failed, ret = %{public}d", ret); + DHLOGE("HandleRegisterSimulationEventListener write ret failed, ret = %d", ret); return ERR_DH_INPUT_SOURCE_STUB_REGISTER_SIMULATION_EVENT_LISTENER_FAIL; } @@ -553,7 +553,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterSimulationEventListener(Mess } int32_t ret = UnregisterSimulationEventListener(callback); if (!reply.WriteInt32(ret)) { - DHLOGE("HandleUnregisterSimulationEventListener write ret failed, ret = %{public}d", ret); + DHLOGE("HandleUnregisterSimulationEventListener write ret failed, ret = %d", ret); return ERR_DH_INPUT_SOURCE_STUB_UNREGISTER_SIMULATION_EVENT_LISTENER_FAIL; } @@ -573,7 +573,7 @@ int32_t DistributedInputSourceStub::HandleRegisterSessionStateCb(MessageParcel & } int32_t ret = RegisterSessionStateCb(callback); if (!reply.WriteInt32(ret)) { - DHLOGE("HandleRegisterSessionStateCb write ret failed, ret = %{public}d", ret); + DHLOGE("HandleRegisterSessionStateCb write ret failed, ret = %d", ret); return ERR_DH_INPUT_SRC_STUB_REGISTER_SESSION_STATE_FAIL; } @@ -588,7 +588,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterSessionStateCb(MessageParcel } int32_t ret = UnregisterSessionStateCb(); if (!reply.WriteInt32(ret)) { - DHLOGE("HandleUnregisterSessionStateCb write ret failed, ret = %{public}d", ret); + DHLOGE("HandleUnregisterSessionStateCb write ret failed, ret = %d", ret); return ERR_DH_INPUT_SRC_STUB_UNREGISTER_SESSION_STATE_FAIL; } @@ -598,7 +598,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterSessionStateCb(MessageParcel int32_t DistributedInputSourceStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("OnRemoteRequest code: %{public}u.", code); + DHLOGI("OnRemoteRequest code: %u.", code); if (data.ReadInterfaceToken() != GetDescriptor()) { DHLOGE("DistributedInputSourceStub read token valid failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; diff --git a/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp b/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp index 3a7f4479162e9dea136e4038a2ed27a47cbb586e..cca24ce377fe3c7712c38f88163b9e83082ca1a3 100644 --- a/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp +++ b/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -57,7 +57,7 @@ int32_t SharingDhIdListenerProxy::OnSharing(std::string dhId) if (ret == DH_SUCCESS) { result = reply.ReadInt32(); } else { - DHLOGE("SharingDhIdListenerProxy SendRequest error: %{public}d", ret); + DHLOGE("SharingDhIdListenerProxy SendRequest error: %d", ret); } return result; } @@ -88,7 +88,7 @@ int32_t SharingDhIdListenerProxy::OnNoSharing(std::string dhId) if (ret == DH_SUCCESS) { result = reply.ReadInt32(); } else { - DHLOGE("SharingDhIdListenerProxy SendRequest error: %{public}d", ret); + DHLOGE("SharingDhIdListenerProxy SendRequest error: %d", ret); } return result; } diff --git a/interfaces/ipc/src/simulation_event_listener_proxy.cpp b/interfaces/ipc/src/simulation_event_listener_proxy.cpp index 167df27295f81b6c7a10e187dd008b4a9bbe5de9..3c6079ede56a9601e34c5f0719f8bb6f04bd04af 100644 --- a/interfaces/ipc/src/simulation_event_listener_proxy.cpp +++ b/interfaces/ipc/src/simulation_event_listener_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -64,7 +64,7 @@ int32_t SimulationEventListenerProxy::OnSimulationEvent(uint32_t type, uint32_t if (ret == DH_SUCCESS) { result = reply.ReadInt32(); } else { - DHLOGE("SimulationEventListenerProxy SendRequest error:%{public}d", ret); + DHLOGE("SimulationEventListenerProxy SendRequest error:%d", ret); } return result; } diff --git a/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp b/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp index 9ee36e55f92a72f9edb692bd1decb04dadabf1d3..480b1c6ce729b9d1011ad24a5356aacedf19d903 100644 --- a/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp +++ b/interfaces/ipc/src/start_stop_d_inputs_call_back_proxy.cpp @@ -55,7 +55,7 @@ void StartStopDInputsCallbackProxy::OnResultDhids(const std::string &devId, cons int32_t ret = remote->SendRequest(static_cast(IStartStopDInputsCallback::Message::RESULT_STRING), data, reply, option); if (ret != 0) { - DHLOGE("OnResultDhids error, ret = %{public}d", ret); + DHLOGE("OnResultDhids error, ret = %d", ret); return; } DHLOGI("OnResultDhids success."); diff --git a/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp b/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp index 8d3e8bd8ee9f33fd96924ad47bae88d20479cfba..a448a3e48c58ec4e24be83211f79dbf12eea958a 100644 --- a/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp +++ b/interfaces/ipc/src/start_stop_result_call_back_proxy.cpp @@ -69,7 +69,7 @@ void StartStopResultCallbackProxy::OnStart( int32_t ret = remote->SendRequest(static_cast(IStartStopResultCallback::Message::RESULT_START), data, reply, option); if (ret != 0) { - DHLOGE("StartStopResultCallbackProxy SendRequest errno:%{public}d", ret); + DHLOGE("StartStopResultCallbackProxy SendRequest errno:%d", ret); return; } DHLOGE("OnStart success."); @@ -114,7 +114,7 @@ void StartStopResultCallbackProxy::OnStop( int32_t ret = remote->SendRequest(static_cast(IStartStopResultCallback::Message::RESULT_STOP), data, reply, option); if (ret != 0) { - DHLOGE("StartStopResultCallbackProxy SendRequest errno:%{public}d", ret); + DHLOGE("StartStopResultCallbackProxy SendRequest errno:%d", ret); return; } DHLOGI("OnStop success."); diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/BUILD.gn b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/BUILD.gn index 2a92b501a96cd41a8111a72ab548232f7b40b62d..a58e51ccd7451f9effd48273550e7b20e8a5ac76 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/BUILD.gn +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -100,7 +100,6 @@ ohos_unittest("add_white_list_infos_callbackl_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/clientunittest/BUILD.gn b/interfaces/ipc/test/clientunittest/BUILD.gn index da8b90c3840055227ca530539c4c8c8985a82eb1..208d6b2811216c16966c1b4320621fc02e39ee88 100644 --- a/interfaces/ipc/test/clientunittest/BUILD.gn +++ b/interfaces/ipc/test/clientunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -124,7 +124,6 @@ ohos_unittest("distributed_input_client_test") { "dsoftbus:softbus_client", "eventhandler:libeventhandler", "graphic_surface:surface", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/BUILD.gn b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/BUILD.gn index ff56334d761ca4e1782e5b84cfe6c5351dadc54b..d659e7b47f5e1836a7899b68523b6f2aeaffb4a3 100644 --- a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/BUILD.gn +++ b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -72,7 +72,6 @@ ohos_unittest("del_white_list_infos_callbackl_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/BUILD.gn b/interfaces/ipc/test/dinputsourcecallbackunittest/BUILD.gn index 73a3dbfe64f2ba22b976bef4da4002b5bb985dbb..dd96fc98bb08552855654be5ce41a07fc07762a5 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/BUILD.gn +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -100,7 +100,6 @@ ohos_unittest("dinput_source_callback_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/ipcunittest/BUILD.gn b/interfaces/ipc/test/ipcunittest/BUILD.gn index 4a9cdaf1ee0508f5328ce168cf4a80c48eb88a70..1a64cadb9047b74cbe93be9c74be0bd689db2536 100644 --- a/interfaces/ipc/test/ipcunittest/BUILD.gn +++ b/interfaces/ipc/test/ipcunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -110,7 +110,6 @@ ohos_unittest("distributed_input_ipc_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/unpreparedinputcallbackunittest/BUILD.gn b/interfaces/ipc/test/unpreparedinputcallbackunittest/BUILD.gn index 49ffca92a862f042b8f7aa4aa3ba4877795fe0a2..6fa67dacacc3f9be30e2937eb7e83d78d0c69499 100644 --- a/interfaces/ipc/test/unpreparedinputcallbackunittest/BUILD.gn +++ b/interfaces/ipc/test/unpreparedinputcallbackunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -72,7 +72,6 @@ ohos_unittest("unprepare_d_input_call_back_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/ipc/test/unregisterdinputcallbackunittest/BUILD.gn b/interfaces/ipc/test/unregisterdinputcallbackunittest/BUILD.gn index 7b0db14f52f83c1a59b5075626b389346d86a4d2..697586b1ec26eab4f8375fbeaa2af70194fa1647 100644 --- a/interfaces/ipc/test/unregisterdinputcallbackunittest/BUILD.gn +++ b/interfaces/ipc/test/unregisterdinputcallbackunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -72,7 +72,6 @@ ohos_unittest("unregister_d_input_call_back_test") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/sink/inputcollector/BUILD.gn b/services/sink/inputcollector/BUILD.gn index 84d81c77f3a697775c0e350bdf2977bd9c9aed9d..dffe5539586e0d0e24b70fd6b0d9d532cd81f73a 100755 --- a/services/sink/inputcollector/BUILD.gn +++ b/services/sink/inputcollector/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -60,7 +60,6 @@ ohos_shared_library("libdinput_collector") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/sink/inputcollector/src/distributed_input_collector.cpp b/services/sink/inputcollector/src/distributed_input_collector.cpp index 3e0eaa6b71c63a8c3665f07bf1dc1bd5190555a5..02895ff91932f0ae2f40464770c9006df2a078fd 100644 --- a/services/sink/inputcollector/src/distributed_input_collector.cpp +++ b/services/sink/inputcollector/src/distributed_input_collector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -85,7 +85,7 @@ bool DistributedInputCollector::InitCollectEventsThread() collectThreadID_ = -1; int32_t ret = pthread_create(&collectThreadID_, &attr, CollectEventsThread, this); if (ret != 0) { - DHLOGE("DistributedInputCollector::InitCollectEventsThread create thread failed:%{public}d \n", ret); + DHLOGE("DistributedInputCollector::InitCollectEventsThread create thread failed:%d \n", ret); pthread_attr_destroy(&attr); collectThreadID_ = -1; isCollectingEvents_ = false; @@ -187,14 +187,14 @@ void DistributedInputCollector::ReportDhIdSharingState(const AffectDhIds &dhIds) } for (auto const &id : dhIds.sharingDhIds) { - DHLOGI("Sharing DhId: %{public}s", GetAnonyString(id).c_str()); + DHLOGI("Sharing DhId: %s", GetAnonyString(id).c_str()); for (auto iter : sharingDhIdListeners_) { iter->OnSharing(id); } } for (auto const &id : dhIds.noSharingDhIds) { - DHLOGI("No Sharing DhId: %{public}s", GetAnonyString(id).c_str()); + DHLOGI("No Sharing DhId: %s", GetAnonyString(id).c_str()); for (auto iter : sharingDhIdListeners_) { iter->OnNoSharing(id); } diff --git a/services/sink/inputcollector/test/sinkcollectorunittest/BUILD.gn b/services/sink/inputcollector/test/sinkcollectorunittest/BUILD.gn index 9980187a69f107568e265f2569e40f7654b1febb..37a7dca6e6137767ee3f362d84845226f64566ba 100644 --- a/services/sink/inputcollector/test/sinkcollectorunittest/BUILD.gn +++ b/services/sink/inputcollector/test/sinkcollectorunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -71,7 +71,6 @@ ohos_unittest("distributed_input_inner_sinkcollector_test") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/sink/sinkmanager/BUILD.gn b/services/sink/sinkmanager/BUILD.gn index 17e4191c5a550e04d0f43244213d35f33eedf90e..23700c96dda518fa6d67332c3517585891bf5374 100644 --- a/services/sink/sinkmanager/BUILD.gn +++ b/services/sink/sinkmanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -80,7 +80,6 @@ ohos_shared_library("libdinput_sink") { "distributed_hardware_fwk:libdhfwk_sdk", "eventhandler:libeventhandler", "graphic_surface:surface", - "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 136acea8ba94990997367c5794390a1158167a6f..cd962eefa5b6316296f79c019a573e8865247698 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -129,8 +129,7 @@ void DistributedInputSinkManager::ClearResourcesStatus() void DistributedInputSinkManager::DInputSinkListener::OnPrepareRemoteInput( const int32_t &sessionId, const std::string &deviceId) { - DHLOGI("OnPrepareRemoteInput called, sessionId: %{public}d, devId: %{public}s", sessionId, - GetAnonyString(deviceId).c_str()); + DHLOGI("OnPrepareRemoteInput called, sessionId: %d, devId: %s", sessionId, GetAnonyString(deviceId).c_str()); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONPREPARE; std::string smsg = ""; @@ -144,7 +143,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnPrepareRemoteInput( void DistributedInputSinkManager::DInputSinkListener::OnUnprepareRemoteInput(const int32_t &sessionId) { - DHLOGI("OnUnprepareRemoteInput called, sessionId: %{public}d", sessionId); + DHLOGI("OnUnprepareRemoteInput called, sessionId: %d", sessionId); std::vector sharingDhIds = DistributedInputCollector::GetInstance().GetSharingDhIds(); if (!sharingDhIds.empty()) { OnStopRemoteInputDhid(sessionId, JointDhIds(sharingDhIds)); @@ -161,7 +160,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnUnprepareRemoteInput(con void DistributedInputSinkManager::DInputSinkListener::OnRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) { - DHLOGI("OnRelayPrepareRemoteInput called, toSinkSessionId: %{public}d, devId: %{public}s", toSinkSessionId, + DHLOGI("OnRelayPrepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, GetAnonyString(deviceId).c_str()); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ON_RELAY_PREPARE; @@ -178,7 +177,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayPrepareRemoteInput( void DistributedInputSinkManager::DInputSinkListener::OnRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) { - DHLOGI("OnRelayUnprepareRemoteInput called, toSinkSessionId: %{public}d, devId: %{public}s", toSinkSessionId, + DHLOGI("OnRelayUnprepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, GetAnonyString(deviceId).c_str()); std::vector sharingDhIds = DistributedInputCollector::GetInstance().GetSharingDhIds(); if (!sharingDhIds.empty()) { @@ -197,7 +196,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayUnprepareRemoteInpu void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( const int32_t &sessionId, const uint32_t &inputTypes) { - DHLOGI("OnStartRemoteInput called, sessionId: %{public}d, inputTypes: %{public}u.", sessionId, inputTypes); + DHLOGI("OnStartRemoteInput called, sessionId: %d, inputTypes: %u.", sessionId, inputTypes); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId); @@ -226,7 +225,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( DistributedInputCollector::GetInstance().GetDeviceInfoByType(static_cast(DInputDeviceType::MOUSE), deviceInfos); for (const auto &deviceInfo : deviceInfos) { - DHLOGI("deviceInfo dhId, %{public}s", GetAnonyString(deviceInfo.second).c_str()); + DHLOGI("deviceInfo dhId, %s", GetAnonyString(deviceInfo.second).c_str()); std::vector devDhIds; SplitStringToVector(deviceInfo.second, INPUT_STRING_SPLIT_POINT, devDhIds); DInputSinkState::GetInstance().RecordDhIds(devDhIds, DhIdState::THROUGH_OUT, sessionId); @@ -237,7 +236,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInput( const int32_t &sessionId, const uint32_t &inputTypes) { - DHLOGI("OnStopRemoteInput called, sessionId: %{public}d, inputTypes: %{public}d, curInputTypes: %{public}d", + DHLOGI("OnStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", sessionId, inputTypes, sinkManagerObj_->GetInputTypes()); sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() - @@ -270,7 +269,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInput( void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) { - DHLOGI("OnStartRemoteInputDhid called, sessionId: %{public}d", sessionId); + DHLOGI("OnStartRemoteInputDhid called, sessionId: %d", sessionId); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId); @@ -298,7 +297,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(con void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) { - DHLOGI("OnStopRemoteInputDhid called, sessionId: %{public}d", sessionId); + DHLOGI("OnStopRemoteInputDhid called, sessionId: %d", sessionId); std::vector stopIndeedDhIds; std::vector stopOnCmdDhIds; SplitStringToVector(strDhids, INPUT_STRING_SPLIT_POINT, stopOnCmdDhIds); @@ -311,7 +310,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInputDhid(cons DInputSinkState::GetInstance().RecordDhIds(stopOnCmdDhIds, DhIdState::THROUGH_IN, sessionId); if (DistributedInputCollector::GetInstance().IsAllDevicesStoped()) { - DHLOGE("All dhid stop sharing, sessionId: %{public}d is closed.", sessionId); + DHLOGE("All dhid stop sharing, sessionId: %d is closed.", sessionId); DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId); } @@ -337,7 +336,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInputDhid(cons void DistributedInputSinkManager::DInputSinkListener::OnRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) { - DHLOGI("onRelayStartDhidRemoteInput called, toSinkSessionId: %{public}d", toSinkSessionId); + DHLOGI("onRelayStartDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(toSinkSessionId); bool result = (startRes == DH_SUCCESS); @@ -365,7 +364,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStartDhidRemoteInpu void DistributedInputSinkManager::DInputSinkListener::OnRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) { - DHLOGI("onRelayStopDhidRemoteInput called, toSinkSessionId: %{public}d", toSinkSessionId); + DHLOGI("onRelayStopDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); std::vector stopIndeedDhIds; std::vector stopOnCmdDhIds; SplitStringToVector(strDhids, INPUT_STRING_SPLIT_POINT, stopOnCmdDhIds); @@ -378,7 +377,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStopDhidRemoteInput DInputSinkState::GetInstance().RecordDhIds(stopOnCmdDhIds, DhIdState::THROUGH_IN, toSinkSessionId); if (DistributedInputCollector::GetInstance().IsAllDevicesStoped()) { - DHLOGE("All dhid stop sharing, sessionId: %{public}d is closed.", toSinkSessionId); + DHLOGE("All dhid stop sharing, sessionId: %d is closed.", toSinkSessionId); DistributedInputSinkSwitch::GetInstance().StopSwitch(toSinkSessionId); } @@ -407,7 +406,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStopDhidRemoteInput void DistributedInputSinkManager::DInputSinkListener::OnRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) { - DHLOGI("OnRelayStartTypeRemoteInput called, toSinkSessionId: %{public}d", toSinkSessionId); + DHLOGI("OnRelayStartTypeRemoteInput called, toSinkSessionId: %d", toSinkSessionId); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(toSinkSessionId); @@ -447,7 +446,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStartTypeRemoteInpu DistributedInputCollector::GetInstance().GetDeviceInfoByType(static_cast(DInputDeviceType::MOUSE), deviceInfos); for (auto deviceInfo : deviceInfos) { - DHLOGI("deviceInfo dhId, %{public}s", GetAnonyString(deviceInfo.second).c_str()); + DHLOGI("deviceInfo dhId, %s", GetAnonyString(deviceInfo.second).c_str()); std::vector devDhIds; SplitStringToVector(deviceInfo.second, INPUT_STRING_SPLIT_POINT, devDhIds); DInputSinkState::GetInstance().RecordDhIds(devDhIds, DhIdState::THROUGH_OUT, toSinkSessionId); @@ -457,7 +456,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStartTypeRemoteInpu void DistributedInputSinkManager::DInputSinkListener::OnRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) { - DHLOGI("OnRelayStopTypeRemoteInput called, sessionId: %{public}d, inputTypes: %{public}d, curInputType: %{public}d", + DHLOGI("OnRelayStopTypeRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", toSinkSessionId, inputTypes, sinkManagerObj_->GetInputTypes()); sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() - @@ -495,20 +494,19 @@ void DistributedInputSinkManager::DeleteStopDhids(int32_t sessionId, const std:: { std::lock_guard lock(mutex_); if (sharingDhIdsMap_.count(sessionId) <= 0) { - DHLOGE("DeleteStopDhids sessionId: %{public}d is not exist.", sessionId); + DHLOGE("DeleteStopDhids sessionId: %d is not exist.", sessionId); return; } - DHLOGI("DeleteStopDhids sessionId=%{public}d before has dhid.size=%{public}zu, delDhIds.size=%{public}zu.", - sessionId, sharingDhIdsMap_[sessionId].size(), stopDhIds.size()); + DHLOGI("DeleteStopDhids sessionId=%d before has dhid.size=%d, delDhIds.size=%d.", sessionId, + sharingDhIdsMap_[sessionId].size(), stopDhIds.size()); for (auto stopDhId : stopDhIds) { sharingDhIdsMap_[sessionId].erase(stopDhId); } if (sharingDhIdsMap_[sessionId].size() == 0) { sharingDhIdsMap_.erase(sessionId); - DHLOGI("DeleteStopDhids sessionId=%{public}d is delete.", sessionId); + DHLOGI("DeleteStopDhids sessionId=%d is delete.", sessionId); } else { - DHLOGI("DeleteStopDhids sessionId=%{public}d after has dhid.size=%{public}zu.", sessionId, - sharingDhIdsMap_[sessionId].size()); + DHLOGI("DeleteStopDhids sessionId=%d after has dhid.size=%d.", sessionId, sharingDhIdsMap_[sessionId].size()); } stopIndeedDhIds.assign(stopDhIds.begin(), stopDhIds.end()); @@ -524,14 +522,13 @@ void DistributedInputSinkManager::StoreStartDhids(int32_t sessionId, const std:: if (sharingDhIdsMap_.count(sessionId) > 0) { tmpDhids = sharingDhIdsMap_[sessionId]; } - DHLOGI("StoreStartDhids start tmpDhids.size=%{public}zu, add dhIds.size=%{public}zu.", tmpDhids.size(), - dhIds.size()); + DHLOGI("StoreStartDhids start tmpDhids.size=%d, add dhIds.size=%d.", tmpDhids.size(), dhIds.size()); for (auto iter : dhIds) { tmpDhids.insert(iter); sharingDhIds_.insert(iter); } sharingDhIdsMap_[sessionId] = tmpDhids; - DHLOGI("StoreStartDhids end tmpDhids.size=%{public}zu", tmpDhids.size()); + DHLOGI("StoreStartDhids end tmpDhids.size=%d", tmpDhids.size()); } void DistributedInputSinkManager::OnStart() @@ -675,7 +672,7 @@ int32_t DistributedInputSinkManager::Release() } int32_t ret = systemAbilityMgr->UnloadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID); if (ret != DH_SUCCESS) { - DHLOGE("Failed to UnloadSystemAbility service! errcode: %{public}d.", ret); + DHLOGE("Failed to UnloadSystemAbility service! errcode: %d.", ret); return ERR_DH_INPUT_SERVER_SINK_MANAGER_RELEASE_FAIL; } DHLOGI("Sink unloadSystemAbility successfully."); @@ -704,7 +701,7 @@ DInputServerType DistributedInputSinkManager::GetStartTransFlag() } void DistributedInputSinkManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Sink isStartTrans_ %{public}d", static_cast(flag)); + DHLOGI("Set Sink isStartTrans_ %d", static_cast(flag)); isStartTrans_ = flag; } @@ -744,7 +741,7 @@ void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic { DHLOGI("ProjectWindowListener OnMessage!"); if (topic != DHTopic::TOPIC_SINK_PROJECT_WINDOW_INFO) { - DHLOGE("this topic is wrong, %{public}u", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } std::string srcDeviceId = ""; @@ -829,9 +826,8 @@ int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfo LocalAbsInfo info = DInputContext::GetInstance().GetLocalTouchScreenInfo().localAbsInfo; sinkScreenInfo.sinkPhyWidth = static_cast(info.absMtPositionXMax + 1); sinkScreenInfo.sinkPhyHeight = static_cast(info.absMtPositionYMax + 1); - DHLOGI("sinkShowWinId: %{public}" PRIu64 ", sinkProjShowWidth: %{public}d, sinkProjShowHeight: %{public}d, " - "sinkWinShowX: %{public}d, sinkWinShowY: %{public}d, sinkShowWidth: %{public}d, sinkShowHeight: %{public}d, " - "sinkPhyWidth: %{public}d, sinkPhyHeight: %{public}d", sinkScreenInfo.sinkShowWinId, + DHLOGI("sinkShowWinId: %d, sinkProjShowWidth: %d, sinkProjShowHeight: %d, sinkWinShowX: %d, sinkWinShowY: %d," + "sinkShowWidth: %d, sinkShowHeight: %d, sinkPhyWidth: %d, sinkPhyHeight: %d", sinkScreenInfo.sinkShowWinId, sinkScreenInfo.sinkProjShowWidth, sinkScreenInfo.sinkProjShowHeight, sinkScreenInfo.sinkWinShowX, sinkScreenInfo.sinkWinShowY, sinkScreenInfo.sinkShowWidth, sinkScreenInfo.sinkShowHeight, sinkScreenInfo.sinkPhyWidth, sinkScreenInfo.sinkPhyHeight); @@ -873,7 +869,7 @@ void DistributedInputSinkManager::PluginStartListener::OnMessage(const DHTopic t { DHLOGI("PluginStartListener OnMessage!"); if (topic != DHTopic::TOPIC_PHY_DEV_PLUGIN) { - DHLOGE("this topic is wrong, %{public}u", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } if (message.empty()) { @@ -919,11 +915,11 @@ int32_t DistributedInputSinkManager::NotifyStartDScreen(const SrcScreenInfo &src srcScreenInfo.sourceWinId); SinkScreenInfo sinkScreenInfo = DInputContext::GetInstance().GetSinkScreenInfo(screenInfoKey); sinkScreenInfo.srcScreenInfo = srcScreenInfo; - DHLOGI("OnRemoteRequest the data: devId: %{public}s, sourceWinId: %{public}" PRIu64 ", sourceWinWidth: %{public}d, " - "sourceWinHeight: %{public}d, sourcePhyId: %{public}s, sourcePhyFd: %{public}d, sourcePhyWidth: %{public}d, " - "sourcePhyHeight: %{public}d", GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, - srcScreenInfo.sourceWinWidth, srcScreenInfo.sourceWinHeight, GetAnonyString(srcScreenInfo.sourcePhyId).c_str(), - srcScreenInfo.sourcePhyFd, srcScreenInfo.sourcePhyWidth, srcScreenInfo.sourcePhyHeight); + DHLOGI("OnRemoteRequest the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d, sourceWinHeight: %d," + "sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", + GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, srcScreenInfo.sourceWinWidth, + srcScreenInfo.sourceWinHeight, GetAnonyString(srcScreenInfo.sourcePhyId).c_str(), srcScreenInfo.sourcePhyFd, + srcScreenInfo.sourcePhyWidth, srcScreenInfo.sourcePhyHeight); int32_t ret = DInputContext::GetInstance().UpdateSinkScreenInfo(screenInfoKey, sinkScreenInfo); std::lock_guard lock(mutex_); if ((ret == DH_SUCCESS) && (getSinkScreenInfosCallbacks_.size() > 0)) { @@ -964,16 +960,16 @@ void DistributedInputSinkManager::CleanExceptionalInfo(const SrcScreenInfo &srcS auto srcInfo = sinkInfo.srcScreenInfo; if ((std::strcmp(srcInfo.uuid.c_str(), uuid.c_str()) == 0) && (srcInfo.sessionId != sessionId)) { DInputContext::GetInstance().RemoveSinkScreenInfo(id); - DHLOGI("CleanExceptionalInfo screenInfoKey: %{public}s, sessionId: %{public}d", id.c_str(), sessionId); + DHLOGI("CleanExceptionalInfo screenInfoKey: %s, sessionId: %d", id.c_str(), sessionId); } } } int32_t DistributedInputSinkManager::NotifyStopDScreen(const std::string &srcScreenInfoKey) { - DHLOGI("NotifyStopDScreen start, srcScreenInfoKey: %{public}s", GetAnonyString(srcScreenInfoKey).c_str()); + DHLOGI("NotifyStopDScreen start, srcScreenInfoKey: %s", GetAnonyString(srcScreenInfoKey).c_str()); if (srcScreenInfoKey.empty()) { - DHLOGE("srcScreenInfoKey is empty, srcScreenInfoKey: %{public}s", GetAnonyString(srcScreenInfoKey).c_str()); + DHLOGE("srcScreenInfoKey is empty, srcScreenInfoKey: %s", GetAnonyString(srcScreenInfoKey).c_str()); return ERR_DH_INPUT_SERVER_SINK_SCREEN_INFO_IS_EMPTY; } return DInputContext::GetInstance().RemoveSinkScreenInfo(srcScreenInfoKey); @@ -997,7 +993,7 @@ int32_t DistributedInputSinkManager::Dump(int32_t fd, const std::vector switchLock(operationMutex_); if (switchVector_.empty()) { - DHLOGE("StartSwitch sessionId: %{public}d fail,switchVector_ is null.", sessionId); + DHLOGE("StartSwitch sessionId: %d fail,switchVector_ is null.", sessionId); return ERR_DH_INPUT_SERVER_SINK_START_SWITCH_FAIL; } else { bool findOld = false; @@ -64,10 +64,10 @@ int32_t DistributedInputSinkSwitch::StartSwitch(int32_t sessionId) } if (findOld) { - DHLOGI("StartSwitch sessionId: %{public}d is find.", sessionId); + DHLOGI("StartSwitch sessionId: %d is find.", sessionId); return DH_SUCCESS; } else { - DHLOGE("StartSwitch sessionId: %{public}d fail, not found.", sessionId); + DHLOGE("StartSwitch sessionId: %d fail, not found.", sessionId); return ERR_DH_INPUT_SERVER_SINK_START_SWITCH_FAIL; } } @@ -77,7 +77,7 @@ void DistributedInputSinkSwitch::StopSwitch(int32_t sessionId) { std::unique_lock switchLock(operationMutex_); if (switchVector_.empty()) { - DHLOGE("StopSwitch sessionId: %{public}d fail,switchVector_ is null.", sessionId); + DHLOGE("StopSwitch sessionId: %d fail,switchVector_ is null.", sessionId); } else { bool findOld = false; for (std::vector::iterator it = switchVector_.begin(); it < switchVector_.end(); ++it) { @@ -89,9 +89,9 @@ void DistributedInputSinkSwitch::StopSwitch(int32_t sessionId) } if (findOld) { - DHLOGI("StopSwitch sessionId: %{public}d is success.", sessionId); + DHLOGI("StopSwitch sessionId: %d is success.", sessionId); } else { - DHLOGE("StopSwitch sessionId: %{public}d fail,not find it.", sessionId); + DHLOGE("StopSwitch sessionId: %d fail,not find it.", sessionId); } } } @@ -115,7 +115,7 @@ void DistributedInputSinkSwitch::AddSession(int32_t sessionId) if (switchVector_.empty()) { SwitchStateData tmp(sessionId, false); switchVector_.push_back(tmp); - DHLOGI("AddSession sessionId: %{public}d add first.", sessionId); + DHLOGI("AddSession sessionId: %d add first.", sessionId); } else { bool findOld = false; for (std::vector::iterator it = switchVector_.begin(); it < switchVector_.end(); ++it) { @@ -126,11 +126,11 @@ void DistributedInputSinkSwitch::AddSession(int32_t sessionId) } if (findOld) { - DHLOGI("AddSession sessionId: %{public}d is find.", sessionId); + DHLOGI("AddSession sessionId: %d is find.", sessionId); } else { SwitchStateData tmp(sessionId, false); switchVector_.push_back(tmp); - DHLOGI("AddSession sessionId: %{public}d add new.", sessionId); + DHLOGI("AddSession sessionId: %d add new.", sessionId); } } } @@ -139,7 +139,7 @@ void DistributedInputSinkSwitch::RemoveSession(int32_t sessionId) { std::unique_lock switchLock(operationMutex_); if (switchVector_.empty()) { - DHLOGE("RemoveSession sessionId: %{public}d fail,switch_vector is null.", sessionId); + DHLOGE("RemoveSession sessionId: %d fail,switch_vector is null.", sessionId); } else { bool findOld = false; for (std::vector::iterator it = switchVector_.begin(); it < switchVector_.end();) { @@ -152,9 +152,9 @@ void DistributedInputSinkSwitch::RemoveSession(int32_t sessionId) } } if (findOld) { - DHLOGI("RemoveSession sessionId: %{public}d is success.", sessionId); + DHLOGI("RemoveSession sessionId: %d is success.", sessionId); } else { - DHLOGE("RemoveSession sessionId: %{public}d fail,not find it.", sessionId); + DHLOGE("RemoveSession sessionId: %d fail,not find it.", sessionId); } } } diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index f1f2dfd230dd16c85aa80d682658f3f30db212ad..bedd63b185526603b35c518f1e8e7b572c3f203f 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -126,7 +126,7 @@ int32_t DistributedInputSinkTransport::RespPrepareRemoteInput( const int32_t sessionId, std::string &smsg) { if (sessionId > 0) { - DHLOGI("RespPrepareRemoteInput sessionId: %{public}d, smsg:%{public}s.", sessionId, SetAnonyId(smsg).c_str()); + DHLOGI("RespPrepareRemoteInput sessionId: %d, smsg:%s.", sessionId, SetAnonyId(smsg).c_str()); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { DHLOGE("RespPrepareRemoteInput error, SendMessage fail."); @@ -142,7 +142,7 @@ int32_t DistributedInputSinkTransport::RespPrepareRemoteInput( int32_t DistributedInputSinkTransport::RespUnprepareRemoteInput(const int32_t sessionId, std::string &smsg) { if (sessionId > 0) { - DHLOGI("RespUnprepareRemoteInput sessionId: %{public}d, smsg:%{public}s.", sessionId, SetAnonyId(smsg).c_str()); + DHLOGI("RespUnprepareRemoteInput sessionId: %d, smsg:%s.", sessionId, SetAnonyId(smsg).c_str()); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { DHLOGE("RespUnprepareRemoteInput error, SendMessage fail."); @@ -158,7 +158,7 @@ int32_t DistributedInputSinkTransport::RespUnprepareRemoteInput(const int32_t se int32_t DistributedInputSinkTransport::RespStartRemoteInput(const int32_t sessionId, std::string &smsg) { if (sessionId > 0) { - DHLOGI("RespStartRemoteInput sessionId: %{public}d, smsg:%{public}s.", sessionId, SetAnonyId(smsg).c_str()); + DHLOGI("RespStartRemoteInput sessionId: %d, smsg:%s.", sessionId, SetAnonyId(smsg).c_str()); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { DHLOGE("RespStartRemoteInput error, SendMessage fail."); @@ -174,7 +174,7 @@ int32_t DistributedInputSinkTransport::RespStartRemoteInput(const int32_t sessio int32_t DistributedInputSinkTransport::RespStopRemoteInput(const int32_t sessionId, std::string &smsg) { if (sessionId > 0) { - DHLOGI("RespStopRemoteInput sessionId: %{public}d, smsg:%{public}s.", sessionId, SetAnonyId(smsg).c_str()); + DHLOGI("RespStopRemoteInput sessionId: %d, smsg:%s.", sessionId, SetAnonyId(smsg).c_str()); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { DHLOGE("RespStopRemoteInput error, SendMessage fail."); @@ -210,7 +210,7 @@ void DistributedInputSinkTransport::SendKeyStateNodeMsg(const int32_t sessionId, DHLOGE("SendKeyStateNodeMsg error, sessionId <= 0."); return; } - DHLOGI("SendKeyStateNodeMsg sessionId: %{public}d, btnCode: %{public}u.", sessionId, btnCode); + DHLOGI("SendKeyStateNodeMsg sessionId: %d, btnCode: %u.", sessionId, btnCode); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_KEY_STATE; jsonStr[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID] = dhId; @@ -232,7 +232,7 @@ void DistributedInputSinkTransport::SendKeyStateNodeMsgBatch(const int32_t sessi DHLOGE("SendKeyStateNodeMsgBatch error, sessionId <= 0."); return; } - DHLOGI("SendKeyStateNodeMsgBatch sessionId: %{public}d, event size: %{public}zu ", sessionId, events.size()); + DHLOGI("SendKeyStateNodeMsgBatch sessionId: %d, event size: %d ", sessionId, events.size()); int32_t cnt = 0; std::vector eventBatch; @@ -302,7 +302,7 @@ void DistributedInputSinkTransport::RecordEventLog(const std::string &dhId, int3 break; } - DHLOGD("2.E2E-Test Sink softBus send, EventType: %{public}s, Code: %{public}d, Value: %{public}d, dhId: %{public}s", + DHLOGD("2.E2E-Test Sink softBus send, EventType: %s, Code: %d, Value: %d, dhId: %s", eventType.c_str(), code, value, GetAnonyString(dhId).c_str()); } @@ -332,7 +332,7 @@ void DistributedInputSinkTransport::NotifyPrepareRemoteInput(int32_t sessionId, return; } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnPrepareRemoteInput(sessionId, deviceId); } @@ -344,7 +344,7 @@ void DistributedInputSinkTransport::NotifyUnprepareRemoteInput(int32_t sessionId return; } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; - DHLOGI("OnBytesReceived cmdType TRANS_SOURCE_MSG_UNPREPARE deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType TRANS_SOURCE_MSG_UNPREPARE deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnUnprepareRemoteInput(sessionId); } @@ -358,7 +358,7 @@ void DistributedInputSinkTransport::NotifyStartRemoteInput(int32_t sessionId, co } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - DHLOGI("OnBytesRecei,ved cmdType is TRANS_SOURCE_MSG_START_TYPE deviceId:%{public}s inputTypes:%{public}d .", + DHLOGI("OnBytesRecei,ved cmdType is TRANS_SOURCE_MSG_START_TYPE deviceId:%s inputTypes:%d .", GetAnonyString(deviceId).c_str(), inputTypes); callback_->OnStartRemoteInput(sessionId, inputTypes); } @@ -372,8 +372,7 @@ void DistributedInputSinkTransport::NotifyStopRemoteInput(int32_t sessionId, con } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE deviceId:%{public}s.", - GetAnonyString(deviceId).c_str()); + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnStopRemoteInput(sessionId, inputTypes); } @@ -400,7 +399,7 @@ void DistributedInputSinkTransport::NotifyStartRemoteInputDhid(int32_t sessionId } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; std::string strTmp = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID deviceId:%{public}s .", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID deviceId:%s .", GetAnonyString(deviceId).c_str()); callback_->OnStartRemoteInputDhid(sessionId, strTmp); } @@ -414,7 +413,7 @@ void DistributedInputSinkTransport::NotifyStopRemoteInputDhid(int32_t sessionId, } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; std::string strTmp = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - DHLOGE("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID deviceId:%{public}s.", + DHLOGE("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnStopRemoteInputDhid(sessionId, strTmp); } @@ -428,7 +427,7 @@ void DistributedInputSinkTransport::NotifyRelayPrepareRemoteInput(int32_t sessio } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayPrepareRemoteInput(toSrcSessionId, sessionId, deviceId); } @@ -442,7 +441,7 @@ void DistributedInputSinkTransport::NotifyRelayUnprepareRemoteInput(int32_t sess } std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_UNPREPARE_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_UNPREPARE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayUnprepareRemoteInput(toSrcSessionId, sessionId, deviceId); } @@ -458,7 +457,7 @@ void DistributedInputSinkTransport::NotifyRelayStartDhidRemoteInput(int32_t sess std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayStartDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); } @@ -474,7 +473,7 @@ void DistributedInputSinkTransport::NotifyRelayStopDhidRemoteInput(int32_t sessi std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayStopDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); } @@ -490,7 +489,7 @@ void DistributedInputSinkTransport::NotifyRelayStartTypeRemoteInput(int32_t sess std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_TYPE_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_TYPE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayStartTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); } @@ -506,7 +505,7 @@ void DistributedInputSinkTransport::NotifyRelayStopTypeRemoteInput(int32_t sessi std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL deviceId:%{public}s.", + DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); callback_->OnRelayStopTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); } @@ -547,7 +546,7 @@ void DistributedInputSinkTransport::RegRespFunMap() void DistributedInputSinkTransport::HandleData(int32_t sessionId, const std::string &message) { if (callback_ == nullptr) { - DHLOGE("OnBytesReceived the callback_ is null, the message:%{public}s abort.", SetAnonyId(message).c_str()); + DHLOGE("OnBytesReceived the callback_ is null, the message:%s abort.", SetAnonyId(message).c_str()); return; } @@ -563,7 +562,7 @@ void DistributedInputSinkTransport::HandleData(int32_t sessionId, const std::str uint32_t cmdType = recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE]; auto iter = memberFuncMap_.find(cmdType); if (iter == memberFuncMap_.end()) { - DHLOGE("OnBytesReceived cmdType %{public}u is undefined.", cmdType); + DHLOGE("OnBytesReceived cmdType %u is undefined.", cmdType); return; } SinkTransportFunc &func = iter->second; @@ -602,8 +601,8 @@ void DistributedInputSinkTransport::DInputSinkEventHandler::RecordEventLog( int32_t code = event[INPUT_KEY_CODE]; int32_t value = event[INPUT_KEY_VALUE]; std::string path = event[INPUT_KEY_PATH]; - DHLOGD("2.E2E-Test Sink softBus send, EventType: %{public}s, Code: %{public}d, Value: %{public}d, " - "Path: %{public}s, When: %{public}" PRId64 "", eventType.c_str(), code, value, path.c_str(), when); + DHLOGD("2.E2E-Test Sink softBus send, EventType: %s, Code: %d, Value: %d, Path: %s, When: %" PRId64 "", + eventType.c_str(), code, value, path.c_str(), when); } } } // namespace DistributedInput diff --git a/services/sink/transport/test/sinktransunittest/BUILD.gn b/services/sink/transport/test/sinktransunittest/BUILD.gn index 7b2a29c8002a2c75b7b6bf017e09c6d8a71781c5..1b981b6879c0c62cb9e8e9ddc9a89ee78344e4d7 100755 --- a/services/sink/transport/test/sinktransunittest/BUILD.gn +++ b/services/sink/transport/test/sinktransunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -92,7 +92,6 @@ ohos_unittest("distributed_input_sinktrans_test") { "eventhandler:libeventhandler", "graphic_surface:surface", "hicollie:libhicollie", - "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/source/inputinject/BUILD.gn b/services/source/inputinject/BUILD.gn index 7382de407e93c2cc3e8a62128c409551811e9d8c..bef2ff5060db5daea19ac527466dc1c067657a2c 100644 --- a/services/source/inputinject/BUILD.gn +++ b/services/source/inputinject/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -67,7 +67,6 @@ ohos_shared_library("libdinput_inject") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/source/inputinject/src/distributed_input_inject.cpp b/services/source/inputinject/src/distributed_input_inject.cpp index 725a18ec98fd27c742f89126b810fda1e34755a4..8f53ecf9677552c9d9546be03cad018a635769a5 100644 --- a/services/source/inputinject/src/distributed_input_inject.cpp +++ b/services/source/inputinject/src/distributed_input_inject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -49,7 +49,7 @@ DistributedInputInject &DistributedInputInject::GetInstance() int32_t DistributedInputInject::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const std::string ¶meters) { - DHLOGI("RegisterDistributedHardware called, deviceId: %{public}s, dhId: %{public}s, parameters: %{public}s", + DHLOGI("RegisterDistributedHardware called, deviceId: %s, dhId: %s, parameters: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), SetAnonyId(parameters).c_str()); std::lock_guard lock(inputNodeManagerMutex_); if (inputNodeManager_ == nullptr) { @@ -67,7 +67,7 @@ int32_t DistributedInputInject::RegisterDistributedHardware(const std::string &d int32_t DistributedInputInject::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId) { - DHLOGI("UnregisterDistributedHardware called, deviceId: %{public}s, dhId: %{public}s", + DHLOGI("UnregisterDistributedHardware called, deviceId: %s, dhId: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(inputNodeManagerMutex_); if (inputNodeManager_ == nullptr) { @@ -85,8 +85,8 @@ int32_t DistributedInputInject::UnregisterDistributedHardware(const std::string int32_t DistributedInputInject::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) { - DHLOGI("[%{public}s] %{public}d, %{public}d, %{public}d, %{public}d, %{public}s.\n", (pBuf.name).c_str(), - pBuf.bus, pBuf.vendor, pBuf.product, pBuf.version, GetAnonyString(pBuf.descriptor).c_str()); + DHLOGI("[%s] %d, %d, %d, %d, %s.\n", (pBuf.name).c_str(), pBuf.bus, pBuf.vendor, pBuf.product, pBuf.version, + GetAnonyString(pBuf.descriptor).c_str()); nlohmann::json tmpJson; tmpJson[DEVICE_NAME] = pBuf.name; tmpJson[PHYSICAL_PATH] = pBuf.physicalPath; diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 9420b7922349e6a6ff8b47d637ffbc54fd0ad232..44b387b6bafc927892e0f46c5dd614187be0ac12 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -154,7 +154,7 @@ void DistributedInputNodeManager::ParseInputDeviceEvents(const nlohmann::json &i void DistributedInputNodeManager::ScanSinkInputDevices(const std::string &devId, const std::string &dhId) { - DHLOGI("ScanSinkInputDevices enter, deviceId: %{public}s, dhId: %{public}s.", + DHLOGI("ScanSinkInputDevices enter, deviceId: %s, dhId: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::vector vecInputDevPath; ScanInputDevicesPath(DEVICE_PATH, vecInputDevPath); @@ -172,7 +172,7 @@ void DistributedInputNodeManager::DInputNodeManagerEventHandler::ProcessEvent( DHLOGI("ProcessEvent enter."); auto iter = eventFuncMap_.find(event->GetInnerEventId()); if (iter == eventFuncMap_.end()) { - DHLOGE("Event Id %{public}d is undefined.", event->GetInnerEventId()); + DHLOGE("Event Id %d is undefined.", event->GetInnerEventId()); return; } nodeMgrFunc &func = iter->second; @@ -224,15 +224,15 @@ bool DistributedInputNodeManager::IsVirtualDev(int fd) char buffer[INPUT_EVENT_BUFFER_SIZE] = {0}; std::string deviceName; if (ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer) < 1) { - DHLOGE("Could not get device name for %{public}s.", ConvertErrNo().c_str()); + DHLOGE("Could not get device name for %s.", ConvertErrNo().c_str()); return false; } buffer[sizeof(buffer) - 1] = '\0'; deviceName = buffer; - DHLOGD("IsVirtualDev deviceName: %{public}s", buffer); + DHLOGD("IsVirtualDev deviceName: %s", buffer); if (deviceName.find(VIRTUAL_DEVICE_NAME) == std::string::npos) { - DHLOGD("This is not a virtual device, fd %{public}d, deviceName: %{public}s.", fd, deviceName.c_str()); + DHLOGD("This is not a virtual device, fd %d, deviceName: %s.", fd, deviceName.c_str()); return false; } return true; @@ -242,13 +242,13 @@ bool DistributedInputNodeManager::GetDevDhUniqueIdByFd(int fd, DhUniqueID &dhUnq { char buffer[INPUT_EVENT_BUFFER_SIZE] = {0}; if (ioctl(fd, EVIOCGPHYS(sizeof(buffer) - 1), &buffer) < 1) { - DHLOGE("Could not get device physicalPath for %{public}s.", ConvertErrNo().c_str()); + DHLOGE("Could not get device physicalPath for %s.", ConvertErrNo().c_str()); return false; } buffer[sizeof(buffer) - 1] = '\0'; physicalPath = buffer; - DHLOGD("GetDevDhUniqueIdByFd physicalPath %{public}s.", physicalPath.c_str()); + DHLOGD("GetDevDhUniqueIdByFd physicalPath %s.", physicalPath.c_str()); std::vector phyPathVec; SplitStringToVector(physicalPath, VIR_NODE_SPLIT_CHAR, phyPathVec); if (phyPathVec.size() != VIR_NODE_PHY_LEN) { @@ -263,8 +263,7 @@ bool DistributedInputNodeManager::GetDevDhUniqueIdByFd(int fd, DhUniqueID &dhUnq } dhUnqueId.first = devId; dhUnqueId.second = dhId; - DHLOGD("Device deviceid: %{public}s, dhId %{public}s.", GetAnonyString(devId).c_str(), - GetAnonyString(dhId).c_str()); + DHLOGD("Device deviceid: %s, dhId %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return true; } @@ -273,10 +272,10 @@ void DistributedInputNodeManager::SetPathForVirDev(const DhUniqueID &dhUniqueId, std::lock_guard lock(virtualDeviceMapMutex_); auto iter = virtualDeviceMap_.begin(); while (iter != virtualDeviceMap_.end()) { - DHLOGD("Check Virtual device, deviceId %{public}s, dhid %{public}s.", GetAnonyString(iter->first.first).c_str(), + DHLOGD("Check Virtual device, deviceId %s, dhid %s.", GetAnonyString(iter->first.first).c_str(), GetAnonyString(iter->first.second).c_str()); if (iter->first == dhUniqueId) { - DHLOGD("Found the virtual device, set path :%{public}s", devicePath.c_str()); + DHLOGD("Found the virtual device, set path :%s", devicePath.c_str()); iter->second->SetPath(devicePath); break; } @@ -287,27 +286,27 @@ void DistributedInputNodeManager::SetPathForVirDev(const DhUniqueID &dhUniqueId, bool DistributedInputNodeManager::MatchAndSavePhysicalPath(const std::string &devicePath, const std::string &devId, const std::string &dhId) { - DHLOGI("Opening input device path: %{public}s", devicePath.c_str()); + DHLOGI("Opening input device path: %s", devicePath.c_str()); DhUniqueID curDhUniqueId; std::string physicalPath; int fd = OpenInputDeviceFdByPath(devicePath); if (fd == UN_INIT_FD_VALUE) { - DHLOGE("The fd open failed, devicePath %{public}s.", devicePath.c_str()); + DHLOGE("The fd open failed, devicePath %s.", devicePath.c_str()); return false; } if (!IsVirtualDev(fd)) { - DHLOGE("The dev not virtual, devicePath %{public}s.", devicePath.c_str()); + DHLOGE("The dev not virtual, devicePath %s.", devicePath.c_str()); CloseFd(fd); return false; } if (!GetDevDhUniqueIdByFd(fd, curDhUniqueId, physicalPath)) { - DHLOGE("Get unique id failed, device path %{public}s.", devicePath.c_str()); + DHLOGE("Get unique id failed, device path %s.", devicePath.c_str()); CloseFd(fd); return false; } - DHLOGD("This opening node deviceId: %{public}s, dhId: %{public}s, to match node deviceId: %{public}s, " - "dhId: %{public}s", GetAnonyString(curDhUniqueId.first).c_str(), GetAnonyString(curDhUniqueId.second).c_str(), + DHLOGD("This opening node deviceId: %s, dhId: %s, to match node deviceId: %s, dhId: %s", + GetAnonyString(curDhUniqueId.first).c_str(), GetAnonyString(curDhUniqueId.second).c_str(), GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); if (curDhUniqueId.first != devId || curDhUniqueId.second != dhId) { @@ -334,9 +333,8 @@ void DistributedInputNodeManager::GetVirtualKeyboardPaths(const std::vectorfirst == dhUniqueId) && ((iter->second->GetClasses() & INPUT_DEVICE_CLASS_KEYBOARD) != 0)) { - DHLOGI("Found vir keyboard path %{public}s, deviceId %{public}s, dhid %{public}s", - iter->second->GetPath().c_str(), GetAnonyString(dhUniqueId.first).c_str(), - GetAnonyString(dhUniqueId.second).c_str()); + DHLOGI("Found vir keyboard path %s, deviceId %s, dhid %s", iter->second->GetPath().c_str(), + GetAnonyString(dhUniqueId.first).c_str(), GetAnonyString(dhUniqueId.second).c_str()); virKeyboardPaths.push_back(iter->second->GetPath()); } iter++; @@ -366,17 +364,17 @@ int32_t DistributedInputNodeManager::CreateVirtualTouchScreenNode(const std::str std::unique_lock my_lock(operationMutex_); std::unique_ptr device; LocalAbsInfo info = DInputContext::GetInstance().GetLocalTouchScreenInfo().localAbsInfo; - DHLOGI("CreateVirtualTouchScreenNode, dhId: %{public}s, sourcePhyWidth: %{public}d, sourcePhyHeight: %{public}d", + DHLOGI("CreateVirtualTouchScreenNode start, dhId: %s, sourcePhyWidth: %d, sourcePhyHeight: %d", GetAnonyString(dhId).c_str(), sourcePhyWidth, sourcePhyHeight); device = std::make_unique(info.deviceInfo); if (!device->SetUp(info.deviceInfo, devId, dhId)) { - DHLOGE("Virtual touch Screen setUp fail, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), + DHLOGE("Virtual touch Screen setUp fail, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_CREATE_HANDLE_FAIL; } virtualTouchScreenFd_ = device->GetDeviceFd(); AddDeviceLocked(devId, dhId, std::move(device)); - DHLOGI("CreateVirtualTouchScreenNode end, dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("CreateVirtualTouchScreenNode end, dhId: %s", GetAnonyString(dhId).c_str()); return DH_SUCCESS; } @@ -393,31 +391,31 @@ int32_t DistributedInputNodeManager::GetVirtualTouchScreenFd() void DistributedInputNodeManager::AddDeviceLocked(const std::string &networkId, const std::string &dhId, std::unique_ptr device) { - DHLOGI("AddDeviceLocked deviceId=%{public}s, dhId=%{public}s", + DHLOGI("AddDeviceLocked deviceId=%s, dhId=%s", GetAnonyString(networkId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(virtualDeviceMapMutex_); auto [dev_it, inserted] = virtualDeviceMap_.insert_or_assign( {networkId, dhId}, std::move(device)); if (!inserted) { - DHLOGI("Device exists, deviceId=%{public}s, dhId=%{public}s, replaced. \n", + DHLOGI("Device exists, deviceId=%s, dhId=%s, replaced. \n", GetAnonyString(networkId).c_str(), GetAnonyString(dhId).c_str()); } } int32_t DistributedInputNodeManager::CloseDeviceLocked(const std::string &devId, const std::string &dhId) { - DHLOGI("CloseDeviceLocked called, deviceId=%{public}s, dhId=%{public}s", + DHLOGI("CloseDeviceLocked called, deviceId=%s, dhId=%s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(virtualDeviceMapMutex_); DhUniqueID dhUniqueId = {devId, dhId}; std::map>::iterator iter = virtualDeviceMap_.find(dhUniqueId); if (iter != virtualDeviceMap_.end()) { - DHLOGI("CloseDeviceLocked called success, deviceId=%{public}s, dhId=%{public}s", + DHLOGI("CloseDeviceLocked called success, deviceId=%s, dhId=%s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); virtualDeviceMap_.erase(iter); return DH_SUCCESS; } - DHLOGE("CloseDeviceLocked called failure, deviceId=%{public}s, dhId=%{public}s", + DHLOGE("CloseDeviceLocked called failure, deviceId=%s, dhId=%s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_CLOSE_DEVICE_FAIL; } @@ -523,9 +521,9 @@ void DistributedInputNodeManager::ProcessInjectEvent(const EventBatch &events) .code = rawEvent.code, .value = rawEvent.value }; - DHLOGI("InjectEvent deviceId: %{public}s, dhId: %{public}s, eventType: %{public}d, eventCode: %{public}d, " - "eventValue: %{public}d, when: %{public}" PRId64"", GetAnonyString(deviceId).c_str(), - GetAnonyString(dhId).c_str(), event.type, event.code, event.value, rawEvent.when); + DHLOGI("InjectEvent deviceId: %s, dhId: %s, eventType: %d, eventCode: %d, eventValue: %d, when: " PRId64"", + GetAnonyString(deviceId).c_str(), GetAnonyString(dhId).c_str(), + event.type, event.code, event.value, rawEvent.when); VirtualDevice* device = nullptr; if (GetDevice(deviceId, dhId, device) < 0) { DHLOGE("could not find the device"); diff --git a/services/source/inputinject/src/virtual_device.cpp b/services/source/inputinject/src/virtual_device.cpp index b34f12ccde81dd110296859d2ee00ae03035ee48..566a906d64cdb1cf94383ca669af7d143f1bdc43 100644 --- a/services/source/inputinject/src/virtual_device.cpp +++ b/services/source/inputinject/src/virtual_device.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -61,7 +61,7 @@ bool VirtualDevice::CreateKey(const InputDevice &inputDevice) auto fun = [this](int32_t uiSet, const std::vector& list) -> bool { for (uint32_t evt_type : list) { if (!DoIoctl(fd_, uiSet, evt_type)) { - DHLOGE("Error setting event type: %{public}u", evt_type); + DHLOGE("Error setting event type: %u", evt_type); return false; } } @@ -93,12 +93,11 @@ void VirtualDevice::SetABSInfo(struct uinput_user_dev &inputUserDev, const Input for (const auto item : inputDevice.absInfos) { int absCode = item.first; std::vector absInfo = item.second; - DHLOGI("SetABSInfo nodeName: %{public}s, absCode: %{public}d, absMin: %{public}d, absMax: %{public}d, " - "absFuzz: %{public}d, absFlat: %{public}d", inputDevice.name.c_str(), absCode, absInfo[ABS_MIN_POS], - absInfo[ABS_MAX_POS], absInfo[ABS_FUZZ_POS], absInfo[ABS_FLAT_POS]); + DHLOGI("SetABSInfo nodeName: %s, absCode: %d, absMin: %d, absMax: %d, absFuzz: %d, absFlat: %d", + inputDevice.name.c_str(), absCode, absInfo[ABS_MIN_POS], absInfo[ABS_MAX_POS], absInfo[ABS_FUZZ_POS], + absInfo[ABS_FLAT_POS]); if (absInfo[ABS_MAX_POS] < absInfo[ABS_MIN_POS]) { - DHLOGE("NodeName: %{public}s, absCode: %{public}d, attributes is invalid.", inputDevice.name.c_str(), - absCode); + DHLOGE("NodeName: %s, absCode: %d, attributes is invalid.", inputDevice.name.c_str(), absCode); continue; } inputUserDev.absmin[absCode] = absInfo[ABS_MIN_POS]; @@ -159,23 +158,23 @@ bool VirtualDevice::SetUp(const InputDevice &inputDevice, const std::string &dev } int ret = ioctl(fd_, UI_DEV_CREATE); if (ret < 0) { - DHLOGE("Unable to create input device, fd: %{public}d, ret= %{public}d", fd_, ret); + DHLOGE("Unable to create input device, fd: %d, ret= %d", fd_, ret); return false; } - DHLOGI("create fd %{public}d", fd_); + DHLOGI("create fd %d", fd_); char sysfsDeviceName[16] = {0}; if (ioctl(fd_, UI_GET_SYSNAME(sizeof(sysfsDeviceName)), sysfsDeviceName) < 0) { DHLOGE("Unable to get input device name"); } - DHLOGI("get input device name: %{public}s, fd: %{public}d", GetAnonyString(sysfsDeviceName).c_str(), fd_); + DHLOGI("get input device name: %s, fd: %d", GetAnonyString(sysfsDeviceName).c_str(), fd_); return true; } bool VirtualDevice::InjectInputEvent(const input_event &event) { if (write(fd_, &event, sizeof(event)) < static_cast(sizeof(event))) { - DHLOGE("could not inject event, removed? (fd: %{public}d", fd_); + DHLOGE("could not inject event, removed? (fd: %d", fd_); return false; } RecordEventLog(event); @@ -184,7 +183,7 @@ bool VirtualDevice::InjectInputEvent(const input_event &event) void VirtualDevice::SetNetWorkId(const std::string &netWorkId) { - DHLOGI("SetNetWorkId %{public}s\n", GetAnonyString(netWorkId).c_str()); + DHLOGI("SetNetWorkId %s\n", GetAnonyString(netWorkId).c_str()); netWorkId_ = netWorkId; } @@ -225,9 +224,8 @@ void VirtualDevice::RecordEventLog(const input_event &event) eventType = "other type " + std::to_string(event.type); break; } - DHLOGD("4.E2E-Test Source write event into input driver, EventType: %{public}s, Code: %{public}d, " - "Value: %{public}d, Sec: %ld, Sec1: %ld", eventType.c_str(), event.code, event.value, event.input_event_sec, - event.input_event_usec); + DHLOGD("4.E2E-Test Source write event into input driver, EventType: %s, Code: %d, Value: %d, Sec: %ld, Sec1: %ld", + eventType.c_str(), event.code, event.value, event.input_event_sec, event.input_event_usec); } int32_t VirtualDevice::GetDeviceFd() diff --git a/services/source/inputinject/test/sourceinjectunittest/BUILD.gn b/services/source/inputinject/test/sourceinjectunittest/BUILD.gn index cfe970adf1b9894568133df5d0e19c5eb2570d55..8c41812eb9a624015235fe255e3d770f028ce6cc 100755 --- a/services/source/inputinject/test/sourceinjectunittest/BUILD.gn +++ b/services/source/inputinject/test/sourceinjectunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -85,7 +85,6 @@ ohos_unittest("distributed_input_inner_sourceinject_test") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/source/sourcemanager/BUILD.gn b/services/source/sourcemanager/BUILD.gn index 2ff784ab9e36c5682046f7094e74d1f183f4d1fd..536f99cbf62be79cd461ac6ec536e3907dc60c9d 100644 --- a/services/source/sourcemanager/BUILD.gn +++ b/services/source/sourcemanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -117,7 +117,6 @@ ohos_shared_library("libdinput_source") { "dsoftbus:softbus_client", "eventhandler:libeventhandler", "hicollie:libhicollie", - "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/source/sourcemanager/src/dinput_source_listener.cpp b/services/source/sourcemanager/src/dinput_source_listener.cpp index ae41aad483c65bccad0db29096b369bd47c45ed9..6645e768dc86ecf6bbfcecdd5bb530181cb14d9d 100644 --- a/services/source/sourcemanager/src/dinput_source_listener.cpp +++ b/services/source/sourcemanager/src/dinput_source_listener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023 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 @@ -51,8 +51,8 @@ DInputSourceListener::~DInputSourceListener() void DInputSourceListener::OnResponseRegisterDistributedHardware( const std::string deviceId, const std::string dhId, bool result) { - DHLOGI("OnResponseRegisterDistributedHardware called, deviceId: %{public}s, " - "result: %{public}s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); + DHLOGI("OnResponseRegisterDistributedHardware called, deviceId: %s, " + "result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { DHLOGE("OnResponseRegisterDistributedHardware sourceManagerObj is null."); return; @@ -78,7 +78,7 @@ void DInputSourceListener::OnResponseRegisterDistributedHardware( void DInputSourceListener::OnResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) { - DHLOGI("OnResponsePrepareRemoteInput called, deviceId: %{public}s, result: %{public}s.", + DHLOGI("OnResponsePrepareRemoteInput called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { @@ -104,8 +104,8 @@ void DInputSourceListener::OnResponsePrepareRemoteInput(const std::string device void DInputSourceListener::OnResponseUnprepareRemoteInput(const std::string deviceId, bool result) { - DHLOGI("OnResponseUnprepareRemoteInput called, deviceId: %{public}s, " - "result: %{public}s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); + DHLOGI("OnResponseUnprepareRemoteInput called, deviceId: %s, " + "result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { DHLOGE("OnResponseUnprepareRemoteInput sourceManagerObj is null."); @@ -131,8 +131,7 @@ void DInputSourceListener::OnResponseUnprepareRemoteInput(const std::string devi void DInputSourceListener::OnResponseRelayPrepareRemoteInput(int32_t toSrcSessionId, const std::string &deviceId, bool result, const std::string &object) { - DHLOGI("OnResponseRelayPrepareRemoteInput deviceId: %{public}s, result: %{public}d.", - GetAnonyString(deviceId).c_str(), result); + DHLOGI("OnResponseRelayPrepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -157,8 +156,7 @@ void DInputSourceListener::OnResponseRelayPrepareRemoteInput(int32_t toSrcSessio void DInputSourceListener::OnResponseRelayUnprepareRemoteInput(int32_t toSrcSessionId, const std::string &deviceId, bool result) { - DHLOGI("OnResponseRelayUnprepareRemoteInput deviceId: %{public}s, result: %{public}d.", - GetAnonyString(deviceId).c_str(), result); + DHLOGI("OnResponseRelayUnprepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -182,7 +180,7 @@ void DInputSourceListener::OnResponseRelayUnprepareRemoteInput(int32_t toSrcSess void DInputSourceListener::OnResponseStartRemoteInput( const std::string deviceId, const uint32_t inputTypes, bool result) { - DHLOGI("OnResponseStartRemoteInput called, deviceId: %{public}s, inputTypes: %{public}d, result: %{public}s.", + DHLOGI("OnResponseStartRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", GetAnonyString(deviceId).c_str(), inputTypes, result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { @@ -212,7 +210,7 @@ void DInputSourceListener::OnResponseStartRemoteInput( void DInputSourceListener::OnResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) { - DHLOGI("OnResponseStopRemoteInput called, deviceId: %{public}s, inputTypes: %{public}d, result: %{public}s.", + DHLOGI("OnResponseStopRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", GetAnonyString(deviceId).c_str(), inputTypes, result ? "true" : "failed"); if (sourceManagerObj_ == nullptr) { @@ -240,7 +238,7 @@ void DInputSourceListener::OnResponseStopRemoteInput(const std::string deviceId, void DInputSourceListener::OnResponseStartRemoteInputDhid( const std::string deviceId, const std::string &dhids, bool result) { - DHLOGI("OnResponseStartRemoteInputDhid called, deviceId: %{public}s, result: %{public}s.", + DHLOGI("OnResponseStartRemoteInputDhid called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { @@ -274,7 +272,7 @@ void DInputSourceListener::OnResponseStartRemoteInputDhid( void DInputSourceListener::OnResponseStopRemoteInputDhid( const std::string deviceId, const std::string &dhids, bool result) { - DHLOGI("OnResponseStopRemoteInputDhid called, deviceId: %{public}s, result: %{public}s.", + DHLOGI("OnResponseStopRemoteInputDhid called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { @@ -302,7 +300,7 @@ void DInputSourceListener::OnResponseStopRemoteInputDhid( void DInputSourceListener::OnResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, const uint32_t code, const uint32_t value) { - DHLOGI("OnResponseKeyState called, deviceId: %{public}s, dhid: %{public}s.", GetAnonyString(deviceId).c_str(), + DHLOGI("OnResponseKeyState called, deviceId: %s, dhid: %s.", GetAnonyString(deviceId).c_str(), GetAnonyString(dhid).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); @@ -330,7 +328,7 @@ void DInputSourceListener::OnResponseKeyState(const std::string deviceId, void DInputSourceListener::OnResponseKeyStateBatch(const std::string deviceId, const std::string &event) { - DHLOGI("OnResponseKeyStateBatch events, deviceId: %{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGI("OnResponseKeyStateBatch events, deviceId: %s.", GetAnonyString(deviceId).c_str()); OnReceivedEventRemoteInput(deviceId, event); } @@ -348,7 +346,7 @@ void DInputSourceListener::OnReceivedEventRemoteInput(const std::string deviceId } size_t jsonSize = inputData.size(); - DHLOGD("OnReceivedEventRemoteInput called, deviceId: %{public}s, json size:%{public}zu.", + DHLOGD("OnReceivedEventRemoteInput called, deviceId: %s, json size:%zu.", GetAnonyString(deviceId).c_str(), jsonSize); std::vector mEventBuffer(jsonSize); @@ -378,8 +376,7 @@ void DInputSourceListener::OnReceivedEventRemoteInput(const std::string deviceId void DInputSourceListener::OnReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -403,8 +400,7 @@ void DInputSourceListener::OnReceiveRelayPrepareResult(int32_t status, void DInputSourceListener::OnReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -428,8 +424,7 @@ void DInputSourceListener::OnReceiveRelayUnprepareResult(int32_t status, void DInputSourceListener::OnReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -454,8 +449,7 @@ void DInputSourceListener::OnReceiveRelayStartDhidResult(int32_t status, void DInputSourceListener::OnReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -480,8 +474,7 @@ void DInputSourceListener::OnReceiveRelayStopDhidResult(int32_t status, void DInputSourceListener::OnReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -506,8 +499,7 @@ void DInputSourceListener::OnReceiveRelayStartTypeResult(int32_t status, void DInputSourceListener::OnReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) { - DHLOGI("status:%{public}d, srcId: %{public}s, sinkId: %{public}s.", status, GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); if (sourceManagerObj_ == nullptr) { DHLOGE("sourceManagerObj is null."); return; @@ -547,8 +539,8 @@ void DInputSourceListener::RecordEventLog(int64_t when, int32_t type, int32_t co eventType = "other type"; break; } - DHLOGD("3.E2E-Test Source softBus receive event, EventType: %{public}s, Code: %{public}d, Value: %{public}d, " - "Path: %{public}s, When: %{public}" PRId64 "", eventType.c_str(), code, value, path.c_str(), when); + DHLOGD("3.E2E-Test Source softBus receive event, EventType: %s, Code: %d, Value: %d, Path: %s, When: %" PRId64 "", + eventType.c_str(), code, value, path.c_str(), when); } } // namespace DistributedInput } // namespace DistributedHardware diff --git a/services/source/sourcemanager/src/dinput_source_manager_event_handler.cpp b/services/source/sourcemanager/src/dinput_source_manager_event_handler.cpp index 81bff48b49f8fee7f83728cc8f5e8d0701f36cae..2f84018f3ed1a4e2a9fe5911749c552d0d9bafe1 100644 --- a/services/source/sourcemanager/src/dinput_source_manager_event_handler.cpp +++ b/services/source/sourcemanager/src/dinput_source_manager_event_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023 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 @@ -97,8 +97,8 @@ void DInputSourceManagerEventHandler::NotifyRegisterCallback(const AppExecFwk::I sourceManagerObj_->RemoveInputDeviceId(deviceId, dhId); } } else { - DHLOGW("ProcessEvent DINPUT_SOURCE_MANAGER_RIGISTER_MSG the, devId: %{public}s, dhId: %{public}s is bad data.", - GetAnonyString(deviceId).c_str(), GetAnonyString(dhId).c_str()); + DHLOGW("ProcessEvent DINPUT_SOURCE_MANAGER_RIGISTER_MSG the " + "devId: %s, dhId: %s is bad data.", GetAnonyString(deviceId).c_str(), GetAnonyString(dhId).c_str()); } sourceManagerObj_->RunRegisterCallback(deviceId, dhId, @@ -178,7 +178,7 @@ void DInputSourceManagerEventHandler::NotifyStartCallback(const AppExecFwk::Inne std::string deviceId = innerMsg[INPUT_SOURCEMANAGER_KEY_DEVID]; uint32_t inputTypes = innerMsg[INPUT_SOURCEMANAGER_KEY_ITP]; bool result = innerMsg[INPUT_SOURCEMANAGER_KEY_RESULT]; - DHLOGI("Start DInput Recv Callback ret: %{public}s, devId: %{public}s, inputTypes: %{public}d", + DHLOGI("Start DInput Recv Callback ret: %s, devId: %s, inputTypes: %d", result ? "true" : "false", GetAnonyString(deviceId).c_str(), inputTypes); if (result) { sourceManagerObj_->SetInputTypesMap( @@ -205,7 +205,7 @@ void DInputSourceManagerEventHandler::NotifyStopCallback(const AppExecFwk::Inner uint32_t inputTypes = innerMsg[INPUT_SOURCEMANAGER_KEY_ITP]; bool result = innerMsg[INPUT_SOURCEMANAGER_KEY_RESULT]; - DHLOGI("Stop DInput Recv Callback ret: %{public}d, devId: %{public}s, inputTypes: %{public}d", + DHLOGI("Stop DInput Recv Callback ret: %B, devId: %s, inputTypes: %d", result, GetAnonyString(deviceId).c_str(), inputTypes); if (result && (sourceManagerObj_->GetInputTypesMap(deviceId) & inputTypes)) { sourceManagerObj_->SetInputTypesMap( @@ -354,7 +354,7 @@ void DInputSourceManagerEventHandler::NotifyRelayPrepareRemoteInput(const AppExe bool result = innerMsg[INPUT_SOURCEMANAGER_KEY_RESULT]; std::string object = innerMsg[INPUT_SOURCEMANAGER_KEY_WHITELIST]; int32_t toSrcSessionId = innerMsg[INPUT_SOURCEMANAGER_KEY_SESSIONID]; - DHLOGI("Device whitelist object: %{public}s", object.c_str()); + DHLOGI("Device whitelist object: %s", object.c_str()); std::string localNetworkId = GetLocalNetworkId(); if (localNetworkId.empty()) { return; @@ -482,7 +482,7 @@ void DInputSourceManagerEventHandler::ProcessEvent(const AppExecFwk::InnerEvent: { auto iter = eventFuncMap_.find(event->GetInnerEventId()); if (iter == eventFuncMap_.end()) { - DHLOGE("Event Id %{public}d is undefined.", event->GetInnerEventId()); + DHLOGE("Event Id %d is undefined.", event->GetInnerEventId()); return; } SourceEventFunc &func = iter->second; diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index 8d7f5fa95a159d64716cd3be6b967a261046ec22..a8d396b5e054f15f658f993b78ea06fa32b5b13a 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -171,8 +171,7 @@ int32_t DistributedInputSourceManager::Release() for (auto iter = inputDevice_.begin(); iter != inputDevice_.end(); ++iter) { std::string devId = iter->devId; std::string dhId = iter->dhId; - DHLOGI("Release devId: %{public}s, dhId: %{public}s.", GetAnonyString(devId).c_str(), - GetAnonyString(dhId).c_str()); + DHLOGI("Release devId: %s, dhId: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); int32_t ret = DistributedInputInject::GetInstance().UnregisterDistributedHardware(devId, dhId); if (ret != DH_SUCCESS) { DHLOGE("DinputSourceManager Release called, remove node fail."); @@ -204,7 +203,7 @@ int32_t DistributedInputSourceManager::Release() } int32_t ret = systemAbilityMgr->UnloadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID); if (ret != DH_SUCCESS) { - DHLOGE("Failed to UnloadSystemAbility service! errcode: %{public}d.", ret); + DHLOGE("Failed to UnloadSystemAbility service! errcode: %d.", ret); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_RELEASE_FAIL; } DHLOGI("Source unloadSystemAbility successfully."); @@ -263,7 +262,7 @@ int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::st ERR_DH_INPUT_SERVER_SOURCE_MANAGER_REGISTER_FAIL, "Dinputregister failed callback is nullptr."); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_REGISTER_FAIL; } - DHLOGI("RegisterDistributedHardware called, deviceId: %{public}s, dhId: %{public}s, parameters: %{public}s", + DHLOGI("RegisterDistributedHardware called, deviceId: %s, dhId: %s, parameters: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), SetAnonyId(parameters).c_str()); std::lock_guard lock(regDisHardwareMutex_); DInputClientRegistInfo info {devId, dhId, callback}; @@ -295,7 +294,7 @@ int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::st } // 3.save device - DHLOGI("inputDevice push deviceId: %{public}s, dhId: %{public}s", GetAnonyString(inputDeviceId.devId).c_str(), + DHLOGI("inputDevice push deviceId: %s, dhId: %s", GetAnonyString(inputDeviceId.devId).c_str(), GetAnonyString(inputDeviceId.dhId).c_str()); inputDevice_.push_back(inputDeviceId); @@ -383,7 +382,7 @@ int32_t DistributedInputSourceManager::CheckDeviceIsExists(const std::string &de } if (it == inputDevice_.end()) { - DHLOGE("CheckDevice called, deviceId: %{public}s is not exist.", GetAnonyString(devId).c_str()); + DHLOGE("CheckDevice called, deviceId: %s is not exist.", GetAnonyString(devId).c_str()); if (UnregCallbackNotify(devId, dhId) != DH_SUCCESS) { return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL; } @@ -434,8 +433,7 @@ int32_t DistributedInputSourceManager::UnregisterDistributedHardware(const std:: ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, "dinput unregister failed in callback is nullptr"); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL; } - DHLOGI("Unregister called, deviceId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), - GetAnonyString(dhId).c_str()); + DHLOGI("Unregister called, deviceId: %s, dhId: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(regDisHardwareMutex_); DInputClientUnregistInfo info {devId, dhId, callback}; unregCallbacks_.push_back(info); @@ -443,14 +441,14 @@ int32_t DistributedInputSourceManager::UnregisterDistributedHardware(const std:: InputDeviceId inputDeviceId {devId, dhId}; auto it = inputDevice_.begin(); if (CheckDeviceIsExists(devId, dhId, inputDeviceId, it) != DH_SUCCESS) { - DHLOGE("Unregister deviceId: %{public}s is not exist.", GetAnonyString(devId).c_str()); + DHLOGE("Unregister deviceId: %s is not exist.", GetAnonyString(devId).c_str()); HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_UNREGISTER_FAIL, devId, dhId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, "dinput unregister failed in deviceId is not exist"); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL; } if (DeleteInputDeviceNodeInfo(devId, dhId, it) != DH_SUCCESS) { - DHLOGE("Unregister deviceId: %{public}s, delete device node failed", GetAnonyString(devId).c_str()); + DHLOGE("Unregister deviceId: %s, delete device node failed", GetAnonyString(devId).c_str()); HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_UNREGISTER_FAIL, devId, dhId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, "dinput unregister failed in delete input node"); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL; @@ -475,10 +473,10 @@ int32_t DistributedInputSourceManager::PrepareRemoteInput( return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; } - DHLOGI("Prepare called, deviceId: %{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("Prepare called, deviceId: %s", GetAnonyString(deviceId).c_str()); int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(deviceId, false); if (ret != DH_SUCCESS) { - DHLOGE("Open softbus session fail, ret: %{public}d", ret); + DHLOGE("Open softbus session fail, ret: %d", ret); HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, "Dinput prepare failed in open softbus"); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_PREPARE_START, DINPUT_PREPARE_TASK); @@ -493,7 +491,7 @@ int32_t DistributedInputSourceManager::PrepareRemoteInput( HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, "Dinput prepare failed in transport prepare"); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_PREPARE_START, DINPUT_PREPARE_TASK); - DHLOGE("Can not send message by softbus, prepare fail, ret: %{public}d", ret); + DHLOGE("Can not send message by softbus, prepare fail, ret: %d", ret); info.preCallback->OnResult(deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL); RemovePrepareCallbacks(info); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; @@ -512,12 +510,12 @@ int32_t DistributedInputSourceManager::UnprepareRemoteInput( FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_UNPREPARE_START, DINPUT_UNPREPARE_TASK); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL; } - DHLOGI("Unprepare called, deviceId: %{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("Unprepare called, deviceId: %s", GetAnonyString(deviceId).c_str()); DInputClientUnprepareInfo info {deviceId, callback}; AddUnPrepareCallbacks(info); int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId); if (ret != DH_SUCCESS) { - DHLOGE("Can not send message by softbus, unprepare fail, ret: %{public}d", ret); + DHLOGE("Can not send message by softbus, unprepare fail, ret: %d", ret); HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, "Dinput unprepare failed in transport unprepare."); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_UNPREPARE_START, DINPUT_UNPREPARE_TASK); @@ -540,7 +538,7 @@ int32_t DistributedInputSourceManager::StartRemoteInput( return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; } - DHLOGI("Start called, deviceId: %{public}s, inputTypes: %{public}d", GetAnonyString(deviceId).c_str(), inputTypes); + DHLOGI("Start called, deviceId: %s, inputTypes: %d", GetAnonyString(deviceId).c_str(), inputTypes); for (auto iter : staCallbacks_) { if (iter.devId == deviceId && iter.inputTypes == inputTypes) { callback->OnResult(deviceId, inputTypes, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL); @@ -584,7 +582,7 @@ int32_t DistributedInputSourceManager::StopRemoteInput( return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; } - DHLOGI("Stop called, deviceId: %{public}s, inputTypes: %{public}d", GetAnonyString(deviceId).c_str(), inputTypes); + DHLOGI("Stop called, deviceId: %s, inputTypes: %d", GetAnonyString(deviceId).c_str(), inputTypes); for (auto iter : stpCallbacks_) { if (iter.devId == deviceId && iter.inputTypes == inputTypes) { callback->OnResult(deviceId, inputTypes, ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL); @@ -627,8 +625,8 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL; } - DHLOGI("StartRemoteInput called, srcId: %{public}s, sinkId: %{public}s, inputTypes: %{public}d", - GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str(), inputTypes); + DHLOGI("StartRemoteInput called, srcId: %s, sinkId: %s, inputTypes: %d", GetAnonyString(srcId).c_str(), + GetAnonyString(sinkId).c_str(), inputTypes); std::string localNetworkId = GetLocalNetworkId(); if (localNetworkId.empty()) { HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, @@ -671,8 +669,8 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &srcId, FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL; } - DHLOGI("StopRemoteInput called, srcId: %{public}s, sinkId: %{public}s, inputTypes: %{public}d", - GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str(), inputTypes); + DHLOGI("StopRemoteInput called, srcId: %s, sinkId: %s, inputTypes: %d", GetAnonyString(srcId).c_str(), + GetAnonyString(sinkId).c_str(), inputTypes); std::string localNetworkId = GetLocalNetworkId(); if (localNetworkId.empty()) { HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId, @@ -756,8 +754,7 @@ int32_t DistributedInputSourceManager::PrepareRemoteInput(const std::string &src FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; } - DHLOGI("Dinput prepare, srcId: %{public}s, sinkId: %{public}s", GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("Dinput prepare, srcId: %s, sinkId: %s", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); std::string localNetworkId = GetLocalNetworkId(); if (localNetworkId.empty()) { return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; @@ -768,7 +765,7 @@ int32_t DistributedInputSourceManager::PrepareRemoteInput(const std::string &src // current device is source device int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(sinkId, false); if (ret != DH_SUCCESS) { - DHLOGE("Open softbus session fail ret=%{public}d.", ret); + DHLOGE("Open softbus session fail ret=%d.", ret); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; } DInputClientPrepareInfo info {sinkId, callback}; @@ -776,7 +773,7 @@ int32_t DistributedInputSourceManager::PrepareRemoteInput(const std::string &src ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(sinkId); if (ret != DH_SUCCESS) { - DHLOGE("Can not send message by softbus, prepare fail, ret: %{public}d", ret); + DHLOGE("Can not send message by softbus, prepare fail, ret: %d", ret); RemovePrepareCallbacks(info); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL; } @@ -792,8 +789,7 @@ int32_t DistributedInputSourceManager::UnprepareRemoteInput(const std::string &s FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL; } - DHLOGI("Dinput unprepare, srcId: %{public}s, sinkId: %{public}s", GetAnonyString(srcId).c_str(), - GetAnonyString(sinkId).c_str()); + DHLOGI("Dinput unprepare, srcId: %s, sinkId: %s", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); std::string localNetworkId = GetLocalNetworkId(); if (localNetworkId.empty()) { return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL; @@ -807,7 +803,7 @@ int32_t DistributedInputSourceManager::UnprepareRemoteInput(const std::string &s AddUnPrepareCallbacks(info); int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(sinkId); if (ret != DH_SUCCESS) { - DHLOGE("Can not send message by softbus, unprepare fail, ret: %{public}d", ret); + DHLOGE("Can not send message by softbus, unprepare fail, ret: %d", ret); RemoveUnPrepareCallbacks(info); return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL; } @@ -829,7 +825,7 @@ bool DistributedInputSourceManager::IsStringDataSame(const std::vector dhidsVec; SplitStringToVector(dhIds, INPUT_STRING_SPLIT_POINT, dhidsVec); - DHLOGI("ProcessEvent DINPUT_SOURCE_MANAGER_START_DHID_MSG dhIds:%{public}s, vec-size:%{public}zu", - GetAnonyString(dhIds).c_str(), dhidsVec.size()); + DHLOGI("ProcessEvent DINPUT_SOURCE_MANAGER_START_DHID_MSG dhIds:%s, vec-size:%d", GetAnonyString(dhIds).c_str(), + dhidsVec.size()); std::string localNetWorkId = GetLocalNetworkId(); if (localNetWorkId.empty()) { return; @@ -1348,7 +1341,7 @@ void DistributedInputSourceManager::RunRelayStartDhidCallback(const std::string { std::vector dhidsVec; SplitStringToVector(dhids, INPUT_STRING_SPLIT_POINT, dhidsVec); - DHLOGI("ProcessEvent DINPUT_SOURCE_MANAGER_RELAY_STARTDHID_RESULT_MMI dhIds:%{public}s, vec-size:%{public}zu", + DHLOGI("ProcessEvent DINPUT_SOURCE_MANAGER_RELAY_STARTDHID_RESULT_MMI dhIds:%s, vec-size:%d", dhids.c_str(), dhidsVec.size()); bool isCbRun = false; sptr cb = nullptr; @@ -1462,7 +1455,7 @@ DInputServerType DistributedInputSourceManager::GetStartTransFlag() void DistributedInputSourceManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Source isStartTrans_ %{public}d", static_cast(flag)); + DHLOGI("Set Source isStartTrans_ %d", static_cast(flag)); isStartTrans_ = flag; } @@ -1481,7 +1474,7 @@ void DistributedInputSourceManager::RemoveInputDeviceId(const std::string device } // delete device - DHLOGI("inputDevice erase deviceId: %{public}s, dhId: %{public}s", GetAnonyString(it->devId).c_str(), + DHLOGI("inputDevice erase deviceId: %s, dhId: %s", GetAnonyString(it->devId).c_str(), GetAnonyString(it->dhId).c_str()); inputDevice_.erase(it); } @@ -1546,7 +1539,7 @@ void DistributedInputSourceManager::StartDScreenListener::OnMessage(const DHTopi { DHLOGI("StartDScreenListener OnMessage!"); if (topic != DHTopic::TOPIC_START_DSCREEN) { - DHLOGE("this topic is wrong, %{public}d", static_cast(topic)); + DHLOGE("this topic is wrong, %d", static_cast(topic)); return; } if (message.size() > SCREEN_MSG_MAX) { @@ -1645,9 +1638,8 @@ int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfo srcScreenInfo.sourcePhyFd = static_cast(virtualScreenFd); srcScreenInfo.sourcePhyWidth = tmpInfo.sourceWinWidth; srcScreenInfo.sourcePhyHeight = tmpInfo.sourceWinHeight; - DHLOGI("StartDScreenListener UpdateSrcScreenInfo the data: devId: %{public}s, sourceWinId: %{public}" PRIu64 ", " - "sourceWinWidth: %{public}d, sourceWinHeight: %{public}d, sourcePhyId: %{public}s, sourcePhyFd: %{public}d, " - "sourcePhyWidth: %{public}d, sourcePhyHeight: %{public}d", + DHLOGI("StartDScreenListener UpdateSrcScreenInfo the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d," + "sourceWinHeight: %d, sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, srcScreenInfo.sourceWinWidth, srcScreenInfo.sourceWinHeight, GetAnonyString(srcScreenInfo.sourcePhyId).c_str(), srcScreenInfo.sourcePhyFd, srcScreenInfo.sourcePhyWidth, srcScreenInfo.sourcePhyHeight); @@ -1658,7 +1650,7 @@ void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic { DHLOGI("StopDScreenListener OnMessage!"); if (topic != DHTopic::TOPIC_STOP_DSCREEN) { - DHLOGE("this topic is wrong, %{public}u", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } std::string sinkDevId = ""; @@ -1671,7 +1663,7 @@ void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic std::string sourceDevId = GetLocalNetworkId(); std::string screenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(sourceDevId, sourceWinId); - DHLOGI("screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); SrcScreenInfo srcScreenInfo = DInputContext::GetInstance().GetSrcScreenInfo(screenInfoKey); int32_t removeNodeRes = DistributedInputInject::GetInstance().RemoveVirtualTouchScreenNode( @@ -1726,7 +1718,7 @@ void DistributedInputSourceManager::DeviceOfflineListener::OnMessage(const DHTop { DHLOGI("DeviceOfflineListener OnMessage!"); if (topic != DHTopic::TOPIC_DEV_OFFLINE) { - DHLOGE("this topic is wrong, %{public}u", static_cast(topic)); + DHLOGE("this topic is wrong, %u", static_cast(topic)); return; } if (message.empty()) { @@ -1787,7 +1779,7 @@ int32_t DistributedInputSourceManager::Dump(int32_t fd, const std::vector DInputSourceSACliMgr::GetRemoteCli(const std::stri DHLOGE("DInputSourceSACliMgr::GetRemoteCli deviceId is empty"); return nullptr; } - DHLOGI("DInputSourceSACliMgr::GetRemoteCli remote deviceid is %{public}s", GetAnonyString(deviceId).c_str()); + DHLOGI("DInputSourceSACliMgr::GetRemoteCli remote deviceid is %s", GetAnonyString(deviceId).c_str()); auto remoteCli = GetRemoteCliFromCache(deviceId); if (remoteCli != nullptr) { DHLOGD("VirtualHardwareManager::GetRemoteCli get from cache!"); @@ -80,7 +80,7 @@ sptr DInputSourceSACliMgr::GetRemoteCli(const std::stri auto object = samgr->CheckSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, deviceId); if (object == nullptr) { - DHLOGE("GetRemoteCli failed get remote Cli %{public}s", GetAnonyString(deviceId).c_str()); + DHLOGE("GetRemoteCli failed get remote Cli %s", GetAnonyString(deviceId).c_str()); return nullptr; } @@ -101,11 +101,11 @@ sptr DInputSourceSACliMgr::GetRemoteCliFromCache(const void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr object) { if (devId.empty() || (object == nullptr)) { - DHLOGW("DInputSourceSACliMgr::AddRemoteCli param error! devId=%{public}s", GetAnonyString(devId).c_str()); + DHLOGW("DInputSourceSACliMgr::AddRemoteCli param error! devId=%s", GetAnonyString(devId).c_str()); return; } - DHLOGI("DInputSourceSACliMgr::AddRemoteCli devId=%{public}s", GetAnonyString(devId).c_str()); + DHLOGI("DInputSourceSACliMgr::AddRemoteCli devId=%s", GetAnonyString(devId).c_str()); object->AddDeathRecipient(remoteCliDeathRcv); std::lock_guard lock(remoteCliLock); @@ -118,7 +118,7 @@ void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr lock(remoteCliLock); auto item = remoteCliMap.find(devId); if (item == remoteCliMap.end()) { @@ -144,7 +144,7 @@ void DInputSourceSACliMgr::DeleteRemoteCli(const sptr remote) return; } - DHLOGI("VirtualHardwareManager::DeleteRemoteCli remote.devId=%{public}s", GetAnonyString(iter->first).c_str()); + DHLOGI("VirtualHardwareManager::DeleteRemoteCli remote.devId=%s", GetAnonyString(iter->first).c_str()); if (iter->second != nullptr) { iter->second->AsObject()->RemoveDeathRecipient(remoteCliDeathRcv); } diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/BUILD.gn b/services/source/sourcemanager/test/sourcemanagerunittest/BUILD.gn index c7d1708b9994495d2cfa3d946cbdea41dbf021f9..3a5b758cbbb320b5a095fa298e5725fa1c55ee1d 100755 --- a/services/source/sourcemanager/test/sourcemanagerunittest/BUILD.gn +++ b/services/source/sourcemanager/test/sourcemanagerunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -128,7 +128,6 @@ ohos_unittest("distributed_input_sourcemanager_test") { "distributed_hardware_fwk:libdhfwk_sdk", "eventhandler:libeventhandler", "hicollie:libhicollie", - "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/source/transport/BUILD.gn b/services/source/transport/BUILD.gn index df26387f31738f7a2ce202156f65388225b05af7..a762f176066b7e1147979fe7a4f34bca4df79abf 100755 --- a/services/source/transport/BUILD.gn +++ b/services/source/transport/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -62,7 +62,6 @@ ohos_shared_library("libdinput_source_trans") { "c_utils:utils", "distributed_hardware_fwk:libdhfwk_sdk", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "samgr:samgr_proxy", ] diff --git a/services/source/transport/src/distributed_input_source_transport.cpp b/services/source/transport/src/distributed_input_source_transport.cpp index 017ad858e2a0bf1d64b097c1b95acb137d3da977..b86e9995a13e91cb6973d4c82e6f5c620812db31 100644 --- a/services/source/transport/src/distributed_input_source_transport.cpp +++ b/services/source/transport/src/distributed_input_source_transport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -138,7 +138,7 @@ int32_t DistributedInputSourceTransport::OpenInputSoftbus(const std::string &rem { int32_t ret = DistributedInputTransportBase::GetInstance().StartSession(remoteDevId); if (ret != DH_SUCCESS) { - DHLOGE("StartSession fail! remoteDevId:%{public}s.", GetAnonyString(remoteDevId).c_str()); + DHLOGE("StartSession fail! remoteDevId:%s.", GetAnonyString(remoteDevId).c_str()); return ret; } @@ -148,7 +148,7 @@ int32_t DistributedInputSourceTransport::OpenInputSoftbus(const std::string &rem if (latencyThreadNum == 0) { StartLatencyThread(remoteDevId); - DHLOGI("LatencyThread started, remoteDevId: %{public}s.", GetAnonyString(remoteDevId).c_str()); + DHLOGI("LatencyThread started, remoteDevId: %s.", GetAnonyString(remoteDevId).c_str()); } else { DHLOGI("LatencyThread already started."); } @@ -192,10 +192,10 @@ int32_t DistributedInputSourceTransport::PrepareRemoteInput(const std::string &d { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("PrepareRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("PrepareRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("PrepareRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("PrepareRemoteInput sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_PREPARE; @@ -204,11 +204,11 @@ int32_t DistributedInputSourceTransport::PrepareRemoteInput(const std::string &d std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("PrepareRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("PrepareRemoteInput deviceId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("PrepareRemoteInput devId:%{public}s, sessionId:%{public}d, msg:%{public}s.", + DHLOGI("PrepareRemoteInput devId:%s, sessionId:%d, msg:%s.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -217,10 +217,10 @@ int32_t DistributedInputSourceTransport::UnprepareRemoteInput(const std::string { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("UnprepareRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("UnprepareRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL; } - DHLOGI("UnprepareRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("UnprepareRemoteInput sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_UNPREPARE; @@ -229,11 +229,11 @@ int32_t DistributedInputSourceTransport::UnprepareRemoteInput(const std::string std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("UnprepareRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("UnprepareRemoteInput deviceId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL; } - DHLOGI("UnprepareRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("UnprepareRemoteInput deviceId:%s, sessionId:%d, smsg:%s.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -242,11 +242,11 @@ int32_t DistributedInputSourceTransport::PrepareRemoteInput(int32_t srcTsrcSeId, { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("PrepareRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("PrepareRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("PrepareRemoteInput srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("PrepareRemoteInput srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_PREPARE_FOR_REL; @@ -255,11 +255,11 @@ int32_t DistributedInputSourceTransport::PrepareRemoteInput(int32_t srcTsrcSeId, std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("PrepareRemoteInput deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("PrepareRemoteInput deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("PrepareRemoteInput send success, devId:%{public}s, msg:%{public}s.", + DHLOGI("PrepareRemoteInput send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -267,10 +267,10 @@ int32_t DistributedInputSourceTransport::UnprepareRemoteInput(int32_t srcTsrcSeI { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("UnprepareRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("UnprepareRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL; } - DHLOGI("UnprepareRemoteInput srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("UnprepareRemoteInput srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_UNPREPARE_FOR_REL; @@ -279,11 +279,11 @@ int32_t DistributedInputSourceTransport::UnprepareRemoteInput(int32_t srcTsrcSeI std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("UnprepareRemoteInput deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("UnprepareRemoteInput deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL; } - DHLOGI("UnprepareRemoteInput send success, devId:%{public}s, msg:%{public}s.", + DHLOGI("UnprepareRemoteInput send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -293,10 +293,10 @@ int32_t DistributedInputSourceTransport::StartRemoteInputDhids(int32_t srcTsrcSe { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("StartRemoteInputDhids error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StartRemoteInputDhids error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInputDhids srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("StartRemoteInputDhids srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_DHID_FOR_REL; @@ -306,11 +306,11 @@ int32_t DistributedInputSourceTransport::StartRemoteInputDhids(int32_t srcTsrcSe std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StartRemoteInputDhids deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("StartRemoteInputDhids deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInputDhids send success, devId:%{public}s, msg:%{public}s.", GetAnonyString(deviceId).c_str(), + DHLOGI("StartRemoteInputDhids send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -320,10 +320,10 @@ int32_t DistributedInputSourceTransport::StopRemoteInputDhids(int32_t srcTsrcSeI { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("StopRemoteInputDhids error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StopRemoteInputDhids error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInputDhids srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("StopRemoteInputDhids srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); std::vector dhIdsVec = SplitDhIdString(dhids); ResetKeyboardKeyState(deviceId, dhIdsVec); @@ -335,11 +335,11 @@ int32_t DistributedInputSourceTransport::StopRemoteInputDhids(int32_t srcTsrcSeI std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StopRemoteInputDhids deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("StopRemoteInputDhids deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInputDhids send success, devId:%{public}s, msg:%{public}s.", GetAnonyString(deviceId).c_str(), + DHLOGI("StopRemoteInputDhids send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -349,10 +349,10 @@ int32_t DistributedInputSourceTransport::StartRemoteInputType(int32_t srcTsrcSeI { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("StartRemoteInputType error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StartRemoteInputType error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInputType srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("StartRemoteInputType srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_TYPE_FOR_REL; @@ -362,11 +362,11 @@ int32_t DistributedInputSourceTransport::StartRemoteInputType(int32_t srcTsrcSeI std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StartRemoteInputType deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("StartRemoteInputType deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInputType send success, devId:%{public}s, msg:%{public}s.", GetAnonyString(deviceId).c_str(), + DHLOGI("StartRemoteInputType send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -376,10 +376,10 @@ int32_t DistributedInputSourceTransport::StopRemoteInputType(int32_t srcTsrcSeId { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { - DHLOGE("StopRemoteInputType error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StopRemoteInputType error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInputType srcTsrcSeId:%{public}d, sinkSessionId:%{public}d.", srcTsrcSeId, sinkSessionId); + DHLOGI("StopRemoteInputType srcTsrcSeId:%d, sinkSessionId:%d.", srcTsrcSeId, sinkSessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL; @@ -389,11 +389,11 @@ int32_t DistributedInputSourceTransport::StopRemoteInputType(int32_t srcTsrcSeId std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sinkSessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StopRemoteInputType deviceId:%{public}s, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("StopRemoteInputType deviceId:%s, smsg:%s, SendMsg error, ret:%d.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInputType send success, devId:%{public}s, msg:%{public}s.", GetAnonyString(deviceId).c_str(), + DHLOGI("StopRemoteInputType send success, devId:%s, msg:%s.", GetAnonyString(deviceId).c_str(), SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -402,10 +402,10 @@ int32_t DistributedInputSourceTransport::SendRelayPrepareRequest(const std::stri { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayPrepareRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayPrepareRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("SendRelayPrepareRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayPrepareRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_PREPARE; @@ -413,11 +413,11 @@ int32_t DistributedInputSourceTransport::SendRelayPrepareRequest(const std::stri std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayPrepareRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayPrepareRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("SendRelayPrepareRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayPrepareRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -426,10 +426,10 @@ int32_t DistributedInputSourceTransport::SendRelayUnprepareRequest(const std::st { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayUnprepareRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayUnprepareRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("SendRelayUnprepareRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayUnprepareRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_UNPREPARE; @@ -437,11 +437,11 @@ int32_t DistributedInputSourceTransport::SendRelayUnprepareRequest(const std::st std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayUnprepareRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayUnprepareRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("SendRelayUnprepareRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayUnprepareRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -459,11 +459,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginPrepareResult(int32_t srcTs std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginPrepareResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginPrepareResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL; } - DHLOGI("NotifyOriginPrepareResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginPrepareResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -480,12 +480,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginUnprepareResult(int32_t src std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginUnprepareResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginUnprepareResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL; } - DHLOGI("NotifyOriginUnprepareResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, - SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginUnprepareResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -503,12 +502,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginStartDhidResult(int32_t src std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginStartDhidResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginStartDhidResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("NotifyOriginStartDhidResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, - SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginStartDhidResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -526,12 +524,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginStopDhidResult(int32_t srcT std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginStopDhidResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginStopDhidResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("NotifyOriginStopDhidResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, - SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginStopDhidResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -549,12 +546,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginStartTypeResult(int32_t src std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginStartTypeResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginStartTypeResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("NotifyOriginStartTypeResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, - SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginStartTypeResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -572,12 +568,11 @@ int32_t DistributedInputSourceTransport::NotifyOriginStopTypeResult(int32_t srcT std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(srcTsrcSeId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("NotifyOriginStopTypeResult srcTsrcSeId:%{public}d, smsg:%{public}s, SendMsg error, ret:%{public}d.", + DHLOGE("NotifyOriginStopTypeResult srcTsrcSeId:%d, smsg:%s, SendMsg error, ret:%d.", srcTsrcSeId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("NotifyOriginStopTypeResult srcTsrcSeId:%{public}d, smsg:%{public}s.", srcTsrcSeId, - SetAnonyId(smsg).c_str()); + DHLOGI("NotifyOriginStopTypeResult srcTsrcSeId:%d, smsg:%s.", srcTsrcSeId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -585,10 +580,10 @@ int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string &dev { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("StartRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StartRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("StartRemoteInput sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_TYPE; @@ -598,11 +593,11 @@ int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string &dev std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StartRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("StartRemoteInput deviceId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("StartRemoteInput deviceId:%s, sessionId:%d, smsg:%s.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -612,10 +607,10 @@ int32_t DistributedInputSourceTransport::StopRemoteInput( { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("StopRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StopRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("StopRemoteInput sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_STOP_TYPE; @@ -625,11 +620,11 @@ int32_t DistributedInputSourceTransport::StopRemoteInput( std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StopRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("StopRemoteInput deviceId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInput deviceId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("StopRemoteInput deviceId:%s, sessionId:%d, smsg:%s.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -638,7 +633,7 @@ int32_t DistributedInputSourceTransport::LatencyCount(const std::string &deviceI { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("LatencyCount error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("LatencyCount error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_LATENCY_FAIL; } @@ -649,8 +644,8 @@ int32_t DistributedInputSourceTransport::LatencyCount(const std::string &deviceI std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("LatencyCount deviceId:%{public}s, sessionId: %{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("LatencyCount deviceId:%s, sessionId: %d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_LATENCY_FAIL; } @@ -666,9 +661,9 @@ void DistributedInputSourceTransport::StartLatencyCount(const std::string &devic while (isLatencyThreadRunning_.load()) { if (sendNum_ >= INPUT_LATENCY_DELAY_TIMES) { uint64_t latency = (uint64_t)(deltaTimeAll_ / 2 / INPUT_LATENCY_DELAY_TIMES); - DHLOGI("LatencyCount average single-channel latency is %{public}" PRIu64 " us, send times is %{public}d, " - "recive times is %{public}d.", latency, sendNum_, recvNum_); - DHLOGD("each RTT latency details is %{public}s", eachLatencyDetails_.c_str()); + DHLOGI("LatencyCount average single-channel latency is %d us, send times is %d, recive times is %d.", + latency, sendNum_, recvNum_); + DHLOGD("each RTT latency details is %s", eachLatencyDetails_.c_str()); deltaTimeAll_ = 0; sendNum_ = 0; recvNum_ = 0; @@ -732,10 +727,10 @@ int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string &dev { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("StartRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StartRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("StartRemoteInput sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_DHID; @@ -745,12 +740,12 @@ int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string &dev std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StartRemoteInput deviceId:%{public}s, sessionId: %{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("StartRemoteInput deviceId:%s, sessionId: %d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("StartRemoteInput deviceId:%{public}s, sessionId: %{public}d, smsg:%{public}s.", - GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); + DHLOGI("StartRemoteInput deviceId:%s, sessionId: %d, smsg:%s.", GetAnonyString(deviceId).c_str(), + sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -759,7 +754,7 @@ void DistributedInputSourceTransport::ResetKeyboardKeyState(const std::string &d { std::vector keyboardNodePaths; DistributedInputInject::GetInstance().GetVirtualKeyboardPaths(deviceId, dhids, keyboardNodePaths); - DHLOGI("Try reset keyboard states, dhIds: %{public}s, nodePaths: %{public}s", + DHLOGI("Try reset keyboard states, dhIds: %s, nodePaths: %s", GetString(dhids).c_str(), GetString(keyboardNodePaths).c_str()); ResetVirtualDevicePressedKeys(keyboardNodePaths); } @@ -769,10 +764,10 @@ int32_t DistributedInputSourceTransport::StopRemoteInput(const std::string &devi { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { - DHLOGE("StopRemoteInput error, not find this device:%{public}s.", GetAnonyString(deviceId).c_str()); + DHLOGE("StopRemoteInput error, not find this device:%s.", GetAnonyString(deviceId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInput sessionId:%{public}d.", sessionId); + DHLOGI("StopRemoteInput sessionId:%d.", sessionId); ResetKeyboardKeyState(deviceId, dhids); nlohmann::json jsonStr; @@ -783,12 +778,11 @@ int32_t DistributedInputSourceTransport::StopRemoteInput(const std::string &devi std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("StopRemoteInput deviceId:%{public}s, sessionId: %{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("StopRemoteInput deviceId:%s, sessionId: %d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("StopRemoteInput deviceId:%{public}s, sessionId: %{public}d, smsg:%{public}s.", - GetAnonyString(deviceId).c_str(), + DHLOGI("StopRemoteInput deviceId:%s, sessionId: %d, smsg:%s.", GetAnonyString(deviceId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -798,10 +792,10 @@ int32_t DistributedInputSourceTransport::SendRelayStartDhidRequest(const std::st { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayStartDhidRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayStartDhidRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("SendRelayStartDhidRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayStartDhidRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_START_DHID; @@ -810,11 +804,11 @@ int32_t DistributedInputSourceTransport::SendRelayStartDhidRequest(const std::st std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayStartDhidRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayStartDhidRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("SendRelayStartDhidRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayStartDhidRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -824,10 +818,10 @@ int32_t DistributedInputSourceTransport::SendRelayStopDhidRequest(const std::str { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayStopDhidRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayStopDhidRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("SendRelayStopDhidRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayStopDhidRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_STOP_DHID; @@ -836,11 +830,11 @@ int32_t DistributedInputSourceTransport::SendRelayStopDhidRequest(const std::str std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayStopDhidRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayStopDhidRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("SendRelayStopDhidRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayStopDhidRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -850,10 +844,10 @@ int32_t DistributedInputSourceTransport::SendRelayStartTypeRequest(const std::st { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayStartTypeRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayStartTypeRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("SendRelayStartTypeRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayStartTypeRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_START_TYPE; @@ -862,11 +856,11 @@ int32_t DistributedInputSourceTransport::SendRelayStartTypeRequest(const std::st std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayStartTypeRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayStartTypeRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL; } - DHLOGI("SendRelayStartTypeRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayStartTypeRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -876,10 +870,10 @@ int32_t DistributedInputSourceTransport::SendRelayStopTypeRequest(const std::str { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { - DHLOGE("SendRelayStopTypeRequest error, not find this device:%{public}s.", GetAnonyString(srcId).c_str()); + DHLOGE("SendRelayStopTypeRequest error, not find this device:%s.", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("SendRelayStopTypeRequest sessionId:%{public}d.", sessionId); + DHLOGI("SendRelayStopTypeRequest sessionId:%d.", sessionId); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_STOP_TYPE; @@ -888,11 +882,11 @@ int32_t DistributedInputSourceTransport::SendRelayStopTypeRequest(const std::str std::string smsg = jsonStr.dump(); int32_t ret = SendMessage(sessionId, smsg); if (ret != DH_SUCCESS) { - DHLOGE("SendRelayStopTypeRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s, SendMsg error, " - "ret:%{public}d.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); + DHLOGE("SendRelayStopTypeRequest srcId:%s, sessionId:%d, smsg:%s, SendMsg error, ret:%d.", + GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str(), ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL; } - DHLOGI("SendRelayStopTypeRequest srcId:%{public}s, sessionId:%{public}d, smsg:%{public}s.", + DHLOGI("SendRelayStopTypeRequest srcId:%s, sessionId:%d, smsg:%s.", GetAnonyString(srcId).c_str(), sessionId, SetAnonyId(smsg).c_str()); return DH_SUCCESS; } @@ -1087,8 +1081,8 @@ void DistributedInputSourceTransport::CalculateLatency(int32_t sessionId, const uint64_t curTimeUs = GetCurrentTimeUs(); if (curTimeUs <= sendTime_) { - DHLOGE("Latency time error, currtime is before than send time, curTime: %{public}" PRIu64 " us, " - "sendTime: %{public}" PRIu64 " us", curTimeUs, sendTime_); + DHLOGE("Latency time error, currtime is before than send time, curTime: %llu us, sendTime: %llu us", + curTimeUs, sendTime_); return; } @@ -1097,7 +1091,7 @@ void DistributedInputSourceTransport::CalculateLatency(int32_t sessionId, const recvNum_ += 1; eachLatencyDetails_ += (std::to_string(deltaTime_) + DINPUT_SPLIT_COMMA); if (deltaTime_ >= MSG_LATENCY_ALARM_US) { - DHLOGW("The RTT time between send req and receive rsp is too long: %{public}" PRIu64 " us", deltaTime_); + DHLOGW("The RTT time between send req and receive rsp is too long: %llu us", deltaTime_); } } @@ -1498,7 +1492,7 @@ void DistributedInputSourceTransport::DInputTransbaseSourceListener::HandleSessi void DistributedInputSourceTransport::HandleData(int32_t sessionId, const std::string &message) { if (callback_ == nullptr) { - DHLOGE("OnBytesReceived the callback_ is null, the message:%{public}s abort.", SetAnonyId(message).c_str()); + DHLOGE("OnBytesReceived the callback_ is null, the message:%s abort.", SetAnonyId(message).c_str()); return; } @@ -1514,7 +1508,7 @@ void DistributedInputSourceTransport::HandleData(int32_t sessionId, const std::s uint32_t cmdType = recMsg[DINPUT_SOFTBUS_KEY_CMD_TYPE]; auto iter = memberFuncMap_.find(cmdType); if (iter == memberFuncMap_.end()) { - DHLOGE("OnBytesReceived cmdType %{public}u is undefined.", cmdType); + DHLOGE("OnBytesReceived cmdType %u is undefined.", cmdType); return; } SourceTransportFunc &func = iter->second; diff --git a/services/source/transport/test/sourcetransunittest/BUILD.gn b/services/source/transport/test/sourcetransunittest/BUILD.gn index 1630fa1877ad084aabd84ce6cab23aa1a6f41192..95ee5bd0db486b32f228d9392cafadb04abfc560 100755 --- a/services/source/transport/test/sourcetransunittest/BUILD.gn +++ b/services/source/transport/test/sourcetransunittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -86,7 +86,6 @@ ohos_unittest("distributed_input_sourcetrans_test") { "c_utils:utils", "distributed_hardware_fwk:libdhfwk_sdk", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", ] diff --git a/services/state/BUILD.gn b/services/state/BUILD.gn index 70b6ba7bacfb6c7417e9138436a8d98922b8836a..5d14f9fbb10ed1a897d1f5a86256549f2424ad95 100644 --- a/services/state/BUILD.gn +++ b/services/state/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -62,7 +62,6 @@ ohos_shared_library("libdinput_sink_state") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/state/src/dinput_sink_state.cpp b/services/state/src/dinput_sink_state.cpp index 747d9f26d5aafeb6807fc0b7289c92ae7a8c25cb..b564d8f5d2bc584ffe727fe8221e05a447da0f69 100644 --- a/services/state/src/dinput_sink_state.cpp +++ b/services/state/src/dinput_sink_state.cpp @@ -57,10 +57,10 @@ int32_t DInputSinkState::Release() int32_t DInputSinkState::RecordDhIds(const std::vector &dhIds, DhIdState state, const int32_t sessionId) { - DHLOGI("RecordDhIds dhIds size = %{public}zu", dhIds.size()); + DHLOGI("RecordDhIds dhIds size = %zu", dhIds.size()); std::lock_guard mapLock(operationMutex_); for (const auto &dhid : dhIds) { - DHLOGD("add dhid : %{public}s, state : %{public}d.", GetAnonyString(dhid).c_str(), state); + DHLOGD("add dhid : %s, state : %d.", GetAnonyString(dhid).c_str(), state); dhIdStateMap_[dhid] = state; } @@ -73,10 +73,10 @@ int32_t DInputSinkState::RecordDhIds(const std::vector &dhIds, DhId int32_t DInputSinkState::RemoveDhIds(const std::vector &dhIds) { - DHLOGI("RemoveDhIds dhIds size = %{public}zu", dhIds.size()); + DHLOGI("RemoveDhIds dhIds size = %zu", dhIds.size()); std::lock_guard mapLock(operationMutex_); for (const auto &dhid : dhIds) { - DHLOGD("delete dhid : %{public}s", GetAnonyString(dhid).c_str()); + DHLOGD("delete dhid : %s", GetAnonyString(dhid).c_str()); dhIdStateMap_.erase(dhid); } return DH_SUCCESS; @@ -91,7 +91,7 @@ DhIdState DInputSinkState::GetStateByDhid(const std::string &dhId) { std::lock_guard mapLock(operationMutex_); if (dhIdStateMap_.find(dhId) == dhIdStateMap_.end()) { - DHLOGE("dhId : %{public}s not exist.", GetAnonyString(dhId).c_str()); + DHLOGE("dhId : %s not exist.", GetAnonyString(dhId).c_str()); return DhIdState::THROUGH_IN; } return dhIdStateMap_[dhId]; @@ -99,7 +99,7 @@ DhIdState DInputSinkState::GetStateByDhid(const std::string &dhId) void DInputSinkState::SimulateMouseBtnMouseUpState(const std::string &dhId, const struct RawEvent &event) { - DHLOGI("Sinmulate Mouse BTN_MOUSE UP state to source, dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("Sinmulate Mouse BTN_MOUSE UP state to source, dhId: %s", GetAnonyString(dhId).c_str()); int32_t scanId = GetRandomInt32(); RawEvent mscScanEv = { event.when, EV_MSC, MSC_SCAN, scanId, dhId, event.path }; RawEvent btnMouseUpEv = { event.when, EV_KEY, BTN_MOUSE, KEY_UP_STATE, dhId, event.path }; @@ -111,13 +111,13 @@ void DInputSinkState::SimulateMouseBtnMouseUpState(const std::string &dhId, cons void DInputSinkState::SimulateTouchPadStateReset(const std::vector &events) { - DHLOGI("SimulateTouchPadStateReset events size: %{public}zu", events.size()); + DHLOGI("SimulateTouchPadStateReset events size: %d", events.size()); DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsgBatch(lastSessionId_, events); } void DInputSinkState::SimulateEventInjectToSrc(const int32_t sessionId, const std::vector &dhIds) { - DHLOGI("SimulateEventInject enter, sessionId %{public}d, dhIds size %{public}zu", sessionId, dhIds.size()); + DHLOGI("SimulateEventInject enter, sessionId %d, dhIds size %d", sessionId, dhIds.size()); // mouse/keyboard/touchpad/touchscreen event send to remote device if these device pass through. if (sessionId == -1) { DHLOGE("SimulateEventInjectToSrc SessionId invalid"); @@ -136,12 +136,12 @@ void DInputSinkState::SimulateKeyDownEvents(const int32_t sessionId, const std:: std::lock_guard mapLock(keyDownStateMapMtx_); auto iter = keyDownStateMap_.find(dhId); if (iter == keyDownStateMap_.end()) { - DHLOGI("The shared Device not has down state key, dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("The shared Device not has down state key, dhId: %s", GetAnonyString(dhId).c_str()); return; } for (const auto &event : iter->second) { - DHLOGI("Simulate Key event for device path: %{public}s, dhId: %{public}s", + DHLOGI("Simulate Key event for device path: %s, dhId: %s", event.path.c_str(), GetAnonyString(event.descriptor).c_str()); SimulateKeyDownEvent(sessionId, dhId, event); } @@ -165,8 +165,7 @@ void DInputSinkState::SimulateTouchPadEvents(const int32_t sessionId, const std: return; } - DHLOGI("SimulateTouchPadEvents dhId: %{public}s, event size: %{public}zu", GetAnonyString(dhId).c_str(), - events.size()); + DHLOGI("SimulateTouchPadEvents dhId: %s, event size: %zu", GetAnonyString(dhId).c_str(), events.size()); DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsgBatch(sessionId, events); } @@ -208,8 +207,8 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event) std::lock_guard mapLock(keyDownStateMapMtx_); auto iter = keyDownStateMap_.find(event.descriptor); if (iter == keyDownStateMap_.end()) { - DHLOGI("Find new pressed key, save it, node id: %{public}s, type: %{public}d, key code: %{public}d, " - "value: %{public}d", GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); + DHLOGI("Find new pressed key, save it, node id: %s, type: %d, key code: %d, value: %d", + GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); keyDownStateMap_[event.descriptor].push_back(event); return; } @@ -218,16 +217,16 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event) keyDownStateMap_[event.descriptor].end(), event); // If not find the cache key on pressing, save it if (evIter == keyDownStateMap_[event.descriptor].end()) { - DHLOGI("Find new pressed key, save it, node id: %{public}s, type: %{public}d, key code: %{public}d, " - "value: %{public}d", GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); + DHLOGI("Find new pressed key, save it, node id: %s, type: %d, key code: %d, value: %d", + GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); keyDownStateMap_[event.descriptor].push_back(event); return; } // it is already the last one, just return if (evIter == (keyDownStateMap_[event.descriptor].end() - 1)) { - DHLOGI("Pressed key already last one, node id: %{public}s, type: %{public}d, key code: %{public}d, " - "value: %{public}d", GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); + DHLOGI("Pressed key already last one, node id: %s, type: %d, key code: %d, value: %d", + GetAnonyString(event.descriptor).c_str(), event.type, event.code, event.value); return; } @@ -235,8 +234,7 @@ void DInputSinkState::CheckAndSetLongPressedKeyOrder(struct RawEvent event) RawEvent backEv = *evIter; keyDownStateMap_[event.descriptor].erase(evIter); keyDownStateMap_[event.descriptor].push_back(backEv); - DHLOGI("Find long pressed key: %{public}d, move the cached pressed key: %{public}d to the last position", - event.code, backEv.code); + DHLOGI("Find long pressed key: %d, move the cached pressed key: %d to the last position", event.code, backEv.code); } void DInputSinkState::ClearDeviceStates() diff --git a/services/state/src/touchpad_event_fragment_mgr.cpp b/services/state/src/touchpad_event_fragment_mgr.cpp index de4427176fcce3ed2dcd2c229859a58801d94def..a48de4c7fa9c6c1e84c0ec47eddea3fc32128d22 100644 --- a/services/state/src/touchpad_event_fragment_mgr.cpp +++ b/services/state/src/touchpad_event_fragment_mgr.cpp @@ -74,7 +74,7 @@ std::pair> TouchPadEventFragmentMgr::DealSynEvent(co allEvents.insert(allEvents.end(), fragEvents.begin(), fragEvents.end()); } needSim = true; - DHLOGI("Find NOT Whole touchpad events need send back, dhId: %{public}s", GetAnonyString(dhId).c_str()); + DHLOGI("Find NOT Whole touchpad events need send back, dhId: %s", GetAnonyString(dhId).c_str()); } fragments_[dhId].clear(); fragments_[dhId].push_back({}); diff --git a/services/state/test/dinpusinkstatetest/BUILD.gn b/services/state/test/dinpusinkstatetest/BUILD.gn index 77bde9073128bccdd7d0f74b3535654918bd94b6..325142293aa969663f70143409fd530de8827438 100644 --- a/services/state/test/dinpusinkstatetest/BUILD.gn +++ b/services/state/test/dinpusinkstatetest/BUILD.gn @@ -52,10 +52,7 @@ ohos_unittest("dinput_sink_state_test") { "//third_party/libevdev:libevdev", ] - external_deps = [ - "c_utils:utils", - "hilog:libhilog", - ] + external_deps = [ "c_utils:utils" ] cflags_cc = [ "-DHILOG_ENABLE" ] } diff --git a/services/transportbase/BUILD.gn b/services/transportbase/BUILD.gn index 3ae870ad5baec6d092ee3882d96567b72cd6c96d..cf5fa169cba7256b8a9447e44b0d501634749c48 100644 --- a/services/transportbase/BUILD.gn +++ b/services/transportbase/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -61,7 +61,6 @@ ohos_shared_library("libdinput_trans_base") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/transportbase/src/distributed_input_transport_base.cpp b/services/transportbase/src/distributed_input_transport_base.cpp index b9296cc52f4cd9e97d305153038864f5998b747b..24caffcd44d49766a8419abca60d8670a1505a58 100644 --- a/services/transportbase/src/distributed_input_transport_base.cpp +++ b/services/transportbase/src/distributed_input_transport_base.cpp @@ -74,7 +74,7 @@ void OnMessage(int32_t socket, const void *data, uint32_t dataLen) (void)socket; (void)data; (void)dataLen; - DHLOGI("socket: %{public}d, dataLen:%{public}d", socket, dataLen); + DHLOGI("socket: %d, dataLen:%d", socket, dataLen); } void OnStream(int32_t socket, const StreamData *data, const StreamData *ext, @@ -84,20 +84,20 @@ void OnStream(int32_t socket, const StreamData *data, const StreamData *ext, (void)data; (void)ext; (void)param; - DHLOGI("socket: %{public}d", socket); + DHLOGI("socket: %d", socket); } void OnFile(int32_t socket, FileEvent *event) { (void)event; - DHLOGI("socket: %{public}d", socket); + DHLOGI("socket: %d", socket); } void OnQos(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount) { - DHLOGI("OnQos, socket: %{public}d, QoSEvent: %{public}d, qosCount: %{public}u", socket, (int32_t)eventId, qosCount); + DHLOGI("OnQos, socket: %d, QoSEvent: %d, qosCount: %u", socket, (int32_t)eventId, qosCount); for (uint32_t idx = 0; idx < qosCount; idx++) { - DHLOGI("QosTV: type: %{public}d, value: %{public}d", (int32_t)qos[idx].qos, qos[idx].value); + DHLOGI("QosTV: type: %d, value: %d", (int32_t)qos[idx].qos, qos[idx].value); } } @@ -121,18 +121,18 @@ int32_t DistributedInputTransportBase::Init() } int32_t socket = CreateServerSocket(); if (socket < DH_SUCCESS) { - DHLOGE("CreateServerSocket failed, ret: %{public}d", socket); + DHLOGE("CreateServerSocket failed, ret: %d", socket); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_INIT_FAIL; } int32_t ret = Listen(socket, g_qosInfo, g_QosTV_Param_Index, &iSocketListener); if (ret != DH_SUCCESS) { - DHLOGE("Socket Listen failed, error code %{public}d.", ret); + DHLOGE("Socket Listen failed, error code %d.", ret); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_INIT_FAIL; } isSessSerCreateFlag_.store(true); localServerSocket_ = socket; - DHLOGI("Finish Init DSoftBus Server Socket, socket: %{public}d", socket); + DHLOGI("Finish Init DSoftBus Server Socket, socket: %d", socket); return DH_SUCCESS; } @@ -147,7 +147,7 @@ int32_t DistributedInputTransportBase::CreateServerSocket() } std::string networkId = localNode->networkId; localSessionName_ = SESSION_NAME + networkId.substr(0, INTERCEPT_STRING_LENGTH); - DHLOGI("CreateServerSocket local networkId is %{public}s, local socketName: %{public}s", + DHLOGI("CreateServerSocket local networkId is %s, local socketName: %s", GetAnonyString(networkId).c_str(), localSessionName_.c_str()); SocketInfo info = { .name = const_cast(localSessionName_.c_str()), @@ -155,7 +155,7 @@ int32_t DistributedInputTransportBase::CreateServerSocket() .dataType = DATA_TYPE_BYTES }; int32_t socket = Socket(info); - DHLOGI("CreateServerSocket Finish, socket: %{public}d", socket); + DHLOGI("CreateServerSocket Finish, socket: %d", socket); return socket; } @@ -164,8 +164,7 @@ void DistributedInputTransportBase::Release() std::unique_lock sessionLock(operationMutex_); auto iter = remoteDevSessionMap_.begin(); for (; iter != remoteDevSessionMap_.end(); ++iter) { - DHLOGI("Shutdown client socket: %{public}d to remote dev: %{public}s", iter->second, - GetAnonyString(iter->first).c_str()); + DHLOGI("Shutdown client socket: %d to remote dev: %s", iter->second, GetAnonyString(iter->first).c_str()); Shutdown(iter->second); } @@ -174,7 +173,7 @@ void DistributedInputTransportBase::Release() if (!isSessSerCreateFlag_.load()) { DHLOGI("DSoftBus Server Socket already remove success."); } else { - DHLOGI("Shutdown DSoftBus Server Socket, socket: %{public}d", localServerSocket_.load()); + DHLOGI("Shutdown DSoftBus Server Socket, socket: %d", localServerSocket_.load()); Shutdown(localServerSocket_.load()); localServerSocket_ = -1; isSessSerCreateFlag_.store(false); @@ -190,7 +189,7 @@ int32_t DistributedInputTransportBase::CheckDeviceSessionState(const std::string if (remoteDevSessionMap_.find(remoteDevId) == remoteDevSessionMap_.end()) { return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_DEVICE_SESSION_STATE; } - DHLOGI("CheckDeviceSessionState has opened, remoteDevId: %{public}s", GetAnonyString(remoteDevId).c_str()); + DHLOGI("CheckDeviceSessionState has opened, remoteDevId: %s", GetAnonyString(remoteDevId).c_str()); return DH_SUCCESS; } @@ -207,7 +206,7 @@ std::string DistributedInputTransportBase::GetDevIdBySessionId(int32_t sessionId int32_t DistributedInputTransportBase::CreateClientSocket(const std::string &remoteDevId) { - DHLOGI("CreateClientSocket start, peerNetworkId: %{public}s", GetAnonyString(remoteDevId).c_str()); + DHLOGI("CreateClientSocket start, peerNetworkId: %s", GetAnonyString(remoteDevId).c_str()); std::string localSesionName = localSessionName_ + "_" + std::to_string(GetCurrentTimeUs()); std::string peerSessionName = SESSION_NAME + remoteDevId.substr(0, INTERCEPT_STRING_LENGTH); SocketInfo info = { @@ -218,7 +217,7 @@ int32_t DistributedInputTransportBase::CreateClientSocket(const std::string &rem .dataType = DATA_TYPE_BYTES }; int32_t socket = Socket(info); - DHLOGI("Bind Socket server, socket: %{public}d, localSessionName: %{public}s, peerSessionName: %{public}s", + DHLOGI("Bind Socket server, socket: %d, localSessionName: %s, peerSessionName: %s", socket, localSesionName.c_str(), peerSessionName.c_str()); return socket; } @@ -227,20 +226,19 @@ int32_t DistributedInputTransportBase::StartSession(const std::string &remoteDev { int32_t ret = CheckDeviceSessionState(remoteDevId); if (ret == DH_SUCCESS) { - DHLOGE("Softbus session has already opened, deviceId: %{public}s", GetAnonyString(remoteDevId).c_str()); + DHLOGE("Softbus session has already opened, deviceId: %s", GetAnonyString(remoteDevId).c_str()); return DH_SUCCESS; } int socket = CreateClientSocket(remoteDevId); if (socket < DH_SUCCESS) { - DHLOGE("StartSession failed, ret: %{public}d", socket); + DHLOGE("StartSession failed, ret: %d", socket); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_OPEN_SESSION_FAIL; } StartAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK); ret = Bind(socket, g_qosInfo, g_QosTV_Param_Index, &iSocketListener); if (ret < DH_SUCCESS) { - DHLOGE("OpenSession fail, remoteDevId: %{public}s, socket: %{public}d", GetAnonyString(remoteDevId).c_str(), - socket); + DHLOGE("OpenSession fail, remoteDevId: %s, socket: %d", GetAnonyString(remoteDevId).c_str(), socket); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK); Shutdown(socket); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_OPEN_SESSION_FAIL; @@ -249,8 +247,7 @@ int32_t DistributedInputTransportBase::StartSession(const std::string &remoteDev std::string peerSessionName = SESSION_NAME + remoteDevId.substr(0, INTERCEPT_STRING_LENGTH); HiDumper::GetInstance().CreateSessionInfo(remoteDevId, socket, localSessionName_, peerSessionName, SessionStatus::OPENED); - DHLOGI("OpenSession success, remoteDevId:%{public}s, sessionId: %{public}d", GetAnonyString(remoteDevId).c_str(), - socket); + DHLOGI("OpenSession success, remoteDevId:%s, sessionId: %d", GetAnonyString(remoteDevId).c_str(), socket); sessionId_ = socket; std::shared_ptr dhFwkKit = DInputContext::GetInstance().GetDHFwkKit(); @@ -295,12 +292,12 @@ void DistributedInputTransportBase::StopSession(const std::string &remoteDevId) { std::unique_lock sessionLock(operationMutex_); if (remoteDevSessionMap_.count(remoteDevId) == 0) { - DHLOGE("remoteDevSessionMap not find remoteDevId: %{public}s", GetAnonyString(remoteDevId).c_str()); + DHLOGE("remoteDevSessionMap not find remoteDevId: %s", GetAnonyString(remoteDevId).c_str()); return; } int32_t sessionId = remoteDevSessionMap_[remoteDevId]; - DHLOGI("RemoteDevId: %{public}s, sessionId: %{public}d", GetAnonyString(remoteDevId).c_str(), sessionId); + DHLOGI("RemoteDevId: %s, sessionId: %d", GetAnonyString(remoteDevId).c_str(), sessionId); HiDumper::GetInstance().SetSessionStatus(remoteDevId, SessionStatus::CLOSING); Shutdown(sessionId); remoteDevSessionMap_.erase(remoteDevId); @@ -381,8 +378,8 @@ int32_t DistributedInputTransportBase::OnSessionOpened(int32_t sessionId, const { std::string peerDevId; peerDevId.assign(info.networkId); - DHLOGI("OnSessionOpened, socket: %{public}d, peerSocketName: %{public}s, peerNetworkId: %{public}s, " - "peerPkgName: %{public}s", sessionId, info.name, GetAnonyString(peerDevId).c_str(), info.pkgName); + DHLOGI("OnSessionOpened, socket: %d, peerSocketName: %s, peerNetworkId: %s, peerPkgName: %s", + sessionId, info.name, GetAnonyString(peerDevId).c_str(), info.pkgName); FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_OPEN_SESSION_START, DINPUT_OPEN_SESSION_TASK); { @@ -402,9 +399,9 @@ int32_t DistributedInputTransportBase::OnSessionOpened(int32_t sessionId, const void DistributedInputTransportBase::OnSessionClosed(int32_t sessionId, ShutdownReason reason) { - DHLOGI("OnSessionClosed, socket: %{public}d, reason: %{public}d", sessionId, (int32_t)reason); + DHLOGI("OnSessionClosed, socket: %d, reason: %d", sessionId, (int32_t)reason); std::string deviceId = GetDevIdBySessionId(sessionId); - DHLOGI("OnSessionClosed notify session closed, sessionId: %{public}d, peer deviceId:%{public}s", + DHLOGI("OnSessionClosed notify session closed, sessionId: %d, peer deviceId:%s", sessionId, GetAnonyString(deviceId).c_str()); RunSessionStateCallback(deviceId, SESSION_STATUS_CLOSED); @@ -525,7 +522,7 @@ void DistributedInputTransportBase::HandleSession(int32_t sessionId, const std:: int32_t DistributedInputTransportBase::SendMsg(int32_t sessionId, std::string &message) { if (message.size() > MSG_MAX_SIZE) { - DHLOGE("SendMessage error: message.size() > MSG_MAX_SIZE, msg size: %{public}zu", message.size()); + DHLOGE("SendMessage error: message.size() > MSG_MAX_SIZE, msg size: %d", message.size()); return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_SENDMESSSAGE; } uint8_t *buf = reinterpret_cast(calloc((MSG_MAX_SIZE), sizeof(uint8_t))); @@ -551,7 +548,7 @@ int32_t DistributedInputTransportBase::GetSessionIdByDevId(const std::string &sr if (it != remoteDevSessionMap_.end()) { return it->second; } - DHLOGE("get session id failed, srcId = %{public}s", GetAnonyString(srcId).c_str()); + DHLOGE("get session id failed, srcId = %s", GetAnonyString(srcId).c_str()); return ERR_DH_INPUT_SERVER_SINK_TRANSPORT_GET_SESSIONID_FAIL; } } // namespace DistributedInput diff --git a/services/transportbase/test/transbaseunittest/BUILD.gn b/services/transportbase/test/transbaseunittest/BUILD.gn index 2552d84eec0ee199fa52edc5582deb13e51bd386..98685993c88271a3828a00e3902ee92d55df43f5 100644 --- a/services/transportbase/test/transbaseunittest/BUILD.gn +++ b/services/transportbase/test/transbaseunittest/BUILD.gn @@ -85,7 +85,6 @@ ohos_unittest("distributed_input_transbase_test") { "distributed_hardware_fwk:libdhfwk_sdk", "eventhandler:libeventhandler", "hicollie:libhicollie", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", ] diff --git a/sinkhandler/BUILD.gn b/sinkhandler/BUILD.gn index c0d3649ec81ea319ba650143a0dbafdb7c721688..66ce305bfb6f5690785f1fe1b58570cd426c740e 100644 --- a/sinkhandler/BUILD.gn +++ b/sinkhandler/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -63,7 +63,6 @@ ohos_shared_library("libdinput_sink_handler") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/sinkhandler/src/distributed_input_sink_handler.cpp b/sinkhandler/src/distributed_input_sink_handler.cpp index 066a8bb761eb421e3c80b7c94b9712975ade0d04..95541e37ef50290ced0cb0f1d179851f8dbf7e6d 100644 --- a/sinkhandler/src/distributed_input_sink_handler.cpp +++ b/sinkhandler/src/distributed_input_sink_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -54,7 +54,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string ¶ms) "dinput sink LoadSystemAbility call"); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, loadCallback); if (ret != ERR_OK) { - DHLOGE("Failed to Load systemAbility, systemAbilityId:%{public}d, ret code:%{public}d", + DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d", DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, ret); return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL; } @@ -109,13 +109,13 @@ void DistributedInputSinkHandler::SALoadSinkCb::OnLoadSystemAbilitySuccess(int32 { currSystemAbilityId = systemAbilityId; currRemoteObject = remoteObject; - DHLOGI("DistributedInputSinkHandler OnLoadSystemAbilitySuccess. systemAbilityId=%{public}d", systemAbilityId); + DHLOGI("DistributedInputSinkHandler OnLoadSystemAbilitySuccess. systemAbilityId=%d", systemAbilityId); } void DistributedInputSinkHandler::SALoadSinkCb::OnLoadSystemAbilityFail(int32_t systemAbilityId) { currSystemAbilityId = systemAbilityId; - DHLOGE("DistributedInputSinkHandler OnLoadSystemAbilityFail. systemAbilityId=%{public}d", systemAbilityId); + DHLOGE("DistributedInputSinkHandler OnLoadSystemAbilityFail. systemAbilityId=%d", systemAbilityId); } void DistributedInputSinkHandler::DInputSinkSvrRecipient::OnRemoteDied(const wptr &remote) diff --git a/sinkhandler/src/load_d_input_sink_callback.cpp b/sinkhandler/src/load_d_input_sink_callback.cpp index 326dc40aa35d2a1223439fa818bb7b2f2967fb42..dd61e7d2536545d6ca673eb4924b5f0fb6a5fb67 100644 --- a/sinkhandler/src/load_d_input_sink_callback.cpp +++ b/sinkhandler/src/load_d_input_sink_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * 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 @@ -27,7 +27,7 @@ namespace DistributedInput { void LoadDInputSinkCallback::OnLoadSystemAbilitySuccess( int32_t systemAbilityId, const sptr &remoteObject) { - DHLOGI("load dinput SA success, systemAbilityId:%{public}d, remoteObject result:%{public}s", + DHLOGI("load dinput SA success, systemAbilityId:%d, remoteObject result:%s", systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); if (remoteObject == nullptr) { DHLOGE("remoteObject is nullptr"); @@ -40,7 +40,7 @@ void LoadDInputSinkCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_INIT_FAIL, "dinput sink LoadSystemAbility call failed."); - DHLOGE("load dinput SA failed, systemAbilityId:%{public}d", systemAbilityId); + DHLOGE("load dinput SA failed, systemAbilityId:%d", systemAbilityId); } } // namespace DistributedInput } // namespace DistributedHardware diff --git a/sinkhandler/test/unittest/BUILD.gn b/sinkhandler/test/unittest/BUILD.gn index 29835a8940c56c959d3412fe3b6cc5e0f6faf77a..1c566b68c7af39ebd85a55a757ae695affa9e1b8 100755 --- a/sinkhandler/test/unittest/BUILD.gn +++ b/sinkhandler/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -77,7 +77,6 @@ ohos_unittest("distributed_input_sink_handler_test") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_core", "samgr:samgr_proxy", diff --git a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp index df24e9e67a4115df6254267683111f786c6f365f..6c453fdbeea3d8cbf5a77da2f12503744858ff15 100644 --- a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -68,7 +68,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%{public}zu.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } diff --git a/sourcehandler/BUILD.gn b/sourcehandler/BUILD.gn index 297d63dce4e37b17086b97236d166b8b9e5a7273..d1c85cdfb248ffa5c05d659cd5ac18ac0bf25fc3 100644 --- a/sourcehandler/BUILD.gn +++ b/sourcehandler/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -66,7 +66,6 @@ ohos_shared_library("libdinput_source_handler") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/sourcehandler/src/distributed_input_source_handler.cpp b/sourcehandler/src/distributed_input_source_handler.cpp index 40080043e3bce5c69407a7d8414cc01484abd76b..dc93bae3fdfc1969e1e558d8e42c0ed3db992fa2 100644 --- a/sourcehandler/src/distributed_input_source_handler.cpp +++ b/sourcehandler/src/distributed_input_source_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -53,7 +53,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms) "dinput init source sa start."); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, loadCallback); if (ret != ERR_OK) { - DHLOGE("Failed to Load systemAbility, systemAbilityId:%{public}d, ret code:%{public}d", + DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d", DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, ret); return ERR_DH_INPUT_SINK_HANDLER_INIT_SOURCE_SA_FAIL; } @@ -116,13 +116,13 @@ void DistributedInputSourceHandler::SALoadSourceCb::OnLoadSystemAbilitySuccess(i { currSystemAbilityId = systemAbilityId; currRemoteObject = remoteObject; - DHLOGI("DistributedInputSourceHandler OnLoadSystemAbilitySuccess. systemAbilityId=%{public}d", systemAbilityId); + DHLOGI("DistributedInputSourceHandler OnLoadSystemAbilitySuccess. systemAbilityId=%d", systemAbilityId); } void DistributedInputSourceHandler::SALoadSourceCb::OnLoadSystemAbilityFail(int32_t systemAbilityId) { currSystemAbilityId = systemAbilityId; - DHLOGE("DistributedInputSourceHandler OnLoadSystemAbilityFail. systemAbilityId=%{public}d", systemAbilityId); + DHLOGE("DistributedInputSourceHandler OnLoadSystemAbilityFail. systemAbilityId=%d", systemAbilityId); } void DistributedInputSourceHandler::DInputSourceSvrRecipient::OnRemoteDied(const wptr &remote) diff --git a/sourcehandler/src/load_d_input_source_callback.cpp b/sourcehandler/src/load_d_input_source_callback.cpp index b08bfa4a922719d67f79ae9f00375a77e5415bbd..1cb5df4052de2d08d022a8d65cf5e53247c4ad03 100644 --- a/sourcehandler/src/load_d_input_source_callback.cpp +++ b/sourcehandler/src/load_d_input_source_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * 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 @@ -27,7 +27,7 @@ LoadDInputSourceCallback::LoadDInputSourceCallback(const std::string ¶ms) : void LoadDInputSourceCallback::OnLoadSystemAbilitySuccess( int32_t systemAbilityId, const sptr &remoteObject) { - DHLOGI("load dinput SA success, systemAbilityId:%{public}d, remoteObject result:%{public}s", + DHLOGI("load dinput SA success, systemAbilityId:%d, remoteObject result:%s", systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); if (remoteObject == nullptr) { DHLOGE("remoteObject is nullptr"); @@ -38,7 +38,7 @@ void LoadDInputSourceCallback::OnLoadSystemAbilitySuccess( void LoadDInputSourceCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { - DHLOGE("load dinput SA failed, systemAbilityId:%{public}d", systemAbilityId); + DHLOGE("load dinput SA failed, systemAbilityId:%d", systemAbilityId); HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_INIT_FAIL, "dinput source LoadSystemAbility call failed."); } diff --git a/sourcehandler/test/unittest/BUILD.gn b/sourcehandler/test/unittest/BUILD.gn index 74cd486529af30c9948febd221766b8c079de79b..5bc8a1e3c4566f932b756f8e106eba092dc6d359 100755 --- a/sourcehandler/test/unittest/BUILD.gn +++ b/sourcehandler/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -79,7 +79,6 @@ ohos_unittest("distributed_input_source_handler_test") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_core", "samgr:samgr_proxy", diff --git a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp index ecf6c162a51ce8fa15f2f629efaf3c1986dffeee..544fd11d0bcc22265f99ec903271dbf291bab61c 100644 --- a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -69,7 +69,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de return; } size_t jsonSize = inputData.size(); - DHLOGI("AddWhiteListInfosCb OnResult json size:%{public}zu.\n", jsonSize); + DHLOGI("AddWhiteListInfosCb OnResult json size:%zu.\n", jsonSize); TYPE_WHITE_LIST_VEC vecWhiteList = inputData; WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } diff --git a/test/fuzztest/dinputconfigdh_fuzzer/BUILD.gn b/test/fuzztest/dinputconfigdh_fuzzer/BUILD.gn index 420f26b7aae21bdf009bd04cd846664b410eea5e..4cd6034c06a837fa0dfe66c370bced1485065a8e 100644 --- a/test/fuzztest/dinputconfigdh_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputconfigdh_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DinputConfigDhFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/dinputinitsink_fuzzer/BUILD.gn b/test/fuzztest/dinputinitsink_fuzzer/BUILD.gn index 646504bb6f71c89670e9338edfe2b11a91b83f26..6e0bb9105fbc461c543ca2cd1312a75e2bc87882 100644 --- a/test/fuzztest/dinputinitsink_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputinitsink_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -61,7 +61,6 @@ ohos_fuzztest("DinputInitSinkFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/dinputinitsource_fuzzer/BUILD.gn b/test/fuzztest/dinputinitsource_fuzzer/BUILD.gn index 91480f69405f145a4480cf891deb712297980342..a04e4bb907f2680af2f81f19c7a7ac08176a71e1 100644 --- a/test/fuzztest/dinputinitsource_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputinitsource_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DinputInitSourceFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/dinputonsessionclosed_fuzzer/BUILD.gn b/test/fuzztest/dinputonsessionclosed_fuzzer/BUILD.gn index d4d0b60f22e75b8107ad981aba77a49e03519081..29f3fd5e930c5d4c1abfbb8a1c2abe35bd357e30 100644 --- a/test/fuzztest/dinputonsessionclosed_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputonsessionclosed_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DinputOnSessionClosedFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/test/fuzztest/dinputonsessionopend_fuzzer/BUILD.gn b/test/fuzztest/dinputonsessionopend_fuzzer/BUILD.gn index 05431bc970050eedb2db36ff6aab5025e90f8903..ff6e76f8cd2a8dc0c6c8ca86db6f9d2d922a651d 100644 --- a/test/fuzztest/dinputonsessionopend_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputonsessionopend_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DinputOnSessionOpendFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/test/fuzztest/dinputreleasesink_fuzzer/BUILD.gn b/test/fuzztest/dinputreleasesink_fuzzer/BUILD.gn index 946bddf0fd36cd345c90f667451a12fa42705b25..cbad99328292ec77a7b82196cc1aba06ee952193 100644 --- a/test/fuzztest/dinputreleasesink_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputreleasesink_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -61,7 +61,6 @@ ohos_fuzztest("DinputReleaseSinkFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/dinputreleasesource_fuzzer/BUILD.gn b/test/fuzztest/dinputreleasesource_fuzzer/BUILD.gn index 850f303d8051e58226e1a4b44474a087579aa23b..586398ee9705aa93d8497e40e4dab924011c070f 100644 --- a/test/fuzztest/dinputreleasesource_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputreleasesource_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DinputReleaseSourceFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/dinputsubscribelocaldh_fuzzer/BUILD.gn b/test/fuzztest/dinputsubscribelocaldh_fuzzer/BUILD.gn index 1c323471009191c57a7fc5113d1a945a5586d637..d21303cf8d9e3c1a7bdb06873ee434c09b48c8d6 100644 --- a/test/fuzztest/dinputsubscribelocaldh_fuzzer/BUILD.gn +++ b/test/fuzztest/dinputsubscribelocaldh_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -61,7 +61,6 @@ ohos_fuzztest("DinputSubscribeLocalDhFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/distributedinputclient_fuzzer/BUILD.gn b/test/fuzztest/distributedinputclient_fuzzer/BUILD.gn index 27ee6aa965264ea3caf5be8982974afae7cbc22e..f7075ecfdf0ad52c208ae3f22c56981ea67ae4df 100755 --- a/test/fuzztest/distributedinputclient_fuzzer/BUILD.gn +++ b/test/fuzztest/distributedinputclient_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -65,7 +65,6 @@ ohos_fuzztest("DistributedInputClientFuzzTest") { "c_utils:utils", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/distributedinputkit_fuzzer/BUILD.gn b/test/fuzztest/distributedinputkit_fuzzer/BUILD.gn index 0639b38d31656a7909f31420b1c1aed454c031a9..858702804ee9a4291bdf43a5b083801cc9d540f9 100755 --- a/test/fuzztest/distributedinputkit_fuzzer/BUILD.gn +++ b/test/fuzztest/distributedinputkit_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DistributedInputKitFuzzTest") { external_deps = [ "c_utils:utils", "eventhandler:libeventhandler", - "hilog:libhilog", "ipc:ipc_core", ] diff --git a/test/fuzztest/distributedinputsinktransport_fuzzer/BUILD.gn b/test/fuzztest/distributedinputsinktransport_fuzzer/BUILD.gn index ae52e14d423170b003f16013c4a73186edc10462..4aaf7f94672a7098bdb03921845470ed1e1be384 100755 --- a/test/fuzztest/distributedinputsinktransport_fuzzer/BUILD.gn +++ b/test/fuzztest/distributedinputsinktransport_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -63,7 +63,6 @@ ohos_fuzztest("DistributedInputSinkTransportFuzzTest") { "dsoftbus:softbus_client", "eventhandler:libeventhandler", "hicollie:libhicollie", - "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", ] diff --git a/test/fuzztest/distributedinputsourcetransport_fuzzer/BUILD.gn b/test/fuzztest/distributedinputsourcetransport_fuzzer/BUILD.gn index c1e3b941aadf9c6983275fa7b57bae83a8edcc21..36490e15b25134589848cc349d593a53172bae90 100755 --- a/test/fuzztest/distributedinputsourcetransport_fuzzer/BUILD.gn +++ b/test/fuzztest/distributedinputsourcetransport_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -67,7 +67,6 @@ ohos_fuzztest("DistributedInputSourceTransportFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/test/fuzztest/distributedinputtransportbase_fuzzer/BUILD.gn b/test/fuzztest/distributedinputtransportbase_fuzzer/BUILD.gn index 3afc87b4a172875ab5736c1a7ea6852ea8205c4e..4ae5eb60987fd665e8c474c1ab6345ae68c7e723 100644 --- a/test/fuzztest/distributedinputtransportbase_fuzzer/BUILD.gn +++ b/test/fuzztest/distributedinputtransportbase_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -66,7 +66,6 @@ ohos_fuzztest("DistributedInputTransportBaseFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", - "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/utils/BUILD.gn b/utils/BUILD.gn index d293f85bf98c6b728322dd64b9355f8c4245ba7d..ce1a1a82777a2ccd6bd71345610b003b8229de00 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -42,6 +42,7 @@ ohos_shared_library("libdinput_utils") { sources = [ "src/dinput_context.cpp", + "src/dinput_log.cpp", "src/dinput_utils_tool.cpp", ] diff --git a/utils/include/dinput_log.h b/utils/include/dinput_log.h index 0be7e53cd15dc9217e05d206a6969a75ae56bbce..3e1e431bcaf157b379c2bde2e0e8a86d42006df3 100644 --- a/utils/include/dinput_log.h +++ b/utils/include/dinput_log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * 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 @@ -16,26 +16,29 @@ #ifndef OHOS_DINPUT_LOG_H #define OHOS_DINPUT_LOG_H -#include "hilog/log.h" -#include - namespace OHOS { namespace DistributedHardware { namespace DistributedInput { -#undef LOG_TAG -#define LOG_TAG "DINPUT" +typedef enum { + DH_LOG_DEBUG, + DH_LOG_INFO, + DH_LOG_WARN, + DH_LOG_ERROR, +} DHLogLevel; + +void DHLog(DHLogLevel logLevel, const char *fmt, ...); -#define DHLOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, \ - "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) +#define DHLOGD(fmt, ...) DHLog(DH_LOG_DEBUG, \ + (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) -#define DHLOGI(fmt, ...) HILOG_INFO(LOG_CORE, \ - "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) +#define DHLOGI(fmt, ...) DHLog(DH_LOG_INFO, \ + (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) -#define DHLOGW(fmt, ...) HILOG_WARN(LOG_CORE, \ - "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) +#define DHLOGW(fmt, ...) DHLog(DH_LOG_WARN, \ + (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) -#define DHLOGE(fmt, ...) HILOG_ERROR(LOG_CORE, \ - "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) +#define DHLOGE(fmt, ...) DHLog(DH_LOG_ERROR, \ + (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dinput_context.cpp b/utils/src/dinput_context.cpp index b7226c63ad37c4a03c180bd9a56104c1eea12691..201399fd3cc2d0421a2518360c9b0d887a68289f 100644 --- a/utils/src/dinput_context.cpp +++ b/utils/src/dinput_context.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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,14 +33,13 @@ DInputContext::~DInputContext() std::string DInputContext::GetScreenInfoKey(const std::string &devId, const uint64_t sourceWinId) { - DHLOGI("GetScreenInfoKey screenInfoKey: %{public}s, sourceWinId: %{public}" PRIu64 "", - GetAnonyString(devId).c_str(), sourceWinId); + DHLOGI("GetScreenInfoKey screenInfoKey: %s, sourceWinId: %d", GetAnonyString(devId).c_str(), sourceWinId); return devId + RESOURCE_SEPARATOR + std::to_string(sourceWinId); } int32_t DInputContext::RemoveSinkScreenInfo(const std::string &screenInfoKey) { - DHLOGI("RemoveSinkScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("RemoveSinkScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); std::lock_guard lock(sinkMapMutex_); sinkScreenInfoMap_.erase(screenInfoKey); return DH_SUCCESS; @@ -48,7 +47,7 @@ int32_t DInputContext::RemoveSinkScreenInfo(const std::string &screenInfoKey) int32_t DInputContext::UpdateSinkScreenInfo(const std::string &screenInfoKey, const SinkScreenInfo &sinkScreenInfo) { - DHLOGI("UpdateSinkScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("UpdateSinkScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); std::lock_guard lock(sinkMapMutex_); if (sinkScreenInfoMap_.count(screenInfoKey) <= 0) { DHLOGE("source window id not exist"); @@ -66,7 +65,7 @@ int32_t DInputContext::UpdateSinkScreenInfo(const std::string &screenInfoKey, co SinkScreenInfo DInputContext::GetSinkScreenInfo(const std::string &screenInfoKey) { - DHLOGI("GetSinkScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("GetSinkScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); std::lock_guard lock(sinkMapMutex_); if (sinkScreenInfoMap_.count(screenInfoKey) <= 0) { DHLOGE("screenInfoKey not exist"); @@ -85,7 +84,7 @@ const std::unordered_map &DInputContext::GetAllSink int32_t DInputContext::RemoveSrcScreenInfo(const std::string &screenInfoKey) { - DHLOGI("RemoveSrcScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("RemoveSrcScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); std::lock_guard lock(srcMapMutex_); srcScreenInfoMap_.erase(screenInfoKey); return DH_SUCCESS; @@ -94,7 +93,7 @@ int32_t DInputContext::RemoveSrcScreenInfo(const std::string &screenInfoKey) int32_t DInputContext::UpdateSrcScreenInfo(const std::string &screenInfoKey, const SrcScreenInfo &srcScreenInfo) { std::lock_guard lock(srcMapMutex_); - DHLOGI("UpdateSrcScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("UpdateSrcScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); if (srcScreenInfoMap_.count(screenInfoKey) <= 0) { DHLOGE("source window id not exist"); return ERR_DH_INPUT_CONTEXT_KEY_NOT_EXIST; @@ -106,7 +105,7 @@ int32_t DInputContext::UpdateSrcScreenInfo(const std::string &screenInfoKey, con SrcScreenInfo DInputContext::GetSrcScreenInfo(const std::string &screenInfoKey) { - DHLOGI("GetSrcScreenInfo screenInfoKey: %{public}s", GetAnonyString(screenInfoKey).c_str()); + DHLOGI("GetSrcScreenInfo screenInfoKey: %s", GetAnonyString(screenInfoKey).c_str()); std::lock_guard lock(srcMapMutex_); if (srcScreenInfoMap_.count(screenInfoKey) <= 0) { DHLOGE("source window id not exist"); @@ -155,8 +154,8 @@ int32_t DInputContext::CalculateTransformInfo(SinkScreenInfo &sinkScreenInfo) transformInfo.coeffHeight = static_cast(sinkScreenInfo.srcScreenInfo.sourcePhyHeight / static_cast(transformInfo.sinkProjPhyHeight)); - DHLOGI("CalculateTransformInfo sinkWinPhyX = %{public}d, sinkWinPhyY = %{public}d, sinkProjPhyWidth = %{public}d, " - "sinkProjPhyHeight = %{public}d, coeffWidth = %{public}f, coeffHeight = %{public}f", transformInfo.sinkWinPhyX, + DHLOGI("CalculateTransformInfo sinkWinPhyX = %d, sinkWinPhyY = %d, sinkProjPhyWidth = %d, " + + "sinkProjPhyHeight = %d, coeffWidth = %f, coeffHeight = %f", transformInfo.sinkWinPhyX, transformInfo.sinkWinPhyY, transformInfo.sinkProjPhyWidth, transformInfo.sinkProjPhyHeight, transformInfo.coeffWidth, transformInfo.coeffHeight); sinkScreenInfo.transformInfo = transformInfo; diff --git a/utils/src/dinput_log.cpp b/utils/src/dinput_log.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b9d3ef49f766a8228bd263e6953f19d2ac3cc4a5 --- /dev/null +++ b/utils/src/dinput_log.cpp @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#include "dinput_log.h" + +#include "constants_dinput.h" +#include "securec.h" + +#ifdef HI_LOG_ENABLE +#include "hilog/log.h" +#else +#include +#endif + +namespace OHOS { +namespace DistributedHardware { +namespace DistributedInput { +static void DHLogOut(DHLogLevel logLevel, const char *logBuf) +{ +#ifdef HI_LOG_ENABLE + LogLevel hiLogLevel = LOG_INFO; + switch (logLevel) { + case DH_LOG_DEBUG: + hiLogLevel = LOG_DEBUG; + break; + case DH_LOG_INFO: + hiLogLevel = LOG_INFO; + break; + case DH_LOG_WARN: + hiLogLevel = LOG_WARN; + break; + case DH_LOG_ERROR: + hiLogLevel = LOG_ERROR; + break; + default: + break; + } + (void)HiLogPrint(LOG_CORE, hiLogLevel, LOG_DOMAIN, DINPUT_LOG_TITLE_TAG.c_str(), "%{public}s", logBuf); +#else + switch (logLevel) { + case DH_LOG_DEBUG: + printf("[D]%s\n", logBuf); + break; + case DH_LOG_INFO: + printf("[I]%s\n", logBuf); + break; + case DH_LOG_WARN: + printf("[W]%s\n", logBuf); + break; + case DH_LOG_ERROR: + printf("[E]%s\n", logBuf); + break; + default: + break; + } +#endif +} + +void DHLog(DHLogLevel logLevel, const char *fmt, ...) +{ + char logBuf[LOG_MAX_LEN] = {0}; + va_list arg; + va_start(arg, fmt); + + int32_t ret = vsprintf_s(logBuf, sizeof(logBuf), fmt, arg); + va_end(arg); + if (ret < 0) { + DHLogOut(logLevel, "DH log length error."); + return; + } + DHLogOut(logLevel, logBuf); +} +} // namespace DistributedInput +} // namespace DistributedHardware +} // namespace OHOS diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index ee6a2b5bc2eebd88402f3ccfd82ba918fa5b47e1..f7136a4d57b51a28e500048b77b1424a0d454dd4 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -61,7 +61,7 @@ DevInfo GetLocalDeviceInfo() auto info = std::make_unique(); auto ret = GetLocalNodeDeviceInfo(DINPUT_PKG_NAME.c_str(), info.get()); if (ret != 0) { - DHLOGE("GetLocalNodeDeviceInfo failed, errCode = %{public}d", ret); + DHLOGE("GetLocalNodeDeviceInfo failed, errCode = %d", ret); return devInfo; } @@ -78,7 +78,7 @@ std::string GetLocalNetworkId() if (localNetworkId.empty()) { DHLOGE("local networkId is empty!"); } - DHLOGI("GetLocalNetworkId, device local networkId is %{public}s", GetAnonyString(localNetworkId).c_str()); + DHLOGI("GetLocalNetworkId, device local networkId is %s", GetAnonyString(localNetworkId).c_str()); return localNetworkId; } @@ -299,12 +299,12 @@ int OpenInputDeviceFdByPath(const std::string &devicePath) char canonicalDevicePath[PATH_MAX] = {0x00}; if (devicePath.length() == 0 || devicePath.length() >= PATH_MAX || realpath(devicePath.c_str(), canonicalDevicePath) == nullptr) { - DHLOGE("path check fail, error path: %{public}s", devicePath.c_str()); + DHLOGE("path check fail, error path: %s", devicePath.c_str()); return -1; } struct stat s; if ((stat(canonicalDevicePath, &s) == 0) && (s.st_mode & S_IFDIR)) { - DHLOGI("path: %{public}s is a dir.", devicePath.c_str()); + DHLOGI("path: %s is a dir.", devicePath.c_str()); return -1; } int fd = open(canonicalDevicePath, O_RDWR | O_CLOEXEC); @@ -313,11 +313,10 @@ int OpenInputDeviceFdByPath(const std::string &devicePath) ++count; usleep(SLEEP_TIME_US); fd = open(canonicalDevicePath, O_RDWR | O_CLOEXEC); - DHLOGE("could not open the path: %{public}s, errno: %{public}s; retry: %{public}d", devicePath.c_str(), - ConvertErrNo().c_str(), count); + DHLOGE("could not open the path: %s, errno: %s; retry: %d", devicePath.c_str(), ConvertErrNo().c_str(), count); } if (count >= MAX_RETRY_COUNT) { - DHLOGE("could not open the path: %{public}s, errno: %{public}s.", devicePath.c_str(), ConvertErrNo().c_str()); + DHLOGE("could not open the path: %s, errno: %s.", devicePath.c_str(), ConvertErrNo().c_str()); CloseFd(fd); return -1; } @@ -369,14 +368,14 @@ void RecordEventLog(const input_event &event) eventType = "other type " + std::to_string(event.type); break; } - DHLOGD("5.E2E-Test Source write event into input driver, EventType: %{public}s, Code: %{public}d, " - "Value: %{public}d", eventType.c_str(), event.code, event.value); + DHLOGD("5.E2E-Test Source write event into input driver, EventType: %s, Code: %d, Value: %d", + eventType.c_str(), event.code, event.value); } void WriteEventToDevice(const int fd, const input_event &event) { if (write(fd, &event, sizeof(event)) < static_cast(sizeof(event))) { - DHLOGE("could not inject event, fd: %{public}d", fd); + DHLOGE("could not inject event, fd: %d", fd); return; } RecordEventLog(event); @@ -386,23 +385,23 @@ void ResetVirtualDevicePressedKeys(const std::vector &nodePaths) { unsigned long keyState[NLONGS(KEY_CNT)] = { 0 }; for (const auto &path : nodePaths) { - DHLOGI("Check and reset key state, path: %{public}s", path.c_str()); + DHLOGI("Check and reset key state, path: %s", path.c_str()); std::vector pressedKeys; int fd = OpenInputDeviceFdByPath(path); if (fd == -1) { - DHLOGE("Open virtual keyboard node failed, path: %{public}s", path.c_str()); + DHLOGE("Open virtual keyboard node failed, path: %s", path.c_str()); continue; } int rc = ioctl(fd, EVIOCGKEY(sizeof(keyState)), keyState); if (rc < 0) { - DHLOGE("Read all key state failed, rc: %{public}d, path: %{public}s", rc, path.c_str()); + DHLOGE("Read all key state failed, rc: %d, path: %s", rc, path.c_str()); continue; } for (int32_t keyIndex = 0; keyIndex < KEY_MAX; keyIndex++) { if (BitIsSet(keyState, keyIndex)) { - DHLOGI("key index: %{public}d pressed.", keyIndex); + DHLOGI("key index: %d pressed.", keyIndex); pressedKeys.push_back(keyIndex); } } diff --git a/utils/test/unittest/BUILD.gn b/utils/test/unittest/BUILD.gn index 39cd320677e79b195b777d7ba33918475934a754..6f38c9fd3ea71ac7d3caeded5f376b81f38eb2b2 100644 --- a/utils/test/unittest/BUILD.gn +++ b/utils/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2023 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 @@ -46,6 +46,7 @@ ohos_unittest("distributed_input_utils_test") { "${common_path}/test/mock/socket_mock.cpp", "${common_path}/test/mock/softbus_bus_center_mock.cpp", "${distributedinput_path}/utils/src/dinput_context.cpp", + "${distributedinput_path}/utils/src/dinput_log.cpp", "${distributedinput_path}/utils/src/dinput_utils_tool.cpp", "dinput_context_test.cpp", ]