mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-02-18 23:10:24 +00:00
Merge branch 'master' of gitee.com:openharmony/window_window_manager into master
Signed-off-by: chengyiyi <chengyiyi1@huawei.com>
This commit is contained in:
commit
10f6b3a3d4
interfaces/innerkits/wm
test/common/mock
utils
window_scene
interfaces/kits/napi/scene_session_manager
session
container/src/zidl
host
session_manager
test/mock
wm
@ -1416,7 +1416,15 @@ public:
|
||||
* @return Errorcode of window.
|
||||
*/
|
||||
virtual WMError NotifyPrepareClosePiPWindow() { return WMError::WM_OK; }
|
||||
|
||||
|
||||
/**
|
||||
* @brief update the pip window instance (w,h,r).
|
||||
*
|
||||
* @param width width of pip window.
|
||||
* @param height width of pip window.
|
||||
* @param reason reason of update.
|
||||
*/
|
||||
virtual void UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason) {}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -616,6 +616,47 @@ enum class PipState : int32_t {
|
||||
ERROR = 6,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Enumerates pip window rect update reason.
|
||||
*/
|
||||
enum class PiPRectUpdateReason : int32_t {
|
||||
REASON_PIP_START_WINDOW,
|
||||
REASON_PIP_MOVE,
|
||||
REASON_PIP_VIDEO_RATIO_CHANGE,
|
||||
REASON_PIP_SCALE_CHANGE,
|
||||
REASON_PIP_DESTROY_WINDOW,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Enumerates picture in picture scale level.
|
||||
*/
|
||||
enum class PiPScaleLevel : int32_t {
|
||||
PIP_SCALE_LEVEL_SMALLEST = 0,
|
||||
PIP_SCALE_LEVEL_BIGGEST = 1,
|
||||
COUNT = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Enumerates picture in picture scale pivot.
|
||||
*/
|
||||
enum class PiPScalePivot : int32_t {
|
||||
UNDEFINED = 0,
|
||||
START,
|
||||
MIDDLE,
|
||||
END,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure of picture in picture rect info.
|
||||
*/
|
||||
struct PiPRectInfo {
|
||||
PiPScalePivot xPivot_;
|
||||
PiPScalePivot yPivot_;
|
||||
uint32_t originWidth_;
|
||||
uint32_t originHeight_;
|
||||
PiPScaleLevel level_;
|
||||
};
|
||||
|
||||
using OnCallback = std::function<void(int64_t)>;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
const std::shared_ptr<OHOS::Rosen::RSTransaction>& rsTransaction));
|
||||
MOCK_METHOD2(UpdateWindowMode, void(OHOS::Rosen::WindowMode mode, bool hasDeco));
|
||||
MOCK_METHOD3(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize));
|
||||
MOCK_METHOD2(UpdateTitleInTargetPos, void(bool isShow, int32_t height));
|
||||
MOCK_METHOD0(GetBackgroundColor, uint32_t());
|
||||
MOCK_METHOD1(SetBackgroundColor, void(uint32_t color));
|
||||
MOCK_METHOD2(DumpInfo, void(const std::vector<std::string>& params, std::vector<std::string>& info));
|
||||
|
@ -40,6 +40,7 @@ ohos_static_library("libwmutil_static") {
|
||||
"src/perform_reporter.cpp",
|
||||
"src/permission.cpp",
|
||||
"src/persistent_storage.cpp",
|
||||
"src/pip_util.cpp",
|
||||
"src/screen_group_info.cpp",
|
||||
"src/screen_info.cpp",
|
||||
"src/screenshot_info.cpp",
|
||||
@ -103,6 +104,7 @@ ohos_shared_library("libwmutil") {
|
||||
"src/perform_reporter.cpp",
|
||||
"src/permission.cpp",
|
||||
"src/persistent_storage.cpp",
|
||||
"src/pip_util.cpp",
|
||||
"src/screen_group_info.cpp",
|
||||
"src/screen_info.cpp",
|
||||
"src/screenshot_info.cpp",
|
||||
|
37
utils/include/pip_util.h
Normal file
37
utils/include/pip_util.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ROSEN_WINDOW_PIP_UTIL_H
|
||||
#define OHOS_ROSEN_WINDOW_PIP_UTIL_H
|
||||
|
||||
#include "wm_common.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
class PiPUtil {
|
||||
public:
|
||||
static void UpdateRectPivot(const int32_t start, const uint32_t len, const uint32_t totalLen,
|
||||
PiPScalePivot& pivot);
|
||||
static void GetRectByPivot(int32_t& start, const uint32_t oldLen, const uint32_t len, const uint32_t totalLen,
|
||||
const PiPScalePivot& pivot);
|
||||
static void GetRectByScale(const uint32_t width, const uint32_t height, const PiPScaleLevel& scaleLevel,
|
||||
Rect& rect);
|
||||
static bool GetValidRect(const uint32_t width, const uint32_t height, Rect& rect);
|
||||
|
||||
static constexpr int32_t SAFE_PADDING_HORIZONTAL = 12;
|
||||
static constexpr int32_t SAFE_PADDING_VERTICAL_TOP = 150;
|
||||
static constexpr int32_t SAFE_PADDING_VERTICAL_BOTTOM = 350;
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
#endif // OHOS_ROSEN_WINDOW_PIP_UTIL_H
|
112
utils/src/pip_util.cpp
Normal file
112
utils/src/pip_util.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "pip_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
constexpr float DEFAULT_PROPORTION = 0.3;
|
||||
constexpr int32_t NUMBER_TWO = 2;
|
||||
constexpr int32_t NUMBER_THREE = 3;
|
||||
constexpr int32_t NUMBER_FOUR = 4;
|
||||
constexpr int32_t NUMBER_SEVEN = 7;
|
||||
}
|
||||
|
||||
void PiPUtil::UpdateRectPivot(const int32_t start, const uint32_t len, const uint32_t totalLen, PiPScalePivot& pivot)
|
||||
{
|
||||
int32_t end = static_cast<int32_t>(totalLen) - start - static_cast<int32_t>(len);
|
||||
if (start > end) {
|
||||
pivot = PiPScalePivot::END;
|
||||
} else if (start < end) {
|
||||
pivot = PiPScalePivot::START;
|
||||
} else {
|
||||
pivot = PiPScalePivot::MIDDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void PiPUtil::GetRectByPivot(int32_t& start, const uint32_t oldLen, const uint32_t len, const uint32_t totalLen,
|
||||
const PiPScalePivot& pivot)
|
||||
{
|
||||
switch (pivot) {
|
||||
default:
|
||||
case PiPScalePivot::START:
|
||||
break;
|
||||
case PiPScalePivot::MIDDLE:
|
||||
start = (static_cast<int32_t>(totalLen) - static_cast<int32_t>(len)) / NUMBER_TWO;
|
||||
break;
|
||||
case PiPScalePivot::END:
|
||||
start = start - static_cast<int32_t>(len) + static_cast<int32_t>(oldLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PiPUtil::GetRectByScale(const uint32_t width, const uint32_t height, const PiPScaleLevel& scaleLevel, Rect& rect)
|
||||
{
|
||||
uint32_t winWidth = rect.width_;
|
||||
uint32_t winHeight = rect.height_;
|
||||
if (winWidth == 0 || winHeight == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (scaleLevel) {
|
||||
default:
|
||||
case PiPScaleLevel::PIP_SCALE_LEVEL_SMALLEST: {
|
||||
float shortBorder = static_cast<float>(width < height ? width : height) * DEFAULT_PROPORTION;
|
||||
if (winWidth < winHeight) {
|
||||
rect.width_ = static_cast<uint32_t>(shortBorder);
|
||||
rect.height_ = rect.width_ * winHeight / winWidth;
|
||||
} else {
|
||||
rect.height_ = static_cast<uint32_t>(shortBorder);
|
||||
rect.width_ = rect.height_ * winWidth / winHeight;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PiPScaleLevel::PIP_SCALE_LEVEL_BIGGEST: {
|
||||
int32_t widthTmp = 0;
|
||||
if (winWidth < winHeight) {
|
||||
widthTmp = (NUMBER_THREE * static_cast<int32_t>(width) -
|
||||
NUMBER_SEVEN * SAFE_PADDING_HORIZONTAL) / NUMBER_FOUR;
|
||||
} else {
|
||||
widthTmp = static_cast<int32_t>(width) - NUMBER_TWO * SAFE_PADDING_HORIZONTAL;
|
||||
}
|
||||
rect.width_ = static_cast<uint32_t>(widthTmp);
|
||||
rect.height_ = rect.width_ * winHeight / winWidth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PiPUtil::GetValidRect(const uint32_t width, const uint32_t height, Rect& rect)
|
||||
{
|
||||
bool hasChanged = false;
|
||||
if (rect.posX_ < SAFE_PADDING_HORIZONTAL) {
|
||||
rect.posX_ = SAFE_PADDING_HORIZONTAL;
|
||||
hasChanged = true;
|
||||
} else if ((rect.posX_ + rect.width_) > (width - SAFE_PADDING_HORIZONTAL)) {
|
||||
rect.posX_ = width - SAFE_PADDING_HORIZONTAL - rect.width_;
|
||||
hasChanged = true;
|
||||
}
|
||||
if (rect.posY_ < SAFE_PADDING_VERTICAL_TOP) {
|
||||
rect.posY_ = SAFE_PADDING_VERTICAL_TOP;
|
||||
hasChanged = true;
|
||||
} else if ((rect.posY_ + rect.height_) > (width - SAFE_PADDING_VERTICAL_BOTTOM)) {
|
||||
rect.posY_ = height - SAFE_PADDING_VERTICAL_BOTTOM - rect.height_;
|
||||
hasChanged = true;
|
||||
}
|
||||
return hasChanged;
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -62,9 +62,9 @@ public:
|
||||
static napi_value SetScreenLocked(napi_env env, napi_callback_info info);
|
||||
static napi_value PreloadInLakeApp(napi_env env, napi_callback_info info);
|
||||
static napi_value AddWindowDragHotArea(napi_env env, napi_callback_info info);
|
||||
static napi_value UpdateTitleInTargetPos(napi_env env, napi_callback_info info);
|
||||
static napi_value UpdateMaximizeMode(napi_env env, napi_callback_info info);
|
||||
static napi_value NotifyAINavigationBarShowStatus(napi_env env, napi_callback_info info);
|
||||
static napi_value UpdateTitleInTargetPos(napi_env env, napi_callback_info info);
|
||||
|
||||
private:
|
||||
napi_value OnRegisterCallback(napi_env env, napi_callback_info info);
|
||||
|
@ -31,7 +31,7 @@
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelProxy"};
|
||||
constexpr int32_t MAX_COUNT = 9 * 9 * 1000000;
|
||||
constexpr int32_t MAX_COUNT = 210 * 9 * 9 * 100000;
|
||||
}
|
||||
|
||||
WSError WindowEventChannelProxy::TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
|
||||
|
@ -29,6 +29,7 @@ enum class ScenePersistentStorageType : uint32_t {
|
||||
UKNOWN = 0,
|
||||
ASPECT_RATIO,
|
||||
MAXIMIZE_STATE,
|
||||
PIP_INFO,
|
||||
};
|
||||
|
||||
class ScenePersistentStorage {
|
||||
@ -59,6 +60,12 @@ public:
|
||||
key.c_str(), static_cast<int>(value));
|
||||
break;
|
||||
}
|
||||
case ScenePersistentStorageType::PIP_INFO: {
|
||||
pref->PutInt(key, value);
|
||||
WLOGD("[ScenePersistentStorage] Insert PicutreInPicture info, key %{public}s, value %{public}d",
|
||||
key.c_str(), static_cast<int>(value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WLOGW("[ScenePersistentStorage] Unknown storage type!");
|
||||
}
|
||||
@ -86,6 +93,12 @@ public:
|
||||
key.c_str(), static_cast<int>(value));
|
||||
break;
|
||||
}
|
||||
case ScenePersistentStorageType::PIP_INFO: {
|
||||
value = pref->GetInt(key);
|
||||
WLOGD("[ScenePersistentStorage] Get PicutreInPicture info, key: %{public}s, value:%{public}d",
|
||||
key.c_str(), static_cast<int>(value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WLOGW("[ScenePersistentStorage] Unknown storage type!");
|
||||
}
|
||||
|
@ -214,6 +214,7 @@ public:
|
||||
void NotifySessionForeground(uint32_t reason, bool withAnimation);
|
||||
void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits);
|
||||
void NotifyPiPWindowPrepareClose() override;
|
||||
WSError UpdatePiPRect(uint32_t width, uint32_t height, PiPRectUpdateReason reason) override;
|
||||
|
||||
private:
|
||||
void HandleStyleEvent(MMI::WindowArea area) override;
|
||||
@ -248,6 +249,13 @@ private:
|
||||
WSRect lastSafeRect = { 0, 0, 0, 0 };
|
||||
std::vector<sptr<SceneSession>> subSession_;
|
||||
bool needDefaultAnimationFlag_ = true;
|
||||
|
||||
PiPRectInfo pipRectInfo_;
|
||||
bool InitPiPRectInfo();
|
||||
void ClearPiPRectPivotInfo();
|
||||
void SavePiPRectInfo();
|
||||
void GetNewPiPRect(const uint32_t displayWidth, const uint32_t displayHeight, Rect& rect);
|
||||
void ProcessUpdatePiPRect(SizeChangeReason reason);
|
||||
public:
|
||||
double textFieldPositionY_ = 0.0;
|
||||
double textFieldHeight_ = 0.0;
|
||||
|
@ -80,10 +80,12 @@ public:
|
||||
virtual void NotifySyncOn() {}
|
||||
virtual void NotifyAsyncOn() {}
|
||||
virtual void NotifyTransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
|
||||
const std::vector<int32_t>& uiExtensionIdLevelVec) {}
|
||||
const std::vector<int32_t>& uiExtensionIdLevelVec) {}
|
||||
|
||||
// PictureInPicture
|
||||
virtual void NotifyPiPWindowPrepareClose() {}
|
||||
virtual WSError UpdatePiPRect(uint32_t width, uint32_t height, PiPRectUpdateReason reason)
|
||||
{ return WSError::WS_OK; }
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
|
@ -57,7 +57,8 @@ enum class SessionInterfaceCode {
|
||||
TRANS_ID_NOTIFY_REPORT_ACCESSIBILITY_EVENT,
|
||||
|
||||
//PictureInPicture
|
||||
TRANS_ID_NOTIFY_PIP_WINDOW_PREPARE_CLOSE = 800
|
||||
TRANS_ID_NOTIFY_PIP_WINDOW_PREPARE_CLOSE = 800,
|
||||
TRANS_ID_UPDATE_PIP_RECT
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
void NotifyExtensionDied() override;
|
||||
|
||||
void NotifyPiPWindowPrepareClose() override;
|
||||
WSError UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason) override;
|
||||
private:
|
||||
static inline BrokerDelegator<SessionProxy> delegator_;
|
||||
};
|
||||
|
@ -69,6 +69,7 @@ private:
|
||||
int HandleNotifyAsyncOn(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleNotifyExtensionDied(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleTransferAccessibilityEvent(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleUpdatePiPRect(MessageParcel& data, MessageParcel& reply);
|
||||
static const std::map<uint32_t, SessionStubFunc> stubFuncMap_;
|
||||
|
||||
// PictureInPicture
|
||||
|
@ -74,6 +74,7 @@ void ScenePersistentStorage::InitDir(std::string dir)
|
||||
storagePath_ = {
|
||||
{ ScenePersistentStorageType::ASPECT_RATIO, saveDir_ + "/session_window_aspect_ratio" },
|
||||
{ ScenePersistentStorageType::MAXIMIZE_STATE, saveDir_ + "/session_window_maximize_state" },
|
||||
{ ScenePersistentStorageType::PIP_INFO, saveDir_ + "/session_pip_window_location_info" },
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "common/include/session_permission.h"
|
||||
#include "interfaces/include/ws_common.h"
|
||||
#include "pixel_map.h"
|
||||
#include "pip_util.h"
|
||||
#include "session/host/include/scene_persistent_storage.h"
|
||||
#include "session/host/include/session_utils.h"
|
||||
#include "display_manager.h"
|
||||
@ -397,6 +398,11 @@ WSError SceneSession::UpdateRect(const WSRect& rect, SizeChangeReason reason,
|
||||
return WSError::WS_ERROR_REPEAT_OPERATION;
|
||||
}
|
||||
WSError ret = session->Session::UpdateRect(rect, reason, rsTransaction);
|
||||
if (WindowHelper::IsPipWindow(session->GetWindowType()) && reason == SizeChangeReason::DRAG_END) {
|
||||
session->ClearPiPRectPivotInfo();
|
||||
ScenePersistentStorage::Insert("pip_window_pos_x", rect.posX_, ScenePersistentStorageType::PIP_INFO);
|
||||
ScenePersistentStorage::Insert("pip_window_pos_y", rect.posY_, ScenePersistentStorageType::PIP_INFO);
|
||||
}
|
||||
if ((ret == WSError::WS_OK || session->sessionInfo_.isSystem_) && session->specificCallback_ != nullptr) {
|
||||
session->specificCallback_->onUpdateAvoidArea_(session->GetPersistentId());
|
||||
}
|
||||
@ -1921,4 +1927,137 @@ WSError SceneSession::SetTextFieldAvoidInfo(double textFieldPositionY, double te
|
||||
textFieldHeight_ = textFieldHeight;
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
bool SceneSession::InitPiPRectInfo()
|
||||
{
|
||||
auto requestRect = GetSessionRequestRect();
|
||||
if (requestRect.width_ == 0 || requestRect.height_ == 0) {
|
||||
return false;
|
||||
}
|
||||
pipRectInfo_.originWidth_ = requestRect.width_;
|
||||
pipRectInfo_.originHeight_ = requestRect.height_;
|
||||
int32_t level = 0;
|
||||
ScenePersistentStorage::Get("pip_window_level", level, ScenePersistentStorageType::PIP_INFO);
|
||||
pipRectInfo_.level_ = static_cast<PiPScaleLevel>(level);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SceneSession::ClearPiPRectPivotInfo()
|
||||
{
|
||||
pipRectInfo_.xPivot_ = PiPScalePivot::UNDEFINED;
|
||||
pipRectInfo_.yPivot_ = PiPScalePivot::UNDEFINED;
|
||||
}
|
||||
|
||||
void SceneSession::SavePiPRectInfo()
|
||||
{
|
||||
auto pipRect = GetSessionRequestRect();
|
||||
ScenePersistentStorage::Insert("pip_window_pos_x", pipRect.posX_, ScenePersistentStorageType::PIP_INFO);
|
||||
ScenePersistentStorage::Insert("pip_window_pos_y", pipRect.posY_, ScenePersistentStorageType::PIP_INFO);
|
||||
ScenePersistentStorage::Insert("pip_window_level", static_cast<int32_t>(pipRectInfo_.level_),
|
||||
ScenePersistentStorageType::PIP_INFO);
|
||||
}
|
||||
|
||||
void SceneSession::GetNewPiPRect(const uint32_t displayWidth, const uint32_t displayHeight, Rect& rect)
|
||||
{
|
||||
PiPUtil::GetRectByScale(displayWidth, displayHeight, pipRectInfo_.level_, rect);
|
||||
WLOGD("SceneSession::GetNewPiPRect rect = (%{public}d, %{public}d, %{public}d, %{public}d)",
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
auto requestRect = GetSessionRequestRect();
|
||||
if (pipRectInfo_.xPivot_ == PiPScalePivot::UNDEFINED || pipRectInfo_.yPivot_ == PiPScalePivot::UNDEFINED) {
|
||||
// If no anchor, create anchor
|
||||
WLOGD("SceneSession::GetNewPiPRect can't find anchor, create it");
|
||||
PiPUtil::UpdateRectPivot(rect.posX_, rect.width_, displayWidth, pipRectInfo_.xPivot_);
|
||||
PiPUtil::UpdateRectPivot(rect.posY_, rect.height_, displayHeight, pipRectInfo_.yPivot_);
|
||||
} else {
|
||||
// If it has anchor, location by anchor
|
||||
WLOGD("SceneSession::GetNewPiPRect find anchor, resize");
|
||||
PiPUtil::GetRectByPivot(rect.posX_, requestRect.width_, rect.width_, displayWidth, pipRectInfo_.xPivot_);
|
||||
PiPUtil::GetRectByPivot(rect.posY_, requestRect.height_, rect.height_, displayHeight, pipRectInfo_.yPivot_);
|
||||
}
|
||||
PiPUtil::GetValidRect(displayWidth, displayHeight, rect);
|
||||
WLOGD("SceneSession::GetNewPiPRect valid rect = (%{public}d, %{public}d, %{public}d, %{public}d)",
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
}
|
||||
|
||||
void SceneSession::ProcessUpdatePiPRect(SizeChangeReason reason)
|
||||
{
|
||||
if (GetWindowType() != WindowType::WINDOW_TYPE_PIP) {
|
||||
WLOGE("SceneSessionManager::ProcessUpdatePiPRect not pip window");
|
||||
return;
|
||||
}
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
if (!display) {
|
||||
WLOGFE("can't find display info");
|
||||
return;
|
||||
}
|
||||
uint32_t displayWidth = static_cast<uint32_t>(display->GetWidth());
|
||||
uint32_t displayHeight = static_cast<uint32_t>(display->GetHeight());
|
||||
|
||||
// default pos of phone is the right top
|
||||
Rect rect = { 0, 0, pipRectInfo_.originWidth_, pipRectInfo_.originHeight_ };
|
||||
ScenePersistentStorage::Get("pip_window_pos_x", rect.posX_, ScenePersistentStorageType::PIP_INFO);
|
||||
ScenePersistentStorage::Get("pip_window_pos_y", rect.posY_, ScenePersistentStorageType::PIP_INFO);
|
||||
if (rect.posX_ == 0) {
|
||||
rect.posX_ = displayWidth - PiPUtil::SAFE_PADDING_HORIZONTAL;
|
||||
}
|
||||
if (rect.posY_ == 0) {
|
||||
rect.posY_ = PiPUtil::SAFE_PADDING_VERTICAL_TOP;
|
||||
}
|
||||
WLOGD("SceneSession::ProcessUpdatePiPRectpip window rect: (%{public}d, %{public}d, %{public}u, %{public}u)",
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
|
||||
GetNewPiPRect(displayWidth, displayHeight, rect);
|
||||
WLOGD("SceneSession::ProcessUpdatePiPRectpip window new rect: (%{public}d, %{public}d, %{public}u, %{public}u)",
|
||||
rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
ScenePersistentStorage::Insert("pip_window_pos_x", rect.posX_, ScenePersistentStorageType::PIP_INFO);
|
||||
ScenePersistentStorage::Insert("pip_window_pos_y", rect.posY_, ScenePersistentStorageType::PIP_INFO);
|
||||
|
||||
WSRect newRect = SessionHelper::TransferToWSRect(rect);
|
||||
SetSessionRect(newRect);
|
||||
Session::UpdateRect(newRect, reason);
|
||||
NotifySessionRectChange(newRect, reason);
|
||||
}
|
||||
|
||||
WSError SceneSession::UpdatePiPRect(uint32_t width, uint32_t height, PiPRectUpdateReason reason)
|
||||
{
|
||||
PostTask([weakThis = wptr(this), width, height, reason]() {
|
||||
auto session = weakThis.promote();
|
||||
if (!session) {
|
||||
WLOGE("SceneSession::UpdatePiPRect session is null");
|
||||
return WSError::WS_ERROR_DESTROYED_OBJECT;
|
||||
}
|
||||
if (session->isTerminating) {
|
||||
WLOGE("SceneSession::UpdatePiPRect session is terminating");
|
||||
return WSError::WS_ERROR_INVALID_OPERATION;
|
||||
}
|
||||
switch (reason) {
|
||||
case PiPRectUpdateReason::REASON_PIP_START_WINDOW:
|
||||
session->InitPiPRectInfo();
|
||||
session->ProcessUpdatePiPRect(SizeChangeReason::CUSTOM_ANIMATION_SHOW);
|
||||
break;
|
||||
case PiPRectUpdateReason::REASON_PIP_SCALE_CHANGE:
|
||||
session->pipRectInfo_.level_ = static_cast<PiPScaleLevel>((static_cast<int32_t>(
|
||||
session->pipRectInfo_.level_) + 1) % static_cast<int32_t>(PiPScaleLevel::COUNT));
|
||||
session->ProcessUpdatePiPRect(SizeChangeReason::TRANSFORM);
|
||||
break;
|
||||
case PiPRectUpdateReason::REASON_PIP_VIDEO_RATIO_CHANGE:
|
||||
session->ClearPiPRectPivotInfo();
|
||||
session->pipRectInfo_.originWidth_ = width;
|
||||
session->pipRectInfo_.originHeight_ = height;
|
||||
session->ProcessUpdatePiPRect(SizeChangeReason::UNDEFINED);
|
||||
break;
|
||||
case PiPRectUpdateReason::REASON_PIP_MOVE:
|
||||
session->ClearPiPRectPivotInfo();
|
||||
break;
|
||||
case PiPRectUpdateReason::REASON_PIP_DESTROY_WINDOW:
|
||||
session->ClearPiPRectPivotInfo();
|
||||
session->SavePiPRectInfo();
|
||||
break;
|
||||
default:
|
||||
return WSError::WS_DO_NOTHING;
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
});
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -876,4 +876,30 @@ void SessionProxy::NotifyPiPWindowPrepareClose()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WSError SessionProxy::UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteUint32(width)) {
|
||||
WLOGFE("width write failed.");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (!data.WriteUint32(height)) {
|
||||
WLOGFE("height write failed.");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (!data.WriteInt32(static_cast<int32_t>(reason))) {
|
||||
WLOGFE("reason write failed.");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_UPDATE_PIP_RECT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return WSError::WS_ERROR_IPC_FAILED;
|
||||
}
|
||||
int32_t ret = reply.ReadInt32();
|
||||
return static_cast<WSError>(ret);
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -97,7 +97,9 @@ const std::map<uint32_t, SessionStubFunc> SessionStub::stubFuncMap_ {
|
||||
std::make_pair(static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_NOTIFY_REPORT_ACCESSIBILITY_EVENT),
|
||||
&SessionStub::HandleTransferAccessibilityEvent),
|
||||
std::make_pair(static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_NOTIFY_PIP_WINDOW_PREPARE_CLOSE),
|
||||
&SessionStub::HandleNotifyPiPWindowPrepareClose)
|
||||
&SessionStub::HandleNotifyPiPWindowPrepareClose),
|
||||
std::make_pair(static_cast<uint32_t>(SessionInterfaceCode::TRANS_ID_UPDATE_PIP_RECT),
|
||||
&SessionStub::HandleUpdatePiPRect)
|
||||
};
|
||||
|
||||
int SessionStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
@ -490,16 +492,14 @@ int SessionStub::HandleNotifyExtensionDied(MessageParcel& data, MessageParcel& r
|
||||
|
||||
int SessionStub::HandleTransferAccessibilityEvent(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFD("HandleTransferAccessibilityEvent begin!");
|
||||
sptr<AccessibilityEventInfoParcel> infoPtr =
|
||||
reply.ReadStrongParcelable<AccessibilityEventInfoParcel>();
|
||||
data.ReadStrongParcelable<AccessibilityEventInfoParcel>();
|
||||
std::vector<int32_t> uiExtensionIdLevelVec;
|
||||
if (!reply.ReadInt32Vector(&uiExtensionIdLevelVec)) {
|
||||
if (!data.ReadInt32Vector(&uiExtensionIdLevelVec)) {
|
||||
WLOGFE("read idVect error");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
NotifyTransferAccessibilityEvent(*infoPtr, uiExtensionIdLevelVec);
|
||||
WLOGFD("HandleTransferAccessibilityEvent end!");
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
@ -509,4 +509,15 @@ int SessionStub::HandleNotifyPiPWindowPrepareClose(MessageParcel& data, MessageP
|
||||
NotifyPiPWindowPrepareClose();
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int SessionStub::HandleUpdatePiPRect(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFD("HandleUpdatePiPRect!");
|
||||
uint32_t width = data.ReadUint32();
|
||||
uint32_t height = data.ReadUint32();
|
||||
auto reason = static_cast<PiPRectUpdateReason>(data.ReadInt32());
|
||||
WSError errCode = UpdatePiPRect(width, height, reason);
|
||||
reply.WriteUint32(static_cast<uint32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -426,6 +426,8 @@ private:
|
||||
void NotifySessionBackground(const sptr<SceneSession>& session, uint32_t reason, bool withAnimation,
|
||||
bool isFromInnerkits);
|
||||
sptr<SceneSession> CreateSceneSession(const SessionInfo& sessionInfo, sptr<WindowSessionProperty> property);
|
||||
|
||||
void ProcessPiPSessionForeground(const sptr<SceneSession> sceneSession);
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
|
@ -84,6 +84,7 @@
|
||||
#include "softbus_bus_center.h"
|
||||
#include "window_manager.h"
|
||||
#include "perform_reporter.h"
|
||||
#include "pip_util.h"
|
||||
#include "focus_change_info.h"
|
||||
|
||||
#include "window_visibility_info.h"
|
||||
@ -3186,6 +3187,9 @@ void SceneSessionManager::OnSessionStateChange(int32_t persistentId, const Sessi
|
||||
if (sceneSession->GetWindowType() == WindowType::WINDOW_TYPE_APP_MAIN_WINDOW) {
|
||||
ProcessSubSessionForeground(sceneSession);
|
||||
}
|
||||
if (sceneSession->GetWindowType() == WindowType::WINDOW_TYPE_PIP) {
|
||||
ProcessPiPSessionForeground(sceneSession);
|
||||
}
|
||||
break;
|
||||
case SessionState::STATE_BACKGROUND:
|
||||
RequestSessionUnfocus(persistentId);
|
||||
@ -5117,6 +5121,16 @@ WSError SceneSessionManager::UnregisterIAbilityManagerCollaborator(int32_t type)
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void SceneSessionManager::ProcessPiPSessionForeground(const sptr<SceneSession> sceneSession)
|
||||
{
|
||||
if (sceneSession == nullptr) {
|
||||
WLOGFE("pip window not found");
|
||||
return;
|
||||
}
|
||||
WLOGFD("start pip rect");
|
||||
sceneSession->UpdatePiPRect(0, 0, PiPRectUpdateReason::REASON_PIP_START_WINDOW);
|
||||
}
|
||||
|
||||
bool SceneSessionManager::CheckCollaboratorType(int32_t type)
|
||||
{
|
||||
if (type != CollaboratorType::RESERVE_TYPE && type != CollaboratorType::OTHERS_TYPE) {
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
MOCK_METHOD0(NotifyCloseExistPipWindow, WSError(void));
|
||||
MOCK_METHOD2(NotifySessionForeground, void(uint32_t reason, bool withAnimation));
|
||||
MOCK_METHOD3(NotifySessionBackground, void(uint32_t reason, bool withAnimation, bool isFromInnerkits));
|
||||
MOCK_METHOD2(UpdateTitleInTargetPos, WSError(bool isShow, int32_t height));
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -42,6 +42,15 @@ public:
|
||||
void IsAutoStartEnabled(bool& enable) const;
|
||||
void UpdateContentSize(uint32_t width, uint32_t height);
|
||||
void StartMove();
|
||||
void DoScale();
|
||||
|
||||
class PipMainWindowLifeCycleImpl : public Rosen::IWindowLifeCycle {
|
||||
public:
|
||||
PipMainWindowLifeCycleImpl() {};
|
||||
~PipMainWindowLifeCycleImpl() {};
|
||||
void AfterBackground() override;
|
||||
void BackgroundFailed(int32_t type) override;
|
||||
};
|
||||
private:
|
||||
WMError CreatePictureInPictureWindow();
|
||||
WMError ShowPictureInPictureWindow();
|
||||
|
@ -38,21 +38,26 @@ public:
|
||||
static void SetCurrentPipController(sptr<PictureInPictureController> pipController);
|
||||
static void RemoveCurrentPipController();
|
||||
static void RemoveCurrentPipControllerSafety();
|
||||
static void AttachActivePipController(sptr<PictureInPictureController> pipController);
|
||||
static void DetachActivePipController(sptr<PictureInPictureController> pipController);
|
||||
|
||||
static bool IsAttachedPipWindow(uint32_t windowId);
|
||||
static sptr<Window> GetCurrentWindow();
|
||||
static bool IsActiveController(wptr<PictureInPictureController> pipController);
|
||||
|
||||
static void DoRestore();
|
||||
static void DoClose(bool needAnim);
|
||||
static void DoStartMove();
|
||||
static void DoScale();
|
||||
static void DoActionEvent(std::string actionName);
|
||||
static void AutoStartPipWindow();
|
||||
private:
|
||||
static sptr<PictureInPictureController> curPipController_;
|
||||
static sptr<PictureInPictureController> activePipController_;
|
||||
static std::map<int32_t, sptr<PictureInPictureController>> windowToControllerMap_;
|
||||
static std::mutex pipWindowStateMutex_;
|
||||
static PipWindowState pipWindowState_;
|
||||
static sptr<IWindowLifeCycle> mainWindowLifeCycleImpl_;
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration);
|
||||
static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
|
||||
static sptr<Window> GetTopWindowWithId(uint32_t mainWinId);
|
||||
static sptr<WindowSessionImpl> GetMainWindowWithId(uint32_t mainWinId);
|
||||
virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) override;
|
||||
WMError NotifyMemoryLevel(int32_t level) override;
|
||||
|
||||
@ -122,9 +123,9 @@ public:
|
||||
void DumpSessionElementInfo(const std::vector<std::string>& params) override;
|
||||
WSError UpdateWindowMode(WindowMode mode) override;
|
||||
WSError UpdateMaximizeMode(MaximizeMode mode) override;
|
||||
WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override;
|
||||
void NotifySessionForeground(uint32_t reason, bool withAnimation) override;
|
||||
void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) override;
|
||||
WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override;
|
||||
WMError NotifyPrepareClosePiPWindow() override;
|
||||
|
||||
protected:
|
||||
|
@ -165,6 +165,7 @@ public:
|
||||
void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) override;
|
||||
WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override;
|
||||
|
||||
void UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason) override;
|
||||
protected:
|
||||
WMError Connect();
|
||||
bool IsWindowSessionInvalid() const;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <event_handler.h>
|
||||
#include <refbase.h>
|
||||
#include <power_mgr_client.h>
|
||||
#include "picture_in_picture_manager.h"
|
||||
#include "picture_in_picture_option.h"
|
||||
#include "window_manager_hilog.h"
|
||||
@ -158,6 +159,7 @@ WMError PictureInPictureController::StopPictureInPicture(bool needAnim)
|
||||
WLOGFE("Window destroy failed");
|
||||
return WMError::WM_ERROR_PIP_DESTROY_FAILED;
|
||||
}
|
||||
window_->UpdatePiPRect(0, 0, PiPRectUpdateReason::REASON_PIP_DESTROY_WINDOW);
|
||||
PictureInPictureManager::RemoveCurrentPipController();
|
||||
PictureInPictureManager::RemovePipControllerInfo(window_->GetWindowId());
|
||||
window_ = nullptr;
|
||||
@ -176,7 +178,7 @@ WMError PictureInPictureController::StopPictureInPicture(bool needAnim)
|
||||
|
||||
sptr<Window> PictureInPictureController::GetPipWindow()
|
||||
{
|
||||
WLOGFD("GetWindow is called");
|
||||
WLOGFD("GetPipWindow is called");
|
||||
return window_;
|
||||
}
|
||||
|
||||
@ -195,6 +197,11 @@ void PictureInPictureController::SetPipWindow(sptr<Window> window)
|
||||
void PictureInPictureController::SetAutoStartEnabled(bool enable)
|
||||
{
|
||||
isAutoStartEnabled_ = enable;
|
||||
if (isAutoStartEnabled_) {
|
||||
PictureInPictureManager::AttachActivePipController(this);
|
||||
} else {
|
||||
PictureInPictureManager::DetachActivePipController(this);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureInPictureController::IsAutoStartEnabled(bool& enable) const
|
||||
@ -204,16 +211,48 @@ void PictureInPictureController::IsAutoStartEnabled(bool& enable) const
|
||||
|
||||
void PictureInPictureController::UpdateContentSize(uint32_t width, uint32_t height)
|
||||
{
|
||||
WLOGI("UpdateDisplaySize is called");
|
||||
return;
|
||||
WLOGI("UpdateContentSize is called");
|
||||
if (window_ == nullptr) {
|
||||
WLOGFE("PiPWindow is not exist");
|
||||
return;
|
||||
}
|
||||
window_->UpdatePiPRect(windowRect_.width_, windowRect_.height_,
|
||||
PiPRectUpdateReason::REASON_PIP_VIDEO_RATIO_CHANGE);
|
||||
}
|
||||
|
||||
void PictureInPictureController::StartMove()
|
||||
{
|
||||
WLOGI("StartMove is called");
|
||||
if (window_ == nullptr) {
|
||||
WLOGFE("window_ is nullptr");
|
||||
WLOGFE("PiPWindow is not exist");
|
||||
return;
|
||||
}
|
||||
window_->StartMove();
|
||||
}
|
||||
|
||||
void PictureInPictureController::DoScale()
|
||||
{
|
||||
WLOGI("DoScale is called");
|
||||
if (window_ == nullptr) {
|
||||
WLOGFE("PiPWindow is not exist");
|
||||
return;
|
||||
}
|
||||
window_->UpdatePiPRect(0, 0, PiPRectUpdateReason::REASON_PIP_SCALE_CHANGE);
|
||||
}
|
||||
|
||||
void PictureInPictureController::PipMainWindowLifeCycleImpl::AfterBackground()
|
||||
{
|
||||
WLOGI("PipMainWindowLifeCycleImpl AfterBackground is called");
|
||||
if (!PowerMgr::PowerMgrClient::GetInstance().IsScreenOn()) {
|
||||
WLOGFE("screen is off");
|
||||
return;
|
||||
}
|
||||
PictureInPictureManager::AutoStartPipWindow();
|
||||
}
|
||||
|
||||
void PictureInPictureController::PipMainWindowLifeCycleImpl::BackgroundFailed(int32_t type)
|
||||
{
|
||||
WLOGI("PipMainWindowLifeCycleImpl BackgroundFailed is called");
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -19,6 +19,7 @@
|
||||
#include "picture_in_picture_controller.h"
|
||||
#include "window.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "window_scene_session_impl.h"
|
||||
#include "wm_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -32,6 +33,7 @@ sptr<PictureInPictureController> PictureInPictureManager::activePipController_ =
|
||||
std::map<int32_t, sptr<PictureInPictureController>> PictureInPictureManager::windowToControllerMap_ = {};
|
||||
std::mutex PictureInPictureManager::pipWindowStateMutex_;
|
||||
PipWindowState PictureInPictureManager::pipWindowState_ = PipWindowState::STATE_UNDEFINED;
|
||||
sptr<IWindowLifeCycle> PictureInPictureManager::mainWindowLifeCycleImpl_;
|
||||
|
||||
PictureInPictureManager::PictureInPictureManager()
|
||||
{
|
||||
@ -104,6 +106,44 @@ void PictureInPictureManager::RemoveCurrentPipControllerSafety()
|
||||
RemoveCurrentPipController();
|
||||
}
|
||||
|
||||
void PictureInPictureManager::AttachActivePipController(sptr<PictureInPictureController> pipController)
|
||||
{
|
||||
WLOGD("Attach active pipController");
|
||||
if (pipController == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (activePipController_ != nullptr && mainWindowLifeCycleImpl_ != nullptr) {
|
||||
sptr<WindowSessionImpl> previousMainWindow = WindowSceneSessionImpl::GetMainWindowWithId(
|
||||
activePipController_ -> GetMainWindowId());
|
||||
if (previousMainWindow != nullptr) {
|
||||
previousMainWindow -> UnregisterLifeCycleListener(mainWindowLifeCycleImpl_);
|
||||
}
|
||||
}
|
||||
activePipController_ = pipController;
|
||||
sptr<WindowSessionImpl> mainWindow = WindowSceneSessionImpl::GetMainWindowWithId(
|
||||
activePipController_ -> GetMainWindowId());
|
||||
if (mainWindow != nullptr) {
|
||||
mainWindowLifeCycleImpl_ = new PictureInPictureController::PipMainWindowLifeCycleImpl();
|
||||
mainWindow -> RegisterLifeCycleListener(mainWindowLifeCycleImpl_);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureInPictureManager::DetachActivePipController(sptr<PictureInPictureController> pipController)
|
||||
{
|
||||
WLOGD("Detach active pipController");
|
||||
if (pipController != nullptr &&
|
||||
pipController.GetRefPtr() != activePipController_.GetRefPtr()) {
|
||||
WLOGFE("not same pip controller or no active pip controller");
|
||||
return;
|
||||
}
|
||||
sptr<WindowSessionImpl> mainWindow = WindowSceneSessionImpl::GetMainWindowWithId(
|
||||
activePipController_ -> GetMainWindowId());
|
||||
if (mainWindow != nullptr && mainWindowLifeCycleImpl_ != nullptr) {
|
||||
mainWindow -> UnregisterLifeCycleListener(mainWindowLifeCycleImpl_);
|
||||
}
|
||||
activePipController_ = nullptr;
|
||||
}
|
||||
|
||||
bool PictureInPictureManager::IsAttachedPipWindow(uint32_t windowId)
|
||||
{
|
||||
WLOGD("IsAttachedPipWindow is called");
|
||||
@ -122,6 +162,11 @@ sptr<Window> PictureInPictureManager::GetCurrentWindow()
|
||||
return curPipController_->GetPipWindow();
|
||||
}
|
||||
|
||||
bool PictureInPictureManager::IsActiveController(wptr<PictureInPictureController> pipController)
|
||||
{
|
||||
return pipController.GetRefPtr() == activePipController_.GetRefPtr();
|
||||
}
|
||||
|
||||
void PictureInPictureManager::DoRestore()
|
||||
{
|
||||
WLOGD("DoRestore is called");
|
||||
@ -154,5 +199,15 @@ void PictureInPictureManager::DoActionEvent(std::string actionName)
|
||||
{
|
||||
WLOGD("DoActionEvent is called");
|
||||
}
|
||||
|
||||
void PictureInPictureManager::AutoStartPipWindow()
|
||||
{
|
||||
WLOGD("AutoStartPipWindow is called");
|
||||
if (activePipController_ == nullptr) {
|
||||
WLOGFE("activePipController_ is null");
|
||||
return;
|
||||
}
|
||||
activePipController_ -> StartPictureInPicture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +310,6 @@ WSError WindowExtensionSessionImpl::NotifyExecuteAction(int32_t elementId,
|
||||
WMError WindowExtensionSessionImpl::TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
|
||||
const std::vector<int32_t>& uiExtensionIdLevelVec)
|
||||
{
|
||||
WLOGFD("TransferAccessibilityEvent IN, vec.size:%{public}d", uiExtensionIdLevelVec.size());
|
||||
if (IsWindowSessionInvalid()) {
|
||||
WLOGFE("Window session invalid.");
|
||||
return WMError::WM_ERROR_REPEAT_OPERATION;
|
||||
|
@ -1469,6 +1469,11 @@ sptr<Window> WindowSceneSessionImpl::GetTopWindowWithContext(const std::shared_p
|
||||
}
|
||||
|
||||
sptr<Window> WindowSceneSessionImpl::GetTopWindowWithId(uint32_t mainWinId)
|
||||
{
|
||||
return GetMainWindowWithId(mainWinId);
|
||||
}
|
||||
|
||||
sptr<WindowSessionImpl> WindowSceneSessionImpl::GetMainWindowWithId(uint32_t mainWinId)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(windowSessionMutex_);
|
||||
if (windowSessionMap_.empty()) {
|
||||
|
@ -1743,5 +1743,14 @@ WSError WindowSessionImpl::UpdateTitleInTargetPos(bool isShow, int32_t height)
|
||||
{
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void WindowSessionImpl::UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason)
|
||||
{
|
||||
if (IsWindowSessionInvalid()) {
|
||||
WLOGFE("HostSession is invalid");
|
||||
return;
|
||||
}
|
||||
hostSession_->UpdatePiPRect(width, height, reason);
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
Loading…
x
Reference in New Issue
Block a user