1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17
18 #include "interfaces/include/ws_common.h"
19 #include "iremote_object_mocker.h"
20 #include "session_manager/include/scene_session_manager.h"
21 #include "session_info.h"
22 #include "session/host/include/scene_session.h"
23 #include "session_manager.h"
24
25 using namespace testing;
26 using namespace testing::ext;
27
28 namespace OHOS {
29 namespace Rosen {
30 namespace {
31 const std::string EMPTY_DEVICE_ID = "";
32 using ConfigItem = WindowSceneConfig::ConfigItem;
33 }
34 class SceneSessionManagerTest7 : public testing::Test {
35 public:
36 static void SetUpTestCase();
37 static void TearDownTestCase();
38 void SetUp() override;
39 void TearDown() override;
40
41 static bool gestureNavigationEnabled_;
42 static ProcessGestureNavigationEnabledChangeFunc callbackFunc_;
43 static sptr<SceneSessionManager> ssm_;
44 private:
45 static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
46 };
47
48 sptr<SceneSessionManager> SceneSessionManagerTest7::ssm_ = nullptr;
49
50 bool SceneSessionManagerTest7::gestureNavigationEnabled_ = true;
51 ProcessGestureNavigationEnabledChangeFunc SceneSessionManagerTest7::callbackFunc_ = [](bool enable,
__anon79483d1d0202(bool enable, const std::string& bundleName, GestureBackType type) 52 const std::string& bundleName, GestureBackType type) {
53 gestureNavigationEnabled_ = enable;
54 };
55
WindowChangedFuncTest(int32_t persistentId,WindowUpdateType type)56 void WindowChangedFuncTest(int32_t persistentId, WindowUpdateType type)
57 {
58 }
59
ProcessStatusBarEnabledChangeFuncTest(bool enable)60 void ProcessStatusBarEnabledChangeFuncTest(bool enable)
61 {
62 }
63
DumpRootSceneElementInfoFuncTest(const std::vector<std::string> & params,std::vector<std::string> & infos)64 void DumpRootSceneElementInfoFuncTest(const std::vector<std::string>& params, std::vector<std::string>& infos)
65 {
66 }
67
SetUpTestCase()68 void SceneSessionManagerTest7::SetUpTestCase()
69 {
70 ssm_ = &SceneSessionManager::GetInstance();
71 }
72
TearDownTestCase()73 void SceneSessionManagerTest7::TearDownTestCase()
74 {
75 ssm_ = nullptr;
76 }
77
SetUp()78 void SceneSessionManagerTest7::SetUp()
79 {
80 ssm_->sceneSessionMap_.clear();
81 }
82
TearDown()83 void SceneSessionManagerTest7::TearDown()
84 {
85 usleep(WAIT_SYNC_IN_NS);
86 ssm_->sceneSessionMap_.clear();
87 }
88
89 namespace {
90 /**
91 * @tc.name: UpdateSessionWindowVisibilityListener
92 * @tc.desc: UpdateSessionWindowVisibilityListener
93 * @tc.type: FUNC
94 */
95 HWTEST_F(SceneSessionManagerTest7, UpdateSessionWindowVisibilityListener, Function | SmallTest | Level3)
96 {
97 int32_t persistentId = 1;
98 bool haveListener = true;
99 ASSERT_NE(nullptr, ssm_);
100 ssm_->sceneSessionMap_.clear();
101 auto ret = ssm_->UpdateSessionWindowVisibilityListener(persistentId, haveListener);
102 EXPECT_EQ(ret, WSError::WS_DO_NOTHING);
103 SessionInfo sessionInfo;
104 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
105 sessionInfo.abilityName_ = "UpdateSessionWindowVisibilityListener";
106 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
107 ASSERT_NE(nullptr, sceneSession);
108 sceneSession->callingPid_ = 65535;
109 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
110 ret = ssm_->UpdateSessionWindowVisibilityListener(persistentId, haveListener);
111 EXPECT_EQ(ret, WSError::WS_ERROR_INVALID_PERMISSION);
112 }
113
114 /**
115 * @tc.name: ProcessVirtualPixelRatioChange
116 * @tc.desc: ProcessVirtualPixelRatioChange
117 * @tc.type: FUNC
118 */
119 HWTEST_F(SceneSessionManagerTest7, ProcessVirtualPixelRatioChange, Function | SmallTest | Level3)
120 {
121 DisplayId defaultDisplayId = 0;
122 sptr<DisplayInfo> displayInfo = nullptr;
123 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
124 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
125 ASSERT_NE(nullptr, ssm_);
126 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
127 displayInfo = sptr<DisplayInfo>::MakeSptr();
128 ASSERT_NE(nullptr, displayInfo);
129 ssm_->sceneSessionMap_.clear();
130 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
131 SessionInfo sessionInfo;
132 sessionInfo.bundleName_ = "SceneSessionManagerTest6";
133 sessionInfo.abilityName_ = "UpdateAvoidArea";
134 sessionInfo.isSystem_ = true;
135 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
136 ASSERT_NE(nullptr, sceneSession);
137 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
138 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
139 sessionInfo.isSystem_ = false;
140 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
141 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
142 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
143 sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
144 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
145 sceneSession->SetSessionState(SessionState::STATE_INACTIVE);
146 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
147 sceneSession = nullptr;
148 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
149 }
150
151 /**
152 * @tc.name: ProcessVirtualPixelRatioChange01
153 * @tc.desc: ProcessVirtualPixelRatioChange
154 * @tc.type: FUNC
155 */
156 HWTEST_F(SceneSessionManagerTest7, ProcessVirtualPixelRatioChange01, Function | SmallTest | Level3)
157 {
158 DisplayId defaultDisplayId = 0;
159 sptr<DisplayInfo> displayInfo = sptr<DisplayInfo>::MakeSptr();
160 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
161 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
162 ASSERT_NE(nullptr, displayInfo);
163 ASSERT_NE(nullptr, ssm_);
164 ssm_->processVirtualPixelRatioChangeFunc_ = nullptr;
165 displayInfo->SetVirtualPixelRatio(0.1f);
166 displayInfo->SetDensityInCurResolution(0.1f);
167 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
__anon79483d1d0402(float ratio, const OHOS::Rosen::Rect& rect) 168 ProcessVirtualPixelRatioChangeFunc func = [](float ratio, const OHOS::Rosen::Rect& rect) {};
169 ssm_->SetVirtualPixelRatioChangeListener(func);
170 ASSERT_NE(nullptr, ssm_->processVirtualPixelRatioChangeFunc_);
171 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
172 displayInfo->SetDensityInCurResolution(0.2f);
173 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
174 ssm_->processVirtualPixelRatioChangeFunc_ = nullptr;
175 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
176 }
177
178 /**
179 * @tc.name: ProcessUpdateRotationChange
180 * @tc.desc: ProcessUpdateRotationChange
181 * @tc.type: FUNC
182 */
183 HWTEST_F(SceneSessionManagerTest7, ProcessUpdateRotationChange, Function | SmallTest | Level3)
184 {
185 DisplayId defaultDisplayId = 0;
186 sptr<DisplayInfo> displayInfo = nullptr;
187 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
188 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
189 ASSERT_NE(nullptr, ssm_);
190 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
191 displayInfo = sptr<DisplayInfo>::MakeSptr();
192 ASSERT_NE(nullptr, displayInfo);
193 SessionInfo sessionInfo;
194 sessionInfo.bundleName_ = "SceneSessionManagerTest6";
195 sessionInfo.abilityName_ = "UpdateAvoidArea";
196 sessionInfo.isSystem_ = true;
197 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
198 ASSERT_NE(nullptr, sceneSession);
199 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
200 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
201 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
202 sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
203 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
204 sceneSession->SetSessionState(SessionState::STATE_INACTIVE);
205 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
206 WSRectF bounds = { 0, 0, 0, 0 };
207 sceneSession->SetBounds(bounds);
208 displayInfo->width_ = 0;
209 displayInfo->height_ = 0;
210 Rotation rotation = Rotation::ROTATION_0;
211 sceneSession->SetRotation(rotation);
212 displayInfo->SetRotation(rotation);
213 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
214 }
215
216 /**
217 * @tc.name: FlushUIParams
218 * @tc.desc: FlushUIParams
219 * @tc.type: FUNC
220 */
221 HWTEST_F(SceneSessionManagerTest7, FlushUIParams, Function | SmallTest | Level3)
222 {
223 SessionInfo sessionInfo;
224 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
225 sessionInfo.abilityName_ = "FlushUIParams";
226 sessionInfo.screenId_ = 1;
227 ScreenId screenId = 2;
228 std::unordered_map<int32_t, SessionUIParam> uiParams;
229 uiParams.clear();
230 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
231 ASSERT_NE(nullptr, sceneSession);
232 ASSERT_NE(nullptr, sceneSession->property_);
233 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
234 ASSERT_NE(nullptr, ssm_);
235 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
236 ssm_->FlushUIParams(screenId, std::move(uiParams));
237 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_END);
238 ssm_->FlushUIParams(screenId, std::move(uiParams));
239 }
240
241 /**
242 * @tc.name: FlushUIParams01
243 * @tc.desc: FlushUIParams
244 * @tc.type: FUNC
245 */
246 HWTEST_F(SceneSessionManagerTest7, FlushUIParams01, Function | SmallTest | Level3)
247 {
248 SessionInfo sessionInfo;
249 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
250 sessionInfo.abilityName_ = "FlushUIParams01";
251 sessionInfo.screenId_ = 2;
252 ScreenId screenId = 2;
253 std::unordered_map<int32_t, SessionUIParam> uiParams;
254 uiParams.clear();
255 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
256 ASSERT_NE(nullptr, sceneSession);
257 ASSERT_NE(nullptr, sceneSession->property_);
258 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
259 sceneSession->persistentId_ = 1;
260 ASSERT_NE(nullptr, ssm_);
261 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
262 SessionUIParam sessionUIParam;
263 uiParams.insert(std::make_pair(1, sessionUIParam));
264 ssm_->FlushUIParams(screenId, std::move(uiParams));
265 sessionInfo.screenId_ = -1ULL;
266 ssm_->FlushUIParams(screenId, std::move(uiParams));
267 }
268
269 /**
270 * @tc.name: RegisterIAbilityManagerCollaborator
271 * @tc.desc: RegisterIAbilityManagerCollaborator
272 * @tc.type: FUNC
273 */
274 HWTEST_F(SceneSessionManagerTest7, RegisterIAbilityManagerCollaborator, Function | SmallTest | Level3)
275 {
276 int32_t type = 0;
277 sptr<AAFwk::IAbilityManagerCollaborator> impl = nullptr;
278 ASSERT_NE(nullptr, ssm_);
279 auto ret = ssm_->RegisterIAbilityManagerCollaborator(type, impl);
280 EXPECT_EQ(ret, WSError::WS_ERROR_INVALID_PERMISSION);
281 }
282
283 /**
284 * @tc.name: ProcessBackEvent
285 * @tc.desc: ProcessBackEvent
286 * @tc.type: FUNC
287 */
288 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent, Function | SmallTest | Level3)
289 {
290 SessionInfo sessionInfo;
291 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
292 sessionInfo.abilityName_ = "FlushUIParams01";
293 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
294 ASSERT_NE(nullptr, sceneSession);
295 ASSERT_NE(nullptr, ssm_);
296 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
297 ssm_->focusedSessionId_ = 1;
298 ssm_->needBlockNotifyFocusStatusUntilForeground_ = true;
299 auto ret = ssm_->ProcessBackEvent();
300 EXPECT_EQ(ret, WSError::WS_OK);
301 ssm_->needBlockNotifyFocusStatusUntilForeground_ = false;
302 sessionInfo.isSystem_ = true;
303 ssm_->rootSceneProcessBackEventFunc_ = nullptr;
304 ret = ssm_->ProcessBackEvent();
305 EXPECT_EQ(ret, WSError::WS_OK);
__anon79483d1d0502()306 RootSceneProcessBackEventFunc func = [](){};
307 ssm_->rootSceneProcessBackEventFunc_ = func;
308 ASSERT_NE(nullptr, ssm_->rootSceneProcessBackEventFunc_);
309 ret = ssm_->ProcessBackEvent();
310 EXPECT_EQ(ret, WSError::WS_OK);
311 sessionInfo.isSystem_ = false;
312 ret = ssm_->ProcessBackEvent();
313 EXPECT_EQ(ret, WSError::WS_OK);
314 ssm_->rootSceneProcessBackEventFunc_ = nullptr;
315 ret = ssm_->ProcessBackEvent();
316 EXPECT_EQ(ret, WSError::WS_OK);
317 }
318
319 /**
320 * @tc.name: DestroySpecificSession
321 * @tc.desc: DestroySpecificSession
322 * @tc.type: FUNC
323 */
324 HWTEST_F(SceneSessionManagerTest7, DestroySpecificSession, Function | SmallTest | Level3)
325 {
326 ASSERT_NE(nullptr, ssm_);
327 ssm_->remoteObjectMap_.clear();
328 sptr<IRemoteObject> remoteObject = sptr<IRemoteObjectMocker>::MakeSptr();
329 ASSERT_NE(nullptr, remoteObject);
330 ssm_->DestroySpecificSession(remoteObject);
331 ssm_->remoteObjectMap_.insert(std::make_pair(remoteObject, 1));
332 SessionInfo sessionInfo;
333 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
334 sessionInfo.abilityName_ = "DestroySpecificSession";
335 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
336 ASSERT_NE(nullptr, sceneSession);
337 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
338 ssm_->DestroySpecificSession(remoteObject);
339 sceneSession = nullptr;
340 ssm_->DestroySpecificSession(remoteObject);
341 }
342
343 /**
344 * @tc.name: DestroyAndDisconnectSpecificSessionWithDetachCallback
345 * @tc.desc: DestroyAndDisconnectSpecificSessionWithDetachCallback
346 * @tc.type: FUNC
347 */
348 HWTEST_F(SceneSessionManagerTest7, DestroyAndDisconnectSpecificSessionWithDetachCallback,
349 Function | SmallTest | Level3)
350 {
351 int32_t persistentId = 1;
352 sptr<IRemoteObject> callback = sptr<IRemoteObjectMocker>::MakeSptr();
353 ASSERT_NE(nullptr, callback);
354 SessionInfo sessionInfo;
355 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
356 sessionInfo.abilityName_ = "DestroyAndDisconnectSpecificSessionWithDetachCallback";
357 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
358 ASSERT_NE(nullptr, sceneSession);
359 sceneSession->SetCallingUid(1);
360 ASSERT_NE(nullptr, ssm_);
361 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
362 auto ret = ssm_->DestroyAndDisconnectSpecificSessionWithDetachCallback(persistentId, callback);
363 EXPECT_EQ(ret, WSError::WS_ERROR_INVALID_PERMISSION);
364 }
365
366 /**
367 * @tc.name: DestroyAndDisconnectSpecificSessionInner
368 * @tc.desc: DestroyAndDisconnectSpecificSessionInner
369 * @tc.type: FUNC
370 */
371 HWTEST_F(SceneSessionManagerTest7, DestroyAndDisconnectSpecificSessionInner, Function | SmallTest | Level3)
372 {
373 SessionInfo sessionInfo;
374 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
375 sessionInfo.abilityName_ = "DestroyAndDisconnectSpecificSessionInner";
376 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
377 ASSERT_NE(nullptr, sceneSession);
378 ASSERT_NE(nullptr, sceneSession->property_);
379 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
380 sceneSession->SetParentPersistentId(2);
381 SessionInfo sessionInfo1;
382 sessionInfo1.bundleName_ = "SceneSessionManagerTest7";
383 sessionInfo1.abilityName_ = "ParentSceneSession";
384 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
385 ASSERT_NE(nullptr, sceneSession1);
386 ASSERT_NE(nullptr, ssm_);
387 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
388 ssm_->sceneSessionMap_.insert(std::make_pair(2, sceneSession1));
389 auto ret = ssm_->DestroyAndDisconnectSpecificSessionInner(1);
390 EXPECT_EQ(ret, WSError::WS_OK);
391 sceneSession1 = nullptr;
392 ret = ssm_->DestroyAndDisconnectSpecificSessionInner(2);
393 EXPECT_EQ(ret, WSError::WS_OK);
394 }
395
396 /**
397 * @tc.name: DestroyAndDisconnectSpecificSessionInner01
398 * @tc.desc: DestroyAndDisconnectSpecificSessionInner
399 * @tc.type: FUNC
400 */
401 HWTEST_F(SceneSessionManagerTest7, DestroyAndDisconnectSpecificSessionInner01, Function | SmallTest | Level3)
402 {
403 SessionInfo sessionInfo;
404 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
405 sessionInfo.abilityName_ = "DestroyAndDisconnectSpecificSessionInner";
406 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
407 ASSERT_NE(nullptr, sceneSession);
408 ASSERT_NE(nullptr, sceneSession->property_);
409 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_TOAST);
410 sceneSession->SetParentPersistentId(2);
411 SessionInfo sessionInfo1;
412 sessionInfo1.bundleName_ = "SceneSessionManagerTest7";
413 sessionInfo1.abilityName_ = "ParentSceneSession";
414 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
415 ASSERT_NE(nullptr, sceneSession1);
416 ASSERT_NE(nullptr, ssm_);
417 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
418 ssm_->sceneSessionMap_.insert(std::make_pair(2, sceneSession1));
419 auto ret = ssm_->DestroyAndDisconnectSpecificSessionInner(1);
420 EXPECT_EQ(ret, WSError::WS_OK);
421 sceneSession1 = nullptr;
422 ret = ssm_->DestroyAndDisconnectSpecificSessionInner(2);
423 EXPECT_EQ(ret, WSError::WS_OK);
424 }
425
426 /**
427 * @tc.name: DestroyAndDisconnectSpecificSessionInner02
428 * @tc.desc: DestroyAndDisconnectSpecificSessionInner
429 * @tc.type: FUNC
430 */
431 HWTEST_F(SceneSessionManagerTest7, DestroyAndDisconnectSpecificSessionInner02, Function | SmallTest | Level3)
432 {
433 SessionInfo sessionInfo;
434 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
435 sessionInfo.abilityName_ = "DestroyAndDisconnectSpecificSessionInner";
436 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
437 ASSERT_NE(nullptr, sceneSession);
438 ASSERT_NE(nullptr, sceneSession->property_);
439 sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
440 sceneSession->SetParentPersistentId(2);
441 SessionInfo sessionInfo1;
442 sessionInfo1.bundleName_ = "SceneSessionManagerTest7";
443 sessionInfo1.abilityName_ = "ParentSceneSession";
444 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
445 ASSERT_NE(nullptr, sceneSession1);
446 ASSERT_NE(nullptr, ssm_);
447 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
448 ssm_->sceneSessionMap_.insert(std::make_pair(2, sceneSession1));
449 auto ret = ssm_->DestroyAndDisconnectSpecificSessionInner(1);
450 EXPECT_EQ(ret, WSError::WS_OK);
451 sceneSession1 = nullptr;
452 ret = ssm_->DestroyAndDisconnectSpecificSessionInner(2);
453 EXPECT_EQ(ret, WSError::WS_OK);
454 }
455
456 /**
457 * @tc.name: DestroyAndDisconnectSpecificSessionInner03
458 * @tc.desc: DestroyAndDisconnectSpecificSessionInner
459 * @tc.type: FUNC
460 */
461 HWTEST_F(SceneSessionManagerTest7, DestroyAndDisconnectSpecificSessionInner03, Function | SmallTest | Level3)
462 {
463 SessionInfo sessionInfo;
464 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
465 sessionInfo.abilityName_ = "DestroyAndDisconnectSpecificSessionInner03";
466 sptr<SceneSession> floatSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
467 floatSession->property_->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
468 floatSession->persistentId_ = 1;
469 sptr<SceneSession> subSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
470 subSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
471 subSession->persistentId_ = 2;
472 subSession->SetParentSession(floatSession);
473 floatSession->subSession_.push_back(subSession);
474 ASSERT_NE(nullptr, ssm_);
475 ssm_->sceneSessionMap_.insert(std::make_pair(1, floatSession));
476 ssm_->sceneSessionMap_.insert(std::make_pair(2, subSession));
477 auto ret = ssm_->DestroyAndDisconnectSpecificSessionInner(1);
478 EXPECT_EQ(ret, WSError::WS_OK);
479 EXPECT_EQ(ssm_->sceneSessionMap_.find(2), ssm_->sceneSessionMap_.end());
480 ret = ssm_->DestroyAndDisconnectSpecificSessionInner(2);
481 EXPECT_EQ(ret, WSError::WS_ERROR_NULLPTR);
482 }
483
484 /**
485 * @tc.name: CheckPiPPriority
486 * @tc.desc: CheckPiPPriority
487 * @tc.type: FUNC
488 */
489 HWTEST_F(SceneSessionManagerTest7, CheckPiPPriority, Function | SmallTest | Level3)
490 {
491 SessionInfo sessionInfo;
492 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
493 sessionInfo.abilityName_ = "CheckPiPPriority";
494 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
495 ASSERT_NE(nullptr, sceneSession);
496 ASSERT_NE(nullptr, sceneSession->property_);
497 sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
498 PiPTemplateInfo pipTemplateInfo;
499 pipTemplateInfo.priority = 0;
500 sceneSession->pipTemplateInfo_.priority = 1;
501 sceneSession->state_ = SessionState::STATE_FOREGROUND;
502 ASSERT_NE(nullptr, ssm_);
503 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
504 auto ret = ssm_->CheckPiPPriority(pipTemplateInfo);
505 EXPECT_EQ(ret, false);
506 sceneSession->state_ = SessionState::STATE_ACTIVE;
507 ret = ssm_->CheckPiPPriority(pipTemplateInfo);
508 EXPECT_EQ(ret, false);
509 pipTemplateInfo.priority = 1;
510 ret = ssm_->CheckPiPPriority(pipTemplateInfo);
511 EXPECT_EQ(ret, true);
512 sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
513 ret = ssm_->CheckPiPPriority(pipTemplateInfo);
514 EXPECT_EQ(ret, true);
515 sceneSession = nullptr;
516 ret = ssm_->CheckPiPPriority(pipTemplateInfo);
517 EXPECT_EQ(ret, true);
518 }
519
520 /**
521 * @tc.name: IsSessionVisibleForeground
522 * @tc.desc: IsSessionVisibleForeground
523 * @tc.type: FUNC
524 */
525 HWTEST_F(SceneSessionManagerTest7, IsSessionVisibleForeground, Function | SmallTest | Level3)
526 {
527 sptr<SceneSession> session = nullptr;
528 ASSERT_NE(nullptr, ssm_);
529 auto ret = ssm_->IsSessionVisibleForeground(session);
530 EXPECT_EQ(ret, false);
531 SessionInfo sessionInfo;
532 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
533 sessionInfo.abilityName_ = "IsSessionVisibleForeground";
534 session = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
535 ASSERT_NE(nullptr, session);
536 session->isVisible_ = false;
537 ret = ssm_->IsSessionVisibleForeground(session);
538 EXPECT_EQ(ret, false);
539 }
540
541 /**
542 * @tc.name: GetAllSessionDumpInfo
543 * @tc.desc: GetAllSessionDumpInfo
544 * @tc.type: FUNC
545 */
546 HWTEST_F(SceneSessionManagerTest7, GetAllSessionDumpInfo, Function | SmallTest | Level3)
547 {
548 SessionInfo sessionInfo;
549 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
550 sessionInfo.abilityName_ = "GetAllSessionDumpInfo";
551 sessionInfo.isSystem_ = false;
552 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
553 ASSERT_NE(nullptr, sceneSession);
554 sceneSession->state_ = SessionState::STATE_DISCONNECT;
555 ASSERT_NE(nullptr, ssm_);
556 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
557 std::string dumpInfo = "";
558 auto ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
559 EXPECT_EQ(ret, WSError::WS_OK);
560 sceneSession->state_ = SessionState::STATE_END;
561 ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
562 EXPECT_EQ(ret, WSError::WS_OK);
563 sceneSession->state_ = SessionState::STATE_ACTIVE;
564 ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
565 EXPECT_EQ(ret, WSError::WS_OK);
566 sessionInfo.isSystem_ = true;
567 ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
568 EXPECT_EQ(ret, WSError::WS_OK);
569 sceneSession = nullptr;
570 ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
571 EXPECT_EQ(ret, WSError::WS_OK);
572 }
573
574 /**
575 * @tc.name: GetAllSessionDumpInfo01
576 * @tc.desc: GetAllSessionDumpInfo
577 * @tc.type: FUNC
578 */
579 HWTEST_F(SceneSessionManagerTest7, GetAllSessionDumpInfo01, Function | SmallTest | Level3)
580 {
581 SessionInfo sessionInfo;
582 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
583 sessionInfo.abilityName_ = "GetAllSessionDumpInfo01";
584 sessionInfo.isSystem_ = true;
585 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
586 ASSERT_NE(nullptr, sceneSession);
587 sceneSession->isVisible_ = true;
588 ASSERT_NE(nullptr, ssm_);
589 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
590 std::string dumpInfo = "";
591 auto ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
592 EXPECT_EQ(ret, WSError::WS_OK);
593 sceneSession->isVisible_ = false;
594 ret = ssm_->GetAllSessionDumpInfo(dumpInfo);
595 EXPECT_EQ(ret, WSError::WS_OK);
596 }
597
598 /**
599 * @tc.name: UpdateNormalSessionAvoidArea
600 * @tc.desc: UpdateNormalSessionAvoidArea
601 * @tc.type: FUNC
602 */
603 HWTEST_F(SceneSessionManagerTest7, UpdateNormalSessionAvoidArea, Function | SmallTest | Level3)
604 {
605 SessionInfo sessionInfo;
606 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
607 sessionInfo.abilityName_ = "UpdateNormalSessionAvoidArea";
608 sessionInfo.isSystem_ = true;
609 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
610 ASSERT_NE(nullptr, sceneSession);
611 sceneSession->isVisible_ = true;
612 sceneSession->state_ = SessionState::STATE_FOREGROUND;
613 int32_t persistentId = 1;
614 bool needUpdate = true;
615 ASSERT_NE(nullptr, ssm_);
616 ssm_->avoidAreaListenerSessionSet_.clear();
617 ssm_->UpdateNormalSessionAvoidArea(persistentId, sceneSession, needUpdate);
618 sceneSession->isVisible_ = false;
619 ssm_->UpdateNormalSessionAvoidArea(persistentId, sceneSession, needUpdate);
620 }
621
622 /**
623 * @tc.name: UpdateNormalSessionAvoidArea01
624 * @tc.desc: UpdateNormalSessionAvoidArea
625 * @tc.type: FUNC
626 */
627 HWTEST_F(SceneSessionManagerTest7, UpdateNormalSessionAvoidArea01, Function | SmallTest | Level3)
628 {
629 SessionInfo sessionInfo;
630 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
631 sessionInfo.abilityName_ = "UpdateNormalSessionAvoidArea01";
632 sessionInfo.isSystem_ = true;
633 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
634 ASSERT_NE(nullptr, sceneSession);
635 sceneSession->isVisible_ = true;
636 sceneSession->state_ = SessionState::STATE_FOREGROUND;
637 int32_t persistentId = 1;
638 bool needUpdate = true;
639 ASSERT_NE(nullptr, ssm_);
640 ssm_->avoidAreaListenerSessionSet_.clear();
641 ssm_->avoidAreaListenerSessionSet_.insert(persistentId);
642 ssm_->UpdateNormalSessionAvoidArea(persistentId, sceneSession, needUpdate);
643 sceneSession = nullptr;
644 ssm_->UpdateNormalSessionAvoidArea(persistentId, sceneSession, needUpdate);
645 }
646
647 /**
648 * @tc.name: UnregisterWindowManagerAgent
649 * @tc.desc: UnregisterWindowManagerAgent
650 * @tc.type: FUNC
651 */
652 HWTEST_F(SceneSessionManagerTest7, UnregisterWindowManagerAgent, Function | SmallTest | Level3)
653 {
654 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR;
655 sptr<IWindowManagerAgent> windowManagerAgent = nullptr;
656 ASSERT_NE(nullptr, ssm_);
657 auto ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
658 EXPECT_EQ(ret, WMError::WM_ERROR_NULLPTR);
659 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_GESTURE_NAVIGATION_ENABLED;
660 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
661 EXPECT_EQ(ret, WMError::WM_ERROR_NULLPTR);
662 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WATER_MARK_FLAG;
663 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
664 EXPECT_EQ(ret, WMError::WM_ERROR_NULLPTR);
665 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY;
666 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
667 EXPECT_EQ(ret, WMError::WM_ERROR_INVALID_PERMISSION);
668 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_DRAWING_STATE;
669 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
670 EXPECT_EQ(ret, WMError::WM_ERROR_INVALID_PERMISSION);
671 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_VISIBLE_WINDOW_NUM;
672 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
673 EXPECT_EQ(ret, WMError::WM_ERROR_INVALID_PERMISSION);
674 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
675 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
676 EXPECT_EQ(ret, WMError::WM_ERROR_INVALID_PERMISSION);
677 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_MODE;
678 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
679 EXPECT_EQ(ret, WMError::WM_ERROR_INVALID_PERMISSION);
680 type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE;
681 ret = ssm_->UnregisterWindowManagerAgent(type, windowManagerAgent);
682 EXPECT_EQ(ret, WMError::WM_ERROR_NULLPTR);
683 }
684
685 /**
686 * @tc.name: FindSessionByAffinity
687 * @tc.desc: FindSessionByAffinity
688 * @tc.type: FUNC
689 */
690 HWTEST_F(SceneSessionManagerTest7, FindSessionByAffinity, Function | SmallTest | Level3)
691 {
692 std::string affinity = "";
693 ASSERT_NE(nullptr, ssm_);
694 auto ret = ssm_->FindSessionByAffinity(affinity);
695 EXPECT_EQ(ret, nullptr);
696 affinity = "Test";
697 SessionInfo sessionInfo;
698 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
699 sessionInfo.abilityName_ = "FindSessionByAffinity";
700 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
701 ASSERT_NE(nullptr, sceneSession);
702 sceneSession->SetCollaboratorType(CollaboratorType::DEFAULT_TYPE);
703 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
704 ret = ssm_->FindSessionByAffinity(affinity);
705 EXPECT_EQ(ret, nullptr);
706 sceneSession->SetCollaboratorType(CollaboratorType::OTHERS_TYPE);
707 sceneSession->sessionInfo_.sessionAffinity = "Test";
708 ret = ssm_->FindSessionByAffinity(affinity);
709 EXPECT_EQ(ret, sceneSession);
710 }
711
712 /**
713 * @tc.name: FindSessionByAffinity01
714 * @tc.desc: FindSessionByAffinity
715 * @tc.type: FUNC
716 */
717 HWTEST_F(SceneSessionManagerTest7, FindSessionByAffinity01, Function | SmallTest | Level3)
718 {
719 std::string affinity = "Test";
720 sptr<SceneSession> sceneSession = nullptr;
721 ASSERT_NE(nullptr, ssm_);
722 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
723 auto ret = ssm_->FindSessionByAffinity(affinity);
724 EXPECT_EQ(ret, nullptr);
725 }
726
727 /**
728 * @tc.name: ProcessUpdateRotationChange01
729 * @tc.desc: ProcessUpdateRotationChange
730 * @tc.type: FUNC
731 */
732 HWTEST_F(SceneSessionManagerTest7, ProcessUpdateRotationChange01, Function | SmallTest | Level3)
733 {
734 DisplayId defaultDisplayId = 0;
735 sptr<DisplayInfo> displayInfo = sptr<DisplayInfo>::MakeSptr();
736 ASSERT_NE(nullptr, displayInfo);
737 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
738 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
739 sptr<SceneSession> sceneSession = nullptr;
740 ASSERT_NE(nullptr, ssm_);
741 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
742 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
743 }
744
745 /**
746 * @tc.name: ProcessUpdateRotationChange02
747 * @tc.desc: ProcessUpdateRotationChange
748 * @tc.type: FUNC
749 */
750 HWTEST_F(SceneSessionManagerTest7, ProcessUpdateRotationChange02, Function | SmallTest | Level3)
751 {
752 DisplayId defaultDisplayId = 0;
753 sptr<DisplayInfo> displayInfo = sptr<DisplayInfo>::MakeSptr();
754 ASSERT_NE(nullptr, displayInfo);
755 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
756 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
757 SessionInfo sessionInfo;
758 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
759 sessionInfo.abilityName_ = "UpdateAvoidArea";
760 sessionInfo.isSystem_ = true;
761 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
762 ASSERT_NE(nullptr, sceneSession);
763 ASSERT_NE(nullptr, ssm_);
764 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
765 sceneSession->SetSessionState(SessionState::STATE_INACTIVE);
766 WSRectF bounds = { 0, 0, 0, 0 };
767 sceneSession->SetBounds(bounds);
768 displayInfo->width_ = 0;
769 displayInfo->height_ = 0;
770 sceneSession->SetRotation(Rotation::ROTATION_0);
771 displayInfo->SetRotation(Rotation::ROTATION_90);
772 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
773 displayInfo->height_ = 1;
774 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
775 displayInfo->width_ = 1;
776 ssm_->ProcessUpdateRotationChange(defaultDisplayId, displayInfo, displayInfoMap, type);
777 }
778
779 /**
780 * @tc.name: SetSkipSelfWhenShowOnVirtualScreen
781 * @tc.desc: SetSkipSelfWhenShowOnVirtualScreen
782 * @tc.type: FUNC
783 */
784 HWTEST_F(SceneSessionManagerTest7, SetSkipSelfWhenShowOnVirtualScreen, Function | SmallTest | Level3)
785 {
786 uint64_t surfaceNodeId = 0;
787 bool isSkip = true;
788 ASSERT_NE(nullptr, ssm_);
789 ssm_->skipSurfaceNodeIds_.clear();
790 ssm_->SetSkipSelfWhenShowOnVirtualScreen(surfaceNodeId, isSkip);
791 ssm_->skipSurfaceNodeIds_.push_back(surfaceNodeId);
792 ssm_->SetSkipSelfWhenShowOnVirtualScreen(surfaceNodeId, isSkip);
793 }
794
795 /**
796 * @tc.name: SetSkipSelfWhenShowOnVirtualScreen01
797 * @tc.desc: SetSkipSelfWhenShowOnVirtualScreen
798 * @tc.type: FUNC
799 */
800 HWTEST_F(SceneSessionManagerTest7, SetSkipSelfWhenShowOnVirtualScreen01, Function | SmallTest | Level3)
801 {
802 uint64_t surfaceNodeId = 0;
803 bool isSkip = false;
804 ASSERT_NE(nullptr, ssm_);
805 ssm_->skipSurfaceNodeIds_.clear();
806 ssm_->SetSkipSelfWhenShowOnVirtualScreen(surfaceNodeId, isSkip);
807 ssm_->skipSurfaceNodeIds_.push_back(surfaceNodeId);
808 ssm_->SetSkipSelfWhenShowOnVirtualScreen(surfaceNodeId, isSkip);
809 }
810
811 /**
812 * @tc.name: GetMainWindowInfos
813 * @tc.desc: GetMainWindowInfos
814 * @tc.type: FUNC
815 */
816 HWTEST_F(SceneSessionManagerTest7, GetMainWindowInfos, Function | SmallTest | Level3)
817 {
818 int32_t topNum = 1;
819 std::vector<MainWindowInfo> topNInfo;
820 topNInfo.clear();
821 SessionInfo sessionInfo;
822 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
823 sessionInfo.abilityName_ = "GetMainWindowInfos";
824 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
825 ASSERT_NE(nullptr, sceneSession);
826 ASSERT_NE(nullptr, sceneSession->property_);
827 sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
828 sceneSession->isVisible_ = true;
829 sceneSession->state_ = SessionState::STATE_FOREGROUND;
830 ASSERT_NE(nullptr, ssm_);
831 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
832 auto ret = ssm_->GetMainWindowInfos(topNum, topNInfo);
833 EXPECT_EQ(ret, WMError::WM_OK);
834 sceneSession->isVisible_ = false;
835 ret = ssm_->GetMainWindowInfos(topNum, topNInfo);
836 EXPECT_EQ(ret, WMError::WM_OK);
837 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_END);
838 ret = ssm_->GetMainWindowInfos(topNum, topNInfo);
839 EXPECT_EQ(ret, WMError::WM_OK);
840 sceneSession->isVisible_ = true;
841 ret = ssm_->GetMainWindowInfos(topNum, topNInfo);
842 EXPECT_EQ(ret, WMError::WM_OK);
843 }
844
845 /**
846 * @tc.name: WindowLayerInfoChangeCallback
847 * @tc.desc: WindowLayerInfoChangeCallback
848 * @tc.type: FUNC
849 */
850 HWTEST_F(SceneSessionManagerTest7, WindowLayerInfoChangeCallback, Function | SmallTest | Level3)
851 {
852 std::shared_ptr<RSOcclusionData> occlusiontionData = nullptr;
853 ASSERT_NE(nullptr, ssm_);
854 ssm_->WindowLayerInfoChangeCallback(occlusiontionData);
855 VisibleData visibleData;
856 visibleData.push_back(std::make_pair(0, WINDOW_LAYER_INFO_TYPE::ALL_VISIBLE));
857 visibleData.push_back(std::make_pair(1, WINDOW_LAYER_INFO_TYPE::SEMI_VISIBLE));
858 visibleData.push_back(std::make_pair(2, WINDOW_LAYER_INFO_TYPE::INVISIBLE));
859 visibleData.push_back(std::make_pair(3, WINDOW_LAYER_INFO_TYPE::WINDOW_LAYER_DYNAMIC_STATUS));
860 visibleData.push_back(std::make_pair(4, WINDOW_LAYER_INFO_TYPE::WINDOW_LAYER_STATIC_STATUS));
861 visibleData.push_back(std::make_pair(5, WINDOW_LAYER_INFO_TYPE::WINDOW_LAYER_UNKNOWN_TYPE));
862 occlusiontionData = std::make_shared<RSOcclusionData>(visibleData);
863 ASSERT_NE(nullptr, occlusiontionData);
864 ssm_->WindowLayerInfoChangeCallback(occlusiontionData);
865 }
866
867 /**
868 * @tc.name: NotifySessionMovedToFront
869 * @tc.desc: NotifySessionMovedToFront
870 * @tc.type: FUNC
871 */
872 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront, Function | SmallTest | Level3)
873 {
874 int32_t persistentId = 1;
875 SessionInfo sessionInfo;
876 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
877 sessionInfo.abilityName_ = "GetMainWindowInfos";
878 sessionInfo.isSystem_ = false;
879 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
880 ASSERT_NE(nullptr, sceneSession);
881 ASSERT_NE(nullptr, ssm_);
882 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
883 ASSERT_NE(nullptr, ssm_->listenerController_);
884 sceneSession->sessionInfo_.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>();
885 ASSERT_NE(nullptr, sceneSession->sessionInfo_.abilityInfo);
886 sceneSession->sessionInfo_.abilityInfo->excludeFromMissions = false;
887 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
888 ssm_->NotifySessionMovedToFront(persistentId);
889 sceneSession->sessionInfo_.abilityInfo->excludeFromMissions = true;
890 ssm_->NotifySessionMovedToFront(persistentId);
891 sceneSession->sessionInfo_.abilityInfo = nullptr;
892 ssm_->NotifySessionMovedToFront(persistentId);
893 sceneSession->sessionInfo_.isSystem_ = true;
894 ssm_->NotifySessionMovedToFront(persistentId);
895 ssm_->listenerController_ = nullptr;
896 ssm_->NotifySessionMovedToFront(persistentId);
897 }
898
899 /**
900 * @tc.name: ProcessVirtualPixelRatioChange02
901 * @tc.desc: ProcessVirtualPixelRatioChange
902 * @tc.type: FUNC
903 */
904 HWTEST_F(SceneSessionManagerTest7, ProcessVirtualPixelRatioChange02, Function | SmallTest | Level3)
905 {
906 DisplayId defaultDisplayId = 0;
907 sptr<DisplayInfo> displayInfo = sptr<DisplayInfo>::MakeSptr();
908 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
909 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
910 ASSERT_NE(nullptr, displayInfo);
911 SessionInfo sessionInfo;
912 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
913 sessionInfo.abilityName_ = "ProcessVirtualPixelRatioChange02";
914 sessionInfo.isSystem_ = true;
915 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
916 ASSERT_NE(nullptr, sceneSession);
917 ASSERT_NE(nullptr, ssm_);
918 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
919 sptr<SceneSession> sceneSession1 = nullptr;
920 ssm_->sceneSessionMap_.insert(std::make_pair(2, sceneSession1));
921 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
922 }
923
924 /**
925 * @tc.name: ProcessVirtualPixelRatioChange03
926 * @tc.desc: ProcessVirtualPixelRatioChange
927 * @tc.type: FUNC
928 */
929 HWTEST_F(SceneSessionManagerTest7, ProcessVirtualPixelRatioChange03, Function | SmallTest | Level3)
930 {
931 DisplayId defaultDisplayId = 0;
932 sptr<DisplayInfo> displayInfo = sptr<DisplayInfo>::MakeSptr();
933 std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
934 DisplayStateChangeType type = DisplayStateChangeType::BEFORE_SUSPEND;
935 ASSERT_NE(nullptr, displayInfo);
936 SessionInfo sessionInfo;
937 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
938 sessionInfo.abilityName_ = "ProcessVirtualPixelRatioChange03";
939 sessionInfo.isSystem_ = false;
940 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
941 ASSERT_NE(nullptr, sceneSession);
942 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
943 ASSERT_NE(nullptr, ssm_);
944 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
945 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
946 ASSERT_NE(nullptr, sceneSession1);
947 sceneSession1->SetSessionState(SessionState::STATE_ACTIVE);
948 ssm_->sceneSessionMap_.insert(std::make_pair(2, sceneSession1));
949 sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
950 ASSERT_NE(nullptr, sceneSession2);
951 sceneSession2->SetSessionState(SessionState::STATE_INACTIVE);
952 ssm_->sceneSessionMap_.insert(std::make_pair(3, sceneSession2));
953 ssm_->ProcessVirtualPixelRatioChange(defaultDisplayId, displayInfo, displayInfoMap, type);
954 }
955
956 /**
957 * @tc.name: ProcessBackEvent01
958 * @tc.desc: ProcessBackEvent
959 * @tc.type: FUNC
960 */
961 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent01, Function | SmallTest | Level3)
962 {
963 SessionInfo sessionInfo;
964 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
965 sessionInfo.abilityName_ = "ProcessBackEvent01";
966 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
967 ASSERT_NE(nullptr, sceneSession);
968 ASSERT_NE(nullptr, ssm_);
969 ssm_->focusedSessionId_ = 1;
970 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
971 ssm_->needBlockNotifyFocusStatusUntilForeground_ = true;
972 auto ret = ssm_->ProcessBackEvent();
973 EXPECT_EQ(ret, WSError::WS_OK);
974 }
975
976 /**
977 * @tc.name: ProcessBackEvent02
978 * @tc.desc: ProcessBackEvent
979 * @tc.type: FUNC
980 */
981 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent02, Function | SmallTest | Level3)
982 {
983 SessionInfo sessionInfo;
984 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
985 sessionInfo.abilityName_ = "ProcessBackEvent02";
986 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
987 ASSERT_NE(nullptr, sceneSession);
988 sceneSession->sessionInfo_.isSystem_ = true;
989 ASSERT_NE(nullptr, ssm_);
990 ssm_->focusedSessionId_ = 1;
991 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
992 ssm_->needBlockNotifyFocusStatusUntilForeground_ = false;
993 ssm_->rootSceneProcessBackEventFunc_ = nullptr;
994 auto ret = ssm_->ProcessBackEvent();
995 EXPECT_EQ(ret, WSError::WS_OK);
996 }
997
998 /**
999 * @tc.name: ProcessBackEvent03
1000 * @tc.desc: ProcessBackEvent
1001 * @tc.type: FUNC
1002 */
1003 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent03, Function | SmallTest | Level3)
1004 {
1005 SessionInfo sessionInfo;
1006 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1007 sessionInfo.abilityName_ = "ProcessBackEvent03";
1008 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1009 ASSERT_NE(nullptr, sceneSession);
1010 sceneSession->sessionInfo_.isSystem_ = true;
1011 ASSERT_NE(nullptr, ssm_);
1012 ssm_->focusedSessionId_ = 1;
1013 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
1014 ssm_->needBlockNotifyFocusStatusUntilForeground_ = false;
__anon79483d1d0602()1015 RootSceneProcessBackEventFunc func = [](){};
1016 ssm_->rootSceneProcessBackEventFunc_ = func;
1017 ASSERT_NE(nullptr, ssm_->rootSceneProcessBackEventFunc_);
1018 auto ret = ssm_->ProcessBackEvent();
1019 EXPECT_EQ(ret, WSError::WS_OK);
1020 }
1021
1022 /**
1023 * @tc.name: ProcessBackEvent02
1024 * @tc.desc: ProcessBackEvent
1025 * @tc.type: FUNC
1026 */
1027 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent04, Function | SmallTest | Level3)
1028 {
1029 SessionInfo sessionInfo;
1030 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1031 sessionInfo.abilityName_ = "ProcessBackEvent04";
1032 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1033 ASSERT_NE(nullptr, sceneSession);
1034 sceneSession->sessionInfo_.isSystem_ = false;
1035 ASSERT_NE(nullptr, ssm_);
1036 ssm_->focusedSessionId_ = 1;
1037 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
1038 ssm_->needBlockNotifyFocusStatusUntilForeground_ = false;
1039 ssm_->rootSceneProcessBackEventFunc_ = nullptr;
1040 auto ret = ssm_->ProcessBackEvent();
1041 EXPECT_EQ(ret, WSError::WS_OK);
1042 }
1043
1044 /**
1045 * @tc.name: ProcessBackEvent05
1046 * @tc.desc: ProcessBackEvent
1047 * @tc.type: FUNC
1048 */
1049 HWTEST_F(SceneSessionManagerTest7, ProcessBackEvent05, Function | SmallTest | Level3)
1050 {
1051 SessionInfo sessionInfo;
1052 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1053 sessionInfo.abilityName_ = "ProcessBackEvent03";
1054 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1055 ASSERT_NE(nullptr, sceneSession);
1056 sceneSession->sessionInfo_.isSystem_ = false;
1057 ASSERT_NE(nullptr, ssm_);
1058 ssm_->focusedSessionId_ = 1;
1059 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
1060 ssm_->needBlockNotifyFocusStatusUntilForeground_ = false;
__anon79483d1d0702()1061 RootSceneProcessBackEventFunc func = [](){};
1062 ssm_->rootSceneProcessBackEventFunc_ = func;
1063 ASSERT_NE(nullptr, ssm_->rootSceneProcessBackEventFunc_);
1064 auto ret = ssm_->ProcessBackEvent();
1065 EXPECT_EQ(ret, WSError::WS_OK);
1066 }
1067
1068 /**
1069 * @tc.name: GetWindowVisibilityChangeInfo
1070 * @tc.desc: GetWindowVisibilityChangeInfo
1071 * @tc.type: FUNC
1072 */
1073 HWTEST_F(SceneSessionManagerTest7, GetWindowVisibilityChangeInfo, Function | SmallTest | Level3)
1074 {
1075 std::vector<std::pair<uint64_t, WindowVisibilityState>> currVisibleData;
1076 currVisibleData.emplace_back(2, WindowVisibilityState::WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
1077 currVisibleData.emplace_back(4, WindowVisibilityState::WINDOW_LAYER_STATE_MAX);
1078 currVisibleData.emplace_back(5, WindowVisibilityState::WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
1079 currVisibleData.emplace_back(7, WindowVisibilityState::WINDOW_LAYER_STATE_MAX);
1080 currVisibleData.emplace_back(9, WindowVisibilityState::WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
1081 ASSERT_NE(nullptr, ssm_);
1082 ssm_->lastVisibleData_.emplace_back(1, WindowVisibilityState::WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
1083 ssm_->lastVisibleData_.emplace_back(4, WindowVisibilityState::WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION);
1084 ssm_->lastVisibleData_.emplace_back(5, WindowVisibilityState::WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
1085 ssm_->lastVisibleData_.emplace_back(6, WindowVisibilityState::WINDOW_LAYER_STATE_MAX);
1086 ssm_->GetWindowVisibilityChangeInfo(currVisibleData);
1087 }
1088
1089 /**
1090 * @tc.name: UpdateAvoidArea
1091 * @tc.desc: UpdateAvoidArea
1092 * @tc.type: FUNC
1093 */
1094 HWTEST_F(SceneSessionManagerTest7, UpdateAvoidArea, Function | SmallTest | Level3)
1095 {
1096 int32_t persistentId = 0;
1097 ASSERT_NE(nullptr, ssm_);
1098 ssm_->sceneSessionMap_.clear();
1099 ssm_->UpdateAvoidArea(persistentId);
1100 }
1101
1102 /**
1103 * @tc.name: UpdateAvoidArea01
1104 * @tc.desc: UpdateAvoidArea
1105 * @tc.type: FUNC
1106 */
1107 HWTEST_F(SceneSessionManagerTest7, UpdateAvoidArea01, Function | SmallTest | Level3)
1108 {
1109 int32_t persistentId = 0;
1110 ASSERT_NE(nullptr, ssm_);
1111 ssm_->sceneSessionMap_.clear();
1112 ssm_->UpdateAvoidArea(persistentId);
1113 SessionInfo sessionInfo;
1114 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1115 sessionInfo.abilityName_ = "UpdateAvoidArea01";
1116 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1117 ASSERT_NE(nullptr, sceneSession);
1118 ASSERT_NE(nullptr, sceneSession->property_);
1119 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_STATUS_BAR);
1120 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
1121 ssm_->UpdateAvoidArea(persistentId);
1122 }
1123
1124 /**
1125 * @tc.name: UpdateAvoidArea02
1126 * @tc.desc: UpdateAvoidArea
1127 * @tc.type: FUNC
1128 */
1129 HWTEST_F(SceneSessionManagerTest7, UpdateAvoidArea02, Function | SmallTest | Level3)
1130 {
1131 int32_t persistentId = 0;
1132 ASSERT_NE(nullptr, ssm_);
1133 ssm_->sceneSessionMap_.clear();
1134 ssm_->UpdateAvoidArea(persistentId);
1135 SessionInfo sessionInfo;
1136 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1137 sessionInfo.abilityName_ = "UpdateAvoidArea02";
1138 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1139 ASSERT_NE(nullptr, sceneSession);
1140 ASSERT_NE(nullptr, sceneSession->property_);
1141 sceneSession->property_->SetWindowType(WindowType::APP_WINDOW_BASE);
1142 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
1143 ssm_->UpdateAvoidArea(persistentId);
1144 }
1145
1146 /**
1147 * @tc.name: NotifySessionMovedToFront01
1148 * @tc.desc: NotifySessionMovedToFront
1149 * @tc.type: FUNC
1150 */
1151 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront01, Function | SmallTest | Level3)
1152 {
1153 int32_t persistentId = 1;
1154 SessionInfo sessionInfo;
1155 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1156 sessionInfo.abilityName_ = "NotifySessionMovedToFront01";
1157 sessionInfo.isSystem_ = false;
1158 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1159 ASSERT_NE(nullptr, sceneSession);
1160 ASSERT_NE(nullptr, ssm_);
1161 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
1162 ASSERT_NE(nullptr, ssm_->listenerController_);
1163 sceneSession->sessionInfo_.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>();
1164 ASSERT_NE(nullptr, sceneSession->sessionInfo_.abilityInfo);
1165 sceneSession->sessionInfo_.abilityInfo->excludeFromMissions = true;
1166 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
1167 ssm_->NotifySessionMovedToFront(persistentId);
1168 }
1169
1170 /**
1171 * @tc.name: NotifySessionMovedToFront02
1172 * @tc.desc: NotifySessionMovedToFront
1173 * @tc.type: FUNC
1174 */
1175 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront02, Function | SmallTest | Level3)
1176 {
1177 int32_t persistentId = 1;
1178 SessionInfo sessionInfo;
1179 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1180 sessionInfo.abilityName_ = "NotifySessionMovedToFront02";
1181 sessionInfo.isSystem_ = false;
1182 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1183 ASSERT_NE(nullptr, sceneSession);
1184 ASSERT_NE(nullptr, ssm_);
1185 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
1186 ASSERT_NE(nullptr, ssm_->listenerController_);
1187 sceneSession->sessionInfo_.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>();
1188 ASSERT_NE(nullptr, sceneSession->sessionInfo_.abilityInfo);
1189 sceneSession->sessionInfo_.abilityInfo->excludeFromMissions = false;
1190 ssm_->sceneSessionMap_.insert(std::make_pair(persistentId, sceneSession));
1191 ssm_->NotifySessionMovedToFront(persistentId);
1192 }
1193
1194 /**
1195 * @tc.name: NotifySessionMovedToFront03
1196 * @tc.desc: NotifySessionMovedToFront
1197 * @tc.type: FUNC
1198 */
1199 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront03, Function | SmallTest | Level3)
1200 {
1201 int32_t persistentId = 1;
1202 SessionInfo sessionInfo;
1203 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1204 sessionInfo.abilityName_ = "NotifySessionMovedToFront03";
1205 sessionInfo.isSystem_ = false;
1206 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1207 ASSERT_NE(nullptr, sceneSession);
1208 ASSERT_NE(nullptr, ssm_);
1209 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
1210 ASSERT_NE(nullptr, ssm_->listenerController_);
1211 sceneSession->sessionInfo_.abilityInfo = nullptr;
1212 ssm_->NotifySessionMovedToFront(persistentId);
1213 }
1214
1215 /**
1216 * @tc.name: NotifySessionMovedToFront04
1217 * @tc.desc: NotifySessionMovedToFront
1218 * @tc.type: FUNC
1219 */
1220 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront04, Function | SmallTest | Level3)
1221 {
1222 int32_t persistentId = 1;
1223 SessionInfo sessionInfo;
1224 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1225 sessionInfo.abilityName_ = "NotifySessionMovedToFront04";
1226 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1227 ASSERT_NE(nullptr, sceneSession);
1228 ASSERT_NE(nullptr, ssm_);
1229 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
1230 ASSERT_NE(nullptr, ssm_->listenerController_);
1231 sceneSession->sessionInfo_.isSystem_ = true;
1232 ssm_->NotifySessionMovedToFront(persistentId);
1233 }
1234
1235 /**
1236 * @tc.name: NotifySessionMovedToFront05
1237 * @tc.desc: NotifySessionMovedToFront
1238 * @tc.type: FUNC
1239 */
1240 HWTEST_F(SceneSessionManagerTest7, NotifySessionMovedToFront05, Function | SmallTest | Level3)
1241 {
1242 int32_t persistentId = 1;
1243 SessionInfo sessionInfo;
1244 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1245 sessionInfo.abilityName_ = "NotifySessionMovedToFront05";
1246 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1247 ASSERT_NE(nullptr, sceneSession);
1248 ASSERT_NE(nullptr, ssm_);
1249 ssm_->listenerController_ = nullptr;
1250 ssm_->NotifySessionMovedToFront(persistentId);
1251 }
1252
1253 /**
1254 * @tc.name: UpdateNormalSessionAvoidArea02
1255 * @tc.desc: UpdateNormalSessionAvoidArea
1256 * @tc.type: FUNC
1257 */
1258 HWTEST_F(SceneSessionManagerTest7, UpdateNormalSessionAvoidArea02, Function | SmallTest | Level3)
1259 {
1260 SessionInfo sessionInfo;
1261 sessionInfo.bundleName_ = "SceneSessionManagerTest7";
1262 sessionInfo.abilityName_ = "UpdateNormalSessionAvoidArea02";
1263 sessionInfo.isSystem_ = true;
1264 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1265 ASSERT_NE(nullptr, sceneSession);
1266 sceneSession->isVisible_ = true;
1267 sceneSession->state_ = SessionState::STATE_FOREGROUND;
1268 sceneSession->winRect_ = { 1, 1, 1, 1 };
1269 int32_t persistentId = 1;
1270 bool needUpdate = true;
1271 ASSERT_NE(nullptr, ssm_);
1272 ssm_->avoidAreaListenerSessionSet_.clear();
1273 ssm_->avoidAreaListenerSessionSet_.insert(persistentId);
1274 ssm_->UpdateNormalSessionAvoidArea(persistentId, sceneSession, needUpdate);
1275 }
1276 }
1277 } // namespace Rosen
1278 } // namespace OHOS