mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
解冲突
Signed-off-by: 苏嵋岩 <sumeiyan@huawei.com>
This commit is contained in:
commit
28f77b84b4
@ -61,6 +61,7 @@ public:
|
||||
virtual void SetFoldDisplayMode(const FoldDisplayMode);
|
||||
virtual sptr<DisplayInfo> GetDisplayInfo(DisplayId displayId);
|
||||
virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId);
|
||||
virtual VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId);
|
||||
/*
|
||||
* used by powermgr
|
||||
*/
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
virtual sptr<DisplayInfo> GetDefaultDisplayInfo();
|
||||
virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId);
|
||||
virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId);
|
||||
virtual VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId);
|
||||
/*
|
||||
* used by powermgr
|
||||
*/
|
||||
|
@ -238,6 +238,16 @@ std::vector<DisplayId> DisplayManagerAdapterLite::GetAllDisplayIds()
|
||||
return displayManagerServiceProxy_->GetAllDisplayIds();
|
||||
}
|
||||
|
||||
VirtualScreenFlag DisplayManagerAdapterLite::GetVirtualScreenFlag(ScreenId screenId)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(VirtualScreenFlag::DEFAULT);
|
||||
if (screenId == SCREEN_ID_INVALID) {
|
||||
WLOGFE("screenId id is invalid");
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
return displayManagerServiceProxy_->GetVirtualScreenFlag(screenId);
|
||||
}
|
||||
|
||||
bool ScreenManagerAdapterLite::SetSpecifiedScreenPower(ScreenId screenId, ScreenPowerState state,
|
||||
PowerStateChangeReason reason)
|
||||
{
|
||||
|
@ -706,4 +706,9 @@ std::vector<DisplayId> DisplayManagerLite::GetAllDisplayIds()
|
||||
return SingletonContainer::Get<DisplayManagerAdapterLite>().GetAllDisplayIds();
|
||||
}
|
||||
|
||||
VirtualScreenFlag DisplayManagerLite::GetVirtualScreenFlag(ScreenId screenId)
|
||||
{
|
||||
return SingletonContainer::Get<DisplayManagerAdapterLite>().GetVirtualScreenFlag(screenId);
|
||||
}
|
||||
|
||||
} // namespace OHOS::Rosen
|
@ -289,6 +289,37 @@ sptr<CutoutInfo> DisplayManagerLiteProxy::GetCutoutInfo(DisplayId displayId)
|
||||
sptr<CutoutInfo> info = reply.ReadParcelable<CutoutInfo>();
|
||||
return info;
|
||||
}
|
||||
|
||||
VirtualScreenFlag DisplayManagerLiteProxy::GetVirtualScreenFlag(ScreenId screenId)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
WLOGFE("GetVirtualScreenFlag: remote is null");
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
|
||||
if (screenId == SCREEN_ID_INVALID) {
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageParcel reply;
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
if (!data.WriteUint64(screenId)) {
|
||||
WLOGFE("Write screenId failed");
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_VIRTUAL_SCREEN_FLAG),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return VirtualScreenFlag::DEFAULT;
|
||||
}
|
||||
return static_cast<VirtualScreenFlag>(reply.ReadUint32());
|
||||
}
|
||||
|
||||
/*
|
||||
* used by powermgr
|
||||
*/
|
||||
|
@ -81,11 +81,16 @@ napi_value AttachWindowExtensionContext(napi_env env, void* value, void *)
|
||||
WLOGFE("Failed to get window extension context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_wrap(env, contextObj, workContext,
|
||||
[](napi_env, void* data, void *) {
|
||||
WLOGI("Finalizer for weak_ptr service extension context is called");
|
||||
delete static_cast<std::weak_ptr<WindowExtensionContext> *>(data);
|
||||
}, nullptr, nullptr);
|
||||
napi_status status = napi_wrap(env, contextObj, workContext,
|
||||
[](napi_env, void* data, void *) {
|
||||
WLOGI("Finalizer for weak_ptr service extension context is called");
|
||||
delete static_cast<std::weak_ptr<WindowExtensionContext> *>(data);
|
||||
}, nullptr, nullptr);
|
||||
if (status != napi_ok) {
|
||||
WLOGFE("Failed to call napi_wrap");
|
||||
delete workContext;
|
||||
return nullptr;
|
||||
}
|
||||
return contextObj;
|
||||
}
|
||||
|
||||
@ -173,11 +178,16 @@ void JsWindowExtension::BindContext(napi_env env, napi_value obj)
|
||||
WLOGI("JsWindowExtension::SetProperty.");
|
||||
napi_set_named_property(env, obj, "context", contextObj);
|
||||
|
||||
napi_wrap(env, contextObj, workContext,
|
||||
[](napi_env, void* data, void *) {
|
||||
WLOGI("Finalizer for weak_ptr extension context is called");
|
||||
delete static_cast<std::weak_ptr<WindowExtensionContext>*>(data);
|
||||
}, nullptr, nullptr);
|
||||
napi_status status = napi_wrap(env, contextObj, workContext,
|
||||
[](napi_env, void* data, void *) {
|
||||
WLOGI("Finalizer for weak_ptr extension context is called");
|
||||
delete static_cast<std::weak_ptr<WindowExtensionContext>*>(data);
|
||||
}, nullptr, nullptr);
|
||||
if (status != napi_ok) {
|
||||
WLOGFE("Failed to call napi_wrap");
|
||||
delete workContext;
|
||||
return;
|
||||
}
|
||||
WLOGI("JsWindowExtension::Init end.");
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,12 @@ enum class EventStatus : uint32_t {
|
||||
END,
|
||||
};
|
||||
|
||||
enum class VirtualScreenFlag : uint32_t {
|
||||
DEFAULT = 0,
|
||||
CAST = 1,
|
||||
MAX = 2,
|
||||
};
|
||||
|
||||
class IDisplayPowerEventListener : public RefBase {
|
||||
public:
|
||||
/**
|
||||
|
@ -39,12 +39,6 @@ struct VirtualScreenOption {
|
||||
std::vector<uint64_t> missionIds_ {};
|
||||
};
|
||||
|
||||
enum class VirtualScreenFlag : uint32_t {
|
||||
DEFAULT = 0,
|
||||
CAST = 1,
|
||||
MAX = 2,
|
||||
};
|
||||
|
||||
class Screen : public RefBase {
|
||||
friend class ScreenManager;
|
||||
public:
|
||||
|
@ -263,6 +263,14 @@ public:
|
||||
* @return All display IDs.
|
||||
*/
|
||||
std::vector<DisplayId> GetAllDisplayIds();
|
||||
|
||||
/**
|
||||
* @brief Get virtual screen flag.
|
||||
*
|
||||
* @param screenId virtual screen id.
|
||||
* @return virtual screen flag
|
||||
*/
|
||||
VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId);
|
||||
private:
|
||||
DisplayManagerLite();
|
||||
~DisplayManagerLite();
|
||||
|
@ -796,11 +796,13 @@ struct KeyboardPanelInfo : public Parcelable {
|
||||
* @brief Enumerates avoid area type.
|
||||
*/
|
||||
enum class AvoidAreaType : uint32_t {
|
||||
TYPE_SYSTEM, // area of SystemUI
|
||||
TYPE_CUTOUT, // cutout of screen
|
||||
TYPE_SYSTEM_GESTURE, // area for system gesture
|
||||
TYPE_KEYBOARD, // area for soft input keyboard
|
||||
TYPE_NAVIGATION_INDICATOR, // area for navigation indicator
|
||||
TYPE_START = 0,
|
||||
TYPE_SYSTEM = TYPE_START, // area of SystemUI
|
||||
TYPE_CUTOUT, // cutout of screen
|
||||
TYPE_SYSTEM_GESTURE, // area for system gesture
|
||||
TYPE_KEYBOARD, // area for soft input keyboard
|
||||
TYPE_NAVIGATION_INDICATOR, // area for navigation indicator
|
||||
TYPE_END,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -402,7 +402,7 @@ int32_t CJWindowImpl::GetWindowAvoidArea(uint32_t areaType, CAvoidArea* retPtr)
|
||||
return static_cast<int32_t>(WmErrorCode::WM_ERROR_STATE_ABNORMALLY);
|
||||
}
|
||||
AvoidAreaType avoidAreaType = static_cast<AvoidAreaType>(areaType);
|
||||
if ((avoidAreaType > AvoidAreaType::TYPE_NAVIGATION_INDICATOR) || (avoidAreaType < AvoidAreaType::TYPE_SYSTEM)) {
|
||||
if (avoidAreaType >= AvoidAreaType::TYPE_END) {
|
||||
return static_cast<int32_t>(WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
AvoidArea avoidArea;
|
||||
|
@ -668,8 +668,7 @@ napi_value JsExtensionWindow::OnGetWindowAvoidArea(napi_env env, napi_callback_i
|
||||
uint32_t resultValue = 0;
|
||||
napi_get_value_uint32(env, nativeMode, &resultValue);
|
||||
avoidAreaType = static_cast<AvoidAreaType>(resultValue);
|
||||
errCode = ((avoidAreaType > AvoidAreaType::TYPE_NAVIGATION_INDICATOR) ||
|
||||
(avoidAreaType < AvoidAreaType::TYPE_SYSTEM)) ?
|
||||
errCode = avoidAreaType >= AvoidAreaType::TYPE_END ?
|
||||
WmErrorCode::WM_ERROR_INVALID_PARAM : WmErrorCode::WM_OK;
|
||||
}
|
||||
if (errCode == WmErrorCode::WM_ERROR_INVALID_PARAM) {
|
||||
|
@ -3141,8 +3141,8 @@ static void ParseAvoidAreaParam(napi_env env, napi_callback_info info, WMError&
|
||||
CHECK_NAPI_RETCODE(errCode, WMError::WM_ERROR_INVALID_PARAM,
|
||||
napi_get_value_uint32(env, nativeMode, &resultValue));
|
||||
avoidAreaType = static_cast<AvoidAreaType>(resultValue);
|
||||
errCode = ((avoidAreaType > AvoidAreaType::TYPE_KEYBOARD) ||
|
||||
(avoidAreaType < AvoidAreaType::TYPE_SYSTEM)) ? WMError::WM_ERROR_INVALID_PARAM : WMError::WM_OK;
|
||||
errCode = avoidAreaType > AvoidAreaType::TYPE_KEYBOARD ?
|
||||
WMError::WM_ERROR_INVALID_PARAM : WMError::WM_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3215,8 +3215,7 @@ napi_value JsWindow::OnGetWindowAvoidAreaSync(napi_env env, napi_callback_info i
|
||||
CHECK_NAPI_RETCODE(errCode, WmErrorCode::WM_ERROR_INVALID_PARAM,
|
||||
napi_get_value_uint32(env, nativeMode, &resultValue));
|
||||
avoidAreaType = static_cast<AvoidAreaType>(resultValue);
|
||||
errCode = ((avoidAreaType > AvoidAreaType::TYPE_NAVIGATION_INDICATOR) ||
|
||||
(avoidAreaType < AvoidAreaType::TYPE_SYSTEM)) ?
|
||||
errCode = avoidAreaType >= AvoidAreaType::TYPE_END ?
|
||||
WmErrorCode::WM_ERROR_INVALID_PARAM : WmErrorCode::WM_OK;
|
||||
}
|
||||
if (errCode == WmErrorCode::WM_ERROR_INVALID_PARAM) {
|
||||
@ -3628,8 +3627,8 @@ napi_value JsWindow::OnSetWindowBrightness(napi_env env, napi_callback_info info
|
||||
} else {
|
||||
task.Reject(env, JsErrUtils::CreateJsError(env, ret, "Window set brightness failed"));
|
||||
}
|
||||
WLOGI("Window [%{public}u, %{public}s] set brightness end",
|
||||
weakWindow->GetWindowId(), weakWindow->GetWindowName().c_str());
|
||||
TLOGI(WmsLogTag::DEFAULT, "Window [%{public}u, %{public}s] set brightness end, state: %{public}d",
|
||||
weakWindow->GetWindowId(), weakWindow->GetWindowName().c_str(), ret);
|
||||
};
|
||||
|
||||
napi_value lastParam = (argc <= 1) ? nullptr :
|
||||
|
@ -547,11 +547,13 @@ struct SystemBarProperty {
|
||||
* @brief Enumerates avoid area type.
|
||||
*/
|
||||
enum class AvoidAreaType : uint32_t {
|
||||
TYPE_SYSTEM, // area of SystemUI
|
||||
TYPE_CUTOUT, // cutout of screen
|
||||
TYPE_SYSTEM_GESTURE, // area for system gesture
|
||||
TYPE_KEYBOARD, // area for soft input keyboard
|
||||
TYPE_NAVIGATION_INDICATOR, // area for navigation indicator
|
||||
TYPE_START = 0,
|
||||
TYPE_SYSTEM = TYPE_START, // area of SystemUI
|
||||
TYPE_CUTOUT, // cutout of screen
|
||||
TYPE_SYSTEM_GESTURE, // area for system gesture
|
||||
TYPE_KEYBOARD, // area for soft input keyboard
|
||||
TYPE_NAVIGATION_INDICATOR, // area for navigation indicator
|
||||
TYPE_END,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -376,7 +376,6 @@ sptr<SceneSession> JsRootSceneSession::GenSceneSession(SessionInfo& info)
|
||||
sceneSession->SetSessionInfoPersistentId(sceneSession->GetPersistentId());
|
||||
}
|
||||
}
|
||||
sceneSession->SetSessionInfoProcessOptions(info.processOptions);
|
||||
return sceneSession;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -467,7 +467,7 @@ void JsSceneSession::ProcessWindowDragHotAreaRegister()
|
||||
{
|
||||
WLOGFI("[NAPI]");
|
||||
NotifyWindowDragHotAreaFunc func = [weakThis = wptr(this)](
|
||||
DisplayId displayId, uint32_t type, const SizeChangeReason reason) {
|
||||
DisplayId displayId, uint32_t type, SizeChangeReason reason) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessWindowDragHotAreaRegister jsSceneSession is null");
|
||||
@ -483,7 +483,7 @@ void JsSceneSession::ProcessWindowDragHotAreaRegister()
|
||||
session->SetWindowDragHotAreaListener(func);
|
||||
}
|
||||
|
||||
void JsSceneSession::OnWindowDragHotArea(DisplayId displayId, uint32_t type, const SizeChangeReason reason)
|
||||
void JsSceneSession::OnWindowDragHotArea(DisplayId displayId, uint32_t type, SizeChangeReason reason)
|
||||
{
|
||||
WLOGFI("[NAPI]");
|
||||
|
||||
@ -1030,7 +1030,7 @@ void JsSceneSession::ProcessBindDialogTargetRegister()
|
||||
void JsSceneSession::ProcessSessionRectChangeRegister()
|
||||
{
|
||||
NotifySessionRectChangeFunc func = [weakThis = wptr(this)](const WSRect& rect,
|
||||
const SizeChangeReason reason, const DisplayId displayId = DISPLAY_ID_INVALID) {
|
||||
SizeChangeReason reason, DisplayId displayId = DISPLAY_ID_INVALID) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessSessionRectChangeRegister jsSceneSession is null");
|
||||
@ -1288,13 +1288,14 @@ void JsSceneSession::ProcessPendingSessionToBackgroundForDelegatorRegister()
|
||||
void JsSceneSession::ProcessSessionExceptionRegister()
|
||||
{
|
||||
WLOGFD("in");
|
||||
NotifySessionExceptionFunc func = [weakThis = wptr(this)](const SessionInfo& info, bool needRemoveSession) {
|
||||
NotifySessionExceptionFunc func = [weakThis = wptr(this)](
|
||||
const SessionInfo& info, bool needRemoveSession, bool startFail) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessSessionExceptionRegister jsSceneSession is null");
|
||||
return;
|
||||
}
|
||||
jsSceneSession->OnSessionException(info, needRemoveSession);
|
||||
jsSceneSession->OnSessionException(info, needRemoveSession, startFail);
|
||||
};
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
@ -1432,13 +1433,13 @@ void JsSceneSession::ProcessSessionTouchableChangeRegister()
|
||||
|
||||
void JsSceneSession::ProcessClickRegister()
|
||||
{
|
||||
NotifyClickFunc func = [weakThis = wptr(this)](bool requestFocus) {
|
||||
NotifyClickFunc func = [weakThis = wptr(this)](bool requestFocus, bool isClick) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessClickRegister jsSceneSession is null");
|
||||
return;
|
||||
}
|
||||
jsSceneSession->OnClick(requestFocus);
|
||||
jsSceneSession->OnClick(requestFocus, isClick);
|
||||
};
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
@ -2838,7 +2839,7 @@ void JsSceneSession::OnBufferAvailableChange(const bool isBufferAvailable)
|
||||
}
|
||||
|
||||
/** @note @window.layout */
|
||||
void JsSceneSession::OnSessionRectChange(const WSRect& rect, const SizeChangeReason reason, const DisplayId displayId)
|
||||
void JsSceneSession::OnSessionRectChange(const WSRect& rect, SizeChangeReason reason, DisplayId displayId)
|
||||
{
|
||||
if (reason != SizeChangeReason::MOVE && reason != SizeChangeReason::PIP_RESTORE && rect.IsEmpty()) {
|
||||
WLOGFD("Rect is empty, there is no need to notify");
|
||||
@ -3141,10 +3142,11 @@ void JsSceneSession::OnMainSessionModalTypeChange(bool isModal)
|
||||
"OnMainSessionModalTypeChange: " + std::to_string(static_cast<uint32_t>(isModal)));
|
||||
}
|
||||
|
||||
void JsSceneSession::OnClick(bool requestFocus)
|
||||
void JsSceneSession::OnClick(bool requestFocus, bool isClick)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "[NAPI] id: %{public}d, requestFocus: %{public}u", persistentId_, requestFocus);
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_, requestFocus, env = env_] {
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "[NAPI] id: %{public}d, requestFocus: %{public}u, isClick: %{public}u",
|
||||
persistentId_, requestFocus, isClick);
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_, requestFocus, isClick, env = env_] {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession || jsSceneSessionMap_.find(persistentId) == jsSceneSessionMap_.end()) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "OnClick jsSceneSession id:%{public}d has been destroyed",
|
||||
@ -3157,7 +3159,8 @@ void JsSceneSession::OnClick(bool requestFocus)
|
||||
return;
|
||||
}
|
||||
napi_value jsRequestFocusObj = CreateJsValue(env, requestFocus);
|
||||
napi_value argv[] = {jsRequestFocusObj};
|
||||
napi_value jsIsClickObj = CreateJsValue(env, isClick);
|
||||
napi_value argv[] = {jsRequestFocusObj, jsIsClickObj};
|
||||
napi_call_function(env, NapiGetUndefined(env), jsCallBack->GetNapiValue(), ArraySize(argv), argv, nullptr);
|
||||
};
|
||||
taskScheduler_->PostMainThreadTask(task, "OnClick: requestFocus" + std::to_string(requestFocus));
|
||||
@ -3276,7 +3279,6 @@ sptr<SceneSession> JsSceneSession::GenSceneSession(SessionInfo& info)
|
||||
sceneSession->SetSessionInfo(info);
|
||||
}
|
||||
}
|
||||
sceneSession->SetSessionInfoProcessOptions(info.processOptions);
|
||||
return sceneSession;
|
||||
}
|
||||
|
||||
@ -3575,13 +3577,14 @@ void JsSceneSession::UpdateSessionIcon(const std::string& iconPath)
|
||||
taskScheduler_->PostMainThreadTask(task, "UpdateSessionIcon");
|
||||
}
|
||||
|
||||
void JsSceneSession::OnSessionException(const SessionInfo& info, bool needRemoveSession)
|
||||
void JsSceneSession::OnSessionException(const SessionInfo& info, bool needRemoveSession, bool startFail)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "[NAPI]bundleName = %{public}s, abilityName = %{public}s",
|
||||
info.bundleName_.c_str(), info.abilityName_.c_str());
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "[NAPI]bundleName = %{public}s, abilityName = %{public}s, startFail = %{public}d",
|
||||
info.bundleName_.c_str(), info.abilityName_.c_str(), startFail);
|
||||
|
||||
std::shared_ptr<SessionInfo> sessionInfo = std::make_shared<SessionInfo>(info);
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_, sessionInfo, needRemoveSession, env = env_] {
|
||||
auto task = [weakThis = wptr(this), persistentId = persistentId_,
|
||||
sessionInfo, needRemoveSession, startFail, env = env_] {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession || jsSceneSessionMap_.find(persistentId) == jsSceneSessionMap_.end()) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "OnSessionException jsSceneSession id:%{public}d has been destroyed",
|
||||
@ -3599,11 +3602,12 @@ void JsSceneSession::OnSessionException(const SessionInfo& info, bool needRemove
|
||||
}
|
||||
napi_value jsSessionInfo = CreateJsSessionInfo(env, *sessionInfo);
|
||||
napi_value jsNeedRemoveSession = CreateJsValue(env, needRemoveSession);
|
||||
napi_value jsStartFail = CreateJsValue(env, startFail);
|
||||
if (jsSessionInfo == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "[NAPI]target session info is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_value argv[] = {jsSessionInfo, jsNeedRemoveSession};
|
||||
napi_value argv[] = {jsSessionInfo, jsNeedRemoveSession, jsStartFail};
|
||||
napi_call_function(env, NapiGetUndefined(env), jsCallBack->GetNapiValue(), ArraySize(argv), argv, nullptr);
|
||||
};
|
||||
taskScheduler_->PostMainThreadTask(task, "OnSessionException, name" + info.bundleName_);
|
||||
|
@ -275,7 +275,7 @@ private:
|
||||
void OnCreateSubSession(const sptr<SceneSession>& sceneSession);
|
||||
void OnBindDialogTarget(const sptr<SceneSession>& sceneSession);
|
||||
void OnSessionRectChange(const WSRect& rect,
|
||||
const SizeChangeReason reason = SizeChangeReason::UNDEFINED, const DisplayId displayId = DISPLAY_ID_INVALID);
|
||||
SizeChangeReason reason = SizeChangeReason::UNDEFINED, DisplayId displayId = DISPLAY_ID_INVALID);
|
||||
void OnSessionPiPControlStatusChange(WsPiPControlType controlType, WsPiPControlStatus status);
|
||||
void OnAutoStartPiPStatusChange(bool isAutoStart, uint32_t priority);
|
||||
void OnRaiseToTop();
|
||||
@ -289,13 +289,13 @@ private:
|
||||
void OnMainWindowTopmostChange(bool isTopmost);
|
||||
void OnSessionModalTypeChange(SubWindowModalType subWindowModalType);
|
||||
void OnMainSessionModalTypeChange(bool isModal);
|
||||
void OnClick(bool requestFocus);
|
||||
void OnClick(bool requestFocus, bool isClick);
|
||||
void TerminateSession(const SessionInfo& info);
|
||||
void TerminateSessionNew(const SessionInfo& info, bool needStartCaller, bool isFromBroker);
|
||||
void TerminateSessionTotal(const SessionInfo& info, TerminateType terminateType);
|
||||
void UpdateSessionLabel(const std::string& label);
|
||||
void UpdateSessionIcon(const std::string& iconPath);
|
||||
void OnSessionException(const SessionInfo& info, bool needRemoveSession);
|
||||
void OnSessionException(const SessionInfo& info, bool needRemoveSession, bool startFail);
|
||||
void OnSystemBarPropertyChange(const std::unordered_map<WindowType, SystemBarProperty>& propertyMap);
|
||||
void OnNeedAvoid(bool status);
|
||||
void PendingSessionToForeground(const SessionInfo& info);
|
||||
@ -305,7 +305,7 @@ private:
|
||||
void OnShowWhenLocked(bool showWhenLocked);
|
||||
void OnReuqestedOrientationChange(uint32_t orientation);
|
||||
void OnForceHideChange(bool hide);
|
||||
void OnWindowDragHotArea(DisplayId displayId, uint32_t type, const SizeChangeReason reason);
|
||||
void OnWindowDragHotArea(DisplayId displayId, uint32_t type, SizeChangeReason reason);
|
||||
void OnTouchOutside();
|
||||
void OnSessionInfoLockedStateChange(bool lockedState);
|
||||
void OnPrepareClosePiPSession();
|
||||
|
@ -144,6 +144,7 @@ napi_value JsSceneSessionManager::Init(napi_env env, napi_value exportObj)
|
||||
JsSceneSessionManager::InitWithRenderServiceAdded);
|
||||
BindNativeFunction(env, exportObj, "getAllAbilityInfo", moduleName, JsSceneSessionManager::GetAllAbilityInfos);
|
||||
BindNativeFunction(env, exportObj, "getBatchAbilityInfos", moduleName, JsSceneSessionManager::GetBatchAbilityInfos);
|
||||
BindNativeFunction(env, exportObj, "getAbilityInfo", moduleName, JsSceneSessionManager::GetAbilityInfo);
|
||||
BindNativeFunction(env, exportObj, "getAllWindowVisibilityInfos", moduleName,
|
||||
JsSceneSessionManager::GetAllWindowVisibilityInfos);
|
||||
BindNativeFunction(env, exportObj, "prepareTerminate", moduleName, JsSceneSessionManager::PrepareTerminate);
|
||||
@ -816,6 +817,13 @@ napi_value JsSceneSessionManager::GetBatchAbilityInfos(napi_env env, napi_callba
|
||||
return (me != nullptr) ? me->OnGetBatchAbilityInfos(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsSceneSessionManager::GetAbilityInfo(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_SCB, "[NAPI]");
|
||||
JsSceneSessionManager* me = CheckParamsAndGetThis<JsSceneSessionManager>(env, info);
|
||||
return (me != nullptr) ? me->OnGetAbilityInfo(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsSceneSessionManager::PrepareTerminate(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGFD("[NAPI]");
|
||||
@ -1422,6 +1430,55 @@ napi_value JsSceneSessionManager::OnGetBatchAbilityInfos(napi_env env, napi_call
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value JsSceneSessionManager::OnGetAbilityInfo(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = DEFAULT_ARG_COUNT;
|
||||
napi_value argv[DEFAULT_ARG_COUNT] = { nullptr };
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc != ARGC_FOUR) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "[NAPI]Argc is invalid: %{public}zu", argc);
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
std::string bundleName;
|
||||
if (!ConvertFromJsValue(env, argv[0], bundleName)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "[NAPI]Failed to convert parameter to bundleName");
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
std::string moduleName;
|
||||
if (!ConvertFromJsValue(env, argv[ARG_INDEX_ONE], moduleName)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "[NAPI]Failed to convert parameter to moduleName");
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
std::string abilityName;
|
||||
if (!ConvertFromJsValue(env, argv[ARG_INDEX_TWO], abilityName)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "[NAPI]Failed to convert parameter to abilityName");
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
int32_t userId = 0;
|
||||
if (!ConvertFromJsValue(env, argv[ARG_INDEX_THREE], userId)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "[NAPI]Failed to convert parameter to userId");
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_INVALID_PARAM),
|
||||
"Input parameter is missing or invalid"));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
SCBAbilityInfo scbAbilityInfo;
|
||||
WSErrorCode ret = WS_JS_TO_ERROR_CODE_MAP.at(SceneSessionManager::GetInstance().GetAbilityInfo(
|
||||
bundleName, moduleName, abilityName, userId, scbAbilityInfo));
|
||||
if (ret != WSErrorCode::WS_OK) {
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(WSErrorCode::WS_ERROR_STATE_ABNORMALLY),
|
||||
"System is abnormal"));
|
||||
}
|
||||
return CreateSCBAbilityInfo(env, scbAbilityInfo);
|
||||
}
|
||||
|
||||
napi_value JsSceneSessionManager::OnInitUserInfo(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 4;
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
static napi_value GetAllWindowVisibilityInfos(napi_env env, napi_callback_info info);
|
||||
static napi_value GetAllAbilityInfos(napi_env env, napi_callback_info info);
|
||||
static napi_value GetBatchAbilityInfos(napi_env env, napi_callback_info info);
|
||||
static napi_value GetAbilityInfo(napi_env env, napi_callback_info info);
|
||||
static napi_value PrepareTerminate(napi_env env, napi_callback_info info);
|
||||
static napi_value PerfRequestEx(napi_env env, napi_callback_info info);
|
||||
static napi_value UpdateWindowMode(napi_env env, napi_callback_info info);
|
||||
@ -147,6 +148,7 @@ private:
|
||||
napi_value OnGetAllWindowVisibilityInfos(napi_env env, napi_callback_info info);
|
||||
napi_value OnGetAllAbilityInfos(napi_env env, napi_callback_info info);
|
||||
napi_value OnGetBatchAbilityInfos(napi_env env, napi_callback_info info);
|
||||
napi_value OnGetAbilityInfo(napi_env env, napi_callback_info info);
|
||||
napi_value OnPrepareTerminate(napi_env env, napi_callback_info info);
|
||||
napi_value OnPerfRequestEx(napi_env env, napi_callback_info info);
|
||||
napi_value OnUpdateWindowMode(napi_env env, napi_callback_info info);
|
||||
|
@ -53,7 +53,6 @@ napi_value JsScreenSessionManager::Init(napi_env env, napi_value exportObj)
|
||||
TLOGE(WmsLogTag::DMS, "Failed to init, env or exportObj is null!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<JsScreenSessionManager> jsScreenSessionManager = new (std::nothrow) JsScreenSessionManager(env);
|
||||
if (jsScreenSessionManager == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "Failed to create, jsScreenSessionManager is null");
|
||||
@ -70,6 +69,8 @@ napi_value JsScreenSessionManager::Init(napi_env env, napi_value exportObj)
|
||||
JsScreenUtils::CreateJsFoldStatus(env));
|
||||
napi_set_named_property(env, exportObj, "ScreenPropertyChangeType",
|
||||
JsScreenUtils::CreateJsScreenPropertyChangeType(env));
|
||||
napi_set_named_property(env, exportObj, "SuperFoldStatus",
|
||||
JsScreenUtils::CreateJsSuperFoldStatus(env));
|
||||
|
||||
const char* moduleName = "JsScreenSessionManager";
|
||||
BindNativeFunction(env, exportObj, "on", moduleName, JsScreenSessionManager::RegisterCallback);
|
||||
|
@ -162,6 +162,28 @@ napi_value JsScreenUtils::CreateJsScreenPropertyChangeType(napi_env env)
|
||||
return objValue;
|
||||
}
|
||||
|
||||
napi_value JsScreenUtils::CreateJsSuperFoldStatus(napi_env env)
|
||||
{
|
||||
napi_value objValue = nullptr;
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr) {
|
||||
WLOGFE("Failed to create object!");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
napi_set_named_property(env, objValue, "SUPER_FOLD_STATUS_UNKNOWN", CreateJsValue(env,
|
||||
static_cast<int32_t>(SuperFoldStatus::UNKNOWN)));
|
||||
napi_set_named_property(env, objValue, "SUPER_FOLD_STATUS_EXPANDED", CreateJsValue(env,
|
||||
static_cast<int32_t>(SuperFoldStatus::EXPANDED)));
|
||||
napi_set_named_property(env, objValue, "SUPER_FOLD_STATUS_FOLDED", CreateJsValue(env,
|
||||
static_cast<int32_t>(SuperFoldStatus::FOLDED)));
|
||||
napi_set_named_property(env, objValue, "SUPER_FOLD_STATUS_HALF_FOLDED", CreateJsValue(env,
|
||||
static_cast<int32_t>(SuperFoldStatus::HALF_FOLDED)));
|
||||
napi_set_named_property(env, objValue, "SUPER_FOLD_STATUS_KEYBOARD", CreateJsValue(env,
|
||||
static_cast<int32_t>(SuperFoldStatus::KEYBOARD)));
|
||||
return objValue;
|
||||
}
|
||||
|
||||
bool ConvertRRectFromJs(napi_env env, napi_value jsObject, RRect& bound)
|
||||
{
|
||||
napi_value jsLeft = nullptr, jsTop = nullptr, jsWidth = nullptr, jsHeight = nullptr, jsRadius = nullptr;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
static napi_value CreateJsScreenPropertyChangeReason(napi_env env);
|
||||
static napi_value CreateJsFoldStatus(napi_env env);
|
||||
static napi_value CreateJsScreenPropertyChangeType(napi_env env);
|
||||
static napi_value CreateJsSuperFoldStatus(napi_env env);
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
|
@ -52,15 +52,11 @@ public:
|
||||
|
||||
void HandleHallData(const SensorEvent * const event);
|
||||
|
||||
void HandleSuperSensorChange();
|
||||
|
||||
void SetHasKeyboard(bool flag);
|
||||
void HandleSuperSensorChange(SuperFoldStatusChangeEvents events);
|
||||
|
||||
private:
|
||||
|
||||
std::recursive_mutex mutex_;
|
||||
|
||||
SuperFoldStatusChangeEvents events_ = SuperFoldStatusChangeEvents::UNDEFINED;
|
||||
|
||||
SensorUser postureUser {};
|
||||
|
||||
|
@ -497,9 +497,9 @@ void SingleDisplayPocketFoldPolicy::ChangeScreenDisplayModeToCoordination()
|
||||
// on main screen
|
||||
auto taskScreenOnMainOn = [=] {
|
||||
TLOGI(WmsLogTag::DMS, "ChangeScreenDisplayModeToCoordination: screenIdMain ON.");
|
||||
NotifyRefreshRateEvent(true);
|
||||
ChangeScreenDisplayModePower(SCREEN_ID_MAIN, ScreenPowerStatus::POWER_STATUS_ON);
|
||||
PowerMgr::PowerMgrClient::GetInstance().RefreshActivity();
|
||||
NotifyRefreshRateEvent(true);
|
||||
};
|
||||
screenPowerTaskScheduler_->PostAsyncTask(taskScreenOnMainOn, "ScreenToCoordinationTask");
|
||||
AddOrRemoveDisplayNodeToTree(SCREEN_ID_MAIN, ADD_DISPLAY_NODE);
|
||||
@ -539,7 +539,7 @@ void SingleDisplayPocketFoldPolicy::ExitCoordination()
|
||||
void SingleDisplayPocketFoldPolicy::NotifyRefreshRateEvent(bool isEventStatus)
|
||||
{
|
||||
EventInfo eventInfo = {
|
||||
.eventName = "VOTER_VIRTUALDISPLAY",
|
||||
.eventName = "VOTER_MULTISELFOWNEDSCREEN",
|
||||
.eventStatus = isEventStatus,
|
||||
.minRefreshRate = 60,
|
||||
.maxRefreshRate = 60,
|
||||
|
@ -32,6 +32,7 @@ namespace {
|
||||
constexpr float ANGLE_MIN_VAL = 30.0F;
|
||||
constexpr float ANGLE_MAX_VAL = 180.0F;
|
||||
constexpr float ANGLE_FLAT_THRESHOLD = 150.0F;
|
||||
constexpr float ANGLE_SENSOR_THRESHOLD = 177.0F;
|
||||
constexpr float ANGLE_HALF_FOLD_THRESHOLD = 135.0F;
|
||||
constexpr uint16_t HALL_HAVE_KEYBOARD_THRESHOLD = 0B0100;
|
||||
constexpr uint16_t HALL_REMOVE_KEYBOARD_THRESHOLD = 0B0000;
|
||||
@ -128,22 +129,23 @@ void SuperFoldSensorManager::HandlePostureData(const SensorEvent * const event)
|
||||
TLOGI(WmsLogTag::DMS, "Invalid value, angle value is: %{public}f.", curAngle_);
|
||||
return;
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "angle value is: %{public}f.", curAngle_);
|
||||
TLOGD(WmsLogTag::DMS, "angle value is: %{public}f.", curAngle_);
|
||||
NotifyFoldAngleChanged(curAngle_);
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::NotifyFoldAngleChanged(float foldAngle)
|
||||
{
|
||||
SuperFoldStatusChangeEvents events;
|
||||
if (std::isgreaterequal(foldAngle, ANGLE_FLAT_THRESHOLD)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is Expanded");
|
||||
events_ = SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED;
|
||||
events = SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED;
|
||||
} else if (std::isless(foldAngle, ANGLE_HALF_FOLD_THRESHOLD) &&
|
||||
std::isgreater(foldAngle, ANGLE_MIN_VAL)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is Half Folded");
|
||||
events_ = SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED;
|
||||
events = SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED;
|
||||
} else if (std::islessequal(foldAngle, ANGLE_MIN_VAL)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is Folded");
|
||||
events_ = SuperFoldStatusChangeEvents::ANGLE_CHANGE_FOLDED;
|
||||
events = SuperFoldStatusChangeEvents::ANGLE_CHANGE_FOLDED;
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "Angle Don't Change!");
|
||||
return;
|
||||
@ -152,7 +154,7 @@ void SuperFoldSensorManager::NotifyFoldAngleChanged(float foldAngle)
|
||||
std::vector<float> foldAngles;
|
||||
foldAngles.push_back(foldAngle);
|
||||
ScreenSessionManager::GetInstance().NotifyFoldAngleChanged(foldAngles);
|
||||
HandleSuperSensorChange();
|
||||
HandleSuperSensorChange(events);
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::HandleHallData(const SensorEvent * const event)
|
||||
@ -184,24 +186,29 @@ void SuperFoldSensorManager::HandleHallData(const SensorEvent * const event)
|
||||
|
||||
void SuperFoldSensorManager::NotifyHallChanged(uint16_t Hall)
|
||||
{
|
||||
SuperFoldStatusChangeEvents events;
|
||||
if (Hall == HALL_REMOVE_KEYBOARD_THRESHOLD) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Keyboard off!");
|
||||
events_ = SuperFoldStatusChangeEvents::KEYBOARD_OFF;
|
||||
events = SuperFoldStatusChangeEvents::KEYBOARD_OFF;
|
||||
} else if (Hall == HALL_HAVE_KEYBOARD_THRESHOLD) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Keyboard on!");
|
||||
events_ = SuperFoldStatusChangeEvents::KEYBOARD_ON;
|
||||
events = SuperFoldStatusChangeEvents::KEYBOARD_ON;
|
||||
HandleSuperSensorChange(SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED);
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Invalid Hall Value!");
|
||||
return;
|
||||
}
|
||||
// notify
|
||||
HandleSuperSensorChange();
|
||||
HandleSuperSensorChange(events);
|
||||
if (std::isgreater(curAngle_, ANGLE_SENSOR_THRESHOLD)) {
|
||||
HandleSuperSensorChange(SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED);
|
||||
}
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::HandleSuperSensorChange()
|
||||
void SuperFoldSensorManager::HandleSuperSensorChange(SuperFoldStatusChangeEvents events)
|
||||
{
|
||||
// trigger events
|
||||
SuperFoldStateManager::GetInstance().HandleSuperFoldStatusChange(events_);
|
||||
SuperFoldStateManager::GetInstance().HandleSuperFoldStatusChange(events);
|
||||
}
|
||||
|
||||
SuperFoldSensorManager::SuperFoldSensorManager() {}
|
||||
|
@ -41,11 +41,13 @@ void SuperFoldStateManager::DoAngleChangeExpanded(SuperFoldStatusChangeEvents ev
|
||||
|
||||
void SuperFoldStateManager::DoKeyboardOn(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
ScreenSessionManager::GetInstance().NotifyScreenMagneticStateChanged(true);
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoKeyboardOn()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoKeyboardOff(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
ScreenSessionManager::GetInstance().NotifyScreenMagneticStateChanged(false);
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoKeyboardOff()");
|
||||
}
|
||||
|
||||
@ -153,7 +155,7 @@ void SuperFoldStateManager::HandleSuperFoldStatusChange(SuperFoldStatusChangeEve
|
||||
return;
|
||||
}
|
||||
ScreenId screenId = screenSession->GetScreenId();
|
||||
ScreenSessionManager::GetInstance().OnSuperFoldStatusChange(screenId, curState_);
|
||||
ScreenSessionManager::GetInstance().OnSuperFoldStatusChange(screenId, curState_.load());
|
||||
ScreenSessionManager::GetInstance().NotifyFoldStatusChanged(
|
||||
MatchSuperFoldStatusToFoldStatus(curState_.load()));
|
||||
}
|
||||
|
@ -56,13 +56,15 @@
|
||||
#include "publish/screen_session_publish.h"
|
||||
#include "dms_xcollie.h"
|
||||
#include "screen_sensor_plugin.h"
|
||||
#include "fold_screen_controller/super_fold_sensor_manager.h"
|
||||
#include "fold_screen_controller/super_fold_state_manager.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
const std::string SCREEN_SESSION_MANAGER_THREAD = "OS_ScreenSessionManager";
|
||||
const std::string SCREEN_SESSION_MANAGER_SCREEN_POWER_THREAD = "OS_ScreenSessionManager_ScreenPower";
|
||||
const std::string SCREEN_CAPTURE_PERMISSION = "ohos.permission.CAPTURE_SCREEN";
|
||||
const std::string CUSTOM_SCREEN_CAPTURE_PERMISSION = "ohos.permission.CUSTOM_CAPTURE_SCREEN";
|
||||
const std::string CUSTOM_SCREEN_CAPTURE_PERMISSION = "ohos.permission.CUSTOM_SCREEN_CAPTURE";
|
||||
const std::string BOOTEVENT_BOOT_COMPLETED = "bootevent.boot.completed";
|
||||
const int32_t CV_WAIT_SCREENON_MS = 300;
|
||||
const int32_t CV_WAIT_SCREENOFF_MS = 1500;
|
||||
@ -153,6 +155,9 @@ ScreenSessionManager::ScreenSessionManager()
|
||||
sessionDisplayPowerController_ = new SessionDisplayPowerController(mutex_,
|
||||
std::bind(&ScreenSessionManager::NotifyDisplayStateChange, this,
|
||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
||||
if (FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
|
||||
g_foldScreenFlag = false;
|
||||
}
|
||||
if (g_foldScreenFlag) {
|
||||
HandleFoldScreenPowerInit();
|
||||
} else {
|
||||
@ -322,6 +327,11 @@ void ScreenSessionManager::Init()
|
||||
SetSensorSubscriptionEnabled();
|
||||
screenEventTracker_.RecordEvent("Dms subscribed to sensor successfully.");
|
||||
}
|
||||
|
||||
if (FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
|
||||
SuperFoldSensorManager::GetInstance().RegisterPostureCallback();
|
||||
SuperFoldSensorManager::GetInstance().RegisterHallCallback();
|
||||
}
|
||||
// publish init
|
||||
ScreenSessionPublish::GetInstance().InitPublishEvents();
|
||||
screenEventTracker_.RecordEvent("Dms init end.");
|
||||
|
@ -312,8 +312,9 @@ int SessionStageStub::HandleUpdateAvoidArea(MessageParcel& data, MessageParcel&
|
||||
if (!avoidArea) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
uint32_t type;
|
||||
if (!data.ReadUint32(type)) {
|
||||
uint32_t type = 0;
|
||||
if (!data.ReadUint32(type) ||
|
||||
type >= static_cast<uint32_t>(AvoidAreaType::TYPE_END)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
UpdateAvoidArea(avoidArea, static_cast<AvoidAreaType>(type));
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include "common/include/window_session_property.h"
|
||||
#include "property/rs_properties_def.h"
|
||||
#include "window.h"
|
||||
#include "screen_manager.h"
|
||||
#include "window.h"
|
||||
#include "ws_common_inner.h"
|
||||
|
||||
namespace OHOS::MMI {
|
||||
@ -36,7 +36,7 @@ namespace OHOS::Rosen {
|
||||
using MoveDragCallback = std::function<void(const SizeChangeReason)>;
|
||||
|
||||
using NotifyWindowDragHotAreaFunc = std::function<void(DisplayId displayId, uint32_t type,
|
||||
const SizeChangeReason reason)>;
|
||||
SizeChangeReason reason)>;
|
||||
|
||||
using NotifyWindowPidChangeCallback = std::function<void(int32_t windowId, bool startMoving)>;
|
||||
|
||||
@ -44,7 +44,7 @@ const uint32_t WINDOW_HOT_AREA_TYPE_UNDEFINED = 0;
|
||||
|
||||
class MoveDragController : public ScreenManager::IScreenListener {
|
||||
public:
|
||||
MoveDragController(int32_t persistentId, bool isSystemWindow = false);
|
||||
MoveDragController(int32_t persistentId, WindowType winType);
|
||||
~MoveDragController() = default;
|
||||
|
||||
/**
|
||||
@ -60,13 +60,11 @@ public:
|
||||
void SetStartMoveFlag(bool flag);
|
||||
bool GetStartMoveFlag() const;
|
||||
bool GetStartDragFlag() const;
|
||||
void SetAsSystemWindow(bool isSystemWindow);
|
||||
bool IsSystemWindow() const;
|
||||
bool HasPointDown();
|
||||
void SetMovable(bool movable);
|
||||
bool GetMovable() const;
|
||||
void SetNotifyWindowPidChangeCallback(const NotifyWindowPidChangeCallback& callback);
|
||||
WSRect GetTargetRect(TargetRectCoordinate coordinate = TargetRectCoordinate::RELATED_TO_START_DISPLAY) const;
|
||||
WSRect GetTargetRect(TargetRectCoordinate coordinate) const;
|
||||
void InitMoveDragProperty();
|
||||
void SetOriginalValue(int32_t pointerId, int32_t pointerType,
|
||||
int32_t pointerPosX, int32_t pointerPosY, const WSRect& winRect);
|
||||
@ -94,8 +92,8 @@ public:
|
||||
std::set<uint64_t> GetNewAddedDisplayIdsDuringMoveDrag();
|
||||
void InitCrossDisplayProperty(DisplayId displayId, uint64_t parentNodeId);
|
||||
WSRect GetScreenRectById(DisplayId displayId);
|
||||
void MoveDragInterrupt();
|
||||
void ResetCrossMoveDragProperty();
|
||||
void MoveDragInterrupted();
|
||||
|
||||
/**
|
||||
* Monitor screen connection status
|
||||
@ -139,7 +137,7 @@ private:
|
||||
constexpr static float NEAR_ZERO = 0.001f;
|
||||
|
||||
bool CalcMoveTargetRect(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, const WSRect& originalRect);
|
||||
void CalcDragTargetRect(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
void CalcDragTargetRect(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, SizeChangeReason reason);
|
||||
bool EventDownInit(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, const WSRect& originalRect,
|
||||
const sptr<WindowSessionProperty> property, const SystemSessionConfig& sysConfig);
|
||||
AreaType GetAreaType(int32_t pointWinX, int32_t pointWinY, int32_t sourceType, const WSRect& rect);
|
||||
@ -151,7 +149,7 @@ private:
|
||||
void FixTranslateByLimits(int32_t& tranX, int32_t& tranY);
|
||||
bool InitMainAxis(AreaType type, int32_t tranX, int32_t tranY);
|
||||
void ConvertXYByAspectRatio(int32_t& tx, int32_t& ty, float aspectRatio);
|
||||
void ProcessSessionRectChange(const SizeChangeReason reason);
|
||||
void ProcessSessionRectChange(SizeChangeReason reason);
|
||||
void InitDecorValue(const sptr<WindowSessionProperty> property, const SystemSessionConfig& sysConfig);
|
||||
|
||||
float GetVirtualPixelRatio() const;
|
||||
@ -187,6 +185,7 @@ private:
|
||||
MoveDragProperty moveDragProperty_;
|
||||
MoveDragCallback moveDragCallback_;
|
||||
int32_t persistentId_;
|
||||
WindowType winType_;
|
||||
bool isPcWindow_ = false;
|
||||
|
||||
enum class DragType : uint32_t {
|
||||
@ -210,7 +209,7 @@ private:
|
||||
MoveTempProperty moveTempProperty_;
|
||||
|
||||
void UpdateHotAreaType(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
void ProcessWindowDragHotAreaFunc(bool flag, const SizeChangeReason reason);
|
||||
void ProcessWindowDragHotAreaFunc(bool flag, SizeChangeReason reason);
|
||||
uint32_t windowDragHotAreaType_ = WINDOW_HOT_AREA_TYPE_UNDEFINED;
|
||||
NotifyWindowDragHotAreaFunc windowDragHotAreaFunc_;
|
||||
NotifyWindowPidChangeCallback pidChangeCallback_;
|
||||
@ -229,7 +228,6 @@ private:
|
||||
/**
|
||||
* Cross Display Move Drag
|
||||
*/
|
||||
bool isSystemWindow_ = false;
|
||||
bool moveDragIsInterrupted_ = false;
|
||||
DisplayId moveDragStartDisplayId_ = DISPLAY_ID_INVALID;
|
||||
DisplayId moveDragEndDisplayId_ = DISPLAY_ID_INVALID;
|
||||
|
@ -42,7 +42,7 @@ using GetSceneSessionVectorByTypeCallback = std::function<std::vector<sptr<Scene
|
||||
WindowType type, DisplayId displayId)>;
|
||||
using UpdateAvoidAreaCallback = std::function<void(int32_t persistentId)>;
|
||||
using UpdateAvoidAreaByTypeCallback = std::function<void(int32_t persistentId, AvoidAreaType type)>;
|
||||
using UpdateOccupiedAreaIfNeedCallback = std::function<void(const int32_t& persistentId)>;
|
||||
using UpdateOccupiedAreaIfNeedCallback = std::function<void(int32_t persistentId)>;
|
||||
using NotifyWindowInfoUpdateCallback = std::function<void(int32_t persistentId, WindowUpdateType type)>;
|
||||
using NotifyWindowPidChangeCallback = std::function<void(int32_t windowId, bool startMoving)>;
|
||||
using NotifySessionTouchOutsideCallback = std::function<void(int32_t persistentId)>;
|
||||
@ -187,7 +187,7 @@ public:
|
||||
bool isKeyboardShow, bool isRotating) {};
|
||||
WSError UpdateRect(const WSRect& rect, SizeChangeReason reason,
|
||||
const std::string& updateReason, const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
|
||||
WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason,
|
||||
WSError UpdateSessionRect(const WSRect& rect, SizeChangeReason reason,
|
||||
bool isGlobal = false, bool isFromMoveToGlobal = false) override;
|
||||
WSError UpdateClientRect(const WSRect& rect) override;
|
||||
WSError ChangeSessionVisibilityWithStatusBar(const sptr<AAFwk::SessionInfo> info, bool visible) override;
|
||||
@ -198,7 +198,8 @@ public:
|
||||
WSError NotifySessionException(
|
||||
const sptr<AAFwk::SessionInfo> info, bool needRemoveSession = false) override;
|
||||
WSError NotifySessionExceptionInner(
|
||||
const sptr<AAFwk::SessionInfo> info, bool needRemoveSession = false, bool isFromClient = false);
|
||||
const sptr<AAFwk::SessionInfo> info, bool needRemoveSession = false,
|
||||
bool isFromClient = false, bool startFail = false);
|
||||
WSError NotifyClientToUpdateRect(const std::string& updateReason,
|
||||
std::shared_ptr<RSTransaction> rsTransaction) override;
|
||||
|
||||
@ -522,7 +523,7 @@ public:
|
||||
|
||||
protected:
|
||||
void NotifySessionRectChange(const WSRect& rect,
|
||||
const SizeChangeReason reason = SizeChangeReason::UNDEFINED, const DisplayId displayId = DISPLAY_ID_INVALID);
|
||||
SizeChangeReason reason = SizeChangeReason::UNDEFINED, DisplayId displayId = DISPLAY_ID_INVALID);
|
||||
void NotifyIsCustomAnimationPlaying(bool isPlaying);
|
||||
void SetMoveDragCallback();
|
||||
std::string GetRatioPreferenceKey();
|
||||
@ -630,12 +631,12 @@ private:
|
||||
/**
|
||||
* Move Drag
|
||||
*/
|
||||
void HandleMoveDragSurfaceNode(const SizeChangeReason reason);
|
||||
void OnMoveDragCallback(const SizeChangeReason reason);
|
||||
void HandleMoveDragSurfaceNode(SizeChangeReason reason);
|
||||
void OnMoveDragCallback(SizeChangeReason reason);
|
||||
void InitializeCrossMoveDrag();
|
||||
void HandleMoveDrag(WSRect& rect, WSRect& globalRect, const SizeChangeReason reason,
|
||||
void HandleMoveDragSurfaceBounds(WSRect& rect, WSRect& globalRect, SizeChangeReason reason,
|
||||
bool isGlobal, bool needFlush);
|
||||
void HandleMoveDragEnd(WSRect& rect, const SizeChangeReason reason);
|
||||
void HandleMoveDragEnd(WSRect& rect, SizeChangeReason reason);
|
||||
|
||||
/**
|
||||
* Gesture Back
|
||||
@ -645,23 +646,23 @@ private:
|
||||
#ifdef DEVICE_STATUS_ENABLE
|
||||
void RotateDragWindow(std::shared_ptr<RSTransaction> rsTransaction);
|
||||
#endif // DEVICE_STATUS_ENABLE
|
||||
void HandleCompatibleModeMoveDrag(WSRect& rect, const SizeChangeReason reason,
|
||||
bool isSupportDragInPcCompatibleMode, bool isGlobal = false, bool needFlush = true);
|
||||
void HandleCompatibleModeDrag(WSRect& rect, const SizeChangeReason reason,
|
||||
void HandleCompatibleModeMoveDrag(WSRect& rect, SizeChangeReason reason,
|
||||
bool isSupportDragInPcCompatibleMode, bool isGlobal, bool needFlush = true);
|
||||
void HandleCompatibleModeDrag(WSRect& rect, SizeChangeReason reason,
|
||||
bool isSupportDragInPcCompatibleMode, bool isGlobal, bool needFlush);
|
||||
void FixRectByLimits(WindowLimits limits, WSRect& rect, float ratio, bool isDecor, float vpr);
|
||||
bool FixRectByAspectRatio(WSRect& rect);
|
||||
bool SaveAspectRatio(float ratio);
|
||||
void NotifyPropertyWhenConnect();
|
||||
WSError RaiseAppMainWindowToTop() override;
|
||||
void SetSurfaceBounds(const WSRect& rect, bool isGlobal = false, bool needFlush = true);
|
||||
void SetSurfaceBounds(const WSRect& rect, bool isGlobal, bool needFlush = true);
|
||||
void UpdateWinRectForSystemBar(WSRect& rect);
|
||||
bool UpdateInputMethodSessionRect(const WSRect& rect, WSRect& newWinRect, WSRect& newRequestRect);
|
||||
bool IsMovableWindowType();
|
||||
bool IsFullScreenMovable();
|
||||
bool IsMovable();
|
||||
void HandleCastScreenConnection(SessionInfo& info, sptr<SceneSession> session);
|
||||
void UpdateSessionRectInner(const WSRect& rect, const SizeChangeReason reason);
|
||||
void UpdateSessionRectInner(const WSRect& rect, SizeChangeReason reason);
|
||||
void UpdateRectForDrag(WSRect& rect);
|
||||
WMError HandleUpdatePropertyByAction(const sptr<WindowSessionProperty>& property,
|
||||
WSPropertyChangeAction action);
|
||||
|
@ -49,7 +49,7 @@ class RSTransaction;
|
||||
class RSSyncTransactionController;
|
||||
class Session;
|
||||
using NotifySessionRectChangeFunc = std::function<void(const WSRect& rect,
|
||||
const SizeChangeReason reason, const DisplayId displayId)>;
|
||||
SizeChangeReason reason, DisplayId displayId)>;
|
||||
using NotifyPendingSessionActivationFunc = std::function<void(SessionInfo& info)>;
|
||||
using NotifyChangeSessionVisibilityWithStatusBarFunc = std::function<void(SessionInfo& info, const bool visible)>;
|
||||
using NotifySessionStateChangeFunc = std::function<void(const SessionState& state)>;
|
||||
@ -61,14 +61,14 @@ using NotifyRequestFocusStatusNotifyManagerFunc =
|
||||
using NotifyBackPressedFunc = std::function<void(const bool needMoveToBackground)>;
|
||||
using NotifySessionFocusableChangeFunc = std::function<void(const bool isFocusable)>;
|
||||
using NotifySessionTouchableChangeFunc = std::function<void(const bool touchable)>;
|
||||
using NotifyClickFunc = std::function<void(bool requestFocus)>;
|
||||
using NotifyClickFunc = std::function<void(bool requestFocus, bool isClick)>;
|
||||
using NotifyTerminateSessionFunc = std::function<void(const SessionInfo& info)>;
|
||||
using NotifyTerminateSessionFuncNew =
|
||||
std::function<void(const SessionInfo& info, bool needStartCaller, bool isFromBroker)>;
|
||||
using NotifyTerminateSessionFuncTotal = std::function<void(const SessionInfo& info, TerminateType terminateType)>;
|
||||
using NofitySessionLabelUpdatedFunc = std::function<void(const std::string& label)>;
|
||||
using NofitySessionIconUpdatedFunc = std::function<void(const std::string& iconPath)>;
|
||||
using NotifySessionExceptionFunc = std::function<void(const SessionInfo& info, bool needRemoveSession)>;
|
||||
using NotifySessionExceptionFunc = std::function<void(const SessionInfo& info, bool needRemoveSession, bool startFail)>;
|
||||
using NotifySessionSnapshotFunc = std::function<void(const int32_t& persistentId)>;
|
||||
using NotifyPendingSessionToForegroundFunc = std::function<void(const SessionInfo& info)>;
|
||||
using NotifyPendingSessionToBackgroundForDelegatorFunc = std::function<void(const SessionInfo& info,
|
||||
@ -200,7 +200,6 @@ public:
|
||||
void SetSessionInfoTime(const std::string& time);
|
||||
void SetSessionInfoAbilityInfo(const std::shared_ptr<AppExecFwk::AbilityInfo>& abilityInfo);
|
||||
void SetSessionInfoWant(const std::shared_ptr<AAFwk::Want>& want);
|
||||
void SetSessionInfoProcessOptions(const std::shared_ptr<AAFwk::ProcessOptions>& processOptions);
|
||||
void ResetSessionInfoResultCode();
|
||||
void SetSessionInfoPersistentId(int32_t persistentId);
|
||||
void SetSessionInfoCallerPersistentId(int32_t callerPersistentId);
|
||||
@ -309,7 +308,7 @@ public:
|
||||
void SetClickListener(const NotifyClickFunc& func);
|
||||
void NotifySessionFocusableChange(bool isFocusable);
|
||||
void NotifySessionTouchableChange(bool touchable);
|
||||
void NotifyClick(bool requestFocus = true);
|
||||
void NotifyClick(bool requestFocus = true, bool isClick = true);
|
||||
bool GetStateFromManager(const ManagerState key);
|
||||
virtual void PresentFoucusIfNeed(int32_t pointerAcrion);
|
||||
virtual WSError UpdateWindowMode(WindowMode mode);
|
||||
@ -526,6 +525,8 @@ public:
|
||||
WSError RemoveStartingWindow() override;
|
||||
void SetEnableRemoveStartingWindow(bool enableRemoveStartingWindow);
|
||||
bool GetEnableRemoveStartingWindow() const;
|
||||
void SetAppBufferReady(bool appBufferReady);
|
||||
bool GetAppBufferReady() const;
|
||||
|
||||
protected:
|
||||
class SessionLifeCycleTask : public virtual RefBase {
|
||||
@ -784,7 +785,7 @@ private:
|
||||
*/
|
||||
std::atomic<bool> isAttach_ { false };
|
||||
std::atomic<bool> isPendingToBackgroundState_ { false };
|
||||
bool isActivatedAfterScreenLocked_ { true };
|
||||
std::atomic<bool> isActivatedAfterScreenLocked_ { true };
|
||||
sptr<IPatternDetachCallback> detachCallback_ = nullptr;
|
||||
|
||||
std::shared_ptr<RSSurfaceNode> leashWinSurfaceNode_;
|
||||
@ -796,6 +797,7 @@ private:
|
||||
* Starting Window
|
||||
*/
|
||||
bool enableRemoveStartingWindow_ {false};
|
||||
bool appBufferReady_ {false};
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
* @return Returns WSError::WS_OK if called success, otherwise failed.
|
||||
*/
|
||||
virtual WSError UpdateSessionRect(
|
||||
const WSRect &rect, const SizeChangeReason reason, bool isGlobal = false, bool isFromMoveToGlobal = false)
|
||||
const WSRect &rect, SizeChangeReason reason, bool isGlobal = false, bool isFromMoveToGlobal = false)
|
||||
{
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
bool isDockHoverShown = true) override;
|
||||
WSError OnRestoreMainWindow() override;
|
||||
WSError RaiseToAppTop() override;
|
||||
WSError UpdateSessionRect(const WSRect &rect, const SizeChangeReason reason, bool isGlobal = false,
|
||||
WSError UpdateSessionRect(const WSRect &rect, SizeChangeReason reason, bool isGlobal = false,
|
||||
bool isFromMoveToGlobal = false) override;
|
||||
WMError GetGlobalScaledRect(Rect& globalScaledRect) override;
|
||||
WSError UpdateClientRect(const WSRect& rect) override;
|
||||
|
@ -193,7 +193,6 @@ void KeyboardSession::OnKeyboardPanelUpdated()
|
||||
|
||||
void KeyboardSession::OnCallingSessionUpdated()
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "id: %{public}d", GetPersistentId());
|
||||
if (!IsSessionForeground() || !IsVisibleForeground()) {
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Keyboard is not foreground.");
|
||||
return;
|
||||
@ -212,7 +211,8 @@ void KeyboardSession::OnCallingSessionUpdated()
|
||||
WSRect callingSessionRect = callingSession->GetSessionRect();
|
||||
NotifyOccupiedAreaChangeInfo(callingSession, callingSessionRect, panelRect);
|
||||
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "callSession Rect: %{public}s", callingSessionRect.ToString().c_str());
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "id: %{public}d, callSession Rect: %{public}s",
|
||||
GetPersistentId(), callingSessionRect.ToString().c_str());
|
||||
}
|
||||
|
||||
WSError KeyboardSession::SetKeyboardSessionGravity(SessionGravity gravity)
|
||||
|
@ -32,7 +32,7 @@ MainSession::MainSession(const SessionInfo& info, const sptr<SpecificSessionCall
|
||||
// persistentId changed due to id conflicts. Need to rename the old snapshot if exists
|
||||
scenePersistence_->RenameSnapshotFromOldPersistentId(info.persistentId_);
|
||||
}
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId());
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId(), GetWindowType());
|
||||
if (specificCallback != nullptr &&
|
||||
specificCallback->onWindowInputPidChangeCallback_ != nullptr) {
|
||||
moveDragController_->SetNotifyWindowPidChangeCallback(specificCallback->onWindowInputPidChangeCallback_);
|
||||
|
@ -15,59 +15,58 @@
|
||||
|
||||
#include "session/host/include/move_drag_controller.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
#include <pointer_event.h>
|
||||
#include "input_manager.h"
|
||||
#include <transaction/rs_transaction.h>
|
||||
#include <ui/rs_surface_node.h>
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "input_manager.h"
|
||||
#include "screen_session_manager_client/include/screen_session_manager_client.h"
|
||||
#include "session/host/include/scene_persistent_storage.h"
|
||||
#include "session/host/include/scene_session.h"
|
||||
#include "session/host/include/session_utils.h"
|
||||
#include "window_helper.h"
|
||||
#include "session_helper.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "ws_common.h"
|
||||
#include "screen_session_manager_client/include/screen_session_manager_client.h"
|
||||
|
||||
#ifdef RES_SCHED_ENABLE
|
||||
#include "res_type.h"
|
||||
#include "res_sched_client.h"
|
||||
#include "res_type.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "MoveDragController" };
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "MoveDragController"};
|
||||
}
|
||||
|
||||
MoveDragController::MoveDragController(int32_t persistentId, bool isSystemWindow)
|
||||
MoveDragController::MoveDragController(int32_t persistentId, WindowType winType)
|
||||
{
|
||||
persistentId_ = persistentId;
|
||||
isSystemWindow_ = isSystemWindow;
|
||||
winType_ = winType;
|
||||
}
|
||||
|
||||
void MoveDragController::OnConnect(ScreenId id)
|
||||
{
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to new screen %{public}" PRIu64
|
||||
" connection.", id);
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to new screen %{public}" PRIu64 " connection.",
|
||||
id);
|
||||
moveDragIsInterrupted_ = true;
|
||||
}
|
||||
|
||||
void MoveDragController::OnDisconnect(ScreenId id)
|
||||
{
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to screen %{public}" PRIu64
|
||||
" disconnection.", id);
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to screen %{public}" PRIu64 " disconnection.",
|
||||
id);
|
||||
moveDragIsInterrupted_ = true;
|
||||
}
|
||||
|
||||
void MoveDragController::OnChange(ScreenId id)
|
||||
{
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to screen %{public}" PRIu64
|
||||
" change.", id);
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Moving or dragging is interrupt due to screen %{public}" PRIu64 " change.", id);
|
||||
moveDragIsInterrupted_ = true;
|
||||
}
|
||||
|
||||
@ -76,16 +75,6 @@ void MoveDragController::RegisterMoveDragCallback(const MoveDragCallback& callBa
|
||||
moveDragCallback_ = callBack;
|
||||
}
|
||||
|
||||
void MoveDragController::SetAsSystemWindow(bool isSystemWindow)
|
||||
{
|
||||
isSystemWindow_ = isSystemWindow;
|
||||
}
|
||||
|
||||
bool MoveDragController::IsSystemWindow() const
|
||||
{
|
||||
return isSystemWindow_;
|
||||
}
|
||||
|
||||
void MoveDragController::NotifyWindowInputPidChange(bool isServerPid)
|
||||
{
|
||||
if (pidChangeCallback_) {
|
||||
@ -164,11 +153,10 @@ WSRect MoveDragController::GetTargetRect(TargetRectCoordinate coordinate) const
|
||||
DisplayId relatedDisplayId = DISPLAY_ID_INVALID;
|
||||
switch (coordinate) {
|
||||
case TargetRectCoordinate::GLOBAL:
|
||||
return {
|
||||
moveDragProperty_.targetRect_.posX_ + originalDisplayOffsetX_,
|
||||
moveDragProperty_.targetRect_.posY_ + originalDisplayOffsetY_,
|
||||
moveDragProperty_.targetRect_.width_,
|
||||
moveDragProperty_.targetRect_.height_ };
|
||||
return {moveDragProperty_.targetRect_.posX_ + originalDisplayOffsetX_,
|
||||
moveDragProperty_.targetRect_.posY_ + originalDisplayOffsetY_,
|
||||
moveDragProperty_.targetRect_.width_,
|
||||
moveDragProperty_.targetRect_.height_};
|
||||
case TargetRectCoordinate::RELATED_TO_START_DISPLAY:
|
||||
return moveDragProperty_.targetRect_;
|
||||
case TargetRectCoordinate::RELATED_TO_END_DISPLAY:
|
||||
@ -184,18 +172,17 @@ WSRect MoveDragController::GetTargetRect(TargetRectCoordinate coordinate) const
|
||||
return moveDragProperty_.targetRect_;
|
||||
}
|
||||
ScreenProperty screenProperty = screenSession->GetScreenProperty();
|
||||
int32_t currentDisplayOffsetX = screenProperty.GetStartX();
|
||||
int32_t currentDisplayOffsetY = screenProperty.GetStartY();
|
||||
return {
|
||||
moveDragProperty_.targetRect_.posX_ + originalDisplayOffsetX_ - currentDisplayOffsetX,
|
||||
int32_t currentDisplayOffsetX = static_cast<int32_t>(screenProperty.GetStartX());
|
||||
int32_t currentDisplayOffsetY = static_cast<int32_t>(screenProperty.GetStartY());
|
||||
return {moveDragProperty_.targetRect_.posX_ + originalDisplayOffsetX_ - currentDisplayOffsetX,
|
||||
moveDragProperty_.targetRect_.posY_ + originalDisplayOffsetY_ - currentDisplayOffsetY,
|
||||
moveDragProperty_.targetRect_.width_,
|
||||
moveDragProperty_.targetRect_.height_ };
|
||||
moveDragProperty_.targetRect_.height_};
|
||||
}
|
||||
|
||||
void MoveDragController::InitMoveDragProperty()
|
||||
{
|
||||
moveDragProperty_ = { -1, -1, -1, -1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
|
||||
moveDragProperty_ = {-1, -1, -1, -1, {0, 0, 0, 0}, {0, 0, 0, 0}};
|
||||
}
|
||||
|
||||
void MoveDragController::InitCrossDisplayProperty(DisplayId displayId, uint64_t initParentNodeId)
|
||||
@ -210,14 +197,14 @@ void MoveDragController::InitCrossDisplayProperty(DisplayId displayId, uint64_t
|
||||
}
|
||||
moveDragStartDisplayId_ = displayId;
|
||||
initParentNodeId_ = initParentNodeId;
|
||||
sptr<ScreenSession> screenSession = ScreenSessionManagerClient::GetInstance().
|
||||
GetScreenSessionById(moveDragStartDisplayId_);
|
||||
sptr<ScreenSession> screenSession =
|
||||
ScreenSessionManagerClient::GetInstance().GetScreenSessionById(moveDragStartDisplayId_);
|
||||
if (!screenSession) {
|
||||
return;
|
||||
}
|
||||
ScreenProperty screenProperty = screenSession->GetScreenProperty();
|
||||
originalDisplayOffsetX_ = screenProperty.GetStartX();
|
||||
originalDisplayOffsetY_ = screenProperty.GetStartY();
|
||||
originalDisplayOffsetX_ = static_cast<int32_t>(screenProperty.GetStartX());
|
||||
originalDisplayOffsetY_ = static_cast<int32_t>(screenProperty.GetStartY());
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "moveDragStartDisplayId: %{public}" PRIu64 ", "
|
||||
"originalDisplayOffsetX: %{public}d, originalDisplayOffsetY: %{public}d",
|
||||
moveDragStartDisplayId_, originalDisplayOffsetX_, originalDisplayOffsetY_);
|
||||
@ -225,7 +212,7 @@ void MoveDragController::InitCrossDisplayProperty(DisplayId displayId, uint64_t
|
||||
|
||||
void MoveDragController::ResetCrossMoveDragProperty()
|
||||
{
|
||||
moveDragProperty_ = { -1, -1, -1, -1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
|
||||
moveDragProperty_ = {-1, -1, -1, -1, {0, 0, 0, 0}, {0, 0, 0, 0}};
|
||||
DMError error = ScreenManager::GetInstance().UnregisterScreenListener(this);
|
||||
if (error != DMError::DM_OK) {
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "Register ScreenListener false.");
|
||||
@ -239,12 +226,11 @@ void MoveDragController::ResetCrossMoveDragProperty()
|
||||
initParentNodeId_ = -1;
|
||||
originalDisplayOffsetX_ = 0;
|
||||
originalDisplayOffsetY_ = 0;
|
||||
isSystemWindow_ = false;
|
||||
moveDragIsInterrupted_ = false;
|
||||
}
|
||||
|
||||
void MoveDragController::SetOriginalValue(int32_t pointerId, int32_t pointerType,
|
||||
int32_t pointerPosX, int32_t pointerPosY, const WSRect& winRect)
|
||||
void MoveDragController::SetOriginalValue(int32_t pointerId, int32_t pointerType, int32_t pointerPosX,
|
||||
int32_t pointerPosY, const WSRect& winRect)
|
||||
{
|
||||
moveDragProperty_.pointerId_ = pointerId;
|
||||
moveDragProperty_.pointerType_ = pointerType;
|
||||
@ -305,8 +291,7 @@ bool MoveDragController::ConsumeMoveEvent(const std::shared_ptr<MMI::PointerEven
|
||||
int32_t sourceType = pointerEvent->GetSourceType();
|
||||
if (!pointerEvent->GetPointerItem(pointerId, pointerItem) ||
|
||||
(sourceType == MMI::PointerEvent::SOURCE_TYPE_MOUSE &&
|
||||
(pointerEvent->GetButtonId() != MMI::PointerEvent::MOUSE_BUTTON_LEFT &&
|
||||
!GetStartMoveFlag()))) {
|
||||
(pointerEvent->GetButtonId() != MMI::PointerEvent::MOUSE_BUTTON_LEFT && !GetStartMoveFlag()))) {
|
||||
WLOGFD("invalid pointerEvent id: %{public}d", persistentId_);
|
||||
return false;
|
||||
}
|
||||
@ -334,7 +319,7 @@ bool MoveDragController::ConsumeMoveEvent(const std::shared_ptr<MMI::PointerEven
|
||||
switch (action) {
|
||||
case MMI::PointerEvent::POINTER_ACTION_MOVE: {
|
||||
if (moveDragIsInterrupted_) {
|
||||
MoveDragInterrupt();
|
||||
MoveDragInterrupted();
|
||||
return true;
|
||||
}
|
||||
reason = SizeChangeReason::MOVE;
|
||||
@ -352,13 +337,13 @@ bool MoveDragController::ConsumeMoveEvent(const std::shared_ptr<MMI::PointerEven
|
||||
return true;
|
||||
}
|
||||
if (moveDragIsInterrupted_) {
|
||||
MoveDragInterrupt();
|
||||
MoveDragInterrupted();
|
||||
return true;
|
||||
}
|
||||
reason = SizeChangeReason::DRAG_END;
|
||||
SetStartMoveFlag(false);
|
||||
hasPointDown_ = false;
|
||||
moveDragEndDisplayId_ = pointerEvent->GetTargetDisplayId();
|
||||
moveDragEndDisplayId_ = static_cast<uint64_t>(pointerEvent->GetTargetDisplayId());
|
||||
ProcessWindowDragHotAreaFunc(windowDragHotAreaType_ != WINDOW_HOT_AREA_TYPE_UNDEFINED, reason);
|
||||
// The Pointer up event sent to the ArkUI.
|
||||
ret = false;
|
||||
@ -373,7 +358,7 @@ bool MoveDragController::ConsumeMoveEvent(const std::shared_ptr<MMI::PointerEven
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MoveDragController::ProcessWindowDragHotAreaFunc(bool isSendHotAreaMessage, const SizeChangeReason reason)
|
||||
void MoveDragController::ProcessWindowDragHotAreaFunc(bool isSendHotAreaMessage, SizeChangeReason reason)
|
||||
{
|
||||
if (isSendHotAreaMessage) {
|
||||
WLOGFI("ProcessWindowDragHotAreaFunc start, isSendHotAreaMessage: %{public}u, reason: %{public}d",
|
||||
@ -419,13 +404,21 @@ void MoveDragController::UpdateGravityWhenDrag(const std::shared_ptr<MMI::Pointe
|
||||
}
|
||||
}
|
||||
|
||||
void MoveDragController::CalcDragTargetRect(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
|
||||
void MoveDragController::CalcDragTargetRect(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
SizeChangeReason reason)
|
||||
{
|
||||
if (!IsSystemWindow() || static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()) == moveDragStartDisplayId_) {
|
||||
if (reason == SizeChangeReason::DRAG_START) {
|
||||
moveDragProperty_.targetRect_ = moveDragProperty_.originalRect_;
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "drag rect: %{public}s", moveDragProperty_.targetRect_.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
if (!WindowHelper::IsSystemWindow(winType_) ||
|
||||
static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()) == moveDragStartDisplayId_) {
|
||||
std::pair<int32_t, int32_t> trans = CalcUnifiedTranslate(pointerEvent);
|
||||
moveDragProperty_.targetRect_ = MathHelper::GreatNotEqual(aspectRatio_, NEAR_ZERO) ?
|
||||
CalcFixedAspectRatioTargetRect(
|
||||
type_, trans.first, trans.second, aspectRatio_, moveDragProperty_.originalRect_) :
|
||||
moveDragProperty_.targetRect_ =
|
||||
MathHelper::GreatNotEqual(aspectRatio_, NEAR_ZERO) ?
|
||||
CalcFixedAspectRatioTargetRect(type_, trans.first, trans.second,
|
||||
aspectRatio_, moveDragProperty_.originalRect_):
|
||||
CalcFreeformTargetRect(type_, trans.first, trans.second, moveDragProperty_.originalRect_);
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "drag rect: %{public}s", moveDragProperty_.targetRect_.ToString().c_str());
|
||||
@ -456,7 +449,7 @@ bool MoveDragController::ConsumeDragEvent(const std::shared_ptr<MMI::PointerEven
|
||||
}
|
||||
case MMI::PointerEvent::POINTER_ACTION_MOVE: {
|
||||
if (moveDragIsInterrupted_) {
|
||||
MoveDragInterrupt();
|
||||
MoveDragInterrupted();
|
||||
return true;
|
||||
}
|
||||
reason = SizeChangeReason::DRAG;
|
||||
@ -469,15 +462,15 @@ bool MoveDragController::ConsumeDragEvent(const std::shared_ptr<MMI::PointerEven
|
||||
return true;
|
||||
}
|
||||
auto screenRect = GetScreenRectById(moveDragStartDisplayId_);
|
||||
if (moveDragIsInterrupted_ || screenRect == WSRect {-1, -1, -1, -1}) {
|
||||
MoveDragInterrupt();
|
||||
if (moveDragIsInterrupted_ || screenRect == WSRect{-1, -1, -1, -1}) {
|
||||
MoveDragInterrupted();
|
||||
return true;
|
||||
}
|
||||
reason = SizeChangeReason::DRAG_END;
|
||||
isStartDrag_ = false;
|
||||
hasPointDown_ = false;
|
||||
moveDragEndDisplayId_ = GetTargetRect(TargetRectCoordinate::GLOBAL).IsOverlap(screenRect) ?
|
||||
moveDragStartDisplayId_ : pointerEvent->GetTargetDisplayId();
|
||||
moveDragStartDisplayId_ : static_cast<uint64_t>(pointerEvent->GetTargetDisplayId());
|
||||
ResSchedReportData(OHOS::ResourceSchedule::ResType::RES_TYPE_RESIZE_WINDOW, false);
|
||||
NotifyWindowInputPidChange(isStartDrag_);
|
||||
break;
|
||||
@ -485,12 +478,12 @@ bool MoveDragController::ConsumeDragEvent(const std::shared_ptr<MMI::PointerEven
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
CalcDragTargetRect(pointerEvent);
|
||||
CalcDragTargetRect(pointerEvent, reason);
|
||||
ProcessSessionRectChange(reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MoveDragController::MoveDragInterrupt()
|
||||
void MoveDragController::MoveDragInterrupted()
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "Screen anomaly, MoveDrag has been interrupted.");
|
||||
SizeChangeReason reason = SizeChangeReason::DRAG_END;
|
||||
@ -511,11 +504,10 @@ void MoveDragController::MoveDragInterrupt()
|
||||
|
||||
WSRect MoveDragController::GetScreenRectById(DisplayId displayId)
|
||||
{
|
||||
sptr<ScreenSession> screenSession =
|
||||
ScreenSessionManagerClient::GetInstance().GetScreenSessionById(displayId);
|
||||
sptr<ScreenSession> screenSession = ScreenSessionManagerClient::GetInstance().GetScreenSessionById(displayId);
|
||||
if (!screenSession) {
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "ScreenSession id null.");
|
||||
return WSRect {-1, -1, -1, -1};
|
||||
return WSRect{-1, -1, -1, -1};
|
||||
}
|
||||
ScreenProperty screenProperty = screenSession->GetScreenProperty();
|
||||
WSRect screenRect = {
|
||||
@ -533,15 +525,15 @@ std::pair<int32_t, int32_t> MoveDragController::CalcUnifiedTranslate(
|
||||
int32_t pointerId = pointerEvent->GetPointerId();
|
||||
MMI::PointerEvent::PointerItem pointerItem;
|
||||
pointerEvent->GetPointerItem(pointerId, pointerItem);
|
||||
sptr<ScreenSession> screenSession = ScreenSessionManagerClient::GetInstance().
|
||||
GetScreenSessionById(static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()));
|
||||
sptr<ScreenSession> screenSession = ScreenSessionManagerClient::GetInstance().GetScreenSessionById(
|
||||
static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()));
|
||||
if (!screenSession) {
|
||||
return std::make_pair(0, 0);
|
||||
}
|
||||
ScreenProperty screenProperty = screenSession->GetScreenProperty();
|
||||
// calculate trans in unified coordinates
|
||||
int32_t currentDisplayTranX = screenProperty.GetStartX();
|
||||
int32_t currentDisplayTranY = screenProperty.GetStartY();
|
||||
int32_t currentDisplayTranX = static_cast<int32_t>(screenProperty.GetStartX());
|
||||
int32_t currentDisplayTranY = static_cast<int32_t>(screenProperty.GetStartY());
|
||||
int32_t tranX = (pointerItem.GetDisplayX() + currentDisplayTranX) -
|
||||
(moveDragProperty_.originalPointerPosX_ + originalDisplayOffsetX_);
|
||||
int32_t tranY = (pointerItem.GetDisplayY() + currentDisplayTranY) -
|
||||
@ -569,15 +561,17 @@ bool MoveDragController::CalcMoveTargetRect(const std::shared_ptr<MMI::PointerEv
|
||||
moveDragProperty_.originalRect_.posY_ = pointerDisplayY - pointerWindowY;
|
||||
return false;
|
||||
};
|
||||
if (!IsSystemWindow() || static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()) == moveDragStartDisplayId_) {
|
||||
if (!WindowHelper::IsSystemWindow(winType_) ||
|
||||
static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()) == moveDragStartDisplayId_) {
|
||||
std::pair<int32_t, int32_t> trans = CalcUnifiedTranslate(pointerEvent);
|
||||
moveDragProperty_.targetRect_ = {
|
||||
moveDragProperty_.originalRect_.posX_ + trans.first,
|
||||
moveDragProperty_.originalRect_.posY_ + trans.second,
|
||||
originalRect.width_,
|
||||
originalRect.height_};
|
||||
originalRect.height_
|
||||
};
|
||||
}
|
||||
WLOGFD("move rect: %{public}s", moveDragProperty_.targetRect_.ToString().c_str());
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "move rect: %{public}s", moveDragProperty_.targetRect_.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -596,14 +590,14 @@ bool MoveDragController::EventDownInit(const std::shared_ptr<MMI::PointerEvent>&
|
||||
InitMoveDragProperty();
|
||||
hasPointDown_ = true;
|
||||
moveDragProperty_.originalRect_ = originalRect;
|
||||
auto display = DisplayManager::GetInstance().GetDisplayById(pointerEvent->GetTargetDisplayId());
|
||||
auto display = DisplayManager::GetInstance().GetDisplayById(
|
||||
static_cast<uint64_t>(pointerEvent->GetTargetDisplayId()));
|
||||
if (display) {
|
||||
vpr_ = display->GetVirtualPixelRatio();
|
||||
} else {
|
||||
vpr_ = 1.5f; // 1.5f: default virtual pixel ratio
|
||||
vpr_ = 1.5f; // 1.5f: default virtual pixel ratio
|
||||
}
|
||||
int outside = (sourceType == MMI::PointerEvent::SOURCE_TYPE_MOUSE) ? HOTZONE_POINTER * vpr_ :
|
||||
HOTZONE_TOUCH * vpr_;
|
||||
int outside = (sourceType == MMI::PointerEvent::SOURCE_TYPE_MOUSE) ? HOTZONE_POINTER * vpr_ : HOTZONE_TOUCH * vpr_;
|
||||
type_ = SessionHelper::GetAreaType(pointerItem.GetWindowX(), pointerItem.GetWindowY(), sourceType, outside, vpr_,
|
||||
moveDragProperty_.originalRect_);
|
||||
if (type_ == AreaType::UNDEFINED) {
|
||||
@ -681,32 +675,32 @@ WSRect MoveDragController::CalcFixedAspectRatioTargetRect(AreaType type, int32_t
|
||||
ConvertXYByAspectRatio(tranX, tranY, aspectRatio);
|
||||
switch (type) {
|
||||
case AreaType::LEFT_TOP: {
|
||||
return { posX + tranX, posY + tranY, width - tranX, height - tranY };
|
||||
return {posX + tranX, posY + tranY, width - tranX, height - tranY};
|
||||
}
|
||||
case AreaType::RIGHT_TOP: {
|
||||
return { posX, posY + (mainMoveAxis_ == AxisType::X_AXIS ? (-tranY) : (tranY)),
|
||||
width + (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)),
|
||||
height + (mainMoveAxis_ == AxisType::X_AXIS ? (tranY) : (-tranY)) };
|
||||
return {posX, posY + (mainMoveAxis_ == AxisType::X_AXIS ? (-tranY) : (tranY)),
|
||||
width + (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)),
|
||||
height + (mainMoveAxis_ == AxisType::X_AXIS ? (tranY) : (-tranY))};
|
||||
}
|
||||
case AreaType::RIGHT_BOTTOM: {
|
||||
return { posX, posY, width + tranX, height + tranY };
|
||||
return {posX, posY, width + tranX, height + tranY};
|
||||
}
|
||||
case AreaType::LEFT_BOTTOM: {
|
||||
return { posX + (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)), posY,
|
||||
width - (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)),
|
||||
height - (mainMoveAxis_ == AxisType::X_AXIS ? (tranY) : (-tranY)) };
|
||||
return {posX + (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)), posY,
|
||||
width - (mainMoveAxis_ == AxisType::X_AXIS ? (tranX) : (-tranX)),
|
||||
height - (mainMoveAxis_ == AxisType::X_AXIS ? (tranY) : (-tranY))};
|
||||
}
|
||||
case AreaType::LEFT: {
|
||||
return { posX + tranX, posY, width - tranX, height - tranY };
|
||||
return {posX + tranX, posY, width - tranX, height - tranY};
|
||||
}
|
||||
case AreaType::TOP: {
|
||||
return { posX, posY + tranY, width - tranX, height - tranY };
|
||||
return {posX, posY + tranY, width - tranX, height - tranY};
|
||||
}
|
||||
case AreaType::RIGHT: {
|
||||
return { posX, posY, width + tranX, height + tranY };
|
||||
return {posX, posY, width + tranX, height + tranY};
|
||||
}
|
||||
case AreaType::BOTTOM: {
|
||||
return { posX, posY, width + tranX, height + tranY };
|
||||
return {posX, posY, width + tranX, height + tranY};
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@ -827,13 +821,12 @@ void MoveDragController::InitDecorValue(const sptr<WindowSessionProperty> proper
|
||||
bool isMainWindow = WindowHelper::IsMainWindow(windowType);
|
||||
bool isSubWindow = WindowHelper::IsSubWindow(windowType);
|
||||
bool isDialogWindow = WindowHelper::IsDialogWindow(windowType);
|
||||
isDecorEnable_ = (isMainWindow ||
|
||||
((isSubWindow || isDialogWindow) && property->IsDecorEnable())) &&
|
||||
isDecorEnable_ = (isMainWindow || ((isSubWindow || isDialogWindow) && property->IsDecorEnable())) &&
|
||||
sysConfig.isSystemDecorEnable_ &&
|
||||
WindowHelper::IsWindowModeSupported(sysConfig.decorModeSupportInfo_, property->GetWindowMode());
|
||||
}
|
||||
|
||||
void MoveDragController::ProcessSessionRectChange(const SizeChangeReason reason)
|
||||
void MoveDragController::ProcessSessionRectChange(SizeChangeReason reason)
|
||||
{
|
||||
if (moveDragCallback_) {
|
||||
moveDragCallback_(reason);
|
||||
@ -854,39 +847,35 @@ float MoveDragController::GetVirtualPixelRatio() const
|
||||
void MoveDragController::UpdateDragType(int32_t startPointPosX, int32_t startPointPosY)
|
||||
{
|
||||
if (startPointPosX > rectExceptCorner_.posX_ &&
|
||||
(startPointPosX < rectExceptCorner_.posX_ +
|
||||
static_cast<int32_t>(rectExceptCorner_.width_))) {
|
||||
(startPointPosX < rectExceptCorner_.posX_ + static_cast<int32_t>(rectExceptCorner_.width_))) {
|
||||
dragType_ = DragType::DRAG_BOTTOM_OR_TOP;
|
||||
} else if (startPointPosY > rectExceptCorner_.posY_ &&
|
||||
(startPointPosY < rectExceptCorner_.posY_ +
|
||||
static_cast<int32_t>(rectExceptCorner_.height_))) {
|
||||
(startPointPosY < rectExceptCorner_.posY_ + static_cast<int32_t>(rectExceptCorner_.height_))) {
|
||||
dragType_ = DragType::DRAG_LEFT_OR_RIGHT;
|
||||
} else if ((startPointPosX <= rectExceptCorner_.posX_ && startPointPosY <= rectExceptCorner_.posY_) ||
|
||||
(startPointPosX >= rectExceptCorner_.posX_ + static_cast<int32_t>(rectExceptCorner_.width_) &&
|
||||
startPointPosY >= rectExceptCorner_.posY_ + static_cast<int32_t>(rectExceptCorner_.height_))) {
|
||||
startPointPosY >= rectExceptCorner_.posY_ + static_cast<int32_t>(rectExceptCorner_.height_))) {
|
||||
dragType_ = DragType::DRAG_LEFT_TOP_CORNER;
|
||||
} else {
|
||||
dragType_ = DragType::DRAG_RIGHT_TOP_CORNER;
|
||||
}
|
||||
}
|
||||
|
||||
bool MoveDragController::IsPointInDragHotZone(int32_t startPointPosX, int32_t startPointPosY,
|
||||
int32_t sourceType, const WSRect& winRect)
|
||||
bool MoveDragController::IsPointInDragHotZone(int32_t startPointPosX, int32_t startPointPosY, int32_t sourceType,
|
||||
const WSRect& winRect)
|
||||
{
|
||||
// calculate rect with hotzone
|
||||
Rect rectWithHotzone;
|
||||
rectWithHotzone.posX_ = winRect.posX_ - static_cast<int32_t>(HOTZONE_POINTER);
|
||||
rectWithHotzone.posY_ = winRect.posY_ - static_cast<int32_t>(HOTZONE_POINTER);
|
||||
rectWithHotzone.width_ = winRect.width_ + HOTZONE_POINTER * 2u; // double hotZone
|
||||
rectWithHotzone.height_ = winRect.height_ + HOTZONE_POINTER * 2u; // double hotZone
|
||||
rectWithHotzone.width_ = winRect.width_ + HOTZONE_POINTER * 2u; // double hotZone
|
||||
rectWithHotzone.height_ = winRect.height_ + HOTZONE_POINTER * 2u; // double hotZone
|
||||
|
||||
if (sourceType == MMI::PointerEvent::SOURCE_TYPE_MOUSE &&
|
||||
!WindowHelper::IsPointInTargetRectWithBound(startPointPosX, startPointPosY, rectWithHotzone)) {
|
||||
return false;
|
||||
} else if ((!WindowHelper::IsPointInTargetRect(startPointPosX,
|
||||
startPointPosY, rectExceptFrame_)) ||
|
||||
(!WindowHelper::IsPointInWindowExceptCorner(startPointPosX,
|
||||
startPointPosY, rectExceptCorner_))) {
|
||||
} else if ((!WindowHelper::IsPointInTargetRect(startPointPosX, startPointPosY, rectExceptFrame_)) ||
|
||||
(!WindowHelper::IsPointInWindowExceptCorner(startPointPosX, startPointPosY, rectExceptCorner_))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -894,23 +883,17 @@ bool MoveDragController::IsPointInDragHotZone(int32_t startPointPosX, int32_t st
|
||||
|
||||
void MoveDragController::CalculateStartRectExceptHotZone(float vpr, const WSRect& winRect)
|
||||
{
|
||||
rectExceptFrame_.posX_ = winRect.posX_ +
|
||||
static_cast<int32_t>(WINDOW_FRAME_WIDTH * vpr);
|
||||
rectExceptFrame_.posY_ = winRect.posY_ +
|
||||
static_cast<int32_t>(WINDOW_FRAME_WIDTH * vpr);
|
||||
rectExceptFrame_.width_ = winRect.width_ -
|
||||
static_cast<uint32_t>((WINDOW_FRAME_WIDTH + WINDOW_FRAME_WIDTH) * vpr);
|
||||
rectExceptFrame_.height_ = winRect.height_ -
|
||||
static_cast<uint32_t>((WINDOW_FRAME_WIDTH + WINDOW_FRAME_WIDTH) * vpr);
|
||||
rectExceptFrame_.posX_ = winRect.posX_ + static_cast<int32_t>(WINDOW_FRAME_WIDTH * vpr);
|
||||
rectExceptFrame_.posY_ = winRect.posY_ + static_cast<int32_t>(WINDOW_FRAME_WIDTH * vpr);
|
||||
rectExceptFrame_.width_ = winRect.width_ - static_cast<uint32_t>((WINDOW_FRAME_WIDTH + WINDOW_FRAME_WIDTH) * vpr);
|
||||
rectExceptFrame_.height_ = winRect.height_ - static_cast<uint32_t>((WINDOW_FRAME_WIDTH + WINDOW_FRAME_WIDTH) * vpr);
|
||||
|
||||
rectExceptCorner_.posX_ = winRect.posX_ +
|
||||
static_cast<int32_t>(WINDOW_FRAME_CORNER_WIDTH * vpr);
|
||||
rectExceptCorner_.posY_ = winRect.posY_ +
|
||||
static_cast<int32_t>(WINDOW_FRAME_CORNER_WIDTH * vpr);
|
||||
rectExceptCorner_.width_ = winRect.width_ -
|
||||
static_cast<uint32_t>((WINDOW_FRAME_CORNER_WIDTH + WINDOW_FRAME_CORNER_WIDTH) * vpr);
|
||||
rectExceptCorner_.height_ = winRect.height_ -
|
||||
static_cast<uint32_t>((WINDOW_FRAME_CORNER_WIDTH + WINDOW_FRAME_CORNER_WIDTH) * vpr);
|
||||
rectExceptCorner_.posX_ = winRect.posX_ + static_cast<int32_t>(WINDOW_FRAME_CORNER_WIDTH * vpr);
|
||||
rectExceptCorner_.posY_ = winRect.posY_ + static_cast<int32_t>(WINDOW_FRAME_CORNER_WIDTH * vpr);
|
||||
rectExceptCorner_.width_ =
|
||||
winRect.width_ - static_cast<uint32_t>((WINDOW_FRAME_CORNER_WIDTH + WINDOW_FRAME_CORNER_WIDTH) * vpr);
|
||||
rectExceptCorner_.height_ =
|
||||
winRect.height_ - static_cast<uint32_t>((WINDOW_FRAME_CORNER_WIDTH + WINDOW_FRAME_CORNER_WIDTH) * vpr);
|
||||
}
|
||||
|
||||
WSError MoveDragController::UpdateMoveTempProperty(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
|
||||
@ -954,7 +937,7 @@ WSError MoveDragController::UpdateMoveTempProperty(const std::shared_ptr<MMI::Po
|
||||
case MMI::PointerEvent::POINTER_ACTION_UP:
|
||||
case MMI::PointerEvent::POINTER_ACTION_BUTTON_UP:
|
||||
case MMI::PointerEvent::POINTER_ACTION_CANCEL: {
|
||||
moveTempProperty_ = { -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
moveTempProperty_ = {-1, -1, -1, -1, -1, -1, -1, -1};
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -990,8 +973,8 @@ void MoveDragController::CalcFirstMoveTargetRect(const WSRect& windowRect, bool
|
||||
originalRect.width_,
|
||||
originalRect.height_
|
||||
};
|
||||
WLOGFD("first move rect: [%{public}d, %{public}d, %{public}u, %{public}u]", targetRect.posX_, targetRect.posY_,
|
||||
targetRect.width_, targetRect.height_);
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "first move rect: [%{public}d, %{public}d, %{public}u, %{public}u]", targetRect.posX_,
|
||||
targetRect.posY_, targetRect.width_, targetRect.height_);
|
||||
moveDragProperty_.targetRect_ = targetRect;
|
||||
ProcessSessionRectChange(SizeChangeReason::MOVE);
|
||||
}
|
||||
@ -1030,9 +1013,9 @@ void MoveDragController::UpdateHotAreaType(const std::shared_ptr<MMI::PointerEve
|
||||
}
|
||||
int32_t pointerDisplayX = pointerItem.GetDisplayX();
|
||||
int32_t pointerDisplayY = pointerItem.GetDisplayY();
|
||||
DisplayId displayId = pointerEvent->GetTargetDisplayId();
|
||||
uint32_t windowDragHotAreaType = SceneSession::GetWindowDragHotAreaType(displayId,
|
||||
WINDOW_HOT_AREA_TYPE_UNDEFINED, pointerDisplayX, pointerDisplayY);
|
||||
DisplayId displayId = static_cast<uint64_t>(pointerEvent->GetTargetDisplayId());
|
||||
uint32_t windowDragHotAreaType = SceneSession::GetWindowDragHotAreaType(displayId, WINDOW_HOT_AREA_TYPE_UNDEFINED,
|
||||
pointerDisplayX, pointerDisplayY);
|
||||
if (windowDragHotAreaType_ != windowDragHotAreaType) {
|
||||
WLOGFI("the pointerEvent is window drag hot area, old type is: %{public}d, new type is: %{public}d",
|
||||
windowDragHotAreaType_, windowDragHotAreaType);
|
||||
@ -1084,8 +1067,8 @@ std::set<uint64_t> MoveDragController::GetNewAddedDisplayIdsDuringMoveDrag()
|
||||
{
|
||||
std::set<uint64_t> newAddedDisplayIdSet;
|
||||
WSRect windowRect = GetTargetRect(TargetRectCoordinate::GLOBAL);
|
||||
std::map<ScreenId, ScreenProperty> screenProperties = ScreenSessionManagerClient::GetInstance().
|
||||
GetAllScreensProperties();
|
||||
std::map<ScreenId, ScreenProperty> screenProperties =
|
||||
ScreenSessionManagerClient::GetInstance().GetAllScreensProperties();
|
||||
std::lock_guard<std::mutex> lock(displayIdSetDuringMoveDragMutex_);
|
||||
for (const auto& [screenId, screenProperty] : screenProperties) {
|
||||
if (displayIdSetDuringMoveDrag_.find(screenId) != displayIdSetDuringMoveDrag_.end()) {
|
||||
@ -1118,4 +1101,4 @@ void MoveDragController::ResSchedReportData(int32_t type, bool onOffTag)
|
||||
WLOGFD("ResSchedReportData success type: %{public}d onOffTag: %{public}d", type, onOffTag);
|
||||
#endif
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -74,7 +74,7 @@ void MultiInstanceManager::SetCurrentUserId(int32_t userId)
|
||||
|
||||
bool MultiInstanceManager::IsMultiInstance(const std::string& bundleName)
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(appInfoMutex_);
|
||||
std::unique_lock<std::shared_mutex> lock(appInfoMutex_);
|
||||
auto iter = appInfoMap_.find(bundleName);
|
||||
if (iter == appInfoMap_.end()) {
|
||||
AppExecFwk::ApplicationInfo appInfo;
|
||||
@ -91,7 +91,7 @@ bool MultiInstanceManager::IsMultiInstance(const std::string& bundleName)
|
||||
|
||||
uint32_t MultiInstanceManager::GetMaxInstanceCount(const std::string& bundleName)
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(appInfoMutex_);
|
||||
std::unique_lock<std::shared_mutex> lock(appInfoMutex_);
|
||||
auto iter = appInfoMap_.find(bundleName);
|
||||
if (iter == appInfoMap_.end()) {
|
||||
AppExecFwk::ApplicationInfo appInfo;
|
||||
|
@ -537,7 +537,8 @@ WSError SceneSession::OnSessionEvent(SessionEvent event)
|
||||
session->moveDragController_->GetOriginalPointerPosY()});
|
||||
}
|
||||
if (session->moveDragController_ && event == SessionEvent::EVENT_DRAG) {
|
||||
WSRect rect = session->moveDragController_->GetTargetRect();
|
||||
WSRect rect = session->moveDragController_->GetTargetRect(
|
||||
MoveDragController::TargetRectCoordinate::RELATED_TO_START_DISPLAY);
|
||||
session->SetSessionEventParam({rect.posX_, rect.posY_, rect.width_, rect.height_});
|
||||
}
|
||||
if (session->sessionChangeCallback_ && session->sessionChangeCallback_->OnSessionEvent_) {
|
||||
@ -1218,7 +1219,7 @@ void SceneSession::SetAutoStartPiPStatusChangeCallback(const NotifyAutoStartPiPS
|
||||
}
|
||||
|
||||
/** @note @window.layout */
|
||||
void SceneSession::UpdateSessionRectInner(const WSRect& rect, const SizeChangeReason reason)
|
||||
void SceneSession::UpdateSessionRectInner(const WSRect& rect, SizeChangeReason reason)
|
||||
{
|
||||
auto newWinRect = winRect_;
|
||||
auto newRequestRect = GetSessionRequestRect();
|
||||
@ -1263,7 +1264,7 @@ void SceneSession::UpdateSessionRectInner(const WSRect& rect, const SizeChangeRe
|
||||
|
||||
/** @note @window.layout */
|
||||
WSError SceneSession::UpdateSessionRect(
|
||||
const WSRect &rect, const SizeChangeReason reason, bool isGlobal, bool isFromMoveToGlobal)
|
||||
const WSRect &rect, SizeChangeReason reason, bool isGlobal, bool isFromMoveToGlobal)
|
||||
{
|
||||
if ((reason == SizeChangeReason::MOVE || reason == SizeChangeReason::RESIZE) &&
|
||||
GetWindowType() == WindowType::WINDOW_TYPE_PIP) {
|
||||
@ -1489,7 +1490,7 @@ WSError SceneSession::RaiseAppMainWindowToTop()
|
||||
if (session->IsFocusedOnShow()) {
|
||||
FocusChangeReason reason = FocusChangeReason::MOVE_UP;
|
||||
session->NotifyRequestFocusStatusNotifyManager(true, true, reason);
|
||||
session->NotifyClick();
|
||||
session->NotifyClick(true, false);
|
||||
} else {
|
||||
session->SetFocusedOnShow(true);
|
||||
}
|
||||
@ -1918,8 +1919,8 @@ WSError SceneSession::GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoid
|
||||
}
|
||||
|
||||
using T = std::underlying_type_t<AvoidAreaType>;
|
||||
for (T avoidType = static_cast<T>(AvoidAreaType::TYPE_SYSTEM);
|
||||
avoidType <= static_cast<T>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR); avoidType++) {
|
||||
for (T avoidType = static_cast<T>(AvoidAreaType::TYPE_START);
|
||||
avoidType < static_cast<T>(AvoidAreaType::TYPE_END); avoidType++) {
|
||||
auto type = static_cast<AvoidAreaType>(avoidType);
|
||||
avoidAreas[type] = session->GetAvoidAreaByTypeInner(type);
|
||||
}
|
||||
@ -2259,7 +2260,7 @@ void SceneSession::RotateDragWindow(std::shared_ptr<RSTransaction> rsTransaction
|
||||
|
||||
/** @note @window.layout */
|
||||
void SceneSession::NotifySessionRectChange(const WSRect& rect,
|
||||
const SizeChangeReason reason, const DisplayId displayId)
|
||||
SizeChangeReason reason, DisplayId displayId)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), rect, reason, displayId] {
|
||||
auto session = weakThis.promote();
|
||||
@ -2393,7 +2394,7 @@ bool SceneSession::FixRectByAspectRatio(WSRect& rect)
|
||||
return true;
|
||||
}
|
||||
|
||||
void SceneSession::HandleCompatibleModeMoveDrag(WSRect& rect, const SizeChangeReason reason,
|
||||
void SceneSession::HandleCompatibleModeMoveDrag(WSRect& rect, SizeChangeReason reason,
|
||||
bool isSupportDragInPcCompatibleMode, bool isGlobal, bool needFlush)
|
||||
{
|
||||
auto sessionProperty = GetSessionProperty();
|
||||
@ -2409,7 +2410,7 @@ void SceneSession::HandleCompatibleModeMoveDrag(WSRect& rect, const SizeChangeRe
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::HandleCompatibleModeDrag(WSRect& rect, const SizeChangeReason reason,
|
||||
void SceneSession::HandleCompatibleModeDrag(WSRect& rect, SizeChangeReason reason,
|
||||
bool isSupportDragInPcCompatibleMode, bool isGlobal, bool needFlush)
|
||||
{
|
||||
auto sessionProperty = GetSessionProperty();
|
||||
@ -2465,7 +2466,7 @@ void SceneSession::HandleCompatibleModeDrag(WSRect& rect, const SizeChangeReason
|
||||
void SceneSession::SetMoveDragCallback()
|
||||
{
|
||||
if (moveDragController_) {
|
||||
MoveDragCallback callBack = [this](const SizeChangeReason reason) {
|
||||
MoveDragCallback callBack = [this](SizeChangeReason reason) {
|
||||
this->OnMoveDragCallback(reason);
|
||||
};
|
||||
moveDragController_->RegisterMoveDragCallback(callBack);
|
||||
@ -2489,7 +2490,7 @@ void SceneSession::InitializeCrossMoveDrag()
|
||||
moveDragController_->InitCrossDisplayProperty(property->GetDisplayId(), parentNode->GetId());
|
||||
}
|
||||
|
||||
void SceneSession::HandleMoveDrag(WSRect& rect, WSRect& globalRect, const SizeChangeReason reason,
|
||||
void SceneSession::HandleMoveDragSurfaceBounds(WSRect& rect, WSRect& globalRect, SizeChangeReason reason,
|
||||
bool isGlobal, bool needFlush)
|
||||
{
|
||||
const char* const funcName = __func__;
|
||||
@ -2526,14 +2527,14 @@ void SceneSession::OnNextVsyncDragReceived()
|
||||
});
|
||||
}
|
||||
|
||||
void SceneSession::HandleMoveDragEnd(WSRect& rect, const SizeChangeReason reason)
|
||||
void SceneSession::HandleMoveDragEnd(WSRect& rect, SizeChangeReason reason)
|
||||
{
|
||||
if (GetOriPosYBeforeRaisedByKeyboard() != 0) {
|
||||
TLOGI(WmsLogTag::WMS_KEYBOARD, "Calling session is moved and reset oriPosYBeforeRaisedByKeyboard");
|
||||
SetOriPosYBeforeRaisedByKeyboard(0);
|
||||
}
|
||||
if (moveDragController_->GetMoveDragEndDisplayId() == moveDragController_->GetMoveDragStartDisplayId() ||
|
||||
moveDragController_->IsSystemWindow()) {
|
||||
WindowHelper::IsSystemWindow(GetWindowType())) {
|
||||
NotifySessionRectChange(rect, reason);
|
||||
} else {
|
||||
NotifySessionRectChange(rect, reason, moveDragController_->GetMoveDragEndDisplayId());
|
||||
@ -2542,7 +2543,7 @@ void SceneSession::HandleMoveDragEnd(WSRect& rect, const SizeChangeReason reason
|
||||
OnSessionEvent(SessionEvent::EVENT_END_MOVE);
|
||||
}
|
||||
|
||||
void SceneSession::OnMoveDragCallback(const SizeChangeReason reason)
|
||||
void SceneSession::OnMoveDragCallback(SizeChangeReason reason)
|
||||
{
|
||||
if (!moveDragController_) {
|
||||
WLOGE("moveDragController_ is null");
|
||||
@ -2583,7 +2584,7 @@ void SceneSession::OnMoveDragCallback(const SizeChangeReason reason)
|
||||
OnSessionEvent(SessionEvent::EVENT_DRAG);
|
||||
return;
|
||||
} else {
|
||||
HandleMoveDrag(rect, globalRect, reason, isGlobal, needFlush);
|
||||
HandleMoveDragSurfaceBounds(rect, globalRect, reason, isGlobal, needFlush);
|
||||
}
|
||||
if (reason == SizeChangeReason::DRAG_END) {
|
||||
HandleMoveDragEnd(rect, reason);
|
||||
@ -2592,7 +2593,7 @@ void SceneSession::OnMoveDragCallback(const SizeChangeReason reason)
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::HandleMoveDragSurfaceNode(const SizeChangeReason reason)
|
||||
void SceneSession::HandleMoveDragSurfaceNode(SizeChangeReason reason)
|
||||
{
|
||||
auto movedSurfaceNode = GetSurfaceNodeForMoveDrag();
|
||||
if (movedSurfaceNode == nullptr) {
|
||||
@ -2611,9 +2612,13 @@ void SceneSession::HandleMoveDragSurfaceNode(const SizeChangeReason reason)
|
||||
}
|
||||
movedSurfaceNode->SetPositionZ(MOVE_DRAG_POSITION_Z);
|
||||
screenSession->GetDisplayNode()->AddCrossParentChild(movedSurfaceNode, -1);
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "Add window to display: %{public}" PRIu64, displayId);
|
||||
}
|
||||
} else if (reason == SizeChangeReason::DRAG_END) {
|
||||
for (const auto displayId : moveDragController_->GetDisplayIdsDuringMoveDrag()) {
|
||||
if (displayId == moveDragController_->GetMoveDragStartDisplayId()) {
|
||||
continue;
|
||||
}
|
||||
auto screenSession = ScreenSessionManagerClient::GetInstance().GetScreenSessionById(displayId);
|
||||
if (screenSession == nullptr) {
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "ScreenSession is null");
|
||||
@ -2621,6 +2626,7 @@ void SceneSession::HandleMoveDragSurfaceNode(const SizeChangeReason reason)
|
||||
}
|
||||
screenSession->GetDisplayNode()->RemoveCrossParentChild(
|
||||
movedSurfaceNode, moveDragController_->GetInitParentNodeId());
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "Remove window from display: %{public}" PRIu64, displayId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2666,7 +2672,8 @@ void SceneSession::UpdateWinRectForSystemBar(WSRect& rect)
|
||||
|
||||
void SceneSession::SetSurfaceBounds(const WSRect& rect, bool isGlobal, bool needFlush)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "rect: %{public}s", rect.ToString().c_str());
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "rect: %{public}s isGlobal: %{public}d needFlush: %{public}d",
|
||||
rect.ToString().c_str(), isGlobal, needFlush);
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction != nullptr && needFlush) {
|
||||
rsTransaction->Begin();
|
||||
@ -4199,9 +4206,9 @@ WSError SceneSession::TerminateSession(const sptr<AAFwk::SessionInfo> abilitySes
|
||||
}
|
||||
|
||||
WSError SceneSession::NotifySessionExceptionInner(const sptr<AAFwk::SessionInfo> abilitySessionInfo,
|
||||
bool needRemoveSession, bool isFromClient)
|
||||
bool needRemoveSession, bool isFromClient, bool startFail)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), abilitySessionInfo, needRemoveSession, isFromClient]() {
|
||||
auto task = [weakThis = wptr(this), abilitySessionInfo, needRemoveSession, isFromClient, startFail]() {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "session is null");
|
||||
@ -4238,11 +4245,11 @@ WSError SceneSession::NotifySessionExceptionInner(const sptr<AAFwk::SessionInfo>
|
||||
}
|
||||
if (session->sessionExceptionFunc_) {
|
||||
auto exceptionFunc = *(session->sessionExceptionFunc_);
|
||||
exceptionFunc(info, needRemoveSession);
|
||||
exceptionFunc(info, needRemoveSession, false);
|
||||
}
|
||||
if (session->jsSceneSessionExceptionFunc_) {
|
||||
auto exceptionFunc = *(session->jsSceneSessionExceptionFunc_);
|
||||
exceptionFunc(info, needRemoveSession);
|
||||
exceptionFunc(info, needRemoveSession, startFail);
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
};
|
||||
@ -4453,7 +4460,8 @@ WSRect SceneSession::GetSessionTargetRect() const
|
||||
{
|
||||
WSRect rect;
|
||||
if (moveDragController_) {
|
||||
rect = moveDragController_->GetTargetRect();
|
||||
rect = moveDragController_->GetTargetRect(
|
||||
MoveDragController::TargetRectCoordinate::RELATED_TO_START_DISPLAY);
|
||||
} else {
|
||||
WLOGFI("moveDragController_ is null");
|
||||
}
|
||||
@ -5270,6 +5278,10 @@ bool SceneSession::UpdateScaleInner(float scaleX, float scaleY, float pivotX, fl
|
||||
NearEqual(pivotX_, pivotX) && NearEqual(pivotY_, pivotY)) {
|
||||
return false;
|
||||
}
|
||||
if (!IsSessionForeground()) {
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "id:%{public}d, session is not foreground!", GetPersistentId());
|
||||
return false;
|
||||
}
|
||||
Session::SetScale(scaleX, scaleY, pivotX, pivotY);
|
||||
if (sessionStage_ != nullptr) {
|
||||
Transform transform;
|
||||
|
@ -223,12 +223,6 @@ void Session::SetSessionInfoWant(const std::shared_ptr<AAFwk::Want>& want)
|
||||
sessionInfo_.want = want;
|
||||
}
|
||||
|
||||
void Session::SetSessionInfoProcessOptions(const std::shared_ptr<AAFwk::ProcessOptions>& processOptions)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(sessionInfoMutex_);
|
||||
sessionInfo_.processOptions = processOptions;
|
||||
}
|
||||
|
||||
void Session::ResetSessionInfoResultCode()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(sessionInfoMutex_);
|
||||
@ -294,6 +288,7 @@ void Session::SetSessionInfo(const SessionInfo& info)
|
||||
sessionInfo_.continueSessionId_ = info.continueSessionId_;
|
||||
sessionInfo_.isAtomicService_ = info.isAtomicService_;
|
||||
sessionInfo_.callState_ = info.callState_;
|
||||
sessionInfo_.processOptions = info.processOptions;
|
||||
}
|
||||
|
||||
void Session::SetScreenId(uint64_t screenId)
|
||||
@ -1395,23 +1390,14 @@ void Session::SetIsPendingToBackgroundState(bool isPendingToBackgroundState)
|
||||
|
||||
bool Session::IsActivatedAfterScreenLocked() const
|
||||
{
|
||||
return isActivatedAfterScreenLocked_;
|
||||
return isActivatedAfterScreenLocked_.load();
|
||||
}
|
||||
|
||||
void Session::SetIsActivatedAfterScreenLocked(bool isActivatedAfterScreenLocked)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), isActivatedAfterScreenLocked] {
|
||||
auto session = weakThis.promote();
|
||||
if (session == nullptr) {
|
||||
TLOGNE(WmsLogTag::WMS_LIFE, "session is null");
|
||||
return;
|
||||
}
|
||||
TLOGNI(WmsLogTag::WMS_LIFE, "id:%{public}d, isActivatedAfterScreenLocked:%{public}d",
|
||||
session->GetPersistentId(), isActivatedAfterScreenLocked);
|
||||
session->isActivatedAfterScreenLocked_ = isActivatedAfterScreenLocked;
|
||||
return;
|
||||
};
|
||||
PostTask(task, __func__);
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "id:%{public}d, isActivatedAfterScreenLocked:%{public}d",
|
||||
GetPersistentId(), isActivatedAfterScreenLocked);
|
||||
isActivatedAfterScreenLocked_.store(isActivatedAfterScreenLocked);
|
||||
}
|
||||
|
||||
void Session::SetAttachState(bool isAttach, WindowMode windowMode)
|
||||
@ -2294,14 +2280,18 @@ void Session::NotifySessionStateChange(const SessionState& state)
|
||||
WLOGFE("session is null");
|
||||
return;
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "NotifySessionStateChange, [state: %{public}u, persistent: %{public}d]",
|
||||
TLOGND(WmsLogTag::WMS_LIFE, "NotifySessionStateChange, [state: %{public}u, persistent: %{public}d]",
|
||||
static_cast<uint32_t>(state), session->GetPersistentId());
|
||||
if (session->sessionStateChangeFunc_) {
|
||||
session->sessionStateChangeFunc_(state);
|
||||
} else {
|
||||
TLOGNI(WmsLogTag::WMS_LIFE, "sessionStateChangeFunc is null");
|
||||
}
|
||||
|
||||
if (session->sessionStateChangeNotifyManagerFunc_) {
|
||||
session->sessionStateChangeNotifyManagerFunc_(session->GetPersistentId(), state);
|
||||
} else {
|
||||
TLOGNI(WmsLogTag::WMS_LIFE, "sessionStateChangeNotifyManagerFunc is null");
|
||||
}
|
||||
};
|
||||
PostTask(task, "NotifySessionStateChange");
|
||||
@ -2340,11 +2330,11 @@ void Session::NotifySessionTouchableChange(bool touchable)
|
||||
}
|
||||
}
|
||||
|
||||
void Session::NotifyClick(bool requestFocus)
|
||||
void Session::NotifyClick(bool requestFocus, bool isClick)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "requestFocus: %{public}u", requestFocus);
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "requestFocus: %{public}u, isClick: %{public}u", requestFocus, isClick);
|
||||
if (clickFunc_) {
|
||||
clickFunc_(requestFocus);
|
||||
clickFunc_(requestFocus, isClick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2846,6 +2836,16 @@ bool Session::GetEnableRemoveStartingWindow() const
|
||||
return enableRemoveStartingWindow_;
|
||||
}
|
||||
|
||||
void Session::SetAppBufferReady(bool appBufferReady)
|
||||
{
|
||||
appBufferReady_ = appBufferReady;
|
||||
}
|
||||
|
||||
bool Session::GetAppBufferReady() const
|
||||
{
|
||||
return appBufferReady_;
|
||||
}
|
||||
|
||||
WindowType Session::GetWindowType() const
|
||||
{
|
||||
auto property = GetSessionProperty();
|
||||
@ -2923,7 +2923,8 @@ void Session::GeneratePersistentId(bool isExtension, int32_t persistentId)
|
||||
persistentId_ = static_cast<uint32_t>(g_persistentId.load()) & 0x3fffffff;
|
||||
}
|
||||
g_persistentIdSet.insert(g_persistentId);
|
||||
WLOGFI("GeneratePersistentId, persistentId: %{public}d, persistentId_: %{public}d", persistentId, persistentId_);
|
||||
TLOGI(WmsLogTag::WMS_LIFE,
|
||||
"persistentId: %{public}d, persistentId_: %{public}d", persistentId, persistentId_);
|
||||
}
|
||||
|
||||
sptr<ScenePersistence> Session::GetScenePersistence() const
|
||||
|
@ -32,7 +32,7 @@ constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "SubSes
|
||||
SubSession::SubSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback)
|
||||
: SceneSession(info, specificCallback)
|
||||
{
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId());
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId(), GetWindowType());
|
||||
if (specificCallback != nullptr &&
|
||||
specificCallback->onWindowInputPidChangeCallback_ != nullptr) {
|
||||
moveDragController_->SetNotifyWindowPidChangeCallback(specificCallback->onWindowInputPidChangeCallback_);
|
||||
|
@ -34,7 +34,7 @@ SystemSession::SystemSession(const SessionInfo& info, const sptr<SpecificSession
|
||||
: SceneSession(info, specificCallback)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "Create SystemSession");
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId(), true);
|
||||
moveDragController_ = sptr<MoveDragController>::MakeSptr(GetPersistentId(), GetWindowType());
|
||||
if (specificCallback != nullptr &&
|
||||
specificCallback->onWindowInputPidChangeCallback_ != nullptr) {
|
||||
moveDragController_->SetNotifyWindowPidChangeCallback(specificCallback_->onWindowInputPidChangeCallback_);
|
||||
|
@ -753,7 +753,7 @@ WSError SessionProxy::OnRestoreMainWindow()
|
||||
}
|
||||
|
||||
/** @note @window.layout */
|
||||
WSError SessionProxy::UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason,
|
||||
WSError SessionProxy::UpdateSessionRect(const WSRect& rect, SizeChangeReason reason,
|
||||
bool isGlobal, bool isFromMoveToGlobal)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "Rect [%{public}d, %{public}d, %{public}u, %{public}u]",
|
||||
|
@ -416,12 +416,18 @@ int SessionStub::HandleRemoveStartingWindow(MessageParcel& data, MessageParcel&
|
||||
|
||||
int SessionStub::HandleSessionEvent(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "In!");
|
||||
uint32_t eventId = 0;
|
||||
if (!data.ReadUint32(eventId)) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "read eventId failed");
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "read eventId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "eventId: %{public}d", eventId);
|
||||
if (eventId < static_cast<uint32_t>(SessionEvent::EVENT_MAXIMIZE) ||
|
||||
eventId > static_cast<uint32_t>(SessionEvent::EVENT_DRAG)) {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "Invalid eventId: %{public}d", eventId);
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "eventId: %{public}d", eventId);
|
||||
WSError errCode = OnSessionEvent(static_cast<SessionEvent>(eventId));
|
||||
reply.WriteUint32(static_cast<uint32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
@ -429,8 +435,13 @@ int SessionStub::HandleSessionEvent(MessageParcel& data, MessageParcel& reply)
|
||||
|
||||
int SessionStub::HandleSyncSessionEvent(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
uint32_t eventId = data.ReadUint32();
|
||||
WLOGFD("HandleSyncSessionEvent eventId: %{public}d", eventId);
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "In!");
|
||||
uint32_t eventId;
|
||||
if (!data.ReadUint32(eventId)) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "read eventId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "eventId: %{public}d", eventId);
|
||||
WSError errCode = SyncSessionEvent(static_cast<SessionEvent>(eventId));
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
@ -812,8 +823,7 @@ int SessionStub::HandleGetAvoidAreaByType(MessageParcel& data, MessageParcel& re
|
||||
{
|
||||
uint32_t typeId = 0;
|
||||
if (!data.ReadUint32(typeId) ||
|
||||
typeId < static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM) ||
|
||||
typeId > static_cast<uint32_t>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR)) {
|
||||
typeId >= static_cast<uint32_t>(AvoidAreaType::TYPE_END)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
AvoidAreaType type = static_cast<AvoidAreaType>(typeId);
|
||||
|
@ -286,6 +286,8 @@ public:
|
||||
std::vector<SCBAbilityInfo>& scbAbilityInfos);
|
||||
WSError GetBatchAbilityInfos(const std::vector<std::string>& bundleNames, int32_t userId,
|
||||
std::vector<SCBAbilityInfo>& scbAbilityInfos);
|
||||
WSError GetAbilityInfo(const std::string& bundleName, const std::string& moduleName,
|
||||
const std::string& abilityName, int32_t userId, SCBAbilityInfo& scbAbilityInfo);
|
||||
WSError PrepareTerminate(int32_t persistentId, bool& isPrepareTerminate);
|
||||
|
||||
WSError TerminateSessionNew(
|
||||
@ -371,7 +373,7 @@ public:
|
||||
* Window Immersive
|
||||
*/
|
||||
WSError GetIsLayoutFullScreen(bool& isLayoutFullScreen);
|
||||
WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) override;
|
||||
WSError UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener) override;
|
||||
bool GetImmersiveState(ScreenId screenId);
|
||||
WSError NotifyStatusBarShowStatus(int32_t persistentId, bool isVisible);
|
||||
WSError NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea, uint64_t displayId);
|
||||
@ -619,16 +621,16 @@ private:
|
||||
void UpdateFocusableProperty(int32_t persistentId);
|
||||
WMError UpdateTopmostProperty(const sptr<WindowSessionProperty>& property, const sptr<SceneSession>& sceneSession);
|
||||
std::vector<sptr<SceneSession>> GetSceneSessionVectorByType(WindowType type, uint64_t displayId);
|
||||
void UpdateOccupiedAreaIfNeed(const int32_t& persistentId);
|
||||
void UpdateOccupiedAreaIfNeed(int32_t persistentId);
|
||||
void NotifyMMIWindowPidChange(int32_t windowId, bool startMoving);
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
*/
|
||||
bool UpdateSessionAvoidAreaIfNeed(const int32_t& persistentId,
|
||||
bool UpdateSessionAvoidAreaIfNeed(const int32_t persistentId,
|
||||
const sptr<SceneSession>& sceneSession, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType);
|
||||
void UpdateAvoidSessionAvoidArea(WindowType type, bool& needUpdate);
|
||||
void UpdateNormalSessionAvoidArea(const int32_t& persistentId, sptr<SceneSession>& sceneSession, bool& needUpdate);
|
||||
void UpdateNormalSessionAvoidArea(const int32_t persistentId, const sptr<SceneSession>& sceneSession, bool& needUpdate);
|
||||
void UpdateAvoidArea(int32_t persistentId);
|
||||
void UpdateAvoidAreaByType(int32_t persistentId, AvoidAreaType type);
|
||||
void UpdateDarkColorModeToRS();
|
||||
@ -654,6 +656,7 @@ private:
|
||||
void PerformRegisterInRequestSceneSession(sptr<SceneSession>& sceneSession);
|
||||
WSError RequestSceneSessionActivationInner(sptr<SceneSession>& sceneSession, bool isNewActive);
|
||||
WSError SetBrightness(const sptr<SceneSession>& sceneSession, float brightness);
|
||||
void PostBrightnessTask(float brightness);
|
||||
WSError UpdateBrightness(int32_t persistentId);
|
||||
void SetDisplayBrightness(float brightness);
|
||||
float GetDisplayBrightness() const;
|
||||
@ -692,7 +695,7 @@ private:
|
||||
void DestroyExtensionSession(const sptr<IRemoteObject>& remoteExtSession);
|
||||
void EraseSceneSessionMapById(int32_t persistentId);
|
||||
void EraseSceneSessionAndMarkDirtyLockFree(int32_t persistentId);
|
||||
WSError GetAbilityInfosFromBundleInfo(std::vector<AppExecFwk::BundleInfo>& bundleInfos,
|
||||
WSError GetAbilityInfosFromBundleInfo(const std::vector<AppExecFwk::BundleInfo>& bundleInfos,
|
||||
std::vector<SCBAbilityInfo>& scbAbilityInfos);
|
||||
void GetOrientationFromResourceManager(AppExecFwk::AbilityInfo& abilityInfo);
|
||||
void UpdatePrivateStateAndNotifyForAllScreens();
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) override;
|
||||
WSError GetSessionDumpInfo(const std::vector<std::string>& params, std::string& info) override;
|
||||
void NotifyDumpInfoResult(const std::vector<std::string>& info) override;
|
||||
WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) override;
|
||||
WSError UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener) override;
|
||||
WSError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener) override;
|
||||
WSError UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener) override;
|
||||
WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
|
||||
|
@ -188,6 +188,10 @@ void SceneInputManager::ConstructDisplayInfos(std::vector<MMI::DisplayInfo>& dis
|
||||
{
|
||||
std::map<ScreenId, ScreenProperty> screensProperties =
|
||||
Rosen::ScreenSessionManagerClient::GetInstance().GetAllScreensProperties();
|
||||
if (screensProperties.empty()) {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "screensProperties is empty");
|
||||
return;
|
||||
}
|
||||
auto displayMode = Rosen::ScreenSessionManagerClient::GetInstance().GetFoldDisplayMode();
|
||||
for (auto& iter: screensProperties) {
|
||||
auto screenId = iter.first;
|
||||
|
@ -1347,7 +1347,7 @@ sptr<SceneSession::SpecificSessionCallback> SceneSessionManager::CreateSpecificS
|
||||
specificCb->onUpdateAvoidAreaByType_ = [this](int32_t persistentId, AvoidAreaType type) {
|
||||
this->UpdateAvoidAreaByType(persistentId, type);
|
||||
};
|
||||
specificCb->onUpdateOccupiedAreaIfNeed_ = [this](const int32_t& persistentId) {
|
||||
specificCb->onUpdateOccupiedAreaIfNeed_ = [this](int32_t persistentId) {
|
||||
this->UpdateOccupiedAreaIfNeed(persistentId);
|
||||
};
|
||||
specificCb->onWindowInfoUpdate_ = [this](int32_t persistentId, WindowUpdateType type) {
|
||||
@ -1984,7 +1984,7 @@ WSError SceneSessionManager::RequestSceneSessionActivationInner(
|
||||
|
||||
if (errCode != ERR_OK) {
|
||||
TLOGI(WmsLogTag::WMS_MAIN, "failed! errCode: %{public}d", errCode);
|
||||
sceneSession->NotifySessionExceptionInner(sceneSessionInfo, true);
|
||||
sceneSession->NotifySessionExceptionInner(sceneSessionInfo, true, false, true);
|
||||
if (startUIAbilityErrorFunc_ && static_cast<WSError>(errCode) == WSError::WS_ERROR_EDM_CONTROLLED) {
|
||||
startUIAbilityErrorFunc_(
|
||||
static_cast<uint32_t>(WS_JS_TO_ERROR_CODE_MAP.at(WSError::WS_ERROR_EDM_CONTROLLED)));
|
||||
@ -3308,7 +3308,7 @@ WSError SceneSessionManager::StartOrMinimizeUIAbilityBySCB(const sptr<SceneSessi
|
||||
abilitySessionInfo, isColdStart, static_cast<uint32_t>(WindowStateChangeReason::USER_SWITCH));
|
||||
if (errCode != ERR_OK) {
|
||||
TLOGE(WmsLogTag::WMS_MULTI_USER, "start failed! errCode: %{public}d", errCode);
|
||||
sceneSession->NotifySessionExceptionInner(abilitySessionInfo, true);
|
||||
sceneSession->NotifySessionExceptionInner(abilitySessionInfo, true, false, true);
|
||||
if (startUIAbilityErrorFunc_ && static_cast<WSError>(errCode) == WSError::WS_ERROR_EDM_CONTROLLED) {
|
||||
startUIAbilityErrorFunc_(
|
||||
static_cast<uint32_t>(WS_JS_TO_ERROR_CODE_MAP.at(WSError::WS_ERROR_EDM_CONTROLLED)));
|
||||
@ -3760,6 +3760,10 @@ void SceneSessionManager::HandleHideNonSystemFloatingWindows(const sptr<WindowSe
|
||||
void SceneSessionManager::UpdateForceHideState(const sptr<SceneSession>& sceneSession,
|
||||
const sptr<WindowSessionProperty>& property, bool add)
|
||||
{
|
||||
if (systemConfig_.IsPcWindow()) {
|
||||
TLOGI(WmsLogTag::DEFAULT, "IsPcWindow, ineffective");
|
||||
return;
|
||||
}
|
||||
if (property == nullptr) {
|
||||
WLOGFD("property is null");
|
||||
return;
|
||||
@ -3790,7 +3794,7 @@ void SceneSessionManager::UpdateForceHideState(const sptr<SceneSession>& sceneSe
|
||||
}
|
||||
if (notifyAll) {
|
||||
bool forceHideFloatNew = !systemTopSceneSessionMap_.empty();
|
||||
for (const auto &item : nonSystemFloatSceneSessionMap_) {
|
||||
for (const auto& item : nonSystemFloatSceneSessionMap_) {
|
||||
auto forceHideSceneSession = item.second;
|
||||
auto forceHideProperty = forceHideSceneSession->GetSessionProperty();
|
||||
if (forceHideProperty && forceHideFloatNew != forceHideProperty->GetForceHide()) {
|
||||
@ -3887,24 +3891,7 @@ WSError SceneSessionManager::SetBrightness(const sptr<SceneSession>& sceneSessio
|
||||
#ifdef POWERMGR_DISPLAY_MANAGER_ENABLE
|
||||
if (GetDisplayBrightness() != brightness &&
|
||||
GetFocusedSessionId() == sceneSession->GetPersistentId()) {
|
||||
bool setBrightnessRet = false;
|
||||
if (std::fabs(brightness - UNDEFINED_BRIGHTNESS) < std::numeric_limits<float>::min()) {
|
||||
auto task = []() {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().RestoreBrightness();
|
||||
};
|
||||
setBrightnessRet = eventHandler_->PostTask(task, "DisplayPowerMgr:RestoreBrightness", 0);
|
||||
SetDisplayBrightness(UNDEFINED_BRIGHTNESS); // UNDEFINED_BRIGHTNESS means system default brightness
|
||||
} else {
|
||||
auto task = [brightness]() {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().OverrideBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
};
|
||||
setBrightnessRet = eventHandler_->PostTask(task, "DisplayPowerMgr:OverrideBrightness", 0);
|
||||
SetDisplayBrightness(brightness);
|
||||
}
|
||||
if (!setBrightnessRet) {
|
||||
WLOGFE("Report post listener callback task failed. the task name is SetBrightness");
|
||||
}
|
||||
PostBrightnessTask(brightness);
|
||||
}
|
||||
#else
|
||||
WLOGFD("Can not found the sub system of DisplayPowerMgr");
|
||||
@ -3913,32 +3900,70 @@ WSError SceneSessionManager::SetBrightness(const sptr<SceneSession>& sceneSessio
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void SceneSessionManager::PostBrightnessTask(float brightness)
|
||||
{
|
||||
bool postTaskRet = true;
|
||||
bool isPC = systemConfig_.IsPcWindow();
|
||||
if (std::fabs(brightness - UNDEFINED_BRIGHTNESS) < std::numeric_limits<float>::min()) {
|
||||
if (!isPC) {
|
||||
auto task = [] {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().RestoreBrightness();
|
||||
};
|
||||
postTaskRet = eventHandler_->PostTask(task, "DisplayPowerMgr:RestoreBrightness", 0);
|
||||
}
|
||||
SetDisplayBrightness(UNDEFINED_BRIGHTNESS); // UNDEFINED_BRIGHTNESS means system default brightness
|
||||
} else {
|
||||
auto task = [brightness, isPC] {
|
||||
if (isPC) {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().SetBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
} else {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().OverrideBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
}
|
||||
};
|
||||
postTaskRet = eventHandler_->PostTask(task, "DisplayPowerMgr:OverrideBrightness", 0);
|
||||
SetDisplayBrightness(brightness);
|
||||
}
|
||||
if (!postTaskRet) {
|
||||
TLOGI(WmsLogTag::DEFAULT, "Report post listener callback task failed. the task name is SetBrightness");
|
||||
}
|
||||
}
|
||||
|
||||
WSError SceneSessionManager::UpdateBrightness(int32_t persistentId)
|
||||
{
|
||||
auto sceneSession = GetSceneSession(persistentId);
|
||||
if (sceneSession == nullptr) {
|
||||
WLOGFE("session is invalid");
|
||||
TLOGE(WmsLogTag::DEFAULT, "session is invalid");
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
if (!(sceneSession->GetWindowType() == WindowType::WINDOW_TYPE_APP_MAIN_WINDOW ||
|
||||
sceneSession->GetSessionInfo().isSystem_)) {
|
||||
WLOGW("only app main window can set brightness");
|
||||
TLOGW(WmsLogTag::DEFAULT, "only app main window can set brightness");
|
||||
return WSError::WS_DO_NOTHING;
|
||||
}
|
||||
auto brightness = sceneSession->GetBrightness();
|
||||
WLOGFI("Brightness: [%{public}f, %{public}f]", GetDisplayBrightness(), brightness);
|
||||
TLOGI(WmsLogTag::DEFAULT, "Brightness: [%{public}f, %{public}f]", GetDisplayBrightness(), brightness);
|
||||
bool isPC = systemConfig_.IsPcWindow();
|
||||
if (std::fabs(brightness - UNDEFINED_BRIGHTNESS) < std::numeric_limits<float>::min()) {
|
||||
if (GetDisplayBrightness() != brightness) {
|
||||
WLOGI("adjust brightness with default value");
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().RestoreBrightness();
|
||||
TLOGI(WmsLogTag::DEFAULT, "adjust brightness with default value");
|
||||
if (!isPC) {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().RestoreBrightness();
|
||||
}
|
||||
SetDisplayBrightness(UNDEFINED_BRIGHTNESS); // UNDEFINED_BRIGHTNESS means system default brightness
|
||||
}
|
||||
brightnessSessionId_ = INVALID_WINDOW_ID;
|
||||
} else {
|
||||
if (GetDisplayBrightness() != brightness) {
|
||||
WLOGI("adjust brightness with value");
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().OverrideBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
TLOGI(WmsLogTag::DEFAULT, "adjust brightness with value");
|
||||
if (isPC) {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().SetBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
} else {
|
||||
DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().OverrideBrightness(
|
||||
static_cast<uint32_t>(brightness * MAX_BRIGHTNESS));
|
||||
}
|
||||
SetDisplayBrightness(brightness);
|
||||
}
|
||||
brightnessSessionId_ = sceneSession->GetPersistentId();
|
||||
@ -4045,7 +4070,8 @@ void SceneSessionManager::RegisterSessionExceptionFunc(const sptr<SceneSession>&
|
||||
WLOGFE("session is nullptr");
|
||||
return;
|
||||
}
|
||||
NotifySessionExceptionFunc sessionExceptionFunc = [this](const SessionInfo& info, bool needRemoveSession = false) {
|
||||
NotifySessionExceptionFunc sessionExceptionFunc = [this](
|
||||
const SessionInfo& info, bool needRemoveSession, bool startFail) {
|
||||
auto task = [this, info] {
|
||||
auto session = GetSceneSession(info.persistentId_);
|
||||
if (session == nullptr) {
|
||||
@ -6737,27 +6763,80 @@ __attribute__((no_sanitize("cfi"))) WSError SceneSessionManager::GetBatchAbility
|
||||
return GetAbilityInfosFromBundleInfo(bundleInfos, scbAbilityInfos);
|
||||
}
|
||||
|
||||
WSError SceneSessionManager::GetAbilityInfosFromBundleInfo(std::vector<AppExecFwk::BundleInfo>& bundleInfos,
|
||||
WSError SceneSessionManager::GetAbilityInfo(const std::string& bundleName, const std::string& moduleName,
|
||||
const std::string& abilityName, int32_t userId, SCBAbilityInfo& scbAbilityInfo)
|
||||
{
|
||||
if (bundleMgr_ == nullptr) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "bundleMgr_ is nullptr");
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
auto flags = (AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION |
|
||||
AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_PERMISSION |
|
||||
AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_METADATA |
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_ABILITY) |
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) |
|
||||
static_cast<int32_t>(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE));
|
||||
AppExecFwk::BundleInfo bundleInfo;
|
||||
if (bundleMgr_->GetBundleInfoV9(bundleName, flags, bundleInfo, userId)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "Query ability info from BMS failed, ability:%{public}s", abilityName.c_str());
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
auto& hapModulesList = bundleInfo.hapModuleInfos;
|
||||
if (hapModulesList.empty()) {
|
||||
TLOGD(WmsLogTag::DEFAULT, "hapModulesList is empty, ability:%{public}s", abilityName.c_str());
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
auto sdkVersion = bundleInfo.targetVersion % 100; // % 100 to get the real version
|
||||
for (auto& hapModule : hapModulesList) {
|
||||
auto& abilityInfoList = hapModule.abilityInfos;
|
||||
for (auto& abilityInfo : abilityInfoList) {
|
||||
if (abilityInfo.moduleName == moduleName && abilityInfo.name == abilityName) {
|
||||
scbAbilityInfo.abilityInfo_ = abilityInfo;
|
||||
scbAbilityInfo.sdkVersion_ = sdkVersion;
|
||||
scbAbilityInfo.codePath_ = bundleInfo.applicationInfo.codePath;
|
||||
GetOrientationFromResourceManager(scbAbilityInfo.abilityInfo_);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
TLOGW(WmsLogTag::DEFAULT, "Ability info not found, ability:%{public}s", abilityName.c_str());
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
WSError SceneSessionManager::GetAbilityInfosFromBundleInfo(const std::vector<AppExecFwk::BundleInfo>& bundleInfos,
|
||||
std::vector<SCBAbilityInfo>& scbAbilityInfos)
|
||||
{
|
||||
if (bundleInfos.empty()) {
|
||||
WLOGFE("bundleInfos is empty");
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
for (auto bundleInfo: bundleInfos) {
|
||||
auto hapModulesList = bundleInfo.hapModuleInfos;
|
||||
for (auto& bundleInfo : bundleInfos) {
|
||||
auto& hapModulesList = bundleInfo.hapModuleInfos;
|
||||
auto sdkVersion = bundleInfo.targetVersion % 100; // %100 to get the real version
|
||||
if (hapModulesList.empty()) {
|
||||
WLOGFD("hapModulesList is empty");
|
||||
continue;
|
||||
}
|
||||
for (auto hapModule: hapModulesList) {
|
||||
auto abilityInfoList = hapModule.abilityInfos;
|
||||
for (auto abilityInfo : abilityInfoList) {
|
||||
if (bundleInfo.applicationInfo.codePath == std::to_string(CollaboratorType::RESERVE_TYPE) ||
|
||||
bundleInfo.applicationInfo.codePath == std::to_string(CollaboratorType::OTHERS_TYPE)) {
|
||||
auto iter = std::find_if(hapModulesList.begin(), hapModulesList.end(),
|
||||
[](const AppExecFwk::HapModuleInfo& hapModule) { return !hapModule.abilityInfos.empty(); });
|
||||
if (iter != hapModulesList.end()) {
|
||||
SCBAbilityInfo scbAbilityInfo;
|
||||
scbAbilityInfo.abilityInfo_ = iter->abilityInfos[0];
|
||||
scbAbilityInfo.sdkVersion_ = sdkVersion;
|
||||
scbAbilityInfo.codePath_ = bundleInfo.applicationInfo.codePath;
|
||||
GetOrientationFromResourceManager(scbAbilityInfo.abilityInfo_);
|
||||
scbAbilityInfos.push_back(scbAbilityInfo);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for (auto& hapModule : hapModulesList) {
|
||||
auto& abilityInfoList = hapModule.abilityInfos;
|
||||
for (auto& abilityInfo : abilityInfoList) {
|
||||
SCBAbilityInfo scbAbilityInfo;
|
||||
scbAbilityInfo.abilityInfo_ = abilityInfo;
|
||||
scbAbilityInfo.sdkVersion_ = sdkVersion;
|
||||
scbAbilityInfo.codePath_ = bundleInfo.applicationInfo.codePath;
|
||||
GetOrientationFromResourceManager(scbAbilityInfo.abilityInfo_);
|
||||
scbAbilityInfos.push_back(scbAbilityInfo);
|
||||
}
|
||||
@ -7683,9 +7762,10 @@ std::vector<std::pair<uint64_t, WindowVisibilityState>> SceneSessionManager::Get
|
||||
if (lastVisibleData_[i].first < currVisibleData[j].first) {
|
||||
visibilityChangeInfo.emplace_back(lastVisibleData_[i].first, WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
|
||||
i++;
|
||||
} else if (lastVisibleData_[i].first > currVisibleData[j].first &&
|
||||
currVisibleData[j].second != WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION) {
|
||||
visibilityChangeInfo.emplace_back(currVisibleData[j].first, currVisibleData[j].second);
|
||||
} else if (lastVisibleData_[i].first > currVisibleData[j].first) {
|
||||
if (currVisibleData[j].second != WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION) {
|
||||
visibilityChangeInfo.emplace_back(currVisibleData[j].first, currVisibleData[j].second);
|
||||
}
|
||||
j++;
|
||||
} else {
|
||||
if (lastVisibleData_[i].second != currVisibleData[j].second) {
|
||||
@ -8060,7 +8140,7 @@ WSError SceneSessionManager::GetFocusSessionElement(AppExecFwk::ElementName& ele
|
||||
return taskScheduler_->PostSyncTask(task, "GetFocusSessionElement");
|
||||
}
|
||||
|
||||
WSError SceneSessionManager::UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener)
|
||||
WSError SceneSessionManager::UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener)
|
||||
{
|
||||
const auto callingPid = IPCSkeleton::GetCallingRealPid();
|
||||
auto task = [this, persistentId, haveListener, callingPid]() {
|
||||
@ -8088,7 +8168,7 @@ WSError SceneSessionManager::UpdateSessionAvoidAreaListener(int32_t& persistentI
|
||||
return taskScheduler_->PostSyncTask(task, "UpdateSessionAvoidAreaListener:PID:" + std::to_string(persistentId));
|
||||
}
|
||||
|
||||
bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const int32_t& persistentId,
|
||||
bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const int32_t persistentId,
|
||||
const sptr<SceneSession>& sceneSession, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType)
|
||||
{
|
||||
if (sceneSession == nullptr) {
|
||||
@ -8153,7 +8233,7 @@ static bool CheckAvoidAreaForAINavigationBar(bool isVisible, const AvoidArea& av
|
||||
}
|
||||
|
||||
void SceneSessionManager::UpdateNormalSessionAvoidArea(
|
||||
const int32_t& persistentId, sptr<SceneSession>& sceneSession, bool& needUpdate)
|
||||
const int32_t persistentId, const sptr<SceneSession>& sceneSession, bool& needUpdate)
|
||||
{
|
||||
bool ret = true;
|
||||
if (sceneSession == nullptr || !IsSessionVisibleForeground(sceneSession)) {
|
||||
@ -8168,11 +8248,11 @@ void SceneSessionManager::UpdateNormalSessionAvoidArea(
|
||||
needUpdate = false;
|
||||
return;
|
||||
}
|
||||
uint32_t start = static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM);
|
||||
uint32_t end = static_cast<uint32_t>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR);
|
||||
for (uint32_t avoidType = start; avoidType <= end; avoidType++) {
|
||||
using T = std::underlying_type_t<AvoidAreaType>;
|
||||
for (T avoidType = static_cast<T>(AvoidAreaType::TYPE_START);
|
||||
avoidType < static_cast<T>(AvoidAreaType::TYPE_END); avoidType++) {
|
||||
AvoidArea avoidArea = sceneSession->GetAvoidAreaByType(static_cast<AvoidAreaType>(avoidType));
|
||||
if (avoidType == static_cast<uint32_t>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR) &&
|
||||
if (avoidType == static_cast<T>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR) &&
|
||||
!CheckAvoidAreaForAINavigationBar(isAINavigationBarVisible_, avoidArea,
|
||||
sceneSession->GetSessionRect().height_)) {
|
||||
continue;
|
||||
@ -8226,10 +8306,8 @@ void SceneSessionManager::UpdateAvoidArea(int32_t persistentId)
|
||||
if (needUpdate) {
|
||||
NotifyWindowInfoChange(persistentId, WindowUpdateType::WINDOW_UPDATE_BOUNDS);
|
||||
}
|
||||
return;
|
||||
};
|
||||
taskScheduler_->PostAsyncTask(task, "UpdateAvoidArea:PID:" + std::to_string(persistentId));
|
||||
return;
|
||||
}
|
||||
|
||||
void SceneSessionManager::UpdateAvoidAreaByType(int32_t persistentId, AvoidAreaType type)
|
||||
@ -8289,7 +8367,7 @@ void SceneSessionManager::UpdateGestureBackEnabled(int32_t persistentId)
|
||||
taskScheduler_->PostAsyncTask(task, "UpdateGestureBackEnabled: PID: " + std::to_string(persistentId));
|
||||
}
|
||||
|
||||
void SceneSessionManager::UpdateOccupiedAreaIfNeed(const int32_t& persistentId)
|
||||
void SceneSessionManager::UpdateOccupiedAreaIfNeed(int32_t persistentId)
|
||||
{
|
||||
auto task = [this, persistentId]() {
|
||||
sptr<SceneSession> keyboardSession = nullptr;
|
||||
@ -8303,7 +8381,7 @@ void SceneSessionManager::UpdateOccupiedAreaIfNeed(const int32_t& persistentId)
|
||||
}
|
||||
}
|
||||
if (keyboardSession == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "keyboardSession is nullptr.");
|
||||
TLOGNE(WmsLogTag::WMS_KEYBOARD, "keyboardSession is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (keyboardSession->GetCallingSessionId() != static_cast<uint32_t>(persistentId)) {
|
||||
@ -9552,7 +9630,7 @@ WSError SceneSessionManager::RaiseWindowToTop(int32_t persistentId)
|
||||
return WSError::WS_ERROR_INVALID_SESSION;
|
||||
}
|
||||
if (sceneSession->GetWindowType() == WindowType::WINDOW_TYPE_APP_MAIN_WINDOW) {
|
||||
sceneSession->NotifyClick();
|
||||
sceneSession->NotifyClick(true, false);
|
||||
return WSError::WS_OK;
|
||||
} else {
|
||||
WLOGFE("session is not app main window!");
|
||||
@ -9597,7 +9675,7 @@ WSError SceneSessionManager::ShiftAppWindowFocus(int32_t sourcePersistentId, int
|
||||
TLOGE(WmsLogTag::WMS_FOCUS, "permission denied, not call by the same process");
|
||||
return WSError::WS_ERROR_INVALID_CALLING;
|
||||
}
|
||||
targetSession->NotifyClick();
|
||||
targetSession->NotifyClick(true, false);
|
||||
FocusChangeReason reason = FocusChangeReason::CLIENT_REQUEST;
|
||||
return RequestSessionFocus(targetPersistentId, false, reason);
|
||||
}
|
||||
@ -10761,7 +10839,7 @@ WMError SceneSessionManager::GetAllMainWindowInfos(std::vector<MainWindowInfo>&
|
||||
} else if (abilityInfo != nullptr) {
|
||||
info.bundleType_ = static_cast<int32_t>(abilityInfo->applicationInfo.bundleType);
|
||||
infos.push_back(info);
|
||||
TLOGD(WmsLogTag::WMS_MAIN, "Get mainWindow info: Session id:%{public}d,"
|
||||
TLOGD(WmsLogTag::WMS_MAIN, "Get mainWindow info: Session id:%{public}d, "
|
||||
"bundleName:%{public}s, bundleType:%{public}d", session->GetPersistentId(),
|
||||
info.bundleName_.c_str(), info.bundleType_);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ int SceneSessionManagerLiteStub::HandleGetMainWindowStatesByPid(MessageParcel& d
|
||||
|
||||
int SceneSessionManagerLiteStub::HandleGetSessionInfo(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFD("run HandleGetSessionInfo!");
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
SessionInfoBean info;
|
||||
std::u16string deviceIdU16;
|
||||
if (!data.ReadString16(deviceIdU16)) {
|
||||
@ -299,12 +299,12 @@ int SceneSessionManagerLiteStub::HandleGetSessionInfo(MessageParcel& data, Messa
|
||||
}
|
||||
WSError errCode = GetSessionInfo(deviceId, persistentId, info);
|
||||
if (!reply.WriteParcelable(&info)) {
|
||||
WLOGFE("GetSessionInfo error");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write sessionInfo fail");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (!reply.WriteInt32(static_cast<int32_t>(errCode))) {
|
||||
WLOGFE("GetSessionInfo result error");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write sessionInfo result fail");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
return ERR_NONE;
|
||||
@ -312,9 +312,14 @@ int SceneSessionManagerLiteStub::HandleGetSessionInfo(MessageParcel& data, Messa
|
||||
|
||||
int SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
SessionInfoBean info;
|
||||
std::string continueSessionId = data.ReadString();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
std::string continueSessionId;
|
||||
if (!data.ReadString(continueSessionId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "read continueSessionId fail");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "continueSessionId: %{public}s", continueSessionId.c_str());
|
||||
SessionInfoBean info;
|
||||
WSError errCode = GetSessionInfoByContinueSessionId(continueSessionId, info);
|
||||
if (!reply.WriteParcelable(&info)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Get sessionInfo by continueSessionId error");
|
||||
@ -712,7 +717,12 @@ int SceneSessionManagerLiteStub::HandleGetWindowStyleType(MessageParcel& data, M
|
||||
|
||||
int SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WMError errCode = TerminateSessionByPersistentId(persistentId);
|
||||
if (!reply.WriteInt32(static_cast<int32_t>(errCode))) {
|
||||
return ERR_INVALID_DATA;
|
||||
|
@ -417,7 +417,7 @@ WSError SceneSessionManagerProxy::BindDialogSessionTarget(uint64_t persistentId,
|
||||
return static_cast<WSError>(ret);
|
||||
}
|
||||
|
||||
WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener)
|
||||
WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -408,9 +408,13 @@ int SceneSessionManagerStub::HandleGetFocusSessionInfo(MessageParcel& data, Mess
|
||||
|
||||
int SceneSessionManagerStub::HandleSetSessionLabel(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleSetSessionLabel!");
|
||||
TLOGD(WmsLogTag::DEFAULT, "In");
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
std::string label = data.ReadString();
|
||||
std::string label;
|
||||
if (!data.ReadString(label)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "read label failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError errCode = SetSessionLabel(token, label);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
@ -418,11 +422,11 @@ int SceneSessionManagerStub::HandleSetSessionLabel(MessageParcel& data, MessageP
|
||||
|
||||
int SceneSessionManagerStub::HandleSetSessionIcon(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleSetSessionIcon!");
|
||||
TLOGD(WmsLogTag::DEFAULT, "In");
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
std::shared_ptr<Media::PixelMap> icon(data.ReadParcelable<Media::PixelMap>());
|
||||
if (icon == nullptr) {
|
||||
WLOGFE("icon is null");
|
||||
TLOGE(WmsLogTag::DEFAULT, "icon is null");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError errCode = SetSessionIcon(token, icon);
|
||||
@ -501,19 +505,24 @@ int SceneSessionManagerStub::HandleUnRegisterSessionListener(MessageParcel& data
|
||||
|
||||
int SceneSessionManagerStub::HandleGetSessionInfos(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleGetSessionInfos!");
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
std::string deviceId = Str16ToStr8(data.ReadString16());
|
||||
int numMax = data.ReadInt32();
|
||||
int32_t numMax = 0;
|
||||
if (!data.ReadInt32(numMax)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Read numMax failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::vector<SessionInfoBean> missionInfos;
|
||||
WSError errCode = GetSessionInfos(deviceId, numMax, missionInfos);
|
||||
reply.WriteInt32(missionInfos.size());
|
||||
for (auto& it : missionInfos) {
|
||||
if (!reply.WriteParcelable(&it)) {
|
||||
WLOGFE("GetSessionInfos error");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write missionInfos error");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
if (!reply.WriteInt32(static_cast<int32_t>(errCode))) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write result error");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
return ERR_NONE;
|
||||
@ -521,18 +530,22 @@ int SceneSessionManagerStub::HandleGetSessionInfos(MessageParcel& data, MessageP
|
||||
|
||||
int SceneSessionManagerStub::HandleGetSessionInfo(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleGetSessionInfo!");
|
||||
SessionInfoBean info;
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
std::string deviceId = Str16ToStr8(data.ReadString16());
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
SessionInfoBean info;
|
||||
WSError errCode = GetSessionInfo(deviceId, persistentId, info);
|
||||
if (!reply.WriteParcelable(&info)) {
|
||||
WLOGFE("GetSessionInfo error");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write sessionInfo error");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (!reply.WriteInt32(static_cast<int32_t>(errCode))) {
|
||||
WLOGFE("GetSessionInfo result error");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Write result error");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
return ERR_NONE;
|
||||
@ -541,8 +554,13 @@ int SceneSessionManagerStub::HandleGetSessionInfo(MessageParcel& data, MessagePa
|
||||
|
||||
int SceneSessionManagerStub::HandleGetSessionInfoByContinueSessionId(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
SessionInfoBean info;
|
||||
std::string continueSessionId = data.ReadString();
|
||||
std::string continueSessionId;
|
||||
if (!data.ReadString(continueSessionId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Read continueSessionId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "continueSessionId: %{public}s", continueSessionId.c_str());
|
||||
WSError errCode = GetSessionInfoByContinueSessionId(continueSessionId, info);
|
||||
if (!reply.WriteParcelable(&info)) {
|
||||
@ -576,17 +594,21 @@ int SceneSessionManagerStub::HandleDumpSessionAll(MessageParcel& data, MessagePa
|
||||
|
||||
int SceneSessionManagerStub::HandleDumpSessionWithId(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleDumpSessionWithId!");
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::DEFAULT, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "read persistentId failed.");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::vector<std::string> infos;
|
||||
WSError errCode = DumpSessionWithId(persistentId, infos);
|
||||
if (!reply.WriteStringVector(infos)) {
|
||||
WLOGFE("HandleDumpSessionWithId write info failed.");
|
||||
TLOGE(WmsLogTag::DEFAULT, "write info failed.");
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
|
||||
if (!reply.WriteInt32(static_cast<int32_t>(errCode))) {
|
||||
WLOGFE("HandleDumpSessionWithId write errcode failed.");
|
||||
TLOGE(WmsLogTag::DEFAULT, "write errcode failed.");
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
return ERR_NONE;
|
||||
@ -789,8 +811,12 @@ int SceneSessionManagerStub::HandleGetSessionSnapshotById(MessageParcel& data, M
|
||||
|
||||
int SceneSessionManagerStub::HandleGetUIContentRemoteObj(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::DEFAULT, "Called");
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::DEFAULT, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "Failed to read persistentId");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
sptr<IRemoteObject> uiContentRemoteObj;
|
||||
WSError ret = GetUIContentRemoteObj(persistentId, uiContentRemoteObj);
|
||||
reply.WriteRemoteObject(uiContentRemoteObj);
|
||||
@ -814,13 +840,17 @@ int SceneSessionManagerStub::HandleBindDialogTarget(MessageParcel& data, Message
|
||||
|
||||
int SceneSessionManagerStub::HandleNotifyDumpInfoResult(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("HandleNotifyDumpInfoResult");
|
||||
std::vector<std::string> info;
|
||||
uint32_t vectorSize = data.ReadUint32();
|
||||
if (vectorSize > MAX_VECTOR_SIZE) {
|
||||
WLOGFI("Vector is too big!");
|
||||
TLOGD(WmsLogTag::DEFAULT, "In!");
|
||||
uint32_t vectorSize;
|
||||
if (!data.ReadUint32(vectorSize)) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "Failed to read vectorSize");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (vectorSize > MAX_VECTOR_SIZE) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "Vector is too big!");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::vector<std::string> info;
|
||||
for (uint32_t i = 0; i < vectorSize; i++) {
|
||||
uint32_t curSize = data.ReadUint32();
|
||||
std::string curInfo = "";
|
||||
@ -830,7 +860,7 @@ int SceneSessionManagerStub::HandleNotifyDumpInfoResult(MessageParcel& data, Mes
|
||||
curInfo = (infoPtr) ? std::string(infoPtr, curSize) : "";
|
||||
}
|
||||
info.emplace_back(curInfo);
|
||||
WLOGFD("HandleNotifyDumpInfoResult count: %{public}u, infoSize: %{public}u", i, curSize);
|
||||
TLOGD(WmsLogTag::DEFAULT, "InfoResult count: %{public}u, infoSize: %{public}u", i, curSize);
|
||||
}
|
||||
NotifyDumpInfoResult(info);
|
||||
return ERR_NONE;
|
||||
@ -838,8 +868,12 @@ int SceneSessionManagerStub::HandleNotifyDumpInfoResult(MessageParcel& data, Mes
|
||||
|
||||
int SceneSessionManagerStub::HandleClearSession(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleClearSession!");
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read persistentId");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = ClearSession(persistentId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -855,26 +889,38 @@ int SceneSessionManagerStub::HandleClearAllSessions(MessageParcel& data, Message
|
||||
|
||||
int SceneSessionManagerStub::HandleLockSession(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleLockSession!");
|
||||
int32_t sessionId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t sessionId;
|
||||
if (!data.ReadInt32(sessionId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read sessionId");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = LockSession(sessionId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
}
|
||||
int SceneSessionManagerStub::HandleUnlockSession(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleUnlockSession!");
|
||||
int32_t sessionId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t sessionId;
|
||||
if (!data.ReadInt32(sessionId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read sessionId");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = UnlockSession(sessionId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
}
|
||||
int SceneSessionManagerStub::HandleMoveSessionsToForeground(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleMoveSessionsToForeground!");
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
std::vector<int32_t> sessionIds;
|
||||
data.ReadInt32Vector(&sessionIds);
|
||||
int32_t topSessionId = data.ReadInt32();
|
||||
int32_t topSessionId;
|
||||
if (!data.ReadInt32(topSessionId)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read topSessionId");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
const WSError &ret = MoveSessionsToForeground(sessionIds, topSessionId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -894,12 +940,16 @@ int SceneSessionManagerStub::HandleMoveSessionsToBackground(MessageParcel& data,
|
||||
|
||||
int SceneSessionManagerStub::HandleRegisterCollaborator(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleRegisterCollaborator!");
|
||||
int32_t type = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t type;
|
||||
if (!data.ReadInt32(type)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read type");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
sptr<AAFwk::IAbilityManagerCollaborator> collaborator =
|
||||
iface_cast<AAFwk::IAbilityManagerCollaborator>(data.ReadRemoteObject());
|
||||
if (collaborator == nullptr) {
|
||||
WLOGFE("collaborator is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "collaborator is nullptr");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = RegisterIAbilityManagerCollaborator(type, collaborator);
|
||||
@ -909,8 +959,12 @@ int SceneSessionManagerStub::HandleRegisterCollaborator(MessageParcel& data, Mes
|
||||
|
||||
int SceneSessionManagerStub::HandleUnregisterCollaborator(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFI("run HandleUnregisterCollaborator!");
|
||||
int32_t type = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "In!");
|
||||
int32_t type;
|
||||
if (!data.ReadInt32(type)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to read type");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = UnregisterIAbilityManagerCollaborator(type);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -918,8 +972,16 @@ int SceneSessionManagerStub::HandleUnregisterCollaborator(MessageParcel& data, M
|
||||
|
||||
int SceneSessionManagerStub::HandleUpdateSessionTouchOutsideListener(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
auto persistentId = data.ReadInt32();
|
||||
bool haveAvoidAreaListener = data.ReadBool();
|
||||
int32_t persistentId = 0;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_INPUT_KEY_FLOW, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
bool haveAvoidAreaListener = false;
|
||||
if (!data.ReadBool(haveAvoidAreaListener)) {
|
||||
TLOGE(WmsLogTag::WMS_INPUT_KEY_FLOW, "read haveAvoidAreaListener fail");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError errCode = UpdateSessionTouchOutsideListener(persistentId, haveAvoidAreaListener);
|
||||
reply.WriteUint32(static_cast<uint32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
@ -939,9 +1001,23 @@ int SceneSessionManagerStub::HandleRaiseWindowToTop(MessageParcel& data, Message
|
||||
|
||||
int SceneSessionManagerStub::HandleNotifyWindowExtensionVisibilityChange(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
auto pid = data.ReadInt32();
|
||||
auto uid = data.ReadInt32();
|
||||
bool visible = data.ReadBool();
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
int32_t pid;
|
||||
if (!data.ReadInt32(pid)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read pid failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t uid;
|
||||
if (!data.ReadInt32(uid)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read uid failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
bool visible;
|
||||
if (!data.ReadBool(visible)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read visible failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "pid:%{public}d, uid:%{public}d, visible:%{public}d", pid, uid, visible);
|
||||
WSError ret = NotifyWindowExtensionVisibilityChange(pid, uid, visible);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -1024,14 +1100,19 @@ int SceneSessionManagerStub::HandleGetVisibilityWindowInfo(MessageParcel& data,
|
||||
|
||||
int SceneSessionManagerStub::HandleAddExtensionWindowStageToSCB(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
sptr<IRemoteObject> sessionStageObject = data.ReadRemoteObject();
|
||||
sptr<ISessionStage> sessionStage = iface_cast<ISessionStage>(sessionStageObject);
|
||||
if (sessionStage == nullptr) {
|
||||
WLOGFE("sessionStage is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "sessionStage is nullptr");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
uint64_t surfaceNodeId = data.ReadUint64();
|
||||
uint64_t surfaceNodeId;
|
||||
if (!data.ReadUint64(surfaceNodeId)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read surfaceNodeId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
AddExtensionWindowStageToSCB(sessionStage, token, surfaceNodeId);
|
||||
return ERR_NONE;
|
||||
}
|
||||
@ -1051,15 +1132,32 @@ int SceneSessionManagerStub::HandleRemoveExtensionWindowStageFromSCB(MessageParc
|
||||
|
||||
int SceneSessionManagerStub::HandleUpdateModalExtensionRect(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
if (token == nullptr) {
|
||||
WLOGFE("token is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "token is nullptr");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t rectX;
|
||||
if (!data.ReadInt32(rectX)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read rectX failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t rectY;
|
||||
if (!data.ReadInt32(rectY)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read rectY failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t rectWidth;
|
||||
if (!data.ReadInt32(rectWidth)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read rectWidth failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t rectHeight;
|
||||
if (!data.ReadInt32(rectHeight)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read rectHeight failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t rectX = data.ReadInt32();
|
||||
int32_t rectY = data.ReadInt32();
|
||||
int32_t rectWidth = data.ReadInt32();
|
||||
int32_t rectHeight = data.ReadInt32();
|
||||
Rect windowRect{rectX, rectY, rectWidth, rectHeight};
|
||||
UpdateModalExtensionRect(token, windowRect);
|
||||
return ERR_NONE;
|
||||
@ -1067,21 +1165,39 @@ int SceneSessionManagerStub::HandleUpdateModalExtensionRect(MessageParcel& data,
|
||||
|
||||
int SceneSessionManagerStub::HandleProcessModalExtensionPointDown(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
if (token == nullptr) {
|
||||
WLOGFE("token is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "token is nullptr");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t posX;
|
||||
if (!data.ReadInt32(posX)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read posX failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t posY;
|
||||
if (!data.ReadInt32(posY)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read posY failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t posX = data.ReadInt32();
|
||||
int32_t posY = data.ReadInt32();
|
||||
ProcessModalExtensionPointDown(token, posX, posY);
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int SceneSessionManagerStub::HandleAddOrRemoveSecureSession(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
bool shouldHide = data.ReadBool();
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
bool shouldHide;
|
||||
if (!data.ReadBool(shouldHide)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read shouldHide failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WSError ret = AddOrRemoveSecureSession(persistentId, shouldHide);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -1089,13 +1205,22 @@ int SceneSessionManagerStub::HandleAddOrRemoveSecureSession(MessageParcel& data,
|
||||
|
||||
int SceneSessionManagerStub::HandleUpdateExtWindowFlags(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_UIEXT, "In!");
|
||||
sptr<IRemoteObject> token = data.ReadRemoteObject();
|
||||
if (token == nullptr) {
|
||||
WLOGFE("token is nullptr");
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "token is nullptr");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
uint32_t extWindowFlags;
|
||||
if (!data.ReadUint32(extWindowFlags)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read extWindowFlags failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
uint32_t extWindowActions;
|
||||
if (!data.ReadUint32(extWindowActions)) {
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "read extWindowActions failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
uint32_t extWindowFlags = data.ReadUint32();
|
||||
uint32_t extWindowActions = data.ReadUint32();
|
||||
WSError ret = UpdateExtWindowFlags(token, extWindowFlags, extWindowActions);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
return ERR_NONE;
|
||||
@ -1131,7 +1256,12 @@ int SceneSessionManagerStub::HandleGetFreeMultiWindowEnableState(MessageParcel&
|
||||
|
||||
int SceneSessionManagerStub::HandleGetCallingWindowWindowStatus(MessageParcel&data, MessageParcel&reply)
|
||||
{
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_KEYBOARD, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WindowStatus windowStatus = WindowStatus::WINDOW_STATUS_UNDEFINED;
|
||||
WMError ret = GetCallingWindowWindowStatus(persistentId, windowStatus);
|
||||
reply.WriteUint32(static_cast<int32_t>(ret));
|
||||
@ -1145,7 +1275,12 @@ int SceneSessionManagerStub::HandleGetCallingWindowWindowStatus(MessageParcel&da
|
||||
|
||||
int SceneSessionManagerStub::HandleGetCallingWindowRect(MessageParcel&data, MessageParcel& reply)
|
||||
{
|
||||
int32_t persistentId = data.ReadInt32();
|
||||
TLOGD(WmsLogTag::WMS_KEYBOARD, "In!");
|
||||
int32_t persistentId;
|
||||
if (!data.ReadInt32(persistentId)) {
|
||||
TLOGE(WmsLogTag::WMS_KEYBOARD, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
Rect rect = {0, 0, 0, 0};
|
||||
WMError ret = GetCallingWindowRect(persistentId, rect);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
|
@ -32,6 +32,7 @@ namespace Rosen {
|
||||
constexpr int32_t DEFAULT_VALUE = -1;
|
||||
constexpr uint32_t EXTENSION_CONNECT_OUT_TIME = 300; // ms
|
||||
constexpr uint32_t TRANS_CMD_SEND_SNAPSHOT_RECT = 2;
|
||||
constexpr int32_t RES_FAILURE = -1;
|
||||
namespace {
|
||||
constexpr uint32_t SLEEP_TIME_US = 100000;
|
||||
}
|
||||
@ -128,6 +129,48 @@ HWTEST_F(ScreenSessionAbilityConnectionTest, OnAbilityDisconnectDone, Function |
|
||||
abilityConnectionStub = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AddObjectDeathRecipient
|
||||
* @tc.desc: AddObjectDeathRecipient func
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionAbilityConnectionTest, AddObjectDeathRecipient, Function | SmallTest | Level1)
|
||||
{
|
||||
sptr<ScreenSessionAbilityConnectionStub> abilityConnectionStub(
|
||||
new (std::nothrow) ScreenSessionAbilityConnectionStub());
|
||||
ASSERT_NE(abilityConnectionStub, nullptr);
|
||||
EXPECT_EQ(abilityConnectionStub->AddObjectDeathRecipient(), false);
|
||||
abilityConnectionStub.clear();
|
||||
abilityConnectionStub = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SendMessage
|
||||
* @tc.desc: SendMessage func test02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionAbilityConnectionTest, SendMessage02, Function | SmallTest | Level1)
|
||||
{
|
||||
ScreenSessionAbilityConnection screenSessionAbilityConnection;
|
||||
int32_t transCode = 0;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
auto ret = screenSessionAbilityConnection.SendMessage(transCode, data, reply);
|
||||
EXPECT_EQ(ret, RES_FAILURE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsConnected
|
||||
* @tc.desc: IsConnected func
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionAbilityConnectionTest, IsConnected, Function | SmallTest | Level1)
|
||||
{
|
||||
ScreenSessionAbilityConnection screenSessionAbilityConnection;
|
||||
auto ret = screenSessionAbilityConnection.IsConnected();
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsAbilityConnected
|
||||
* @tc.desc: IsAbilityConnected func
|
||||
|
@ -349,6 +349,104 @@ namespace {
|
||||
bool ret = screenSettingHelper.GetSettingValue(value, key);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RemoveInvalidChar01
|
||||
* @tc.desc: RemoveInvalidChar Test01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, RemoveInvalidChar01, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::string test_str = "test";
|
||||
auto ret = screenSettingHelper.RemoveInvalidChar(test_str);
|
||||
ASSERT_EQ(ret, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RemoveInvalidChar02
|
||||
* @tc.desc: RemoveInvalidChar Test02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, RemoveInvalidChar02, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::string test_str = "test 2.0 ,";
|
||||
auto ret = screenSettingHelper.RemoveInvalidChar(test_str);
|
||||
ASSERT_EQ(ret, " 2.0 ,");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SplitString
|
||||
* @tc.desc: SplitString Test01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, SplitString01, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::vector<std::string> splitValues = {"split", "test"};
|
||||
std::string input = "";
|
||||
char delimiter = ',';
|
||||
auto ret = screenSettingHelper.SplitString(splitValues, input, delimiter);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SplitString
|
||||
* @tc.desc: SplitString Test02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, SplitString02, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::vector<std::string> splitValues = {};
|
||||
std::string input = "test, str";
|
||||
char delimiter = ',';
|
||||
auto ret = screenSettingHelper.SplitString(splitValues, input, delimiter);
|
||||
ASSERT_TRUE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSettingRecoveryResolutionString
|
||||
* @tc.desc: GetSettingRecoveryResolutionString Test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, GetSettingRecoveryResolutionString, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::vector<std::string> resolutionString = {};
|
||||
std::string key = "test, str";
|
||||
auto ret = screenSettingHelper.GetSettingRecoveryResolutionString(resolutionString, key);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSettingScreenModeString
|
||||
* @tc.desc: GetSettingScreenModeString Test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, GetSettingScreenModeString, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::vector<std::string> screenModeStrings = {};
|
||||
std::string key = "test, str";
|
||||
auto ret = screenSettingHelper.GetSettingScreenModeString(screenModeStrings, key);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSettingRelativePositionString
|
||||
* @tc.desc: GetSettingRelativePositionString Test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSettingHelperTest, GetSettingRelativePositionString, Function | SmallTest | Level3)
|
||||
{
|
||||
ScreenSettingHelper screenSettingHelper = ScreenSettingHelper();
|
||||
std::vector<std::string> relativePositionStrings = {};
|
||||
std::string key = "test";
|
||||
auto ret = screenSettingHelper.GetSettingRelativePositionString(relativePositionStrings, key);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -38,14 +38,14 @@ public:
|
||||
sptr<SceneSession> callingSession_;
|
||||
};
|
||||
|
||||
using UpdateSessionRectCallBack = std::function<void(const WSRect& rect, const SizeChangeReason reason)>;
|
||||
using UpdateSessionRectCallBack = std::function<void(const WSRect& rect, SizeChangeReason reason)>;
|
||||
class KSSceneSessionMocker : public SceneSession {
|
||||
public:
|
||||
KSSceneSessionMocker(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback)
|
||||
: SceneSession(info, specificCallback) {}
|
||||
~KSSceneSessionMocker() {}
|
||||
|
||||
WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason, bool isGlobal = false,
|
||||
WSError UpdateSessionRect(const WSRect& rect, SizeChangeReason reason, bool isGlobal = false,
|
||||
bool isFromMoveToGlobal = false) override
|
||||
{
|
||||
updateRectCallback_(rect, reason);
|
||||
@ -58,7 +58,7 @@ public:
|
||||
return statusBarHeight;
|
||||
}
|
||||
|
||||
UpdateSessionRectCallBack updateRectCallback_ = [](const WSRect& rect, const SizeChangeReason reason) {};
|
||||
UpdateSessionRectCallBack updateRectCallback_ = [](const WSRect& rect, SizeChangeReason reason) {};
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
MOCK_METHOD2(Background, WSError(bool isFromClient, const std::string& identityToken));
|
||||
MOCK_METHOD2(Disconnect, WSError(bool isFromClient, const std::string& identityToken));
|
||||
|
||||
MOCK_METHOD4(UpdateSessionRect, WSError(const WSRect& rect, const SizeChangeReason reason,
|
||||
MOCK_METHOD4(UpdateSessionRect, WSError(const WSRect& rect, SizeChangeReason reason,
|
||||
bool isGlobal, bool isFromMoveToGlobal));
|
||||
MOCK_METHOD1(UpdateClientRect, WSError(const WSRect& rect));
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ HWTEST_F(KeyboardSessionTest, RaiseCallingSession01, Function | SmallTest | Leve
|
||||
sptr<KSSceneSessionMocker> callingSession = GetSceneSessionMocker("callingSession", "callingSession");
|
||||
ASSERT_NE(callingSession, nullptr);
|
||||
|
||||
callingSession->updateRectCallback_ = [&resultRect](const WSRect& rect, const SizeChangeReason reason) {
|
||||
callingSession->updateRectCallback_ = [&resultRect](const WSRect& rect, SizeChangeReason reason) {
|
||||
resultRect.posX_ = rect.posX_;
|
||||
resultRect.posY_ = rect.posY_;
|
||||
resultRect.width_ = rect.width_;
|
||||
@ -1161,7 +1161,7 @@ HWTEST_F(KeyboardSessionTest, RaiseCallingSession03, Function | SmallTest | Leve
|
||||
ASSERT_NE(callingSession, nullptr);
|
||||
callingSession->winRect_ = { 1, 1, 1, 1 };
|
||||
callingSession->oriPosYBeforeRaisedByKeyboard_ = 0;
|
||||
callingSession->updateRectCallback_ = [](const WSRect& rect, const SizeChangeReason reason) {};
|
||||
callingSession->updateRectCallback_ = [](const WSRect& rect, SizeChangeReason reason) {};
|
||||
keyboardSession->keyboardCallback_->onGetSceneSession_ = [callingSession](int32_t persistentId) {
|
||||
return callingSession;
|
||||
};
|
||||
@ -1203,7 +1203,7 @@ HWTEST_F(KeyboardSessionTest, IsCallingSessionSplitMode01, Function | SmallTest
|
||||
ASSERT_NE(callingSession, nullptr);
|
||||
callingSession->oriPosYBeforeRaisedByKeyboard_ = 0;
|
||||
callingSession->winRect_ = { 0, 0, 0, 0 };
|
||||
callingSession->updateRectCallback_ = [](const WSRect& rect, const SizeChangeReason reason) {};
|
||||
callingSession->updateRectCallback_ = [](const WSRect& rect, SizeChangeReason reason) {};
|
||||
keyboardSession->keyboardCallback_->onGetSceneSession_ = [callingSession](int32_t persistentId) {
|
||||
return callingSession;
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ void MoveDragControllerTest::SetUp()
|
||||
info.moduleName_ = "testSession2";
|
||||
info.bundleName_ = "testSession3";
|
||||
session_ = new (std::nothrow) Session(info);
|
||||
moveDragController = new MoveDragController(session_->GetPersistentId());
|
||||
moveDragController = new MoveDragController(session_->GetPersistentId(), session_->GetWindowType());
|
||||
}
|
||||
|
||||
void MoveDragControllerTest::TearDown()
|
||||
@ -176,7 +176,7 @@ HWTEST_F(MoveDragControllerTest, GetTargetRect, Function | SmallTest | Level1)
|
||||
ASSERT_EQ(pos, res.posX_);
|
||||
ASSERT_EQ(pos, res.posY_);
|
||||
|
||||
res = moveDragController->GetTargetRect();
|
||||
res = moveDragController->GetTargetRect(MoveDragController::TargetRectCoordinate::RELATED_TO_START_DISPLAY);
|
||||
ASSERT_EQ(tmp, res.height_);
|
||||
ASSERT_EQ(tmp, res.width_);
|
||||
ASSERT_EQ(pos, res.posX_);
|
||||
@ -646,7 +646,7 @@ HWTEST_F(MoveDragControllerTest, ProcessWindowDragHotAreaFunc, Function | SmallT
|
||||
SizeChangeReason reason = SizeChangeReason::UNDEFINED;
|
||||
moveDragController->ProcessWindowDragHotAreaFunc(isSendHotAreaMessage, reason);
|
||||
ASSERT_EQ(true, isSendHotAreaMessage);
|
||||
auto dragHotAreaFunc = [](DisplayId displayId, int32_t type, const SizeChangeReason reason) {
|
||||
auto dragHotAreaFunc = [](DisplayId displayId, int32_t type, SizeChangeReason reason) {
|
||||
type = 0;
|
||||
};
|
||||
auto preFunc = moveDragController->windowDragHotAreaFunc_;
|
||||
@ -850,7 +850,8 @@ HWTEST_F(MoveDragControllerTest, CalcFirstMoveTargetRect001, Function | SmallTes
|
||||
moveDragController->InitMoveDragProperty();
|
||||
moveDragController->SetStartMoveFlag(true);
|
||||
moveDragController->CalcFirstMoveTargetRect(windowRect, true);
|
||||
WSRect targetRect = moveDragController->GetTargetRect();
|
||||
WSRect targetRect = moveDragController->GetTargetRect(
|
||||
MoveDragController::TargetRectCoordinate::RELATED_TO_START_DISPLAY);
|
||||
ASSERT_EQ(targetRect.posX_, 0);
|
||||
}
|
||||
|
||||
@ -1055,7 +1056,7 @@ HWTEST_F(MoveDragControllerTest, ProcessSessionRectChange, Function | SmallTest
|
||||
int32_t res = 0;
|
||||
auto preCallback = moveDragController->moveDragCallback_;
|
||||
SizeChangeReason reason = SizeChangeReason::UNDEFINED;
|
||||
MoveDragCallback callBack = [](const SizeChangeReason reason) {
|
||||
MoveDragCallback callBack = [](SizeChangeReason reason) {
|
||||
return;
|
||||
};
|
||||
moveDragController->moveDragCallback_ = callBack;
|
||||
@ -1122,28 +1123,13 @@ HWTEST_F(MoveDragControllerTest, CalcUnifiedTranslate, Function | SmallTest | Le
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetSysWindowFlag
|
||||
* @tc.desc: test function : GetSysWindowFlag
|
||||
* @tc.name: MoveDragInterrupted
|
||||
* @tc.desc: test function : MoveDragInterrupted
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(MoveDragControllerTest, GetSysWindowFlag, Function | SmallTest | Level1)
|
||||
HWTEST_F(MoveDragControllerTest, MoveDragInterrupted, Function | SmallTest | Level1)
|
||||
{
|
||||
bool preSystemWindowFlag = moveDragController->IsSystemWindow();
|
||||
moveDragController->SetAsSystemWindow(true);
|
||||
ASSERT_EQ(true, moveDragController->IsSystemWindow());
|
||||
moveDragController->SetAsSystemWindow(false);
|
||||
ASSERT_EQ(false, moveDragController->IsSystemWindow());
|
||||
moveDragController->SetAsSystemWindow(preSystemWindowFlag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MoveDragInterrupt
|
||||
* @tc.desc: test function : MoveDragInterrupt
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(MoveDragControllerTest, MoveDragInterrupt, Function | SmallTest | Level1)
|
||||
{
|
||||
moveDragController->MoveDragInterrupt();
|
||||
moveDragController->MoveDragInterrupted();
|
||||
ASSERT_EQ(false, moveDragController->GetStartDragFlag());
|
||||
ASSERT_EQ(false, moveDragController->GetStartMoveFlag());
|
||||
ASSERT_EQ(false, moveDragController->hasPointDown_);
|
||||
@ -1157,7 +1143,6 @@ HWTEST_F(MoveDragControllerTest, MoveDragInterrupt, Function | SmallTest | Level
|
||||
HWTEST_F(MoveDragControllerTest, ResetCrossMoveDragProperty, Function | SmallTest | Level1)
|
||||
{
|
||||
moveDragController->ResetCrossMoveDragProperty();
|
||||
ASSERT_EQ(false, moveDragController->IsSystemWindow());
|
||||
ASSERT_EQ(false, moveDragController->hasPointDown_);
|
||||
}
|
||||
}
|
||||
|
@ -379,8 +379,22 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfo, Function | Small
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
std::u16string deviceIdU16 = u"testDeviceId";
|
||||
data.WriteString16(deviceIdU16);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t persistentId = 0;
|
||||
data.WriteString16(deviceIdU16);
|
||||
data.WriteInt32(persistentId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -393,8 +407,15 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleGetSessionInfoByContinueSessionI
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
std::string continueSessionId = "testSessionId";
|
||||
data.WriteString(continueSessionId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleGetSessionInfoByContinueSessionId(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -449,11 +470,64 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState, Functio
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
sptr <IRemoteObject> token = nullptr;
|
||||
data.WriteRemoteObject(token);
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t continueStateValue = -3;
|
||||
data.WriteRemoteObject(token);
|
||||
data.WriteInt32(continueStateValue);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
continueStateValue = 1;
|
||||
data.WriteRemoteObject(token);
|
||||
data.WriteInt32(continueStateValue);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleSetSessionContinueState1
|
||||
* @tc.desc: test function : HandleSetSessionContinueState
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState1, Function | SmallTest | Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
data.WriteRemoteObject(nullptr);
|
||||
data.WriteInt32(-2);
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleSetSessionContinueState2
|
||||
* @tc.desc: test function : HandleSetSessionContinueState
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerLiteStubTest, HandleSetSessionContinueState2, Function | SmallTest | Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
sptr<IRemoteObject> token = nullptr;
|
||||
data.WriteRemoteObject(token);
|
||||
data.WriteInt32(static_cast<int32_t>(ContinueState::CONTINUESTATE_MAX));
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleSetSessionContinueState(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
uint32_t writtenError;
|
||||
EXPECT_TRUE(reply.ReadUint32(writtenError));
|
||||
EXPECT_EQ(writtenError, static_cast<uint32_t>(ERR_NONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleGetSessionSnapshot
|
||||
* @tc.desc: test function : HandleGetSessionSnapshot
|
||||
@ -483,8 +557,15 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleClearSession, Function | SmallTe
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleClearSession(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t persistentId = 0;
|
||||
data.WriteInt32(persistentId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleClearSession(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -511,8 +592,15 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleLockSession, Function | SmallTes
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleLockSession(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t persistentId = 0;
|
||||
data.WriteInt32(persistentId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleLockSession(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -525,8 +613,15 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnlockSession, Function | SmallT
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t sessionId = 0;
|
||||
data.WriteInt32(sessionId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleUnlockSession(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -539,8 +634,23 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleMoveSessionsToForeground, Functi
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
std::vector<int32_t> sessionIds;
|
||||
sessionIds.push_back(0);
|
||||
data.WriteInt32Vector(sessionIds);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
|
||||
EXPECT_EQ(ERR_TRANSACTION_FAILED, res);
|
||||
|
||||
int32_t topSessionId = 0;
|
||||
data.WriteInt32Vector(sessionIds);
|
||||
data.WriteInt32(topSessionId);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleMoveSessionsToForeground(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -600,6 +710,21 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleRegisterWindowManagerAgent, Func
|
||||
data.WriteUint32(static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS));
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(-100);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(100);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(5);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -614,7 +739,22 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleUnregisterWindowManagerAgent, Fu
|
||||
MessageParcel reply;
|
||||
data.WriteUint32(static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS));
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleUnregisterWindowManagerAgent(data, reply);
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(-100);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(100);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
data.WriteUint32(5);
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
@ -703,9 +843,14 @@ HWTEST_F(SceneSessionManagerLiteStubTest, HandleTerminateSessionByPersistentId,
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, res);
|
||||
|
||||
int32_t persistentId = 1;
|
||||
data.WriteInt32(persistentId);
|
||||
auto res = sceneSessionManagerLiteStub_->
|
||||
res = sceneSessionManagerLiteStub_->
|
||||
SceneSessionManagerLiteStub::HandleTerminateSessionByPersistentId(data, reply);
|
||||
EXPECT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
@ -194,10 +194,13 @@ HWTEST_F(SceneSessionManagerStubLifecycleTest, HandleClearSession, Function | Sm
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = stub_->HandleClearSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t persistentId = 65535;
|
||||
data.WriteInt32(persistentId);
|
||||
|
||||
int res = stub_->HandleClearSession(data, reply);
|
||||
res = stub_->HandleClearSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -233,10 +236,11 @@ HWTEST_F(SceneSessionManagerStubLifecycleTest, HandleLockSession, Function | Sma
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = stub_->HandleLockSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
int32_t sessionId = 65535;
|
||||
data.WriteInt32(sessionId);
|
||||
|
||||
int res = stub_->HandleLockSession(data, reply);
|
||||
res = stub_->HandleLockSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -254,10 +258,11 @@ HWTEST_F(SceneSessionManagerStubLifecycleTest, HandleUnlockSession, Function | S
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = stub_->HandleUnlockSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
int32_t sessionId = 65535;
|
||||
data.WriteInt32(sessionId);
|
||||
|
||||
int res = stub_->HandleUnlockSession(data, reply);
|
||||
res = stub_->HandleUnlockSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -275,12 +280,14 @@ HWTEST_F(SceneSessionManagerStubLifecycleTest, HandleMoveSessionsToForeground, F
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = stub_->HandleMoveSessionsToForeground(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
std::vector<int32_t> sessionIds = {1, 2, 3, 15, 1423};
|
||||
data.WriteInt32Vector(sessionIds);
|
||||
int32_t topSessionId = 1;
|
||||
data.WriteInt32(topSessionId);
|
||||
|
||||
int res = stub_->HandleMoveSessionsToForeground(data, reply);
|
||||
res = stub_->HandleMoveSessionsToForeground(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
|
@ -870,28 +870,14 @@ HWTEST_F(SceneSessionManagerStubTest, TransIdNotifyDumpInfoResult, Function | Sm
|
||||
MessageOption option;
|
||||
|
||||
data.WriteInterfaceToken(SceneSessionManagerStub::GetDescriptor());
|
||||
uint32_t vectorSize = 128;
|
||||
auto res = stub_->HandleNotifyDumpInfoResult(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
data.WriteInterfaceToken(SceneSessionManagerStub::GetDescriptor());
|
||||
uint32_t vectorSize = 90;
|
||||
data.WriteUint32(vectorSize);
|
||||
stub_->HandleNotifyDumpInfoResult(data, reply);
|
||||
|
||||
std::vector<std::string> info = {"-a", "-b123", "-c3456789", ""};
|
||||
vectorSize = static_cast<uint32_t>(info.size());
|
||||
data.WriteUint32(vectorSize);
|
||||
uint32_t curSize;
|
||||
for (const auto &elem : info) {
|
||||
const char *curInfo = elem.c_str();
|
||||
curSize = static_cast<uint32_t>(strlen(curInfo));
|
||||
data.WriteUint32(curSize);
|
||||
if (curSize != 0) {
|
||||
data.WriteRawData(curInfo, curSize);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t code =
|
||||
static_cast<uint32_t>(ISceneSessionManager::SceneSessionManagerMessage::TRANS_ID_NOTIFY_DUMP_INFO_RESULT);
|
||||
|
||||
int res = stub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(res, ERR_TRANSACTION_FAILED);
|
||||
res = stub_->HandleNotifyDumpInfoResult(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1289,12 +1275,12 @@ HWTEST_F(SceneSessionManagerStubTest, HandleSetSessionLabel, Function | SmallTes
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteString(static_cast<string>("123"));
|
||||
sptr<IWindowManagerAgent> windowManagerAgent = new WindowManagerAgent();
|
||||
data.WriteRemoteObject(windowManagerAgent->AsObject());
|
||||
|
||||
int res = stub_->HandleSetSessionLabel(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
sptr<IRemoteObject> token = nullptr;
|
||||
data.WriteRemoteObject(token);
|
||||
std::string label = "TestLabel";
|
||||
data.WriteString(label);
|
||||
int result = stub_->HandleSetSessionLabel(data, reply);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1349,11 +1335,8 @@ HWTEST_F(SceneSessionManagerStubTest, HandleGetSessionInfos, Function | SmallTes
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteString16(static_cast<std::u16string>(u"123"));
|
||||
int32_t numMax = 100;
|
||||
data.WriteInt32(numMax);
|
||||
|
||||
int res = stub_->HandleGetSessionInfos(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1371,13 +1354,31 @@ HWTEST_F(SceneSessionManagerStubTest, HandleGetSessionInfo, Function | SmallTest
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteString16(static_cast<std::u16string>(u"123"));
|
||||
int32_t persistentId = 65535;
|
||||
data.WriteInt32(persistentId);
|
||||
|
||||
int res = stub_->HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
data.WriteString16(static_cast<std::u16string>(u"123"));
|
||||
data.WriteInt32(123);
|
||||
res = stub_->HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleGetSessionInfo2
|
||||
* @tc.desc: test HandleGetSessionInfo2
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerStubTest, HandleGetSessionInfo2, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteString16(static_cast<std::u16string>(u"TestDeviceId"));
|
||||
data.WriteInt32(123456789);
|
||||
int result = stub_->HandleGetSessionInfo(data, reply);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleDumpSessionAll
|
||||
* @tc.desc: test HandleDumpSessionAll
|
||||
@ -1402,10 +1403,12 @@ HWTEST_F(SceneSessionManagerStubTest, HandleDumpSessionWithId, Function | SmallT
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
int res = stub_->HandleDumpSessionWithId(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t x = 1;
|
||||
data.WriteInt32(x);
|
||||
|
||||
int res = stub_->HandleDumpSessionWithId(data, reply);
|
||||
res = stub_->HandleDumpSessionWithId(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -1669,7 +1672,7 @@ HWTEST_F(SceneSessionManagerStubTest, HandleNotifyDumpInfoResult, Function | Sma
|
||||
}
|
||||
|
||||
int res = stub_->HandleNotifyDumpInfoResult(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1686,10 +1689,12 @@ HWTEST_F(SceneSessionManagerStubTest, HandleUnregisterCollaborator, Function | S
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
int res = stub_->HandleUnregisterCollaborator(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t type = CollaboratorType::RESERVE_TYPE;
|
||||
data.WriteInt32(type);
|
||||
|
||||
int res = stub_->HandleUnregisterCollaborator(data, reply);
|
||||
res = stub_->HandleUnregisterCollaborator(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -1751,14 +1756,25 @@ HWTEST_F(SceneSessionManagerStubTest, HandleNotifyWindowExtensionVisibilityChang
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
int32_t pid = 65535;
|
||||
data.WriteInt32(pid);
|
||||
int32_t uid = 12345;
|
||||
data.WriteInt32(uid);
|
||||
bool visible = true;
|
||||
data.WriteBool(visible);
|
||||
|
||||
int res = stub_->HandleNotifyWindowExtensionVisibilityChange(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t pid = 123;
|
||||
data.WriteInt32(pid);
|
||||
res = stub_->HandleNotifyWindowExtensionVisibilityChange(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t uid = 1231;
|
||||
data.WriteInt32(pid);
|
||||
data.WriteInt32(uid);
|
||||
res = stub_->HandleNotifyWindowExtensionVisibilityChange(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
bool visible = true;
|
||||
data.WriteInt32(pid);
|
||||
data.WriteInt32(uid);
|
||||
data.WriteBool(visible);
|
||||
res = stub_->HandleNotifyWindowExtensionVisibilityChange(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -1818,15 +1834,27 @@ HWTEST_F(SceneSessionManagerStubTest, HandleAddExtensionWindowStageToSCB, Functi
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
sptr<ISessionStage> sessionStage = sptr<SessionStageMocker>::MakeSptr();
|
||||
ASSERT_NE(sessionStage, nullptr);
|
||||
int res = stub_->HandleAddExtensionWindowStageToSCB(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
sptr<ISessionStage> sessionStage = new SessionStageMocker();
|
||||
ASSERT_NE(nullptr, sessionStage);
|
||||
data.WriteRemoteObject(sessionStage->AsObject());
|
||||
res = stub_->HandleAddExtensionWindowStageToSCB(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
|
||||
ASSERT_NE(token, nullptr);
|
||||
data.WriteRemoteObject(token);
|
||||
data.WriteUint64(12345);
|
||||
res = stub_->HandleAddExtensionWindowStageToSCB(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int res = stub_->HandleAddExtensionWindowStageToSCB(data, reply);
|
||||
ASSERT_NE(nullptr, sessionStage);
|
||||
data.WriteRemoteObject(sessionStage->AsObject());
|
||||
ASSERT_NE(token, nullptr);
|
||||
data.WriteRemoteObject(token);
|
||||
data.WriteUint64(12345);
|
||||
res = stub_->HandleAddExtensionWindowStageToSCB(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -1910,10 +1938,16 @@ HWTEST_F(SceneSessionManagerStubTest, HandleAddOrRemoveSecureSession, Function |
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteInt32(12345);
|
||||
data.WriteBool(true);
|
||||
|
||||
int res = stub_->HandleAddOrRemoveSecureSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
data.WriteInt32(15);
|
||||
res = stub_->HandleAddOrRemoveSecureSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
data.WriteInt32(15);
|
||||
data.WriteBool(true);
|
||||
res = stub_->HandleAddOrRemoveSecureSession(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -1926,8 +1960,11 @@ HWTEST_F(SceneSessionManagerStubTest, HandleGetUIContentRemoteObj, Function | Sm
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
data.WriteInt32(1);
|
||||
|
||||
int res = stub_->HandleGetUIContentRemoteObj(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
data.WriteInt32(1);
|
||||
res = stub_->HandleGetUIContentRemoteObj(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -2004,9 +2041,10 @@ HWTEST_F(SceneSessionManagerStubTest, HandleGetSessionInfoByContinueSessionId, F
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteString("test_01");
|
||||
|
||||
int res = stub_->HandleGetSessionInfoByContinueSessionId(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
data.WriteString("test_01");
|
||||
res = stub_->HandleGetSessionInfoByContinueSessionId(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
@ -2140,6 +2178,25 @@ HWTEST_F(SceneSessionManagerStubTest, HandleGetDisplayIdByWindowId, Function | S
|
||||
int res = stub_->HandleGetDisplayIdByWindowId(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleRegisterCollaborator
|
||||
* @tc.desc: test HandleRegisterCollaborator
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerStubTest, HandleRegisterCollaborator, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
auto res = stub_->HandleRegisterCollaborator(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
|
||||
int32_t type = CollaboratorType::RESERVE_TYPE;
|
||||
data.WriteInt32(type);
|
||||
res = stub_->HandleRegisterCollaborator(data, reply);
|
||||
EXPECT_EQ(res, ERR_INVALID_DATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -233,6 +233,14 @@ HWTEST_F(SceneSessionManagerTest6, GetWindowVisibilityChangeInfo03, Function | S
|
||||
std::make_pair(2, WindowVisibilityState::WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION));
|
||||
visibilityChangeInfos = ssm_->GetWindowVisibilityChangeInfo(currVisibleData);
|
||||
ASSERT_EQ(visibilityChangeInfos.size(), 1);
|
||||
currVisibleData.clear();
|
||||
ssm_->lastVisibleData_.clear();
|
||||
currVisibleData.push_back(std::make_pair(1, WindowVisibilityState::WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION));
|
||||
ssm_->lastVisibleData_.push_back(
|
||||
std::make_pair(2, WindowVisibilityState::WINDOW_VISIBILITY_STATE_NO_OCCLUSION));
|
||||
visibilityChangeInfos = ssm_->GetWindowVisibilityChangeInfo(currVisibleData);
|
||||
ASSERT_EQ(visibilityChangeInfos.size(), 1);
|
||||
ASSERT_EQ(visibilityChangeInfos[0].first, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -865,8 +865,8 @@ HWTEST_F(SceneSessionTest, ModalUIExtension, Function | SmallTest | Level2)
|
||||
HWTEST_F(SceneSessionTest, NotifySessionRectChange, Function | SmallTest | Level2)
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "Background01";
|
||||
info.bundleName_ = "IsFloatingWindowAppType";
|
||||
info.abilityName_ = "NotifySessionRectChange";
|
||||
info.bundleName_ = "NotifySessionRectChangebundle";
|
||||
info.windowType_ = 1;
|
||||
sptr<Rosen::ISession> session_;
|
||||
sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
|
||||
@ -878,8 +878,7 @@ HWTEST_F(SceneSessionTest, NotifySessionRectChange, Function | SmallTest | Level
|
||||
WSRect overlapRect = { 0, 0, 0, 0 };
|
||||
sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, -1);
|
||||
sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, 11);
|
||||
sceneSession->sessionRectChangeFunc_ = [](const WSRect& rect,
|
||||
const SizeChangeReason reason, DisplayId displayId) {
|
||||
sceneSession->sessionRectChangeFunc_ = [](const WSRect& rect, SizeChangeReason reason, DisplayId displayId) {
|
||||
return;
|
||||
};
|
||||
sceneSession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION, -1);
|
||||
@ -1133,13 +1132,14 @@ HWTEST_F(SceneSessionTest, TransferPointerEventDecorDialog, Function | SmallTest
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "TransferPointerEventDecorDialog";
|
||||
info.bundleName_ = "TransferPointerEventDecorDialogBundle";
|
||||
info.windowType_ = 2122;
|
||||
info.bundleName_ = "TransferPointerEventDecorDialogbundle";
|
||||
info.windowType_ = 1;
|
||||
sptr<Rosen::ISession> session_;
|
||||
sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
|
||||
new (std::nothrow) SceneSession::SpecificSessionCallback();
|
||||
sptr<SceneSession> sceneSession =
|
||||
new (std::nothrow) SceneSession(info, specificCallback_);
|
||||
sceneSession->moveDragController_ = new MoveDragController(12);
|
||||
sceneSession->moveDragController_ = new MoveDragController(12, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
sptr<WindowSessionProperty> property = new WindowSessionProperty();
|
||||
@ -1162,13 +1162,14 @@ HWTEST_F(SceneSessionTest, TransferPointerEventSystemDialog, Function | SmallTes
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "TransferPointerEventSystemDialog";
|
||||
info.bundleName_ = "TransferPointerEventSystemDialogBundle";
|
||||
info.windowType_ = 2123;
|
||||
info.bundleName_ = "TransferPointerEventSystemDialogbundle";
|
||||
info.windowType_ = 1;
|
||||
sptr<Rosen::ISession> session_;
|
||||
sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
|
||||
new (std::nothrow) SceneSession::SpecificSessionCallback();
|
||||
sptr<SceneSession> sceneSession =
|
||||
new (std::nothrow) SceneSession(info, specificCallback_);
|
||||
sceneSession->moveDragController_ = new MoveDragController(12);
|
||||
sceneSession->moveDragController_ = new MoveDragController(12, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
|
||||
sptr<WindowSessionProperty> property = new WindowSessionProperty();
|
||||
@ -1413,7 +1414,7 @@ HWTEST_F(SceneSessionTest, OnSessionEvent, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "OnSessionEvent";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
|
||||
sceneSession->OnSessionEvent(SessionEvent::EVENT_START_MOVE);
|
||||
sceneSession->moveDragController_->isStartDrag_ = true;
|
||||
@ -1915,42 +1916,42 @@ HWTEST_F(SceneSessionTest, HandleCompatibleModeMoveDrag, Function | SmallTest |
|
||||
WSRect rect = {1, 1, 1, 1};
|
||||
WSRect rect2 = {1, 1, 2, 1};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
rect2 = {1, 1, 1, 2};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
rect = {1, 1, 2000, 1};
|
||||
rect2 = {1, 1, 2, 1};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
rect = {1, 1, 2000, 1};
|
||||
rect2 = {1, 1, 1, 2};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
rect = {1, 1, 500, 1};
|
||||
rect2 = {1, 1, 1, 2};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
rect = {1, 1, 500, 1};
|
||||
rect2 = {1, 1, 1, 2};
|
||||
sceneSession->winRect_ = rect2;
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
|
||||
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::MOVE, false);
|
||||
sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::MOVE, false, false);
|
||||
ASSERT_EQ(sceneSession->reason_, SizeChangeReason::MOVE);
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ HWTEST_F(SceneSessionTest2, SetScale, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: RequestHideKeyboard
|
||||
* @tc.desc: * @tc.name: RequestHideKeyboard
|
||||
* @tc.desc: RequestHideKeyboard
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, RequestHideKeyboard, Function | SmallTest | Level2)
|
||||
@ -742,7 +742,7 @@ HWTEST_F(SceneSessionTest2, RequestHideKeyboard, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: SetIsDisplayStatusBarTemporarily
|
||||
* @tc.desc: * @tc.name: SetIsDisplayStatusBarTemporarily
|
||||
* @tc.desc: SetIsDisplayStatusBarTemporarily
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetIsDisplayStatusBarTemporarily, Function | SmallTest | Level2)
|
||||
@ -760,7 +760,7 @@ HWTEST_F(SceneSessionTest2, SetIsDisplayStatusBarTemporarily, Function | SmallTe
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateAvoidArea
|
||||
* @tc.desc: * @tc.name: UpdateAvoidArea
|
||||
* @tc.desc: UpdateAvoidArea
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, UpdateAvoidArea, Function | SmallTest | Level2)
|
||||
@ -949,7 +949,7 @@ HWTEST_F(SceneSessionTest2, CalculateCombinedExtWindowFlags, Function | SmallTes
|
||||
|
||||
/**
|
||||
* @tc.name: SaveUpdatedIcon
|
||||
* @tc.desc: * @tc.name: SaveUpdatedIcon
|
||||
* @tc.desc: SaveUpdatedIcon
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SaveUpdatedIcon, Function | SmallTest | Level2)
|
||||
@ -966,7 +966,7 @@ HWTEST_F(SceneSessionTest2, SaveUpdatedIcon, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyTouchOutside
|
||||
* @tc.desc: * @tc.name: NotifyTouchOutside
|
||||
* @tc.desc: NotifyTouchOutside
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, NotifyTouchOutside, Function | SmallTest | Level2)
|
||||
@ -997,7 +997,7 @@ HWTEST_F(SceneSessionTest2, NotifyTouchOutside, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: CheckOutTouchOutsideRegister
|
||||
* @tc.desc: * @tc.name: CheckOutTouchOutsideRegister
|
||||
* @tc.desc: CheckOutTouchOutsideRegister
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, CheckOutTouchOutsideRegister, Function | SmallTest | Level2)
|
||||
@ -1027,7 +1027,7 @@ HWTEST_F(SceneSessionTest2, CheckOutTouchOutsideRegister, Function | SmallTest |
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateRotationAvoidArea
|
||||
* @tc.desc: * @tc.name: UpdateRotationAvoidArea
|
||||
* @tc.desc: UpdateRotationAvoidArea
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, UpdateRotationAvoidArea, Function | SmallTest | Level2)
|
||||
@ -1055,7 +1055,7 @@ HWTEST_F(SceneSessionTest2, UpdateRotationAvoidArea, Function | SmallTest | Leve
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyForceHideChange
|
||||
* @tc.desc: * @tc.name: NotifyForceHideChange
|
||||
* @tc.desc: NotifyForceHideChange
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, NotifyForceHideChange, Function | SmallTest | Level2)
|
||||
@ -1082,7 +1082,7 @@ HWTEST_F(SceneSessionTest2, NotifyForceHideChange, Function | SmallTest | Level2
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterSessionChangeCallback
|
||||
* @tc.desc: * @tc.name: RegisterSessionChangeCallback
|
||||
* @tc.desc: RegisterSessionChangeCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, RegisterSessionChangeCallback, Function | SmallTest | Level2)
|
||||
@ -1098,7 +1098,7 @@ HWTEST_F(SceneSessionTest2, RegisterSessionChangeCallback, Function | SmallTest
|
||||
|
||||
/**
|
||||
* @tc.name: ClearSpecificSessionCbMap
|
||||
* @tc.desc: * @tc.name: ClearSpecificSessionCbMap
|
||||
* @tc.desc: ClearSpecificSessionCbMap
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap, Function | SmallTest | Level2)
|
||||
@ -1113,7 +1113,7 @@ HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap, Function | SmallTest | Le
|
||||
|
||||
/**
|
||||
* @tc.name: SendPointerEventToUI
|
||||
* @tc.desc: * @tc.name: SendPointerEventToUI
|
||||
* @tc.desc: SendPointerEventToUI
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SendPointerEventToUI, Function | SmallTest | Level2)
|
||||
@ -1135,7 +1135,7 @@ HWTEST_F(SceneSessionTest2, SendPointerEventToUI, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: SetFloatingScale
|
||||
* @tc.desc: * @tc.name: SetFloatingScale
|
||||
* @tc.desc: SetFloatingScale
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetFloatingScale, Function | SmallTest | Level2)
|
||||
@ -1171,7 +1171,7 @@ HWTEST_F(SceneSessionTest2, SetFloatingScale, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: ProcessPointDownSession
|
||||
* @tc.desc: * @tc.name: ProcessPointDownSession
|
||||
* @tc.desc: ProcessPointDownSession
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, ProcessPointDownSession, Function | SmallTest | Level2)
|
||||
@ -1203,7 +1203,7 @@ HWTEST_F(SceneSessionTest2, ProcessPointDownSession, Function | SmallTest | Leve
|
||||
|
||||
/**
|
||||
* @tc.name: SetSelfToken
|
||||
* @tc.desc: * @tc.name: SetSelfToken
|
||||
* @tc.desc: SetSelfToken
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetSelfToken, Function | SmallTest | Level2)
|
||||
@ -1242,7 +1242,7 @@ HWTEST_F(SceneSessionTest2, SetSelfToken, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: SetLastSafeRect
|
||||
* @tc.desc: * @tc.name: SetLastSafeRect
|
||||
* @tc.desc: SetLastSafeRect
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetLastSafeRect, Function | SmallTest | Level2)
|
||||
@ -1265,7 +1265,7 @@ HWTEST_F(SceneSessionTest2, SetLastSafeRect, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: GetSessionTargetRect
|
||||
* @tc.desc: * @tc.name: GetSessionTargetRect
|
||||
* @tc.desc: GetSessionTargetRect
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, GetSessionTargetRect, Function | SmallTest | Level2)
|
||||
@ -1280,11 +1280,11 @@ HWTEST_F(SceneSessionTest2, GetSessionTargetRect, Function | SmallTest | Level2)
|
||||
bool res = sceneSession->AddSubSession(sceneSession);
|
||||
EXPECT_EQ(true, res);
|
||||
EXPECT_EQ(sceneSession, (sceneSession->GetSubSession())[0]);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1024);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1024, WindowType::WINDOW_TYPE_FLOAT);
|
||||
WSRect rectResult = sceneSession->GetSessionTargetRect();
|
||||
EXPECT_EQ(0, rectResult.posX_);
|
||||
EXPECT_EQ(0, rectResult.width_);
|
||||
auto dragHotAreaFunc = [sceneSession](DisplayId displayId, int32_t type, const SizeChangeReason reason) {
|
||||
auto dragHotAreaFunc = [sceneSession](DisplayId displayId, int32_t type, SizeChangeReason reason) {
|
||||
if (SizeChangeReason::END == reason) {
|
||||
GTEST_LOG_(INFO) << "type = " << type;
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ HWTEST_F(SceneSessionTest2, GetSessionTargetRect, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: SetPipActionEvent
|
||||
* @tc.desc: * @tc.name: SetPipActionEvent
|
||||
* @tc.desc: SetPipActionEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetPipActionEvent, Function | SmallTest | Level2)
|
||||
@ -1321,7 +1321,7 @@ HWTEST_F(SceneSessionTest2, SetPipActionEvent, Function | SmallTest | Level2)
|
||||
|
||||
/*
|
||||
* @tc.name: SetPiPControlEvent
|
||||
* @tc.desc: * @tc.name: SetPiPControlEvent
|
||||
* @tc.desc: SetPiPControlEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetPiPControlEvent, Function | SmallTest | Level2)
|
||||
@ -1374,7 +1374,7 @@ HWTEST_F(SceneSessionTest2, SetForceHideState, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: ClearSpecificSessionCbMap
|
||||
* @tc.desc: * @tc.name: ClearSpecificSessionCbMap
|
||||
* @tc.desc: ClearSpecificSessionCbMap
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap01, Function | SmallTest | Level2)
|
||||
@ -1405,7 +1405,7 @@ HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap01, Function | SmallTest |
|
||||
|
||||
/**
|
||||
* @tc.name: OnSessionEvent01
|
||||
* @tc.desc: * @tc.name: OnSessionEvent
|
||||
* @tc.desc: OnSessionEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, OnSessionEvent01, Function | SmallTest | Level2)
|
||||
@ -1419,7 +1419,7 @@ HWTEST_F(SceneSessionTest2, OnSessionEvent01, Function | SmallTest | Level2)
|
||||
|
||||
sceneSession->leashWinSurfaceNode_ = nullptr;
|
||||
SessionEvent event = SessionEvent::EVENT_START_MOVE;
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
|
||||
sceneSession->OnSessionEvent(event);
|
||||
|
||||
@ -1434,7 +1434,7 @@ HWTEST_F(SceneSessionTest2, OnSessionEvent01, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: SetSessionRectChangeCallback
|
||||
* @tc.desc: * @tc.name: SetSessionRectChangeCallback
|
||||
* @tc.desc: SetSessionRectChangeCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetSessionRectChangeCallback, Function | SmallTest | Level2)
|
||||
@ -1461,7 +1461,7 @@ HWTEST_F(SceneSessionTest2, SetSessionRectChangeCallback, Function | SmallTest |
|
||||
|
||||
/**
|
||||
* @tc.name: SetSessionPiPControlStatusChangeCallback
|
||||
* @tc.desc: * @tc.name: SetSessionPiPControlStatusChangeCallback
|
||||
* @tc.desc: SetSessionPiPControlStatusChangeCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetSessionPiPControlStatusChangeCallback, Function | SmallTest | Level2)
|
||||
@ -1493,7 +1493,7 @@ HWTEST_F(SceneSessionTest2, SetAutoStartPiPStatusChangeCallback, Function | Smal
|
||||
|
||||
/**
|
||||
* @tc.name: RaiseAppMainWindowToTop
|
||||
* @tc.desc: * @tc.name: RaiseAppMainWindowToTop
|
||||
* @tc.desc: RaiseAppMainWindowToTop
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, RaiseAppMainWindowToTop, Function | SmallTest | Level2)
|
||||
@ -1522,7 +1522,7 @@ HWTEST_F(SceneSessionTest2, RaiseAppMainWindowToTop, Function | SmallTest | Leve
|
||||
|
||||
/**
|
||||
* @tc.name: GetKeyboardAvoidArea
|
||||
* @tc.desc: * @tc.name: GetKeyboardAvoidArea01
|
||||
* @tc.desc: GetKeyboardAvoidArea01
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, GetKeyboardAvoidArea01, Function | SmallTest | Level2)
|
||||
@ -1542,7 +1542,7 @@ HWTEST_F(SceneSessionTest2, GetKeyboardAvoidArea01, Function | SmallTest | Level
|
||||
|
||||
/**
|
||||
* @tc.name: GetCutoutAvoidArea
|
||||
* @tc.desc: * @tc.name: GetCutoutAvoidArea
|
||||
* @tc.desc: GetCutoutAvoidArea
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, GetCutoutAvoidArea01, Function | SmallTest | Level2)
|
||||
@ -1565,7 +1565,7 @@ HWTEST_F(SceneSessionTest2, GetCutoutAvoidArea01, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: GetAINavigationBarArea
|
||||
* @tc.desc: * @tc.name: GetAINavigationBarArea
|
||||
* @tc.desc: GetAINavigationBarArea
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, GetAINavigationBarArea, Function | SmallTest | Level2)
|
||||
@ -1607,7 +1607,7 @@ HWTEST_F(SceneSessionTest2, GetAINavigationBarArea, Function | SmallTest | Level
|
||||
|
||||
/**
|
||||
* @tc.name: TransferPointerEvent
|
||||
* @tc.desc: * @tc.name: TransferPointerEvent
|
||||
* @tc.desc: TransferPointerEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, TransferPointerEvent03, Function | SmallTest | Level2)
|
||||
@ -1647,7 +1647,7 @@ HWTEST_F(SceneSessionTest2, TransferPointerEvent03, Function | SmallTest | Level
|
||||
|
||||
/**
|
||||
* @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: * @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: OnMoveDragCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, OnMoveDragCallback, Function | SmallTest | Level2)
|
||||
@ -1662,7 +1662,7 @@ HWTEST_F(SceneSessionTest2, OnMoveDragCallback, Function | SmallTest | Level2)
|
||||
Session session(info);
|
||||
WSRect rect;
|
||||
sceneSession->UpdateWinRectForSystemBar(rect);
|
||||
sceneSession->SetSurfaceBounds(rect);
|
||||
sceneSession->SetSurfaceBounds(rect, false);
|
||||
sceneSession->GetWindowNameAllType();
|
||||
session.scenePersistence_ = new ScenePersistence("aa", 0);
|
||||
sceneSession->GetUpdatedIconPath();
|
||||
@ -1677,7 +1677,7 @@ HWTEST_F(SceneSessionTest2, OnMoveDragCallback, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: * @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: OnMoveDragCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, OnMoveDragCallback01, Function | SmallTest | Level2)
|
||||
@ -1704,7 +1704,7 @@ HWTEST_F(SceneSessionTest2, OnMoveDragCallback01, Function | SmallTest | Level2)
|
||||
|
||||
/**
|
||||
* @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: * @tc.name: OnMoveDragCallback
|
||||
* @tc.desc: OnMoveDragCallback
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, OnMoveDragCallback02, Function | SmallTest | Level2)
|
||||
@ -1738,13 +1738,13 @@ HWTEST_F(SceneSessionTest2, OnMoveDragCallback02, Function | SmallTest | Level2)
|
||||
bool isPreImeEvent = true;
|
||||
sceneSession->SendKeyEventToUI(keyEvent, isPreImeEvent);
|
||||
sceneSession->IsDirtyWindow();
|
||||
sceneSession->moveDragController_ = new MoveDragController(0);
|
||||
sceneSession->moveDragController_ = new MoveDragController(0, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->NotifyUILostFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsStartMoving
|
||||
* @tc.desc: * @tc.name: IsStartMoving
|
||||
* @tc.desc: IsStartMoving
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, IsStartMoving, Function | SmallTest | Level2)
|
||||
@ -1792,7 +1792,7 @@ HWTEST_F(SceneSessionTest2, IsSystemSpecificSession, Function | SmallTest | Leve
|
||||
|
||||
/**
|
||||
* @tc.name: SetTemporarilyShowWhenLocked
|
||||
* @tc.desc: * @tc.name: SetTemporarilyShowWhenLocked
|
||||
* @tc.desc: SetTemporarilyShowWhenLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, SetTemporarilyShowWhenLocked, Function | SmallTest | Level2)
|
||||
@ -1818,7 +1818,7 @@ HWTEST_F(SceneSessionTest2, SetTemporarilyShowWhenLocked, Function | SmallTest |
|
||||
|
||||
/**
|
||||
* @tc.name: GetShowWhenLockedFlagValue
|
||||
* @tc.desc: * @tc.name: GetShowWhenLockedFlagValue
|
||||
* @tc.desc: GetShowWhenLockedFlagValue
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionTest2, GetShowWhenLockedFlagValue, Function | SmallTest | Level2)
|
||||
|
@ -97,7 +97,7 @@ HWTEST_F(SceneSessionTest3, SetAspectRatio12, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(result, WSError::WS_OK);
|
||||
ASSERT_EQ(sceneSession->GetAspectRatio(), ratio);
|
||||
|
||||
sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(0);
|
||||
sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(0, sceneSession->GetWindowType());
|
||||
result = sceneSession->SetAspectRatio(ratio);
|
||||
ASSERT_EQ(result, WSError::WS_OK);
|
||||
ASSERT_EQ(sceneSession->GetAspectRatio(), ratio);
|
||||
@ -675,11 +675,11 @@ HWTEST_F(SceneSessionTest3, GetStartMoveFlag, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "GetStartMoveFlag";
|
||||
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
bool isMoving = false;
|
||||
ASSERT_EQ(WSError::WS_OK, sceneSession->GetStartMoveFlag(isMoving));
|
||||
|
||||
sceneSession->moveDragController_ = new MoveDragController(1024);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1024, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_EQ(WSError::WS_OK, sceneSession->GetStartMoveFlag(isMoving));
|
||||
}
|
||||
|
||||
|
@ -343,9 +343,9 @@ HWTEST_F(SceneSessionTest4, SetSurfaceBounds, Function | SmallTest | Level2)
|
||||
struct RSSurfaceNodeConfig config;
|
||||
std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
|
||||
session->surfaceNode_ = surfaceNode;
|
||||
session->SetSurfaceBounds(rect);
|
||||
session->SetSurfaceBounds(rect, false);
|
||||
session->SetLeashWinSurfaceNode(surfaceNode);
|
||||
session->SetSurfaceBounds(rect);
|
||||
session->SetSurfaceBounds(rect, false);
|
||||
EXPECT_NE(nullptr, session->GetLeashWinSurfaceNode());
|
||||
}
|
||||
|
||||
@ -1108,7 +1108,7 @@ HWTEST_F(SceneSessionTest4, SetMovable01, Function | SmallTest | Level2)
|
||||
sceneSession->SetMovable(true);
|
||||
sceneSession->leashWinSurfaceNode_ = nullptr;
|
||||
SessionEvent event = SessionEvent::EVENT_START_MOVE;
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
sceneSession->SetMovable(true);
|
||||
sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
|
||||
sceneSession->OnSessionEvent(event);
|
||||
@ -1258,7 +1258,7 @@ HWTEST_F(SceneSessionTest4, IsMovable02, Function | SmallTest | Level2)
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
|
||||
sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
|
||||
sceneSession->SetSessionProperty(property);
|
||||
sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
sceneSession->moveDragController_ = new MoveDragController(2024, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_EQ(WSError::WS_DO_NOTHING, sceneSession->UpdateFocus(false));
|
||||
ASSERT_EQ(false, sceneSession->IsMovable());
|
||||
ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateFocus(true));
|
||||
@ -1277,7 +1277,7 @@ HWTEST_F(SceneSessionTest4, IsMovable03, Function | SmallTest | Level2)
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
|
||||
sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
|
||||
sceneSession->SetSessionProperty(nullptr);
|
||||
sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
sceneSession->moveDragController_ = new MoveDragController(2024, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_EQ(WSError::WS_OK, sceneSession->UpdateFocus(true));
|
||||
ASSERT_EQ(false, sceneSession->IsMovable());
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ HWTEST_F(SceneSessionTest5, NotifyClientToUpdateRectTask, Function | SmallTest |
|
||||
EXPECT_EQ(session->reason_, SizeChangeReason::RECOVER);
|
||||
EXPECT_EQ(WSError::WS_ERROR_INVALID_SESSION, session->NotifyClientToUpdateRectTask("SceneSessionTest5", nullptr));
|
||||
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, session->GetWindowType());
|
||||
session->moveDragController_->isStartDrag_ = true;
|
||||
session->moveDragController_->isStartMove_ = true;
|
||||
session->Session::UpdateSizeChangeReason(SizeChangeReason::MOVE);
|
||||
@ -330,7 +330,7 @@ HWTEST_F(SceneSessionTest5, TransferPointerEvent01, Function | SmallTest | Level
|
||||
session->property_->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
|
||||
session->property_->SetMaximizeMode(MaximizeMode::MODE_RECOVER);
|
||||
session->ClearDialogVector();
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, session->GetWindowType());
|
||||
SystemSessionConfig systemConfig;
|
||||
systemConfig.isSystemDecorEnable_ = false;
|
||||
systemConfig.decorModeSupportInfo_ = 2;
|
||||
@ -383,9 +383,9 @@ HWTEST_F(SceneSessionTest5, SetSurfaceBounds01, Function | SmallTest | Level2)
|
||||
session->SetSessionRect(preRect);
|
||||
|
||||
session->property_->SetDragEnabled(true);
|
||||
session->SetSurfaceBounds(rect);
|
||||
session->SetSurfaceBounds(rect, false);
|
||||
session->property_->SetDragEnabled(false);
|
||||
session->SetSurfaceBounds(rect);
|
||||
session->SetSurfaceBounds(rect, false);
|
||||
EXPECT_EQ(preRect, session->GetSessionRect());
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ HWTEST_F(SceneSessionTest5, SetSessionRectChangeCallback, Function | SmallTest |
|
||||
sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
|
||||
EXPECT_NE(session, nullptr);
|
||||
WSRect rec = { 1, 1, 1, 1 };
|
||||
NotifySessionRectChangeFunc func = [](const WSRect& rect, const SizeChangeReason reason, DisplayId displayId) {
|
||||
NotifySessionRectChangeFunc func = [](const WSRect& rect, SizeChangeReason reason, DisplayId displayId) {
|
||||
return;
|
||||
};
|
||||
session->SetSessionRectChangeCallback(nullptr);
|
||||
@ -511,7 +511,7 @@ HWTEST_F(SceneSessionTest5, SetSessionRectChangeCallback02, Function | SmallTest
|
||||
sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(info, nullptr);
|
||||
EXPECT_NE(session, nullptr);
|
||||
WSRect rec = { 1, 1, 1, 1 };
|
||||
NotifySessionRectChangeFunc func = [](const WSRect& rect, const SizeChangeReason reason, DisplayId displayId) {
|
||||
NotifySessionRectChangeFunc func = [](const WSRect& rect, SizeChangeReason reason, DisplayId displayId) {
|
||||
return;
|
||||
};
|
||||
session->SetSessionRectChangeCallback(nullptr);
|
||||
@ -818,7 +818,7 @@ HWTEST_F(SceneSessionTest5, OnMoveDragCallback, Function | SmallTest | Level2)
|
||||
session->moveDragController_ = nullptr;
|
||||
SizeChangeReason reason = { SizeChangeReason::DRAG };
|
||||
session->OnMoveDragCallback(reason);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, session->GetWindowType());
|
||||
session->OnMoveDragCallback(reason);
|
||||
|
||||
reason = SizeChangeReason::DRAG_END;
|
||||
@ -831,7 +831,7 @@ HWTEST_F(SceneSessionTest5, OnMoveDragCallback, Function | SmallTest | Level2)
|
||||
session->OnMoveDragCallback(reason);
|
||||
EXPECT_EQ(WSError::WS_OK, session->UpdateSizeChangeReason(reason));
|
||||
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, session->GetWindowType());
|
||||
EXPECT_NE(session->moveDragController_, nullptr);
|
||||
session->SetSessionProperty(nullptr);
|
||||
session->OnMoveDragCallback(reason);
|
||||
@ -1628,7 +1628,7 @@ HWTEST_F(SceneSessionTest5, HandleMoveDragSurfaceNode, Function | SmallTest | Le
|
||||
sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
|
||||
EXPECT_NE(property, nullptr);
|
||||
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024);
|
||||
session->moveDragController_ = sptr<MoveDragController>::MakeSptr(2024, session->GetWindowType());
|
||||
EXPECT_NE(session->moveDragController_, nullptr);
|
||||
|
||||
session->HandleMoveDragSurfaceNode(SizeChangeReason::DRAG_START);
|
||||
|
@ -126,13 +126,15 @@ HWTEST_F(SessionStubTest, ProcessRemoteRequestTest01, Function | SmallTest | Lev
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_CONNECT), data, reply, option);
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
ASSERT_EQ(data.WriteUint32(1), true);
|
||||
ASSERT_EQ(data.WriteUint32(100), true);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_SESSION_EVENT), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
AAFwk::Want options;
|
||||
EXPECT_NE(data.WriteString("HandleSessionException"), false);
|
||||
EXPECT_NE(data.WriteParcelable(&options), false);
|
||||
EXPECT_NE(data.WriteBool(false), false);
|
||||
EXPECT_NE(data.WriteInt32(33), false);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_TERMINATE), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
@ -163,9 +165,10 @@ HWTEST_F(SessionStubTest, ProcessRemoteRequestTest02, Function | SmallTest | Lev
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_RAISE_APP_MAIN_WINDOW), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
data.WriteBool(true);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_BACKPRESSED), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_MARK_PROCESSED), data, reply, option);
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
@ -193,9 +196,10 @@ HWTEST_F(SessionStubTest, ProcessRemoteRequestTest02, Function | SmallTest | Lev
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_NOTIFY_EXTENSION_DIED), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
data.WriteInt32(1);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_NOTIFY_EXTENSION_TIMEOUT), data, reply, option);
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -318,9 +322,11 @@ HWTEST_F(SessionStubTest, ProcessRemoteRequestTest05, Function | SmallTest | Lev
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_UPDATE_PIP_RECT), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(data.WriteUint32(1), true);
|
||||
ASSERT_EQ(data.WriteInt32(1), true);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_UPDATE_PIP_CONTROL_STATUS), data, reply, option);
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
res = session_->ProcessRemoteRequest(
|
||||
static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_LAYOUT_FULL_SCREEN_CHANGE), data, reply, option);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
@ -405,14 +411,18 @@ HWTEST_F(SessionStubTest, sessionStubTest02, Function | SmallTest | Level2)
|
||||
if (!data.ReadBool()) {
|
||||
ASSERT_EQ(ERR_INVALID_DATA, res);
|
||||
}
|
||||
ASSERT_EQ(data.WriteInt32(2), true);
|
||||
res = session_->HandleMarkProcessed(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
res = session_->HandleGetGlobalMaximizeMode(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(data.WriteBool(true), true);
|
||||
res = session_->HandleNeedAvoid(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(data.WriteUint32(2), true);
|
||||
res = session_->HandleGetAvoidAreaByType(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(data.WriteFloat(2.0f), true);
|
||||
res = session_->HandleSetAspectRatio(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
res = session_->HandleUpdateWindowSceneAfterCustomAnimation(data, reply);
|
||||
@ -420,6 +430,7 @@ HWTEST_F(SessionStubTest, sessionStubTest02, Function | SmallTest | Level2)
|
||||
session_->HandleTransferAbilityResult(data, reply);
|
||||
res = session_->HandleNotifyExtensionDied(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
ASSERT_EQ(data.WriteInt32(2), true);
|
||||
res = session_->HandleNotifyExtensionTimeout(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
res = session_->HandleGetStatusBarHeight(data, reply);
|
||||
@ -729,6 +740,7 @@ HWTEST_F(SessionStubTest, HandleUpdateSessionRect, Function | SmallTest | Level2
|
||||
data.WriteUint32(40);
|
||||
data.WriteUint32(0);
|
||||
data.WriteBool(true);
|
||||
data.WriteBool(true);
|
||||
auto res = session_->HandleUpdateSessionRect(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
}
|
||||
@ -832,6 +844,39 @@ HWTEST_F(SessionStubTest, HandleUpdateClientRect01, Function | SmallTest | Level
|
||||
res = session_->HandleUpdateClientRect(data, reply);
|
||||
ASSERT_EQ(ERR_NONE, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleSyncSessionEvent1
|
||||
* @tc.desc: sessionStub HandleSyncSessionEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SessionStubTest, HandleSyncSessionEvent1, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteUint32(static_cast<uint32_t>(SessionEvent::EVENT_MAXIMIZE));
|
||||
auto result = session_->HandleSyncSessionEvent(data, reply);
|
||||
ASSERT_EQ(result, ERR_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleSyncSessionEvent2
|
||||
* @tc.desc: sessionStub HandleSyncSessionEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SessionStubTest, HandleSyncSessionEvent2, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
data.WriteUint32(0xFFFFFFFF);
|
||||
auto result = session_->HandleSyncSessionEvent(data, reply);
|
||||
ASSERT_EQ(result, ERR_INVALID_DATA);
|
||||
|
||||
result = session_->HandleSyncSessionEvent(data, reply);
|
||||
ASSERT_EQ(result, ERR_NONE);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -546,7 +546,7 @@ HWTEST_F(WindowSessionTest, OnSessionEvent02, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect targetRect_ = { 100, 100, 1000, 1000 };
|
||||
@ -568,7 +568,7 @@ HWTEST_F(WindowSessionTest, ConsumeMoveEvent01, Function | SmallTest | Level2)
|
||||
info.abilityName_ = "testSession1";
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
@ -604,7 +604,7 @@ HWTEST_F(WindowSessionTest, ConsumeMoveEvent02, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect originalRect = { 100, 100, 1000, 1000 };
|
||||
@ -642,7 +642,7 @@ HWTEST_F(WindowSessionTest, ConsumeMoveEvent02, Function | SmallTest | Level2)
|
||||
pointerItem.SetDisplayX(205);
|
||||
pointerItem.SetDisplayY(650);
|
||||
result = sceneSession->moveDragController_->ConsumeMoveEvent(pointerEvent, originalRect);
|
||||
ASSERT_EQ(result, false);
|
||||
ASSERT_EQ(result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -657,7 +657,7 @@ HWTEST_F(WindowSessionTest, ConsumeDragEvent01, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect originalRect = { 100, 100, 1000, 1000 };
|
||||
@ -699,7 +699,7 @@ HWTEST_F(WindowSessionTest, ConsumeDragEvent02, Function | SmallTest | Level2)
|
||||
info.abilityName_ = "testSession1";
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect originalRect = { 100, 100, 1000, 1000 };
|
||||
@ -746,7 +746,7 @@ HWTEST_F(WindowSessionTest, ConsumeDragEvent02, Function | SmallTest | Level2)
|
||||
pointerItem.SetDisplayX(250);
|
||||
pointerItem.SetDisplayY(250);
|
||||
result = sceneSession->moveDragController_->ConsumeDragEvent(pointerEvent, originalRect, property, sessionConfig);
|
||||
ASSERT_EQ(result, false);
|
||||
ASSERT_EQ(result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -761,7 +761,7 @@ HWTEST_F(WindowSessionTest, ConsumeDragEvent03, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect originalRect = { 100, 100, 1000, 1000 };
|
||||
@ -820,7 +820,7 @@ HWTEST_F(WindowSessionTest, ConsumeDragEvent04, Function | SmallTest | Level2)
|
||||
info.bundleName_ = "testSession3";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1);
|
||||
sceneSession->moveDragController_ = new MoveDragController(1, WindowType::WINDOW_TYPE_FLOAT);
|
||||
ASSERT_TRUE(sceneSession->moveDragController_);
|
||||
sceneSession->moveDragController_->InitMoveDragProperty();
|
||||
WSRect originalRect = { 100, 100, 1000, 1000 };
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "session_manager/include/scene_session_manager.h"
|
||||
#include "session/host/include/session.h"
|
||||
#include "session_info.h"
|
||||
#include "process_options.h"
|
||||
#include "key_event.h"
|
||||
#include "wm_common.h"
|
||||
#include "window_manager_hilog.h"
|
||||
@ -995,6 +996,8 @@ HWTEST_F(WindowSessionTest2, SetSessionInfo, Function | SmallTest | Level2)
|
||||
info.uiAbilityId_ = 1;
|
||||
info.startSetting = nullptr;
|
||||
info.continueSessionId_ = "";
|
||||
std::shared_ptr<AAFwk::ProcessOptions> processOptions = std::make_shared<AAFwk::ProcessOptions>();
|
||||
info.processOptions = processOptions;
|
||||
session_->SetSessionInfo(info);
|
||||
ASSERT_EQ(nullptr, session_->sessionInfo_.want);
|
||||
ASSERT_EQ(nullptr, session_->sessionInfo_.callerToken_);
|
||||
@ -1004,6 +1007,7 @@ HWTEST_F(WindowSessionTest2, SetSessionInfo, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(1, session_->sessionInfo_.uiAbilityId_);
|
||||
ASSERT_EQ("", session_->sessionInfo_.continueSessionId_);
|
||||
ASSERT_EQ(nullptr, session_->sessionInfo_.startSetting);
|
||||
ASSERT_EQ(processOptions, session_->sessionInfo_.processOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2063,7 +2067,7 @@ HWTEST_F(WindowSessionTest2, SetSessionExceptionListener, Function | SmallTest |
|
||||
{
|
||||
session_->SetSessionExceptionListener(nullptr, true);
|
||||
|
||||
NotifySessionExceptionFunc func = [](const SessionInfo& info, bool needRemoveSession) {};
|
||||
NotifySessionExceptionFunc func = [](const SessionInfo& info, bool needRemoveSession, bool startFail) {};
|
||||
session_->SetSessionExceptionListener(func, true);
|
||||
|
||||
ASSERT_NE(nullptr, session_->jsSceneSessionExceptionFunc_);
|
||||
|
@ -879,14 +879,17 @@ HWTEST_F(WindowSessionTest3, NotifyClick, Function | SmallTest | Level2)
|
||||
ASSERT_NE(session_, nullptr);
|
||||
int resultValue = 0;
|
||||
bool hasRequestFocus = true;
|
||||
NotifyClickFunc func = [&resultValue, &hasRequestFocus](bool requestFocus) {
|
||||
bool hasIsClick = true;
|
||||
NotifyClickFunc func = [&resultValue, &hasRequestFocus, &hasIsClick](bool requestFocus, bool isClick) {
|
||||
resultValue = 1;
|
||||
hasRequestFocus = requestFocus;
|
||||
hasIsClick = isClick;
|
||||
};
|
||||
session_->SetClickListener(func);
|
||||
session_->NotifyClick(false);
|
||||
session_->NotifyClick(false, false);
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
EXPECT_EQ(hasRequestFocus, false);
|
||||
EXPECT_EQ(hasIsClick, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
virtual void SetMaximizeMode(MaximizeMode maximizeMode);
|
||||
virtual MaximizeMode GetMaximizeMode();
|
||||
virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo);
|
||||
virtual WMError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener);
|
||||
virtual WMError UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener);
|
||||
virtual WMError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener);
|
||||
virtual WMError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible);
|
||||
virtual WMError UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener);
|
||||
|
@ -687,7 +687,7 @@ void WindowAdapter::GetFocusWindowInfo(FocusChangeInfo& focusInfo)
|
||||
wmsProxy->GetFocusWindowInfo(focusInfo);
|
||||
}
|
||||
|
||||
WMError WindowAdapter::UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener)
|
||||
WMError WindowAdapter::UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING);
|
||||
|
||||
|
@ -163,6 +163,9 @@ RSSurfaceNode::SharedPtr WindowImpl::CreateSurfaceNode(std::string name, WindowT
|
||||
case WindowType::WINDOW_TYPE_APP_MAIN_WINDOW:
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::APP_WINDOW_NODE;
|
||||
break;
|
||||
case WindowType::WINDOW_TYPE_PIP:
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::APP_WINDOW_NODE;
|
||||
break;
|
||||
default:
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::DEFAULT;
|
||||
break;
|
||||
|
@ -267,6 +267,9 @@ RSSurfaceNode::SharedPtr WindowSessionImpl::CreateSurfaceNode(const std::string&
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::UI_EXTENSION_COMMON_NODE;
|
||||
}
|
||||
break;
|
||||
case WindowType::WINDOW_TYPE_PIP:
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::APP_WINDOW_NODE;
|
||||
break;
|
||||
default:
|
||||
rsSurfaceNodeType = RSSurfaceNodeType::DEFAULT;
|
||||
break;
|
||||
@ -945,7 +948,7 @@ sptr<WindowSessionImpl> WindowSessionImpl::FindMainWindowWithContext()
|
||||
return win;
|
||||
}
|
||||
}
|
||||
WLOGFW("Can not find main window, not app type");
|
||||
TLOGD(WmsLogTag::DEFAULT, "Can not find main window, not app type");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1603,7 +1606,7 @@ WMError WindowSessionImpl::SetResizeByDragEnabled(bool dragEnabled)
|
||||
TLOGE(WmsLogTag::DEFAULT, "Session is invalid");
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
}
|
||||
|
||||
|
||||
WLOGFD("%{public}d", dragEnabled);
|
||||
if (IsWindowSessionInvalid()) {
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
@ -1776,6 +1779,7 @@ std::string WindowSessionImpl::GetRestoredRouterStack()
|
||||
|
||||
Ace::UIContent* WindowSessionImpl::GetUIContent() const
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(uiContentMutex_);
|
||||
return uiContent_.get();
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void WindowManagerAgentProxy::NotifyAccessibilityWindowInfo(const std::vector<sp
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteUint32(static_cast<uint32_t>(type))) {
|
||||
if (!data.WriteInt32(static_cast<int32_t>(type))) {
|
||||
WLOGFE("Write windowUpdateType failed");
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,14 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
break;
|
||||
}
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_MODE_TYPE: {
|
||||
WindowModeType type = static_cast<WindowModeType>(data.ReadUint8());
|
||||
uint8_t typeId = 0;
|
||||
if (!data.ReadUint8(typeId) ||
|
||||
typeId < static_cast<uint8_t>(WindowModeType::WINDOW_MODE_SPLIT_FLOATING) ||
|
||||
typeId > static_cast<uint8_t>(WindowModeType::WINDOW_MODE_OTHER)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "read WindowModeType failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WindowModeType type = static_cast<WindowModeType>(typeId);
|
||||
UpdateWindowModeTypeInfo(type);
|
||||
break;
|
||||
}
|
||||
@ -88,7 +95,14 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
WLOGFE("read accessibility window infos failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WindowUpdateType type = static_cast<WindowUpdateType>(data.ReadUint32());
|
||||
int32_t typeId = 0;
|
||||
if (!data.ReadInt32(typeId) ||
|
||||
typeId < static_cast<int32_t>(WindowUpdateType::WINDOW_UPDATE_ADDED) ||
|
||||
typeId > static_cast<int32_t>(WindowUpdateType::WINDOW_UPDATE_ALL)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "read WindowUpdateType failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WindowUpdateType type = static_cast<WindowUpdateType>(typeId);
|
||||
NotifyAccessibilityWindowInfo(infos, type);
|
||||
break;
|
||||
}
|
||||
@ -152,7 +166,14 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
break;
|
||||
}
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_STYLE_TYPE: {
|
||||
WindowStyleType type = static_cast<WindowStyleType>(data.ReadUint8());
|
||||
uint8_t typeId = 0;
|
||||
if (!data.ReadUint8(typeId) ||
|
||||
typeId < static_cast<uint8_t>(WindowStyleType::WINDOW_STYLE_DEFAULT) ||
|
||||
typeId > static_cast<uint8_t>(WindowStyleType::WINDOW_STYLE_FREE_MULTI_WINDOW)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "read WindowStyleType failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WindowStyleType type = static_cast<WindowStyleType>(typeId);
|
||||
NotifyWindowStyleChange(type);
|
||||
break;
|
||||
}
|
||||
|
@ -119,8 +119,7 @@ int WindowStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParce
|
||||
}
|
||||
uint32_t type = 0;
|
||||
if (!data.ReadUint32(type) ||
|
||||
type < static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM) ||
|
||||
type > static_cast<uint32_t>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR)) {
|
||||
type >= static_cast<uint32_t>(AvoidAreaType::TYPE_END)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
UpdateAvoidArea(avoidArea, static_cast<AvoidAreaType>(type));
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
virtual MaximizeMode GetMaximizeMode() = 0;
|
||||
virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0;
|
||||
virtual WMError CheckWindowId(int32_t windowId, int32_t& pid) { return WMError::WM_OK; }
|
||||
virtual WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) { return WSError::WS_OK; }
|
||||
virtual WSError UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener) { return WSError::WS_OK; }
|
||||
virtual WSError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener)
|
||||
{
|
||||
return WSError::WS_OK;
|
||||
|
@ -176,9 +176,9 @@ void AvoidAreaController::UpdateOverlayWindowIfNeed(const sptr<WindowNode>& node
|
||||
WLOGD("window: %{public}u is not in avoidAreaListenerNodes, don't update avoid area.", node->GetWindowId());
|
||||
return;
|
||||
}
|
||||
uint32_t start = static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM);
|
||||
uint32_t end = static_cast<uint32_t>(AvoidAreaType::TYPE_KEYBOARD);
|
||||
for (uint32_t type = start; type <= end; type++) {
|
||||
using T = std::underlying_type_t<AvoidAreaType>;
|
||||
for (T type = static_cast<T>(AvoidAreaType::TYPE_START);
|
||||
type < static_cast<T>(AvoidAreaType::TYPE_END); type++) {
|
||||
AvoidArea systemAvoidArea = GetAvoidAreaByType(node, static_cast<AvoidAreaType>(type));
|
||||
bool res = UpdateAvoidAreaIfNeed(systemAvoidArea, node, static_cast<AvoidAreaType>(type));
|
||||
if (res && type == static_cast<uint32_t>(AvoidAreaType::TYPE_KEYBOARD)) {
|
||||
|
@ -103,8 +103,7 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel& data, M
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
uint32_t avoidAreaTypeId = 0;
|
||||
if (!data.ReadUint32(avoidAreaTypeId) ||
|
||||
avoidAreaTypeId < static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM) ||
|
||||
avoidAreaTypeId > static_cast<uint32_t>(AvoidAreaType::TYPE_NAVIGATION_INDICATOR)) {
|
||||
avoidAreaTypeId >= static_cast<uint32_t>(AvoidAreaType::TYPE_END)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
auto avoidAreaType = static_cast<AvoidAreaType>(avoidAreaTypeId);
|
||||
|
Loading…
Reference in New Issue
Block a user