mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-17 23:45:34 -04:00
回退 'Pull Request !176 : fix:hilog改用宏接口'
This commit is contained in:
@@ -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> 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<std::mutex> deviceLock(devicesMutex_);
|
||||
for (auto it = closingDevices_.begin(); it != closingDevices_.end();) {
|
||||
std::unique_ptr<Device> 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> 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<std::mutex> 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<std::mutex> 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> &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> &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)
|
||||
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> &device)
|
||||
|
||||
void InputHub::QueryEventInfo(int fd, std::unique_ptr<Device> &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> &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> &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> &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> &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> 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)
|
||||
|
||||
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> 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<size_t>(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<std::string> d
|
||||
std::lock_guard<std::mutex> 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<std::string> InputHub::GetSharingDevices()
|
||||
std::lock_guard<std::mutex> 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<std::string> InputHub::GetSharingDevices()
|
||||
void InputHub::GetSharedMousePathByDhId(const std::vector<std::string> &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<std::mutex> deviceLock(devicesMutex_);
|
||||
for (const auto &dhId : dhIds) {
|
||||
for (const auto &[id, device] : devices_) {
|
||||
@@ -1237,8 +1234,8 @@ void InputHub::GetSharedMousePathByDhId(const std::vector<std::string> &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<std::string> &dhIds, s
|
||||
void InputHub::GetSharedKeyboardPathsByDhIds(const std::vector<std::string> &dhIds,
|
||||
std::vector<std::string> &sharedKeyboardPaths, std::vector<std::string> &sharedKeyboardDhIds)
|
||||
{
|
||||
DHLOGI("GetSharedKeyboardPathsByDhIds: devices_.size:%{public}zu,", devices_.size());
|
||||
DHLOGI("GetSharedKeyboardPathsByDhIds: devices_.size:%d,", devices_.size());
|
||||
std::lock_guard<std::mutex> deviceLock(devicesMutex_);
|
||||
for (const auto &dhId : dhIds) {
|
||||
for (const auto &[id, device] : devices_) {
|
||||
@@ -1261,8 +1258,8 @@ void InputHub::GetSharedKeyboardPathsByDhIds(const std::vector<std::string> &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<std::mutex> 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::Device*> 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<InputHub::Device*> 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<InputHub::Device*> 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;
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> 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();
|
||||
}
|
||||
|
||||
+2
-1
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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<std::string> &args, std::string &result)
|
||||
result.clear();
|
||||
int32_t argsSize = static_cast<int32_t>(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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<IRemoteObject> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<std::mutex> 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<std::mutex> 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<RegisterCallback> &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<UnregisterCallback> &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<IPrepareDInputCallback> 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<IUnprepareDInputCallback> 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<IStartDInputCallback> 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<IStopDInputCallback> 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<IStartDInputCallback> 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<IStopDInputCallback> 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<IPrepareDInputCallback> 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<IUnprepareDInputCallback> 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<std::string> &dhIds,
|
||||
sptr<IStartStopDInputsCallback> 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<std::string> &dhIds,
|
||||
sptr<IStartStopDInputsCallback> 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<std::string> &dhIds, sptr<IStartStopDInputsCallback> 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<std::string> &dhIds, sptr<IStartStopDInputsCallback> 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<std::mutex> 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(sptr<ISimulation
|
||||
} else {
|
||||
isSimulationEventCbReg = false;
|
||||
regSimulationEventListener_ = listener;
|
||||
DHLOGE("RegisterSimulationEventListener Failed, ret = %{public}d", ret);
|
||||
DHLOGE("RegisterSimulationEventListener Failed, ret = %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -616,7 +611,7 @@ int32_t DistributedInputClient::UnregisterSimulationEventListener(sptr<ISimulati
|
||||
|
||||
int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->UnregisterSimulationEventListener(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<std::vector<uint32_t>> 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<IDistributedSinkInput> 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<IDistributedSinkInput> 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<IDistributedSinkInput> 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;
|
||||
|
||||
@@ -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) ||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<uint32_t>(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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void StartStopDInputsCallbackProxy::OnResultDhids(const std::string &devId, cons
|
||||
int32_t ret = remote->SendRequest(static_cast<uint32_t>(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.");
|
||||
|
||||
@@ -69,7 +69,7 @@ void StartStopResultCallbackProxy::OnStart(
|
||||
int32_t ret = remote->SendRequest(static_cast<uint32_t>(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<uint32_t>(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.");
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<std::string> 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<std::string> 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<uint32_t>(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<std::string> 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<std::string> stopIndeedDhIds;
|
||||
std::vector<std::string> 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<std::string> stopIndeedDhIds;
|
||||
std::vector<std::string> 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<uint32_t>(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<std::string> 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<std::mutex> 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<int32_t>(flag));
|
||||
DHLOGI("Set Sink isStartTrans_ %d", static_cast<int32_t>(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<uint32_t>(topic));
|
||||
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
|
||||
return;
|
||||
}
|
||||
std::string srcDeviceId = "";
|
||||
@@ -829,9 +826,8 @@ int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfo
|
||||
LocalAbsInfo info = DInputContext::GetInstance().GetLocalTouchScreenInfo().localAbsInfo;
|
||||
sinkScreenInfo.sinkPhyWidth = static_cast<uint32_t>(info.absMtPositionXMax + 1);
|
||||
sinkScreenInfo.sinkPhyHeight = static_cast<uint32_t>(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<uint32_t>(topic));
|
||||
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(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<std::mutex> 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<std::u16
|
||||
return ERR_DH_INPUT_HIDUMP_DUMP_PROCESS_FAIL;
|
||||
}
|
||||
|
||||
int32_t ret = dprintf(fd, "%{public}s\n", result.c_str());
|
||||
int32_t ret = dprintf(fd, "%s\n", result.c_str());
|
||||
if (ret < 0) {
|
||||
DHLOGE("dprintf error.");
|
||||
return ERR_DH_INPUT_HIDUMP_DPRINTF_FAIL;
|
||||
|
||||
@@ -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
|
||||
@@ -111,7 +111,6 @@ ohos_unittest("distributed_input_sinkmanager_test") {
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_surface:surface",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
|
||||
@@ -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_shared_library("libdinput_sink_trans") {
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"ipc:ipc_core",
|
||||
"safwk:system_ability_fwk",
|
||||
|
||||
@@ -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
|
||||
@@ -51,7 +51,7 @@ int32_t DistributedInputSinkSwitch::StartSwitch(int32_t sessionId)
|
||||
{
|
||||
std::unique_lock<std::mutex> 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<std::mutex> 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<SwitchStateData>::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<SwitchStateData>::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<std::mutex> 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<SwitchStateData>::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<struct RawEvent> 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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<std::mutex> 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<std::mutex> 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;
|
||||
|
||||
@@ -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<std::string> 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<std::string> 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<std::mutex> 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::vector<DhUn
|
||||
}
|
||||
if ((iter->first == 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<std::mutex> my_lock(operationMutex_);
|
||||
std::unique_ptr<VirtualDevice> 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<VirtualDevice>(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<VirtualDevice> 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<std::mutex> 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<std::mutex> lock(virtualDeviceMapMutex_);
|
||||
DhUniqueID dhUniqueId = {devId, dhId};
|
||||
std::map<DhUniqueID, std::unique_ptr<VirtualDevice>>::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");
|
||||
|
||||
@@ -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<uint32_t>& 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<int32_t> 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<ssize_t>(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()
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<RawEvent> 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<std::mutex> 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<std::mutex> 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<std::stri
|
||||
break;
|
||||
}
|
||||
}
|
||||
DHLOGI("IsSame: %{public}d.", isSame);
|
||||
DHLOGI("IsSame: %d.", isSame);
|
||||
return isSame;
|
||||
}
|
||||
|
||||
@@ -844,8 +840,7 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &sinkI
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
|
||||
}
|
||||
DHLOGI("Dinput start, sinkId: %{public}s, vector.string.size: %{public}zu", GetAnonyString(sinkId).c_str(),
|
||||
dhIds.size());
|
||||
DHLOGI("Dinput start, sinkId: %s, vector.string.size: %d", GetAnonyString(sinkId).c_str(), dhIds.size());
|
||||
std::string localNetworkId = GetLocalNetworkId();
|
||||
if (localNetworkId.empty()) {
|
||||
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
|
||||
@@ -886,8 +881,7 @@ int32_t DistributedInputSourceManager::StopRemoteInput(const std::string &sinkId
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL;
|
||||
}
|
||||
DHLOGI("Dinput stop, sinkId: %{public}s, vector.string.size: %{public}zu", GetAnonyString(sinkId).c_str(),
|
||||
dhIds.size());
|
||||
DHLOGI("Dinput stop, sinkId: %s, vector.string.size: %d", GetAnonyString(sinkId).c_str(), dhIds.size());
|
||||
std::string localNetworkId = GetLocalNetworkId();
|
||||
if (localNetworkId.empty()) {
|
||||
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
|
||||
@@ -926,8 +920,7 @@ int32_t DistributedInputSourceManager::StartRemoteInput(const std::string &srcId
|
||||
FinishAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL;
|
||||
}
|
||||
DHLOGI("Dinput start, srcId: %{public}s, sinkId: %{public}s", GetAnonyString(srcId).c_str(),
|
||||
GetAnonyString(sinkId).c_str());
|
||||
DHLOGI("Dinput start, srcId: %s, sinkId: %s", GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str());
|
||||
std::string localNetworkId = GetLocalNetworkId();
|
||||
if (localNetworkId.empty()) {
|
||||
HisyseventUtil::GetInstance().SysEventWriteFault(DINPUT_OPT_FAIL, sinkId,
|
||||
@@ -970,7 +963,7 @@ 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("Dinput stop, srcId: %{public}s, sinkId: %{public}s, vector.string.size: %{public}zu",
|
||||
DHLOGI("Dinput stop, srcId: %s, sinkId: %s, vector.string.size: %d",
|
||||
GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str(), dhIds.size());
|
||||
std::string localNetworkId = GetLocalNetworkId();
|
||||
if (localNetworkId.empty()) {
|
||||
@@ -1080,7 +1073,7 @@ int32_t DistributedInputSourceManager::RelayPrepareRemoteInput(const std::string
|
||||
|
||||
ret = DistributedInputSourceTransport::GetInstance().SendRelayPrepareRequest(srcId, 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);
|
||||
RemoveRelayPrepareCallbacks(info);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL;
|
||||
}
|
||||
@@ -1095,7 +1088,7 @@ int32_t DistributedInputSourceManager::RelayUnprepareRemoteInput(const std::stri
|
||||
|
||||
int32_t ret = DistributedInputSourceTransport::GetInstance().SendRelayUnprepareRequest(srcId, 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);
|
||||
RemoveRelayUnPrepareCallbacks(info);
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL;
|
||||
}
|
||||
@@ -1305,8 +1298,8 @@ void DistributedInputSourceManager::RunStartDhidCallback(const std::string &sink
|
||||
{
|
||||
std::vector<std::string> 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<std::string> 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<IStartStopDInputsCallback> cb = nullptr;
|
||||
@@ -1462,7 +1455,7 @@ DInputServerType DistributedInputSourceManager::GetStartTransFlag()
|
||||
|
||||
void DistributedInputSourceManager::SetStartTransFlag(const DInputServerType flag)
|
||||
{
|
||||
DHLOGI("Set Source isStartTrans_ %{public}d", static_cast<int32_t>(flag));
|
||||
DHLOGI("Set Source isStartTrans_ %d", static_cast<int32_t>(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<uint32_t>(topic));
|
||||
DHLOGE("this topic is wrong, %d", static_cast<uint32_t>(topic));
|
||||
return;
|
||||
}
|
||||
if (message.size() > SCREEN_MSG_MAX) {
|
||||
@@ -1645,9 +1638,8 @@ int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfo
|
||||
srcScreenInfo.sourcePhyFd = static_cast<uint32_t>(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<uint32_t>(topic));
|
||||
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(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<uint32_t>(topic));
|
||||
DHLOGE("this topic is wrong, %u", static_cast<uint32_t>(topic));
|
||||
return;
|
||||
}
|
||||
if (message.empty()) {
|
||||
@@ -1787,7 +1779,7 @@ int32_t DistributedInputSourceManager::Dump(int32_t fd, const std::vector<std::u
|
||||
return ERR_DH_INPUT_HIDUMP_DUMP_PROCESS_FAIL;
|
||||
}
|
||||
|
||||
int ret = dprintf(fd, "%{public}s\n", result.c_str());
|
||||
int ret = dprintf(fd, "%s\n", result.c_str());
|
||||
if (ret < 0) {
|
||||
DHLOGE("dprintf error.");
|
||||
return ERR_DH_INPUT_HIDUMP_DPRINTF_FAIL;
|
||||
|
||||
@@ -65,7 +65,7 @@ sptr<IDistributedSourceInput> 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<IDistributedSourceInput> 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<IDistributedSourceInput> DInputSourceSACliMgr::GetRemoteCliFromCache(const
|
||||
void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr<IRemoteObject> 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<std::mutex> lock(remoteCliLock);
|
||||
@@ -118,7 +118,7 @@ void DInputSourceSACliMgr::AddRemoteCli(const std::string &devId, sptr<IRemoteOb
|
||||
|
||||
void DInputSourceSACliMgr::DeleteRemoteCli(const std::string &devId)
|
||||
{
|
||||
DHLOGI("DInputSourceSACliMgr::DeleteRemoteCli devId=%{public}s", GetAnonyString(devId).c_str());
|
||||
DHLOGI("DInputSourceSACliMgr::DeleteRemoteCli devId=%s", GetAnonyString(devId).c_str());
|
||||
std::lock_guard<std::mutex> lock(remoteCliLock);
|
||||
auto item = remoteCliMap.find(devId);
|
||||
if (item == remoteCliMap.end()) {
|
||||
@@ -144,7 +144,7 @@ void DInputSourceSACliMgr::DeleteRemoteCli(const sptr<IRemoteObject> 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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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<std::string> 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<std::string> 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;
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -57,10 +57,10 @@ int32_t DInputSinkState::Release()
|
||||
|
||||
int32_t DInputSinkState::RecordDhIds(const std::vector<std::string> &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<std::mutex> 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<std::string> &dhIds, DhId
|
||||
|
||||
int32_t DInputSinkState::RemoveDhIds(const std::vector<std::string> &dhIds)
|
||||
{
|
||||
DHLOGI("RemoveDhIds dhIds size = %{public}zu", dhIds.size());
|
||||
DHLOGI("RemoveDhIds dhIds size = %zu", dhIds.size());
|
||||
std::lock_guard<std::mutex> 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<std::mutex> 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<RawEvent> &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<std::string> &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<std::mutex> 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<std::mutex> 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()
|
||||
|
||||
@@ -74,7 +74,7 @@ std::pair<bool, std::vector<RawEvent>> 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({});
|
||||
|
||||
@@ -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" ]
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<char*>(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<std::mutex> 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<DistributedHardwareFwkKit> dhFwkKit = DInputContext::GetInstance().GetDHFwkKit();
|
||||
@@ -295,12 +292,12 @@ void DistributedInputTransportBase::StopSession(const std::string &remoteDevId)
|
||||
{
|
||||
std::unique_lock<std::mutex> 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<uint8_t *>(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
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<IRemoteObject> &remote)
|
||||
|
||||
@@ -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<IRemoteObject> &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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<IRemoteObject> &remote)
|
||||
|
||||
@@ -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<IRemoteObject> &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.");
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
+2
-1
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
+17
-14
@@ -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 <inttypes.h>
|
||||
|
||||
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;
|
||||
|
||||
#define DHLOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, \
|
||||
"[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__)
|
||||
void DHLog(DHLogLevel logLevel, const char *fmt, ...);
|
||||
|
||||
#define DHLOGI(fmt, ...) HILOG_INFO(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 DHLOGW(fmt, ...) HILOG_WARN(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 DHLOGE(fmt, ...) HILOG_ERROR(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, ...) DHLog(DH_LOG_ERROR, \
|
||||
(std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__)
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -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<std::mutex> 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<std::mutex> 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<std::mutex> lock(sinkMapMutex_);
|
||||
if (sinkScreenInfoMap_.count(screenInfoKey) <= 0) {
|
||||
DHLOGE("screenInfoKey not exist");
|
||||
@@ -85,7 +84,7 @@ const std::unordered_map<std::string, SinkScreenInfo> &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<std::mutex> 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<std::mutex> 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<std::mutex> 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<double>(sinkScreenInfo.srcScreenInfo.sourcePhyHeight /
|
||||
static_cast<double>(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;
|
||||
|
||||
@@ -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 <cstdio>
|
||||
#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
|
||||
@@ -61,7 +61,7 @@ DevInfo GetLocalDeviceInfo()
|
||||
auto info = std::make_unique<NodeBasicInfo>();
|
||||
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<ssize_t>(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<std::string> &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<uint32_t> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user