mirror of
https://github.com/openharmony/distributed_screen.git
synced 2026-07-19 17:04:08 -04:00
@@ -94,5 +94,19 @@ std::string GetAnonyString(const std::string &value)
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string GetInterruptString(const std::string &value)
|
||||
{
|
||||
constexpr size_t INT32_MIN_ID_LENGTH = 3;
|
||||
std::string res;
|
||||
size_t strlen = value.length();
|
||||
if(strlen <= INT32_MIN_ID_LENGTH) {
|
||||
res = value;
|
||||
} else {
|
||||
res = value.substr(0, strlen / 2);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
@@ -41,10 +41,8 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s
|
||||
{
|
||||
DHLOGI("CreateVirtualScreen, width: %u, height: %u", videoParam->GetScreenWidth(),
|
||||
videoParam->GetScreenHeight());
|
||||
int32_t devIdsize = devId.size() / 2;
|
||||
int32_t dhIdsize = dhId.size() / 2;
|
||||
std::string screenName = DSCREEN_PREFIX + SEPERATOR + devId.substr(0, devIdsize) +
|
||||
SEPERATOR + dhId.substr(0, dhIdsize);
|
||||
std::string screenName = DSCREEN_PREFIX + SEPERATOR + GetInterruptString(devId) +
|
||||
SEPERATOR + GetInterruptString(dhId);
|
||||
auto iter = screenIdMap_.find(screenName);
|
||||
if (iter != screenIdMap_.end()) {
|
||||
DHLOGI("remove an exist virtual screen.");
|
||||
|
||||
Reference in New Issue
Block a user