mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 06:50:40 +00:00
Description:新增MakeMirrorwithRegion
IssueNo:https://gitee.com/openharmony/drivers_hdf_core/issues/IB367G Feature or Bugfix: Feature Binary Source:No Signed-off-by: zhangyao <zhangyao114@huawei.com>
This commit is contained in:
parent
e7582e5ffa
commit
ab400845eb
@ -124,6 +124,8 @@ public:
|
||||
virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId);
|
||||
virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos);
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId, ScreenId& screenGroupId);
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId, DMRect mainScreenRegion,
|
||||
ScreenId& screenGroupId);
|
||||
virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode);
|
||||
virtual DMError SetMultiScreenRelativePosition(MultiScreenPositionOptions mainScreenOptions,
|
||||
|
@ -478,13 +478,21 @@ void BaseAdapter::Clear()
|
||||
}
|
||||
|
||||
DMError ScreenManagerAdapter::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId,
|
||||
ScreenId& screenGroupId)
|
||||
ScreenId& screenGroupId)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
|
||||
|
||||
return displayManagerServiceProxy_->MakeMirror(mainScreenId, mirrorScreenId, screenGroupId);
|
||||
}
|
||||
|
||||
DMError ScreenManagerAdapter::MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
|
||||
|
||||
return displayManagerServiceProxy_->MakeMirror(mainScreenId, mirrorScreenId, mainScreenRegion, screenGroupId);
|
||||
}
|
||||
|
||||
DMError ScreenManagerAdapter::SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode)
|
||||
{
|
||||
@ -873,4 +881,4 @@ std::shared_ptr<Media::PixelMap> DisplayManagerAdapter::GetDisplaySnapshotWithOp
|
||||
INIT_PROXY_CHECK_RETURN(nullptr);
|
||||
return displayManagerServiceProxy_->GetDisplaySnapshotWithOption(captureOption, errorCode);
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -486,7 +486,20 @@ DMError ScreenManager::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> m
|
||||
return DMError::DM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().MakeMirror(mainScreenId, mirrorScreenId,
|
||||
screenGroupId);
|
||||
screenGroupId);
|
||||
if (screenGroupId == SCREEN_ID_INVALID) {
|
||||
WLOGFE("create mirror failed");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DMError ScreenManager::MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId, DMRect mainScreenRegion,
|
||||
ScreenId& screenGroupId)
|
||||
{
|
||||
WLOGFI("Make mirror with region for screen: %{public}" PRIu64",mirrorScreen: %{public}" PRIu64"",
|
||||
mainScreenId, mirrorScreenId);
|
||||
DMError ret = SingletonContainer::Get<ScreenManagerAdapter>().MakeMirror(mainScreenId, mirrorScreenId,
|
||||
mainScreenRegion, screenGroupId);
|
||||
if (screenGroupId == SCREEN_ID_INVALID) {
|
||||
WLOGFE("create mirror failed");
|
||||
}
|
||||
|
@ -137,6 +137,11 @@ public:
|
||||
virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) = 0;
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId) = 0;
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
return DMError::DM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode)
|
||||
{
|
||||
@ -253,4 +258,4 @@ public:
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
#endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_H
|
||||
#endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_H
|
||||
|
@ -57,6 +57,7 @@ enum class DisplayManagerMessage : unsigned int {
|
||||
TRANS_ID_GET_DENSITY_IN_CURRENT_RESOLUTION,
|
||||
TRANS_ID_SCREENGROUP_BASE = 1100,
|
||||
TRANS_ID_SCREEN_MAKE_MIRROR = TRANS_ID_SCREENGROUP_BASE,
|
||||
TRANS_ID_SCREEN_MAKE_MIRROR_WITH_REGION,
|
||||
TRANS_ID_MULTI_SCREEN_MODE_SWITCH,
|
||||
TRANS_ID_SET_MULTI_SCREEN_POSITION,
|
||||
TRANS_ID_SCREEN_MAKE_EXPAND,
|
||||
@ -138,4 +139,4 @@ enum class DisplayManagerMessage : unsigned int {
|
||||
TRANS_ID_GET_DISPLAY_SNAPSHOT_WITH_OPTION,
|
||||
};
|
||||
}
|
||||
#endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_CODE_H
|
||||
#endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_CODE_H
|
||||
|
@ -112,6 +112,18 @@ public:
|
||||
*/
|
||||
DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId, ScreenId& screenGroupId);
|
||||
|
||||
/**
|
||||
* @brief Make screen as mirror-screen for region of main screen.
|
||||
*
|
||||
* @param mainScreenId Main screen id.
|
||||
* @param mirrorScreenId Mirror screen id.
|
||||
* @param mainScreenRegion Region of main screen.
|
||||
* @param screenGroupId Screen group id.
|
||||
* @return DM_OK means make mirror success, others means make mirror failed.
|
||||
*/
|
||||
DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId, DMRect mainScreenRegion,
|
||||
ScreenId& screenGroupId);
|
||||
|
||||
/**
|
||||
* @brief Make screens as mirror-screen
|
||||
*
|
||||
@ -382,4 +394,4 @@ private:
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
#endif // FOUNDATION_DM_SCREEN_MANAGER_H
|
||||
#endif // FOUNDATION_DM_SCREEN_MANAGER_H
|
||||
|
@ -81,6 +81,12 @@ static napi_value MakeMirror(napi_env env, napi_callback_info info)
|
||||
return (me != nullptr) ? me->OnMakeMirror(env, info) : nullptr;
|
||||
}
|
||||
|
||||
static napi_value MakeMirrorWithRegion(napi_env env, napi_callback_info info)
|
||||
{
|
||||
JsScreenManager* me = CheckParamsAndGetThis<JsScreenManager>(env, info);
|
||||
return (me != nullptr) ? me->OnMakeMirrorWithRegion(env, info) : nullptr;
|
||||
}
|
||||
|
||||
static napi_value SetMultiScreenMode(napi_env env, napi_callback_info info)
|
||||
{
|
||||
JsScreenManager* me = CheckParamsAndGetThis<JsScreenManager>(env, info);
|
||||
@ -447,6 +453,53 @@ napi_value OnMakeMirror(napi_env env, napi_callback_info info)
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value OnMakeMirrorWithRegion(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGI("OnMakeMirrorWithRegion is called");
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc < ARGC_THREE) {
|
||||
return NapiThrowError(env, DmErrorCode::DM_ERROR_INVALID_PARAM, "Invalid args count, need 3 args at least!");
|
||||
}
|
||||
|
||||
int64_t mainScreenId;
|
||||
if (!ConvertFromJsValue(env, argv[INDEX_ZERO], mainScreenId)) {
|
||||
return NapiThrowError(env, DmErrorCode::DM_ERROR_INVALID_PARAM, "Failed to convert parameter to mainScreenId");
|
||||
}
|
||||
|
||||
int64_t mirrorScreenId;
|
||||
if (!ConvertFromJsValue(env, argv[INDEX_ONE], mirrorScreenId)) {
|
||||
return NapiThrowError(env, DmErrorCode::DM_ERROR_INVALID_PARAM,
|
||||
"Failed to convert parameter to mirrorScreenId");
|
||||
}
|
||||
|
||||
DMRect mainScreenRegion;
|
||||
if (GetRectFromJs(env, argv[INDEX_TWO], mainScreenRegion) == -1) {
|
||||
return NapiThrowError(env, DmErrorCode::DM_ERROR_INVALID_PARAM,
|
||||
"Failed to convert parameter to mainScreenRegion");
|
||||
}
|
||||
|
||||
napi_value lastParam = nullptr;
|
||||
napi_value result = nullptr;
|
||||
std::unique_ptr<NapiAsyncTask> napiAsyncTask = CreateEmptyAsyncTask(env, lastParam, &result);
|
||||
auto asyncTask = [mainScreenId, mirrorScreenId, mainScreenRegion, env, task = napiAsyncTask.get()]() {
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "JsScreenManager::OnMakeMirrorWithRegion");
|
||||
ScreenId screenGroupId = INVALID_SCREEN_ID;
|
||||
DmErrorCode ret = DM_JS_TO_ERROR_CODE_MAP.at(
|
||||
SingletonContainer::Get<ScreenManager>().MakeMirror(mainScreenId, mirrorScreenId, mainScreenRegion,
|
||||
screenGroupId));
|
||||
if (ret == DmErrorCode::DM_OK) {
|
||||
task->Resolve(env, CreateJsValue(env, static_cast<uint32_t>(screenGroupId)));
|
||||
} else {
|
||||
task->Reject(env,
|
||||
CreateJsError(env, static_cast<int32_t>(ret), "JsScreenManager::OnMakeMirrorWithRegion failed."));
|
||||
}
|
||||
};
|
||||
NapiSendDmsEvent(env, asyncTask, napiAsyncTask);
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value OnSetMultiScreenMode(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = ARGC_FOUR;
|
||||
@ -741,6 +794,40 @@ static int32_t GetMultiScreenPositionOptionsFromJs(napi_env env, napi_value opti
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t GetRectFromJs(napi_env env, napi_value optionObject, DMRect& rect)
|
||||
{
|
||||
napi_value leftValue = nullptr;
|
||||
napi_value topValue = nullptr;
|
||||
napi_value widthValue = nullptr;
|
||||
napi_value heightValue = nullptr;
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
napi_get_named_property(env, optionObject, "left", &leftValue);
|
||||
napi_get_named_property(env, optionObject, "top", &topValue);
|
||||
napi_get_named_property(env, optionObject, "width", &widthValue);
|
||||
napi_get_named_property(env, optionObject, "height", &heightValue);
|
||||
if (!ConvertFromJsValue(env, leftValue, left)) {
|
||||
WLOGFE("Failed to convert leftValue to callbackType");
|
||||
return -1;
|
||||
}
|
||||
if (!ConvertFromJsValue(env, topValue, top)) {
|
||||
WLOGFE("Failed to convert topValue to callbackType");
|
||||
return -1;
|
||||
}
|
||||
if (!ConvertFromJsValue(env, widthValue, width)) {
|
||||
WLOGFE("Failed to convert widthValue to callbackType");
|
||||
return -1;
|
||||
}
|
||||
if (!ConvertFromJsValue(env, heightValue, height)) {
|
||||
WLOGFE("Failed to convert heightValue to callbackType");
|
||||
return -1;
|
||||
}
|
||||
rect = {left, top, width, height};
|
||||
return 0;
|
||||
}
|
||||
|
||||
napi_value OnCreateVirtualScreen(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGI("JsScreenManager::OnCreateVirtualScreen is called");
|
||||
@ -1233,6 +1320,7 @@ napi_value JsScreenManagerInit(napi_env env, napi_value exportObj)
|
||||
BindNativeFunction(env, exportObj, "on", moduleName, JsScreenManager::RegisterScreenManagerCallback);
|
||||
BindNativeFunction(env, exportObj, "off", moduleName, JsScreenManager::UnregisterScreenMangerCallback);
|
||||
BindNativeFunction(env, exportObj, "makeMirror", moduleName, JsScreenManager::MakeMirror);
|
||||
BindNativeFunction(env, exportObj, "makeMirrorWithRegion", moduleName, JsScreenManager::MakeMirrorWithRegion);
|
||||
BindNativeFunction(env, exportObj, "setMultiScreenMode", moduleName, JsScreenManager::SetMultiScreenMode);
|
||||
BindNativeFunction(env, exportObj, "setMultiScreenRelativePosition", moduleName,
|
||||
JsScreenManager::SetMultiScreenRelativePosition);
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
DMError UniqueSwitch(const std::vector<ScreenId>& screenIds);
|
||||
|
||||
DMError MirrorSwitch(const ScreenId mainScreenId, const std::vector<ScreenId>& screenIds,
|
||||
DMError MirrorSwitch(const ScreenId mainScreenId, const std::vector<ScreenId>& screenIds, DMRect mainScreenRegion,
|
||||
ScreenId& screenGroupId);
|
||||
|
||||
void MultiScreenModeChange(sptr<ScreenSession> mainSession, sptr<ScreenSession> secondarySession,
|
||||
@ -55,9 +55,9 @@ private:
|
||||
std::vector<ScreenId>& physicalScreenIds, std::vector<ScreenId>& virtualScreenIds);
|
||||
|
||||
DMError VirtualScreenMirrorSwitch(const ScreenId mainScreenId, const std::vector<ScreenId>& screenIds,
|
||||
ScreenId& screenGroupId);
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId);
|
||||
|
||||
DMError PhysicalScreenMirrorSwitch(const std::vector<ScreenId>& screenIds);
|
||||
DMError PhysicalScreenMirrorSwitch(const std::vector<ScreenId>& screenIds, DMRect mainScreenRegion);
|
||||
|
||||
DMError PhysicalScreenUniqueSwitch(const std::vector<ScreenId>& screenIds);
|
||||
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override;
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId) override;
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId) override;
|
||||
virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode) override;
|
||||
virtual DMError SetMultiScreenRelativePosition(MultiScreenPositionOptions mainScreenOptions,
|
||||
@ -164,7 +166,8 @@ public:
|
||||
bool HandleFoldScreenSessionCreate(ScreenId screenId);
|
||||
|
||||
void ChangeScreenGroup(sptr<ScreenSessionGroup> group, const std::vector<ScreenId>& screens,
|
||||
const std::vector<Point>& startPoints, bool filterScreen, ScreenCombination combination);
|
||||
const std::vector<Point>& startPoints, bool filterScreen, ScreenCombination combination,
|
||||
DMRect mainScreenRegion = DMRect::NONE());
|
||||
|
||||
bool RemoveChildFromGroup(sptr<ScreenSession> screen, sptr<ScreenSessionGroup> screenGroup);
|
||||
|
||||
@ -173,7 +176,7 @@ public:
|
||||
std::map<ScreenId, bool>& removeChildResMap);
|
||||
bool CheckScreenInScreenGroup(sptr<ScreenSession> screen) const;
|
||||
|
||||
DMError SetMirror(ScreenId screenId, std::vector<ScreenId> screens);
|
||||
DMError SetMirror(ScreenId screenId, std::vector<ScreenId> screens, DMRect mainScreenRegion);
|
||||
DMError StopScreens(const std::vector<ScreenId>& screenIds, ScreenCombination stopCombination);
|
||||
|
||||
void NotifyScreenConnected(sptr<ScreenInfo> screenInfo);
|
||||
@ -372,6 +375,8 @@ private:
|
||||
void NotifyDisplayStateChange(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo,
|
||||
const std::map<DisplayId, sptr<DisplayInfo>>& displayInfoMap, DisplayStateChangeType type);
|
||||
void NotifyCaptureStatusChanged();
|
||||
DMError DoMakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId);
|
||||
bool OnMakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint);
|
||||
bool OnRemoteDied(const sptr<IRemoteObject>& agent);
|
||||
std::string TransferTypeToString(ScreenType type) const;
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override { return DMError::DM_OK; }
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId) override { return DMError::DM_OK; }
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId) override { return DMError::DM_OK; }
|
||||
virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode) override { return DMError::DM_OK; }
|
||||
virtual DMError SetMultiScreenRelativePosition(MultiScreenPositionOptions mainScreenOptions,
|
||||
|
@ -85,6 +85,8 @@ public:
|
||||
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId) override;
|
||||
virtual DMError MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId) override;
|
||||
virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode) override;
|
||||
virtual DMError SetMultiScreenRelativePosition(MultiScreenPositionOptions mainScreenOptions,
|
||||
@ -193,4 +195,4 @@ private:
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
|
||||
#endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
|
||||
|
@ -63,7 +63,7 @@ void MultiScreenManager::FilterPhysicalAndVirtualScreen(const std::vector<Screen
|
||||
}
|
||||
|
||||
DMError MultiScreenManager::VirtualScreenMirrorSwitch(const ScreenId mainScreenId,
|
||||
const std::vector<ScreenId>& screenIds, ScreenId& screenGroupId)
|
||||
const std::vector<ScreenId>& screenIds, DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "enter size: %{public}u",
|
||||
static_cast<uint32_t>(screenIds.size()));
|
||||
@ -73,7 +73,7 @@ DMError MultiScreenManager::VirtualScreenMirrorSwitch(const ScreenId mainScreenI
|
||||
TLOGE(WmsLogTag::DMS, "screen session null fail mainScreenId: %{public}" PRIu64, mainScreenId);
|
||||
return DMError::DM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
DMError ret = ScreenSessionManager::GetInstance().SetMirror(mainScreenId, screenIds);
|
||||
DMError ret = ScreenSessionManager::GetInstance().SetMirror(mainScreenId, screenIds, mainScreenRegion);
|
||||
if (ret != DMError::DM_OK) {
|
||||
TLOGE(WmsLogTag::DMS, "error: %{public}d", ret);
|
||||
return ret;
|
||||
@ -88,7 +88,7 @@ DMError MultiScreenManager::VirtualScreenMirrorSwitch(const ScreenId mainScreenI
|
||||
return ret;
|
||||
}
|
||||
|
||||
DMError MultiScreenManager::PhysicalScreenMirrorSwitch(const std::vector<ScreenId>& screenIds)
|
||||
DMError MultiScreenManager::PhysicalScreenMirrorSwitch(const std::vector<ScreenId>& screenIds, DMRect mirrorRegion)
|
||||
{
|
||||
sptr<ScreenSession> defaultSession = ScreenSessionManager::GetInstance().GetDefaultScreenSession();
|
||||
if (defaultSession == nullptr) {
|
||||
@ -110,6 +110,8 @@ DMError MultiScreenManager::PhysicalScreenMirrorSwitch(const std::vector<ScreenI
|
||||
displayNode->RemoveFromTree();
|
||||
}
|
||||
screenSession->ReleaseDisplayNode();
|
||||
screenSession->SetMirrorScreenRegion(defaultSession->GetRSScreenId(), mirrorRegion);
|
||||
screenSession->SetIsPhysicalMirrorSwitch(true);
|
||||
RSDisplayNodeConfig config = { screenSession->screenId_, true, nodeId, true };
|
||||
screenSession->CreateDisplayNode(config);
|
||||
}
|
||||
@ -210,7 +212,7 @@ DMError MultiScreenManager::UniqueSwitch(const std::vector<ScreenId>& screenIds)
|
||||
}
|
||||
|
||||
DMError MultiScreenManager::MirrorSwitch(const ScreenId mainScreenId, const std::vector<ScreenId>& screenIds,
|
||||
ScreenId& screenGroupId)
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
DMError switchStatus = DMError::DM_OK;
|
||||
std::vector<ScreenId> virtualScreenIds;
|
||||
@ -223,12 +225,12 @@ DMError MultiScreenManager::MirrorSwitch(const ScreenId mainScreenId, const std:
|
||||
FilterPhysicalAndVirtualScreen(screenIds, physicalScreenIds, virtualScreenIds);
|
||||
|
||||
if (!virtualScreenIds.empty()) {
|
||||
switchStatus = VirtualScreenMirrorSwitch(mainScreenId, virtualScreenIds, screenGroupId);
|
||||
switchStatus = VirtualScreenMirrorSwitch(mainScreenId, virtualScreenIds, mainScreenRegion, screenGroupId);
|
||||
TLOGI(WmsLogTag::DMS, "virtual screen switch to mirror result: %{public}d", switchStatus);
|
||||
}
|
||||
if (!physicalScreenIds.empty()) {
|
||||
screenGroupId = 1;
|
||||
switchStatus = PhysicalScreenMirrorSwitch(physicalScreenIds);
|
||||
switchStatus = PhysicalScreenMirrorSwitch(physicalScreenIds, mainScreenRegion);
|
||||
TLOGI(WmsLogTag::DMS, "physical screen switch to mirror result: %{public}d", switchStatus);
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "end switchStatus: %{public}d", switchStatus);
|
||||
@ -576,4 +578,4 @@ void MultiScreenManager::ExternalScreenDisconnectChange(sptr<ScreenSession> inte
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -3290,8 +3290,8 @@ void ScreenSessionManager::MirrorSwitchNotify(ScreenId screenId)
|
||||
}
|
||||
}
|
||||
|
||||
DMError ScreenSessionManager::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId)
|
||||
DMError ScreenSessionManager::DoMakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "enter!");
|
||||
if (!SessionPermission::IsSystemCalling() && !SessionPermission::IsStartByHdcd()) {
|
||||
@ -3319,7 +3319,7 @@ DMError ScreenSessionManager::MakeMirror(ScreenId mainScreenId, std::vector<Scre
|
||||
OnVirtualScreenChange(screenId, ScreenEvent::DISCONNECTED);
|
||||
}
|
||||
DMError makeResult = MultiScreenManager::GetInstance().MirrorSwitch(mainScreenId,
|
||||
allMirrorScreenIds, screenGroupId);
|
||||
allMirrorScreenIds, mainScreenRegion, screenGroupId);
|
||||
for (ScreenId screenId : allMirrorScreenIds) {
|
||||
MirrorSwitchNotify(screenId);
|
||||
}
|
||||
@ -3329,6 +3329,20 @@ DMError ScreenSessionManager::MakeMirror(ScreenId mainScreenId, std::vector<Scre
|
||||
return makeResult;
|
||||
}
|
||||
|
||||
DMError ScreenSessionManager::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
|
||||
ScreenId& screenGroupId)
|
||||
{
|
||||
return DoMakeMirror(mainScreenId, mirrorScreenIds, DMRect::NONE(), screenGroupId);
|
||||
}
|
||||
|
||||
DMError ScreenSessionManager::MakeMirror(ScreenId mainScreenId, ScreenId mirrorScreenId,
|
||||
DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
std::vector<ScreenId> screenIds;
|
||||
screenIds.emplace_back(mirrorScreenId);
|
||||
return DoMakeMirror(mainScreenId, screenIds, mainScreenRegion, screenGroupId);
|
||||
}
|
||||
|
||||
void ScreenSessionManager::RegisterCastObserver(std::vector<ScreenId>& mirrorScreenIds)
|
||||
{
|
||||
mirrorScreenIds_ = mirrorScreenIds;
|
||||
@ -4020,7 +4034,7 @@ bool ScreenSessionManager::RemoveChildFromGroup(sptr<ScreenSession> screen, sptr
|
||||
return true;
|
||||
}
|
||||
|
||||
DMError ScreenSessionManager::SetMirror(ScreenId screenId, std::vector<ScreenId> screens)
|
||||
DMError ScreenSessionManager::SetMirror(ScreenId screenId, std::vector<ScreenId> screens, DMRect mainScreenRegion)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "screenId:%{public}" PRIu64"", screenId);
|
||||
sptr<ScreenSession> screen = GetScreenSession(screenId);
|
||||
@ -4044,7 +4058,8 @@ DMError ScreenSessionManager::SetMirror(ScreenId screenId, std::vector<ScreenId>
|
||||
bool filterMirroredScreen =
|
||||
group->combination_ == ScreenCombination::SCREEN_MIRROR && group->mirrorScreenId_ == screen->screenId_;
|
||||
group->mirrorScreenId_ = screen->screenId_;
|
||||
ChangeScreenGroup(group, screens, startPoints, filterMirroredScreen, ScreenCombination::SCREEN_MIRROR);
|
||||
ChangeScreenGroup(group, screens, startPoints, filterMirroredScreen, ScreenCombination::SCREEN_MIRROR,
|
||||
mainScreenRegion);
|
||||
TLOGI(WmsLogTag::DMS, "success");
|
||||
return DMError::DM_OK;
|
||||
}
|
||||
@ -4078,7 +4093,7 @@ bool ScreenSessionManager::CheckScreenInScreenGroup(sptr<ScreenSession> screen)
|
||||
}
|
||||
|
||||
void ScreenSessionManager::ChangeScreenGroup(sptr<ScreenSessionGroup> group, const std::vector<ScreenId>& screens,
|
||||
const std::vector<Point>& startPoints, bool filterScreen, ScreenCombination combination)
|
||||
const std::vector<Point>& startPoints, bool filterScreen, ScreenCombination combination, DMRect mainScreenRegion)
|
||||
{
|
||||
std::map<ScreenId, bool> removeChildResMap;
|
||||
std::vector<ScreenId> addScreens;
|
||||
@ -4094,7 +4109,16 @@ void ScreenSessionManager::ChangeScreenGroup(sptr<ScreenSessionGroup> group, con
|
||||
TLOGI(WmsLogTag::DMS, "Screen->groupSmsId_: %{public}" PRIu64"", screen->groupSmsId_);
|
||||
screen->groupSmsId_ = 1;
|
||||
if (filterScreen && screen->groupSmsId_ == group->screenId_ && group->HasChild(screen->screenId_)) {
|
||||
continue;
|
||||
//该screen已经在该分组中了
|
||||
if (combination != ScreenCombination::SCREEN_MIRROR ||
|
||||
screen->GetMirrorScreenRegion().second == mainScreenRegion) {
|
||||
continue;
|
||||
}
|
||||
//镜像模式且镜像区域变化,需要重新创建镜像
|
||||
TLOGI(WmsLogTag::DMS, "Screen: %{public}" PRIu64
|
||||
", apply new region, x:%{public}d y:%{public}d w:%{public}u h:%{public}u",
|
||||
screenId, mainScreenRegion.posX_, mainScreenRegion.posY_,
|
||||
mainScreenRegion.width_, mainScreenRegion.height_);
|
||||
}
|
||||
if (CheckScreenInScreenGroup(screen)) {
|
||||
NotifyDisplayDestroy(screenId);
|
||||
@ -4103,6 +4127,20 @@ void ScreenSessionManager::ChangeScreenGroup(sptr<ScreenSessionGroup> group, con
|
||||
addChildPos.emplace_back(startPoints[i]);
|
||||
removeChildResMap[screenId] = originGroup != nullptr;
|
||||
addScreens.emplace_back(screenId);
|
||||
if (combination == ScreenCombination::SCREEN_MIRROR) {
|
||||
auto mirrorScreenId = group->mirrorScreenId_;
|
||||
ScreenId rsScreenId = SCREEN_ID_INVALID;
|
||||
if (!ConvertScreenIdToRsScreenId(screenId, rsScreenId)) {
|
||||
TLOGE(WmsLogTag::DMS, "Screen: %{public}" PRIu64" convert to rs id failed", mirrorScreenId);
|
||||
} else {
|
||||
screen->SetMirrorScreenRegion(rsScreenId, mainScreenRegion);
|
||||
screen->SetIsPhysicalMirrorSwitch(false);
|
||||
TLOGI(WmsLogTag::DMS, "Screen: %{public}" PRIu64" mirror to %{public}"
|
||||
PRIu64" with region, x:%{public}d y:%{public}d w:%{public}u h:%{public}u",
|
||||
screenId, mirrorScreenId, mainScreenRegion.posX_, mainScreenRegion.posY_,
|
||||
mainScreenRegion.width_, mainScreenRegion.height_);
|
||||
}
|
||||
}
|
||||
}
|
||||
group->combination_ = combination;
|
||||
AddScreenToGroup(group, addScreens, addChildPos, removeChildResMap);
|
||||
|
@ -1271,6 +1271,44 @@ DMError ScreenSessionManagerProxy::MakeMirror(ScreenId mainScreenId,
|
||||
return ret;
|
||||
}
|
||||
|
||||
DMError ScreenSessionManagerProxy::MakeMirror(ScreenId mainScreenId,
|
||||
ScreenId mirrorScreenId, DMRect mainScreenRegion, ScreenId& screenGroupId)
|
||||
{
|
||||
WLOGFW("ScreenSessionManagerProxy::MakeMirror: ENTER");
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
WLOGFW("ScreenSessionManagerProxy::MakeMirror: create mirror fail: remote is null");
|
||||
return DMError::DM_ERROR_NULLPTR;
|
||||
}
|
||||
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("ScreenSessionManagerProxy::MakeMirror: create mirror fail: WriteInterfaceToken failed");
|
||||
return DMError::DM_ERROR_WRITE_INTERFACE_TOKEN_FAILED;
|
||||
}
|
||||
bool res = data.WriteUint64(static_cast<uint64_t>(mainScreenId)) &&
|
||||
data.WriteUint64(static_cast<uint64_t>(mirrorScreenId));
|
||||
if (!res) {
|
||||
WLOGFE("ScreenSessionManagerProxy::MakeMirror: create mirror fail: write screenId failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (!data.WriteInt32(mainScreenRegion.posX_) || !data.WriteInt32(mainScreenRegion.posY_) ||
|
||||
!data.WriteUint32(mainScreenRegion.width_) || !data.WriteUint32(mainScreenRegion.height_)) {
|
||||
WLOGFE("ScreenSessionManagerProxy::MakeMirror: Write mainScreenRegion failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR_WITH_REGION),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("ScreenSessionManagerProxy::MakeMirror: create mirror fail: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
DMError ret = static_cast<DMError>(reply.ReadInt32());
|
||||
screenGroupId = static_cast<ScreenId>(reply.ReadUint64());
|
||||
return ret;
|
||||
}
|
||||
|
||||
DMError ScreenSessionManagerProxy::SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
|
||||
MultiScreenMode screenMode)
|
||||
{
|
||||
|
@ -269,6 +269,20 @@ int32_t ScreenSessionManagerStub::OnRemoteRequest(uint32_t code, MessageParcel&
|
||||
static_cast<void>(reply.WriteUint64(static_cast<uint64_t>(screenGroupId)));
|
||||
break;
|
||||
}
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR_WITH_REGION: {
|
||||
ScreenId mainScreenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
ScreenId mirrorScreenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
int32_t posX = data.ReadInt32();
|
||||
int32_t posY = data.ReadInt32();
|
||||
uint32_t width = data.ReadUint32();
|
||||
uint32_t height = data.ReadUint32();
|
||||
DMRect mainScreenRegion = { posX, posY, width, height };
|
||||
ScreenId screenGroupId = INVALID_SCREEN_ID;
|
||||
DMError ret = MakeMirror(mainScreenId, mirrorScreenId, mainScreenRegion, screenGroupId);
|
||||
static_cast<void>(reply.WriteInt32(static_cast<int32_t>(ret)));
|
||||
static_cast<void>(reply.WriteUint64(static_cast<uint64_t>(screenGroupId)));
|
||||
break;
|
||||
}
|
||||
case DisplayManagerMessage::TRANS_ID_MULTI_SCREEN_MODE_SWITCH: {
|
||||
ScreenId mainScreenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
ScreenId secondaryScreenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
|
@ -174,6 +174,8 @@ public:
|
||||
bool IsScreenRotationLocked();
|
||||
void SetTouchEnabledFromJs(bool isTouchEnabled);
|
||||
bool IsTouchEnabled();
|
||||
void SetIsPhysicalMirrorSwitch(bool isPhysicalMirrorSwitch);
|
||||
bool GetIsPhysicalMirrorSwitch();
|
||||
|
||||
void UpdateToInputManager(RRect bounds, int rotation, FoldDisplayMode foldDisplayMode);
|
||||
void UpdatePropertyAfterRotation(RRect bounds, int rotation, FoldDisplayMode foldDisplayMode);
|
||||
@ -248,6 +250,8 @@ public:
|
||||
Rotation ConvertIntToRotation(int rotation);
|
||||
void SetPhysicalRotation(int rotation, FoldStatus foldStatus);
|
||||
void SetStartPosition(uint32_t startX, uint32_t startY);
|
||||
void SetMirrorScreenRegion(ScreenId screenId, DMRect screenRegion);
|
||||
std::pair<ScreenId, DMRect> GetMirrorScreenRegion();
|
||||
void ScreenCaptureNotify(ScreenId mainScreenId, int32_t uid, const std::string& clientName);
|
||||
void SuperFoldStatusChange(ScreenId screenId, SuperFoldStatus superFoldStatus);
|
||||
|
||||
@ -260,6 +264,7 @@ private:
|
||||
VirtualScreenFlag screenFlag_ { VirtualScreenFlag::DEFAULT };
|
||||
bool hasPrivateWindowForeground_ = false;
|
||||
bool isFakeInUse_ = false;
|
||||
bool isPhysicalMirrorSwitch_ = false;
|
||||
mutable std::shared_mutex displayNodeMutex_;
|
||||
std::atomic<bool> touchEnabled_ { true };
|
||||
std::function<void(float)> updateToInputManagerCallback_ = nullptr;
|
||||
@ -270,10 +275,12 @@ private:
|
||||
std::vector<uint32_t> hdrFormats_;
|
||||
std::vector<uint32_t> colorSpaces_;
|
||||
MirrorScreenType mirrorScreenType_ { MirrorScreenType::VIRTUAL_MIRROR };
|
||||
std::pair<ScreenId, DMRect> mirrorScreenRegion_ = std::make_pair(INVALID_SCREEN_ID, DMRect::NONE());
|
||||
SetScreenSceneDpiFunc setScreenSceneDpiCallback_ = nullptr;
|
||||
DestroyScreenSceneFunc destroyScreenSceneCallback_ = nullptr;
|
||||
void ReportNotifyModeChange(DisplayOrientation displayOrientation);
|
||||
sptr<ScreenSession> fakeScreenSession_ = nullptr;
|
||||
void EnableMirrorScreenRegion();
|
||||
};
|
||||
|
||||
class ScreenSessionGroup : public ScreenSession {
|
||||
|
@ -96,6 +96,9 @@ void ScreenSession::CreateDisplayNode(const Rosen::RSDisplayNodeConfig& config)
|
||||
property_.GetBounds().rect_.width_, property_.GetBounds().rect_.height_);
|
||||
displayNode_->SetBounds(property_.GetBounds().rect_.left_, property_.GetBounds().rect_.top_,
|
||||
property_.GetBounds().rect_.width_, property_.GetBounds().rect_.height_);
|
||||
if (config.isMirrored) {
|
||||
EnableMirrorScreenRegion();
|
||||
}
|
||||
} else {
|
||||
TLOGE(WmsLogTag::DMS, "Failed to create displayNode, displayNode is null!");
|
||||
}
|
||||
@ -214,6 +217,41 @@ void ScreenSession::UnregisterScreenChangeListener(IScreenChangeListener* screen
|
||||
screenChangeListenerList_.end());
|
||||
}
|
||||
|
||||
void ScreenSession::SetMirrorScreenRegion(ScreenId screenId, DMRect screenRegion)
|
||||
{
|
||||
mirrorScreenRegion_ = std::make_pair(screenId, screenRegion);
|
||||
}
|
||||
|
||||
std::pair<ScreenId, DMRect> ScreenSession::GetMirrorScreenRegion()
|
||||
{
|
||||
return mirrorScreenRegion_;
|
||||
}
|
||||
|
||||
void ScreenSession::EnableMirrorScreenRegion()
|
||||
{
|
||||
auto& rect = mirrorScreenRegion_.second;
|
||||
if (rect == DMRect::NONE()) {
|
||||
return;
|
||||
}
|
||||
ScreenId screenId = INVALID_SCREEN_ID;
|
||||
if (isPhysicalMirrorSwitch_) {
|
||||
screenId = screenId_;
|
||||
} else {
|
||||
screenId = rsId_;
|
||||
}
|
||||
auto ret = RSInterfaces::GetInstance().SetMirrorScreenVisibleRect(screenId,
|
||||
{ rect.posX_, rect.posY_, rect.width_, rect.height_ });
|
||||
if (ret != StatusCode::SUCCESS) {
|
||||
WLOGE("ScreenSession::EnableMirrorScreenRegion fail! rsId %{public}" PRIu64", ret:%{public}d," PRIu64
|
||||
", x:%{public}d y:%{public}d w:%{public}u h:%{public}u", screenId, ret,
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
} else {
|
||||
WLOGE("ScreenSession::EnableMirrorScreenRegion success! rsId %{public}" PRIu64", ret:%{public}d," PRIu64
|
||||
", x:%{public}d y:%{public}d w:%{public}u h:%{public}u", screenId, ret,
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
}
|
||||
}
|
||||
|
||||
sptr<DisplayInfo> ScreenSession::ConvertToDisplayInfo()
|
||||
{
|
||||
sptr<DisplayInfo> displayInfo = new(std::nothrow) DisplayInfo();
|
||||
@ -1239,6 +1277,9 @@ void ScreenSession::InitRSDisplayNode(RSDisplayNodeConfig& config, Point& startP
|
||||
screenId_, width, height);
|
||||
displayNode_->SetFrame(0, 0, static_cast<float>(width), static_cast<float>(height));
|
||||
displayNode_->SetBounds(0, 0, static_cast<float>(width), static_cast<float>(height));
|
||||
if (config.isMirrored) {
|
||||
EnableMirrorScreenRegion();
|
||||
}
|
||||
auto transactionProxy = RSTransactionProxy::GetInstance();
|
||||
if (transactionProxy != nullptr) {
|
||||
transactionProxy->FlushImplicitTransaction();
|
||||
@ -1541,4 +1582,14 @@ void ScreenSession::SuperFoldStatusChange(ScreenId screenId, SuperFoldStatus sup
|
||||
listener->OnSuperFoldStatusChange(screenId, superFoldStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSession::SetIsPhysicalMirrorSwitch(bool isPhysicalMirrorSwitch)
|
||||
{
|
||||
isPhysicalMirrorSwitch_ = isPhysicalMirrorSwitch;
|
||||
}
|
||||
|
||||
bool ScreenSession::GetIsPhysicalMirrorSwitch()
|
||||
{
|
||||
return isPhysicalMirrorSwitch_;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -111,7 +111,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch01, Function | SmallTe
|
||||
ScreenId mainScreenId = 1;
|
||||
std::vector<ScreenId> ScreenIds = {2, 3};
|
||||
ScreenId screenGroupId;
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, DMRect::NONE(),
|
||||
screenGroupId);
|
||||
EXPECT_EQ(screenGroupId, 0);
|
||||
}
|
||||
|
||||
@ -127,7 +128,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch02, Function | SmallTe
|
||||
ScreenId screenGroupId;
|
||||
sptr<ScreenSession> session = new ScreenSession();
|
||||
ScreenSessionManager::GetInstance().screenSessionMap_[mainScreenId] = session;
|
||||
auto ret = MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
auto ret = MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds,
|
||||
DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -148,7 +150,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch03, Function | SmallTe
|
||||
ScreenCombination combination = ScreenCombination::SCREEN_ALONE;
|
||||
sptr<ScreenSessionGroup> sessiongroup = new ScreenSessionGroup(mainScreenId, rsId, name, combination);
|
||||
ScreenSessionManager::GetInstance().smsScreenGroupMap_[mainScreenId] = sessiongroup;
|
||||
auto ret = MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
auto ret = MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, DMRect::NONE(),
|
||||
screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -162,7 +165,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch04, Function | SmallTe
|
||||
ScreenId mainScreenId = 1003;
|
||||
std::vector<ScreenId> ScreenIds = {2, 3};
|
||||
ScreenId screenGroupId;
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, DMRect::NONE(),
|
||||
screenGroupId);
|
||||
EXPECT_EQ(screenGroupId, 0);
|
||||
}
|
||||
|
||||
@ -176,7 +180,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch05, Function | SmallTe
|
||||
ScreenId mainScreenId = 101;
|
||||
std::vector<ScreenId> ScreenIds = {1, 2};
|
||||
ScreenId screenGroupId;
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, DMRect::NONE(),
|
||||
screenGroupId);
|
||||
EXPECT_EQ(screenGroupId, 0);
|
||||
}
|
||||
|
||||
@ -190,7 +195,8 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch06, Function | SmallTe
|
||||
ScreenId mainScreenId = 102;
|
||||
std::vector<ScreenId> ScreenIds = {1, 3};
|
||||
ScreenId screenGroupId;
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, screenGroupId);
|
||||
MultiScreenManager::GetInstance().VirtualScreenMirrorSwitch(mainScreenId, ScreenIds, DMRect::NONE(),
|
||||
screenGroupId);
|
||||
EXPECT_EQ(screenGroupId, 0);
|
||||
}
|
||||
|
||||
@ -202,7 +208,7 @@ HWTEST_F(MultiScreenManagerTest, VirtualScreenMirrorSwitch06, Function | SmallTe
|
||||
HWTEST_F(MultiScreenManagerTest, PhysicalScreenMirrorSwitch01, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {2, 3};
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds);
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds, DMRect::NONE());
|
||||
EXPECT_EQ(ret, DMError::DM_ERROR_NULLPTR);
|
||||
}
|
||||
|
||||
@ -217,7 +223,7 @@ HWTEST_F(MultiScreenManagerTest, PhysicalScreenMirrorSwitch02, Function | SmallT
|
||||
sptr<ScreenSession> session = new ScreenSession();
|
||||
ScreenSessionManager::GetInstance().screenSessionMap_[
|
||||
ScreenSessionManager::GetInstance().defaultScreenId_] = session;
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds);
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds, DMRect::NONE());
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -234,7 +240,7 @@ HWTEST_F(MultiScreenManagerTest, PhysicalScreenMirrorSwitch03, Function | SmallT
|
||||
ScreenSessionManager::GetInstance().defaultScreenId_] = session;
|
||||
sptr<ScreenSession> session1 = new ScreenSession();
|
||||
ScreenSessionManager::GetInstance().screenSessionMap_[1002] = session1;
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds);
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds, DMRect::NONE());
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -249,7 +255,7 @@ HWTEST_F(MultiScreenManagerTest, PhysicalScreenMirrorSwitch04, Function | SmallT
|
||||
sptr<ScreenSession> session = new ScreenSession();
|
||||
ScreenSessionManager::GetInstance().screenSessionMap_[
|
||||
ScreenSessionManager::GetInstance().defaultScreenId_] = session;
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds);
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds, DMRect::NONE());
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -267,7 +273,7 @@ HWTEST_F(MultiScreenManagerTest, PhysicalScreenMirrorSwitch05, Function | SmallT
|
||||
ScreenSessionManager::GetInstance().defaultScreenId_] = session;
|
||||
sptr<ScreenSession> session1 = new ScreenSession();
|
||||
ScreenSessionManager::GetInstance().screenSessionMap_[12] = session1;
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds);
|
||||
DMError ret = MultiScreenManager::GetInstance().PhysicalScreenMirrorSwitch(screenIds, DMRect::NONE());
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -538,7 +544,7 @@ HWTEST_F(MultiScreenManagerTest, MirrorSwitch, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {};
|
||||
ScreenId screenGroupId = 0;
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, screenGroupId);
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -551,7 +557,7 @@ HWTEST_F(MultiScreenManagerTest, MirrorSwitch01, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {1001, 1002};
|
||||
ScreenId screenGroupId = 0;
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, screenGroupId);
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -564,7 +570,7 @@ HWTEST_F(MultiScreenManagerTest, MirrorSwitch02, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {2, 3};
|
||||
ScreenId screenGroupId = 0;
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, screenGroupId);
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -577,7 +583,7 @@ HWTEST_F(MultiScreenManagerTest, MirrorSwitch03, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {1003, 1002};
|
||||
ScreenId screenGroupId = 0;
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, screenGroupId);
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -590,7 +596,7 @@ HWTEST_F(MultiScreenManagerTest, MirrorSwitch04, Function | SmallTest | Level1)
|
||||
{
|
||||
std::vector<ScreenId> screenIds = {1003, 2};
|
||||
ScreenId screenGroupId = 0;
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, screenGroupId);
|
||||
DMError ret = MultiScreenManager::GetInstance().MirrorSwitch(1, screenIds, DMRect::NONE(), screenGroupId);
|
||||
EXPECT_EQ(ret, DMError::DM_OK);
|
||||
}
|
||||
|
||||
@ -1860,4 +1866,4 @@ HWTEST_F(MultiScreenManagerTest, ExternalScreenDisconnectChange05, Function | Sm
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -1540,8 +1540,8 @@ HWTEST_F(ScreenSessionManagerTest, SetMirror, Function | SmallTest | Level3)
|
||||
ssm_->screenSessionMap_ = screenSessionMap_;
|
||||
auto screen = ssm_->GetScreenSession(2);
|
||||
screen->GetScreenProperty().SetScreenType(ScreenType::REAL);
|
||||
ASSERT_EQ(DMError::DM_OK, ssm_->SetMirror(2, screens));
|
||||
ASSERT_EQ(DMError::DM_ERROR_NULLPTR, ssm_->SetMirror(9, screens));
|
||||
ASSERT_EQ(DMError::DM_OK, ssm_->SetMirror(2, screens, DMRect::NONE()));
|
||||
ASSERT_EQ(DMError::DM_ERROR_NULLPTR, ssm_->SetMirror(9, screens, DMRect::NONE()));
|
||||
ssm_->DestroyVirtualScreen(screenId);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user