mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-30 02:22:15 +00:00
Description:提供屏幕控件方向
IssueNo:https://gitee.com/openharmony/drivers_hdf_core/issues/IB36TN Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wyk99 <wangyuekai1@huawei.com>
This commit is contained in:
parent
64742b2051
commit
14350e8a00
@ -103,6 +103,7 @@ enum class DisplayManagerMessage : unsigned int {
|
||||
TRANS_ID_SET_CLIENT = 2500,
|
||||
TRANS_ID_GET_SCREEN_PROPERTY,
|
||||
TRANS_ID_GET_DISPLAY_NODE,
|
||||
TRANS_ID_UPDATE_SCREEN_DIRECTION_INFO,
|
||||
TRANS_ID_UPDATE_SCREEN_ROTATION_PROPERTY,
|
||||
TRANS_ID_UPDATE_AVAILABLE_AREA,
|
||||
TRANS_ID_SET_SCREEN_OFF_DELAY_TIME,
|
||||
|
@ -462,6 +462,15 @@ struct ScrollableParam {
|
||||
std::string friction_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief screen direction info
|
||||
*/
|
||||
struct ScreenDirectionInfo {
|
||||
int32_t notifyRotation_;
|
||||
int32_t screenRotation_;
|
||||
int32_t rotation_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief displayRect
|
||||
*/
|
||||
|
@ -439,11 +439,14 @@ napi_value JsScreenSessionManager::OnUpdateScreenRotationProperty(napi_env env,
|
||||
TLOGE(WmsLogTag::DMS, "[NAPI]Failed to get bounds from js object");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
int rotation;
|
||||
if (!ConvertFromJsValue(env, argv[2], rotation)) { // 2: the 3rd argv
|
||||
TLOGE(WmsLogTag::DMS, "[NAPI]Failed to convert parameter to rotation");
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
ScreenDirectionInfo directionInfo;
|
||||
napi_value nativeObject = argv[2];
|
||||
if (nativeObject == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[NAPI]Failed to convert parameter to ScreenDirectionInfo,the param is null");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
if (!ConvertScreenDirectionInfoFromJs(env, nativeObject, directionInfo)) {
|
||||
TLOGE(WmsLogTag::DMS, "[NAPI]Failed to convert parameter to ScreenDirectionInfo");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
ScreenPropertyChangeType type = ScreenPropertyChangeType::UNSPECIFIED;
|
||||
@ -456,7 +459,7 @@ napi_value JsScreenSessionManager::OnUpdateScreenRotationProperty(napi_env env,
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
}
|
||||
ScreenSessionManagerClient::GetInstance().UpdateScreenRotationProperty(screenId, bounds, rotation,
|
||||
ScreenSessionManagerClient::GetInstance().UpdateScreenRotationProperty(screenId, bounds, directionInfo,
|
||||
type);
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
@ -236,6 +236,39 @@ bool ConvertRRectFromJs(napi_env env, napi_value jsObject, RRect& bound)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConvertScreenDirectionInfoFromJs(napi_env env, napi_value jsObject, ScreenDirectionInfo& directionInfo)
|
||||
{
|
||||
napi_value jsNotifyRotation = nullptr, jsScreenRotation = nullptr, jsRotation = nullptr;
|
||||
napi_get_named_property(env, jsObject, "notifyRotation", &jsNotifyRotation);
|
||||
napi_get_named_property(env, jsObject, "screenRotation", &jsScreenRotation);
|
||||
napi_get_named_property(env, jsObject, "rotation", &jsRotation);
|
||||
|
||||
if (GetType(env, jsNotifyRotation) != napi_undefined) {
|
||||
int32_t notifyRotation;
|
||||
if (!ConvertFromJsValue(env, jsNotifyRotation, notifyRotation)) {
|
||||
WLOGFE("[NAPI]Failed to convert parameter to notifyRotation");
|
||||
return false;
|
||||
}
|
||||
directionInfo.notifyRotation_ = notifyRotation;
|
||||
}
|
||||
if (GetType(env, jsScreenRotation) != napi_undefined) {
|
||||
int32_t screenRotation;
|
||||
if (!ConvertFromJsValue(env, jsScreenRotation, screenRotation)) {
|
||||
WLOGFE("[NAPI]Failed to convert parameter to screenRotation");
|
||||
return false;
|
||||
}
|
||||
directionInfo.screenRotation_ = screenRotation;
|
||||
}
|
||||
if (GetType(env, jsRotation) != napi_undefined) {
|
||||
int32_t rotation;
|
||||
if (!ConvertFromJsValue(env, jsRotation, rotation)) {
|
||||
WLOGFE("[NAPI]Failed to convert parameter to rotation");
|
||||
return false;
|
||||
}
|
||||
directionInfo.rotation_ = rotation;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConvertDMRectFromJs(napi_env env, napi_value jsObject, DMRect& rect)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@
|
||||
namespace OHOS::Rosen {
|
||||
bool ConvertRRectFromJs(napi_env env, napi_value jsObject, RRect& bound);
|
||||
bool ConvertDMRectFromJs(napi_env env, napi_value jsObject, DMRect& rect);
|
||||
bool ConvertScreenDirectionInfoFromJs(napi_env env, napi_value jsObject, ScreenDirectionInfo& directionInfo);
|
||||
napi_value NapiGetUndefined(napi_env env);
|
||||
bool NapiIsCallable(napi_env env, napi_value value);
|
||||
class JsScreenUtils {
|
||||
|
@ -267,6 +267,7 @@ public:
|
||||
std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
|
||||
void UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType) override;
|
||||
void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation) override;
|
||||
uint32_t GetCurvedCompressionArea() override;
|
||||
ScreenProperty GetPhyScreenProperty(ScreenId screenId) override;
|
||||
void SetScreenPrivacyState(bool hasPrivate) override;
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
virtual std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) { return nullptr; }
|
||||
virtual void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType) {}
|
||||
virtual void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation) {}
|
||||
virtual void UpdateAvailableArea(ScreenId screenId, DMRect area) {}
|
||||
virtual int32_t SetScreenOffDelayTime(int32_t delay) { return 0; }
|
||||
virtual uint32_t GetCurvedCompressionArea() { return 0; }
|
||||
|
@ -154,6 +154,7 @@ public:
|
||||
std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
|
||||
void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType) override;
|
||||
void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation) override;
|
||||
void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override;
|
||||
int32_t SetScreenOffDelayTime(int32_t delay) override;
|
||||
uint32_t GetCurvedCompressionArea() override;
|
||||
|
@ -2569,6 +2569,20 @@ void ScreenSessionManager::NotifyAndPublishEvent(sptr<DisplayInfo> displayInfo,
|
||||
IPCSkeleton::SetCallingIdentity(identity);
|
||||
}
|
||||
|
||||
void ScreenSessionManager::UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation)
|
||||
{
|
||||
sptr<ScreenSession> screenSession = GetScreenSession(screenId);
|
||||
if (screenSession == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "fail, cannot find screen %{public}" PRIu64"",
|
||||
screenId);
|
||||
return;
|
||||
}
|
||||
screenSession->SetPhysicalRotation(rotation, GetFoldStatus());
|
||||
screenSession->SetScreenComponentRotation(screenComponentRotation);
|
||||
TLOGI(WmsLogTag::DMS, "screenId: %{public}" PRIu64 ", rotation: %{public}f, screenComponentRotation: %{public}f",
|
||||
screenId, rotation, screenComponentRotation);
|
||||
}
|
||||
|
||||
void ScreenSessionManager::UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType)
|
||||
{
|
||||
@ -2612,7 +2626,6 @@ void ScreenSessionManager::UpdateScreenRotationProperty(ScreenId screenId, const
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock_info(displayInfoMutex_);
|
||||
screenSession->SetPhysicalRotation(rotation, GetFoldStatus());
|
||||
screenSession->UpdatePropertyAfterRotation(bounds, rotation, GetFoldDisplayMode());
|
||||
}
|
||||
sptr<DisplayInfo> displayInfo = screenSession->ConvertToDisplayInfo();
|
||||
|
@ -2455,6 +2455,41 @@ std::shared_ptr<RSDisplayNode> ScreenSessionManagerProxy::GetDisplayNode(ScreenI
|
||||
return displayNode;
|
||||
}
|
||||
|
||||
void ScreenSessionManagerProxy::UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation,
|
||||
float rotation)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
WLOGFE("UpdateScreenDirectionInfo: remote is null");
|
||||
return;
|
||||
}
|
||||
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteUint64(screenId)) {
|
||||
WLOGFE("Write screenId failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteFloat(screenComponentRotation)) {
|
||||
WLOGFE("Write screenComponentRotation failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteFloat(rotation)) {
|
||||
WLOGFE("Write rotation failed");
|
||||
return;
|
||||
}
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_DIRECTION_INFO),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSessionManagerProxy::UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType)
|
||||
{
|
||||
|
@ -695,6 +695,13 @@ int32_t ScreenSessionManagerStub::OnRemoteRequest(uint32_t code, MessageParcel&
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_DIRECTION_INFO: {
|
||||
auto screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
auto screenComponentRotation = data.ReadFloat();
|
||||
auto rotation = data.ReadFloat();
|
||||
UpdateScreenDirectionInfo(screenId, screenComponentRotation, rotation);
|
||||
break;
|
||||
}
|
||||
case DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_ROTATION_PROPERTY: {
|
||||
auto screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
RRect bounds;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
std::map<ScreenId, ScreenProperty> GetAllScreensProperties() const;
|
||||
FoldDisplayMode GetFoldDisplayMode() const;
|
||||
|
||||
void UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, float rotation,
|
||||
void UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, ScreenDirectionInfo directionInfo,
|
||||
ScreenPropertyChangeType screenPropertyChangeType);
|
||||
uint32_t GetCurvedCompressionArea();
|
||||
ScreenProperty GetPhyScreenProperty(ScreenId screenId);
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <system_ability_definition.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
#include <transaction/rs_interfaces.h>
|
||||
|
||||
#include "dm_common.h"
|
||||
#include "pipeline/rs_node_map.h"
|
||||
#include "window_manager_hilog.h"
|
||||
|
||||
@ -301,14 +301,16 @@ FoldDisplayMode ScreenSessionManagerClient::GetFoldDisplayMode() const
|
||||
return displayMode_;
|
||||
}
|
||||
|
||||
void ScreenSessionManagerClient::UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds, float rotation,
|
||||
ScreenPropertyChangeType screenPropertyChangeType)
|
||||
void ScreenSessionManagerClient::UpdateScreenRotationProperty(ScreenId screenId, const RRect& bounds,
|
||||
ScreenDirectionInfo directionInfo, ScreenPropertyChangeType screenPropertyChangeType)
|
||||
{
|
||||
if (!screenSessionManager_) {
|
||||
WLOGFE("screenSessionManager_ is null");
|
||||
return;
|
||||
}
|
||||
screenSessionManager_->UpdateScreenRotationProperty(screenId, bounds, rotation, screenPropertyChangeType);
|
||||
screenSessionManager_->UpdateScreenDirectionInfo(screenId, directionInfo.screenRotation_, directionInfo.rotation_);
|
||||
screenSessionManager_->UpdateScreenRotationProperty(screenId, bounds, directionInfo.notifyRotation_,
|
||||
screenPropertyChangeType);
|
||||
|
||||
// not need update property to input manager
|
||||
if (screenPropertyChangeType == ScreenPropertyChangeType::ROTATION_END ||
|
||||
@ -322,8 +324,9 @@ void ScreenSessionManagerClient::UpdateScreenRotationProperty(ScreenId screenId,
|
||||
}
|
||||
auto foldDisplayMode = screenSessionManager_->GetFoldDisplayMode();
|
||||
auto foldStatus = screenSessionManager_->GetFoldStatus();
|
||||
screenSession->SetPhysicalRotation(rotation, foldStatus);
|
||||
screenSession->UpdateToInputManager(bounds, rotation, foldDisplayMode);
|
||||
screenSession->SetPhysicalRotation(directionInfo.rotation_, foldStatus);
|
||||
screenSession->SetScreenComponentRotation(directionInfo.screenRotation_);
|
||||
screenSession->UpdateToInputManager(bounds, directionInfo.notifyRotation_, foldDisplayMode);
|
||||
}
|
||||
|
||||
void ScreenSessionManagerClient::SetDisplayNodeScreenId(ScreenId screenId, ScreenId displayNodeScreenId)
|
||||
|
@ -112,6 +112,9 @@ public:
|
||||
void SetPhysicalRotation(float rotation);
|
||||
float GetPhysicalRotation() const;
|
||||
|
||||
void SetScreenComponentRotation(float rotation);
|
||||
float GetScreenComponentRotation() const;
|
||||
|
||||
float GetXDpi() const;
|
||||
float GetYDpi() const;
|
||||
|
||||
@ -153,6 +156,7 @@ private:
|
||||
}
|
||||
float rotation_ { 0.0f };
|
||||
float physicalRotation_ { 0.0f };
|
||||
float screenComponentRotation_ { 0.0f };
|
||||
RRect bounds_;
|
||||
RRect phyBounds_;
|
||||
|
||||
|
@ -241,6 +241,7 @@ public:
|
||||
MirrorScreenType GetMirrorScreenType();
|
||||
Rotation ConvertIntToRotation(int rotation);
|
||||
void SetPhysicalRotation(int rotation, FoldStatus foldStatus);
|
||||
void SetScreenComponentRotation(int rotation);
|
||||
void SetStartPosition(uint32_t startX, uint32_t startY);
|
||||
void ScreenCaptureNotify(ScreenId mainScreenId, int32_t uid, const std::string& clientName);
|
||||
void SuperFoldStatusChange(ScreenId screenId, SuperFoldStatus superFoldStatus);
|
||||
|
@ -47,6 +47,16 @@ float ScreenProperty::GetPhysicalRotation() const
|
||||
return physicalRotation_;
|
||||
}
|
||||
|
||||
void ScreenProperty::SetScreenComponentRotation(float rotation)
|
||||
{
|
||||
screenComponentRotation_ = rotation;
|
||||
}
|
||||
|
||||
float ScreenProperty::GetScreenComponentRotation() const
|
||||
{
|
||||
return screenComponentRotation_;
|
||||
}
|
||||
|
||||
void ScreenProperty::SetBounds(const RRect& bounds)
|
||||
{
|
||||
bounds_ = bounds;
|
||||
|
@ -606,6 +606,12 @@ void ScreenSession::SetPhysicalRotation(int rotation, FoldStatus foldStatus)
|
||||
property_.GetPhysicalRotation(), rotation, offsetRotation);
|
||||
}
|
||||
|
||||
void ScreenSession::SetScreenComponentRotation(int rotation)
|
||||
{
|
||||
property_.SetScreenComponentRotation(static_cast<float>(rotation));
|
||||
WLOGFI("screenComponentRotation :%{public}f ", property_.GetScreenComponentRotation());
|
||||
}
|
||||
|
||||
void ScreenSession::UpdatePropertyAfterRotation(RRect bounds, int rotation, FoldDisplayMode foldDisplayMode)
|
||||
{
|
||||
Rotation targetRotation = ConvertIntToRotation(rotation);
|
||||
|
@ -256,6 +256,72 @@ HWTEST_F(ScreenPropertyTest, GetRotation, Function | SmallTest | Level2)
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: GetRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetPhysicalRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenPropertyTest, SetPhysicalRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhysicalRotation start";
|
||||
ScreenProperty* property = new(std::nothrow) ScreenProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
float rotation = 2.0f;
|
||||
property->SetPhysicalRotation(rotation);
|
||||
ASSERT_EQ(property->physicalRotation_, rotation);
|
||||
delete property;
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: SetPhysicalRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetPhysicalRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenPropertyTest, GetPhysicalRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhysicalRotation start";
|
||||
ScreenProperty* property = new(std::nothrow) ScreenProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
float rotation = property->GetPhysicalRotation();
|
||||
ASSERT_EQ(property->physicalRotation_, rotation);
|
||||
delete property;
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: GetPhysicalRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetScreenComponentRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenPropertyTest, SetScreenComponentRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenComponentRotation start";
|
||||
ScreenProperty* property = new(std::nothrow) ScreenProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
float rotation = 2.0f;
|
||||
property->SetScreenComponentRotation(rotation);
|
||||
ASSERT_EQ(property->screenComponentRotation_, rotation);
|
||||
delete property;
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: SetScreenComponentRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetScreenComponentRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenPropertyTest, GetScreenComponentRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenComponentRotation start";
|
||||
ScreenProperty* property = new(std::nothrow) ScreenProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
float rotation = property->GetScreenComponentRotation();
|
||||
ASSERT_EQ(property->screenComponentRotation_, rotation);
|
||||
delete property;
|
||||
GTEST_LOG_(INFO) << "ScreenPropertyTest: GetScreenComponentRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetBounds
|
||||
* @tc.desc: normal function
|
||||
|
@ -415,11 +415,14 @@ HWTEST_F(ScreenSessionManagerClientTest, UpdateScreenRotationProperty, Function
|
||||
RRect bounds;
|
||||
bounds.rect_.width_ = 1344;
|
||||
bounds.rect_.height_ = 2772;
|
||||
float rotation = 90;
|
||||
float scaleX = 1.0;
|
||||
float scaleY = 1.0;
|
||||
ScreenDirectionInfo directionInfo;
|
||||
directionInfo.notifyRotation_ = 90;
|
||||
directionInfo.screenRotation_ = 90;
|
||||
directionInfo.rotation_ = 90;
|
||||
ScreenPropertyChangeType screenPropertyChangeType = ScreenPropertyChangeType::ROTATION_BEGIN;
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, rotation,
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, directionInfo,
|
||||
screenPropertyChangeType);
|
||||
screenSessionManagerClient_->SetDisplayNodeScreenId(screenId, displayNodeScreenId);
|
||||
screenSessionManagerClient_->GetPhyScreenProperty(screenId);
|
||||
@ -445,9 +448,12 @@ HWTEST_F(ScreenSessionManagerClientTest, GetScreenSnapshot, Function | SmallTest
|
||||
RRect bounds;
|
||||
bounds.rect_.width_ = 1344;
|
||||
bounds.rect_.height_ = 2772;
|
||||
float rotation = 90;
|
||||
ScreenDirectionInfo directionInfo;
|
||||
directionInfo.notifyRotation_ = 90;
|
||||
directionInfo.screenRotation_ = 90;
|
||||
directionInfo.rotation_ = 90;
|
||||
ScreenPropertyChangeType screenPropertyChangeType = ScreenPropertyChangeType::ROTATION_BEGIN;
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, rotation,
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, directionInfo,
|
||||
screenPropertyChangeType);
|
||||
screenSessionManagerClient_->SetDisplayNodeScreenId(screenId, displayNodeScreenId);
|
||||
std::shared_ptr<Media::PixelMap> res = screenSessionManagerClient_->GetScreenSnapshot(screenId, scaleX, scaleY);
|
||||
@ -1270,11 +1276,14 @@ HWTEST_F(ScreenSessionManagerClientTest, UpdateScreenRotationProperty02, Functio
|
||||
RRect bounds;
|
||||
bounds.rect_.width_ = 1344;
|
||||
bounds.rect_.height_ = 2772;
|
||||
float rotation = 90;
|
||||
float scaleX = 1.0;
|
||||
float scaleY = 1.0;
|
||||
ScreenDirectionInfo directionInfo;
|
||||
directionInfo.notifyRotation_ = 90;
|
||||
directionInfo.screenRotation_ = 90;
|
||||
directionInfo.rotation_ = 90;
|
||||
ScreenPropertyChangeType screenPropertyChangeType = ScreenPropertyChangeType::ROTATION_BEGIN;
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, rotation,
|
||||
screenSessionManagerClient_->UpdateScreenRotationProperty(screenId, bounds, directionInfo,
|
||||
screenPropertyChangeType);
|
||||
screenSessionManagerClient_->SetDisplayNodeScreenId(screenId, displayNodeScreenId);
|
||||
screenSessionManagerClient_->GetPhyScreenProperty(screenId);
|
||||
|
@ -2874,6 +2874,27 @@ HWTEST_F(ScreenSessionManagerStubTest, OnRemoteRequest134, Function | SmallTest
|
||||
int res = stub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(res, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnRemoteRequest135
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionManagerStubTest, OnRemoteRequest135, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
data.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
|
||||
data.WriteUint64(0);
|
||||
data.WriteFloat(0);
|
||||
data.WriteFloat(0);
|
||||
uint32_t code = static_cast<uint32_t>(
|
||||
DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_DIRECTION_INFO);
|
||||
int res = stub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(res, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -382,6 +382,47 @@ HWTEST_F(ScreenSessionTest, GetVirtualScreenFlag, Function | SmallTest | Level2)
|
||||
GTEST_LOG_(INFO) << "GetVirtualScreenFlag end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetPhysicalRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionTest, SetPhysicalRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "SetPhysicalRotation start";
|
||||
ScreenSessionConfig config = {
|
||||
.screenId = 100,
|
||||
.rsId = 101,
|
||||
.name = "OpenHarmony",
|
||||
};
|
||||
sptr<ScreenSession> screenSession = new ScreenSession(config, ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);
|
||||
EXPECT_NE(nullptr, screenSession);
|
||||
int rotation = 0;
|
||||
FoldStatus foldStatus = FoldStatus::UNKNOWN;
|
||||
screenSession->SetPhysicalRotation(rotation, foldStatus);
|
||||
GTEST_LOG_(INFO) << "SetPhysicalRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetScreenComponentRotation
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionTest, SetScreenComponentRotation, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "SetScreenComponentRotation start";
|
||||
ScreenSessionConfig config = {
|
||||
.screenId = 100,
|
||||
.rsId = 101,
|
||||
.name = "OpenHarmony",
|
||||
};
|
||||
sptr<ScreenSession> screenSession = new ScreenSession(config, ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);
|
||||
EXPECT_NE(nullptr, screenSession);
|
||||
int rotation = 0;
|
||||
screenSession->SetScreenComponentRotation(rotation);
|
||||
GTEST_LOG_(INFO) << "SetScreenComponentRotation end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateToInputManager
|
||||
* @tc.desc: normal function
|
||||
|
Loading…
Reference in New Issue
Block a user