mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 06:50:40 +00:00
解冲突
Signed-off-by: kuangmei <kuangmei1@huawei.com>
This commit is contained in:
commit
c360cc7305
@ -73,7 +73,8 @@
|
||||
"libjpeg-turbo",
|
||||
"libxml2",
|
||||
"bounds_checking_function",
|
||||
"device_status"
|
||||
"device_status",
|
||||
"ets_frontend"
|
||||
],
|
||||
"third_party": [
|
||||
]
|
||||
|
@ -133,6 +133,7 @@ ohos_shared_library("libdm") {
|
||||
external_deps = [
|
||||
"ability_runtime:ability_manager",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image_native",
|
||||
@ -193,6 +194,7 @@ ohos_shared_library("libdm_ndk") {
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"image_framework:pixelmap",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
|
||||
part_name = "window_manager"
|
||||
|
@ -585,21 +585,11 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeLi
|
||||
NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
}
|
||||
|
||||
static void NativeDisplayManager_FreeMemory(void *memPtr)
|
||||
{
|
||||
if (memPtr == nullptr) {
|
||||
TLOGW(WmsLogTag::DMS, "[DMNDK] param is null. no need to free.");
|
||||
return;
|
||||
}
|
||||
free(memPtr);
|
||||
memPtr = nullptr;
|
||||
}
|
||||
|
||||
static void NativeDisplayManager_SetColorSpace(NativeDisplayManager_DisplayInfo *displayInfo, sptr<DisplayInfo> info)
|
||||
{
|
||||
std::vector<uint32_t> colorSpaces = info->GetColorSpaces();
|
||||
if (colorSpaces.empty()) {
|
||||
TLOGW(WmsLogTag::DMS, "[DMNDK] colorSpaces is empty displayId=%{public}d", displayInfo->id);
|
||||
TLOGW(WmsLogTag::DMS, "[DMNDK] colorSpaces is empty displayId=%{public}u", displayInfo->id);
|
||||
return;
|
||||
}
|
||||
displayInfo->colorSpace = (NativeDisplayManager_DisplayColorSpace*)malloc(
|
||||
@ -612,22 +602,22 @@ static void NativeDisplayManager_SetColorSpace(NativeDisplayManager_DisplayInfo
|
||||
sizeof(NativeDisplayManager_DisplayColorSpace));
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset color space failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace);
|
||||
return;
|
||||
}
|
||||
displayInfo->colorSpace->colorSpaceLength = static_cast<uint32_t>(colorSpaces.size());
|
||||
displayInfo->colorSpace->colorSpaces = (uint32_t*)malloc(sizeof(uint32_t) * colorSpaces.size());
|
||||
if (displayInfo->colorSpace->colorSpaces == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] malloc color spaces failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace);
|
||||
return;
|
||||
}
|
||||
retMemset = memset_s(displayInfo->colorSpace->colorSpaces, sizeof(uint32_t) * colorSpaces.size(), 0,
|
||||
sizeof(uint32_t) * colorSpaces.size());
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset color spaces failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace->colorSpaces));
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace->colorSpaces);
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -643,14 +633,14 @@ static void NativeDisplayManager_SetColorSpace(NativeDisplayManager_DisplayInfo
|
||||
static_cast<uint32_t>(DM_NATIVE_TO_NDK_COLOR_SPACE_TYPE_MAP.at(colorSpaceValue));
|
||||
colorLoop++;
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] color spaces count:%{public}d.", colorLoop);
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] color spaces count:%{public}u.", colorLoop);
|
||||
}
|
||||
|
||||
static void NativeDisplayManager_SetHdrFormat(NativeDisplayManager_DisplayInfo *displayInfo, sptr<DisplayInfo> info)
|
||||
{
|
||||
std::vector<uint32_t> hdrFormats = info->GetHdrFormats();
|
||||
if (hdrFormats.empty()) {
|
||||
TLOGW(WmsLogTag::DMS, "[DMNDK] hdrFormats is empty displayId=%{public}d", displayInfo->id);
|
||||
TLOGW(WmsLogTag::DMS, "[DMNDK] hdrFormats is empty displayId=%{public}u", displayInfo->id);
|
||||
return;
|
||||
}
|
||||
displayInfo->hdrFormat = (NativeDisplayManager_DisplayHdrFormat*)malloc(
|
||||
@ -663,22 +653,22 @@ static void NativeDisplayManager_SetHdrFormat(NativeDisplayManager_DisplayInfo *
|
||||
sizeof(NativeDisplayManager_DisplayHdrFormat));
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset hdr format failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat);
|
||||
return;
|
||||
}
|
||||
displayInfo->hdrFormat->hdrFormatLength = static_cast<uint32_t>(hdrFormats.size());
|
||||
displayInfo->hdrFormat->hdrFormats = (uint32_t*)malloc(sizeof(uint32_t) * hdrFormats.size());
|
||||
if (displayInfo->hdrFormat->hdrFormats == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] malloc hdr format failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat);
|
||||
return;
|
||||
}
|
||||
retMemset = memset_s(displayInfo->hdrFormat->hdrFormats, sizeof(uint32_t) * hdrFormats.size(), 0,
|
||||
sizeof(uint32_t) * hdrFormats.size());
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset hdr format failed");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat->hdrFormats));
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat->hdrFormats);
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -693,7 +683,7 @@ static void NativeDisplayManager_SetHdrFormat(NativeDisplayManager_DisplayInfo *
|
||||
static_cast<uint32_t>(DM_NATIVE_TO_NDK_HDR_FORMAT_TYPE_MAP.at(hdrFormatValue));
|
||||
hdrLoop++;
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] hdr format count:%{public}d", hdrLoop);
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] hdr format count:%{public}u", hdrLoop);
|
||||
}
|
||||
|
||||
static void NativeDisplayManager_SetDisplayInfo(NativeDisplayManager_DisplayInfo *displayInfo,
|
||||
@ -723,7 +713,7 @@ static void NativeDisplayManager_SetDisplayInfo(NativeDisplayManager_DisplayInfo
|
||||
NativeDisplayManager_SetColorSpace(displayInfo, info);
|
||||
/* hdr format */
|
||||
NativeDisplayManager_SetHdrFormat(displayInfo, info);
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] set display id[%{public}d] finish.", displayInfo->id);
|
||||
TLOGI(WmsLogTag::DMS, "[DMNDK] set display id[%{public}u] finish.", displayInfo->id);
|
||||
}
|
||||
|
||||
static NativeDisplayManager_ErrorCode NativeDisplayManager_SetDisplaysInfo(const std::vector<sptr<Display>>& displays,
|
||||
@ -738,7 +728,7 @@ static NativeDisplayManager_ErrorCode NativeDisplayManager_SetDisplaysInfo(const
|
||||
auto info = display->GetDisplayInfo();
|
||||
if (info == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] get display id[%{public}" PRIu64"] info null.", display->GetId());
|
||||
return NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
continue;
|
||||
}
|
||||
int ret = memcpy_s(displaysInfo[i].name, OH_DISPLAY_NAME_LENGTH, info->GetName().c_str(),
|
||||
OH_DISPLAY_NAME_LENGTH);
|
||||
@ -763,18 +753,18 @@ static void NativeDisplayManager_DestroyDisplaysInfoInner(uint32_t displaysLengt
|
||||
NativeDisplayManager_DisplayInfo displayItem = displaysInfo[i];
|
||||
if (displayItem.colorSpace != nullptr) {
|
||||
if (displayItem.colorSpace->colorSpaces != nullptr) {
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayItem.colorSpace->colorSpaces));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayItem.colorSpace->colorSpaces);
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayItem.colorSpace));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayItem.colorSpace);
|
||||
}
|
||||
if (displayItem.hdrFormat != nullptr) {
|
||||
if (displayItem.hdrFormat->hdrFormats != nullptr) {
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayItem.hdrFormat->hdrFormats));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayItem.hdrFormat->hdrFormats);
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayItem.hdrFormat));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayItem.hdrFormat);
|
||||
}
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displaysInfo));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displaysInfo);
|
||||
}
|
||||
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(
|
||||
@ -800,7 +790,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(
|
||||
sizeof(NativeDisplayManager_DisplaysInfo));
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset displays failed.");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displaysInner));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displaysInner);
|
||||
return NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
}
|
||||
size_t displaySize = displays.size();
|
||||
@ -809,7 +799,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(
|
||||
(NativeDisplayManager_DisplayInfo*)malloc(sizeof(NativeDisplayManager_DisplayInfo) * displaySize);
|
||||
if (displaysInfo == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] malloc displaysInfo failed.");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displaysInner));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displaysInner);
|
||||
return NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
}
|
||||
retMemset = memset_s(displaysInfo, sizeof(NativeDisplayManager_DisplayInfo) * displaySize, 0,
|
||||
@ -820,8 +810,8 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(
|
||||
}
|
||||
if (retMemset != EOK || setRet != NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset or set displaysInfo failed setRet=%{public}d.", setRet);
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displaysInner));
|
||||
NativeDisplayManager_DestroyDisplaysInfoInner(displaysInner->displaysLength, displaysInfo);
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displaysInner);
|
||||
return NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
}
|
||||
displaysInner->displaysInfo = displaysInfo;
|
||||
@ -836,11 +826,11 @@ void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInf
|
||||
return;
|
||||
}
|
||||
if (allDisplays->displaysInfo == nullptr) {
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(allDisplays));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(allDisplays);
|
||||
return;
|
||||
}
|
||||
NativeDisplayManager_DestroyDisplaysInfoInner(allDisplays->displaysLength, allDisplays->displaysInfo);
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(allDisplays));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(allDisplays);
|
||||
}
|
||||
|
||||
static NativeDisplayManager_DisplayInfo* NativeDisplayManager_FillDisplayInfo(sptr<Display> display,
|
||||
@ -863,14 +853,14 @@ static NativeDisplayManager_DisplayInfo* NativeDisplayManager_FillDisplayInfo(sp
|
||||
sizeof(NativeDisplayManager_DisplayInfo));
|
||||
if (retMemset != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memset display info null.");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInner));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInner);
|
||||
*errCode = NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
return nullptr;
|
||||
}
|
||||
int ret = memcpy_s(displayInner->name, OH_DISPLAY_NAME_LENGTH, info->GetName().c_str(), OH_DISPLAY_NAME_LENGTH);
|
||||
if (ret != EOK) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] memcpy display name failed.");
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInner));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInner);
|
||||
*errCode = NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL;
|
||||
return nullptr;
|
||||
}
|
||||
@ -879,7 +869,7 @@ static NativeDisplayManager_DisplayInfo* NativeDisplayManager_FillDisplayInfo(sp
|
||||
return displayInner;
|
||||
}
|
||||
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayInfoById(uint32_t id,
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById(uint32_t id,
|
||||
NativeDisplayManager_DisplayInfo **displayInfo)
|
||||
{
|
||||
if (displayInfo == nullptr) {
|
||||
@ -915,7 +905,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreatePrimaryDisplay(
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
void OH_NativeDisplayManager_DestroyDisplayInfo(NativeDisplayManager_DisplayInfo *displayInfo)
|
||||
void OH_NativeDisplayManager_DestroyDisplay(NativeDisplayManager_DisplayInfo *displayInfo)
|
||||
{
|
||||
if (displayInfo == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "[DMNDK] free display info is null.");
|
||||
@ -923,20 +913,20 @@ void OH_NativeDisplayManager_DestroyDisplayInfo(NativeDisplayManager_DisplayInfo
|
||||
}
|
||||
if (displayInfo->colorSpace != nullptr) {
|
||||
if (displayInfo->colorSpace->colorSpaces != nullptr) {
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace->colorSpaces));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace->colorSpaces);
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->colorSpace));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->colorSpace);
|
||||
}
|
||||
if (displayInfo->hdrFormat != nullptr) {
|
||||
if (displayInfo->hdrFormat->hdrFormats != nullptr) {
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat->hdrFormats));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat->hdrFormats);
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo->hdrFormat));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo->hdrFormat);
|
||||
}
|
||||
NativeDisplayManager_FreeMemory(static_cast<void *>(displayInfo));
|
||||
DISPLAY_MANAGER_FREE_MEMORY(displayInfo);
|
||||
}
|
||||
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateScreenCapture(uint32_t displayId,
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CaptureScreenPixelmap(uint32_t displayId,
|
||||
OH_PixelmapNative **pixelMap)
|
||||
{
|
||||
if (pixelMap == nullptr) {
|
||||
|
@ -224,6 +224,15 @@ const std::map<DM_ScreenHDRFormat, DM_HDRFormat> DM_NATIVE_TO_NDK_HDR_FORMAT_TYP
|
||||
{ DM_ScreenHDRFormat::IMAGE_HDR_ISO_DUAL, DM_HDRFormat::IMAGE_HDR_ISO_DUAL },
|
||||
{ DM_ScreenHDRFormat::IMAGE_HDR_ISO_SINGLE, DM_HDRFormat::IMAGE_HDR_ISO_SINGLE },
|
||||
};
|
||||
|
||||
#define DISPLAY_MANAGER_FREE_MEMORY(ptr) \
|
||||
do { \
|
||||
if ((ptr)) { \
|
||||
free((ptr)); \
|
||||
(ptr) = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_OH_NATIVE_DISPLAY_MANAGER_INNER_H
|
||||
|
@ -70,6 +70,7 @@ ohos_shared_library("libdms") {
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"graphic_surface:surface",
|
||||
"hilog:libhilog",
|
||||
@ -77,6 +78,7 @@ ohos_shared_library("libdms") {
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
@ -598,6 +598,10 @@ sptr<AbstractScreenGroup> AbstractScreenController::AddAsSuccedentScreenLocked(s
|
||||
if (screenGroup->combination_ == ScreenCombination::SCREEN_EXPAND) {
|
||||
for (auto& child : screenGroup->GetChildren()) {
|
||||
WLOGD("AddAsSuccedentScreenLocked. defaultScreen rotation:%d", child->rotation_);
|
||||
if (child->GetActiveScreenMode() == nullptr) {
|
||||
WLOGE("active screen mode is nullptr");
|
||||
continue;
|
||||
}
|
||||
if (child->rotation_ == Rotation::ROTATION_90 || child->rotation_ == Rotation::ROTATION_270) {
|
||||
point.posX_ += static_cast<int32_t>(child->GetActiveScreenMode()->height_);
|
||||
} else {
|
||||
|
@ -62,6 +62,7 @@ ohos_shared_library("libwindow_extension_client") {
|
||||
"ability_runtime:ability_connect_callback_stub",
|
||||
"ability_runtime:ability_manager",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
|
@ -71,13 +71,16 @@ ohos_shared_library("libwindow_extension") {
|
||||
"ability_runtime:extensionkit_native",
|
||||
"ability_runtime:napi_common",
|
||||
"ability_runtime:runtime",
|
||||
"ability_runtime:wantagent_innerkits",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_napi",
|
||||
"ipc:ipc_single",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
@ -364,8 +364,6 @@ enum class SuperFoldStatusChangeEvents : uint32_t {
|
||||
ANGLE_CHANGE_FOLDED,
|
||||
KEYBOARD_ON,
|
||||
KEYBOARD_OFF,
|
||||
SOFT_KEYBOARD_ON,
|
||||
SOFT_KEYBOARD_OFF,
|
||||
INVALID,
|
||||
};
|
||||
|
||||
@ -378,7 +376,6 @@ enum class SuperFoldStatus : uint32_t {
|
||||
HALF_FOLDED,
|
||||
EXPANDED,
|
||||
KEYBOARD,
|
||||
SOFT_KEYBOARD,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -882,6 +882,12 @@ public:
|
||||
* @return WMError
|
||||
*/
|
||||
virtual WMError NotifyDrawingCompleted() { return WMError::WM_OK; }
|
||||
/**
|
||||
* @brief notify window remove starting window.
|
||||
*
|
||||
* @return WMError
|
||||
*/
|
||||
virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
/**
|
||||
* @brief move the window to (x, y)
|
||||
*
|
||||
@ -1962,6 +1968,14 @@ public:
|
||||
*/
|
||||
virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
|
||||
/**
|
||||
* @brief Enable or disable move window by title bar.
|
||||
*
|
||||
* @param enable The value true means to enable window moving, and false means the opposite.
|
||||
* @return Errorcode of window.
|
||||
*/
|
||||
virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
|
||||
/**
|
||||
* @brief Set window container color.
|
||||
*
|
||||
@ -2067,7 +2081,7 @@ public:
|
||||
*
|
||||
* @return Value of PixelRatio obtained from displayInfo.
|
||||
*/
|
||||
virtual float GetVirtualPixelRatio() { return 0.0f; }
|
||||
virtual float GetVirtualPixelRatio() { return 1.0f; }
|
||||
|
||||
/**
|
||||
* @brief Hide None Secure Windows.
|
||||
@ -2404,7 +2418,7 @@ public:
|
||||
virtual void NotifyExtensionEventAsync(uint32_t notifyEvent) {}
|
||||
|
||||
/**
|
||||
* @brief Get isUIExtFirstSubWindow flag
|
||||
* @brief Get whether this window is the first level sub window of UIExtension.
|
||||
*
|
||||
* @return true - is the first sub window of UIExtension, false - is not the first sub window of UIExtension
|
||||
*/
|
||||
|
@ -231,7 +231,7 @@ public:
|
||||
void SetOnlySupportSceneBoard(bool onlySupportSceneBoard);
|
||||
|
||||
/**
|
||||
* @brief Set whether this window is the first sub window of UIExtension.
|
||||
* @brief Set whether this window is the first level sub window of UIExtension.
|
||||
*
|
||||
* @param isUIExtFirstSubWindow whether is the first sub window of UIExtension.
|
||||
*/
|
||||
@ -427,7 +427,7 @@ public:
|
||||
bool GetOnlySupportSceneBoard() const;
|
||||
|
||||
/**
|
||||
* @brief Get isUIExtFirstSubWindow flag
|
||||
* @brief Get whether this window is the first level sub window of UIExtension.
|
||||
*
|
||||
* @return true - is the first sub window of UIExtension, false - is not the first sub window of UIExtension
|
||||
*/
|
||||
|
@ -50,6 +50,7 @@ ohos_shared_library("cj_display_ffi") {
|
||||
"ability_runtime:runtime",
|
||||
"bounds_checking_function:libsec_shared",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:2d_graphics_new",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"napi:ace_napi",
|
||||
|
@ -52,12 +52,14 @@ ohos_shared_library("cj_window_ffi") {
|
||||
"ability_runtime:dialog_request_info",
|
||||
"ability_runtime:extensionkit_native",
|
||||
"ability_runtime:runtime",
|
||||
"ability_runtime:wantagent_innerkits",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
|
@ -47,7 +47,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Creates a screen capture of the specified display.
|
||||
* @brief Capture a screen pixelmap of the specified display.
|
||||
*
|
||||
* @param displayId The ID of the display to be captured.
|
||||
* @param pixelMap The output pixel map of the captured display.
|
||||
@ -59,7 +59,7 @@ extern "C" {
|
||||
* @syscap SystemCapability.Window.SessionManager.Core
|
||||
* @since 14
|
||||
*/
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateScreenCapture(uint32_t displayId,
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CaptureScreenPixelmap(uint32_t displayId,
|
||||
OH_PixelmapNative **pixelMap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -325,7 +325,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(
|
||||
NativeDisplayManager_DisplaysInfo **allDisplays);
|
||||
|
||||
/**
|
||||
* @brief Destroys all displays.
|
||||
* @brief Destroy all displays.
|
||||
*
|
||||
* @param allDisplays all displays to be free.
|
||||
* @syscap SystemCapability.Window.SessionManager.Core
|
||||
@ -335,6 +335,7 @@ void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInf
|
||||
|
||||
/**
|
||||
* @brief Create display information by display id.
|
||||
*
|
||||
* @param displayId The display id.
|
||||
* @param displayInfo The pointer to the display information.
|
||||
* @return { @link DISPLAY_MANAGER_OK } If the operation is successful.
|
||||
@ -343,7 +344,7 @@ void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInf
|
||||
* @syscap SystemCapability.Window.SessionManager.Core
|
||||
* @since 14
|
||||
*/
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayInfoById(uint32_t displayId,
|
||||
NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById(uint32_t displayId,
|
||||
NativeDisplayManager_DisplayInfo **displayInfo);
|
||||
|
||||
/**
|
||||
@ -353,10 +354,10 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayInfoById(uin
|
||||
* @syscap SystemCapability.Window.SessionManager.Core
|
||||
* @since 14
|
||||
*/
|
||||
void OH_NativeDisplayManager_DestroyDisplayInfo(NativeDisplayManager_DisplayInfo *displayInfo);
|
||||
void OH_NativeDisplayManager_DestroyDisplay(NativeDisplayManager_DisplayInfo *displayInfo);
|
||||
|
||||
/**
|
||||
* @brief Creates a primary display.
|
||||
* @brief Create a primary display.
|
||||
*
|
||||
* @param displayInfo The information of the created display.
|
||||
* @return { @link DISPLAY_MANAGER_OK } If the operation is successful.
|
||||
|
@ -85,11 +85,11 @@
|
||||
},
|
||||
{
|
||||
"first_instroduced":"14",
|
||||
"name":"OH_NativeDisplayManager_CreateDisplayInfoById"
|
||||
"name":"OH_NativeDisplayManager_CreateDisplayById"
|
||||
},
|
||||
{
|
||||
"first_instroduced":"14",
|
||||
"name":"OH_NativeDisplayManager_DestroyDisplayInfo"
|
||||
"name":"OH_NativeDisplayManager_DestroyDisplay"
|
||||
},
|
||||
{
|
||||
"first_instroduced":"14",
|
||||
@ -101,6 +101,6 @@
|
||||
},
|
||||
{
|
||||
"first_instroduced":"14",
|
||||
"name":"OH_NativeDisplayManager_CreateScreenCapture"
|
||||
"name":"OH_NativeDisplayManager_CaptureScreenPixelmap"
|
||||
}
|
||||
]
|
@ -100,8 +100,10 @@ ohos_shared_library("extensionwindow_napi") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:runtime",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
|
@ -49,6 +49,7 @@ ohos_shared_library("screen_napi") {
|
||||
external_deps = [
|
||||
"ability_runtime:runtime",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_surface:surface", # use for SurfaceUtils
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
|
@ -169,7 +169,7 @@ static void IsNeedNotify(napi_env env, std::unique_ptr<Param> ¶m, napi_value
|
||||
{
|
||||
GNAPI_LOG("Get Screenshot Option: IsNeedNotify");
|
||||
napi_value isNeedNotify;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_named_property(env, argv, "isNeedNotify", &isNeedNotify));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_named_property(env, argv, "isNotificationNeeded", &isNeedNotify));
|
||||
if (isNeedNotify != nullptr && GetType(env, isNeedNotify) == napi_boolean) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_value_bool(env, isNeedNotify, ¶m->option.isNeedNotify));
|
||||
GNAPI_LOG("IsNeedNotify: %{public}d", param->option.isNeedNotify);
|
||||
@ -182,7 +182,7 @@ static void IsNeedPointer(napi_env env, std::unique_ptr<Param> ¶m, napi_valu
|
||||
{
|
||||
GNAPI_LOG("Get Screenshot Option: IsNeedPointer");
|
||||
napi_value isNeedPointer;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_named_property(env, argv, "isNeedPointer", &isNeedPointer));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_named_property(env, argv, "isPointerNeeded", &isNeedPointer));
|
||||
if (isNeedPointer != nullptr && GetType(env, isNeedPointer) == napi_boolean) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_value_bool(env, isNeedPointer, ¶m->option.isNeedPointer));
|
||||
GNAPI_LOG("IsNeedPointer: %{public}d", param->option.isNeedPointer);
|
||||
|
@ -114,6 +114,7 @@ ohos_shared_library("window_napi") {
|
||||
cfi_vcall_icall_only = true
|
||||
debug = false
|
||||
}
|
||||
defines = [ "SUPPORT_SCREEN" ]
|
||||
sources = [
|
||||
"window_manager_napi/js_window_manager.cpp",
|
||||
"window_manager_napi/window_manager_module.cpp",
|
||||
@ -137,8 +138,10 @@ ohos_shared_library("window_napi") {
|
||||
"ability_runtime:ability_context_native",
|
||||
"ability_runtime:abilitykit_native",
|
||||
"ability_runtime:runtime",
|
||||
"ability_runtime:wantagent_innerkits",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
@ -177,6 +180,7 @@ ohos_shared_library("windowstage_kit") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:runtime",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "js_window_manager.h"
|
||||
#include "native_engine/native_engine.h"
|
||||
|
||||
static napi_module g_winManagerModule = {
|
||||
.nm_filename = "module/libwindow_napi.so/window.js",
|
||||
|
@ -851,6 +851,13 @@ napi_value JsWindow::SetWindowDecorVisible(napi_env env, napi_callback_info info
|
||||
return (me != nullptr) ? me->OnSetWindowDecorVisible(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindow::SetWindowTitleMoveEnabled(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "[NAPI]");
|
||||
JsWindow* me = CheckParamsAndGetThis<JsWindow>(env, info);
|
||||
return (me != nullptr) ? me->OnSetWindowTitleMoveEnabled(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindow::SetSubWindowModal(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_SUB, "[NAPI]");
|
||||
@ -2688,7 +2695,14 @@ napi_value JsWindow::OnSetWindowLayoutFullScreen(napi_env env, napi_callback_inf
|
||||
if (errCode != WmErrorCode::WM_OK) {
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
|
||||
if (windowToken_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "windowToken_ is nullptr");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY);
|
||||
}
|
||||
if (windowToken_->IsPcOrPadFreeMultiWindowMode()) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "device not support");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[weakToken, isLayoutFullScreen](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
@ -6265,6 +6279,34 @@ napi_value JsWindow::OnSetWindowDecorVisible(napi_env env, napi_callback_info in
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
napi_value JsWindow::OnSetWindowTitleMoveEnabled(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = FOUR_PARAMS_SIZE;
|
||||
napi_value argv[FOUR_PARAMS_SIZE] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc != 1) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
bool enable = true;
|
||||
if (!ConvertFromJsValue(env, argv[INDEX_ZERO], enable)) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "Failed to convert parameter to enable");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
if (windowToken_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "windowToken is nullptr");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY);
|
||||
}
|
||||
WmErrorCode ret = WM_JS_TO_ERROR_CODE_MAP.at(windowToken_->SetWindowTitleMoveEnabled(enable));
|
||||
if (ret != WmErrorCode::WM_OK) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "Window set title move enable failed");
|
||||
return NapiThrowError(env, ret);
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "Window [%{public}u, %{public}s] end",
|
||||
windowToken_->GetWindowId(), windowToken_->GetWindowName().c_str());
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
napi_value JsWindow::OnSetSubWindowModal(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 4;
|
||||
@ -6701,6 +6743,10 @@ napi_value JsWindow::OnSetImmersiveModeEnabledState(napi_env env, napi_callback_
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "[NAPI]OnSetImmersiveModeEnabledState is not allowed since invalid window type");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING);
|
||||
}
|
||||
if (windowToken_->IsPcOrPadFreeMultiWindowMode()) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "device not support");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
napi_value nativeVal = argv[0];
|
||||
if (nativeVal == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "Failed to convert parameter to enable");
|
||||
@ -7161,6 +7207,7 @@ void BindFunctions(napi_env env, napi_value object, const char* moduleName)
|
||||
BindNativeFunction(env, object, "enableLandscapeMultiWindow", moduleName, JsWindow::EnableLandscapeMultiWindow);
|
||||
BindNativeFunction(env, object, "disableLandscapeMultiWindow", moduleName, JsWindow::DisableLandscapeMultiWindow);
|
||||
BindNativeFunction(env, object, "setWindowDecorVisible", moduleName, JsWindow::SetWindowDecorVisible);
|
||||
BindNativeFunction(env, object, "setWindowTitleMoveEnabled", moduleName, JsWindow::SetWindowTitleMoveEnabled);
|
||||
BindNativeFunction(env, object, "setSubWindowModal", moduleName, JsWindow::SetSubWindowModal);
|
||||
BindNativeFunction(env, object, "enableDrag", moduleName, JsWindow::EnableDrag);
|
||||
BindNativeFunction(env, object, "setWindowDecorHeight", moduleName, JsWindow::SetWindowDecorHeight);
|
||||
|
@ -160,6 +160,7 @@ public:
|
||||
static napi_value SetWaterMarkFlag(napi_env env, napi_callback_info info);
|
||||
static napi_value SetHandwritingFlag(napi_env env, napi_callback_info info);
|
||||
static napi_value SetWindowDecorVisible(napi_env env, napi_callback_info info);
|
||||
static napi_value SetWindowTitleMoveEnabled(napi_env env, napi_callback_info info);
|
||||
static napi_value SetSubWindowModal(napi_env env, napi_callback_info info);
|
||||
static napi_value SetWindowDecorHeight(napi_env env, napi_callback_info info);
|
||||
static napi_value GetWindowDecorHeight(napi_env env, napi_callback_info info);
|
||||
@ -247,6 +248,7 @@ private:
|
||||
napi_value OnGetWindowLimits(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetSpecificSystemBarEnabled(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetWindowDecorVisible(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetWindowTitleMoveEnabled(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetSubWindowModal(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetWindowDecorHeight(napi_env env, napi_callback_info info);
|
||||
napi_value OnGetWindowDecorHeight(napi_env env, napi_callback_info info);
|
||||
|
@ -33,6 +33,13 @@ JsWindowListener::~JsWindowListener()
|
||||
WLOGI("[NAPI]~JsWindowListener");
|
||||
}
|
||||
|
||||
void JsWindowListener::OnLastStrongRef(const void *)
|
||||
{
|
||||
if (napi_status::napi_ok != napi_send_event(env_, [jsCallBack = std::move(jsCallBack_)] {}, napi_eprio_immediate)) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "Failed to send event");
|
||||
}
|
||||
}
|
||||
|
||||
void JsWindowListener::SetMainEventHandler()
|
||||
{
|
||||
auto mainRunner = AppExecFwk::EventRunner::GetMainEventRunner();
|
||||
@ -120,7 +127,6 @@ void JsWindowListener::OnSystemBarPropertyChange(DisplayId displayId, const Syst
|
||||
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
|
||||
[self = weakRef_, displayId, tints, eng = env_] (napi_env env,
|
||||
NapiAsyncTask& task, int32_t status) {
|
||||
|
||||
auto thisListener = self.promote();
|
||||
if (thisListener == nullptr || eng == nullptr) {
|
||||
WLOGFE("[NAPI]this listener or eng is nullptr");
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
void OnMainWindowClose(bool& terminateCloseProcess) override;
|
||||
|
||||
private:
|
||||
void OnLastStrongRef(const void *) override;
|
||||
|
||||
Rect currRect_ = {0, 0, 0, 0};
|
||||
WindowState state_ {WindowState::STATE_INITIAL};
|
||||
void LifeCycleCallBack(LifeCycleEventType eventType);
|
||||
@ -115,7 +117,7 @@ private:
|
||||
napi_env env_ = nullptr;
|
||||
std::shared_ptr<NativeReference> jsCallBack_;
|
||||
CaseType caseType_ = CaseType::CASE_WINDOW;
|
||||
wptr<JsWindowListener> weakRef_ = nullptr;
|
||||
wptr<JsWindowListener> weakRef_ = nullptr;
|
||||
std::shared_ptr<AppExecFwk::EventHandler> eventHandler_ = nullptr;
|
||||
DEFINE_VAR_DEFAULT_FUNC_SET(bool, IsDeprecatedInterface, isDeprecatedInterface, false)
|
||||
RectChangeReason currentReason_ = RectChangeReason::UNDEFINED;
|
||||
|
@ -15,11 +15,7 @@
|
||||
|
||||
#include "js_err_utils.h"
|
||||
#include "js_window_stage.h"
|
||||
#include <string>
|
||||
#include "js_runtime_utils.h"
|
||||
#include "js_window.h"
|
||||
#include "js_window_register_manager.h"
|
||||
#include "js_window_utils.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "permission.h"
|
||||
|
||||
@ -28,6 +24,8 @@ namespace Rosen {
|
||||
using namespace AbilityRuntime;
|
||||
namespace {
|
||||
const int CONTENT_STORAGE_ARG = 2;
|
||||
constexpr size_t INDEX_ZERO = 0;
|
||||
constexpr size_t FOUR_PARAMS_SIZE = 4;
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "JsWindowStage"};
|
||||
} // namespace
|
||||
|
||||
@ -146,6 +144,13 @@ napi_value JsWindowStage::SetDefaultDensityEnabled(napi_env env, napi_callback_i
|
||||
return (me != nullptr) ? me->OnSetDefaultDensityEnabled(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindowStage::RemoveStartingWindow(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_MAIN, "[NAPI]");
|
||||
JsWindowStage* me = CheckParamsAndGetThis<JsWindowStage>(env, info);
|
||||
return (me != nullptr) ? me->OnRemoveStartingWindow(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindowStage::OnSetUIContent(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 4;
|
||||
@ -691,6 +696,44 @@ napi_value JsWindowStage::OnCreateSubWindowWithOptions(napi_env env, napi_callba
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value JsWindowStage::OnRemoveStartingWindow(napi_env env, napi_callback_info info)
|
||||
{
|
||||
auto windowScene = windowScene_.lock();
|
||||
if (windowScene == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_MAIN, "windowScene is null");
|
||||
napi_throw(env, JsErrUtils::CreateJsError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY));
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
const char* const where = __func__;
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[where, windowScene](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto window = windowScene->GetMainWindow();
|
||||
if (window == nullptr) {
|
||||
TLOGNE(WmsLogTag::WMS_MAIN, "%{public}s [NAPI]Get main window failed", where);
|
||||
task.Reject(env,
|
||||
JsErrUtils::CreateJsError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY, "Get main window failed"));
|
||||
return;
|
||||
}
|
||||
WmErrorCode ret = WM_JS_TO_ERROR_CODE_MAP.at(window->NotifyRemoveStartingWindow());
|
||||
if (ret == WmErrorCode::WM_OK) {
|
||||
task.Resolve(env, NapiGetUndefined(env));
|
||||
} else {
|
||||
task.Reject(env, JsErrUtils::CreateJsError(env, ret, "Notify remove starting window failed"));
|
||||
}
|
||||
};
|
||||
|
||||
size_t argc = FOUR_PARAMS_SIZE;
|
||||
napi_value argv[FOUR_PARAMS_SIZE] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
napi_value lastParam = (argc == 0) ? nullptr :
|
||||
(argv[INDEX_ZERO] != nullptr && GetType(env, argv[INDEX_ZERO]) == napi_function ? argv[INDEX_ZERO] : nullptr);
|
||||
napi_value result = nullptr;
|
||||
NapiAsyncTask::Schedule("JsWindow::OnRemoveStartingWindow",
|
||||
env, CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value CreateJsWindowStage(napi_env env, std::shared_ptr<Rosen::WindowScene> windowScene)
|
||||
{
|
||||
WLOGFD("[NAPI]CreateJsWindowStage");
|
||||
@ -727,7 +770,8 @@ napi_value CreateJsWindowStage(napi_env env, std::shared_ptr<Rosen::WindowScene>
|
||||
objValue, "disableWindowDecor", moduleName, JsWindowStage::DisableWindowDecor);
|
||||
BindNativeFunction(env,
|
||||
objValue, "setDefaultDensityEnabled", moduleName, JsWindowStage::SetDefaultDensityEnabled);
|
||||
|
||||
BindNativeFunction(env,
|
||||
objValue, "removeStartingWindow", moduleName, JsWindowStage::RemoveStartingWindow);
|
||||
return objValue;
|
||||
}
|
||||
} // namespace Rosen
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
static napi_value SetShowOnLockScreen(napi_env env, napi_callback_info info);
|
||||
static napi_value DisableWindowDecor(napi_env env, napi_callback_info info);
|
||||
static napi_value SetDefaultDensityEnabled(napi_env env, napi_callback_info info);
|
||||
static napi_value RemoveStartingWindow(napi_env env, napi_callback_info info);
|
||||
|
||||
private:
|
||||
napi_value OnSetUIContent(napi_env env, napi_callback_info info);
|
||||
@ -64,6 +65,7 @@ private:
|
||||
napi_value OnSetShowOnLockScreen(napi_env env, napi_callback_info info);
|
||||
napi_value OnDisableWindowDecor(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetDefaultDensityEnabled(napi_env env, napi_callback_info info);
|
||||
napi_value OnRemoveStartingWindow(napi_env env, napi_callback_info info);
|
||||
|
||||
std::weak_ptr<WindowScene> windowScene_;
|
||||
};
|
||||
|
@ -73,6 +73,10 @@ class WindowStage {
|
||||
setDefaultDensityEnabled(enabled) {
|
||||
return this.__window_stage__.setDefaultDensityEnabled(enabled);
|
||||
}
|
||||
|
||||
removeStartingWindow() {
|
||||
return this.__window_stage__.removeStartingWindow();
|
||||
}
|
||||
}
|
||||
|
||||
export default WindowStage;
|
||||
|
@ -146,6 +146,10 @@ if (!ispreview) {
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
if (!build_ohos_sdk && !is_mingw) {
|
||||
external_deps += [ "ability_runtime:ability_manager" ]
|
||||
}
|
||||
|
||||
cflags_cc = [ "-DWINDOW_PREVIEW" ]
|
||||
cflags = [ "-std=c++11" ]
|
||||
|
||||
|
@ -296,7 +296,7 @@ public:
|
||||
virtual void SetDensity(float density) = 0;
|
||||
virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual bool GetDefaultDensityEnabled() { return false; }
|
||||
virtual float GetVirtualPixelRatio() { return 0.0f; }
|
||||
virtual float GetVirtualPixelRatio() { return 1.0f; }
|
||||
virtual void UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type);
|
||||
virtual void CreateSurfaceNode(const std::string name, const SendRenderDataCallback& callback) = 0;
|
||||
virtual void SetContentInfoCallback(const ContentInfoCallback& callback) = 0;
|
||||
@ -328,6 +328,7 @@ public:
|
||||
virtual WMError SetSingleFrameComposerEnabled(bool enable) = 0;
|
||||
virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) = 0;
|
||||
virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
|
||||
bool isCloseVisible)
|
||||
{
|
||||
@ -412,6 +413,13 @@ public:
|
||||
* @param height The height after layout
|
||||
*/
|
||||
virtual void FlushLayoutSize(int32_t width, int32_t height) {}
|
||||
|
||||
/**
|
||||
* @brief notify window remove starting window.
|
||||
*
|
||||
* @return WMError
|
||||
*/
|
||||
virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ ohos_executable("setresolution_screen") {
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_surface:surface",
|
||||
"init:libbegetutil",
|
||||
]
|
||||
|
@ -217,17 +217,25 @@ HWTEST_F(WindowMultiAbilityTest, MultiAbilityWindow2, Function | MediumTest | Le
|
||||
HWTEST_F(WindowMultiAbilityTest, MultiAbilityWindow03, Function | MediumTest | Level3)
|
||||
{
|
||||
sptr<WindowScene> scene1 = Utils::CreateWindowScene();
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene1->GoForeground());
|
||||
if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
ASSERT_EQ(WMError::WM_OK, scene1->GoForeground());
|
||||
} else {
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene1->GoForeground());
|
||||
}
|
||||
sptr<WindowScene> scene2 = Utils::CreateWindowScene();
|
||||
sptr<WindowScene> scene3 = Utils::CreateWindowScene();
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene3->GoForeground());
|
||||
if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
ASSERT_EQ(WMError::WM_OK, scene3->GoForeground());
|
||||
} else {
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene3->GoForeground());
|
||||
}
|
||||
DoSceneResource(scene1);
|
||||
sptr<WindowScene> scene4 = Utils::CreateWindowScene();
|
||||
if (!SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene3->GoBackground());
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene2->GoForeground());
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene4->GoForeground());
|
||||
ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene2->GoBackground());
|
||||
ASSERT_EQ(WMError::WM_OK, scene3->GoBackground());
|
||||
ASSERT_EQ(WMError::WM_OK, scene2->GoForeground());
|
||||
ASSERT_EQ(WMError::WM_OK, scene4->GoForeground());
|
||||
ASSERT_EQ(WMError::WM_OK, scene2->GoBackground());
|
||||
} else {
|
||||
ASSERT_NE(WMError::WM_OK, scene3->GoBackground());
|
||||
ASSERT_NE(WMError::WM_OK, scene2->GoForeground());
|
||||
|
@ -199,6 +199,7 @@ ohos_shared_library("libwmutil") {
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:2d_graphics",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"graphic_surface:surface",
|
||||
"hicollie:libhicollie",
|
||||
|
@ -28,6 +28,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class RSFrameRateLinker;
|
||||
class VSyncReceiver;
|
||||
class FrameRateRange;
|
||||
|
||||
using FrameRateLinkerId = uint64_t;
|
||||
using NodeId = uint64_t;
|
||||
@ -64,6 +65,9 @@ private:
|
||||
std::shared_ptr<AppExecFwk::EventHandler> vsyncHandler_ = nullptr;
|
||||
std::string vsyncTimeoutTaskName_;
|
||||
|
||||
std::shared_ptr<FrameRateRange> lastFrameRateRange_ = nullptr;
|
||||
int32_t lastAnimatorExpectedFrameRate_ = 0;
|
||||
|
||||
std::mutex mutex_;
|
||||
bool isFirstVsyncRequest_ = true;
|
||||
bool isFirstVsyncBack_ = true;
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
#ifndef OHOS_ROSEN_WINDOW_TRANSITION_INFO_H
|
||||
#define OHOS_ROSEN_WINDOW_TRANSITION_INFO_H
|
||||
#ifndef SUPPORT_GRAPHICS
|
||||
#define SUPPORT_GRAPHICS
|
||||
#endif
|
||||
#include <iremote_object.h>
|
||||
#include <string>
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "window_manager.h"
|
||||
#include "wm_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
|
@ -222,10 +222,15 @@ FrameRateLinkerId VsyncStation::GetFrameRateLinkerId()
|
||||
void VsyncStation::FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType)
|
||||
{
|
||||
if (auto frameRateLinker = GetFrameRateLinker()) {
|
||||
if (lastFrameRateRange_ == nullptr) {
|
||||
lastFrameRateRange_ = std::make_shared<FrameRateRange>(0, RANGE_MAX_REFRESHRATE, rate, rateType);
|
||||
} else {
|
||||
lastFrameRateRange_->Set(0, RANGE_MAX_REFRESHRATE, rate, rateType);
|
||||
}
|
||||
lastAnimatorExpectedFrameRate_ = animatorExpectedFrameRate;
|
||||
if (frameRateLinker->IsEnable()) {
|
||||
TLOGD(WmsLogTag::WMS_MAIN, "rate %{public}d, linkerId %{public}" PRIu64, rate, frameRateLinker->GetId());
|
||||
FrameRateRange range = {0, RANGE_MAX_REFRESHRATE, rate, rateType};
|
||||
frameRateLinker->UpdateFrameRateRange(range, animatorExpectedFrameRate);
|
||||
frameRateLinker->UpdateFrameRateRange(*lastFrameRateRange_, lastAnimatorExpectedFrameRate_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,11 +239,18 @@ void VsyncStation::SetFrameRateLinkerEnable(bool enabled)
|
||||
{
|
||||
if (auto frameRateLinker = GetFrameRateLinker()) {
|
||||
if (!enabled) {
|
||||
// clear frameRate vote
|
||||
FrameRateRange range = {0, RANGE_MAX_REFRESHRATE, 0};
|
||||
TLOGI(WmsLogTag::WMS_MAIN, "rate %{public}d, linkerId %{public}" PRIu64,
|
||||
range.preferred_, frameRateLinker->GetId());
|
||||
frameRateLinker->UpdateFrameRateRange(range);
|
||||
frameRateLinker->UpdateFrameRateRangeImme(range);
|
||||
} else if (lastFrameRateRange_) {
|
||||
// to resolve these cases:
|
||||
// case 1: when app go backGround and haven't cleared the vote itself, the vote will be invalid forever,
|
||||
// so we restore the vote which is cleared here.
|
||||
// case 2: when frameRateLinker is disabled, the frameRate vote by app will be delayed until linker enable.
|
||||
frameRateLinker->UpdateFrameRateRange(*lastFrameRateRange_, lastAnimatorExpectedFrameRate_);
|
||||
}
|
||||
frameRateLinker->SetEnable(enabled);
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ ohos_shared_library("libintention_event") {
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:libcomposer",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"graphic_2d:window_animation",
|
||||
"hicollie:libhicollie",
|
||||
@ -54,6 +55,7 @@ ohos_shared_library("libintention_event") {
|
||||
"hitrace:hitrace_meter",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"libxml2:libxml2",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
@ -47,6 +47,7 @@ ohos_shared_library("intention_event_anr_manager") {
|
||||
public_external_deps = [ "accessibility:accessibility_common" ]
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"hicollie:libhicollie",
|
||||
|
@ -600,6 +600,7 @@ struct AppWindowSceneConfig {
|
||||
|
||||
struct DeviceScreenConfig {
|
||||
std::string rotationPolicy_ = "11"; // default use phone policy
|
||||
std::string defaultRotationPolicy_ = "1"; // default unspecified policy
|
||||
bool isRightPowerButton_ = true;
|
||||
};
|
||||
|
||||
|
@ -61,6 +61,7 @@ ohos_shared_library("scenesessionmanager_napi") {
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
@ -68,7 +69,9 @@ ohos_shared_library("scenesessionmanager_napi") {
|
||||
"image_framework:image_native",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
"preferences:native_preferences",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
@ -344,6 +344,7 @@ void JsSceneSession::BindNativeMethod(napi_env env, napi_value objValue, const c
|
||||
BindNativeFunction(env, objValue, "setUniqueDensityDpiFromSCB", moduleName,
|
||||
JsSceneSession::SetUniqueDensityDpiFromSCB);
|
||||
BindNativeFunction(env, objValue, "setBlankFlag", moduleName, JsSceneSession::SetBlankFlag);
|
||||
BindNativeFunction(env, objValue, "removeBlank", moduleName, JsSceneSession::RemoveBlank);
|
||||
BindNativeFunction(env, objValue, "setBufferAvailableCallbackEnable", moduleName,
|
||||
JsSceneSession::SetBufferAvailableCallbackEnable);
|
||||
BindNativeFunction(env, objValue, "syncDefaultRequestedOrientation", moduleName,
|
||||
@ -653,12 +654,12 @@ void JsSceneSession::ProcessAdjustKeyboardLayoutRegister()
|
||||
|
||||
void JsSceneSession::ProcessLayoutFullScreenChangeRegister()
|
||||
{
|
||||
auto sessionchangeCallback = sessionchangeCallback_.promote();
|
||||
if (sessionchangeCallback == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "sessionchangeCallback is nullptr");
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "session is nullptr, id:%{public}d", persistentId_);
|
||||
return;
|
||||
}
|
||||
sessionchangeCallback->onLayoutFullScreenChangeFunc_ = [weakThis = wptr(this)](bool isLayoutFullScreen) {
|
||||
auto layoutFullScreenChangeCallback = [weakThis = wptr(this)](bool isLayoutFullScreen) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessLayoutFullScreenChangeRegister jsSceneSession is null");
|
||||
@ -666,6 +667,7 @@ void JsSceneSession::ProcessLayoutFullScreenChangeRegister()
|
||||
}
|
||||
jsSceneSession->OnLayoutFullScreenChange(isLayoutFullScreen);
|
||||
};
|
||||
session->RegisterLayoutFullScreenChangeCallback(layoutFullScreenChangeCallback);
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "success");
|
||||
}
|
||||
|
||||
@ -1521,20 +1523,19 @@ void JsSceneSession::ProcessNeedAvoidRegister()
|
||||
|
||||
void JsSceneSession::ProcessIsCustomAnimationPlaying()
|
||||
{
|
||||
auto sessionchangeCallback = sessionchangeCallback_.promote();
|
||||
if (sessionchangeCallback == nullptr) {
|
||||
WLOGFE("sessionchangeCallback is nullptr");
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "session is nullptr");
|
||||
return;
|
||||
}
|
||||
sessionchangeCallback->onIsCustomAnimationPlaying_ = [weakThis = wptr(this)](bool status) {
|
||||
session->RegisterIsCustomAnimationPlayingCallback([weakThis = wptr(this)](bool status) {
|
||||
auto jsSceneSession = weakThis.promote();
|
||||
if (!jsSceneSession) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "ProcessIsCustomAnimationPlaying jsSceneSession is null");
|
||||
TLOGNE(WmsLogTag::WMS_LIFE, "jsSceneSession is null");
|
||||
return;
|
||||
}
|
||||
jsSceneSession->OnIsCustomAnimationPlaying(status);
|
||||
};
|
||||
WLOGFD("success");
|
||||
});
|
||||
}
|
||||
|
||||
void JsSceneSession::ProcessShowWhenLockedRegister()
|
||||
@ -1995,6 +1996,13 @@ napi_value JsSceneSession::SetBlankFlag(napi_env env, napi_callback_info info)
|
||||
return (me != nullptr) ? me->OnSetBlankFlag(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsSceneSession::RemoveBlank(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_SCB, "[NAPI]");
|
||||
JsSceneSession *me = CheckParamsAndGetThis<JsSceneSession>(env, info);
|
||||
return (me != nullptr) ? me->OnRemoveBlank(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsSceneSession::SetBufferAvailableCallbackEnable(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_SCB, "[NAPI]");
|
||||
@ -4723,6 +4731,17 @@ napi_value JsSceneSession::OnSetBlankFlag(napi_env env, napi_callback_info info)
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
napi_value JsSceneSession::OnRemoveBlank(napi_env env, napi_callback_info info)
|
||||
{
|
||||
auto session = weakSession_.promote();
|
||||
if (session == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_SCB, "[NAPI]session is nullptr, id:%{public}d", persistentId_);
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
session->NotifyRemoveBlank();
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
napi_value JsSceneSession::OnSetBufferAvailableCallbackEnable(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = ARGC_FOUR;
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include "interfaces/include/ws_common.h"
|
||||
#include "session/host/include/scene_session.h"
|
||||
#include "js_scene_utils.h"
|
||||
#include "task_scheduler.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
enum class ListenerFuncType : uint32_t {
|
||||
@ -143,6 +141,7 @@ private:
|
||||
static napi_value SetCompatibleModeEnableInPad(napi_env env, napi_callback_info info);
|
||||
static napi_value SetUniqueDensityDpiFromSCB(napi_env env, napi_callback_info info);
|
||||
static napi_value SetBlankFlag(napi_env env, napi_callback_info info);
|
||||
static napi_value RemoveBlank(napi_env env, napi_callback_info info);
|
||||
static napi_value SetBufferAvailableCallbackEnable(napi_env env, napi_callback_info info);
|
||||
static napi_value SyncDefaultRequestedOrientation(napi_env env, napi_callback_info info);
|
||||
static napi_value SetIsPcAppInPad(napi_env env, napi_callback_info info);
|
||||
@ -195,6 +194,7 @@ private:
|
||||
napi_value OnSetCompatibleModeEnableInPad(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetUniqueDensityDpiFromSCB(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetBlankFlag(napi_env env, napi_callback_info info);
|
||||
napi_value OnRemoveBlank(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetBufferAvailableCallbackEnable(napi_env env, napi_callback_info info);
|
||||
napi_value OnSyncDefaultRequestedOrientation(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetIsPcAppInPad(napi_env env, napi_callback_info info);
|
||||
|
@ -3389,10 +3389,10 @@ napi_value JsSceneSessionManager::OnGetWindowPid(napi_env env, napi_callback_inf
|
||||
|
||||
void JsSceneSessionManager::OnCloseTargetFloatWindow(const std::string& bundleName)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_MULTI_WINDOW, "[NAPI]in");
|
||||
auto task = [this, bundleName, jsCallBack = GetJSCallback(CLOSE_TARGET_FLOAT_WINDOW_CB), env = env_]() {
|
||||
TLOGD(WmsLogTag::WMS_MULTI_WINDOW, "[NAPI]");
|
||||
auto task = [this, bundleName, jsCallBack = GetJSCallback(CLOSE_TARGET_FLOAT_WINDOW_CB), env = env_] {
|
||||
if (jsCallBack == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_MULTI_WINDOW, "[NAPI]jsCallBack is nullptr");
|
||||
TLOGNE(WmsLogTag::WMS_MULTI_WINDOW, "[NAPI]jsCallBack is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_value jsBundleNameObj = CreateJsValue(env, bundleName);
|
||||
@ -3405,7 +3405,7 @@ void JsSceneSessionManager::OnCloseTargetFloatWindow(const std::string& bundleNa
|
||||
void JsSceneSessionManager::ProcessCloseTargetFloatWindow()
|
||||
{
|
||||
ProcessCloseTargetFloatWindowFunc func = [this](const std::string& bundleName) {
|
||||
TLOGD(WmsLogTag::WMS_MULTI_WINDOW, "ProcessCloseTargetFloatWindow. bundleName:%{public}s", bundleName.c_str());
|
||||
TLOGND(WmsLogTag::WMS_MULTI_WINDOW, "ProcessCloseTargetFloatWindow. bundleName:%{public}s", bundleName.c_str());
|
||||
this->OnCloseTargetFloatWindow(bundleName);
|
||||
};
|
||||
SceneSessionManager::GetInstance().SetCloseTargetFloatWindowFunc(func);
|
||||
|
@ -970,6 +970,7 @@ napi_value CreateJsSessionRecoverInfo(
|
||||
Rect rect = property->GetWindowRect();
|
||||
WSRect wsRect = { rect.posX_, rect.posY_, rect.width_, rect.height_ };
|
||||
napi_set_named_property(env, objValue, "recoverRect", CreateJsSessionRect(env, wsRect));
|
||||
napi_set_named_property(env, objValue, "layoutFullScreen", CreateJsValue(env, property->IsLayoutFullScreen()));
|
||||
return objValue;
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ ohos_shared_library("screensessionmanager_napi") {
|
||||
"ability_runtime:runtime",
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
|
@ -22,7 +22,8 @@ using namespace AbilityRuntime;
|
||||
|
||||
napi_value JsDeviceScreenConfig::CreateDeviceScreenConfig(napi_env env, const DeviceScreenConfig& config)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "DeviceScreenConfig rotationPolicy:%{public}s.", config.rotationPolicy_.c_str());
|
||||
TLOGI(WmsLogTag::DMS, "DeviceScreenConfig rotationPolicy:%{public}s, defaultRotationPolicy:%{public}s.",
|
||||
config.rotationPolicy_.c_str(), config.defaultRotationPolicy_.c_str());
|
||||
napi_value objValue = nullptr;
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr) {
|
||||
@ -30,6 +31,7 @@ napi_value JsDeviceScreenConfig::CreateDeviceScreenConfig(napi_env env, const De
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
napi_set_named_property(env, objValue, "rotationPolicy", CreateJsValue(env, config.rotationPolicy_));
|
||||
napi_set_named_property(env, objValue, "defaultRotationPolicy", CreateJsValue(env, config.defaultRotationPolicy_));
|
||||
napi_set_named_property(env, objValue, "isRightPowerButton", CreateJsValue(env, config.isRightPowerButton_));
|
||||
return objValue;
|
||||
}
|
||||
|
@ -48,8 +48,10 @@ ohos_shared_library("transactionmanager_napi") {
|
||||
"ability_runtime:runtime",
|
||||
"c_utils:utils",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
|
@ -123,12 +123,14 @@ ohos_shared_library("screen_session_manager") {
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:dataobs_manager",
|
||||
"ability_runtime:extension_manager",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"config_policy:configpolicy_util",
|
||||
"data_share:datashare_common",
|
||||
"data_share:datashare_consumer",
|
||||
"eventhandler:libeventhandler",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
|
@ -16,8 +16,6 @@
|
||||
#ifndef OHOS_ROSEN_SUPER_FOLD_SENSOR_MANAGER_H
|
||||
#define OHOS_ROSEN_SUPER_FOLD_SENSOR_MANAGER_H
|
||||
|
||||
#ifdef SENSOR_ENABLE
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@ -46,16 +44,12 @@ public:
|
||||
|
||||
void RegisterHallCallback(); // 磁吸键盘
|
||||
|
||||
void RegisterSoftKeyboardCallback();
|
||||
|
||||
void UnregisterPostureCallback();
|
||||
|
||||
void UnregisterHallCallback();
|
||||
|
||||
void HandlePostureData(const SensorEvent * const event);
|
||||
|
||||
void HandleSoftKeyboardData();
|
||||
|
||||
void HandleHallData(const SensorEvent * const event);
|
||||
|
||||
void HandleSuperSensorChange();
|
||||
@ -66,17 +60,15 @@ private:
|
||||
|
||||
std::recursive_mutex mutex_;
|
||||
|
||||
bool hasKeyboard_ = false;
|
||||
|
||||
SuperFoldStatusChangeEvents events_ = SuperFoldStatusChangeEvents::UNDEFINED;
|
||||
|
||||
SensorUser postureUser {};
|
||||
|
||||
SensorUser hallUser {};
|
||||
|
||||
float globalAngle = 170.0F;
|
||||
float curAngle_ = 170.0F;
|
||||
|
||||
uint16_t globalHall = USHRT_MAX;
|
||||
uint16_t curHall_ = USHRT_MAX;
|
||||
|
||||
void NotifyFoldAngleChanged(float foldAngle);
|
||||
|
||||
@ -90,6 +82,5 @@ private:
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SENSOR_ENABLE
|
||||
|
||||
#endif // OHOS_ROSEN_SUPER_FOLD_SENSOR_MANAGER_H
|
@ -21,6 +21,7 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <atomic>
|
||||
|
||||
#include "dm_common.h"
|
||||
#include "wm_single_instance.h"
|
||||
@ -35,45 +36,44 @@ public:
|
||||
SuperFoldStateManager();
|
||||
~SuperFoldStateManager();
|
||||
|
||||
void initStateManagerMap(SuperFoldStatus curState,
|
||||
void AddStateManagerMap(SuperFoldStatus curState,
|
||||
SuperFoldStatusChangeEvents event,
|
||||
SuperFoldStatus nextState,
|
||||
std::function<void ()> action);
|
||||
std::function<void (SuperFoldStatusChangeEvents)> action);
|
||||
|
||||
void transferState(SuperFoldStatus nextState);
|
||||
void TransferState(SuperFoldStatus nextState);
|
||||
|
||||
void HandleSuperFoldStatusChange(SuperFoldStatusChangeEvents events);
|
||||
|
||||
SuperFoldStatus GetCurrentStatus();
|
||||
|
||||
void SetCurrentStatus(SuperFoldStatus curState);
|
||||
|
||||
FoldStatus MatchSuperFoldStatusToFoldStatus(SuperFoldStatus superFoldStatus);
|
||||
private:
|
||||
SuperFoldStatus curState_ = SuperFoldStatus::HALF_FOLDED;
|
||||
std::atomic<SuperFoldStatus> curState_ = SuperFoldStatus::HALF_FOLDED;
|
||||
|
||||
struct Transition {
|
||||
SuperFoldStatus nextState;
|
||||
std::function<void ()> action;
|
||||
std::function<void (SuperFoldStatusChangeEvents)> action;
|
||||
};
|
||||
|
||||
using transEvent = std::pair<SuperFoldStatus, SuperFoldStatusChangeEvents>;
|
||||
std::map<transEvent, Transition> stateManagerMap_;
|
||||
|
||||
static void DoAngleChangeFolded();
|
||||
static void DoAngleChangeFolded(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoAngleChangeHalfFolded();
|
||||
static void DoAngleChangeHalfFolded(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoAngleChangeExpanded();
|
||||
static void DoAngleChangeExpanded(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoKeyboardOn();
|
||||
static void DoKeyboardOn(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoKeyboardOff();
|
||||
static void DoKeyboardOff(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoSoftKeyboardOn();
|
||||
static void DoFoldedToHalfFolded(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoSoftKeyboardOff();
|
||||
static void DoExpandedToKeyboard(SuperFoldStatusChangeEvents event);
|
||||
|
||||
static void DoExpandedToKeyboard();
|
||||
void SetCurrentStatus(SuperFoldStatus curState);
|
||||
};
|
||||
} // Rosen
|
||||
} // OHOS
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
ScreenSessionDumper(int fd, const std::vector<std::u16string>& args);
|
||||
~ScreenSessionDumper() = default;
|
||||
|
||||
bool IsNumber(std::string str);
|
||||
void ExcuteDumpCmd();
|
||||
void DumpEventTracker(EventTracker& tracker);
|
||||
void DumpFreezedPidList(std::set<int32_t> pidList);
|
||||
@ -57,6 +58,7 @@ private:
|
||||
void DumpScreenInfoById(ScreenId id);
|
||||
void DumpScreenPropertyById(ScreenId id);
|
||||
void ExcuteInjectCmd();
|
||||
void ExcuteInjectCmd2();
|
||||
/*
|
||||
hidumper 命令注入隔离
|
||||
*/
|
||||
@ -71,11 +73,21 @@ private:
|
||||
bool IsValidDisplayModeCommand(std::string command);
|
||||
int SetFoldDisplayMode();
|
||||
int SetFoldStatusLocked();
|
||||
void SetHallAndPostureValue(std::string input);
|
||||
void SetHallAndPostureStatus(std::string input);
|
||||
|
||||
private:
|
||||
int fd_;
|
||||
std::vector<std::string> params_;
|
||||
std::string dumpInfo_;
|
||||
/*
|
||||
依赖的外部定义
|
||||
*/
|
||||
private:
|
||||
typedef struct EXTHALLData {
|
||||
float flag = 0.0;
|
||||
float hall = 0.0;
|
||||
} ExtHallData;
|
||||
};
|
||||
} // Rosen
|
||||
} // OHOS
|
||||
|
@ -473,6 +473,7 @@ private:
|
||||
std::atomic<uint32_t> cachedSettingDpi_ {0};
|
||||
|
||||
uint32_t defaultDpi {0};
|
||||
uint32_t extendDefaultDpi_ {0};
|
||||
uint32_t defaultDeviceRotationOffset_ { 0 };
|
||||
|
||||
bool isMultiScreenCollaboration_ = false;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "setting_observer.h"
|
||||
|
||||
@ -40,8 +41,8 @@ public:
|
||||
static void SetSettingRotationScreenId(int32_t screenId);
|
||||
static bool GetSettingRotation(int32_t& rotation, const std::string& key = SETTING_ROTATION_KEY);
|
||||
static bool GetSettingRotationScreenID(int32_t& screenId, const std::string& key = SETTING_ROTATION_SCREEN_ID_KEY);
|
||||
static void RemoveInvalidChar(std::string& dataStr, const std::string& inputString);
|
||||
static bool SplitString(std::vector<std::string>& splitValues, const std::string& inputString);
|
||||
static std::string RemoveInvalidChar(const std::string& input);
|
||||
static bool SplitString(std::vector<std::string>& splitValues, const std::string& input, char delimiter = ',');
|
||||
static int32_t GetDataFromString(std::vector<uint64_t>& datas, const std::string& inputString);
|
||||
static bool GetSettingRecoveryResolutionString(std::vector<std::string>& resolutionStrings,
|
||||
const std::string& key = SETTING_RECOVERY_RESOLUTION_KEY);
|
||||
|
@ -132,14 +132,12 @@ void DualDisplayFoldPolicy::ChangeScreenDisplayMode(FoldDisplayMode displayMode)
|
||||
ReportFoldDisplayModeChange(displayMode);
|
||||
ScreenSessionManager::GetInstance().SwitchScrollParam(displayMode);
|
||||
ChangeScreenDisplayModeProc(screenSession, displayMode);
|
||||
if (currentDisplayMode_ != displayMode) {
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock_mode(displayModeMutex_);
|
||||
currentDisplayMode_ = displayMode;
|
||||
lastDisplayMode_ = displayMode;
|
||||
}
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
SetdisplayModeChangeStatus(false);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void SensorFoldStateManager::HandleSensorChange(FoldStatus nextState, float angl
|
||||
WLOGFW("fold state is UNKNOWN");
|
||||
return;
|
||||
}
|
||||
if (mState_ == nextState && !IsTentMode()) {
|
||||
if (mState_ == nextState) {
|
||||
WLOGFD("fold state doesn't change, foldState = %{public}d.", mState_);
|
||||
return;
|
||||
}
|
||||
@ -57,7 +57,7 @@ void SensorFoldStateManager::HandleSensorChange(FoldStatus nextState, float angl
|
||||
PowerMgr::PowerMgrClient::GetInstance().RefreshActivity();
|
||||
|
||||
NotifyReportFoldStatusToScb(mState_, nextState, angle);
|
||||
|
||||
|
||||
mState_ = nextState;
|
||||
if (foldScreenPolicy != nullptr) {
|
||||
foldScreenPolicy->SetFoldStatus(mState_);
|
||||
|
@ -125,12 +125,12 @@ void SingleDisplayFoldPolicy::ChangeScreenDisplayMode(FoldDisplayMode displayMod
|
||||
break;
|
||||
}
|
||||
}
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock_mode(displayModeMutex_);
|
||||
currentDisplayMode_ = displayMode;
|
||||
lastDisplayMode_ = displayMode;
|
||||
}
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
}
|
||||
|
||||
void SingleDisplayFoldPolicy::SendSensorResult(FoldStatus foldStatus)
|
||||
|
@ -109,12 +109,12 @@ void SingleDisplayPocketFoldPolicy::ChangeScreenDisplayMode(FoldDisplayMode disp
|
||||
ReportFoldDisplayModeChange(displayMode);
|
||||
ScreenSessionManager::GetInstance().SwitchScrollParam(displayMode);
|
||||
ChangeScreenDisplayModeProc(screenSession, displayMode);
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock_mode(displayModeMutex_);
|
||||
currentDisplayMode_ = displayMode;
|
||||
lastDisplayMode_ = displayMode;
|
||||
}
|
||||
ScreenSessionManager::GetInstance().NotifyDisplayModeChanged(displayMode);
|
||||
}
|
||||
|
||||
void SingleDisplayPocketFoldPolicy::ChangeScreenDisplayModeProc(sptr<ScreenSession> screenSession,
|
||||
|
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifdef SENSOR_ENABLE
|
||||
|
||||
#include <cmath>
|
||||
#include <hisysevent.h>
|
||||
@ -34,9 +33,9 @@ constexpr float ANGLE_MIN_VAL = 30.0F;
|
||||
constexpr float ANGLE_MAX_VAL = 180.0F;
|
||||
constexpr float ANGLE_FLAT_THRESHOLD = 150.0F;
|
||||
constexpr float ANGLE_HALF_FOLD_THRESHOLD = 135.0F;
|
||||
constexpr int32_t HALL_HAVE_KEYBOARD_THRESHOLD = 0x0100;
|
||||
constexpr int32_t HALL_REMOVE_KEYBOARD_THRESHOLD = 0;
|
||||
constexpr int32_t HALL_ACTIVE = 1 << 2;
|
||||
constexpr uint16_t HALL_HAVE_KEYBOARD_THRESHOLD = 0B0100;
|
||||
constexpr uint16_t HALL_REMOVE_KEYBOARD_THRESHOLD = 0B0000;
|
||||
constexpr uint16_t HALL_ACTIVE = 1 << 2;
|
||||
constexpr int32_t SENSOR_SUCCESS = 0;
|
||||
constexpr int32_t POSTURE_INTERVAL = 100000000;
|
||||
constexpr uint16_t SENSOR_EVENT_FIRST_DATA = 0;
|
||||
@ -109,8 +108,6 @@ void SuperFoldSensorManager::UnregisterHallCallback()
|
||||
}
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::RegisterSoftKeyboardCallback() {}
|
||||
|
||||
void SuperFoldSensorManager::HandlePostureData(const SensorEvent * const event)
|
||||
{
|
||||
if (event == nullptr) {
|
||||
@ -126,28 +123,29 @@ void SuperFoldSensorManager::HandlePostureData(const SensorEvent * const event)
|
||||
return;
|
||||
}
|
||||
PostureData *postureData = reinterpret_cast<PostureData *>(event[SENSOR_EVENT_FIRST_DATA].data);
|
||||
globalAngle = (*postureData).angle;
|
||||
if (std::isless(globalAngle, ANGLE_MIN_VAL) ||
|
||||
std::isgreater(globalAngle, ANGLE_MAX_VAL + ACCURACY_ERROR_FOR_PC)) {
|
||||
TLOGI(WmsLogTag::DMS, "Invalid value, angle value is: %{public}f.", globalAngle);
|
||||
curAngle_ = (*postureData).angle;
|
||||
if (std::isgreater(curAngle_, ANGLE_MAX_VAL + ACCURACY_ERROR_FOR_PC)) {
|
||||
TLOGI(WmsLogTag::DMS, "Invalid value, angle value is: %{public}f.", curAngle_);
|
||||
return;
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "angle value is: %{public}f.", globalAngle);
|
||||
NotifyFoldAngleChanged(globalAngle);
|
||||
TLOGI(WmsLogTag::DMS, "angle value is: %{public}f.", curAngle_);
|
||||
NotifyFoldAngleChanged(curAngle_);
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::NotifyFoldAngleChanged(float foldAngle)
|
||||
{
|
||||
if (std::isgreater(foldAngle, ANGLE_FLAT_THRESHOLD)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is not Folded");
|
||||
if (std::isgreaterequal(foldAngle, ANGLE_FLAT_THRESHOLD)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is 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 folded");
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is Half Folded");
|
||||
events_ = SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED;
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged");
|
||||
} else if (std::islessequal(foldAngle, ANGLE_MIN_VAL)) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyFoldAngleChanged is Folded");
|
||||
events_ = SuperFoldStatusChangeEvents::ANGLE_CHANGE_FOLDED;
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "Angle Don't Change!");
|
||||
return;
|
||||
}
|
||||
// notify
|
||||
@ -175,55 +173,39 @@ void SuperFoldSensorManager::HandleHallData(const SensorEvent * const event)
|
||||
auto status = static_cast<uint32_t>(data->status);
|
||||
TLOGI(WmsLogTag::DMS, "HallData status is: %{public}u.", status);
|
||||
|
||||
if (globalHall == (status & HALL_ACTIVE)) {
|
||||
TLOGI(WmsLogTag::DMS, "Hall don't change, hall = %{public}u", globalHall);
|
||||
if (curHall_ == (status & HALL_ACTIVE)) {
|
||||
TLOGI(WmsLogTag::DMS, "Hall don't change, hall = %{public}u", curHall_);
|
||||
return;
|
||||
}
|
||||
globalHall = (status & HALL_ACTIVE);
|
||||
TLOGI(WmsLogTag::DMS, "Hall change, hall = %{public}u", globalHall);
|
||||
NotifyHallChanged(globalHall);
|
||||
curHall_ = (status & HALL_ACTIVE);
|
||||
TLOGI(WmsLogTag::DMS, "Hall change, hall = %{public}u", curHall_);
|
||||
NotifyHallChanged(curHall_);
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::NotifyHallChanged(uint16_t Hall)
|
||||
{
|
||||
if (Hall == HALL_REMOVE_KEYBOARD_THRESHOLD) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged is not hasPhysicalKeyboard");
|
||||
hasKeyboard_ = false;
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Keyboard off!");
|
||||
events_ = SuperFoldStatusChangeEvents::KEYBOARD_OFF;
|
||||
} else if (Hall == HALL_HAVE_KEYBOARD_THRESHOLD) {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged is hasPhysicalKeyboard");
|
||||
hasKeyboard_ = true;
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Keyboard on!");
|
||||
events_ = SuperFoldStatusChangeEvents::KEYBOARD_ON;
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged invalide hall value");
|
||||
TLOGI(WmsLogTag::DMS, "NotifyHallChanged: Invalid Hall Value!");
|
||||
return;
|
||||
}
|
||||
// notify
|
||||
HandleSuperSensorChange();
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::HandleSoftKeyboardData() {}
|
||||
|
||||
void SuperFoldSensorManager::NotifySoftKeyboardChanged() {}
|
||||
|
||||
void SuperFoldSensorManager::HandleSuperSensorChange()
|
||||
{
|
||||
// trigger events
|
||||
if (hasKeyboard_ && events_ != SuperFoldStatusChangeEvents::KEYBOARD_OFF) {
|
||||
TLOGI(WmsLogTag::DMS, "Don't Change!");
|
||||
return;
|
||||
}
|
||||
SuperFoldStateManager::GetInstance().HandleSuperFoldStatusChange(events_);
|
||||
}
|
||||
|
||||
void SuperFoldSensorManager::SetHasKeyboard(bool flag)
|
||||
{
|
||||
hasKeyboard_ = flag;
|
||||
}
|
||||
|
||||
SuperFoldSensorManager::SuperFoldSensorManager() {}
|
||||
|
||||
SuperFoldSensorManager::~SuperFoldSensorManager() {}
|
||||
} // Rosen
|
||||
} // OHOS
|
||||
#endif
|
||||
} // OHOS
|
@ -24,111 +24,117 @@ namespace Rosen {
|
||||
|
||||
WM_IMPLEMENT_SINGLE_INSTANCE(SuperFoldStateManager)
|
||||
|
||||
void SuperFoldStateManager::DoAngleChangeFolded()
|
||||
void SuperFoldStateManager::DoAngleChangeFolded(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoAngleChangeFolded()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoAngleChangeHalfFolded()
|
||||
void SuperFoldStateManager::DoAngleChangeHalfFolded(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoAngleChangeHalfFolded())");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoAngleChangeExpanded()
|
||||
void SuperFoldStateManager::DoAngleChangeExpanded(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoAngleChangeExpanded()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoKeyboardOn()
|
||||
void SuperFoldStateManager::DoKeyboardOn(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoKeyboardOn()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoKeyboardOff()
|
||||
void SuperFoldStateManager::DoKeyboardOff(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoKeyboardOff()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoSoftKeyboardOn()
|
||||
void SuperFoldStateManager::DoFoldedToHalfFolded(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoSoftKeyboardOn()");
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoFoldedToHalfFolded()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoSoftKeyboardOff()
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoSoftKeyboardOff()");
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::DoExpandedToKeyboard()
|
||||
void SuperFoldStateManager::DoExpandedToKeyboard(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoExpandedToKeyboard()");
|
||||
}
|
||||
|
||||
SuperFoldStateManager::SuperFoldStateManager()
|
||||
{
|
||||
initStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
AddStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED,
|
||||
SuperFoldStatus::EXPANDED,
|
||||
&SuperFoldStateManager::DoAngleChangeExpanded);
|
||||
|
||||
AddStateManagerMap(SuperFoldStatus::FOLDED,
|
||||
SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED,
|
||||
SuperFoldStatus::HALF_FOLDED,
|
||||
&SuperFoldStateManager::DoFoldedToHalfFolded);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::EXPANDED,
|
||||
AddStateManagerMap(SuperFoldStatus::EXPANDED,
|
||||
SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED,
|
||||
SuperFoldStatus::HALF_FOLDED,
|
||||
&SuperFoldStateManager::DoAngleChangeHalfFolded);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
AddStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
SuperFoldStatusChangeEvents::ANGLE_CHANGE_FOLDED,
|
||||
SuperFoldStatus::FOLDED,
|
||||
&SuperFoldStateManager::DoAngleChangeFolded);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
AddStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
SuperFoldStatusChangeEvents::KEYBOARD_ON,
|
||||
SuperFoldStatus::KEYBOARD,
|
||||
&SuperFoldStateManager::DoKeyboardOn);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::EXPANDED,
|
||||
AddStateManagerMap(SuperFoldStatus::EXPANDED,
|
||||
SuperFoldStatusChangeEvents::KEYBOARD_ON,
|
||||
SuperFoldStatus::KEYBOARD,
|
||||
&SuperFoldStateManager::DoExpandedToKeyboard);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::KEYBOARD,
|
||||
AddStateManagerMap(SuperFoldStatus::KEYBOARD,
|
||||
SuperFoldStatusChangeEvents::KEYBOARD_OFF,
|
||||
SuperFoldStatus::HALF_FOLDED,
|
||||
&SuperFoldStateManager::DoKeyboardOff);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
SuperFoldStatusChangeEvents::SOFT_KEYBOARD_ON,
|
||||
SuperFoldStatus::SOFT_KEYBOARD,
|
||||
&SuperFoldStateManager::DoSoftKeyboardOn);
|
||||
|
||||
initStateManagerMap(SuperFoldStatus::SOFT_KEYBOARD,
|
||||
SuperFoldStatusChangeEvents::SOFT_KEYBOARD_OFF,
|
||||
SuperFoldStatus::HALF_FOLDED,
|
||||
&SuperFoldStateManager::DoSoftKeyboardOff);
|
||||
}
|
||||
|
||||
SuperFoldStateManager::~SuperFoldStateManager() = default;
|
||||
|
||||
void SuperFoldStateManager::initStateManagerMap(SuperFoldStatus curState,
|
||||
void SuperFoldStateManager::AddStateManagerMap(SuperFoldStatus curState,
|
||||
SuperFoldStatusChangeEvents event,
|
||||
SuperFoldStatus nextState,
|
||||
std::function<void ()> action)
|
||||
std::function<void (SuperFoldStatusChangeEvents)> action)
|
||||
{
|
||||
stateManagerMap_[{curState, event}] = {nextState, action};
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::transferState(SuperFoldStatus nextState)
|
||||
void SuperFoldStateManager::TransferState(SuperFoldStatus nextState)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "transferState from %{public}d to %{public}d", curState_, nextState);
|
||||
curState_ = nextState;
|
||||
TLOGI(WmsLogTag::DMS, "TransferState from %{public}d to %{public}d", curState_.load(), nextState);
|
||||
curState_ .store(nextState);
|
||||
}
|
||||
|
||||
FoldStatus SuperFoldStateManager::MatchSuperFoldStatusToFoldStatus(SuperFoldStatus superFoldStatus)
|
||||
{
|
||||
switch (superFoldStatus) {
|
||||
case SuperFoldStatus::EXPANDED:
|
||||
return FoldStatus::EXPAND;
|
||||
case SuperFoldStatus::HALF_FOLDED:
|
||||
return FoldStatus::HALF_FOLD;
|
||||
case SuperFoldStatus::FOLDED:
|
||||
return FoldStatus::FOLDED;
|
||||
case SuperFoldStatus::KEYBOARD:
|
||||
return FoldStatus::HALF_FOLD;
|
||||
default:
|
||||
return FoldStatus::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::HandleSuperFoldStatusChange(SuperFoldStatusChangeEvents event)
|
||||
{
|
||||
SuperFoldStatus curState = curState_;
|
||||
SuperFoldStatus curState = curState_.load();
|
||||
SuperFoldStatus nextState = SuperFoldStatus::UNKNOWN;
|
||||
bool isTransfer = false;
|
||||
std::function<void ()> action;
|
||||
std::function<void (SuperFoldStatusChangeEvents)> action;
|
||||
|
||||
auto item = stateManagerMap_.find({curState, event});
|
||||
if (item != stateManagerMap_.end()) {
|
||||
@ -138,8 +144,8 @@ void SuperFoldStateManager::HandleSuperFoldStatusChange(SuperFoldStatusChangeEve
|
||||
}
|
||||
|
||||
if (isTransfer && action) {
|
||||
action();
|
||||
transferState(nextState);
|
||||
action(event);
|
||||
TransferState(nextState);
|
||||
// notify
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetDefaultScreenSession();
|
||||
if (screenSession == nullptr) {
|
||||
@ -148,17 +154,19 @@ void SuperFoldStateManager::HandleSuperFoldStatusChange(SuperFoldStatusChangeEve
|
||||
}
|
||||
ScreenId screenId = screenSession->GetScreenId();
|
||||
ScreenSessionManager::GetInstance().OnSuperFoldStatusChange(screenId, curState_);
|
||||
ScreenSessionManager::GetInstance().NotifyFoldStatusChanged(
|
||||
MatchSuperFoldStatusToFoldStatus(curState_.load()));
|
||||
}
|
||||
}
|
||||
|
||||
SuperFoldStatus SuperFoldStateManager::GetCurrentStatus()
|
||||
{
|
||||
return curState_;
|
||||
return curState_.load();
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::SetCurrentStatus(SuperFoldStatus curState)
|
||||
{
|
||||
curState_ = curState;
|
||||
curState_.store(curState);
|
||||
}
|
||||
|
||||
} // Rosen
|
||||
|
@ -540,13 +540,13 @@ void MultiScreenManager::InternalScreenOffChange(sptr<ScreenSession> internalSes
|
||||
DoFirstMirrorChange(externalSession, internalSession, SCREEN_MIRROR);
|
||||
TLOGI(WmsLogTag::DMS, "3: internal mirror to external mirror");
|
||||
} else if (mainScreenId == internalScreenId && secondaryScreenMode == MultiScreenMode::SCREEN_EXTEND) {
|
||||
DoFirstExtendChange(externalSession, internalSession, SCREEN_EXTEND);
|
||||
DoFirstExtendChange(externalSession, internalSession, SCREEN_MIRROR);
|
||||
TLOGI(WmsLogTag::DMS, "10: internal extend to external mirror");
|
||||
} else if (mainScreenId != internalScreenId && secondaryScreenMode == MultiScreenMode::SCREEN_EXTEND) {
|
||||
DoFirstMainChange(externalSession, internalSession, SCREEN_EXTEND);
|
||||
DoFirstMainChange(externalSession, internalSession, SCREEN_MIRROR);
|
||||
TLOGI(WmsLogTag::DMS, "14: external extend to external mirror");
|
||||
} else {
|
||||
TLOGE(WmsLogTag::DMS, "paramater error!");
|
||||
TLOGE(WmsLogTag::DMS, "no need to change or paramater error!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ enum XmlNodeElement {
|
||||
HALL_SWITCH_APP,
|
||||
PACKAGE_NAME,
|
||||
ROTATION_POLICY,
|
||||
DEFAULT_ROTATION_POLICY,
|
||||
SCREEN_SNAPSHOT_BUNDLE_NAME,
|
||||
SCREEN_SNAPSHOT_ABILITY_NAME,
|
||||
IS_RIGHT_POWER_BUTTON,
|
||||
@ -89,6 +90,7 @@ std::map<int32_t, std::string> ScreenSceneConfig::xmlNodeMap_ = {
|
||||
{HALL_SWITCH_APP, "hallSwitchApp"},
|
||||
{PACKAGE_NAME, "packageName"},
|
||||
{ROTATION_POLICY, "rotationPolicy"},
|
||||
{DEFAULT_ROTATION_POLICY, "defaultRotationPolicy"},
|
||||
{SCREEN_SNAPSHOT_BUNDLE_NAME, "screenSnapshotBundleName"},
|
||||
{SCREEN_SNAPSHOT_ABILITY_NAME, "screenSnapshotAbilityName"},
|
||||
{IS_RIGHT_POWER_BUTTON, "isRightPowerButton"},
|
||||
@ -191,6 +193,7 @@ void ScreenSceneConfig::ParseNodeConfig(const xmlNodePtr& currNode)
|
||||
bool stringConfigCheck = (xmlNodeMap_[DEFAULT_DISPLAY_CUTOUT_PATH] == nodeName) ||
|
||||
(xmlNodeMap_[SUB_DISPLAY_CUTOUT_PATH] == nodeName) ||
|
||||
(xmlNodeMap_[ROTATION_POLICY] == nodeName) ||
|
||||
(xmlNodeMap_[DEFAULT_ROTATION_POLICY] == nodeName) ||
|
||||
(xmlNodeMap_[SCREEN_SNAPSHOT_BUNDLE_NAME] == nodeName) ||
|
||||
(xmlNodeMap_[SCREEN_SNAPSHOT_ABILITY_NAME] == nodeName) ||
|
||||
(xmlNodeMap_[EXTERNAL_SCREEN_DEFAULT_MODE] == nodeName) ||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "screen_session_manager.h"
|
||||
#include "session_permission.h"
|
||||
#include "screen_rotation_property.h"
|
||||
#include "screen_sensor_connector.h"
|
||||
#include "parameters.h"
|
||||
#include "fold_screen_controller/super_fold_state_manager.h"
|
||||
|
||||
@ -55,6 +56,8 @@ const std::string ARG_SET_ON_TENT_MODE = "-ontent";
|
||||
const std::string ARG_SET_OFF_TENT_MODE = "-offtent";
|
||||
const std::string ARG_SET_HOVER_STATUS = "-hoverstatus";
|
||||
const std::string ARG_SET_SUPER_FOLD_STATUS = "-supertrans";
|
||||
const std::string ARG_SET_POSTURE_HALL = "-posture";
|
||||
const std::string ARG_SET_POSTURE_HALL_STATUS = "-registerhall"; // 关闭开合sensor报值
|
||||
}
|
||||
|
||||
static std::string GetProcessNameByPid(int32_t pid)
|
||||
@ -87,6 +90,19 @@ ScreenSessionDumper::ScreenSessionDumper(int fd, const std::vector<std::u16strin
|
||||
TLOGI(WmsLogTag::DMS, "input args: [%{public}s]", info.c_str());
|
||||
}
|
||||
|
||||
bool ScreenSessionDumper::IsNumber(std::string str)
|
||||
{
|
||||
if (str.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < static_cast<int32_t>(str.size()); i++) {
|
||||
if (str.at(i) < '0' || str.at(i) > '9') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScreenSessionDumper::OutputDumpInfo()
|
||||
{
|
||||
if (fd_ < 0) {
|
||||
@ -142,30 +158,46 @@ void ScreenSessionDumper::ExcuteInjectCmd()
|
||||
}
|
||||
if (params_[0] == STATUS_FOLD_HALF || params_[0] == STATUS_EXPAND || params_[0] == STATUS_FOLD) {
|
||||
ShowNotifyFoldStatusChangedInfo();
|
||||
return;
|
||||
} else if (params_[0].find(ARG_SET_ROTATION_SENSOR) != std::string::npos) {
|
||||
SetMotionSensorvalue(params_[0]);
|
||||
return;
|
||||
} else if (params_[0].find(ARG_SET_ROTATION_LOCK) != std::string::npos) {
|
||||
SetRotationLockedvalue(params_[0]);
|
||||
return;
|
||||
} else if (params_[0].find(ARG_PUBLISH_CAST_EVENT) != std::string::npos) {
|
||||
MockSendCastPublishEvent(params_[0]);
|
||||
return;
|
||||
} else if (params_.size() == 1 && IsValidDisplayModeCommand(params_[0])) {
|
||||
int errCode = SetFoldDisplayMode();
|
||||
if (errCode != 0) {
|
||||
ShowIllegalArgsInfo();
|
||||
}
|
||||
return;
|
||||
} else if (params_.size() == 1 && (params_[0] == ARG_LOCK_FOLD_DISPLAY_STATUS
|
||||
|| params_[0] == ARG_UNLOCK_FOLD_DISPLAY_STATUS)) {
|
||||
int errCode = SetFoldStatusLocked();
|
||||
if (errCode != 0) {
|
||||
ShowIllegalArgsInfo();
|
||||
}
|
||||
} else if (params_[0].find(ARG_SET_ON_TENT_MODE) != std::string::npos ||
|
||||
return;
|
||||
}
|
||||
ExcuteInjectCmd2();
|
||||
}
|
||||
|
||||
void ScreenSessionDumper::ExcuteInjectCmd2()
|
||||
{
|
||||
if (params_[0].find(ARG_SET_ON_TENT_MODE) != std::string::npos ||
|
||||
params_[0].find(ARG_SET_OFF_TENT_MODE) != std::string::npos) {
|
||||
SetEnterOrExitTentMode(params_[0]);
|
||||
} else if (params_[0].find(ARG_SET_HOVER_STATUS) != std::string::npos) {
|
||||
SetHoverStatusChange(params_[0]);
|
||||
} else if (params_[0].find(ARG_SET_SUPER_FOLD_STATUS) != std::string::npos) {
|
||||
SetSuperFoldStatusChange(params_[0]);
|
||||
} else if (params_[0].find(ARG_SET_POSTURE_HALL) != std::string::npos) {
|
||||
SetHallAndPostureValue(params_[0]);
|
||||
} else if (params_[0].find(ARG_SET_POSTURE_HALL_STATUS) != std::string::npos) {
|
||||
SetHallAndPostureStatus(params_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,6 +695,10 @@ void ScreenSessionDumper::SetHoverStatusChange(std::string input)
|
||||
{
|
||||
size_t commaPos = input.find_last_of(',');
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetDefaultScreenSession();
|
||||
if (screenSession == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "screenSession is nullptr");
|
||||
return;
|
||||
}
|
||||
if ((commaPos != std::string::npos) && (input.substr(0, commaPos) == ARG_SET_HOVER_STATUS)) {
|
||||
std::string valueStr = input.substr(commaPos + 1);
|
||||
int32_t value = std::stoi(valueStr);
|
||||
@ -676,6 +712,63 @@ void ScreenSessionDumper::SetHoverStatusChange(std::string input)
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSessionDumper::SetHallAndPostureValue(std::string input)
|
||||
{
|
||||
std::string token;
|
||||
std::istringstream ss(input);
|
||||
std::vector<std::string> tokens;
|
||||
while (std::getline(ss, token, ',')) {
|
||||
tokens.push_back(token);
|
||||
}
|
||||
if (tokens.size() != DUMPER_PARAM_INDEX_THREE && tokens[0] != ARG_SET_POSTURE_HALL) {
|
||||
TLOGE(WmsLogTag::DMS, "param error: %{public}s", input.c_str());
|
||||
return;
|
||||
}
|
||||
if (!IsNumber(tokens[DUMPER_PARAM_INDEX_ONE]) || !IsNumber(tokens[DUMPER_PARAM_INDEX_TWO])) {
|
||||
TLOGE(WmsLogTag::DMS, "param error: %{public}s", input.c_str());
|
||||
return;
|
||||
}
|
||||
int hallVal = stoi(tokens[DUMPER_PARAM_INDEX_ONE]);
|
||||
int postureVal = stoi(tokens[DUMPER_PARAM_INDEX_TWO]);
|
||||
ExtHallData hallData = {(1 << 1), hallVal};
|
||||
PostureData postureData = {
|
||||
.angle = postureVal,
|
||||
};
|
||||
SensorEvent hallEvent = {
|
||||
.dataLen = sizeof(ExtHallData),
|
||||
.data = reinterpret_cast<uint8_t *>(&hallData),
|
||||
};
|
||||
SensorEvent postureEvent = {
|
||||
.dataLen = sizeof(PostureData),
|
||||
.data = reinterpret_cast<uint8_t *>(&postureData),
|
||||
};
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().HandleHallData(&hallEvent);
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().HandlePostureData(&postureEvent);
|
||||
TLOGI(WmsLogTag::DMS, "mock posture: %{public}d, hall: %{public}d ", postureVal, hallVal);
|
||||
}
|
||||
|
||||
void ScreenSessionDumper::SetHallAndPostureStatus(std::string input)
|
||||
{
|
||||
size_t commaPos = input.find_last_of(',');
|
||||
if ((commaPos != std::string::npos) && (input.substr(0, commaPos) == ARG_SET_POSTURE_HALL_STATUS)) {
|
||||
std::string valueStr = input.substr(commaPos + 1, DUMPER_PARAM_INDEX_ONE);
|
||||
if (valueStr.size() != DUMPER_PARAM_INDEX_ONE && !std::isdigit(valueStr[0])) {
|
||||
return;
|
||||
}
|
||||
int32_t value = std::stoi(valueStr);
|
||||
if (value) {
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().RegisterHallCallback();
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().RegisterPostureCallback();
|
||||
OHOS::Rosen::ScreenSensorConnector::SubscribeRotationSensor();
|
||||
} else {
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().UnRegisterHallCallback();
|
||||
OHOS::Rosen::FoldScreenSensorManager::GetInstance().UnRegisterPostureCallback();
|
||||
OHOS::Rosen::ScreenSensorConnector::UnsubscribeRotationSensor();
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "hall and posture register status: %{public}d", value);
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSessionDumper::SetSuperFoldStatusChange(std::string input)
|
||||
{
|
||||
size_t commaPos = input.find_last_of(',');
|
||||
|
@ -432,6 +432,11 @@ void ScreenSessionManager::ConfigureScreenScene()
|
||||
TLOGD(WmsLogTag::DMS, "rotationPolicy = %{public}s.", rotationPolicy.c_str());
|
||||
deviceScreenConfig_.rotationPolicy_ = rotationPolicy;
|
||||
}
|
||||
if (stringConfig.count("defaultRotationPolicy") != 0) {
|
||||
std::string defaultRotationPolicy = stringConfig["defaultRotationPolicy"];
|
||||
TLOGD(WmsLogTag::DMS, "defaultRotationPolicy = %{public}s.", defaultRotationPolicy.c_str());
|
||||
deviceScreenConfig_.defaultRotationPolicy_ = defaultRotationPolicy;
|
||||
}
|
||||
if (enableConfig.count("isRightPowerButton") != 0) {
|
||||
bool isRightPowerButton = static_cast<bool>(enableConfig["isRightPowerButton"]);
|
||||
TLOGD(WmsLogTag::DMS, "isRightPowerButton = %d", isRightPowerButton);
|
||||
@ -1508,6 +1513,7 @@ void ScreenSessionManager::InitExtendScreenDensity(sptr<ScreenSession> session,
|
||||
}
|
||||
float extendDensity = CalcDefaultExtendScreenDensity(property);
|
||||
TLOGI(WmsLogTag::DMS, "extendDensity = %{public}f", extendDensity);
|
||||
extendDefaultDpi_ = static_cast<uint32_t>(extendDensity * BASELINE_DENSITY);
|
||||
session->SetVirtualPixelRatio(extendDensity);
|
||||
session->SetDefaultDensity(extendDensity);
|
||||
session->SetDensityInCurResolution(extendDensity);
|
||||
@ -2352,7 +2358,11 @@ void ScreenSessionManager::SetDpiFromSettingData(bool isInternal)
|
||||
}
|
||||
if (!ret) {
|
||||
TLOGW(WmsLogTag::DMS, "get setting dpi failed,use default dpi");
|
||||
settingDpi = defaultDpi;
|
||||
if (isInternal) {
|
||||
settingDpi = defaultDpi;
|
||||
} else {
|
||||
settingDpi = extendDefaultDpi_;
|
||||
}
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "get setting dpi success,settingDpi: %{public}u", settingDpi);
|
||||
}
|
||||
@ -5374,7 +5384,7 @@ void ScreenSessionManager::ScbStatusRecoveryWhenSwitchUser(std::vector<int32_t>
|
||||
TLOGE(WmsLogTag::DMS, "unsupport foldStatus: %{public}u", foldStatus);
|
||||
}
|
||||
} else {
|
||||
screenSession->UpdateRotationAfterBoot(true);
|
||||
screenSession->UpdateValidRotationToScb();
|
||||
}
|
||||
auto task = [=] {
|
||||
clientProxy_->SwitchUserCallback(oldScbPids, newScbPid);
|
||||
|
@ -234,42 +234,30 @@ bool ScreenSettingHelper::GetSettingRotationScreenID(int32_t& screenId, const st
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScreenSettingHelper::RemoveInvalidChar(std::string& dataStr, const std::string& inputString)
|
||||
std::string ScreenSettingHelper::RemoveInvalidChar(const std::string& input)
|
||||
{
|
||||
for (char character : inputString) {
|
||||
if (!std::isdigit(character) && character != ' ' && character != ',' && character != '.') {
|
||||
continue;
|
||||
std::string resultString = "";
|
||||
for (char character : input) {
|
||||
if (std::isdigit(character) || character == ' ' || character == ',' || character == '.') {
|
||||
resultString += character;
|
||||
}
|
||||
dataStr += character;
|
||||
}
|
||||
TLOGI(WmsLogTag::DMS, "process done, dataStr: %{public}s", dataStr.c_str());
|
||||
TLOGI(WmsLogTag::DMS, "process done, resultString: %{public}s", resultString.c_str());
|
||||
return resultString;
|
||||
}
|
||||
|
||||
bool ScreenSettingHelper::SplitString(std::vector<std::string>& splitValues, const std::string& inputString)
|
||||
bool ScreenSettingHelper::SplitString(std::vector<std::string>& splitValues, const std::string& input,
|
||||
char delimiter)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "input value: %{public}s", inputString.c_str());
|
||||
std::string dataStr;
|
||||
RemoveInvalidChar(dataStr, inputString);
|
||||
int32_t strLength = dataStr.size();
|
||||
int32_t beginIdx = 0;
|
||||
std::string currentValue;
|
||||
for (int32_t currentIdx = 0; currentIdx < strLength; currentIdx++) {
|
||||
if (dataStr[currentIdx] != ',') {
|
||||
continue;
|
||||
}
|
||||
currentValue = dataStr.substr(beginIdx, currentIdx - beginIdx);
|
||||
if (currentValue.size() > 0) {
|
||||
splitValues.push_back(currentValue);
|
||||
TLOGI(WmsLogTag::DMS, "resolving current value success, currentValue: %{public}s",
|
||||
currentValue.c_str());
|
||||
}
|
||||
beginIdx = currentIdx + 1;
|
||||
TLOGI(WmsLogTag::DMS, "input string: %{public}s", input.c_str());
|
||||
if (input.size() == 0) {
|
||||
TLOGE(WmsLogTag::DMS, "noting in input string");
|
||||
return false;
|
||||
}
|
||||
currentValue = dataStr.substr(beginIdx, strLength - beginIdx);
|
||||
if (currentValue.size() > 0) {
|
||||
splitValues.push_back(currentValue);
|
||||
TLOGI(WmsLogTag::DMS, "resolving current value success, currentValue: %{public}s",
|
||||
currentValue.c_str());
|
||||
std::stringstream stream(input);
|
||||
std::string token;
|
||||
while (std::getline(stream, token, delimiter)) {
|
||||
splitValues.push_back(token);
|
||||
}
|
||||
if (splitValues.size() == 0) {
|
||||
TLOGE(WmsLogTag::DMS, "resolving split values failed");
|
||||
@ -314,7 +302,8 @@ bool ScreenSettingHelper::GetSettingRecoveryResolutionString(std::vector<std::st
|
||||
TLOGE(WmsLogTag::DMS, "get setting recovery resolution failed, ret=%{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
bool ret1 = SplitString(resolutionString, value);
|
||||
std::string validString = RemoveInvalidChar(value);
|
||||
bool ret1 = SplitString(resolutionString, validString);
|
||||
if (!ret1) {
|
||||
TLOGE(WmsLogTag::DMS, "resolving resolution string failed");
|
||||
return false;
|
||||
@ -362,7 +351,8 @@ bool ScreenSettingHelper::GetSettingScreenModeString(std::vector<std::string>& s
|
||||
TLOGE(WmsLogTag::DMS, "get setting screen mode failed, ret=%{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
bool ret1 = SplitString(screenModeStrings, value);
|
||||
std::string validString = RemoveInvalidChar(value);
|
||||
bool ret1 = SplitString(screenModeStrings, validString);
|
||||
if (!ret1) {
|
||||
TLOGE(WmsLogTag::DMS, "resolving screen mode failed");
|
||||
return false;
|
||||
@ -408,7 +398,8 @@ bool ScreenSettingHelper::GetSettingRelativePositionString(std::vector<std::stri
|
||||
TLOGE(WmsLogTag::DMS, "get setting relative position failed, ret=%{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
bool ret1 = SplitString(relativePositionStrings, value);
|
||||
std::string validString = RemoveInvalidChar(value);
|
||||
bool ret1 = SplitString(relativePositionStrings, validString);
|
||||
if (!ret1) {
|
||||
TLOGE(WmsLogTag::DMS, "resolving relative position failed");
|
||||
return false;
|
||||
|
@ -83,9 +83,11 @@ ohos_shared_library("scene_session") {
|
||||
"ability_runtime:start_window_option",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"bundle_framework:libappexecfwk_common",
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"hisysevent:libhisysevent",
|
||||
@ -94,6 +96,7 @@ ohos_shared_library("scene_session") {
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
if (!(host_os == "linux" && host_cpu == "arm64")) {
|
||||
external_deps += [ "preferences:native_preferences" ]
|
||||
@ -177,6 +180,7 @@ ohos_shared_library("screen_session") {
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
|
@ -124,12 +124,10 @@ public:
|
||||
NotifySessionModalTypeChangeFunc onSessionModalTypeChange_;
|
||||
NotifyRaiseToTopFunc onRaiseToTop_;
|
||||
NotifySessionEventFunc OnSessionEvent_;
|
||||
NotifyIsCustomAnimationPlayingCallback onIsCustomAnimationPlaying_;
|
||||
NotifyWindowAnimationFlagChangeFunc onWindowAnimationFlagChange_;
|
||||
NotifyRaiseAboveTargetFunc onRaiseAboveTarget_;
|
||||
NotifyTouchOutsideFunc OnTouchOutside_;
|
||||
NotifyLandscapeMultiWindowSessionFunc onSetLandscapeMultiWindowFunc_;
|
||||
NotifyLayoutFullScreenChangeFunc onLayoutFullScreenChangeFunc_;
|
||||
NotifyDefaultDensityEnabledFunc onDefaultDensityEnabledFunc_;
|
||||
};
|
||||
|
||||
@ -383,6 +381,16 @@ public:
|
||||
*/
|
||||
void RegisterRequestedOrientationChangeCallback(NotifyReqOrientationChangeFunc&& callback);
|
||||
|
||||
/**
|
||||
* Window Animation
|
||||
*/
|
||||
void RegisterIsCustomAnimationPlayingCallback(NotifyIsCustomAnimationPlayingCallback&& callback);
|
||||
|
||||
/**
|
||||
* Window layoutFullScreen
|
||||
*/
|
||||
void RegisterLayoutFullScreenChangeCallback(NotifyLayoutFullScreenChangeFunc&& callback);
|
||||
|
||||
/**
|
||||
* Window Visibility
|
||||
*/
|
||||
@ -797,6 +805,16 @@ private:
|
||||
*/
|
||||
NotifyReqOrientationChangeFunc onRequestedOrientationChange_;
|
||||
|
||||
/**
|
||||
* Window Animation
|
||||
*/
|
||||
NotifyIsCustomAnimationPlayingCallback onIsCustomAnimationPlaying_;
|
||||
|
||||
/**
|
||||
* Window LayoutFullscreen
|
||||
*/
|
||||
NotifyLayoutFullScreenChangeFunc onLayoutFullScreenChangeFunc_;
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
*/
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <event_handler.h>
|
||||
|
||||
#include "accessibility_element_info.h"
|
||||
#include "interfaces/include/ws_common.h"
|
||||
#include "session/container/include/zidl/session_stage_interface.h"
|
||||
#include "session/host/include/zidl/session_stub.h"
|
||||
@ -99,11 +98,13 @@ public:
|
||||
virtual void OnBackground() {}
|
||||
virtual void OnDisconnect() {}
|
||||
virtual void OnLayoutFinished() {}
|
||||
virtual void OnRemoveBlank() {}
|
||||
virtual void OnDrawingCompleted() {}
|
||||
virtual void OnExtensionDied() {}
|
||||
virtual void OnExtensionTimeout(int32_t errorCode) {}
|
||||
virtual void OnAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
|
||||
int64_t uiExtensionIdLevel) {}
|
||||
virtual void OnAppRemoveStartingWindow() {}
|
||||
};
|
||||
|
||||
enum class LifeCycleTaskType : uint32_t {
|
||||
@ -161,6 +162,7 @@ public:
|
||||
void NotifyBackground();
|
||||
void NotifyDisconnect();
|
||||
void NotifyLayoutFinished();
|
||||
void NotifyRemoveBlank();
|
||||
void NotifyExtensionDied() override;
|
||||
void NotifyExtensionTimeout(int32_t errorCode) override;
|
||||
void NotifyTransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
|
||||
@ -288,7 +290,7 @@ public:
|
||||
sptr<ScenePersistence> GetScenePersistence() const;
|
||||
void SetParentSession(const sptr<Session>& session);
|
||||
sptr<Session> GetParentSession() const;
|
||||
sptr<Session> GetMainSession();
|
||||
sptr<Session> GetMainSession() const;
|
||||
void BindDialogToParentSession(const sptr<Session>& session);
|
||||
void RemoveDialogToParentSession(const sptr<Session>& session);
|
||||
std::vector<sptr<Session>> GetDialogVector() const;
|
||||
@ -364,6 +366,8 @@ public:
|
||||
virtual void SetSystemFocusable(bool systemFocusable); // Used by SCB
|
||||
bool GetSystemFocusable() const;
|
||||
bool CheckFocusable() const;
|
||||
void SetStartingBeforeVisible(bool isStartingBeforeVisible);
|
||||
bool GetStartingBeforeVisible() const;
|
||||
bool IsFocused() const;
|
||||
bool GetFocused() const;
|
||||
virtual WSError UpdateFocus(bool isFocused);
|
||||
@ -509,6 +513,13 @@ public:
|
||||
void SetAppInstanceKey(const std::string& appInstanceKey);
|
||||
std::string GetAppInstanceKey() const;
|
||||
|
||||
/*
|
||||
* Starting Window
|
||||
*/
|
||||
WSError RemoveStartingWindow() override;
|
||||
void SetEnableRemoveStartingWindow(bool enableRemoveStartingWindow);
|
||||
bool GetEnableRemoveStartingWindow() const;
|
||||
|
||||
protected:
|
||||
class SessionLifeCycleTask : public virtual RefBase {
|
||||
public:
|
||||
@ -735,6 +746,7 @@ private:
|
||||
bool focusedOnShow_ = true;
|
||||
std::atomic_bool systemFocusable_ = true;
|
||||
bool focusableOnShow_ = true; // if false, ignore request focus when session onAttach
|
||||
bool isStartingBeforeVisible_ = false;
|
||||
|
||||
bool showRecent_ = false;
|
||||
bool bufferAvailable_ = false;
|
||||
@ -767,6 +779,11 @@ private:
|
||||
mutable std::mutex leashWinSurfaceNodeMutex_;
|
||||
DetectTaskInfo detectTaskInfo_;
|
||||
mutable std::shared_mutex detectTaskInfoMutex_;
|
||||
|
||||
/*
|
||||
* Starting Window
|
||||
*/
|
||||
bool enableRemoveStartingWindow_ {false};
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
virtual WSError Show(sptr<WindowSessionProperty> property) = 0;
|
||||
virtual WSError Hide() = 0;
|
||||
virtual WSError DrawingCompleted() = 0;
|
||||
virtual WSError RemoveStartingWindow() = 0;
|
||||
|
||||
// scene session
|
||||
/**
|
||||
|
@ -31,6 +31,7 @@ enum class SessionInterfaceCode {
|
||||
TRANS_ID_TERMINATE,
|
||||
TRANS_ID_EXCEPTION,
|
||||
TRANS_ID_DRAWING_COMPLETED,
|
||||
TRANS_ID_APP_REMOVE_STARTING_WINDOW,
|
||||
|
||||
// Scene
|
||||
TRANS_ID_SESSION_EVENT = 100,
|
||||
|
@ -108,6 +108,11 @@ public:
|
||||
*/
|
||||
WMError SetGestureBackEnabled(bool isEnabled) override;
|
||||
|
||||
/*
|
||||
* Starting Window
|
||||
*/
|
||||
WSError RemoveStartingWindow() override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<SessionProxy> delegator_;
|
||||
};
|
||||
|
@ -40,6 +40,7 @@ private:
|
||||
int HandleShow(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleHide(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleDrawingCompleted(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleRemoveStartingWindow(MessageParcel& data, MessageParcel& reply);
|
||||
|
||||
// scene session
|
||||
int HandleSessionEvent(MessageParcel& data, MessageParcel& reply);
|
||||
|
@ -15,13 +15,8 @@
|
||||
|
||||
#include "session/host/include/main_session.h"
|
||||
|
||||
#include <ui/rs_surface_node.h>
|
||||
|
||||
#include "key_event.h"
|
||||
#include "pointer_event.h"
|
||||
#include "session_helper.h"
|
||||
#include "session/host/include/scene_persistent_storage.h"
|
||||
#include "window_manager_hilog.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <running_lock.h>
|
||||
#include "screen_manager.h"
|
||||
#include "screen.h"
|
||||
#include "singleton_container.h"
|
||||
#include "fold_screen_state_internel.h"
|
||||
#include "session/host/include/multi_instance_manager.h"
|
||||
|
||||
@ -1549,10 +1548,6 @@ void SceneSession::GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea)
|
||||
if (Session::GetFloatingScale() <= miniScale) {
|
||||
return;
|
||||
}
|
||||
if (Session::GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING &&
|
||||
rect.height_ < rect.width_) {
|
||||
return;
|
||||
}
|
||||
float vpr = 3.5f; // 3.5f: default pixel ratio
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
if (display == nullptr) {
|
||||
@ -2630,7 +2625,7 @@ void SceneSession::SetSurfaceBounds(const WSRect& rect, bool isGlobal, bool need
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LAYOUT, "rect: %{public}s", rect.ToString().c_str());
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction && needFlush) {
|
||||
if (rsTransaction != nullptr && needFlush) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
auto leashWinSurfaceNode = GetLeashWinSurfaceNode();
|
||||
@ -2665,8 +2660,7 @@ void SceneSession::SetSurfaceBounds(const WSRect& rect, bool isGlobal, bool need
|
||||
} else {
|
||||
WLOGE("SetSurfaceBounds surfaceNode is null!");
|
||||
}
|
||||
if (rsTransaction && needFlush) {
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr && needFlush) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
@ -2918,12 +2912,18 @@ void SceneSession::SetSnapshotSkip(bool isSkip)
|
||||
return;
|
||||
}
|
||||
property->SetSnapshotSkip(isSkip);
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
surfaceNode_->SetSkipLayer(isSkip);
|
||||
auto leashWinSurfaceNode = GetLeashWinSurfaceNode();
|
||||
if (leashWinSurfaceNode != nullptr) {
|
||||
leashWinSurfaceNode->SetSkipLayer(isSkip);
|
||||
}
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::SetWatermarkEnabled(const std::string& watermarkName, bool isEnabled)
|
||||
@ -2934,11 +2934,17 @@ void SceneSession::SetWatermarkEnabled(const std::string& watermarkName, bool is
|
||||
}
|
||||
TLOGI(WmsLogTag::DEFAULT, "watermarkName:%{public}s, isEnabled:%{public}d, wid:%{public}d",
|
||||
watermarkName.c_str(), isEnabled, GetPersistentId());
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
surfaceNode_->SetWatermarkEnabled(watermarkName, isEnabled);
|
||||
if (auto leashWinSurfaceNode = GetLeashWinSurfaceNode()) {
|
||||
leashWinSurfaceNode->SetWatermarkEnabled(watermarkName, isEnabled);
|
||||
}
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo)
|
||||
@ -2959,12 +2965,18 @@ void SceneSession::SetSystemSceneOcclusionAlpha(double alpha)
|
||||
}
|
||||
uint8_t alpha8bit = static_cast<uint8_t>(alpha * 255);
|
||||
WLOGFI("SetAbilityBGAlpha alpha8bit=%{public}u.", alpha8bit);
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
surfaceNode_->SetAbilityBGAlpha(alpha8bit);
|
||||
auto leashWinSurfaceNode = GetLeashWinSurfaceNode();
|
||||
if (leashWinSurfaceNode != nullptr) {
|
||||
leashWinSurfaceNode->SetAbilityBGAlpha(alpha8bit);
|
||||
}
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::SetSystemSceneForceUIFirst(bool forceUIFirst)
|
||||
@ -2976,8 +2988,7 @@ void SceneSession::SetSystemSceneForceUIFirst(bool forceUIFirst)
|
||||
return;
|
||||
}
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction) {
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
if (leashWinSurfaceNode != nullptr) {
|
||||
@ -2989,7 +3000,7 @@ void SceneSession::SetSystemSceneForceUIFirst(bool forceUIFirst)
|
||||
surfaceNode_->GetName().c_str(), surfaceNode_->GetId(), forceUIFirst);
|
||||
surfaceNode_->SetForceUIFirst(forceUIFirst);
|
||||
}
|
||||
if (rsTransaction) {
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
@ -3065,8 +3076,8 @@ bool SceneSession::IsSystemSessionAboveApp() const
|
||||
void SceneSession::NotifyIsCustomAnimationPlaying(bool isPlaying)
|
||||
{
|
||||
WLOGFI("id %{public}d %{public}u", GetPersistentId(), isPlaying);
|
||||
if (sessionChangeCallback_ != nullptr && sessionChangeCallback_->onIsCustomAnimationPlaying_) {
|
||||
sessionChangeCallback_->onIsCustomAnimationPlaying_(isPlaying);
|
||||
if (onIsCustomAnimationPlaying_) {
|
||||
onIsCustomAnimationPlaying_(isPlaying);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3586,7 +3597,6 @@ static bool IsNeedSystemPermissionByAction(WSPropertyChangeAction action,
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS:
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_TOPMOST:
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE:
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED:
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED:
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO:
|
||||
return true;
|
||||
@ -3986,11 +3996,6 @@ WMError SceneSession::HandleActionUpdateWindowLimits(const sptr<WindowSessionPro
|
||||
WMError SceneSession::HandleActionUpdateDragenabled(const sptr<WindowSessionProperty>& property,
|
||||
WSPropertyChangeAction action)
|
||||
{
|
||||
if (!property->GetSystemCalling()) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "Update property dragEnabled permission denied!");
|
||||
return WMError::WM_ERROR_NOT_SYSTEM_APP;
|
||||
}
|
||||
|
||||
auto sessionProperty = GetSessionProperty();
|
||||
if (sessionProperty != nullptr) {
|
||||
sessionProperty->SetDragEnabled(property->GetDragEnabled());
|
||||
@ -4524,9 +4529,13 @@ WSError SceneSession::SetAutoStartPiP(bool isAutoStart)
|
||||
|
||||
void SceneSession::SendPointerEventToUI(std::shared_ptr<MMI::PointerEvent> pointerEvent)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(pointerEventMutex_);
|
||||
if (systemSessionPointerEventFunc_ != nullptr) {
|
||||
systemSessionPointerEventFunc_(pointerEvent);
|
||||
NotifySystemSessionPointerEventFunc systemSessionPointerEventFunc = nullptr;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(pointerEventMutex_);
|
||||
systemSessionPointerEventFunc = systemSessionPointerEventFunc_;
|
||||
}
|
||||
if (systemSessionPointerEventFunc != nullptr) {
|
||||
systemSessionPointerEventFunc(pointerEvent);
|
||||
} else {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "PointerEventFunc_ nullptr, id:%{public}d", pointerEvent->GetId());
|
||||
pointerEvent->MarkProcessed();
|
||||
@ -4535,9 +4544,13 @@ void SceneSession::SendPointerEventToUI(std::shared_ptr<MMI::PointerEvent> point
|
||||
|
||||
bool SceneSession::SendKeyEventToUI(std::shared_ptr<MMI::KeyEvent> keyEvent, bool isPreImeEvent)
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(keyEventMutex_);
|
||||
if (systemSessionKeyEventFunc_ != nullptr) {
|
||||
return systemSessionKeyEventFunc_(keyEvent, isPreImeEvent);
|
||||
NotifySystemSessionKeyEventFunc systemSessionKeyEventFunc = nullptr;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(keyEventMutex_);
|
||||
systemSessionKeyEventFunc = systemSessionKeyEventFunc_;
|
||||
}
|
||||
if (systemSessionKeyEventFunc != nullptr) {
|
||||
return systemSessionKeyEventFunc(keyEvent, isPreImeEvent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -4727,10 +4740,9 @@ WSError SceneSession::OnLayoutFullScreenChange(bool isLayoutFullScreen)
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "session is null");
|
||||
return WSError::WS_ERROR_DESTROYED_OBJECT;
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "OnLayoutFullScreenChange, isLayoutFullScreen: %{public}d",
|
||||
isLayoutFullScreen);
|
||||
if (session->sessionChangeCallback_ && session->sessionChangeCallback_->onLayoutFullScreenChangeFunc_) {
|
||||
session->sessionChangeCallback_->onLayoutFullScreenChangeFunc_(isLayoutFullScreen);
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "isLayoutFullScreen: %{public}d", isLayoutFullScreen);
|
||||
if (session->onLayoutFullScreenChangeFunc_) {
|
||||
session->onLayoutFullScreenChangeFunc_(isLayoutFullScreen);
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
};
|
||||
@ -4824,12 +4836,18 @@ void SceneSession::SetSkipDraw(bool skip)
|
||||
WLOGFE("surfaceNode_ is null");
|
||||
return;
|
||||
}
|
||||
auto rsTransaction = RSTransactionProxy::GetInstance();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Begin();
|
||||
}
|
||||
surfaceNode_->SetSkipDraw(skip);
|
||||
auto leashWinSurfaceNode = GetLeashWinSurfaceNode();
|
||||
if (leashWinSurfaceNode != nullptr) {
|
||||
leashWinSurfaceNode->SetSkipDraw(skip);
|
||||
}
|
||||
RSTransaction::FlushImplicitTransaction();
|
||||
if (rsTransaction != nullptr) {
|
||||
rsTransaction->Commit();
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSession::SetSkipSelfWhenShowOnVirtualScreen(bool isSkip)
|
||||
@ -4963,6 +4981,32 @@ void SceneSession::RegisterBindDialogSessionCallback(NotifyBindDialogSessionFunc
|
||||
PostTask(task, __func__);
|
||||
}
|
||||
|
||||
void SceneSession::RegisterIsCustomAnimationPlayingCallback(NotifyIsCustomAnimationPlayingCallback&& callback)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), callback = std::move(callback)] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_LIFE, "session is null");
|
||||
return;
|
||||
}
|
||||
session->onIsCustomAnimationPlaying_ = std::move(callback);
|
||||
};
|
||||
PostTask(task, __func__);
|
||||
}
|
||||
|
||||
void SceneSession::RegisterLayoutFullScreenChangeCallback(NotifyLayoutFullScreenChangeFunc&& callback)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), callback = std::move(callback)] {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
TLOGNE(WmsLogTag::WMS_LAYOUT, "session is null");
|
||||
return;
|
||||
}
|
||||
session->onLayoutFullScreenChangeFunc_ = std::move(callback);
|
||||
};
|
||||
PostTask(task, __func__);
|
||||
}
|
||||
|
||||
WMError SceneSession::GetAppForceLandscapeConfig(AppForceLandscapeConfig& config)
|
||||
{
|
||||
if (forceSplitFunc_ == nullptr) {
|
||||
@ -5275,12 +5319,10 @@ void SceneSession::UnregisterSessionChangeListeners()
|
||||
session->sessionChangeCallback_->onSessionModalTypeChange_ = nullptr;
|
||||
session->sessionChangeCallback_->onRaiseToTop_ = nullptr;
|
||||
session->sessionChangeCallback_->OnSessionEvent_ = nullptr;
|
||||
session->sessionChangeCallback_->onIsCustomAnimationPlaying_ = nullptr;
|
||||
session->sessionChangeCallback_->onWindowAnimationFlagChange_ = nullptr;
|
||||
session->sessionChangeCallback_->onRaiseAboveTarget_ = nullptr;
|
||||
session->sessionChangeCallback_->OnTouchOutside_ = nullptr;
|
||||
session->sessionChangeCallback_->onSetLandscapeMultiWindowFunc_ = nullptr;
|
||||
session->sessionChangeCallback_->onLayoutFullScreenChangeFunc_ = nullptr;
|
||||
}
|
||||
session->Session::UnregisterSessionChangeListeners();
|
||||
};
|
||||
|
@ -16,9 +16,7 @@
|
||||
#include "session/host/include/session.h"
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "ability_start_setting.h"
|
||||
#include "input_manager.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "key_event.h"
|
||||
#include "pointer_event.h"
|
||||
#include <transaction/rs_interfaces.h>
|
||||
@ -29,15 +27,12 @@
|
||||
#include "common/include/session_permission.h"
|
||||
#include "session_helper.h"
|
||||
#include "surface_capture_future.h"
|
||||
#include "util.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "parameters.h"
|
||||
#include <hisysevent.h>
|
||||
#include "hitrace_meter.h"
|
||||
#include "screen_session_manager_client/include/screen_session_manager_client.h"
|
||||
#include "session/host/include/ws_ffrt_helper.h"
|
||||
#include "singleton_container.h"
|
||||
#include "perform_reporter.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
@ -45,6 +40,7 @@ namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "Session" };
|
||||
std::atomic<int32_t> g_persistentId = INVALID_SESSION_ID;
|
||||
std::set<int32_t> g_persistentIdSet;
|
||||
std::mutex g_persistentIdSetMutex;
|
||||
constexpr float INNER_BORDER_VP = 5.0f;
|
||||
constexpr float OUTSIDE_BORDER_VP = 4.0f;
|
||||
constexpr float INNER_ANGLE_VP = 16.0f;
|
||||
@ -106,7 +102,7 @@ Session::~Session()
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "id:%{public}d", GetPersistentId());
|
||||
if (mainHandler_) {
|
||||
mainHandler_->PostTask([surfaceNode = std::move(surfaceNode_)]() mutable {
|
||||
mainHandler_->PostTask([surfaceNode = std::move(surfaceNode_)]() {
|
||||
// do nothing
|
||||
});
|
||||
}
|
||||
@ -423,6 +419,16 @@ void Session::NotifyLayoutFinished()
|
||||
}
|
||||
}
|
||||
|
||||
void Session::NotifyRemoveBlank()
|
||||
{
|
||||
auto lifecycleListeners = GetListeners<ILifecycleListener>();
|
||||
for (auto& listener : lifecycleListeners) {
|
||||
if (auto listenerPtr = listener.lock()) {
|
||||
listenerPtr->OnRemoveBlank();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Session::NotifyExtensionDied()
|
||||
{
|
||||
if (!SessionPermission::IsSystemCalling()) {
|
||||
@ -623,6 +629,16 @@ bool Session::IsFocusedOnShow() const
|
||||
return focusedOnShow_;
|
||||
}
|
||||
|
||||
void Session::SetStartingBeforeVisible(bool isStartingBeforeVisible)
|
||||
{
|
||||
isStartingBeforeVisible_ = isStartingBeforeVisible;
|
||||
}
|
||||
|
||||
bool Session::GetStartingBeforeVisible() const
|
||||
{
|
||||
return isStartingBeforeVisible_;
|
||||
}
|
||||
|
||||
WSError Session::SetTouchable(bool touchable)
|
||||
{
|
||||
SetSystemTouchable(touchable);
|
||||
@ -1216,6 +1232,7 @@ WSError Session::Background(bool isFromClient, const std::string& identityToken)
|
||||
isActive_ = false;
|
||||
}
|
||||
isStarting_ = false;
|
||||
isStartingBeforeVisible_ = false;
|
||||
if (state != SessionState::STATE_INACTIVE) {
|
||||
TLOGW(WmsLogTag::WMS_LIFE, "Background state invalid! id: %{public}d, state: %{public}u",
|
||||
GetPersistentId(), state);
|
||||
@ -1248,6 +1265,7 @@ WSError Session::Disconnect(bool isFromClient, const std::string& identityToken)
|
||||
TLOGI(WmsLogTag::WMS_LIFE, "Disconnect session, id: %{public}d, state: %{public}u", GetPersistentId(), state);
|
||||
isActive_ = false;
|
||||
isStarting_ = false;
|
||||
isStartingBeforeVisible_ = false;
|
||||
bufferAvailable_ = false;
|
||||
isNeedSyncSessionRect_ = true;
|
||||
if (mainHandler_) {
|
||||
@ -1292,6 +1310,17 @@ WSError Session::DrawingCompleted()
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError Session::RemoveStartingWindow()
|
||||
{
|
||||
auto lifecycleListeners = GetListeners<ILifecycleListener>();
|
||||
for (auto& listener : lifecycleListeners) {
|
||||
if (auto listenerPtr = listener.lock()) {
|
||||
listenerPtr->OnAppRemoveStartingWindow();
|
||||
}
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError Session::SetActive(bool active)
|
||||
{
|
||||
SessionState state = GetSessionState();
|
||||
@ -1739,10 +1768,10 @@ sptr<Session> Session::GetParentSession() const
|
||||
return parentSession_;
|
||||
}
|
||||
|
||||
sptr<Session> Session::GetMainSession()
|
||||
sptr<Session> Session::GetMainSession() const
|
||||
{
|
||||
if (SessionHelper::IsMainWindow(GetWindowType())) {
|
||||
return this;
|
||||
return const_cast<Session*>(this);
|
||||
} else if (parentSession_) {
|
||||
return parentSession_->GetMainSession();
|
||||
} else {
|
||||
@ -2793,6 +2822,16 @@ WSRect Session::GetClientRect() const
|
||||
return clientRect_;
|
||||
}
|
||||
|
||||
void Session::SetEnableRemoveStartingWindow(bool enableRemoveStartingWindow)
|
||||
{
|
||||
enableRemoveStartingWindow_ = enableRemoveStartingWindow;
|
||||
}
|
||||
|
||||
bool Session::GetEnableRemoveStartingWindow() const
|
||||
{
|
||||
return enableRemoveStartingWindow_;
|
||||
}
|
||||
|
||||
WindowType Session::GetWindowType() const
|
||||
{
|
||||
auto property = GetSessionProperty();
|
||||
@ -2843,6 +2882,7 @@ WSError Session::ProcessBackEvent()
|
||||
|
||||
void Session::GeneratePersistentId(bool isExtension, int32_t persistentId)
|
||||
{
|
||||
std::lock_guard lock(g_persistentIdSetMutex);
|
||||
if (persistentId != INVALID_SESSION_ID && !g_persistentIdSet.count(persistentId)) {
|
||||
g_persistentIdSet.insert(persistentId);
|
||||
persistentId_ = persistentId;
|
||||
|
@ -205,8 +205,9 @@ bool SubSession::IsModal() const
|
||||
|
||||
bool SubSession::IsVisibleForeground() const
|
||||
{
|
||||
if (parentSession_ && WindowHelper::IsMainWindow(parentSession_->GetWindowType())) {
|
||||
return parentSession_->IsVisibleForeground() && Session::IsVisibleForeground();
|
||||
const auto& mainSession = GetMainSession();
|
||||
if (mainSession && WindowHelper::IsMainWindow(mainSession->GetWindowType())) {
|
||||
return mainSession->IsVisibleForeground() && Session::IsVisibleForeground();
|
||||
}
|
||||
return Session::IsVisibleForeground();
|
||||
}
|
||||
|
@ -337,6 +337,28 @@ WSError SessionProxy::DrawingCompleted()
|
||||
return static_cast<WSError>(reply.ReadInt32());
|
||||
}
|
||||
|
||||
WSError SessionProxy::RemoveStartingWindow()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "WriteInterfaceToken failed");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "remote is null");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_APP_REMOVE_STARTING_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
TLOGE(WmsLogTag::WMS_LIFE, "SendRequest failed");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
return static_cast<WSError>(reply.ReadInt32());
|
||||
}
|
||||
|
||||
WSError SessionProxy::ChangeSessionVisibilityWithStatusBar(sptr<AAFwk::SessionInfo> abilitySessionInfo, bool visible)
|
||||
{
|
||||
if (abilitySessionInfo == nullptr) {
|
||||
|
@ -104,6 +104,8 @@ int SessionStub::ProcessRemoteRequest(uint32_t code, MessageParcel& data, Messag
|
||||
return HandleHide(data, reply);
|
||||
case static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_DRAWING_COMPLETED):
|
||||
return HandleDrawingCompleted(data, reply);
|
||||
case static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_APP_REMOVE_STARTING_WINDOW):
|
||||
return HandleRemoveStartingWindow(data, reply);
|
||||
case static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_UPDATE_RECTCHANGE_LISTENER_REGISTERED):
|
||||
return HandleUpdateRectChangeListenerRegistered(data, reply);
|
||||
case static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_SESSION_EVENT):
|
||||
@ -402,6 +404,14 @@ int SessionStub::HandleDrawingCompleted(MessageParcel& data, MessageParcel& repl
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int SessionStub::HandleRemoveStartingWindow(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_LIFE, "Called!");
|
||||
WSError errCode = RemoveStartingWindow();
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int SessionStub::HandleSessionEvent(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
uint32_t eventId = 0;
|
||||
|
@ -233,6 +233,7 @@ public:
|
||||
bool UpdateAvailableArea(DMRect area);
|
||||
void SetFoldScreen(bool isFold);
|
||||
void UpdateRotationAfterBoot(bool foldToExpand);
|
||||
void UpdateValidRotationToScb();
|
||||
std::shared_ptr<Media::PixelMap> GetScreenSnapshot(float scaleX, float scaleY);
|
||||
void SetDefaultDeviceRotationOffset(uint32_t defaultRotationOffset);
|
||||
|
||||
@ -258,6 +259,7 @@ private:
|
||||
std::function<void(float, float)> updateScreenPivotCallback_ = nullptr;
|
||||
bool isFold_ = false;
|
||||
float currentSensorRotation_ { -1.0f };
|
||||
float currentValidSensorRotation_ { -1.0f };
|
||||
std::vector<uint32_t> hdrFormats_;
|
||||
std::vector<uint32_t> colorSpaces_;
|
||||
MirrorScreenType mirrorScreenType_ { MirrorScreenType::VIRTUAL_MIRROR };
|
||||
|
@ -480,8 +480,9 @@ void ScreenSession::SensorRotationChange(Rotation sensorRotation)
|
||||
void ScreenSession::SensorRotationChange(float sensorRotation)
|
||||
{
|
||||
if (sensorRotation >= 0.0f) {
|
||||
currentSensorRotation_ = sensorRotation;
|
||||
currentValidSensorRotation_ = sensorRotation;
|
||||
}
|
||||
currentSensorRotation_ = sensorRotation;
|
||||
for (auto& listener : screenChangeListenerList_) {
|
||||
listener->OnSensorRotationChange(sensorRotation, screenId_);
|
||||
}
|
||||
@ -677,6 +678,12 @@ void ScreenSession::UpdateRotationAfterBoot(bool foldToExpand)
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSession::UpdateValidRotationToScb()
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "Rotation: %{public}f", currentValidSensorRotation_);
|
||||
SensorRotationChange(currentValidSensorRotation_);
|
||||
}
|
||||
|
||||
sptr<SupportedScreenModes> ScreenSession::GetActiveScreenMode() const
|
||||
{
|
||||
if (activeIdx_ < 0 || activeIdx_ >= static_cast<int32_t>(modes_.size())) {
|
||||
|
@ -108,17 +108,20 @@ ohos_shared_library("scene_session_manager") {
|
||||
"ability_runtime:ability_deps_wrapper",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:ability_start_setting",
|
||||
"ability_runtime:app_context",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"ability_runtime:session_handler",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"bundle_framework:libappexecfwk_common",
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
@ -130,7 +133,9 @@ ohos_shared_library("scene_session_manager") {
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
"preferences:native_preferences",
|
||||
"resource_management:global_resmgr",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
@ -226,6 +231,7 @@ ohos_shared_library("session_manager") {
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:librender_service_base",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image_native",
|
||||
|
@ -21,6 +21,12 @@
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
#ifndef OHOS_BUILD_ENABLE_SECURITY_COMPONENT // pointer_envent.h
|
||||
#define OHOS_BUILD_ENABLE_SECURITY_COMPONENT
|
||||
#endif
|
||||
#ifndef SUPPORT_SCREEN
|
||||
#define SUPPORT_SCREEN
|
||||
#endif
|
||||
#include "mission_snapshot.h"
|
||||
#include "transaction/rs_interfaces.h"
|
||||
|
||||
@ -460,12 +466,6 @@ public:
|
||||
*/
|
||||
void RefreshPcZOrderList(uint32_t startZOrder, std::vector<int32_t>&& persistentIds);
|
||||
|
||||
/*
|
||||
* PiP Window
|
||||
*/
|
||||
WMError CloseTargetPiPWindow(const std::string& bundleName);
|
||||
WMError GetCurrentPiPWindowInfo(std::string& bundleName);
|
||||
|
||||
/*
|
||||
* Window Watermark
|
||||
*/
|
||||
@ -491,6 +491,12 @@ public:
|
||||
*/
|
||||
WMError ReleaseForegroundSessionScreenLock() override;
|
||||
|
||||
/*
|
||||
* PiP Window
|
||||
*/
|
||||
WMError CloseTargetPiPWindow(const std::string& bundleName);
|
||||
WMError GetCurrentPiPWindowInfo(std::string& bundleName);
|
||||
|
||||
/*
|
||||
* Window displayId
|
||||
*/
|
||||
@ -598,6 +604,7 @@ private:
|
||||
bool MissionChanged(sptr<SceneSession>& prevSession, sptr<SceneSession>& currSession);
|
||||
std::string GetAllSessionFocusInfo();
|
||||
void RegisterRequestFocusStatusNotifyManagerFunc(sptr<SceneSession>& sceneSession);
|
||||
void ProcessUpdateLastFocusedAppId(const std::vector<uint32_t>& zOrderList);
|
||||
|
||||
void RegisterGetStateFromManagerFunc(sptr<SceneSession>& sceneSession);
|
||||
void RegisterSessionChangeByActionNotifyManagerFunc(sptr<SceneSession>& sceneSession);
|
||||
@ -624,6 +631,7 @@ private:
|
||||
void UpdateNormalSessionAvoidArea(const int32_t& persistentId, sptr<SceneSession>& sceneSession, bool& needUpdate);
|
||||
void UpdateAvoidArea(int32_t persistentId);
|
||||
void UpdateAvoidAreaByType(int32_t persistentId, AvoidAreaType type);
|
||||
void UpdateDarkColorModeToRS();
|
||||
WSError IsLastFrameLayoutFinished(bool& isLayoutFinished);
|
||||
void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property,
|
||||
const sptr<SceneSession>& sceneSession);
|
||||
@ -981,7 +989,12 @@ private:
|
||||
/*
|
||||
* Screen Manager
|
||||
*/
|
||||
bool IsInSecondaryScreen(const sptr<SceneSession>& sceneSession);
|
||||
bool IsInDefaultScreen(const sptr<SceneSession>& sceneSession);
|
||||
|
||||
/*
|
||||
* Window Mode Type
|
||||
*/
|
||||
bool IsNeedSkipWindowModeTypeCheck(const sptr<SceneSession>& sceneSession, bool isSmallFold);
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "pixel_map.h"
|
||||
#ifndef SUPPORT_SCREEN
|
||||
#define SUPPORT_SCREEN
|
||||
#endif
|
||||
#include "mission_listener_interface.h"
|
||||
#include "ws_common.h"
|
||||
|
||||
|
@ -158,13 +158,14 @@ std::string DumpTransformInDisplayInfo(const std::vector<float>& transform)
|
||||
|
||||
std::string DumpDisplayInfo(const MMI::DisplayInfo& info)
|
||||
{
|
||||
std::string infoStr = "DisplayInfo: ";
|
||||
infoStr = infoStr + " id: " + std::to_string(info.id) + " x: " + std::to_string(info.x) +
|
||||
"y: " + std::to_string(info.y) + " width: " + std::to_string(info.width) +
|
||||
"height: " + std::to_string(info.height) + " dpi: " + std::to_string(info.dpi) + " name:" + info.name +
|
||||
" uniq: " + info.uniq + " displayMode: " + std::to_string(static_cast<int>(info.displayMode)) +
|
||||
" direction: " + std::to_string(static_cast<int>(info.direction)) +
|
||||
" transform: " + DumpTransformInDisplayInfo(info.transform);
|
||||
std::ostringstream infoStream("DisplayInfo: ");
|
||||
infoStream << " id: " << info.id << " x: " << info.x << " y: " << info.y
|
||||
<< " width: " << info.width << " height: " << info.height << " dpi: " << info.dpi
|
||||
<< " name: " << info.name << " uniq: " << info.uniq
|
||||
<< " displayMode: " << static_cast<int>(info.displayMode)
|
||||
<< " direction: " << static_cast<int>(info.direction)
|
||||
<< " transform: " << DumpTransformInDisplayInfo(info.transform);
|
||||
std::string infoStr = infoStream.str();
|
||||
return infoStr;
|
||||
}
|
||||
} //namespace
|
||||
@ -399,7 +400,7 @@ void DumpUIExtentionWindowInfo(const MMI::WindowInfo& windowInfo)
|
||||
void SceneInputManager::PrintWindowInfo(const std::vector<MMI::WindowInfo>& windowInfoList)
|
||||
{
|
||||
int windowListSize = static_cast<int>(windowInfoList.size());
|
||||
std::string idList;
|
||||
std::ostringstream idListStream;
|
||||
static std::string lastIdList;
|
||||
static uint32_t windowEventID = 0;
|
||||
if (windowEventID == UINT32_MAX) {
|
||||
@ -409,22 +410,18 @@ void SceneInputManager::PrintWindowInfo(const std::vector<MMI::WindowInfo>& wind
|
||||
std::unordered_map<int32_t, MMI::Rect> currWindowDefaultHotArea;
|
||||
static std::unordered_map<int32_t, MMI::Rect> lastWindowDefaultHotArea;
|
||||
for (auto& e : windowInfoList) {
|
||||
idList += std::to_string(e.id) + "|" + std::to_string(e.flags) + "|" +
|
||||
std::to_string(static_cast<int32_t>(e.zOrder)) + "|" +
|
||||
std::to_string(e.pid) + "|" +
|
||||
std::to_string(e.defaultHotAreas.size());
|
||||
idListStream << e.id << "|" << e.flags << "|" << static_cast<int32_t>(e.zOrder) << "|"
|
||||
<< e.pid << "|" << e.defaultHotAreas.size();
|
||||
|
||||
if (e.defaultHotAreas.size() > 0) {
|
||||
auto iter = lastWindowDefaultHotArea.find(e.id);
|
||||
if (iter == lastWindowDefaultHotArea.end() || iter->second != e.defaultHotAreas[0]) {
|
||||
idList += "|" + std::to_string(e.defaultHotAreas[0].x) + "|" +
|
||||
std::to_string(e.defaultHotAreas[0].y) + "|" +
|
||||
std::to_string(e.defaultHotAreas[0].width) + "|" +
|
||||
std::to_string(e.defaultHotAreas[0].height);
|
||||
idListStream << "|" << e.defaultHotAreas[0].x << "|" << e.defaultHotAreas[0].y
|
||||
<< "|" << e.defaultHotAreas[0].width << "|" << e.defaultHotAreas[0].height;
|
||||
}
|
||||
currWindowDefaultHotArea.insert({e.id, e.defaultHotAreas[0]});
|
||||
}
|
||||
idList += ",";
|
||||
idListStream << ",";
|
||||
if ((focusedSessionId_ == e.id) && (e.id == e.agentWindowId)) {
|
||||
UpdateFocusedSessionId(focusedSessionId_);
|
||||
}
|
||||
@ -433,7 +430,8 @@ void SceneInputManager::PrintWindowInfo(const std::vector<MMI::WindowInfo>& wind
|
||||
}
|
||||
}
|
||||
lastWindowDefaultHotArea = currWindowDefaultHotArea;
|
||||
idList += std::to_string(focusedSessionId_);
|
||||
idListStream << focusedSessionId_;
|
||||
std::string idList = idListStream.str();
|
||||
if (lastIdList != idList) {
|
||||
windowEventID++;
|
||||
TLOGI(WmsLogTag::WMS_EVENT, "eid:%{public}d,size:%{public}d,idList:%{public}s",
|
||||
@ -445,19 +443,17 @@ void SceneInputManager::PrintWindowInfo(const std::vector<MMI::WindowInfo>& wind
|
||||
void SceneInputManager::PrintDisplayInfo(const std::vector<MMI::DisplayInfo>& displayInfos)
|
||||
{
|
||||
int displayListSize = static_cast<int>(displayInfos.size());
|
||||
std::string displayList = "";
|
||||
std::ostringstream displayListStream;
|
||||
static std::string lastDisplayList = "";
|
||||
for (auto& displayInfo : displayInfos) {
|
||||
displayList += std::to_string(displayInfo.id) + "|" +
|
||||
std::to_string(displayInfo.x) + "|" +
|
||||
std::to_string(displayInfo.y) + "|" +
|
||||
std::to_string(displayInfo.width) + "|" +
|
||||
std::to_string(displayInfo.height) + "|" +
|
||||
std::to_string(static_cast<int32_t>(displayInfo.direction)) + "|" +
|
||||
std::to_string(static_cast<int32_t>(displayInfo.displayDirection)) + "|" +
|
||||
std::to_string(static_cast<int32_t>(displayInfo.displayMode));
|
||||
displayList += ",";
|
||||
displayListStream << displayInfo.id << "|" << displayInfo.x << "|" << displayInfo.y << "|"
|
||||
<< displayInfo.width << "|" << displayInfo.height << "|"
|
||||
<< static_cast<int32_t>(displayInfo.direction) << "|"
|
||||
<< static_cast<int32_t>(displayInfo.displayDirection) << "|"
|
||||
<< static_cast<int32_t>(displayInfo.displayMode) << ",";
|
||||
}
|
||||
|
||||
std::string displayList = displayListStream.str();
|
||||
if (lastDisplayList != displayList) {
|
||||
TLOGI(WmsLogTag::WMS_EVENT, "num:%{public}d,displayList:%{public}s", displayListSize, displayList.c_str());
|
||||
lastDisplayList = displayList;
|
||||
|
@ -871,20 +871,23 @@ void DumpSecSurfaceInfoMap(const std::map<uint64_t, std::vector<SecSurfaceInfo>>
|
||||
void SceneSessionDirtyManager::UpdateSecSurfaceInfo(const std::map<uint64_t,
|
||||
std::vector<SecSurfaceInfo>>& secSurfaceInfoMap)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(secSurfaceInfoMutex_);
|
||||
if (secSurfaceInfoMap.size() != secSurfaceInfoMap_.size() || secSurfaceInfoMap_ != secSurfaceInfoMap) {
|
||||
secSurfaceInfoMap_ = secSurfaceInfoMap;
|
||||
bool updateSecSurfaceInfoNeeded = false;
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(secSurfaceInfoMutex_);
|
||||
if (secSurfaceInfoMap_ != secSurfaceInfoMap) {
|
||||
secSurfaceInfoMap_ = secSurfaceInfoMap;
|
||||
updateSecSurfaceInfoNeeded = true;
|
||||
}
|
||||
}
|
||||
if (updateSecSurfaceInfoNeeded) {
|
||||
ResetFlushWindowInfoTask();
|
||||
DumpSecSurfaceInfoMap(secSurfaceInfoMap_);
|
||||
DumpSecSurfaceInfoMap(secSurfaceInfoMap);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<MMI::WindowInfo> SceneSessionDirtyManager::GetSecSurfaceWindowinfoList(
|
||||
const sptr<SceneSession>& sceneSession, const MMI::WindowInfo& hostWindowinfo, const Matrix3f& hostTransform) const
|
||||
{
|
||||
if (secSurfaceInfoMap_.size() == 0) {
|
||||
return {};
|
||||
}
|
||||
if (sceneSession == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "sceneSession is nullptr");
|
||||
return {};
|
||||
|
@ -15,11 +15,9 @@
|
||||
|
||||
#include "session_manager/include/scene_session_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <securec.h>
|
||||
|
||||
#include <ability_context.h>
|
||||
#include <ability_manager_client.h>
|
||||
#include <application_context.h>
|
||||
#include <bundlemgr/launcher_service.h>
|
||||
#include <hisysevent.h>
|
||||
#include <parameters.h>
|
||||
@ -62,10 +60,8 @@
|
||||
#include "perform_reporter.h"
|
||||
#include "dms_reporter.h"
|
||||
#include "res_sched_client.h"
|
||||
#include "res_type.h"
|
||||
#include "anomaly_detection.h"
|
||||
#include "hidump_controller.h"
|
||||
#include "window_pid_visibility_info.h"
|
||||
#include "session/host/include/multi_instance_manager.h"
|
||||
|
||||
#ifdef MEMMGR_WINDOW_ENABLE
|
||||
@ -123,6 +119,7 @@ const std::string ARG_DUMP_DETAIL = "-c";
|
||||
constexpr uint64_t NANO_SECOND_PER_SEC = 1000000000; // ns
|
||||
const int32_t LOGICAL_DISPLACEMENT_32 = 32;
|
||||
constexpr int32_t GET_TOP_WINDOW_DELAY = 100;
|
||||
constexpr char SMALL_FOLD_PRODUCT_TYPE = '2';
|
||||
|
||||
constexpr int32_t FFRT_USER_INTERACTIVE_MAX_THREAD_NUM = 5;
|
||||
|
||||
@ -168,22 +165,24 @@ bool GetSingleIntItem(const WindowSceneConfig::ConfigItem& item, int32_t& value)
|
||||
return false;
|
||||
}
|
||||
|
||||
int ConfigFfrtWorkerNum()
|
||||
{
|
||||
ffrt_worker_num_param qosConfig;
|
||||
(void)memset_s(&qosConfig, sizeof(qosConfig), -1, sizeof(qosConfig));
|
||||
qosConfig.effectLen = 1;
|
||||
qosConfig.qosConfigArray[0].qos = ffrt_qos_user_interactive;
|
||||
qosConfig.qosConfigArray[0].hardLimit = FFRT_USER_INTERACTIVE_MAX_THREAD_NUM;
|
||||
return ffrt_set_qos_worker_num(&qosConfig);
|
||||
}
|
||||
|
||||
int32_t GetPid()
|
||||
{
|
||||
static int32_t pid = static_cast<int32_t>(getpid());
|
||||
return pid;
|
||||
}
|
||||
|
||||
bool GetEnableRemoveStartingWindowFromBMS(const std::shared_ptr<AppExecFwk::AbilityInfo>& abilityInfo)
|
||||
{
|
||||
auto& metadata = abilityInfo->metadata;
|
||||
for (const auto& item : metadata) {
|
||||
if (item.name == "enable.remove.starting.window") {
|
||||
return item.value == "true";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class BundleStatusCallback : public IRemoteStub<AppExecFwk::IBundleStatusCallback> {
|
||||
public:
|
||||
BundleStatusCallback() = default;
|
||||
@ -270,7 +269,7 @@ void SceneSessionManager::Init()
|
||||
}
|
||||
taskScheduler_->SetExportHandler(eventHandler_);
|
||||
|
||||
ret = ConfigFfrtWorkerNum();
|
||||
ret = ffrt_set_cpu_worker_max_num(ffrt_qos_user_interactive, FFRT_USER_INTERACTIVE_MAX_THREAD_NUM);
|
||||
TLOGI(WmsLogTag::WMS_MAIN, "FFRT user interactive qos max thread number: %{public}d, retcode: %{public}d",
|
||||
FFRT_USER_INTERACTIVE_MAX_THREAD_NUM, ret);
|
||||
|
||||
@ -299,6 +298,7 @@ void SceneSessionManager::Init()
|
||||
MultiInstanceManager::GetInstance().SetCurrentUserId(currentUserId_);
|
||||
}
|
||||
InitVsyncStation();
|
||||
UpdateDarkColorModeToRS();
|
||||
}
|
||||
|
||||
void SceneSessionManager::InitVsyncStation()
|
||||
@ -1776,8 +1776,8 @@ sptr<AAFwk::SessionInfo> SceneSessionManager::SetAbilitySessionInfo(const sptr<S
|
||||
static_cast<int>(sessionProperty->GetDisplayId()));
|
||||
}
|
||||
abilitySessionInfo->instanceKey = sessionInfo.appInstanceKey_;
|
||||
if (sessionInfo.callState_ >= static_cast<int32_t>(AAFwk::CallToState::UNKNOW) &&
|
||||
sessionInfo.callState_ <= static_cast<int32_t>(AAFwk::CallToState::BACKGROUND)) {
|
||||
if (sessionInfo.callState_ >= static_cast<uint32_t>(AAFwk::CallToState::UNKNOW) &&
|
||||
sessionInfo.callState_ <= static_cast<uint32_t>(AAFwk::CallToState::BACKGROUND)) {
|
||||
abilitySessionInfo->state = static_cast<AAFwk::CallToState>(sessionInfo.callState_);
|
||||
} else {
|
||||
TLOGW(WmsLogTag::WMS_LIFE, "Invalid callState:%{public}d", sessionInfo.callState_);
|
||||
@ -1911,6 +1911,7 @@ WSError SceneSessionManager::RequestSceneSessionActivationInner(
|
||||
RequestInputMethodCloseKeyboard(persistentId);
|
||||
if (WindowHelper::IsMainWindow(sceneSession->GetWindowType())) {
|
||||
sceneSession->SetIsStarting(true);
|
||||
sceneSession->SetStartingBeforeVisible(true);
|
||||
}
|
||||
if (WindowHelper::IsMainWindow(sceneSession->GetWindowType()) && sceneSession->IsFocusedOnShow()) {
|
||||
if (Session::IsScbCoreEnabled()) {
|
||||
@ -2188,7 +2189,7 @@ void SceneSessionManager::EraseSceneSessionMapById(int32_t persistentId)
|
||||
EraseSceneSessionAndMarkDirtyLockFree(persistentId);
|
||||
systemTopSceneSessionMap_.erase(persistentId);
|
||||
nonSystemFloatSceneSessionMap_.erase(persistentId);
|
||||
if (MultiInstanceManager::IsSupportMultiInstance(systemConfig_) &&
|
||||
if (sceneSession && MultiInstanceManager::IsSupportMultiInstance(systemConfig_) &&
|
||||
MultiInstanceManager::GetInstance().IsMultiInstance(sceneSession->GetSessionInfo().bundleName_)) {
|
||||
MultiInstanceManager::GetInstance().DecreaseInstanceKeyRefCount(sceneSession);
|
||||
}
|
||||
@ -2385,7 +2386,7 @@ WSError SceneSessionManager::CreateAndConnectSpecificSession(const sptr<ISession
|
||||
TLOGE(WmsLogTag::WMS_UIEXT, "create non-secure window permission denied!");
|
||||
return WSError::WS_ERROR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
|
||||
if (property->GetWindowType() == WindowType::WINDOW_TYPE_APP_SUB_WINDOW && property->GetIsUIExtFirstSubWindow()) {
|
||||
WSError err = CheckSubSessionStartedByExtensionAndSetDisplayId(token, property, sessionStage);
|
||||
if (err != WSError::WS_OK) {
|
||||
@ -2587,8 +2588,19 @@ bool SceneSessionManager::CheckSystemWindowPermission(const sptr<WindowSessionPr
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (type == WindowType::WINDOW_TYPE_SYSTEM_SUB_WINDOW) {
|
||||
int32_t parentId = property->GetParentPersistentId();
|
||||
auto parentSession = GetSceneSession(parentId);
|
||||
if (parentSession != nullptr && parentSession->GetWindowType() == WindowType::WINDOW_TYPE_FLOAT &&
|
||||
SessionPermission::VerifyCallingPermission("ohos.permission.SYSTEM_FLOAT_WINDOW")) {
|
||||
TLOGI(WmsLogTag::WMS_SYSTEM, "check system subWindow permission success, parentId:%{public}d.", parentId);
|
||||
return true;
|
||||
} else {
|
||||
TLOGW(WmsLogTag::WMS_SYSTEM, "check system subWindow permission warning, parentId:%{public}d.", parentId);
|
||||
}
|
||||
}
|
||||
if (SessionPermission::IsSystemCalling() || SessionPermission::IsStartByHdcd()) {
|
||||
WLOGFD("check create permission success, create with system calling.");
|
||||
TLOGI(WmsLogTag::WMS_SYSTEM, "check create permission success, create with system calling.");
|
||||
return true;
|
||||
}
|
||||
WLOGFE("check system window permission failed.");
|
||||
@ -3202,12 +3214,18 @@ WSError SceneSessionManager::ProcessBackEvent()
|
||||
auto task = [this]() {
|
||||
auto session = GetSceneSession(focusedSessionId_);
|
||||
if (!session) {
|
||||
WLOGFE("session is nullptr: %{public}d", focusedSessionId_);
|
||||
TLOGNE(WmsLogTag::WMS_MAIN, "session is nullptr: %{public}d", focusedSessionId_);
|
||||
return WSError::WS_ERROR_INVALID_SESSION;
|
||||
}
|
||||
WLOGFI("ProcessBackEvent session persistentId:%{public}d needBlock::%{public}d",
|
||||
TLOGNI(WmsLogTag::WMS_MAIN, "ProcessBackEvent session persistentId:%{public}d needBlock:%{public}d",
|
||||
focusedSessionId_, needBlockNotifyFocusStatusUntilForeground_);
|
||||
if (needBlockNotifyFocusStatusUntilForeground_) {
|
||||
TLOGND(WmsLogTag::WMS_MAIN, "RequestSessionBack when start session");
|
||||
if (session->GetSessionInfo().abilityInfo != nullptr &&
|
||||
session->GetSessionInfo().abilityInfo->unclearableMission) {
|
||||
TLOGNI(WmsLogTag::WMS_MAIN, "backPress unclearableMission");
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
session->RequestSessionBack(true);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
@ -3219,7 +3237,7 @@ WSError SceneSessionManager::ProcessBackEvent()
|
||||
return WSError::WS_OK;
|
||||
};
|
||||
|
||||
taskScheduler_->PostAsyncTask(task, "ProcessBackEvent");
|
||||
taskScheduler_->PostAsyncTask(task, __func__);
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
@ -3536,6 +3554,7 @@ void SceneSessionManager::FillSessionInfo(sptr<SceneSession>& sceneSession)
|
||||
WLOGFE("abilityInfo is nullptr!");
|
||||
return;
|
||||
}
|
||||
sceneSession->SetEnableRemoveStartingWindow(GetEnableRemoveStartingWindowFromBMS(abilityInfo));
|
||||
sceneSession->SetSessionInfoAbilityInfo(abilityInfo);
|
||||
sceneSession->SetSessionInfoTime(GetCurrentTime());
|
||||
if (abilityInfo->applicationInfo.codePath == std::to_string(CollaboratorType::RESERVE_TYPE)) {
|
||||
@ -3830,8 +3849,8 @@ void SceneSessionManager::HandleKeepScreenOn(const sptr<SceneSession>& sceneSess
|
||||
return;
|
||||
}
|
||||
bool shouldLock = requireLock && IsSessionVisibleForeground(sceneSession);
|
||||
TLOGNI(WmsLogTag::DEFAULT, "keep screen on: [%{public}s, %{public}d, %{public}d], %{public}d], %{public}d]",
|
||||
sceneSession->GetWindowName().c_str(), sceneSession->GetSessionState(),
|
||||
TLOGNI(WmsLogTag::DEFAULT, "keep screen on: [%{public}s, %{public}d, %{public}d], %{public}d], %{public}d]",
|
||||
sceneSession->GetWindowName().c_str(), sceneSession->GetSessionState(),
|
||||
sceneSession->IsVisible(), requireLock, shouldLock);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:HandleKeepScreenOn");
|
||||
ErrCode res;
|
||||
@ -3861,7 +3880,6 @@ bool SceneSessionManager::NotifyVisibleChange(int32_t persistentId)
|
||||
return false;
|
||||
}
|
||||
HandleKeepScreenOn(sceneSession, sceneSession->IsKeepScreenOn());
|
||||
ProcessWindowModeType();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4222,21 +4240,23 @@ bool SceneSessionManager::IsSessionVisible(const sptr<SceneSession>& session)
|
||||
}
|
||||
const auto& state = session->GetSessionState();
|
||||
if (WindowHelper::IsSubWindow(session->GetWindowType())) {
|
||||
const auto& parentSceneSession = session->GetParentSession();
|
||||
if (parentSceneSession == nullptr) {
|
||||
WLOGFW("Can not find parent for this sub window, id: %{public}d", session->GetPersistentId());
|
||||
const auto& mainSession = session->GetMainSession();
|
||||
if (mainSession == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_SUB, "Can not find parent for this sub window, id: %{public}d",
|
||||
session->GetPersistentId());
|
||||
return false;
|
||||
}
|
||||
const auto& parentState = parentSceneSession->GetSessionState();
|
||||
const auto mainState = mainSession->GetSessionState();
|
||||
if (session->IsVisible() || (state == SessionState::STATE_ACTIVE || state == SessionState::STATE_FOREGROUND)) {
|
||||
if (parentState == SessionState::STATE_INACTIVE || parentState == SessionState::STATE_BACKGROUND) {
|
||||
WLOGFD("Parent of this sub window is at background, id: %{public}d", session->GetPersistentId());
|
||||
if (mainState == SessionState::STATE_INACTIVE || mainState == SessionState::STATE_BACKGROUND) {
|
||||
TLOGD(WmsLogTag::WMS_SUB, "Parent of this sub window is at background, id: %{public}d",
|
||||
session->GetPersistentId());
|
||||
return false;
|
||||
}
|
||||
WLOGFD("Sub window is at foreground, id: %{public}d", session->GetPersistentId());
|
||||
TLOGD(WmsLogTag::WMS_SUB, "Sub window is at foreground, id: %{public}d", session->GetPersistentId());
|
||||
return true;
|
||||
}
|
||||
WLOGFD("Sub window is at background, id: %{public}d", session->GetPersistentId());
|
||||
TLOGD(WmsLogTag::WMS_SUB, "Sub window is at background, id: %{public}d", session->GetPersistentId());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5795,7 +5815,6 @@ __attribute__((no_sanitize("cfi"))) void SceneSessionManager::OnSessionStateChan
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ProcessWindowModeType();
|
||||
}
|
||||
|
||||
void SceneSessionManager::ProcessFocusWhenForeground(sptr<SceneSession>& sceneSession)
|
||||
@ -5853,10 +5872,10 @@ static bool IsSmallFoldProduct()
|
||||
TLOGE(WmsLogTag::DEFAULT, "foldScreenType is empty");
|
||||
return false;
|
||||
}
|
||||
return foldScreenType[0] == '2';
|
||||
return foldScreenType[0] == SMALL_FOLD_PRODUCT_TYPE;
|
||||
}
|
||||
|
||||
bool SceneSessionManager::IsInSecondaryScreen(const sptr<SceneSession>& sceneSession)
|
||||
bool SceneSessionManager::IsInDefaultScreen(const sptr<SceneSession>& sceneSession)
|
||||
{
|
||||
auto sessionProperty = sceneSession->GetSessionProperty();
|
||||
if (sessionProperty == nullptr) {
|
||||
@ -5864,7 +5883,21 @@ bool SceneSessionManager::IsInSecondaryScreen(const sptr<SceneSession>& sceneSes
|
||||
return false;
|
||||
}
|
||||
ScreenId defaultScreenId = ScreenSessionManagerClient::GetInstance().GetDefaultScreenId();
|
||||
return sessionProperty->GetDisplayId() != defaultScreenId;
|
||||
return sessionProperty->GetDisplayId() == defaultScreenId;
|
||||
}
|
||||
|
||||
bool SceneSessionManager::IsNeedSkipWindowModeTypeCheck(const sptr<SceneSession>& sceneSession, bool isSmallFold)
|
||||
{
|
||||
if (sceneSession == nullptr ||
|
||||
!WindowHelper::IsMainWindow(sceneSession->GetWindowType()) ||
|
||||
!sceneSession->GetRSVisible() ||
|
||||
!sceneSession->IsSessionForeground()) {
|
||||
return true;
|
||||
}
|
||||
if (isSmallFold && !IsInDefaultScreen(sceneSession)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
WindowModeType SceneSessionManager::CheckWindowModeType()
|
||||
@ -5876,12 +5909,7 @@ WindowModeType SceneSessionManager::CheckWindowModeType()
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
for (const auto& session : sceneSessionMap_) {
|
||||
if (session.second == nullptr ||
|
||||
!WindowHelper::IsMainWindow(session.second->GetWindowType()) ||
|
||||
!Rosen::SceneSessionManager::GetInstance().IsSessionVisibleForeground(session.second)) {
|
||||
continue;
|
||||
}
|
||||
if (isSmallFold && IsInSecondaryScreen(session.second)) {
|
||||
if (IsNeedSkipWindowModeTypeCheck(session.second, isSmallFold)) {
|
||||
continue;
|
||||
}
|
||||
auto mode = session.second->GetWindowMode();
|
||||
@ -7630,8 +7658,8 @@ std::vector<sptr<SceneSession>> SceneSessionManager::GetSubSceneSession(int32_t
|
||||
if (sceneSession == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (sceneSession->GetParentSession() != nullptr &&
|
||||
sceneSession->GetParentSession()->GetWindowId() == parentWindowId) {
|
||||
const auto& mainSession = sceneSession->GetMainSession();
|
||||
if (mainSession != nullptr && mainSession->GetWindowId() == parentWindowId) {
|
||||
subSessions.push_back(sceneSession);
|
||||
}
|
||||
}
|
||||
@ -7711,6 +7739,7 @@ void SceneSessionManager::DealwithVisibilityChange(const std::vector<std::pair<u
|
||||
visibilityInfo.c_str());
|
||||
SessionManagerAgentController::GetInstance().UpdateWindowVisibilityInfo(windowVisibilityInfos);
|
||||
}
|
||||
ProcessWindowModeType();
|
||||
#ifdef MEMMGR_WINDOW_ENABLE
|
||||
if (memMgrWindowInfos.size() != 0) {
|
||||
WLOGD("Notify memMgrWindowInfos changed start");
|
||||
@ -8411,6 +8440,25 @@ WSError SceneSessionManager::UpdateSessionWindowVisibilityListener(int32_t persi
|
||||
return taskScheduler_->PostSyncTask(task, "UpdateSessionWindowVisibilityListener");
|
||||
}
|
||||
|
||||
void SceneSessionManager::UpdateDarkColorModeToRS()
|
||||
{
|
||||
std::shared_ptr<AbilityRuntime::ApplicationContext> appContext = AbilityRuntime::Context::GetApplicationContext();
|
||||
if (appContext == nullptr) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "app context is nullptr");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AppExecFwk::Configuration> config = appContext->GetConfiguration();
|
||||
if (config == nullptr) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "app configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
std::string colorMode = config->GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE);
|
||||
bool isDark = (colorMode == AppExecFwk::ConfigurationInner::COLOR_MODE_DARK);
|
||||
bool ret = RSInterfaces::GetInstance().SetGlobalDarkColorMode(isDark);
|
||||
TLOGI(WmsLogTag::DEFAULT, "SetGlobalDarkColorMode with colorMode: %{public}s, ret: %{public}d",
|
||||
colorMode.c_str(), ret);
|
||||
}
|
||||
|
||||
void SceneSessionManager::SetVirtualPixelRatioChangeListener(const ProcessVirtualPixelRatioChangeFunc& func)
|
||||
{
|
||||
processVirtualPixelRatioChangeFunc_ = func;
|
||||
@ -9226,6 +9274,7 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map<in
|
||||
std::unique_lock<std::mutex> lock(nextFlushCompletedMutex_);
|
||||
nextFlushCompletedCV_.notify_all();
|
||||
}
|
||||
std::vector<uint32_t> startingAppZOrderList;
|
||||
processingFlushUIParams_.store(true);
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
@ -9239,6 +9288,12 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map<in
|
||||
}
|
||||
auto iter = uiParams.find(sceneSession->GetPersistentId());
|
||||
if (iter != uiParams.end()) {
|
||||
if ((systemConfig_.IsPhoneWindow() ||
|
||||
(systemConfig_.IsPadWindow() && !systemConfig_.IsFreeMultiWindowMode())) &&
|
||||
sceneSession->GetStartingBeforeVisible() && sceneSession->IsAppSession()) {
|
||||
startingAppZOrderList.push_back(iter->second.zOrder_);
|
||||
sceneSession->SetStartingBeforeVisible(false);
|
||||
}
|
||||
sessionMapDirty_ |= sceneSession->UpdateUIParam(iter->second);
|
||||
} else {
|
||||
sessionMapDirty_ |= sceneSession->UpdateUIParam();
|
||||
@ -9258,6 +9313,7 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map<in
|
||||
item.first, item.second.zOrder_, item.second.rect_.ToString().c_str(), item.second.transX_,
|
||||
item.second.transY_, item.second.needSync_, item.second.interactive_);
|
||||
}
|
||||
ProcessUpdateLastFocusedAppId(startingAppZOrderList);
|
||||
ProcessFocusZOrderChange(sessionMapDirty_);
|
||||
PostProcessFocus();
|
||||
PostProcessProperty(sessionMapDirty_);
|
||||
@ -9286,7 +9342,29 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map<in
|
||||
taskScheduler_->PostAsyncTask(task, "FlushUIParams");
|
||||
}
|
||||
|
||||
void SceneSessionManager::ProcessFocusZOrderChange(uint32_t dirty) {
|
||||
void SceneSessionManager::ProcessUpdateLastFocusedAppId(const std::vector<uint32_t>& zOrderList)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "last focused app: %{public}d, list size %{public}zu", lastFocusedAppSessionId_,
|
||||
zOrderList.size());
|
||||
if (lastFocusedAppSessionId_ == INVALID_SESSION_ID || zOrderList.empty()) {
|
||||
return;
|
||||
}
|
||||
auto lastFocusedAppSession = GetSceneSession(lastFocusedAppSessionId_);
|
||||
if (lastFocusedAppSession == nullptr) {
|
||||
return;
|
||||
}
|
||||
uint32_t lastFocusedAppZOrder = lastFocusedAppSession->GetZOrder();
|
||||
auto it = std::find_if(zOrderList.begin(), zOrderList.end(), [lastFocusedAppZOrder](uint32_t zOrder) {
|
||||
return zOrder > lastFocusedAppZOrder;
|
||||
});
|
||||
if (it != zOrderList.end()) {
|
||||
TLOGD(WmsLogTag::WMS_FOCUS, "clear with high zOrder app visible");
|
||||
lastFocusedAppSessionId_ = INVALID_SESSION_ID;
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSessionManager::ProcessFocusZOrderChange(uint32_t dirty)
|
||||
{
|
||||
if (!(dirty & static_cast<uint32_t>(SessionUIDirtyFlag::Z_ORDER))) {
|
||||
return;
|
||||
}
|
||||
@ -9549,10 +9627,9 @@ std::shared_ptr<Media::PixelMap> SceneSessionManager::GetSessionSnapshotPixelMap
|
||||
}
|
||||
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:GetSessionSnapshotPixelMap(%d )", persistentId);
|
||||
std::shared_ptr<Media::PixelMap> pixelMap = nullptr;
|
||||
|
||||
bool isPc = systemConfig_.IsPcWindow() || systemConfig_.IsFreeMultiWindowMode();
|
||||
pixelMap = sceneSession->Snapshot(true, scaleParam, isPc);
|
||||
std::shared_ptr<Media::PixelMap> pixelMap = sceneSession->Snapshot(true, scaleParam, isPc);
|
||||
if (!pixelMap) {
|
||||
WLOGFI("get local snapshot pixelmap start");
|
||||
pixelMap = sceneSession->GetSnapshotPixelMap(snapshotScale_, scaleParam);
|
||||
@ -10996,7 +11073,10 @@ void SceneSessionManager::RefreshPcZOrderList(uint32_t startZOrder, std::vector<
|
||||
void SceneSessionManager::SetCloseTargetFloatWindowFunc(const ProcessCloseTargetFloatWindowFunc& func)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_MULTI_WINDOW, "in");
|
||||
closeTargetFloatWindowFunc_ = func;
|
||||
auto task = [this, func] {
|
||||
closeTargetFloatWindowFunc_ = func;
|
||||
};
|
||||
taskScheduler_->PostTask(task, __func__);
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::CloseTargetFloatWindow(const std::string& bundleName)
|
||||
@ -11011,7 +11091,7 @@ WMError SceneSessionManager::CloseTargetFloatWindow(const std::string& bundleNam
|
||||
closeTargetFloatWindowFunc_(bundleName);
|
||||
}
|
||||
};
|
||||
taskScheduler_->PostTask(task, "CloseTargetFloatWindow");
|
||||
taskScheduler_->PostTask(task, __func__);
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
@ -11027,7 +11107,7 @@ WMError SceneSessionManager::CloseTargetPiPWindow(const std::string& bundleName)
|
||||
return WMError::WM_ERROR_INVALID_PERMISSION;
|
||||
}
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
for (const auto& iter: sceneSessionMap_) {
|
||||
for (const auto& iter : sceneSessionMap_) {
|
||||
auto& session = iter.second;
|
||||
if (session && session->GetWindowType() == WindowType::WINDOW_TYPE_PIP &&
|
||||
session->GetSessionInfo().bundleName_ == bundleName) {
|
||||
@ -11045,7 +11125,7 @@ WMError SceneSessionManager::GetCurrentPiPWindowInfo(std::string& bundleName)
|
||||
return WMError::WM_ERROR_INVALID_PERMISSION;
|
||||
}
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
for (const auto& iter: sceneSessionMap_) {
|
||||
for (const auto& iter : sceneSessionMap_) {
|
||||
auto& session = iter.second;
|
||||
if (session && session->GetWindowType() == WindowType::WINDOW_TYPE_PIP) {
|
||||
bundleName = session->GetSessionInfo().bundleName_;
|
||||
|
@ -232,7 +232,7 @@ void SessionManagerAgentController::NotifyWindowPidVisibilityChanged(
|
||||
|
||||
void SessionManagerAgentController::UpdatePiPWindowStateChanged(const std::string& bundleName, bool isForeground)
|
||||
{
|
||||
for (auto &agent: smAgentContainer_.GetAgentsByType(
|
||||
for (auto& agent : smAgentContainer_.GetAgentsByType(
|
||||
WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_PIP)) {
|
||||
if (agent != nullptr) {
|
||||
agent->UpdatePiPWindowStateChanged(bundleName, isForeground);
|
||||
|
@ -12,7 +12,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SUPPORT_SCREEN
|
||||
#define SUPPORT_SCREEN
|
||||
#endif
|
||||
#include "session_manager/include/zidl/scene_session_manager_proxy.h"
|
||||
|
||||
#include <ipc_types.h>
|
||||
|
@ -351,7 +351,11 @@ int SceneSessionManagerStub::HandleRequestFocusStatus(MessageParcel& data, Messa
|
||||
TLOGE(WmsLogTag::WMS_FOCUS, "read persistentId failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
bool isFocused = data.ReadBool();
|
||||
bool isFocused = false;
|
||||
if (!data.ReadBool(isFocused)) {
|
||||
TLOGE(WmsLogTag::WMS_FOCUS, "read isFocused failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WMError ret = RequestFocusStatus(persistentId, isFocused, true, FocusChangeReason::CLIENT_REQUEST);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
return ERR_NONE;
|
||||
|
@ -1425,7 +1425,7 @@ HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange01, Function | SmallTest
|
||||
|
||||
/**
|
||||
* @tc.name: InternalScreenOffChange02
|
||||
* @tc.desc: internal extend to external mirror
|
||||
* @tc.desc: no need to change or paramater error
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange02, Function | SmallTest | Level1)
|
||||
@ -1478,7 +1478,7 @@ HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange02, Function | SmallTest
|
||||
|
||||
/**
|
||||
* @tc.name: InternalScreenOffChange03
|
||||
* @tc.desc: paramater error
|
||||
* @tc.desc: internal extend to external mirror
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange03, Function | SmallTest | Level1)
|
||||
@ -1519,7 +1519,7 @@ HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange03, Function | SmallTest
|
||||
|
||||
EXPECT_EQ(true, internalSession->GetIsExtend());
|
||||
EXPECT_EQ(false, externalSession->GetIsExtend());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_EXTEND, internalSession->GetScreenCombination());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_MIRROR, internalSession->GetScreenCombination());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_MAIN, externalSession->GetScreenCombination());
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex>
|
||||
@ -1572,7 +1572,7 @@ HWTEST_F(MultiScreenManagerTest, InternalScreenOffChange04, Function | SmallTest
|
||||
|
||||
EXPECT_EQ(true, internalSession->GetIsExtend());
|
||||
EXPECT_EQ(false, externalSession->GetIsExtend());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_EXTEND, internalSession->GetScreenCombination());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_MIRROR, internalSession->GetScreenCombination());
|
||||
EXPECT_EQ(ScreenCombination::SCREEN_MAIN, externalSession->GetScreenCombination());
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex>
|
||||
|
@ -497,6 +497,25 @@ HWTEST_F(ScreenSessionTest, UpdateRotationAfterBoot02, Function | SmallTest | Le
|
||||
GTEST_LOG_(INFO) << "UpdateRotationAfterBoot end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateValidRotationToScb
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenSessionTest, UpdateValidRotationToScb, Function | SmallTest | Level2)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "UpdateValidRotationToScb start";
|
||||
ScreenSessionConfig config = {
|
||||
.screenId = 100,
|
||||
.rsId = 101,
|
||||
.name = "OpenHarmony",
|
||||
};
|
||||
sptr<ScreenSession> screenSession = new ScreenSession(config, ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);
|
||||
EXPECT_NE(nullptr, screenSession);
|
||||
screenSession->UpdateValidRotationToScb();
|
||||
GTEST_LOG_(INFO) << "UpdateValidRotationToScb end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetScreenSceneDpiChangeListener
|
||||
* @tc.desc: normal function
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
MOCK_METHOD1(Show, WSError(sptr<WindowSessionProperty> property));
|
||||
MOCK_METHOD0(Hide, WSError(void));
|
||||
MOCK_METHOD0(DrawingCompleted, WSError(void));
|
||||
MOCK_METHOD0(RemoveStartingWindow, WSError(void));
|
||||
|
||||
MOCK_METHOD4(OnRemoteRequest, int(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option));
|
||||
|
||||
|
@ -616,6 +616,7 @@ ohos_unittest("ws_scene_session_manager_test4") {
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"ability_runtime:ability_context_native",
|
||||
"ability_runtime:app_context",
|
||||
"ability_runtime:mission_info",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
@ -893,10 +894,13 @@ ohos_unittest("ws_scene_session_manager_stub_test") {
|
||||
|
||||
ohos_unittest("ws_scene_session_manager_supplement_test") {
|
||||
module_out_path = module_out_path
|
||||
|
||||
include_dirs = [ "${window_base_path}/test/common/utils/include/" ]
|
||||
sources = [ "scene_session_manager_supplement_test.cpp" ]
|
||||
|
||||
deps = [ ":ws_unittest_common" ]
|
||||
deps = [
|
||||
":ws_unittest_common",
|
||||
"${window_base_path}/test/common/utils:libtestutil",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:configuration",
|
||||
|
@ -137,6 +137,7 @@ HWTEST_F(IntentionEventManagerTest, OnInputEvent0, Function | MediumTest | Level
|
||||
property->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_FLOAT);
|
||||
sceneSession1->SetSessionProperty(property);
|
||||
inputEventListener_->OnInputEvent(pointerEvent);
|
||||
EXPECT_EQ(200010, pointerEvent->GetPointerId());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,7 +182,9 @@ HWTEST_F(IntentionEventManagerTest, OnInputEvent1, Function | MediumTest | Level
|
||||
SceneSessionManager::GetInstance().sceneSessionMap_.emplace(std::make_pair(2, sceneSession1));
|
||||
SceneSessionManager::GetInstance().SetFocusedSessionId(2);
|
||||
EXPECT_EQ(2, SceneSessionManager::GetInstance().GetFocusedSessionId());
|
||||
auto focusedSceneSession = SceneSessionManager::GetInstance().GetSceneSession(2);
|
||||
inputEventListener_->OnInputEvent(keyEvent);
|
||||
EXPECT_NE(nullptr, focusedSceneSession);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,7 +217,9 @@ HWTEST_F(IntentionEventManagerTest, OnInputEvent2, Function | MediumTest | Level
|
||||
sceneSession->SetNotifySystemSessionKeyEventFunc(nullptr);
|
||||
keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_FN);
|
||||
EXPECT_EQ(MMI::KeyEvent::KEYCODE_FN, keyEvent->GetKeyCode());
|
||||
auto focusedSceneSession = SceneSessionManager::GetInstance().GetSceneSession(1);
|
||||
inputEventListener_->OnInputEvent(keyEvent);
|
||||
EXPECT_NE(nullptr, focusedSceneSession);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -246,7 +251,9 @@ HWTEST_F(IntentionEventManagerTest, OnInputEvent3, Function | MediumTest | Level
|
||||
keyEvent->SetKeyCode(MMI::KeyEvent::KEYCODE_UNKNOWN);
|
||||
EXPECT_EQ(MMI::KeyEvent::KEYCODE_UNKNOWN, keyEvent->GetKeyCode());
|
||||
inputEventListener->OnInputEvent(keyEvent);
|
||||
auto focusedSceneSession = SceneSessionManager::GetInstance().GetSceneSession(1);
|
||||
inputEventListener_->OnInputEvent(keyEvent);
|
||||
EXPECT_NE(nullptr, focusedSceneSession);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -801,12 +801,22 @@ HWTEST_F(SceneSessionDirtyManagerTest, UpdateSecSurfaceInfo, Function | SmallTes
|
||||
*/
|
||||
HWTEST_F(SceneSessionDirtyManagerTest, ResetFlushWindowInfoTask, Function | SmallTest | Level2)
|
||||
{
|
||||
int ret = 0;
|
||||
auto preFlushWindowInfoCallback = manager_->flushWindowInfoCallback_;
|
||||
manager_->flushWindowInfoCallback_ = nullptr;
|
||||
manager_->ResetFlushWindowInfoTask();
|
||||
EXPECT_TRUE(manager_->hasPostTask_.load());
|
||||
manager_->flushWindowInfoCallback_ = preFlushWindowInfoCallback;
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ResetFlushWindowInfoTask1
|
||||
* @tc.desc: ResetFlushWindowInfoTask1
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionDirtyManagerTest, ResetFlushWindowInfoTask1, Function | SmallTest | Level2)
|
||||
{
|
||||
manager_->ResetFlushWindowInfoTask();
|
||||
EXPECT_TRUE(manager_->hasPostTask_.load());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "window_manager_agent.h"
|
||||
#include "session_manager.h"
|
||||
#include "zidl/window_manager_agent_interface.h"
|
||||
#include "common_test_utils.h"
|
||||
#include "mock/mock_session_stage.h"
|
||||
#include "mock/mock_window_event_channel.h"
|
||||
#include "context.h"
|
||||
@ -244,6 +245,7 @@ HWTEST_F(SceneSessionManagerSupplementTest, CreateAndConnectSpecificSession, Fun
|
||||
property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
|
||||
ssm_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property, id, session,
|
||||
systemConfig, token);
|
||||
CommonTestUtils::GuaranteeFloatWindowPermission("ws_scene_session_manager_supplement_test");
|
||||
property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
|
||||
property->SetFloatingWindowAppType(true);
|
||||
ssm_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property, id, session,
|
||||
|
@ -587,11 +587,11 @@ HWTEST_F(SceneSessionManagerTest10, NotifyVisibleChange, Function | SmallTest |
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsInSecondaryScreen
|
||||
* @tc.desc: test IsInSecondaryScreen
|
||||
* @tc.name: IsInDefaultScreen
|
||||
* @tc.desc: test IsInDefaultScreen
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest10, IsInSecondaryScreen, Function | SmallTest | Level3)
|
||||
HWTEST_F(SceneSessionManagerTest10, IsInDefaultScreen, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "test";
|
||||
@ -603,12 +603,12 @@ HWTEST_F(SceneSessionManagerTest10, IsInSecondaryScreen, Function | SmallTest |
|
||||
DisplayId displayId = ScreenSessionManagerClient::GetInstance().GetDefaultScreenId();
|
||||
property->SetDisplayId(displayId);
|
||||
sceneSession->SetSessionProperty(property);
|
||||
ASSERT_EQ(ssm_->IsInSecondaryScreen(sceneSession), false);
|
||||
ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), true);
|
||||
|
||||
displayId = 5;
|
||||
property->SetDisplayId(displayId);
|
||||
sceneSession->SetSessionProperty(property);
|
||||
ASSERT_EQ(ssm_->IsInSecondaryScreen(sceneSession), true);
|
||||
ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -663,6 +663,102 @@ HWTEST_F(SceneSessionManagerTest10, EraseSceneSessionAndMarkDirtyLockFree, Funct
|
||||
ASSERT_EQ(ssm_->sessionMapDirty_, static_cast<uint32_t>(SessionUIDirtyFlag::VISIBLE));
|
||||
ASSERT_EQ(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateAvoidAreaByType
|
||||
* @tc.desc: test UpdateAvoidAreaByType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest10, UpdateAvoidAreaByType, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "test";
|
||||
info.bundleName_ = "test";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
ASSERT_NE(nullptr, sceneSession);
|
||||
|
||||
ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
|
||||
sceneSession->isVisible_ = true;
|
||||
sceneSession->state_ = SessionState::STATE_ACTIVE;
|
||||
ssm_->UpdateAvoidAreaByType(sceneSession->GetPersistentId(), AvoidAreaType::TYPE_NAVIGATION_INDICATOR);
|
||||
EXPECT_EQ(ssm_->lastUpdatedAvoidArea_.find(sceneSession->GetPersistentId()), ssm_->lastUpdatedAvoidArea_.end());
|
||||
ssm_->avoidAreaListenerSessionSet_.insert(sceneSession->GetPersistentId());
|
||||
ssm_->UpdateAvoidAreaByType(sceneSession->GetPersistentId(), AvoidAreaType::TYPE_NAVIGATION_INDICATOR);
|
||||
EXPECT_EQ(ssm_->lastUpdatedAvoidArea_.find(sceneSession->GetPersistentId()), ssm_->lastUpdatedAvoidArea_.end());
|
||||
ssm_->avoidAreaListenerSessionSet_.erase(sceneSession->GetPersistentId());
|
||||
ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyStatusBarShowStatus
|
||||
* @tc.desc: test NotifyStatusBarShowStatus
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest10, NotifyStatusBarShowStatus, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "test";
|
||||
info.bundleName_ = "test";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
ASSERT_NE(nullptr, sceneSession);
|
||||
|
||||
ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(WSError::WS_OK, ssm_->NotifyStatusBarShowStatus(sceneSession->GetPersistentId(), false));
|
||||
ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ProcessUpdateLastFocusedAppId
|
||||
* @tc.desc: test ProcessUpdateLastFocusedAppId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest10, ProcessUpdateLastFocusedAppId, Function | SmallTest | Level1)
|
||||
{
|
||||
ssm_->sceneSessionMap_.clear();
|
||||
std::vector<uint32_t> zOrderList;
|
||||
ssm_->lastFocusedAppSessionId_ = INVALID_SESSION_ID;
|
||||
ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
|
||||
|
||||
SessionInfo sessionInfo;
|
||||
sessionInfo.bundleName_ = "lastFocusedAppSession";
|
||||
sessionInfo.abilityName_ = "lastFocusedAppSession";
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
|
||||
ssm_->sceneSessionMap_.emplace(1, sceneSession);
|
||||
ssm_->lastFocusedAppSessionId_ = 1;
|
||||
sceneSession->zOrder_ = 101;
|
||||
|
||||
ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
|
||||
ASSERT_EQ(1, ssm_->lastFocusedAppSessionId_);
|
||||
|
||||
zOrderList.push_back(103);
|
||||
ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
|
||||
ASSERT_EQ(INVALID_SESSION_ID, ssm_->lastFocusedAppSessionId_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsNeedSkipWindowModeTypeCheck
|
||||
* @tc.desc: IsNeedSkipWindowModeTypeCheck
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest10, IsNeedSkipWindowModeTypeCheck, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo sessionInfo;
|
||||
sessionInfo.bundleName_ = "IsNeedSkipWindowModeTypeCheck";
|
||||
sessionInfo.abilityName_ = "IsNeedSkipWindowModeTypeCheck";
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
|
||||
ASSERT_NE(nullptr, sceneSession);
|
||||
ASSERT_NE(nullptr, sceneSession->property_);
|
||||
sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
|
||||
sceneSession->SetRSVisible(false);
|
||||
sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
|
||||
ASSERT_TRUE(ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false));
|
||||
sceneSession->SetRSVisible(true);
|
||||
DisplayId displayId = 1001;
|
||||
sceneSession->property_->SetDisplayId(displayId);
|
||||
ASSERT_TRUE(ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, true));
|
||||
ASSERT_FALSE(ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false));
|
||||
}
|
||||
} // namespace
|
||||
}
|
||||
}
|
@ -1406,6 +1406,52 @@ HWTEST_F(SceneSessionManagerTest2, UpdateRecoveredSessionInfo, Function | SmallT
|
||||
ssm_->sceneSessionMap_.erase(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateRecoveredSessionInfo02
|
||||
* @tc.desc: Test if failRecoverPersistentSet exist or not exist
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest2, UpdateRecoveredSessionInfo02, Function | SmallTest | Level3)
|
||||
{
|
||||
int ret = 0;
|
||||
ASSERT_NE(ssm_, nullptr);
|
||||
std::vector<int32_t> recoveredPersistentIds;
|
||||
recoveredPersistentIds.push_back(0);
|
||||
recoveredPersistentIds.push_back(1);
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "UpdateRecoveredSessionInfo02";
|
||||
info.bundleName_ = "SceneSessionManagerTest2";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
ASSERT_NE(sceneSession, nullptr);
|
||||
ssm_->failRecoveredPersistentIdSet_.insert(0);
|
||||
ssm_->sceneSessionMap_.insert({1, sceneSession});
|
||||
ssm_->UpdateRecoveredSessionInfo(recoveredPersistentIds);
|
||||
ssm_->failRecoveredPersistentIdSet_.erase(0);
|
||||
ssm_->sceneSessionMap_.erase(1);
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyCreateSubSession
|
||||
* @tc.desc: Test if createSubSessionFuncMap_ exist
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest2, NotifyCreateSubSession, Function | SmallTest | Level3)
|
||||
{
|
||||
int ret = 0;
|
||||
ASSERT_NE(ssm_, nullptr);
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "NotifyCreateSubSession";
|
||||
info.bundleName_ = "SceneSessionManagerTest2";
|
||||
sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
ASSERT_NE(sceneSession, nullptr);
|
||||
NotifyCreateSubSessionFunc func;
|
||||
ssm_->createSubSessionFuncMap_.insert({1, func});
|
||||
ssm_->NotifyCreateSubSession(1, sceneSession, 256);
|
||||
ssm_->createSubSessionFuncMap_.erase(1);
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ConfigWindowSceneXml
|
||||
* @tc.desc: SceneSesionManager config window scene xml run
|
||||
@ -2047,6 +2093,33 @@ HWTEST_F(SceneSessionManagerTest2, RecoverAndConnectSpecificSession, Function |
|
||||
ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RecoverAndConnectSpecificSession02
|
||||
* @tc.desc: RecoverAndConnectSpecificSession02
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest2, RecoverAndConnectSpecificSession02, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo sessionInfo;
|
||||
sessionInfo.abilityName_ = "RecoverAndConnectSpecificSession02";
|
||||
sessionInfo.bundleName_ = "SceneSessionManagerTest2";
|
||||
sessionInfo.windowType_ = static_cast<uint32_t>(WindowType::APP_MAIN_WINDOW_END);
|
||||
sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
property->SetSessionInfo(sessionInfo);
|
||||
property->SetPersistentId(1);
|
||||
property->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
sptr<ISessionStage> sessionStage;
|
||||
sptr<IWindowEventChannel> eventChannel;
|
||||
std::shared_ptr<RSSurfaceNode> surfaceNode;
|
||||
sptr<ISession> session;
|
||||
sptr<IRemoteObject> token;
|
||||
ASSERT_NE(ssm_, nullptr);
|
||||
auto result = ssm_->RecoverAndConnectSpecificSession(sessionStage, eventChannel,
|
||||
surfaceNode, property, session, token);
|
||||
ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CacheSubSessionForRecovering
|
||||
* @tc.desc: CacheSubSessionForRecovering
|
||||
|
@ -1251,6 +1251,31 @@ HWTEST_F(SceneSessionManagerTest3, QueryAbilityInfoFromBMS, Function | SmallTest
|
||||
ASSERT_NE(sessionInfo_.want, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyStartAbility
|
||||
* @tc.desc: SceneSesionManager NotifyStartAbility
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest3, NotifyStartAbility, Function | SmallTest | Level3)
|
||||
{
|
||||
SessionInfo sessionInfo;
|
||||
sessionInfo.moduleName_ = "SceneSessionManagerTest";
|
||||
sessionInfo.bundleName_ = "SceneSessionManagerTest3";
|
||||
sessionInfo.abilityName_ = "NotifyStartAbility";
|
||||
sptr<AAFwk::IAbilityManagerCollaborator> collaborator =
|
||||
iface_cast<AAFwk::IAbilityManagerCollaborator>(nullptr);
|
||||
ssm_->collaboratorMap_.clear();
|
||||
ssm_->collaboratorMap_.insert(std::make_pair(1, collaborator));
|
||||
int32_t collaboratorType = 1;
|
||||
auto ret1 = ssm_->NotifyStartAbility(collaboratorType, sessionInfo);
|
||||
ASSERT_EQ(ret1, BrokerStates::BROKER_UNKOWN);
|
||||
|
||||
sessionInfo.want = std::make_shared<AAFwk::Want>();
|
||||
auto ret2 = ssm_->NotifyStartAbility(collaboratorType, sessionInfo);
|
||||
ASSERT_EQ(ret2, BrokerStates::BROKER_UNKOWN);
|
||||
ssm_->collaboratorMap_.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsSessionClearable
|
||||
* @tc.desc: SceneSesionManager is session clearable
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <regex>
|
||||
#include <application_context.h>
|
||||
#include <bundle_mgr_interface.h>
|
||||
#include <bundlemgr/launcher_service.h>
|
||||
|
||||
@ -630,6 +631,27 @@ HWTEST_F(SceneSessionManagerTest4, UpdateSessionWindowVisibilityListener02, Func
|
||||
EXPECT_EQ(result, WSError::WS_ERROR_INVALID_PERMISSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateDarkColorModeToRS
|
||||
* @tc.desc: UpdateDarkColorModeToRS
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueIB1N43
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest4, UpdateDarkColorModeToRS, Function | SmallTest | Level3)
|
||||
{
|
||||
ASSERT_NE(nullptr, ssm_);
|
||||
AbilityRuntime::ApplicationContext::applicationContext_ =
|
||||
std::make_shared<AbilityRuntime::ApplicationContext>();
|
||||
ASSERT_NE(nullptr, AbilityRuntime::ApplicationContext::applicationContext_);
|
||||
AbilityRuntime::ApplicationContext::applicationContext_->contextImpl_ =
|
||||
std::make_shared<AbilityRuntime::ContextImpl>();
|
||||
ASSERT_NE(nullptr, AbilityRuntime::ApplicationContext::applicationContext_->contextImpl_);
|
||||
AbilityRuntime::ApplicationContext::applicationContext_->contextImpl_->config_ =
|
||||
std::make_shared<AppExecFwk::Configuration>();
|
||||
ASSERT_NE(nullptr, AbilityRuntime::ApplicationContext::applicationContext_->GetConfiguration());
|
||||
ssm_->UpdateDarkColorModeToRS();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NotifySessionAINavigationBarChange
|
||||
* @tc.desc: NotifySessionAINavigationBarChange
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user