mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-02-12 11:19:30 +00:00
视频暂停熄屏
Signed-off-by: zhengleran <zhengleran@huawei.com>
This commit is contained in:
parent
979a4aa406
commit
d927348237
@ -888,11 +888,13 @@ public:
|
||||
int32_t x, int32_t y, std::vector<int32_t>& windowIds) const;
|
||||
|
||||
/**
|
||||
* @brief Release screen lock of foreground sessions.
|
||||
* @brief Update screen lock status for app.
|
||||
*
|
||||
* @return WM_OK means release success, others means failed.
|
||||
* @param bundleName BundleName of specific app
|
||||
* @param isRelease True means screen lock, false means reLock screen lock
|
||||
* @return WM_OK means update success, others means failed.
|
||||
*/
|
||||
WMError ReleaseForegroundSessionScreenLock();
|
||||
WMError UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease);
|
||||
|
||||
/**
|
||||
* @brief Get displayId by windowId.
|
||||
|
@ -457,7 +457,7 @@ public:
|
||||
/*
|
||||
* Window Property
|
||||
*/
|
||||
WMError ReleaseForegroundSessionScreenLock() override;
|
||||
WMError UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease) override;
|
||||
void DealwithDrawingContentChange(const std::vector<std::pair<uint64_t, bool>>& drawingContentChangeInfo);
|
||||
|
||||
/*
|
||||
@ -751,6 +751,7 @@ private:
|
||||
/*
|
||||
* Window Property
|
||||
*/
|
||||
std::unordered_map<std::string, std::unordered_set<int32_t>> releasedScreenLockMap_;
|
||||
std::vector<std::pair<uint64_t, bool>> GetWindowDrawingContentChangeInfo(
|
||||
const std::vector<std::pair<uint64_t, bool>>& currDrawingContentData);
|
||||
bool GetPreWindowDrawingState(uint64_t surfaceId, bool currentWindowDrawing, int32_t& pid);
|
||||
@ -758,6 +759,10 @@ private:
|
||||
void UpdateWindowDrawingData(uint64_t surfaceId, int32_t pid, int32_t uid);
|
||||
bool GetSpecifiedDrawingData(uint64_t surfaceId, int32_t& pid, int32_t& uid);
|
||||
void RemoveSpecifiedDrawingData(uint64_t surfaceId);
|
||||
WMError ReleaseScreenLockForApp(const std::string& bundleName);
|
||||
WMError RelockScreenLockForApp(const std::string& bundleName);
|
||||
void GetAllSessionsToReleaseScreenLock(
|
||||
std::vector<sptr<SceneSession>>& sessionsToReleaseScreenLock, const std::string& bundleName);
|
||||
|
||||
/*
|
||||
* Window Rotate Animation
|
||||
@ -1161,7 +1166,7 @@ private:
|
||||
int32_t uid_ = 0;
|
||||
};
|
||||
std::unordered_map<uint64_t, DrawingSessionInfo> lastDrawingSessionInfoMap_;
|
||||
|
||||
|
||||
/*
|
||||
* Move Drag
|
||||
*/
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
TRANS_ID_SET_SNAPSHOT_SKIP_BY_USERID_AND_BUNDLENAMES,
|
||||
TRANS_ID_SET_PROCESS_WATERMARK,
|
||||
TRANS_ID_GET_WINDOW_IDS_BY_COORDINATE,
|
||||
TRANS_ID_RELEASE_SESSION_SCREEN_LOCK,
|
||||
TRANS_ID_UPDATE_SESSION_SCREEN_LOCK,
|
||||
TRANS_ID_IS_PC_WINDOW,
|
||||
TRANS_ID_IS_PC_OR_PAD_FREE_MULTI_WINDOW_MODE,
|
||||
TRANS_ID_GET_DISPLAYID_BY_WINDOWID,
|
||||
@ -338,7 +338,8 @@ public:
|
||||
WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber, int32_t x, int32_t y,
|
||||
std::vector<int32_t>& windowIds) override { return WMError::WM_OK; }
|
||||
|
||||
WMError ReleaseForegroundSessionScreenLock() override { return WMError::WM_OK; }
|
||||
WMError UpdateScreenLockStatusForApp(const std::string& bundleName,
|
||||
bool isRelease) override { return WMError::WM_OK; }
|
||||
|
||||
WMError IsPcOrPadFreeMultiWindowMode(bool& isPcOrPadFreeMultiWindowMode) override { return WMError::WM_OK; }
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
WMError SetProcessWatermark(int32_t pid, const std::string& watermarkName, bool isEnabled) override;
|
||||
WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber,
|
||||
int32_t x, int32_t y, std::vector<int32_t>& windowIds) override;
|
||||
WMError ReleaseForegroundSessionScreenLock() override;
|
||||
WMError UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease) override;
|
||||
WMError IsPcWindow(bool& isPcWindow) override;
|
||||
WMError IsPcOrPadFreeMultiWindowMode(bool& isPcOrPadFreeMultiWindowMode) override;
|
||||
WMError IsWindowRectAutoSave(const std::string& key, bool& enabled) override;
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
int HandleSkipSnapshotByUserIdAndBundleNames(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleSetProcessWatermark(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleGetWindowIdsByCoordinate(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleReleaseForegroundSessionScreenLock(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleUpdateSessionScreenLock(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleIsPcWindow(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleIsPcOrPadFreeMultiWindowMode(MessageParcel& data, MessageParcel& reply);
|
||||
int HandleIsWindowRectAutoSave(MessageParcel& data, MessageParcel& reply);
|
||||
|
@ -1608,7 +1608,7 @@ sptr<SceneSession> SceneSessionManager::GetKeyboardSession(DisplayId displayId,
|
||||
}
|
||||
}
|
||||
return keyboardSession;
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSessionManager::HandleKeyboardAvoidChange(sptr<SceneSession> sceneSession, DisplayId displayId,
|
||||
SystemKeyboardAvoidChangeReason reason)
|
||||
@ -1644,7 +1644,7 @@ void SceneSessionManager::HandleKeyboardAvoidChange(sptr<SceneSession> sceneSess
|
||||
* when the system keyboard is hiden, disconnect or it's gravity is float
|
||||
* check for whether other keyboard can be avoided: if yes, avoids the other keyboard
|
||||
* if no, restores the system keyboard
|
||||
*/
|
||||
*/
|
||||
case SystemKeyboardAvoidChangeReason::KEYBOARD_HIDE:
|
||||
case SystemKeyboardAvoidChangeReason::KEYBOARD_DISCONNECT:
|
||||
case SystemKeyboardAvoidChangeReason::KEYBOARD_GRAVITY_FLOAT: {
|
||||
@ -3612,7 +3612,7 @@ WMError SceneSessionManager::NotifyWatchFocusActiveChange(bool isActive)
|
||||
void SceneSessionManager::RegisterWatchFocusActiveChangeCallback(NotifyWatchFocusActiveChangeFunc&& func)
|
||||
{
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "in");
|
||||
onWatchFocusActiveChangeFunc_ = std::move(func);
|
||||
onWatchFocusActiveChangeFunc_ = std::move(func);
|
||||
}
|
||||
|
||||
void SceneSessionManager::ClearSpecificSessionRemoteObjectMap(int32_t persistentId)
|
||||
@ -10035,7 +10035,7 @@ bool SceneSessionManager::GetImmersiveState(ScreenId screenId)
|
||||
if (sceneSession->GetWindowMode() != WindowMode::WINDOW_MODE_FULLSCREEN) {
|
||||
continue;
|
||||
}
|
||||
if (sceneSession->GetSessionProperty()->GetDisplayId() != screenId) {
|
||||
if (sceneSession->GetSessionProperty()->GetDisplayId() != screenId) {
|
||||
continue;
|
||||
}
|
||||
if (isPcOrPadFreeMultiWindowMode) {
|
||||
@ -12219,36 +12219,91 @@ void SceneSessionManager::RefreshAppInfo(const std::string& bundleName)
|
||||
AbilityInfoManager::GetInstance().RemoveAppInfo(bundleName);
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::ReleaseForegroundSessionScreenLock()
|
||||
WMError SceneSessionManager::UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease)
|
||||
{
|
||||
if (!SessionPermission::IsSACalling() && !SessionPermission::IsShellCall()) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "permission denied!");
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "permission denied!");
|
||||
return WMError::WM_ERROR_INVALID_PERMISSION;
|
||||
}
|
||||
#ifdef POWER_MANAGER_ENABLE
|
||||
auto task = [this] {
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
for (const auto& [persistentId, sceneSession] : sceneSessionMap_) {
|
||||
if (!IsSessionVisibleForeground(sceneSession) || sceneSession->keepScreenLock_ == nullptr) {
|
||||
if (isRelease) {
|
||||
return ReleaseScreenLockForApp(bundleName);
|
||||
} else {
|
||||
return RelockScreenLockForApp(bundleName);
|
||||
}
|
||||
#else
|
||||
TLOGI(WmsLogTag::WMS_ATTRIBUTE, "Can not find the sub system of PowerMgr");
|
||||
return WMError::WM_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::ReleaseScreenLockForApp(const std::string& bundleName)
|
||||
{
|
||||
std::vector<sptr<SceneSession>> sessionsToReleaseScreenLock;
|
||||
GetAllSessionsToReleaseScreenLock(sessionsToReleaseScreenLock, bundleName);
|
||||
auto task = [this, bundleName, sessionsToReleaseScreenLock] {
|
||||
for (const auto& sceneSession : sessionsToReleaseScreenLock) {
|
||||
if (sceneSession->keepScreenLock_ == nullptr || !sceneSession->keepScreenLock_->IsUsed()) {
|
||||
continue;
|
||||
}
|
||||
auto res = sceneSession->keepScreenLock_->UnLock();
|
||||
if (res != ERR_OK) {
|
||||
TLOGNE(WmsLogTag::DEFAULT,
|
||||
"release screen lock failed: window: [%{public}d, %{public}s], err: %{public}d",
|
||||
persistentId, sceneSession->GetWindowName().c_str(), res);
|
||||
return WMError::WM_ERROR_INVALID_OPERATION;
|
||||
TLOGNE(WmsLogTag::WMS_ATTRIBUTE,
|
||||
"release screenlock failed, window:[%{public}d, %{public}s], err:%{public}d",
|
||||
sceneSession->GetPersistentId(), sceneSession->GetWindowName().c_str(), res);
|
||||
continue;
|
||||
}
|
||||
TLOGNI(WmsLogTag::DEFAULT, "release screen lock success: window: [%{public}d, %{public}s]",
|
||||
persistentId, sceneSession->GetWindowName().c_str());
|
||||
auto [iter, emplaced] = releasedScreenLockMap_.try_emplace(bundleName, std::unordered_set<int32_t>{});
|
||||
iter->second.insert(sceneSession->GetPersistentId());
|
||||
TLOGNI(WmsLogTag::WMS_ATTRIBUTE, "release screenlock success, window:[%{public}d, %{public}s]",
|
||||
sceneSession->GetPersistentId(), sceneSession->GetWindowName().c_str());
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
};
|
||||
return taskScheduler_->PostSyncTask(task, __func__);
|
||||
#else
|
||||
TLOGD(WmsLogTag::DEFAULT, "Can not find the sub system of PowerMgr");
|
||||
return WMError::WM_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SceneSessionManager::GetAllSessionsToReleaseScreenLock(
|
||||
std::vector<sptr<SceneSession>>& sessionsToReleaseScreenLock, const std::string& bundleName) {
|
||||
std::shared_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
|
||||
for (const auto& [persistentId, sceneSession] : sceneSessionMap_) {
|
||||
if (sceneSession->GetSessionInfo().bundleName_ == bundleName && sceneSession->keepScreenLock_ != nullptr) {
|
||||
sessionsToReleaseScreenLock.push_back(sceneSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::RelockScreenLockForApp(const std::string& bundleName)
|
||||
{
|
||||
auto task = [this, bundleName] {
|
||||
auto iter = releasedScreenLockMap_.find(bundleName);
|
||||
if (iter == releasedScreenLockMap_.end()) {
|
||||
TLOGNE(WmsLogTag::WMS_ATTRIBUTE, "%{public}s: not found in map", bundleName.c_str());
|
||||
return WMError::WM_ERROR_INVALID_OPERATION;
|
||||
}
|
||||
const auto& persistentIds = iter->second;
|
||||
for (const int32_t persistentId : persistentIds) {
|
||||
sptr<SceneSession> sceneSession = GetSceneSession(static_cast<int32_t>(persistentId));
|
||||
if (sceneSession == nullptr) {
|
||||
continue;
|
||||
}
|
||||
auto sourceMode = ScreenSourceMode::SCREEN_ALONE;
|
||||
auto screenSession = ScreenSessionManagerClient::GetInstance().GetScreenSessionById(
|
||||
sceneSession->GetScreenId());
|
||||
if (screenSession) {
|
||||
sourceMode = screenSession->GetSourceMode();
|
||||
}
|
||||
if (sceneSession->IsKeepScreenOn() && IsSessionVisibleForeground(sceneSession) &&
|
||||
sourceMode != ScreenSourceMode::SCREEN_UNIQUE && sceneSession->keepScreenLock_ != nullptr) {
|
||||
auto res = sceneSession->keepScreenLock_->Lock();
|
||||
TLOGNI(WmsLogTag::WMS_ATTRIBUTE, "relock screenlock, window: [%{public}d, %{public}s], res:%{public}d",
|
||||
persistentId, sceneSession->GetWindowName().c_str(), res);
|
||||
}
|
||||
}
|
||||
releasedScreenLockMap_.erase(bundleName);
|
||||
return WMError::WM_OK;
|
||||
};
|
||||
return taskScheduler_->PostSyncTask(task, __func__);
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::IsPcWindow(bool& isPcWindow)
|
||||
|
@ -2471,18 +2471,26 @@ WMError SceneSessionManagerProxy::GetWindowIdsByCoordinate(DisplayId displayId,
|
||||
return ret;
|
||||
}
|
||||
|
||||
WMError SceneSessionManagerProxy::ReleaseForegroundSessionScreenLock()
|
||||
WMError SceneSessionManagerProxy::UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "WriteInterfaceToken failed");
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "WriteInterfaceToken failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_RELEASE_SESSION_SCREEN_LOCK),
|
||||
if (!data.WriteString(bundleName)) {
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "Write bundleName failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (!data.WriteBool(isRelease)) {
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "Write isRelease failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_UPDATE_SESSION_SCREEN_LOCK),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "SendRequest failed");
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "SendRequest failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
return static_cast<WMError>(reply.ReadInt32());
|
||||
|
@ -179,8 +179,8 @@ int SceneSessionManagerStub::ProcessRemoteRequest(uint32_t code, MessageParcel&
|
||||
return HandleSetProcessWatermark(data, reply);
|
||||
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_IDS_BY_COORDINATE):
|
||||
return HandleGetWindowIdsByCoordinate(data, reply);
|
||||
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_RELEASE_SESSION_SCREEN_LOCK):
|
||||
return HandleReleaseForegroundSessionScreenLock(data, reply);
|
||||
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_UPDATE_SESSION_SCREEN_LOCK):
|
||||
return HandleUpdateSessionScreenLock(data, reply);
|
||||
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_IS_PC_WINDOW):
|
||||
return HandleIsPcWindow(data, reply);
|
||||
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_IS_PC_OR_PAD_FREE_MULTI_WINDOW_MODE):
|
||||
@ -1480,9 +1480,19 @@ int SceneSessionManagerStub::HandleGetWindowIdsByCoordinate(MessageParcel& data,
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
int SceneSessionManagerStub::HandleReleaseForegroundSessionScreenLock(MessageParcel& data, MessageParcel& reply)
|
||||
int SceneSessionManagerStub::HandleUpdateSessionScreenLock(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WMError errCode = ReleaseForegroundSessionScreenLock();
|
||||
std::string bundleName;
|
||||
if (!data.ReadString(bundleName)) {
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "Read bundleName failed.");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
bool isRelease = false;
|
||||
if (!data.ReadBool(isRelease)) {
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "Read isRelease failed.");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
WMError errCode = UpdateScreenLockStatusForApp(bundleName, isRelease);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
@ -1002,17 +1002,17 @@ HWTEST_F(sceneSessionManagerProxyTest, SkipSnapshotByUserIdAndBundleNames, Funct
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ReleaseForegroundSessionScreenLock
|
||||
* @tc.name: UpdateScreenLockStatusForApp
|
||||
* @tc.desc: normal function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(sceneSessionManagerProxyTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
|
||||
HWTEST_F(sceneSessionManagerProxyTest, UpdateScreenLockStatusForApp, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
|
||||
sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
|
||||
sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
|
||||
EXPECT_NE(sceneSessionManagerProxy, nullptr);
|
||||
ASSERT_EQ(sceneSessionManagerProxy->ReleaseForegroundSessionScreenLock(), WMError::WM_OK);
|
||||
ASSERT_EQ(sceneSessionManagerProxy->UpdateScreenLockStatusForApp("", true), WMError::WM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2139,15 +2139,17 @@ HWTEST_F(SceneSessionManagerStubTest, HandleSkipSnapshotByUserIdAndBundleNames,
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleReleaseForegroundSessionScreenLock
|
||||
* @tc.desc: test HandleReleaseForegroundSessionScreenLock
|
||||
* @tc.name: HandleUpdateSessionScreenLock
|
||||
* @tc.desc: test HandleUpdateSessionScreenLock
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerStubTest, HandleReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
|
||||
HWTEST_F(SceneSessionManagerStubTest, HandleUpdateSessionScreenLock, Function | SmallTest | Level2)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int res = stub_->HandleReleaseForegroundSessionScreenLock(data, reply);
|
||||
data.WriteString("");
|
||||
data.WriteBool(true);
|
||||
int res = stub_->HandleUpdateSessionScreenLock(data, reply);
|
||||
EXPECT_EQ(res, ERR_NONE);
|
||||
}
|
||||
|
||||
|
@ -2230,13 +2230,13 @@ HWTEST_F(SceneSessionManagerTest, GetRootMainWindowId, Function | SmallTest | Le
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ReleaseForegroundSessionScreenLock
|
||||
* @tc.desc: release screen lock of foreground session
|
||||
* @tc.name: UpdateScreenLockStatusForApp
|
||||
* @tc.desc: SceneSesionManager UpdateScreenLockStatusForApp
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level3)
|
||||
HWTEST_F(SceneSessionManagerTest, UpdateScreenLockStatusForApp, Function | SmallTest | Level3)
|
||||
{
|
||||
auto result = ssm_->ReleaseForegroundSessionScreenLock();
|
||||
auto result = ssm_->UpdateScreenLockStatusForApp("", true);
|
||||
ASSERT_EQ(result, WMError::WM_OK);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
virtual WMError SetProcessWatermark(int32_t pid, const std::string& watermarkName, bool isEnabled);
|
||||
virtual WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber,
|
||||
int32_t x, int32_t y, std::vector<int32_t>& windowIds);
|
||||
virtual WMError ReleaseForegroundSessionScreenLock();
|
||||
virtual WMError UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease);
|
||||
virtual WMError NotifyWatchGestureConsumeResult(int32_t keyCode, bool isConsumed);
|
||||
virtual WMError NotifyWatchFocusActiveChange(bool isActive);
|
||||
|
||||
|
@ -977,12 +977,12 @@ WMError WindowAdapter::SetProcessWatermark(int32_t pid, const std::string& water
|
||||
return wmsProxy->SetProcessWatermark(pid, watermarkName, isEnabled);
|
||||
}
|
||||
|
||||
WMError WindowAdapter::ReleaseForegroundSessionScreenLock()
|
||||
WMError WindowAdapter::UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING);
|
||||
auto wmsProxy = GetWindowManagerServiceProxy();
|
||||
CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING);
|
||||
return wmsProxy->ReleaseForegroundSessionScreenLock();
|
||||
return wmsProxy->UpdateScreenLockStatusForApp(bundleName, isRelease);
|
||||
}
|
||||
|
||||
WMError WindowAdapter::IsPcWindow(bool& isPcWindow)
|
||||
|
@ -1437,11 +1437,11 @@ WMError WindowManager::GetWindowIdsByCoordinate(DisplayId displayId, int32_t win
|
||||
return ret;
|
||||
}
|
||||
|
||||
WMError WindowManager::ReleaseForegroundSessionScreenLock()
|
||||
WMError WindowManager::UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease)
|
||||
{
|
||||
WMError ret = SingletonContainer::Get<WindowAdapter>().ReleaseForegroundSessionScreenLock();
|
||||
WMError ret = SingletonContainer::Get<WindowAdapter>().UpdateScreenLockStatusForApp(bundleName, isRelease);
|
||||
if (ret != WMError::WM_OK) {
|
||||
TLOGE(WmsLogTag::DEFAULT, "release screen lock failed");
|
||||
TLOGE(WmsLogTag::WMS_ATTRIBUTE, "update screen lock status failed");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -705,14 +705,14 @@ HWTEST_F(WindowAdapterTest, SetProcessWatermark, Function | SmallTest | Level2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ReleaseForegroundSessionScreenLock
|
||||
* @tc.desc: WindowAdapter/ReleaseForegroundSessionScreenLock
|
||||
* @tc.name: UpdateScreenLockStatusForApp
|
||||
* @tc.desc: WindowAdapter/UpdateScreenLockStatusForApp
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowAdapterTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
|
||||
HWTEST_F(WindowAdapterTest, UpdateScreenLockStatusForApp, Function | SmallTest | Level2)
|
||||
{
|
||||
WindowAdapter windowAdapter;
|
||||
auto err = windowAdapter.ReleaseForegroundSessionScreenLock();
|
||||
auto err = windowAdapter.UpdateScreenLockStatusForApp("", true);
|
||||
ASSERT_EQ(err, WMError::WM_OK);
|
||||
auto ret = windowAdapter.InitWMSProxy();
|
||||
ASSERT_EQ(ret, true);
|
||||
|
@ -1453,13 +1453,13 @@ HWTEST_F(WindowManagerTest, NotifyWindowPidVisibilityChanged, Function | SmallTe
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ReleaseForegroundSessionScreenLock
|
||||
* @tc.desc: check ReleaseForegroundSessionScreenLock
|
||||
* @tc.name: UpdateScreenLockStatusForApp
|
||||
* @tc.desc: check UpdateScreenLockStatusForApp
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowManagerTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
|
||||
HWTEST_F(WindowManagerTest, UpdateScreenLockStatusForApp, Function | SmallTest | Level2)
|
||||
{
|
||||
auto ret = WindowManager::GetInstance().ReleaseForegroundSessionScreenLock();
|
||||
auto ret = WindowManager::GetInstance().UpdateScreenLockStatusForApp("", true);
|
||||
ASSERT_EQ(ret, WMError::WM_OK);
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,8 @@ public:
|
||||
virtual WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber,
|
||||
int32_t x, int32_t y, std::vector<int32_t>& windowIds) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual WMError GetParentMainWindowId(int32_t windowId, int32_t& mainWindowId) { return WMError::WM_OK; }
|
||||
virtual WMError ReleaseForegroundSessionScreenLock() { return WMError::WM_OK; }
|
||||
virtual WMError UpdateScreenLockStatusForApp(
|
||||
const std::string& bundleName, bool isRelease) { return WMError::WM_OK; }
|
||||
virtual WMError IsPcWindow(bool& isPcWindow) { return WMError::WM_OK; }
|
||||
virtual WMError IsPcOrPadFreeMultiWindowMode(bool& isPcOrPadFreeMultiWindowMode) { return WMError::WM_OK; }
|
||||
virtual WMError IsWindowRectAutoSave(const std::string& key, bool& enabled) { return WMError::WM_OK; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user