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 "mock/mock_accesstoken_kit.h"
21 #include "session_manager/include/scene_session_manager.h"
22 #include "session_info.h"
23 #include "session/host/include/root_scene_session.h"
24 #include "session/host/include/scene_session.h"
25 #include "session_manager.h"
26 #include "screen_session_manager_client/include/screen_session_manager_client.h"
27
28 using namespace testing;
29 using namespace testing::ext;
30
31 namespace OHOS {
32 namespace Rosen {
33
34 class SceneSessionManagerTest10 : public testing::Test {
35 public:
36 static void SetUpTestCase();
37 static void TearDownTestCase();
38 void SetUp() override;
39 void TearDown() override;
40 void InitTestSceneSession(DisplayId displayId, int32_t windowId, int32_t zOrder, bool visible, WSRect rect);
41 void InitTestSceneSessionForListWindowInfo();
42
43 static sptr<SceneSessionManager> ssm_;
44
45 private:
46 static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
47 };
48
49 sptr<SceneSessionManager> SceneSessionManagerTest10::ssm_ = nullptr;
50
GetCutoutInfoByRotation(Rotation rotation,Rect & rect)51 bool GetCutoutInfoByRotation(Rotation rotation, Rect& rect)
52 {
53 auto cutoutInfo = DisplayManager::GetInstance().GetCutoutInfoWithRotation(rotation);
54 if (cutoutInfo == nullptr) {
55 TLOGI(WmsLogTag::WMS_IMMS, "There is no cutout info");
56 return false;
57 }
58 std::vector<DMRect> cutoutAreas = cutoutInfo->GetBoundingRects();
59 if (cutoutAreas.empty()) {
60 TLOGI(WmsLogTag::WMS_IMMS, "There is no cutout area");
61 return false;
62 }
63 for (auto& cutoutArea : cutoutAreas) {
64 rect = { cutoutArea.posX_, cutoutArea.posY_, cutoutArea.width_, cutoutArea.height_ };
65 }
66 return true;
67 }
68
SetUpTestCase()69 void SceneSessionManagerTest10::SetUpTestCase()
70 {
71 ssm_ = &SceneSessionManager::GetInstance();
72 }
73
TearDownTestCase()74 void SceneSessionManagerTest10::TearDownTestCase()
75 {
76 ssm_ = nullptr;
77 }
78
SetUp()79 void SceneSessionManagerTest10::SetUp() {}
80
TearDown()81 void SceneSessionManagerTest10::TearDown()
82 {
83 MockAccesstokenKit::ChangeMockStateToInit();
84 usleep(WAIT_SYNC_IN_NS);
85 }
86
InitTestSceneSession(DisplayId displayId,int32_t windowId,int32_t zOrder,bool visible,WSRect rect)87 void SceneSessionManagerTest10::InitTestSceneSession(DisplayId displayId,
88 int32_t windowId,
89 int32_t zOrder,
90 bool visible,
91 WSRect rect)
92 {
93 SessionInfo info;
94 info.bundleName_ = "root";
95 info.persistentId_ = windowId;
96 sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, nullptr);
97 ASSERT_NE(nullptr, sceneSession);
98 sceneSession->SetZOrder(zOrder);
99 sceneSession->SetRSVisible(visible);
100 sceneSession->SetSessionRect(rect);
101 sceneSession->property_->SetDisplayId(displayId);
102 ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
103 EXPECT_EQ(windowId, sceneSession->GetPersistentId());
104 }
105
InitTestSceneSessionForListWindowInfo()106 void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo()
107 {
108 SessionInfo sessionInfo1;
109 sessionInfo1.isSystem_ = false;
110 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
111 sceneSession1->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
112 WSRect rect = { 0, 0, 100, 100 };
113 sceneSession1->SetSessionRect(rect);
114 sceneSession1->SetSessionGlobalRect(rect);
115 sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND);
116 sceneSession1->GetSessionProperty()->SetDisplayId(0);
117 ssm_->sceneSessionMap_.insert({ sceneSession1->GetPersistentId(), sceneSession1 });
118
119 SessionInfo sessionInfo2;
120 sessionInfo2.isSystem_ = false;
121 sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(sessionInfo2, nullptr);
122 sceneSession2->SetVisibilityState(WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION);
123 rect = { 0, 0, 120, 120 };
124 sceneSession2->SetSessionRect(rect);
125 sceneSession2->SetSessionGlobalRect(rect);
126 sceneSession2->SetSessionState(SessionState::STATE_FOREGROUND);
127 sceneSession2->GetSessionProperty()->SetDisplayId(0);
128 ssm_->sceneSessionMap_.insert({ sceneSession2->GetPersistentId(), sceneSession2 });
129
130 SessionInfo sessionInfo3;
131 sessionInfo3.isSystem_ = false;
132 sptr<SceneSession> sceneSession3 = sptr<SceneSession>::MakeSptr(sessionInfo3, nullptr);
133 sceneSession3->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
134 rect = { 0, 100, 120, 120 };
135 sceneSession3->SetSessionRect(rect);
136 sceneSession3->SetSessionGlobalRect(rect);
137 sceneSession3->SetSessionState(SessionState::STATE_FOREGROUND);
138 sceneSession3->GetSessionProperty()->SetDisplayId(0);
139 ssm_->sceneSessionMap_.insert({ sceneSession3->GetPersistentId(), sceneSession3 });
140
141 SessionInfo sessionInfo4;
142 sessionInfo4.isSystem_ = false;
143 sptr<SceneSession> sceneSession4 = sptr<SceneSession>::MakeSptr(sessionInfo4, nullptr);
144 sceneSession4->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
145 rect = { 0, 3000, 120, 120 };
146 sceneSession4->SetSessionRect(rect);
147 sceneSession4->SetSessionGlobalRect(rect);
148 sceneSession4->SetSessionState(SessionState::STATE_FOREGROUND);
149 sceneSession4->GetSessionProperty()->SetDisplayId(0);
150 ssm_->sceneSessionMap_.insert({ sceneSession4->GetPersistentId(), sceneSession4 });
151
152 SessionInfo sessionInfo5;
153 sessionInfo5.isSystem_ = false;
154 sptr<SceneSession> sceneSession5 = sptr<SceneSession>::MakeSptr(sessionInfo5, nullptr);
155 sceneSession5->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
156 rect = { 0, 0, 100, 100 };
157 sceneSession5->SetSessionRect(rect);
158 sceneSession5->SetSessionGlobalRect(rect);
159 sceneSession5->SetSessionState(SessionState::STATE_BACKGROUND);
160 sceneSession5->GetSessionProperty()->SetDisplayId(0);
161 ssm_->sceneSessionMap_.insert({ sceneSession5->GetPersistentId(), sceneSession5 });
162
163 SessionInfo sessionInfo6;
164 sessionInfo6.isSystem_ = true;
165 sptr<SceneSession> sceneSession6 = sptr<SceneSession>::MakeSptr(sessionInfo6, nullptr);
166 sceneSession6->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
167 rect = { 0, 200, 120, 120 };
168 sceneSession6->SetSessionRect(rect);
169 sceneSession6->SetSessionGlobalRect(rect);
170 sceneSession6->SetSessionState(SessionState::STATE_FOREGROUND);
171 constexpr DisplayId SECOND_DISPLAY_ID = 11;
172 sceneSession6->GetSessionProperty()->SetDisplayId(SECOND_DISPLAY_ID);
173 ssm_->sceneSessionMap_.insert({ sceneSession6->GetPersistentId(), sceneSession6 });
174 }
175
176 namespace {
177 /**
178 * @tc.name: RequestSceneSessionDestructionInner
179 * @tc.desc: Test RequestSceneSessionDestructionInner with CollaboratorType RESERVE_TYPE
180 * @tc.type: FUNC
181 */
182 HWTEST_F(SceneSessionManagerTest10, RequestSceneSessionDestructionInner, TestSize.Level1)
183 {
184 ASSERT_NE(ssm_, nullptr);
185
186 SessionInfo info;
187 sptr<SceneSession::SpecificSessionCallback> specificCallback = nullptr;
188 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
189 sptr<AAFwk::SessionInfo> sceneSessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr();
190 bool needRemoveSession = true;
191 bool isForceClean = true;
192
193 SessionInfo sessionInfo;
194 sessionInfo.collaboratorType_ = CollaboratorType::RESERVE_TYPE;
195 auto res =
196 ssm_->RequestSceneSessionDestructionInner(sceneSession, sceneSessionInfo, needRemoveSession, isForceClean);
197 ASSERT_EQ(res, WSError::WS_OK);
198 }
199
200 /**
201 * @tc.name: TestRequestSceneSessionDestructionInner_01
202 * @tc.desc: Test RequestSceneSessionDestructionInner with CollaboratorType DEFAULT_TYPE
203 * @tc.type: FUNC
204 */
205 HWTEST_F(SceneSessionManagerTest10, TestRequestSceneSessionDestructionInner_01, TestSize.Level1)
206 {
207 ASSERT_NE(ssm_, nullptr);
208
209 SessionInfo info;
210 sptr<SceneSession::SpecificSessionCallback> specificCallback = nullptr;
211 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
212 sptr<AAFwk::SessionInfo> sceneSessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr();
213 bool needRemoveSession = false;
214 bool isForceClean = false;
215
216 SessionInfo sessionInfo;
217 sessionInfo.collaboratorType_ = CollaboratorType::DEFAULT_TYPE;
218 sessionInfo.want = std::make_shared<AAFwk::Want>();
219 ssm_->listenerController_ = std::make_shared<SessionListenerController>();
220 auto res =
221 ssm_->RequestSceneSessionDestructionInner(sceneSession, sceneSessionInfo, needRemoveSession, isForceClean);
222 ASSERT_EQ(res, WSError::WS_OK);
223 }
224
225 /**
226 * @tc.name: TestRegisterWindowManagerAgent_01
227 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR
228 * @tc.type: FUNC
229 */
230 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_01, TestSize.Level1)
231 {
232 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR;
233 sptr<IWindowManagerAgent> windowManagerAgent;
234 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
235 ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
236 }
237
238 /**
239 * @tc.name: TestRegisterWindowManagerAgent_02
240 * @tc.desc: Test RegisterWindowManagerAgent with AgentType WINDOW_MANAGER_AGENT_TYPE_GESTURE_NAVIGATION_ENABLED
241 * @tc.type: FUNC
242 */
243 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_02, TestSize.Level1)
244 {
245 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_GESTURE_NAVIGATION_ENABLED;
246 sptr<IWindowManagerAgent> windowManagerAgent;
247 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
248 ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
249 }
250
251 /**
252 * @tc.name: TestRegisterWindowManagerAgent_03
253 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WATER_MARK_FLAG
254 * @tc.type: FUNC
255 */
256 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_03, TestSize.Level1)
257 {
258 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WATER_MARK_FLAG;
259 sptr<IWindowManagerAgent> windowManagerAgent;
260 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
261 ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
262 }
263
264 /**
265 * @tc.name: TestRegisterWindowManagerAgent_04
266 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE
267 * @tc.type: FUNC
268 */
269 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_04, TestSize.Level1)
270 {
271 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE;
272 sptr<IWindowManagerAgent> windowManagerAgent;
273 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
274 ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
275 }
276
277 /**
278 * @tc.name: TestRegisterWindowManagerAgent_05
279 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY
280 * @tc.type: FUNC
281 */
282 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_05, TestSize.Level1)
283 {
284 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY;
285 sptr<IWindowManagerAgent> windowManagerAgent;
286 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
287 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
288 }
289
290 /**
291 * @tc.name: TestRegisterWindowManagerAgent_06
292 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_FOCUS
293 * @tc.type: FUNC
294 */
295 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_06, TestSize.Level1)
296 {
297 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
298 sptr<IWindowManagerAgent> windowManagerAgent;
299 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
300 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
301 }
302
303 /**
304 * @tc.name: TestRegisterWindowManagerAgent_07
305 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_DRAWING_STATE
306 * @tc.type: FUNC
307 */
308 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_07, TestSize.Level1)
309 {
310 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_DRAWING_STATE;
311 sptr<IWindowManagerAgent> windowManagerAgent;
312 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
313 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
314 }
315
316 /**
317 * @tc.name: TestRegisterWindowManagerAgent_08
318 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_VISIBLE_WINDOW_NUM
319 * @tc.type: FUNC
320 */
321 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_08, TestSize.Level1)
322 {
323 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_VISIBLE_WINDOW_NUM;
324 sptr<IWindowManagerAgent> windowManagerAgent;
325 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
326 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
327 }
328
329 /**
330 * @tc.name: TestRegisterWindowManagerAgent_09
331 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_MODE
332 * @tc.type: FUNC
333 */
334 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_09, TestSize.Level1)
335 {
336 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_MODE;
337 sptr<IWindowManagerAgent> windowManagerAgent;
338 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
339 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
340 }
341
342 /**
343 * @tc.name: TestRegisterWindowManagerAgent_010
344 * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_PID_VISIBILITY
345 * @tc.type: FUNC
346 */
347 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_010, TestSize.Level1)
348 {
349 WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_PID_VISIBILITY;
350 sptr<IWindowManagerAgent> windowManagerAgent;
351 auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
352 ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
353 }
354
355 /**
356 * @tc.name: RegisterAcquireRotateAnimationConfigFunc
357 * @tc.desc: RegisterAcquireRotateAnimationConfigFunc
358 * @tc.type: FUNC
359 */
360 HWTEST_F(SceneSessionManagerTest10, RegisterAcquireRotateAnimationConfigFunc, TestSize.Level1)
361 {
362 ASSERT_NE(ssm_, nullptr);
363 SessionInfo sessionInfo;
364 sessionInfo.bundleName_ = "bundleName";
365 sessionInfo.persistentId_ = 1;
366 sessionInfo.isSystem_ = false;
367 sessionInfo.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>();
368 ASSERT_NE(sessionInfo.abilityInfo, nullptr);
369 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
370 ASSERT_NE(sceneSession, nullptr);
371 sceneSession->scenePersistence_ = sptr<ScenePersistence>::MakeSptr("bundleName", 1);
372 ASSERT_NE(sceneSession->scenePersistence_, nullptr);
373 ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
374 ssm_->RegisterAcquireRotateAnimationConfigFunc(sceneSession);
375 WSRect rect({ 1, 1, 1, 1 });
376 SizeChangeReason reason = SizeChangeReason::ROTATION;
377 WSError result = sceneSession->UpdateRect(rect, reason, "SceneSessionManagerTest10");
378 ASSERT_EQ(result, WSError::WS_OK);
379 }
380
381 /**
382 * @tc.name: TestCheckLastFocusedAppSessionFocus_01
383 * @tc.desc: Test CheckLastFocusedAppSessionFocus with GetPersistentId
384 * @tc.type: FUNC
385 */
386 HWTEST_F(SceneSessionManagerTest10, TestCheckLastFocusedAppSessionFocus_01, TestSize.Level1)
387 {
388 ASSERT_NE(ssm_, nullptr);
389
390 SessionInfo info1;
391 info1.abilityName_ = "focusedSession";
392 info1.bundleName_ = "focusedSession";
393 info1.windowType_ = 1;
394 sptr<SceneSession> focusedSession = sptr<SceneSession>::MakeSptr(info1, nullptr);
395 ASSERT_NE(focusedSession, nullptr);
396
397 SessionInfo info2;
398 info2.abilityName_ = "nextSession";
399 info2.bundleName_ = "nextSession";
400 info2.windowType_ = 1;
401 sptr<SceneSession> nextSession = sptr<SceneSession>::MakeSptr(info2, nullptr);
402 ASSERT_NE(nextSession, nullptr);
403
404 auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
405 focusGroup->SetLastFocusedAppSessionId(nextSession->GetPersistentId());
406 ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
407 }
408
409 /**
410 * @tc.name: TestCheckLastFocusedAppSessionFocus_02
411 * @tc.desc: Test CheckLastFocusedAppSessionFocus with WindowType WINDOW_TYPE_DIALOG
412 * @tc.type: FUNC
413 */
414 HWTEST_F(SceneSessionManagerTest10, TestCheckLastFocusedAppSessionFocus_02, TestSize.Level1)
415 {
416 ASSERT_NE(ssm_, nullptr);
417
418 SessionInfo info1;
419 info1.abilityName_ = "focusedSession";
420 info1.bundleName_ = "focusedSession";
421 info1.windowType_ = 1;
422 sptr<SceneSession> focusedSession = sptr<SceneSession>::MakeSptr(info1, nullptr);
423
424 SessionInfo info2;
425 info2.abilityName_ = "nextSession";
426 info2.bundleName_ = "nextSession";
427 info2.windowType_ = 1;
428 sptr<SceneSession> nextSession = sptr<SceneSession>::MakeSptr(info2, nullptr);
429
430 ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, 124);
431 focusedSession->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
432 ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
433
434 nextSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
435 ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
436 auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
437 ASSERT_EQ(0, focusGroup->GetLastFocusedAppSessionId());
438 }
439
440 /**
441 * @tc.name: GetWindowIdsByCoordinate01
442 * @tc.desc: GetWindowIdsByCoordinate, displayId invalid
443 * @tc.type: FUNC
444 */
445 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate01, TestSize.Level1)
446 {
447 std::vector<int32_t> windowIds;
448 WMError result = ssm_->GetWindowIdsByCoordinate(DISPLAY_ID_INVALID, 0, 0, 0, windowIds);
449 EXPECT_EQ(result, WMError::WM_ERROR_INVALID_PARAM);
450 }
451
452 /**
453 * @tc.name: GetWindowIdsByCoordinate02
454 * @tc.desc: GetWindowIdsByCoordinate, windowNumber 0, x y invalid
455 * @tc.type: FUNC
456 */
457 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate02, TestSize.Level1)
458 {
459 ssm_->sceneSessionMap_.clear();
460 InitTestSceneSession(1, 101, 11, true, { 100, 100, 200, 200 });
461 ssm_->sceneSessionMap_.insert({ 102, nullptr });
462 InitTestSceneSession(1, 103, 14, true, { 120, 120, 220, 220 });
463 InitTestSceneSession(1, 105, 12, true, { 100, 100, 200, 200 });
464 auto it1 = ssm_->sceneSessionMap_.find(105);
465 if (it1 != ssm_->sceneSessionMap_.end()) {
466 it1->second->sessionInfo_.bundleName_ = "other";
467 }
468 InitTestSceneSession(1, 106, 15, true, { 140, 140, 240, 240 });
469 InitTestSceneSession(2, 107, 15, true, { 150, 150, 250, 250 });
470 InitTestSceneSession(1, 108, 13, false, { 150, 150, 250, 250 });
471 InitTestSceneSession(1, 109, 13, true, { 160, 160, 260, 260 });
472 InitTestSceneSession(1, 110, 12, true, { 500, 500, 600, 600 });
473
474 std::vector<int32_t> windowIds;
475 WMError result = ssm_->GetWindowIdsByCoordinate(1, 0, -1, -1, windowIds);
476 EXPECT_EQ(result, WMError::WM_OK);
477 EXPECT_EQ(5, windowIds.size());
478 EXPECT_EQ(106, windowIds[0]);
479 EXPECT_EQ(103, windowIds[1]);
480 EXPECT_EQ(109, windowIds[2]);
481 EXPECT_EQ(110, windowIds[3]);
482 EXPECT_EQ(101, windowIds[4]);
483 ssm_->sceneSessionMap_.clear();
484 }
485
486 /**
487 * @tc.name: GetWindowIdsByCoordinate03
488 * @tc.desc: GetWindowIdsByCoordinate, windowNumber 3, x y invalid
489 * @tc.type: FUNC
490 */
491 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate03, TestSize.Level1)
492 {
493 ssm_->sceneSessionMap_.clear();
494 InitTestSceneSession(1, 111, 11, true, { 100, 100, 200, 200 });
495 ssm_->sceneSessionMap_.insert({ 102, nullptr });
496 InitTestSceneSession(1, 113, 14, true, { 120, 120, 220, 220 });
497 InitTestSceneSession(1, 114, 12, true, { 100, 100, 200, 200 });
498 ASSERT_TRUE(ssm_->sceneSessionMap_.find(114) != ssm_->sceneSessionMap_.end());
499 InitTestSceneSession(1, 115, 12, true, { 100, 100, 200, 200 });
500 auto it1 = ssm_->sceneSessionMap_.find(115);
501 if (it1 != ssm_->sceneSessionMap_.end()) {
502 it1->second->sessionInfo_.bundleName_ = "other";
503 }
504 InitTestSceneSession(1, 116, 15, true, { 140, 140, 240, 240 });
505 InitTestSceneSession(2, 117, 15, true, { 150, 150, 250, 250 });
506 InitTestSceneSession(1, 118, 13, false, { 150, 150, 250, 250 });
507 InitTestSceneSession(1, 119, 13, true, { 160, 160, 260, 260 });
508 InitTestSceneSession(1, 120, 12, true, { 500, 500, 600, 600 });
509
510 std::vector<int32_t> windowIds;
511 WMError result = ssm_->GetWindowIdsByCoordinate(1, 3, -1, -1, windowIds);
512 EXPECT_EQ(result, WMError::WM_OK);
513 EXPECT_EQ(3, windowIds.size());
514 EXPECT_EQ(116, windowIds[0]);
515 EXPECT_EQ(113, windowIds[1]);
516 EXPECT_EQ(119, windowIds[2]);
517 ssm_->sceneSessionMap_.clear();
518 }
519
520 /**
521 * @tc.name: GetWindowIdsByCoordinate04
522 * @tc.desc: GetWindowIdsByCoordinate, windowNumber 0, x y effictive value
523 * @tc.type: FUNC
524 */
525 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate04, TestSize.Level1)
526 {
527 ssm_->sceneSessionMap_.clear();
528 InitTestSceneSession(1, 121, 11, true, { 100, 100, 200, 200 });
529 ssm_->sceneSessionMap_.insert({ 102, nullptr });
530 InitTestSceneSession(1, 123, 14, true, { 120, 120, 220, 220 });
531 InitTestSceneSession(1, 125, 12, true, { 100, 100, 200, 200 });
532 auto it1 = ssm_->sceneSessionMap_.find(125);
533 if (it1 != ssm_->sceneSessionMap_.end()) {
534 it1->second->sessionInfo_.bundleName_ = "other";
535 }
536 InitTestSceneSession(1, 126, 15, true, { 140, 140, 240, 240 });
537 InitTestSceneSession(2, 127, 15, true, { 150, 150, 250, 250 });
538 InitTestSceneSession(1, 128, 13, false, { 150, 150, 250, 250 });
539 InitTestSceneSession(1, 129, 13, true, { 160, 160, 260, 260 });
540 InitTestSceneSession(1, 130, 12, true, { 500, 500, 600, 600 });
541
542 std::vector<int32_t> windowIds;
543 WMError result = ssm_->GetWindowIdsByCoordinate(1, 0, 180, 180, windowIds);
544 EXPECT_EQ(result, WMError::WM_OK);
545 EXPECT_EQ(4, windowIds.size());
546 EXPECT_EQ(126, windowIds[0]);
547 EXPECT_EQ(123, windowIds[1]);
548 EXPECT_EQ(129, windowIds[2]);
549 EXPECT_EQ(121, windowIds[3]);
550 ssm_->sceneSessionMap_.clear();
551 }
552
553 /**
554 * @tc.name: GetWindowIdsByCoordinate05
555 * @tc.desc: GetWindowIdsByCoordinate, windowNumber 3, x y effictive value
556 * @tc.type: FUNC
557 */
558 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate05, TestSize.Level1)
559 {
560 ssm_->sceneSessionMap_.clear();
561 InitTestSceneSession(1, 131, 11, true, { 100, 100, 200, 200 });
562 ssm_->sceneSessionMap_.insert({ 102, nullptr });
563 InitTestSceneSession(1, 133, 14, true, { 120, 120, 220, 220 });
564 InitTestSceneSession(1, 134, 12, true, { 100, 100, 200, 200 });
565 ASSERT_TRUE(ssm_->sceneSessionMap_.find(134) != ssm_->sceneSessionMap_.end());
566 InitTestSceneSession(1, 135, 12, true, { 100, 100, 200, 200 });
567 auto it1 = ssm_->sceneSessionMap_.find(135);
568 if (it1 != ssm_->sceneSessionMap_.end()) {
569 it1->second->sessionInfo_.bundleName_ = "other";
570 }
571 InitTestSceneSession(1, 136, 15, true, { 140, 140, 240, 240 });
572 InitTestSceneSession(2, 137, 15, true, { 150, 150, 250, 250 });
573 InitTestSceneSession(1, 138, 13, false, { 150, 150, 250, 250 });
574 InitTestSceneSession(1, 139, 13, true, { 160, 160, 260, 260 });
575 InitTestSceneSession(1, 140, 12, true, { 500, 500, 600, 600 });
576
577 std::vector<int32_t> windowIds;
578 WMError result = ssm_->GetWindowIdsByCoordinate(1, 3, 180, 180, windowIds);
579 EXPECT_EQ(result, WMError::WM_OK);
580 EXPECT_EQ(3, windowIds.size());
581 EXPECT_EQ(136, windowIds[0]);
582 EXPECT_EQ(133, windowIds[1]);
583 EXPECT_EQ(139, windowIds[2]);
584 ssm_->sceneSessionMap_.clear();
585 }
586
587 /**
588 * @tc.name: ChangeWindowRectYInVirtualDisplay
589 * @tc.desc: ChangeWindowRectYInVirtualDisplay
590 * @tc.type: FUNC
591 */
592 HWTEST_F(SceneSessionManagerTest10, ChangeWindowRectYInVirtualDisplay, TestSize.Level1)
593 {
594 DisplayId defaultDisplayId = 0;
595 DisplayId displayId = 0;
596 int32_t y = 100;
597 ssm_->ChangeWindowRectYInVirtualDisplay(displayId, y);
598 EXPECT_EQ(displayId, 0);
599 EXPECT_EQ(y, 100);
600 displayId = 999;
601 ssm_->ChangeWindowRectYInVirtualDisplay(displayId, y);
602 EXPECT_EQ(displayId, defaultDisplayId);
603 }
604 /**
605 * @tc.name: ProcessFocusZOrderChange
606 * @tc.desc: ProcessFocusZOrderChange
607 * @tc.type: FUNC
608 */
609 HWTEST_F(SceneSessionManagerTest10, ProcessFocusZOrderChange, TestSize.Level1)
610 {
611 ssm_->sceneSessionMap_.clear();
612 ssm_->ProcessFocusZOrderChange(10);
613 ssm_->systemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
614 ssm_->ProcessFocusZOrderChange(97);
615
616 ssm_->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
617 ssm_->ProcessFocusZOrderChange(97);
618
619 SessionInfo sessionInfo;
620 sessionInfo.bundleName_ = "focusedSession";
621 sessionInfo.abilityName_ = "focusedSession";
622 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
623 ASSERT_NE(nullptr, sceneSession);
624 ssm_->sceneSessionMap_.emplace(1, sceneSession);
625 auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
626 focusGroup->SetFocusedSessionId(1);
627 ssm_->ProcessFocusZOrderChange(97);
628
629 sceneSession->lastZOrder_ = 2203;
630 sceneSession->zOrder_ = 101;
631 ssm_->ProcessFocusZOrderChange(97);
632
633 SessionInfo sessionInfo1;
634 sessionInfo1.bundleName_ = "voiceInteractionSession";
635 sessionInfo1.abilityName_ = "voiceInteractionSession";
636 sessionInfo1.windowType_ = static_cast<uint32_t>(WindowType::WINDOW_TYPE_VOICE_INTERACTION);
637 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
638 ASSERT_NE(nullptr, sceneSession1);
639 sceneSession1->zOrder_ = 2109;
640 ssm_->sceneSessionMap_.emplace(2, sceneSession1);
641
642 sceneSession->lastZOrder_ = 103;
643 sceneSession->zOrder_ = 101;
644 ssm_->ProcessFocusZOrderChange(97);
645
646 sceneSession->lastZOrder_ = 2203;
647 sceneSession->zOrder_ = 101;
648 ssm_->ProcessFocusZOrderChange(97);
649 }
650
651 /**
652 * @tc.name: GetAllSceneSessionForAccessibility
653 * @tc.desc: GetAllSceneSessionForAccessibility
654 * @tc.type: FUNC
655 */
656 HWTEST_F(SceneSessionManagerTest10, GetAllSceneSessionForAccessibility, TestSize.Level1)
657 {
658 ASSERT_NE(ssm_, nullptr);
659 std::vector<sptr<SceneSession>> sceneSessionList;
660 ASSERT_EQ(sceneSessionList.size(), 0);
661 SessionInfo info1;
662 info1.abilityName_ = "test1";
663 info1.bundleName_ = "test1";
664 info1.windowType_ = 1;
665 sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(info1, nullptr);
666 ASSERT_NE(nullptr, sceneSession1);
667 SessionInfo info2;
668 info2.abilityName_ = "test2";
669 info2.bundleName_ = "test2";
670 info2.windowType_ = 1;
671 sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(info2, nullptr);
672 ASSERT_NE(nullptr, sceneSession2);
673 SessionInfo info3;
674 info3.abilityName_ = "test3";
675 info3.bundleName_ = "test3";
676 info3.windowType_ = 1;
677 sptr<SceneSession> sceneSession3 = sptr<SceneSession>::MakeSptr(info3, nullptr);
678 ASSERT_NE(nullptr, sceneSession3);
679 ssm_->sceneSessionMap_.emplace(1, sceneSession1);
680 ssm_->sceneSessionMap_.emplace(2, sceneSession2);
681 ssm_->sceneSessionMap_.emplace(3, sceneSession3);
682 sceneSession1->isScbCoreEnabled_ = false;
683 sceneSession2->isScbCoreEnabled_ = false;
684 sceneSession3->isScbCoreEnabled_ = false;
685 sceneSession1->isVisibleForAccessibility_ = true;
686 sceneSession2->isVisibleForAccessibility_ = false;
687 sceneSession3->isVisibleForAccessibility_ = true;
688 sceneSession1->isVisible_ = true;
689 sceneSession2->isVisible_ = false;
690 sceneSession3->isVisible_ = true;
691 ssm_->GetAllSceneSessionForAccessibility(sceneSessionList);
692 ASSERT_EQ(sceneSessionList.size(), 1);
693 }
694
695 /**
696 * @tc.name: TestGetMainParentSceneSession_01
697 * @tc.desc: Test GetMainParentSceneSession with invalid persistentId
698 * @tc.type: FUNC
699 */
700 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_01, TestSize.Level1)
701 {
702 ASSERT_NE(ssm_, nullptr);
703 sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(0, ssm_->sceneSessionMap_);
704 ASSERT_EQ(ret, nullptr);
705 }
706
707 /**
708 * @tc.name: TestGetMainParentSceneSession_02
709 * @tc.desc: Test GetMainParentSceneSession with Error found scene session
710 * @tc.type: FUNC
711 */
712 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_02, TestSize.Level1)
713 {
714 ASSERT_NE(ssm_, nullptr);
715 sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(999, ssm_->sceneSessionMap_);
716 ASSERT_EQ(ret, nullptr);
717 }
718
719 /**
720 * @tc.name: TestGetMainParentSceneSession_03
721 * @tc.desc: Test GetMainParentSceneSession with parent session
722 * @tc.type: FUNC
723 */
724 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_03, TestSize.Level1)
725 {
726 ASSERT_NE(ssm_, nullptr);
727 SessionInfo info;
728 info.abilityName_ = "GetMainParentSceneSession001";
729 info.bundleName_ = "GetMainParentSceneSession001";
730 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
731 sptr<SceneSession> sceneSessionParent = sptr<SceneSession>::MakeSptr(info, nullptr);
732 sceneSessionParent->property_->SetPersistentId(100);
733 ssm_->sceneSessionMap_.insert({ 100, sceneSessionParent });
734 sceneSession->SetParentSession(sceneSessionParent);
735
736 ssm_->sceneSessionMap_[999] = sceneSession;
737 sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(999, ssm_->sceneSessionMap_);
738 ASSERT_NE(ret, sceneSessionParent);
739 }
740
741 /**
742 * @tc.name: TestGetParentMainWindowId_01
743 * @tc.desc: Tst GetParentMainWindowId with invalid windowId
744 * @tc.type: FUNC
745 */
746 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_01, TestSize.Level1)
747 {
748 ASSERT_NE(ssm_, nullptr);
749 int32_t windowId = 0;
750 int32_t mainWindowId = 0;
751 WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
752 ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_PARAM);
753 }
754
755 /**
756 * @tc.name: TestGetParentMainWindowId_02
757 * @tc.desc: Tst GetParentMainWindowId with not found scene session
758 * @tc.type: FUNC
759 */
760 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_02, TestSize.Level1)
761 {
762 int32_t windowId = -1;
763 int32_t mainWindowId = 0;
764 WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
765 ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
766 }
767
768 /**
769 * @tc.name: TestGetParentMainWindowId_03
770 * @tc.desc: Tst GetParentMainWindowId with session
771 * @tc.type: FUNC
772 */
773 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_03, TestSize.Level1)
774 {
775 int32_t windowId = 200;
776 int32_t mainWindowId = 0;
777 SessionInfo info;
778 info.abilityName_ = "test";
779 info.bundleName_ = "test";
780 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
781
782 sceneSession->property_->SetPersistentId(windowId);
783 ssm_->sceneSessionMap_[windowId] = sceneSession;
784 WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
785 ASSERT_EQ(ret, WMError::WM_OK);
786 }
787
788 /**
789 * @tc.name: TestGetParentMainWindowId_04
790 * @tc.desc: Tst GetParentMainWindowId with WindowType WINDOW_TYPE_APP_SUB_WINDOW
791 * @tc.type: FUNC
792 */
793 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_04, TestSize.Level1)
794 {
795 int32_t windowId = 200;
796 int32_t mainWindowId = 0;
797 SessionInfo info;
798 info.abilityName_ = "test";
799 info.bundleName_ = "test";
800 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
801 sceneSession->property_->SetPersistentId(windowId);
802 ssm_->sceneSessionMap_[windowId] = sceneSession;
803 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
804 WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
805 ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
806
807 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
808 ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
809 ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
810 }
811
812 /**
813 * @tc.name: NotifyVisibleChange
814 * @tc.desc: test NotifyVisibleChange
815 * @tc.type: FUNC
816 */
817 HWTEST_F(SceneSessionManagerTest10, NotifyVisibleChange, TestSize.Level1)
818 {
819 SessionInfo info;
820 info.abilityName_ = "test";
821 info.bundleName_ = "test";
822 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
823 ASSERT_NE(nullptr, sceneSession);
824
825 ASSERT_FALSE(ssm_->NotifyVisibleChange(sceneSession->GetPersistentId()));
826 ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
827 ASSERT_TRUE(ssm_->NotifyVisibleChange(sceneSession->GetPersistentId()));
828
829 ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
830 }
831
832 /**
833 * @tc.name: TestIsInDefaultScreen_01
834 * @tc.desc: Test IsInDefaultScreen with not DefaultScreen id
835 * @tc.type: FUNC
836 */
837 HWTEST_F(SceneSessionManagerTest10, TestIsInDefaultScreen_01, TestSize.Level1)
838 {
839 SessionInfo info;
840 info.abilityName_ = "test";
841 info.bundleName_ = "test";
842 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
843 DisplayId displayId = 5;
844 sceneSession->property_->SetDisplayId(displayId);
845 ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), false);
846 }
847
848 /**
849 * @tc.name: TestIsInDefaultScreen_02
850 * @tc.desc: Test IsInDefaultScreen with DefaultScreen id
851 * @tc.type: FUNC
852 */
853 HWTEST_F(SceneSessionManagerTest10, TestIsInDefaultScreen_02, TestSize.Level1)
854 {
855 SessionInfo info;
856 info.abilityName_ = "test";
857 info.bundleName_ = "test";
858 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
859 ASSERT_NE(nullptr, sceneSession);
860 DisplayId displayId = ScreenSessionManagerClient::GetInstance().GetDefaultScreenId();
861 sceneSession->property_->SetDisplayId(displayId);
862 ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), true);
863 }
864
865 /**
866 * @tc.name: RegisterRequestVsyncFunc
867 * @tc.desc: test RegisterRequestVsyncFunc01
868 * @tc.type: FUNC
869 */
870 HWTEST_F(SceneSessionManagerTest10, RegisterRequestVsyncFunc01, TestSize.Level1)
871 {
872 ssm_->RegisterRequestVsyncFunc(nullptr);
873 SessionInfo info;
874 info.abilityName_ = "RegisterRequestVsyncFunc01";
875 info.bundleName_ = "RegisterRequestVsyncFunc01";
876 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
877 ASSERT_NE(nullptr, sceneSession);
878 ssm_->RegisterRequestVsyncFunc(sceneSession);
879 ASSERT_NE(nullptr, sceneSession->requestNextVsyncFunc_);
880 }
881
882 /**
883 * @tc.name: RegisterSessionPropertyChangeNotifyManagerFunc
884 * @tc.desc: test RegisterSessionPropertyChangeNotifyManagerFunc01
885 * @tc.type: FUNC
886 */
887 HWTEST_F(SceneSessionManagerTest10, RegisterSessionPropertyChangeNotifyManagerFunc01, TestSize.Level1)
888 {
889 ssm_->RegisterSessionPropertyChangeNotifyManagerFunc(nullptr);
890 SessionInfo info;
891 info.abilityName_ = "RegisterRequestVsyncFunc01";
892 info.bundleName_ = "RegisterRequestVsyncFunc01";
893 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
894 ASSERT_NE(nullptr, sceneSession);
895 ssm_->RegisterSessionPropertyChangeNotifyManagerFunc(sceneSession);
896 EXPECT_NE(nullptr, sceneSession->sessionPropertyChangeNotifyManagerFunc_);
897 }
898
899 /**
900 * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_01
901 * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase id not exist
902 * @tc.type: FUNC
903 */
904 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_01, TestSize.Level1)
905 {
906 // init
907 ssm_->sceneSessionMap_.clear();
908 ssm_->sessionMapDirty_ = 0;
909
910 SessionInfo info;
911 info.abilityName_ = "EraseSceneSessionAndMarkDirtyLocked";
912 info.bundleName_ = "EraseSceneSessionAndMarkDirtyLocked";
913 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
914 const int32_t validId = 100;
915 const int32_t invalidId = 101;
916 ssm_->sceneSessionMap_.insert({ validId, sceneSession });
917 // erase id not exist
918 ssm_->EraseSceneSessionAndMarkDirtyLocked(invalidId);
919 ASSERT_EQ(ssm_->sessionMapDirty_, 0);
920 ASSERT_NE(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
921 }
922
923 /**
924 * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_02
925 * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase invisible session
926 * @tc.type: FUNC
927 */
928 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_02, TestSize.Level1)
929 {
930 // init
931 ssm_->sceneSessionMap_.clear();
932 ssm_->sessionMapDirty_ = 0;
933
934 SessionInfo info;
935 info.abilityName_ = "TestEraseSceneSessionAndMarkDirtyLocked_02";
936 info.bundleName_ = "TestEraseSceneSessionAndMarkDirtyLocked_02";
937 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
938 const int32_t validId = 100;
939 ssm_->sceneSessionMap_.insert({ validId, sceneSession });
940
941 // erase invisible session
942 sceneSession->isVisible_ = false;
943 ssm_->EraseSceneSessionAndMarkDirtyLocked(validId);
944 ASSERT_EQ(ssm_->sessionMapDirty_, 0);
945 ASSERT_EQ(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
946 }
947
948 /**
949 * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_03
950 * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase visible session
951 * @tc.type: FUNC
952 */
953 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_03, TestSize.Level1)
954 {
955 // init
956 ssm_->sceneSessionMap_.clear();
957 ssm_->sessionMapDirty_ = 0;
958
959 SessionInfo info;
960 info.abilityName_ = "TestEraseSceneSessionAndMarkDirtyLocked_03";
961 info.bundleName_ = "TestEraseSceneSessionAndMarkDirtyLocked_03";
962 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
963 const int32_t validId = 100;
964
965 // erase visible session
966 ssm_->sceneSessionMap_.insert({ validId, sceneSession });
967 sceneSession->isVisible_ = true;
968 ssm_->EraseSceneSessionAndMarkDirtyLocked(validId);
969 ASSERT_EQ(ssm_->sessionMapDirty_, static_cast<uint32_t>(SessionUIDirtyFlag::VISIBLE));
970 ASSERT_EQ(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
971 }
972
973 /**
974 * @tc.name: ProcessUpdateLastFocusedAppId
975 * @tc.desc: test ProcessUpdateLastFocusedAppId
976 * @tc.type: FUNC
977 */
978 HWTEST_F(SceneSessionManagerTest10, ProcessUpdateLastFocusedAppId, TestSize.Level1)
979 {
980 ssm_->sceneSessionMap_.clear();
981 std::vector<std::pair<uint32_t, uint32_t>> zOrderList;
982 ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, INVALID_SESSION_ID);
983 ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
984
985 SessionInfo sessionInfo;
986 sessionInfo.bundleName_ = "lastFocusedAppSession";
987 sessionInfo.abilityName_ = "lastFocusedAppSession";
988 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
989 ssm_->sceneSessionMap_.emplace(1, sceneSession);
990 ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, 1);
991 sceneSession->zOrder_ = 101;
992 auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
993
994 ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
995 ASSERT_EQ(1, focusGroup->GetLastFocusedAppSessionId());
996
997 zOrderList.push_back(std::make_pair(100, 103));
998 ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
999 ASSERT_EQ(INVALID_SESSION_ID, focusGroup->GetLastFocusedAppSessionId());
1000 }
1001
1002 /**
1003 * @tc.name: TestIsNeedSkipWindowModeTypeCheck_01
1004 * @tc.desc: Test IsNeedSkipWindowModeTypeCheck with sceneSession nullptr
1005 * @tc.type: FUNC
1006 */
1007 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_01, TestSize.Level1)
1008 {
1009 sptr<SceneSession> sceneSession;
1010 auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1011 ASSERT_TRUE(ret);
1012 }
1013
1014 /**
1015 * @tc.name: TestIsNeedSkipWindowModeTypeCheck_02
1016 * @tc.desc: Test IsNeedSkipWindowModeTypeCheck with sceneSession not nullptr
1017 * @tc.type: FUNC
1018 */
1019 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_02, TestSize.Level1)
1020 {
1021 SessionInfo sessionInfo;
1022 sessionInfo.bundleName_ = "IsNeedSkipWindowModeTypeCheck";
1023 sessionInfo.abilityName_ = "IsNeedSkipWindowModeTypeCheck";
1024 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1025 ASSERT_NE(nullptr, sceneSession->property_);
1026 sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
1027 sceneSession->SetRSVisible(true);
1028 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1029 auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1030 ASSERT_TRUE(ret);
1031 }
1032
1033 /**
1034 * @tc.name: TestIsNeedSkipWindowModeTypeCheck_03
1035 * @tc.desc: Test IsNeedSkipWindowModeTypeCheck WindowType APP_MAIN_WINDOW_BASE
1036 * @tc.type: FUNC
1037 */
1038 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_03, TestSize.Level1)
1039 {
1040 SessionInfo sessionInfo;
1041 sessionInfo.bundleName_ = "IsNeedSkipWindowModeTypeCheck";
1042 sessionInfo.abilityName_ = "IsNeedSkipWindowModeTypeCheck";
1043 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1044 ASSERT_NE(nullptr, sceneSession->property_);
1045 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1046 sceneSession->SetRSVisible(false);
1047 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1048 auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1049 ASSERT_TRUE(ret);
1050 }
1051
1052 /**
1053 * @tc.name: TestIsNeedSkipWindowModeTypeCheck_04
1054 * @tc.desc: Test IsNeedSkipWindowModeTypeCheck WindowType APP_MAIN_WINDOW_BASE and RSVisible true
1055 * @tc.type: FUNC
1056 */
1057 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_04, TestSize.Level1)
1058 {
1059 SessionInfo sessionInfo;
1060 sessionInfo.bundleName_ = "TestIsNeedSkipWindowModeTypeCheck_04";
1061 sessionInfo.abilityName_ = "TestIsNeedSkipWindowModeTypeCheck_04";
1062 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1063 ASSERT_NE(nullptr, sceneSession);
1064 ASSERT_NE(nullptr, sceneSession->property_);
1065 sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1066 sceneSession->SetRSVisible(true);
1067 sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1068 DisplayId displayId = 1001;
1069 sceneSession->property_->SetDisplayId(displayId);
1070 auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, true);
1071 EXPECT_TRUE(ret);
1072
1073 ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1074 ASSERT_FALSE(ret);
1075 }
1076
1077 /**
1078 * @tc.name: NotifyStatusBarShowStatus
1079 * @tc.desc: test NotifyStatusBarShowStatus
1080 * @tc.type: FUNC
1081 */
1082 HWTEST_F(SceneSessionManagerTest10, NotifyStatusBarShowStatus, TestSize.Level0)
1083 {
1084 SessionInfo info;
1085 info.abilityName_ = "test";
1086 info.bundleName_ = "test";
1087 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1088 ASSERT_NE(nullptr, sceneSession);
1089
1090 ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
1091 sceneSession->isStatusBarVisible_ = true;
1092 EXPECT_EQ(WSError::WS_OK, ssm_->NotifyStatusBarShowStatus(sceneSession->GetPersistentId(), false));
1093 ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
1094 }
1095
1096 /**
1097 * @tc.name: GetStatusBarConstantlyShow
1098 * @tc.desc: test GetStatusBarConstantlyShow
1099 * @tc.type: FUNC
1100 */
1101 HWTEST_F(SceneSessionManagerTest10, GetStatusBarConstantlyShow, TestSize.Level0)
1102 {
1103 SessionInfo info;
1104 info.abilityName_ = "test";
1105 info.bundleName_ = "test";
1106 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1107 ASSERT_NE(nullptr, sceneSession);
1108 sptr<RootSceneSession> rootSceneSession = sptr<RootSceneSession>::MakeSptr();
1109 ASSERT_NE(nullptr, rootSceneSession);
1110 sceneSession->property_->SetPersistentId(1);
1111 rootSceneSession->property_->SetPersistentId(2);
1112 ssm_->rootSceneSession_ = rootSceneSession;
1113
1114 ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
1115 bool isVisible;
1116 ssm_->NotifyStatusBarConstantlyShow(sceneSession->GetSessionProperty()->GetDisplayId(), false);
1117 ssm_->GetStatusBarConstantlyShow(sceneSession->GetSessionProperty()->GetDisplayId(), isVisible);
1118 EXPECT_EQ(isVisible, false);
1119 ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
1120 }
1121
1122 /**
1123 * @tc.name: NotifyAppUseControlList
1124 * @tc.desc: NotifyAppUseControlList
1125 * @tc.type: FUNC
1126 */
1127 HWTEST_F(SceneSessionManagerTest10, NotifyAppUseControlList, TestSize.Level1)
1128 {
1129 ASSERT_NE(ssm_, nullptr);
1130 std::vector<AppUseControlInfo> controlList;
1131 controlList.emplace_back();
1132 MockAccesstokenKit::MockAccessTokenKitRet(-1);
1133 EXPECT_EQ(WSError::WS_ERROR_INVALID_PERMISSION,
1134 ssm_->NotifyAppUseControlList(ControlAppType::APP_LOCK, -1, controlList));
1135
1136 AppUseControlInfo appUseControlInfo;
1137 appUseControlInfo.bundleName_ = "bundleName";
1138 appUseControlInfo.appIndex_ = 1;
1139 appUseControlInfo.isNeedControl_ = true;
1140 EXPECT_EQ(WSError::WS_ERROR_INVALID_PERMISSION,
1141 ssm_->NotifyAppUseControlList(ControlAppType::APP_LOCK, -1, controlList));
1142 }
1143
1144 /**
1145 * @tc.name: MinimizeMainSession
1146 * @tc.desc: test MinimizeMainSession
1147 * @tc.type: FUNC
1148 */
1149 HWTEST_F(SceneSessionManagerTest10, MinimizeMainSession, TestSize.Level1)
1150 {
1151 ASSERT_NE(ssm_, nullptr);
1152 SessionInfo sessionInfo;
1153 sessionInfo.bundleName_ = "MinimizeMainSessionBundle";
1154 sessionInfo.abilityName_ = "MinimizeMainSessionAbility";
1155 sessionInfo.appIndex_ = 0;
1156 sessionInfo.windowType_ = 1;
1157 sessionInfo.sessionState_ = SessionState::STATE_ACTIVE;
1158 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1159
1160 ssm_->sceneSessionMap_.emplace(1, sceneSession);
1161 int userId = ssm_->currentUserId_.load();
1162 auto result = ssm_->MinimizeMainSession(sessionInfo.bundleName_, sessionInfo.appIndex_, userId);
1163 ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, result);
1164
1165 result = ssm_->MinimizeMainSession(sessionInfo.bundleName_, sessionInfo.appIndex_, 1);
1166 ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, result);
1167 }
1168
1169 /**
1170 * @tc.name: ListWindowInfo
1171 * @tc.desc: WM_ERROR_INVALID_PERMISSION
1172 * @tc.type: FUNC
1173 */
1174 HWTEST_F(SceneSessionManagerTest10, ListWindowInfo01, TestSize.Level1)
1175 {
1176 WindowInfoOption windowInfoOption;
1177 std::vector<sptr<WindowInfo>> infos;
1178 ASSERT_EQ(ssm_->ListWindowInfo(windowInfoOption, infos), WMError::WM_ERROR_INVALID_PERMISSION);
1179 }
1180
1181 /**
1182 * @tc.name: FilterForListWindowInfo01
1183 * @tc.desc: ALL
1184 * @tc.type: FUNC
1185 */
1186 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo01, TestSize.Level1)
1187 {
1188 ssm_->sceneSessionMap_.clear();
1189 InitTestSceneSessionForListWindowInfo();
1190 WindowInfoOption windowInfoOption;
1191 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL;
1192 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1193 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1194 windowInfoOption.windowId = 0;
1195 int32_t filterNum = 0;
1196 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1197 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1198 filterNum++;
1199 }
1200 }
1201 ASSERT_EQ(filterNum, 6);
1202 ssm_->sceneSessionMap_.clear();
1203 }
1204
1205 /**
1206 * @tc.name: FilterForListWindowInfo02
1207 * @tc.desc: EXCLUDE_SYSTEM
1208 * @tc.type: FUNC
1209 */
1210 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo02, TestSize.Level1)
1211 {
1212 ssm_->sceneSessionMap_.clear();
1213 InitTestSceneSessionForListWindowInfo();
1214 WindowInfoOption windowInfoOption;
1215 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM;
1216 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1217 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1218 windowInfoOption.windowId = 0;
1219 int32_t filterNum = 0;
1220 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1221 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1222 filterNum++;
1223 }
1224 }
1225 ASSERT_EQ(filterNum, 5);
1226 ssm_->sceneSessionMap_.clear();
1227 }
1228
1229 /**
1230 * @tc.name: FilterForListWindowInfo03
1231 * @tc.desc: VISIBLE
1232 * @tc.type: FUNC
1233 */
1234 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo03, TestSize.Level1)
1235 {
1236 ssm_->sceneSessionMap_.clear();
1237 InitTestSceneSessionForListWindowInfo();
1238 WindowInfoOption windowInfoOption;
1239 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::VISIBLE;
1240 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1241 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1242 windowInfoOption.windowId = 0;
1243 int32_t filterNum = 0;
1244 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1245 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1246 filterNum++;
1247 }
1248 }
1249 ASSERT_EQ(filterNum, 4);
1250 ssm_->sceneSessionMap_.clear();
1251 }
1252
1253 /**
1254 * @tc.name: FilterForListWindowInfo04
1255 * @tc.desc: FOREGROUND
1256 * @tc.type: FUNC
1257 */
1258 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo04, TestSize.Level1)
1259 {
1260 ssm_->sceneSessionMap_.clear();
1261 InitTestSceneSessionForListWindowInfo();
1262 WindowInfoOption windowInfoOption;
1263 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND;
1264 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1265 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1266 windowInfoOption.windowId = 0;
1267 int32_t filterNum = 0;
1268 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1269 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1270 filterNum++;
1271 }
1272 }
1273 ASSERT_EQ(filterNum, 5);
1274 ssm_->sceneSessionMap_.clear();
1275 }
1276
1277 /**
1278 * @tc.name: FilterForListWindowInfo05
1279 * @tc.desc: EXCLUDE_SYSTEM | VISIBLE
1280 * @tc.type: FUNC
1281 */
1282 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo05, TestSize.Level1)
1283 {
1284 ssm_->sceneSessionMap_.clear();
1285 InitTestSceneSessionForListWindowInfo();
1286 WindowInfoOption windowInfoOption;
1287 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM | WindowInfoFilterOption::VISIBLE;
1288 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1289 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1290 windowInfoOption.windowId = 0;
1291 int32_t filterNum = 0;
1292 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1293 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1294 filterNum++;
1295 }
1296 }
1297 ASSERT_EQ(filterNum, 3);
1298 ssm_->sceneSessionMap_.clear();
1299 }
1300
1301 /**
1302 * @tc.name: FilterForListWindowInfo06
1303 * @tc.desc: EXCLUDE_SYSTEM | FOREGROUND
1304 * @tc.type: FUNC
1305 */
1306 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo06, TestSize.Level1)
1307 {
1308 ssm_->sceneSessionMap_.clear();
1309 InitTestSceneSessionForListWindowInfo();
1310 WindowInfoOption windowInfoOption;
1311 windowInfoOption.windowInfoFilterOption =
1312 WindowInfoFilterOption::EXCLUDE_SYSTEM | WindowInfoFilterOption::FOREGROUND;
1313 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1314 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1315 windowInfoOption.windowId = 0;
1316 int32_t filterNum = 0;
1317 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1318 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1319 filterNum++;
1320 }
1321 }
1322 ASSERT_EQ(filterNum, 4);
1323 ssm_->sceneSessionMap_.clear();
1324 }
1325
1326 /**
1327 * @tc.name: FilterForListWindowInfo07
1328 * @tc.desc: FOREGROUND | VISIBLE
1329 * @tc.type: FUNC
1330 */
1331 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo07, TestSize.Level1)
1332 {
1333 ssm_->sceneSessionMap_.clear();
1334 InitTestSceneSessionForListWindowInfo();
1335 WindowInfoOption windowInfoOption;
1336 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND | WindowInfoFilterOption::VISIBLE;
1337 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1338 windowInfoOption.displayId = DISPLAY_ID_INVALID;
1339 windowInfoOption.windowId = 0;
1340 int32_t filterNum = 0;
1341 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1342 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1343 filterNum++;
1344 }
1345 }
1346 ASSERT_EQ(filterNum, 4);
1347 ssm_->sceneSessionMap_.clear();
1348 }
1349
1350 /**
1351 * @tc.name: FilterForListWindowInfo08
1352 * @tc.desc: displayId = 0
1353 * @tc.type: FUNC
1354 */
1355 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo08, TestSize.Level1)
1356 {
1357 ssm_->sceneSessionMap_.clear();
1358 InitTestSceneSessionForListWindowInfo();
1359 WindowInfoOption windowInfoOption;
1360 windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL;
1361 windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1362 windowInfoOption.displayId = 0;
1363 windowInfoOption.windowId = 0;
1364 int32_t filterNum = 0;
1365 for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1366 if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1367 filterNum++;
1368 }
1369 }
1370 ASSERT_EQ(filterNum, 5);
1371 ssm_->sceneSessionMap_.clear();
1372 }
1373
1374 /**
1375 * @tc.name: NotifyNextAvoidRectInfo
1376 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo
1377 * @tc.type: FUNC
1378 */
1379 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo, TestSize.Level0)
1380 {
1381 ASSERT_NE(ssm_, nullptr);
1382 WSRect portraitRect = { 0, 0, 1260, 123 };
1383 WSRect landspaceRect = { 0, 0, 2720, 123 };
1384 auto ret = ssm_->NotifyNextAvoidRectInfo(AvoidAreaType::TYPE_SYSTEM, portraitRect, landspaceRect, 0);
1385 ASSERT_EQ(ret, WSError::WS_OK);
1386 std::pair<WSRect, WSRect> nextSystemBarAvoidAreaRectInfo;
1387 ret = ssm_->GetNextAvoidRectInfo(0, AvoidAreaType::TYPE_SYSTEM, nextSystemBarAvoidAreaRectInfo);
1388 ASSERT_EQ(ret, WSError::WS_OK);
1389 ret = ssm_->GetNextAvoidRectInfo(0, AvoidAreaType::TYPE_NAVIGATION_INDICATOR, nextSystemBarAvoidAreaRectInfo);
1390 ASSERT_EQ(ret, WSError::WS_DO_NOTHING);
1391 }
1392
1393 /**
1394 * @tc.name: NotifyNextAvoidRectInfo_01
1395 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_01
1396 * @tc.type: FUNC
1397 */
1398 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_01, TestSize.Level0)
1399 {
1400 ASSERT_NE(ssm_, nullptr);
1401 WSRect portraitRect = { 0, 0, 1260, 123 };
1402 WSRect landspaceRect = { 0, 0, 2720, 123 };
1403 auto ret = ssm_->NotifyNextAvoidRectInfo(AvoidAreaType::TYPE_SYSTEM, portraitRect, landspaceRect, 0);
1404 ASSERT_EQ(ret, WSError::WS_OK);
1405 SessionInfo info;
1406 info.abilityName_ = "NotifyNextAvoidRectInfo";
1407 info.bundleName_ = "NotifyNextAvoidRectInfo";
1408 info.screenId_ = 0;
1409 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1410 specificCb->onGetNextAvoidAreaRectInfo_ =
__anon87ae71e70202(DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) 1411 [](DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) {
1412 return ssm_->GetNextAvoidRectInfo(displayId, type, nextSystemBarAvoidAreaRectInfo);
1413 };
1414 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1415 sceneSession->property_->SetPersistentId(1);
1416 sceneSession->GetLayoutController()->SetSessionRect({ 0, 0, 1260, 2720 });
1417 ssm_->sceneSessionMap_.insert({ 1, sceneSession });
1418 std::pair<WSRect, WSRect> nextSystemBarAvoidAreaRectInfo;
1419 ret = sceneSession->specificCallback_->onGetNextAvoidAreaRectInfo_(
1420 0, AvoidAreaType::TYPE_SYSTEM, nextSystemBarAvoidAreaRectInfo);
1421 ASSERT_EQ(ret, WSError::WS_OK);
1422 ASSERT_EQ(nextSystemBarAvoidAreaRectInfo.first, portraitRect);
1423 ASSERT_EQ(nextSystemBarAvoidAreaRectInfo.second, landspaceRect);
1424 ssm_->sceneSessionMap_.clear();
1425 }
1426
1427 /**
1428 * @tc.name: NotifyNextAvoidRectInfo_statusBar
1429 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_statusBar
1430 * @tc.type: FUNC
1431 */
1432 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_statusBar, TestSize.Level0)
1433 {
1434 ASSERT_NE(ssm_, nullptr);
1435 WSRect portraitRect = { 0, 0, 1260, 123 };
1436 WSRect landspaceRect = { 0, 0, 2720, 123 };
1437 auto ret = ssm_->NotifyNextAvoidRectInfo(AvoidAreaType::TYPE_SYSTEM, portraitRect, landspaceRect, 0);
1438 ASSERT_EQ(ret, WSError::WS_OK);
1439 SessionInfo info;
1440 info.abilityName_ = "NotifyNextAvoidRectInfo_statusBar";
1441 info.bundleName_ = "NotifyNextAvoidRectInfo_statusBar";
1442 info.screenId_ = 0;
1443 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1444 specificCb->onGetNextAvoidAreaRectInfo_ =
__anon87ae71e70302(DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) 1445 [](DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) {
1446 return ssm_->GetNextAvoidRectInfo(displayId, type, nextSystemBarAvoidAreaRectInfo);
1447 };
1448 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1449 sceneSession->property_->SetPersistentId(1);
1450 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1451 sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
1452 sceneSession->GetLayoutController()->SetSessionRect({ 0, 0, 1260, 2720 });
1453 ssm_->sceneSessionMap_.insert({ 1, sceneSession });
1454 std::map<WindowType, SystemBarProperty> properties;
1455 properties[WindowType::WINDOW_TYPE_STATUS_BAR] = SystemBarProperty();
1456 properties[WindowType::WINDOW_TYPE_STATUS_BAR].settingFlag_ = SystemBarSettingFlag::ENABLE_SETTING;
1457 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR] = SystemBarProperty();
1458 std::map<AvoidAreaType, AvoidArea> avoidAreas;
1459 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_0, { 0, 0, 1260, 2720 }, properties, avoidAreas);
1460 Rect rect = { 0, 0, 1260, 123 };
1461 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_SYSTEM].topRect_, rect);
1462 properties[WindowType::WINDOW_TYPE_STATUS_BAR].enable_ = false;
1463 rect = { 0, 0, 0, 0 };
1464 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_0, { 0, 0, 1260, 123 }, properties, avoidAreas);
1465 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_SYSTEM].topRect_, rect);
1466 ssm_->sceneSessionMap_.clear();
1467 }
1468
1469 /**
1470 * @tc.name: NotifyNextAvoidRectInfo_statusBar_01
1471 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_statusBar_01
1472 * @tc.type: FUNC
1473 */
1474 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_statusBar_01, TestSize.Level0)
1475 {
1476 ASSERT_NE(ssm_, nullptr);
1477 WSRect portraitRect = { 0, 0, 1260, 123 };
1478 WSRect landspaceRect = { 0, 0, 2720, 123 };
1479 auto ret = ssm_->NotifyNextAvoidRectInfo(AvoidAreaType::TYPE_SYSTEM, portraitRect, landspaceRect, 0);
1480 ASSERT_EQ(ret, WSError::WS_OK);
1481 SessionInfo info;
1482 info.abilityName_ = "NotifyNextAvoidRectInfo_statusBar_01";
1483 info.bundleName_ = "NotifyNextAvoidRectInfo_statusBar_01";
1484 info.screenId_ = 0;
1485 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1486 specificCb->onGetNextAvoidAreaRectInfo_ =
__anon87ae71e70402(DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) 1487 [](DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) {
1488 return ssm_->GetNextAvoidRectInfo(displayId, type, nextSystemBarAvoidAreaRectInfo);
1489 };
1490 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1491 sceneSession->property_->SetPersistentId(1);
1492 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1493 sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
1494 sceneSession->GetLayoutController()->SetSessionRect({ 0, 0, 1260, 2720 });
1495 ssm_->sceneSessionMap_.insert({ 1, sceneSession });
1496 std::map<WindowType, SystemBarProperty> properties;
1497 properties[WindowType::WINDOW_TYPE_STATUS_BAR] = SystemBarProperty();
1498 properties[WindowType::WINDOW_TYPE_STATUS_BAR].settingFlag_ = SystemBarSettingFlag::ENABLE_SETTING;
1499 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR] = SystemBarProperty();
1500 std::map<AvoidAreaType, AvoidArea> avoidAreas;
1501 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_90, { 0, 0, 2720, 1260 }, properties, avoidAreas);
1502 Rect rect = { 0, 0, 2720, 123 };
1503 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_SYSTEM].topRect_, rect);
1504 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR].enable_ = false;
1505 rect = { 0, 0, 0, 0 };
1506 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_90, { 0, 0, 2720, 1260 }, properties, avoidAreas);
1507 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].bottomRect_, rect);
1508 ssm_->sceneSessionMap_.clear();
1509 }
1510
1511 /**
1512 * @tc.name: NotifyNextAvoidRectInfo_keyboard
1513 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_keyboard
1514 * @tc.type: FUNC
1515 */
1516 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_keyboard, TestSize.Level0)
1517 {
1518 SessionInfo info;
1519 info.abilityName_ = "NotifyNextAvoidRectInfo_keyboard";
1520 info.bundleName_ = "NotifyNextAvoidRectInfo_keyboard";
1521 info.screenId_ = 0;
1522 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1523 specificCb->onKeyboardRotationChange_ =
__anon87ae71e70502(int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas) 1524 [](int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas) {
1525 ssm_->GetKeyboardOccupiedAreaWithRotation(persistentId, rotation, avoidAreas);
1526 };
1527 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1528 sceneSession->property_->SetPersistentId(1);
1529 ssm_->sceneSessionMap_.insert({ 1, sceneSession });
1530 AvoidArea avoidArea;
1531 sceneSession->GetKeyboardAvoidAreaByRotation(Rotation::ROTATION_0, { 0, 0, 1260, 2720 }, avoidArea);
1532 Rect rect = { 0, 0, 0, 0 };
1533 ASSERT_EQ(avoidArea.bottomRect_, rect);
1534 ssm_->sceneSessionMap_.clear();
1535 }
1536
1537 /**
1538 * @tc.name: NotifyNextAvoidRectInfo_keyboard_01
1539 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_keyboard_01
1540 * @tc.type: FUNC
1541 */
1542 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_keyboard_01, TestSize.Level0)
1543 {
1544 SessionInfo info;
1545 info.abilityName_ = "NotifyNextAvoidRectInfo_keyboard_01";
1546 info.bundleName_ = "NotifyNextAvoidRectInfo_keyboard_01";
1547 info.screenId_ = 0;
1548 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1549 specificCb->onKeyboardRotationChange_ =
__anon87ae71e70602(int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas) 1550 [](int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas) {
1551 ssm_->GetKeyboardOccupiedAreaWithRotation(persistentId, rotation, avoidAreas);
1552 };
1553 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1554 sceneSession->property_->SetPersistentId(1);
1555 SessionInfo keyboardSessionInfo;
1556 keyboardSessionInfo.abilityName_ = "keyboard";
1557 keyboardSessionInfo.bundleName_ = "keyboard";
1558 keyboardSessionInfo.screenId_ = 0;
1559 sptr<SceneSession> keyboardSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1560 keyboardSession->state_ = SessionState::STATE_FOREGROUND;
1561 keyboardSession->property_->type_ = WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT;
1562 keyboardSession->property_->keyboardLayoutParams_.PortraitPanelRect_ = { 0, 1700, 1260, 1020 };
1563 keyboardSession->property_->keyboardLayoutParams_.LandscapePanelRect_ = { 0, 538, 2720, 722 };
1564 keyboardSession->property_->SetPersistentId(2);
1565 ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
1566 ssm_->sceneSessionMap_.insert({ keyboardSession->GetPersistentId(), keyboardSession });
1567 auto uiType = ssm_->systemConfig_.windowUIType_;
1568 ssm_->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1569 AvoidArea avoidArea;
1570 sceneSession->GetKeyboardAvoidAreaByRotation(Rotation::ROTATION_0, { 0, 0, 1260, 2720 }, avoidArea);
1571 Rect rect = { 0, 1700, 1260, 1020 };
1572 ASSERT_EQ(avoidArea.bottomRect_, rect);
1573 sceneSession->GetKeyboardAvoidAreaByRotation(Rotation::ROTATION_90, { 0, 0, 2720, 1260 }, avoidArea);
1574 rect = { 0, 538, 2720, 722 };
1575 ASSERT_EQ(avoidArea.bottomRect_, rect);
1576 keyboardSession->state_ = SessionState::STATE_BACKGROUND;
1577 rect = { 0, 0, 0, 0 };
1578 avoidArea.bottomRect_ = rect;
1579 sceneSession->GetKeyboardAvoidAreaByRotation(Rotation::ROTATION_180, { 0, 0, 1260, 2720 }, avoidArea);
1580 ASSERT_EQ(avoidArea.bottomRect_, rect);
1581 ssm_->systemConfig_.windowUIType_ = uiType;
1582 ssm_->sceneSessionMap_.clear();
1583 }
1584
1585 /**
1586 * @tc.name: NotifyNextAvoidRectInfo_AIBar
1587 * @tc.desc: SceneSesionManager test NotifyNextAvoidRectInfo_AIBar
1588 * @tc.type: FUNC
1589 */
1590 HWTEST_F(SceneSessionManagerTest10, NotifyNextAvoidRectInfo_AIBar, TestSize.Level0)
1591 {
1592 ASSERT_NE(ssm_, nullptr);
1593 WSRect portraitRect = { 409, 2629, 442, 91 };
1594 WSRect landspaceRect = { 884, 1169, 952, 91 };
1595 auto ret = ssm_->NotifyNextAvoidRectInfo(AvoidAreaType::TYPE_NAVIGATION_INDICATOR, portraitRect, landspaceRect, 0);
1596 ASSERT_EQ(ret, WSError::WS_OK);
1597 SessionInfo info;
1598 info.abilityName_ = "NotifyNextAvoidRectInfo_AIBar";
1599 info.bundleName_ = "NotifyNextAvoidRectInfo_AIBar";
1600 info.screenId_ = 0;
1601 auto specificCb = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1602 specificCb->onGetNextAvoidAreaRectInfo_ =
__anon87ae71e70702(DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) 1603 [](DisplayId displayId, AvoidAreaType type, std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo) {
1604 return ssm_->GetNextAvoidRectInfo(displayId, type, nextSystemBarAvoidAreaRectInfo);
1605 };
1606 sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCb);
1607 sceneSession->property_->SetPersistentId(1);
1608 sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1609 sceneSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
1610 sceneSession->GetLayoutController()->SetSessionRect({ 0, 0, 1260, 2720 });
1611 ssm_->sceneSessionMap_.insert({ 1, sceneSession });
1612 std::map<WindowType, SystemBarProperty> properties;
1613 properties[WindowType::WINDOW_TYPE_STATUS_BAR] = SystemBarProperty();
1614 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR] = SystemBarProperty();
1615 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR].settingFlag_ = SystemBarSettingFlag::ENABLE_SETTING;
1616 std::map<AvoidAreaType, AvoidArea> avoidAreas;
1617 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_0, { 0, 0, 1260, 2720 }, properties, avoidAreas);
1618 Rect rect = { 409, 2629, 442, 91 };
1619 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].bottomRect_, rect);
1620 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_90, { 0, 0, 2720, 1260 }, properties, avoidAreas);
1621 rect = { 884, 1169, 952, 91 };
1622 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].bottomRect_, rect);
1623 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_180, { 0, 0, 1260, 2720 }, properties, avoidAreas);
1624 rect = { 409, 2629, 442, 91 };
1625 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].bottomRect_, rect);
1626 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_270, { 0, 0, 2720, 1260 }, properties, avoidAreas);
1627 rect = { 884, 1169, 952, 91 };
1628 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].bottomRect_, rect);
1629 properties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR].enable_ = false;
1630 rect = { 0, 0, 0, 0 };
1631 sceneSession->GetAvoidAreasByRotation(Rotation::ROTATION_0, { 0, 0, 2720, 1260 }, properties, avoidAreas);
1632 ASSERT_EQ(avoidAreas[AvoidAreaType::TYPE_NAVIGATION_INDICATOR].topRect_, rect);
1633 ssm_->sceneSessionMap_.clear();
1634 }
1635
1636 /**
1637 * @tc.name: NotifyWindowSystemBarPropertyChange
1638 * @tc.desc: SceneSesionManager test NotifyWindowSystemBarPropertyChange
1639 * @tc.type: FUNC
1640 */
1641 HWTEST_F(SceneSessionManagerTest10, NotifyWindowSystemBarPropertyChange, TestSize.Level0)
1642 {
1643 EXPECT_NE(ssm_, nullptr);
1644 SystemBarProperty systemBarProperty;
1645 ssm_->NotifyWindowSystemBarPropertyChange(WindowType::WINDOW_TYPE_STATUS_BAR, systemBarProperty);
1646 EXPECT_EQ(ssm_->lastSystemBarPropertyMap_[WindowType::WINDOW_TYPE_STATUS_BAR], systemBarProperty);
1647 ssm_->NotifyWindowSystemBarPropertyChange(WindowType::WINDOW_TYPE_STATUS_BAR, systemBarProperty);
1648 EXPECT_EQ(ssm_->lastSystemBarPropertyMap_[WindowType::WINDOW_TYPE_STATUS_BAR], systemBarProperty);
1649 }
1650
1651 /**
1652 * @tc.name: RefreshAllAppUseControlMap
1653 * @tc.desc: RefreshAllAppUseControlMap
1654 * @tc.type: FUNC
1655 */
1656 HWTEST_F(SceneSessionManagerTest10, RefreshAllAppUseControlMap, TestSize.Level1)
1657 {
1658 ASSERT_NE(ssm_, nullptr);
1659 AppUseControlInfo appUseControlInfo;
1660 appUseControlInfo.bundleName_ = "app_bundle_name";
1661 ssm_->RefreshAllAppUseControlMap(appUseControlInfo, ControlAppType::APP_LOCK);
1662
1663 appUseControlInfo.isNeedControl_ = true;
1664 ssm_->RefreshAllAppUseControlMap(appUseControlInfo, ControlAppType::APP_LOCK);
1665 EXPECT_EQ(1, ssm_->allAppUseControlMap_.size());
1666
1667 appUseControlInfo.isNeedControl_ = false;
1668 ssm_->RefreshAllAppUseControlMap(appUseControlInfo, ControlAppType::APP_LOCK);
1669 EXPECT_EQ(0, ssm_->allAppUseControlMap_.size());
1670
1671 appUseControlInfo.isNeedControl_ = false;
1672 appUseControlInfo.isControlRecentOnly_ = true;
1673 appUseControlInfo.isControlRecentOnly_ = false;
1674 ssm_->RefreshAllAppUseControlMap(appUseControlInfo, ControlAppType::APP_LOCK);
1675 ssm_->RefreshAllAppUseControlMap(appUseControlInfo, ControlAppType::PARENT_CONTROL);
1676 EXPECT_EQ(0, ssm_->allAppUseControlMap_.size());
1677 }
1678 } // namespace
1679 } // namespace Rosen
1680 } // namespace OHOS