• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <regex>
18 #include <bundle_mgr_interface.h>
19 #include <bundlemgr/launcher_service.h>
20 #include "interfaces/include/ws_common.h"
21 #include "libxml/parser.h"
22 #include "libxml/tree.h"
23 #include "session_manager/include/scene_session_manager.h"
24 #include "session_info.h"
25 #include "session/host/include/scene_session.h"
26 #include "session/host/include/main_session.h"
27 #include "window_manager_agent.h"
28 #include "session_manager.h"
29 #include "zidl/window_manager_agent_interface.h"
30 #include "mock/mock_session_stage.h"
31 #include "mock/mock_window_event_channel.h"
32 #include "context.h"
33 
34 using namespace testing;
35 using namespace testing::ext;
36 
37 namespace OHOS {
38 namespace Rosen {
39 namespace {
40     const std::string EMPTY_DEVICE_ID = "";
41     using ConfigItem = WindowSceneConfig::ConfigItem;
ReadConfig(const std::string & xmlStr)42     ConfigItem ReadConfig(const std::string& xmlStr)
43     {
44         ConfigItem config;
45         xmlDocPtr docPtr = xmlParseMemory(xmlStr.c_str(), xmlStr.length() + 1);
46         if (docPtr == nullptr) {
47             return config;
48         }
49 
50         xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
51         if (rootPtr == nullptr || rootPtr->name == nullptr ||
52             xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
53             xmlFreeDoc(docPtr);
54             return config;
55         }
56 
57         std::map<std::string, ConfigItem> configMap;
58         config.SetValue(configMap);
59         WindowSceneConfig::ReadConfig(rootPtr, *config.mapValue_);
60         xmlFreeDoc(docPtr);
61         return config;
62     }
63 }
64 class SceneSessionManagerTest3 : public testing::Test {
65 public:
66     static void SetUpTestCase();
67     static void TearDownTestCase();
68     void SetUp() override;
69     void TearDown() override;
70 
71     static bool gestureNavigationEnabled_;
72     static ProcessGestureNavigationEnabledChangeFunc callbackFunc_;
73     static sptr<SceneSessionManager> ssm_;
74 private:
75     static constexpr uint32_t WAIT_SYNC_IN_NS = 50000;
76 };
77 
78 sptr<SceneSessionManager> SceneSessionManagerTest3::ssm_ = nullptr;
79 
80 bool SceneSessionManagerTest3::gestureNavigationEnabled_ = true;
81 ProcessGestureNavigationEnabledChangeFunc SceneSessionManagerTest3::callbackFunc_ = [](bool enable,
__anonc10c36570202(bool enable, const std::string& bundleName, GestureBackType type) 82     const std::string& bundleName, GestureBackType type) {
83     gestureNavigationEnabled_ = enable;
84 };
85 
WindowChangedFuncTest(int32_t persistentId,WindowUpdateType type)86 void WindowChangedFuncTest(int32_t persistentId, WindowUpdateType type)
87 {
88 }
89 
ProcessStatusBarEnabledChangeFuncTest(bool enable,const std::string & bundleName)90 void ProcessStatusBarEnabledChangeFuncTest(bool enable, const std::string& bundleName)
91 {
92 }
93 
DumpRootSceneElementInfoFuncTest(const std::vector<std::string> & params,std::vector<std::string> & infos)94 void DumpRootSceneElementInfoFuncTest(const std::vector<std::string>& params, std::vector<std::string>& infos)
95 {
96 }
97 
SetUpTestCase()98 void SceneSessionManagerTest3::SetUpTestCase()
99 {
100     ssm_ = &SceneSessionManager::GetInstance();
101 }
102 
TearDownTestCase()103 void SceneSessionManagerTest3::TearDownTestCase()
104 {
105     ssm_ = nullptr;
106     usleep(WAIT_SYNC_IN_NS);
107 }
108 
SetUp()109 void SceneSessionManagerTest3::SetUp()
110 {
111     ssm_->sceneSessionMap_.clear();
112 }
113 
TearDown()114 void SceneSessionManagerTest3::TearDown()
115 {
116     ssm_->sceneSessionMap_.clear();
117     usleep(WAIT_SYNC_IN_NS);
118 }
119 
120 namespace {
121 /**
122  * @tc.name: ConfigDecor
123  * @tc.desc: SceneSesionManager config decor
124  * @tc.type: FUNC
125  */
126 HWTEST_F(SceneSessionManagerTest3, ConfigDecor, Function | SmallTest | Level3)
127 {
128     WindowSceneConfig::ConfigItem* item = new (std::nothrow) WindowSceneConfig::ConfigItem;
129     ASSERT_NE(nullptr, item);
130     int ret = 0;
131     ssm_->ConfigDecor(*item);
132     ASSERT_EQ(ret, 0);
133     delete item;
134 }
135 
136 /**
137  * @tc.name: ConfigWindowEffect
138  * @tc.desc: SceneSesionManager config window effect
139  * @tc.type: FUNC
140  */
141 HWTEST_F(SceneSessionManagerTest3, ConfigWindowEffect, Function | SmallTest | Level3)
142 {
143     WindowSceneConfig::ConfigItem* item = new (std::nothrow) WindowSceneConfig::ConfigItem;
144     ASSERT_NE(nullptr, item);
145     int ret = 0;
146     ssm_->ConfigWindowEffect(*item);
147     ASSERT_EQ(ret, 0);
148     delete item;
149 }
150 
151 /**
152  * @tc.name: ConfigAppWindowCornerRadius
153  * @tc.desc: SceneSesionManager config app window coener radius
154  * @tc.type: FUNC
155  */
156 HWTEST_F(SceneSessionManagerTest3, ConfigAppWindowCornerRadius, Function | SmallTest | Level3)
157 {
158     float out = 0.0f;
159     WindowSceneConfig::ConfigItem item01;
160     std::string str = "defaultCornerRadiusM";
161     item01.SetValue(str);
162     bool result01 = ssm_->ConfigAppWindowCornerRadius(item01, out);
163     ASSERT_EQ(result01, true);
164 
165     WindowSceneConfig::ConfigItem item02;
166     item02.SetValue(new string("defaultCornerRadiusS"));
167     bool result02 = ssm_->ConfigAppWindowCornerRadius(item02, out);
168     ASSERT_EQ(result02, false);
169     ASSERT_EQ(out, 12.0f);
170 }
171 
172 /**
173  * @tc.name: ConfigAppWindowShadow
174  * @tc.desc: SceneSesionManager config app window shadow
175  * @tc.type: FUNC
176  */
177 HWTEST_F(SceneSessionManagerTest3, ConfigAppWindowShadow, Function | SmallTest | Level3)
178 {
179     WindowSceneConfig::ConfigItem item;
180     WindowSceneConfig::ConfigItem shadowConfig;
181     WindowShadowConfig outShadow;
182     std::vector<float> floatTest = {0.0f, 0.1f, 0.2f, 0.3f};
183     bool result01 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
184     ASSERT_EQ(result01, true);
185 
186     item.SetValue(floatTest);
187     shadowConfig.SetValue({{"radius", item}});
188     bool result02 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
189     ASSERT_EQ(result02, false);
190     shadowConfig.SetValue({{"alpha", item}});
191     bool result03 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
192     ASSERT_EQ(result03, false);
193     shadowConfig.SetValue({{"sffsetY", item}});
194     bool result04 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
195     ASSERT_EQ(result04, true);
196     shadowConfig.SetValue({{"sffsetX", item}});
197     bool result05 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
198     ASSERT_EQ(result05, true);
199 
200     item.SetValue(new std::string("color"));
201     shadowConfig.SetValue({{"color", item}});
202     bool result06 = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
203     ASSERT_EQ(result06, true);
204 }
205 
206 /**
207  * @tc.name: ConfigStatusBar
208  * @tc.desc: ConfigStatusBar config window immersive status bar
209  * @tc.type: FUNC
210  */
211 HWTEST_F(SceneSessionManagerTest3, ConfigStatusBar, Function | SmallTest | Level3)
212 {
213     StatusBarConfig out;
214     WindowSceneConfig::ConfigItem enable;
215     enable.SetValue(true);
216     WindowSceneConfig::ConfigItem showHide;
217     showHide.SetProperty({{"enable", enable}});
218     WindowSceneConfig::ConfigItem item01;
219     WindowSceneConfig::ConfigItem contentColor;
220     contentColor.SetValue(std::string("#12345678"));
221     WindowSceneConfig::ConfigItem backgroundColor;
222     backgroundColor.SetValue(std::string("#12345678"));
223     item01.SetValue({{"showHide", showHide}, {"contentColor", contentColor}, {"backgroundColor", backgroundColor}});
224     bool result01 = ssm_->ConfigStatusBar(item01, out);
225     ASSERT_EQ(result01, true);
226     ASSERT_EQ(out.showHide_, true);
227     ASSERT_EQ(out.contentColor_, "#12345678");
228     ASSERT_EQ(out.backgroundColor_, "#12345678");
229 }
230 
231 /**
232  * @tc.name: ConfigKeyboardAnimation
233  * @tc.desc: SceneSesionManager config keyboard animation
234  * @tc.type: FUNC
235  */
236 HWTEST_F(SceneSessionManagerTest3, ConfigWindowImmersive, Function | SmallTest | Level3)
237 {
238     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
239         "<Configs>"
240             "<immersive>"
241                 "<inDesktopStatusBarConfig>"
242                     "<showHide enable=\"true\"/>"
243                     "<backgroundColor>#12341234</backgroundColor>"
244                     "<contentColor>#12341234</contentColor>"
245                 "</inDesktopStatusBarConfig>"
246                 "<inSplitStatusBarConfig>"
247                     "<upDownSplit>"
248                         "<showHide enable=\"true\"/>"
249                         "<backgroundColor>#12341234</backgroundColor>"
250                         "<contentColor>#12341234</contentColor>"
251                     "</upDownSplit>"
252                     "<leftRightSplit>"
253                         "<showHide enable=\"true\"/>"
254                         "<backgroundColor>#12341234</backgroundColor>"
255                         "<contentColor>#12341234</contentColor>"
256                     "</leftRightSplit>"
257                 "</inSplitStatusBarConfig>"
258             "</immersive>"
259         "</Configs>";
260     WindowSceneConfig::config_ = ReadConfig(xmlStr);
261     ssm_->ConfigWindowSceneXml();
262     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.desktopStatusBarConfig_.showHide_, true);
263     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.desktopStatusBarConfig_.backgroundColor_, "#12341234");
264     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.desktopStatusBarConfig_.contentColor_, "#12341234");
265     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.upDownStatusBarConfig_.showHide_, true);
266     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.upDownStatusBarConfig_.backgroundColor_, "#12341234");
267     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.upDownStatusBarConfig_.contentColor_, "#12341234");
268     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.leftRightStatusBarConfig_.showHide_, true);
269     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.leftRightStatusBarConfig_.backgroundColor_, "#12341234");
270     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowImmersive_.leftRightStatusBarConfig_.contentColor_, "#12341234");
271 }
272 
273 /**
274  * @tc.name: ConfigWindowAnimation
275  * @tc.desc: SceneSesionManager config window animation
276  * @tc.type: FUNC
277  */
278 HWTEST_F(SceneSessionManagerTest3, ConfigWindowAnimation, Function | SmallTest | Level3)
279 {
280     WindowSceneConfig::ConfigItem windowAnimationConfig;
281     WindowSceneConfig::ConfigItem item;
282     std::vector<float> opacity = {0.1f};
283     std::vector<float> translate = {0.1f, 0.2f};
284     std::vector<float> rotation = {0.1f, 0.2f, 0.3f, 0.4f};
285     std::vector<float> scale = {0.1f, 0.2f};
286     std::vector<int> duration = {39};
287 
288     item.SetValue(opacity);
289     windowAnimationConfig.SetValue({{"opacity", item}});
290     int ret = 0;
291     ssm_->ConfigWindowAnimation(windowAnimationConfig);
292     ASSERT_EQ(ret, 0);
293 
294     item.SetValue(rotation);
295     windowAnimationConfig.SetValue({{"rotation", item}});
296     ssm_->ConfigWindowAnimation(windowAnimationConfig);
297     ASSERT_EQ(ret, 0);
298 
299     item.SetValue(translate);
300     windowAnimationConfig.SetValue({{"translate", item}});
301     ssm_->ConfigWindowAnimation(windowAnimationConfig);
302     ASSERT_EQ(ret, 0);
303 
304     item.SetValue(scale);
305     windowAnimationConfig.SetValue({{"scale", item}});
306     ssm_->ConfigWindowAnimation(windowAnimationConfig);
307     ASSERT_EQ(ret, 0);
308 
309     item.SetValue(duration);
310     item.SetValue({{"duration", item}});
311     windowAnimationConfig.SetValue({{"timing", item}});
312     ssm_->ConfigWindowAnimation(windowAnimationConfig);
313     ASSERT_EQ(ret, 0);
314 
315     item.SetValue(duration);
316     item.SetValue({{"curve", item}});
317     windowAnimationConfig.SetValue({{"timing", item}});
318     ssm_->ConfigWindowAnimation(windowAnimationConfig);
319     ASSERT_EQ(ret, 0);
320 }
321 
322 /**
323  * @tc.name: RecoverAndReconnectSceneSession
324  * @tc.desc: check func RecoverAndReconnectSceneSession
325  * @tc.type: FUNC
326  */
327 HWTEST_F(SceneSessionManagerTest3, RecoverAndReconnectSceneSession, Function | SmallTest | Level2)
328 {
329     sptr<ISession> session;
330     auto result = ssm_->RecoverAndReconnectSceneSession(nullptr, nullptr, nullptr, session, nullptr, nullptr);
331     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
332 
333     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
334     ASSERT_NE(nullptr, property);
335     std::vector<int32_t> recoveredPersistentIds = { 0, 1, 2 };
336     ssm_->SetAlivePersistentIds(recoveredPersistentIds);
337     property->SetPersistentId(1);
338     result = ssm_->RecoverAndReconnectSceneSession(nullptr, nullptr, nullptr, session, property, nullptr);
339     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
340 }
341 
342 /**
343  * @tc.name: ConfigStartingWindowAnimation
344  * @tc.desc: SceneSesionManager config start window animation
345  * @tc.type: FUNC
346  */
347 HWTEST_F(SceneSessionManagerTest3, ConfigStartingWindowAnimation, Function | SmallTest | Level3)
348 {
349     std::vector<float> midFloat = {0.1f};
350     std::vector<int> midInt = {1};
351     WindowSceneConfig::ConfigItem middleFloat;
352     middleFloat.SetValue(midFloat);
353     WindowSceneConfig::ConfigItem middleInt;
354     middleInt.SetValue(midInt);
355     WindowSceneConfig::ConfigItem curve;
356     curve.SetValue(midFloat);
357     curve.SetValue({{"curve", curve}});
358     WindowSceneConfig::ConfigItem enableConfigItem;
359     enableConfigItem.SetValue(false);
360     std::map<std::string, WindowSceneConfig::ConfigItem> midMap = {{"duration", middleInt}, {"curve", curve}};
361     WindowSceneConfig::ConfigItem timing;
362     timing.SetValue(midMap);
363     std::map<std::string, WindowSceneConfig::ConfigItem> middleMap = {{"enable", enableConfigItem},
364         {"timing", timing}, {"opacityStart", middleFloat}, {"opacityEnd", middleFloat}};
365     WindowSceneConfig::ConfigItem configItem;
366     configItem.SetValue(middleMap);
367     int ret = 0;
368     ssm_->ConfigStartingWindowAnimation(configItem);
369     ASSERT_EQ(ret, 0);
370     midMap.clear();
371     middleMap.clear();
372 }
373 
374 /**
375  * @tc.name: CreateCurve
376  * @tc.desc: SceneSesionManager create curve
377  * @tc.type: FUNC
378  */
379 HWTEST_F(SceneSessionManagerTest3, CreateCurve, Function | SmallTest | Level3)
380 {
381     WindowSceneConfig::ConfigItem curveConfig;
382     std::string result01 = std::get<std::string>(ssm_->CreateCurve(curveConfig));
383     ASSERT_EQ(result01, "easeOut");
384 
385     std::string value02 = "userName";
386     curveConfig.SetValue(value02);
387     curveConfig.SetValue({{"name", curveConfig}});
388     std::string result02 = std::get<std::string>(ssm_->CreateCurve(curveConfig));
389     ASSERT_EQ(result02, "easeOut");
390 
391     std::string value03 = "interactiveSpring";
392     curveConfig.SetValue(value03);
393     curveConfig.SetValue({{"name", curveConfig}});
394     std::string result03 = std::get<std::string>(ssm_->CreateCurve(curveConfig));
395     ASSERT_EQ(result03, "easeOut");
396 
397     std::string value04 = "cubic";
398     curveConfig.SetValue(value04);
399     curveConfig.SetValue({{"name", curveConfig}});
400     std::string result04 = std::get<std::string>(ssm_->CreateCurve(curveConfig));
401     ASSERT_EQ(result04, "easeOut");
402 }
403 
404 /**
405  * @tc.name: SetRootSceneContext
406  * @tc.desc: SceneSesionManager set root scene context
407  * @tc.type: FUNC
408  */
409 HWTEST_F(SceneSessionManagerTest3, SetRootSceneContext, Function | SmallTest | Level3)
410 {
411     int ret = 0;
412     std::weak_ptr<AbilityRuntime::Context> contextWeakPtr;
413     ssm_->SetRootSceneContext(contextWeakPtr);
414     ASSERT_EQ(ret, 0);
415 }
416 
417 /**
418  * @tc.name: GetRootSceneSession
419  * @tc.desc: SceneSesionManager get root scene session
420  * @tc.type: FUNC
421  */
422 HWTEST_F(SceneSessionManagerTest3, GetRootSceneSession, Function | SmallTest | Level3)
423 {
424     int ret = 0;
425     ssm_->GetRootSceneSession();
426     ssm_->GetRootSceneSession();
427     ASSERT_EQ(ret, 0);
428 }
429 
430 /**
431  * @tc.name: GetSceneSession
432  * @tc.desc: SceneSesionManager get scene session
433  * @tc.type: FUNC
434  */
435 HWTEST_F(SceneSessionManagerTest3, GetSceneSession, Function | SmallTest | Level3)
436 {
437     int32_t persistentId = 65535;
438     ASSERT_EQ(ssm_->GetSceneSession(persistentId), nullptr);
439 }
440 
441 /**
442  * @tc.name: GetSceneSession002
443  * @tc.desc: SceneSesionManager get scene session
444  * @tc.type: FUNC
445  */
446 HWTEST_F(SceneSessionManagerTest3, GetSceneSession002, Function | SmallTest | Level3)
447 {
448     SessionInfo info;
449     info.abilityName_ = "test1";
450     info.bundleName_ = "test2";
451     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
452     if (sceneSession == nullptr) {
453         return;
454     }
455     ssm_->sceneSessionMap_.insert({65535, sceneSession});
456     int32_t persistentId = 65535;
457     ASSERT_NE(ssm_->GetSceneSession(persistentId), nullptr);
458 }
459 
460 /**
461  * @tc.name: GetSceneSessionByIdentityInfo
462  * @tc.desc: SceneSesionManager get scene session by name
463  * @tc.type: FUNC
464  */
465 HWTEST_F(SceneSessionManagerTest3, GetSceneSessionByIdentityInfo, Function | SmallTest | Level3)
466 {
467     SessionInfo info;
468     info.abilityName_ = "test1";
469     info.bundleName_ = "test2";
470     info.moduleName_ = "test3";
471     info.appIndex_ = 10;
472     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
473     if (sceneSession == nullptr) {
474         return;
475     }
476     std::string bundleName1 = "test1";
477     std::string moduleName1 = "test2";
478     std::string abilityName1 = "test3";
479     int32_t appIndex1 = 10;
480     SessionIdentityInfo identityInfo = { bundleName1, moduleName1, abilityName1, appIndex1 };
481     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
482     ssm_->sceneSessionMap_.insert({1, sceneSession});
483     std::string bundleName2 = "test11";
484     std::string moduleName2 = "test22";
485     std::string abilityName2 = "test33";
486     int32_t appIndex2 = 100;
487     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
488     identityInfo = { bundleName1, moduleName2, abilityName2, appIndex2 };
489     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
490     identityInfo = { bundleName2, moduleName1, abilityName2, appIndex2 };
491     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
492     identityInfo = { bundleName2, moduleName2, abilityName1, appIndex2 };
493     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
494     identityInfo = { bundleName2, moduleName2, abilityName2, appIndex1 };
495     ASSERT_EQ(ssm_->GetSceneSessionByIdentityInfo(identityInfo), nullptr);
496     ssm_->sceneSessionMap_.erase(1);
497 }
498 
499 /**
500  * @tc.name: GetSceneSessionVectorByTypeAndDisplayId
501  * @tc.desc: SceneSesionManager get scene session vector by type
502  * @tc.type: FUNC
503  */
504 HWTEST_F(SceneSessionManagerTest3, GetSceneSessionVectorByTypeAndDisplayId, Function | SmallTest | Level3)
505 {
506     int ret = 0;
507     uint64_t displayId = -1ULL;
508     ssm_->GetSceneSessionVectorByTypeAndDisplayId(WindowType::APP_MAIN_WINDOW_BASE, displayId);
509     displayId = 1;
510     ssm_->GetSceneSessionVectorByTypeAndDisplayId(WindowType::APP_MAIN_WINDOW_BASE, displayId);
511     SessionInfo info;
512     info.abilityName_ = "test1";
513     info.bundleName_ = "test2";
514     info.moduleName_ = "test3";
515     info.appIndex_ = 10;
516     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
517     if (sceneSession == nullptr) {
518         return;
519     }
520     ssm_->sceneSessionMap_.insert({1, sceneSession});
521     ssm_->GetSceneSessionVectorByTypeAndDisplayId(WindowType::APP_MAIN_WINDOW_BASE, displayId);
522     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
523     ssm_->GetSceneSessionVectorByTypeAndDisplayId(WindowType::APP_MAIN_WINDOW_BASE, displayId);
524     sceneSession->property_->SetDisplayId(1);
525     ssm_->GetSceneSessionVectorByTypeAndDisplayId(WindowType::APP_MAIN_WINDOW_BASE, displayId);
526     ssm_->sceneSessionMap_.erase(1);
527     ASSERT_EQ(ret, 0);
528 }
529 
530 /**
531  * @tc.name: CheckWindowId
532  * @tc.desc: CheckWindowId
533  * @tc.type: FUNC
534  */
535 HWTEST_F(SceneSessionManagerTest3, CheckWindowId, Function | SmallTest | Level3)
536 {
537     int ret = 0;
538     int32_t windowId = 1;
539     int32_t pid = 2;
540     ssm_->CheckWindowId(windowId, pid);
541     ssm_->sceneSessionMap_.insert({windowId, nullptr});
542     ssm_->CheckWindowId(windowId, pid);
543     SessionInfo info;
544     info.abilityName_ = "test1";
545     info.bundleName_ = "test2";
546     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
547     ASSERT_NE(nullptr, sceneSession);
548     ssm_->sceneSessionMap_.insert({windowId, sceneSession});
549     ssm_->CheckWindowId(windowId, pid);
550     ssm_->PerformRegisterInRequestSceneSession(sceneSession);
551     ssm_->sceneSessionMap_.erase(windowId);
552     ASSERT_EQ(ret, 0);
553 }
554 
555 /**
556  * @tc.name: CheckAppIsInDisplay
557  * @tc.desc: CheckAppIsInDisplay
558  * @tc.type: FUNC
559  */
560 HWTEST_F(SceneSessionManagerTest3, CheckAppIsInDisplay, Function | SmallTest | Level3)
561 {
562     int ret = 0;
563     sptr<SceneSession> sceneSession;
564     ssm_->RequestSceneSessionActivation(sceneSession, true);
565     SessionInfo info;
566     ret++;
567     ssm_->DestroyDialogWithMainWindow(sceneSession);
568     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
569     ASSERT_NE(nullptr, sceneSession);
570     ssm_->DestroyDialogWithMainWindow(sceneSession);
571     ssm_->DestroySubSession(sceneSession);
572     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
573     ASSERT_NE(nullptr, property);
574     sceneSession->SetSessionProperty(property);
575     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
576     property->SetWindowType(WindowType::WINDOW_TYPE_DESKTOP);
577     AppExecFwk::Configuration config;
578     ssm_->SetAbilitySessionInfo(sceneSession);
579     bool res = true;
580     ssm_->PrepareTerminate(1, res);
581     ssm_->isPrepareTerminateEnable_ = true;
582     ssm_->PrepareTerminate(1, res);
583     ssm_->isPrepareTerminateEnable_ = false;
584     ssm_->PrepareTerminate(1, res);
585     ssm_->StartUIAbilityBySCB(sceneSession);
586     ssm_->sceneSessionMap_.insert({1, nullptr});
587     ssm_->IsKeyboardForeground();
588     ssm_->sceneSessionMap_.insert({1, sceneSession});
589     ssm_->NotifyForegroundInteractiveStatus(sceneSession, true);
590     ssm_->NotifyForegroundInteractiveStatus(sceneSession, false);
591     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
592     ssm_->IsKeyboardForeground();
593     ssm_->StartUIAbilityBySCB(sceneSession);
594     ssm_->PrepareTerminate(1, res);
595     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
596     ssm_->DestroyDialogWithMainWindow(sceneSession);
597     ssm_->sceneSessionMap_.erase(1);
598     sptr<AAFwk::SessionInfo> abilitySessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr();
599     ASSERT_NE(nullptr, abilitySessionInfo);
600     ssm_->StartUIAbilityBySCB(abilitySessionInfo);
601     ssm_->DestroySubSession(sceneSession);
602     ssm_->EraseSceneSessionMapById(2);
603     ASSERT_EQ(ret, 1);
604 }
605 
606 /**
607  * @tc.name: StartUIAbilityBySCB
608  * @tc.desc: StartUIAbilityBySCB
609  * @tc.type: FUNC
610  */
611 HWTEST_F(SceneSessionManagerTest3, StartUIAbilityBySCB, Function | SmallTest | Level3)
612 {
613     SessionInfo info;
614     info.abilityName_ = "StartUIAbilityBySCB";
615     info.bundleName_ = "StartUIAbilityBySCB";
616     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
617     ASSERT_NE(nullptr, sceneSession);
618     sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
619     int32_t ret = ssm_->StartUIAbilityBySCB(sceneSession);
620     EXPECT_NE(ret, ERR_OK);
621 }
622 
623 /**
624  * @tc.name: ChangeUIAbilityVisibilityBySCB
625  * @tc.desc: ChangeUIAbilityVisibilityBySCB
626  * @tc.type: FUNC
627  */
628 HWTEST_F(SceneSessionManagerTest3, ChangeUIAbilityVisibilityBySCB, Function | SmallTest | Level3)
629 {
630     SessionInfo info;
631     info.abilityName_ = "ChangeUIAbilityVisibilityBySCB";
632     info.bundleName_ = "ChangeUIAbilityVisibilityBySCB";
633     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
634     ASSERT_NE(nullptr, sceneSession);
635     sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
636     int32_t ret = ssm_->ChangeUIAbilityVisibilityBySCB(sceneSession, true);
637     EXPECT_EQ(ret, 2097202);
638     ret = ssm_->ChangeUIAbilityVisibilityBySCB(sceneSession, true, false);
639     EXPECT_EQ(ret, 2097202);
640     ret = ssm_->ChangeUIAbilityVisibilityBySCB(sceneSession, true, true);
641     EXPECT_EQ(ret, 2097202);
642 }
643 
644 /**
645  * @tc.name: SetAbilitySessionInfo
646  * @tc.desc: SceneSesionManager set ability session info
647  * @tc.type: FUNC
648  */
649 HWTEST_F(SceneSessionManagerTest3, SetAbilitySessionInfo, Function | SmallTest | Level3)
650 {
651     SessionInfo info;
652     info.abilityName_ = "SetAbilitySessionInfo";
653     info.bundleName_ = "SetAbilitySessionInfo";
654     sptr<SceneSession> sceneSession;
655     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
656     ASSERT_NE(nullptr, sceneSession);
657     sptr<OHOS::AAFwk::SessionInfo> ret = ssm_->SetAbilitySessionInfo(sceneSession);
658     OHOS::AppExecFwk::ElementName retElementName = ret->want.GetElement();
659     ASSERT_EQ(retElementName.GetAbilityName(), info.abilityName_);
660     ASSERT_EQ(retElementName.GetBundleName(), info.bundleName_);
661 }
662 
663 /**
664  * @tc.name: PrepareTerminate
665  * @tc.desc: SceneSesionManager prepare terminate
666  * @tc.type: FUNC
667  */
668 HWTEST_F(SceneSessionManagerTest3, PrepareTerminate, Function | SmallTest | Level3)
669 {
670     int32_t persistentId = 0;
671     bool isPrepareTerminate = false;
672     ASSERT_EQ(WSError::WS_OK, ssm_->PrepareTerminate(persistentId, isPrepareTerminate));
673 }
674 
675 /**
676  * @tc.name: DestroyDialogWithMainWindow
677  * @tc.desc: SceneSesionManager destroy dialog with main window
678  * @tc.type: FUNC
679  */
680 HWTEST_F(SceneSessionManagerTest3, DestroyDialogWithMainWindow, Function | SmallTest | Level3)
681 {
682     SessionInfo info;
683     info.abilityName_ = "DestroyDialogWithMainWindow";
684     info.bundleName_ = "DestroyDialogWithMainWindow";
685     sptr<SceneSession> sceneSession;
686     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
687     ASSERT_NE(nullptr, sceneSession);
688     ASSERT_EQ(WSError::WS_OK, ssm_->DestroyDialogWithMainWindow(sceneSession));
689 }
690 
691 /**
692  * @tc.name: AddClientDeathRecipient
693  * @tc.desc: SceneSesionManager add client death recipient
694  * @tc.type: FUNC
695  */
696 HWTEST_F(SceneSessionManagerTest3, AddClientDeathRecipient, Function | SmallTest | Level3)
697 {
698     SessionInfo info;
699     info.abilityName_ = "AddClientDeathRecipient";
700     info.bundleName_ = "AddClientDeathRecipient";
701     sptr<SceneSession> sceneSession;
702     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
703     ASSERT_NE(nullptr, sceneSession);
704     int ret = 0;
705     ssm_->AddClientDeathRecipient(nullptr, sceneSession);
706     ASSERT_EQ(ret, 0);
707 }
708 
709 /**
710  * @tc.name: DestroySpecificSession
711  * @tc.desc: SceneSesionManager destroy specific session
712  * @tc.type: FUNC
713  */
714 HWTEST_F(SceneSessionManagerTest3, DestroySpecificSession, Function | SmallTest | Level3)
715 {
716     sptr<IRemoteObject> remoteObject = nullptr;
717     int ret = 0;
718     ssm_->DestroySpecificSession(remoteObject);
719     ASSERT_EQ(ret, 0);
720 }
721 
722 /**
723  * @tc.name: SetCreateSystemSessionListener
724  * @tc.desc: SceneSesionManager set create specific session listener
725  * @tc.type: FUNC
726  */
727 HWTEST_F(SceneSessionManagerTest3, SetCreateSystemSessionListener, Function | SmallTest | Level3)
728 {
729     int ret = 0;
730     ssm_->SetCreateSystemSessionListener(nullptr);
731     ASSERT_EQ(ret, 0);
732 }
733 
734 /**
735  * @tc.name: SetGestureNavigationEnabledChangeListener
736  * @tc.desc: SceneSesionManager set gesture navigation enabled change listener
737  * @tc.type: FUNC
738  */
739 HWTEST_F(SceneSessionManagerTest3, SetGestureNavigationEnabledChangeListener, Function | SmallTest | Level3)
740 {
741     int ret = 0;
742     ssm_->SetGestureNavigationEnabledChangeListener(nullptr);
743     ASSERT_EQ(ret, 0);
744 }
745 
746 /**
747  * @tc.name: OnOutsideDownEvent
748  * @tc.desc: SceneSesionManager on out side down event
749  * @tc.type: FUNC
750  */
751 HWTEST_F(SceneSessionManagerTest3, OnOutsideDownEvent, Function | SmallTest | Level3)
752 {
753     int32_t x = 32;
754     int32_t y = 32;
755     int ret = 0;
756     ssm_->OnOutsideDownEvent(x, y);
757     ASSERT_EQ(ret, 0);
758 }
759 
760 /**
761  * @tc.name: NotifySessionTouchOutside
762  * @tc.desc: SceneSesionManager notify session touch outside
763  * @tc.type: FUNC
764  */
765 HWTEST_F(SceneSessionManagerTest3, NotifySessionTouchOutside, Function | SmallTest | Level3)
766 {
767     int ret = 0;
768     ssm_->NotifySessionTouchOutside(0);
769     ASSERT_EQ(ret, 0);
770 }
771 
772 /**
773  * @tc.name: SetOutsideDownEventListener
774  * @tc.desc: SceneSesionManager set outside down event listener
775  * @tc.type: FUNC
776  */
777 HWTEST_F(SceneSessionManagerTest3, SetOutsideDownEventListener, Function | SmallTest | Level3)
778 {
__anonc10c36570402(int32_t x, int32_t y) 779     ProcessOutsideDownEventFunc func = [](int32_t x, int32_t y) {
780         ssm_->OnOutsideDownEvent(x, y);
781     };
782     int ret = 0;
783     ssm_->SetOutsideDownEventListener(func);
784     ASSERT_EQ(ret, 0);
785 }
786 
787 /**
788  * @tc.name: GetWindowSceneConfig
789  * @tc.desc: SceneSesionManager get window scene config
790  * @tc.type: FUNC
791  */
792 HWTEST_F(SceneSessionManagerTest3, GetWindowSceneConfig, Function | SmallTest | Level3)
793 {
794     int ret = 0;
795     AppWindowSceneConfig appWindowSceneConfig_ = ssm_->GetWindowSceneConfig();
796     ASSERT_EQ(ret, 0);
797 }
798 
799 /**
800  * @tc.name: ProcessBackEvent
801  * @tc.desc: SceneSesionManager process back event
802  * @tc.type: FUNC
803  */
804 HWTEST_F(SceneSessionManagerTest3, ProcessBackEvent, Function | SmallTest | Level3)
805 {
806     WSError result = ssm_->ProcessBackEvent();
807     ASSERT_EQ(result, WSError::WS_OK);
808 }
809 
810 /**
811  * @tc.name: IsPcSceneSessionLifecycle1
812  * @tc.desc: Normal test
813  * @tc.type: FUNC
814  */
815 HWTEST_F(SceneSessionManagerTest3, IsPcSceneSessionLifecycle1, Function | SmallTest | Level3)
816 {
817     ASSERT_NE(nullptr, ssm_);
818     ssm_->systemConfig_.backgroundswitch = true;
819     SessionInfo info;
820     info.abilityName_ = "IsPcSceneSessionLifecycle1";
821     info.bundleName_ = "IsPcSceneSessionLifecycle1";
822     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
823     ASSERT_NE(nullptr, sceneSession);
824     sceneSession->property_->SetIsAppSupportPhoneInPc(false);
825     sceneSession->property_->SetIsPcAppInPad(false);
826 
827     bool ret = ssm_->IsPcSceneSessionLifecycle(sceneSession);
828     EXPECT_EQ(ret, true);
829 }
830 
831 /**
832  * @tc.name: IsPcSceneSessionLifecycle2
833  * @tc.desc: pc app in pad
834  * @tc.type: FUNC
835  */
836 HWTEST_F(SceneSessionManagerTest3, IsPcSceneSessionLifecycle2, Function | SmallTest | Level3)
837 {
838     ASSERT_NE(nullptr, ssm_);
839     ssm_->systemConfig_.backgroundswitch = false;
840     SessionInfo info;
841     info.abilityName_ = "IsPcSceneSessionLifecycle2";
842     info.bundleName_ = "IsPcSceneSessionLifecycle2";
843     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
844     ASSERT_NE(nullptr, sceneSession);
845     sceneSession->property_->SetIsAppSupportPhoneInPc(false);
846     sceneSession->property_->SetIsPcAppInPad(true);
847 
848     bool ret = ssm_->IsPcSceneSessionLifecycle(sceneSession);
849     EXPECT_EQ(ret, true);
850 }
851 
852 /**
853  * @tc.name: IsPcSceneSessionLifecycle3
854  * @tc.desc: Compatible mode in pc
855  * @tc.type: FUNC
856  */
857 HWTEST_F(SceneSessionManagerTest3, IsPcSceneSessionLifecycle3, Function | SmallTest | Level3)
858 {
859     ASSERT_NE(nullptr, ssm_);
860     ssm_->systemConfig_.backgroundswitch = true;
861     SessionInfo info;
862     info.abilityName_ = "IsPcSceneSessionLifecycle3";
863     info.bundleName_ = "IsPcSceneSessionLifecycle3";
864     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
865     ASSERT_NE(nullptr, sceneSession);
866     sceneSession->property_->SetIsAppSupportPhoneInPc(true);
867     sceneSession->property_->SetIsPcAppInPad(false);
868 
869     bool ret = ssm_->IsPcSceneSessionLifecycle(sceneSession);
870     EXPECT_EQ(ret, false);
871 }
872 
873 /**
874  * @tc.name: InitUserInfo
875  * @tc.desc: SceneSesionManager init user info
876  * @tc.type: FUNC
877  */
878 HWTEST_F(SceneSessionManagerTest3, InitUserInfo, Function | SmallTest | Level3)
879 {
880     int32_t newUserId = 10086;
881     std::string fileDir;
882     WSError result01 = ssm_->InitUserInfo(newUserId, fileDir);
883     ASSERT_EQ(result01, WSError::WS_DO_NOTHING);
884     fileDir = "newFileDir";
885     WSError result02 = ssm_->InitUserInfo(newUserId, fileDir);
886     ASSERT_EQ(result02, WSError::WS_OK);
887 }
888 
889 /**
890  * @tc.name: IsInvalidMainSessionOnUserSwitch1
891  * @tc.desc: invalid window type
892  * @tc.type: FUNC
893  */
894 HWTEST_F(SceneSessionManagerTest3, IsNeedChangeLifeCycleOnUserSwitch1, Function | SmallTest | Level3)
895 {
896     ASSERT_NE(nullptr, ssm_);
897     ssm_->systemConfig_.backgroundswitch = true;
898     int32_t pid = 12345;
899     SessionInfo info;
900     info.abilityName_ = "IsNeedChangeLifeCycleOnUserSwitch1";
901     info.bundleName_ = "IsNeedChangeLifeCycleOnUserSwitch1";
902     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
903     ASSERT_NE(nullptr, sceneSession);
904     sceneSession->SetCallingPid(45678);
905     sceneSession->property_->SetIsAppSupportPhoneInPc(false);
906     sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
907     sceneSession->SetSessionState(SessionState::STATE_BACKGROUND);
908 
909     bool ret = ssm_->IsNeedChangeLifeCycleOnUserSwitch(sceneSession, pid);
910     EXPECT_EQ(ret, false);
911 }
912 
913 /**
914  * @tc.name: IsNeedChangeLifeCycleOnUserSwitch2
915  * @tc.desc: invalid window state
916  * @tc.type: FUNC
917  */
918 HWTEST_F(SceneSessionManagerTest3, IsNeedChangeLifeCycleOnUserSwitch2, Function | SmallTest | Level3)
919 {
920     ASSERT_NE(nullptr, ssm_);
921     int32_t pid = 12345;
922     ssm_->systemConfig_.backgroundswitch = true;
923     SessionInfo info;
924     info.abilityName_ = "IsNeedChangeLifeCycleOnUserSwitch2";
925     info.bundleName_ = "IsNeedChangeLifeCycleOnUserSwitch2";
926     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
927     ASSERT_NE(nullptr, sceneSession);
928     sceneSession->SetCallingPid(45678);
929     sceneSession->property_->SetIsAppSupportPhoneInPc(false);
930     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
931     sceneSession->SetSessionState(SessionState::STATE_END);
932 
933     bool ret = ssm_->IsNeedChangeLifeCycleOnUserSwitch(sceneSession, pid);
934     EXPECT_EQ(ret, false);
935 }
936 
937 /**
938  * @tc.name: IsNeedChangeLifeCycleOnUserSwitch3
939  * @tc.desc: Normal test
940  * @tc.type: FUNC
941  */
942 HWTEST_F(SceneSessionManagerTest3, IsNeedChangeLifeCycleOnUserSwitch3, Function | SmallTest | Level3)
943 {
944     ASSERT_NE(nullptr, ssm_);
945     int32_t pid = 12345;
946     ssm_->systemConfig_.backgroundswitch = true;
947     SessionInfo info;
948     info.abilityName_ = "IsNeedChangeLifeCycleOnUserSwitch3";
949     info.bundleName_ = "IsNeedChangeLifeCycleOnUserSwitch3";
950     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
951     ASSERT_NE(nullptr, sceneSession);
952     sceneSession->SetCallingPid(45678);
953     sceneSession->property_->SetIsAppSupportPhoneInPc(false);
954     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
955     sceneSession->SetSessionState(SessionState::STATE_BACKGROUND);
956 
957     bool ret = ssm_->IsNeedChangeLifeCycleOnUserSwitch(sceneSession, pid);
958     EXPECT_EQ(ret, true);
959 }
960 
961 /**
962  * @tc.name: IsNeedChangeLifeCycleOnUserSwitch4
963  * @tc.desc: Invalid pid
964  * @tc.type: FUNC
965  */
966 HWTEST_F(SceneSessionManagerTest3, IsNeedChangeLifeCycleOnUserSwitch4, Function | SmallTest | Level3)
967 {
968     ASSERT_NE(nullptr, ssm_);
969     int32_t pid = 12345;
970     SessionInfo info;
971     info.abilityName_ = "IsNeedChangeLifeCycleOnUserSwitch4";
972     info.bundleName_ = "IsNeedChangeLifeCycleOnUserSwitch4";
973     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
974     ASSERT_NE(nullptr, sceneSession);
975     sceneSession->SetCallingPid(pid);
976 
977     bool ret = ssm_->IsNeedChangeLifeCycleOnUserSwitch(sceneSession, pid);
978     EXPECT_EQ(ret, false);
979 }
980 
981 /**
982  * @tc.name: HandleUserSwitch
983  * @tc.desc: SceneSesionManager notify switching user
984  * @tc.type: FUNC
985  */
986 HWTEST_F(SceneSessionManagerTest3, HandleUserSwitch, Function | SmallTest | Level3)
987 {
988     int ret = 0;
989     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHING, true);
990     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHED, true);
991     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHING, false);
992     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHED, false);
993     ASSERT_EQ(ret, 0);
994 }
995 
996 /**
997  * @tc.name: HandleUserSwitch1
998  * @tc.desc: notify switching user on PC
999  * @tc.type: FUNC
1000  */
1001 HWTEST_F(SceneSessionManagerTest3, HandleUserSwitch1, Function | SmallTest | Level3)
1002 {
1003     ASSERT_NE(nullptr, ssm_);
1004     ssm_->systemConfig_.backgroundswitch = true;
1005     SessionInfo info;
1006     info.abilityName_ = "IsNeedChangeLifeCycleOnUserSwitch3";
1007     info.bundleName_ = "IsNeedChangeLifeCycleOnUserSwitch3";
1008     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1009     ASSERT_NE(nullptr, sceneSession);
1010     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1011     ASSERT_NE(nullptr, property);
1012     sceneSession->SetSessionProperty(property);
1013     sceneSession->SetCallingPid(45678);
1014     property->SetIsAppSupportPhoneInPc(false);
1015     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1016     sceneSession->SetSessionState(SessionState::STATE_BACKGROUND);
1017     ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), sceneSession });
1018     ssm_->sceneSessionMap_.insert({ sceneSession->GetPersistentId(), nullptr });
1019     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHING, false);
1020     ssm_->HandleUserSwitch(UserSwitchEventType::SWITCHED, false);
1021 }
1022 
1023 /**
1024  * @tc.name: GetSessionInfoByContinueSessionId
1025  * @tc.desc: SceneSesionManager GetSessionInfoByContinueSessionId
1026  * @tc.type: FUNC
1027  */
1028 HWTEST_F(SceneSessionManagerTest3, GetSessionInfoByContinueSessionId, Function | SmallTest | Level3)
1029 {
1030     std::string continueSessionId = "";
1031     SessionInfoBean missionInfo;
1032     EXPECT_EQ(ssm_->GetSessionInfoByContinueSessionId(continueSessionId, missionInfo),
1033         WSError::WS_ERROR_INVALID_PERMISSION);
1034 }
1035 
1036 /**
1037  * @tc.name: PreHandleCollaborator
1038  * @tc.desc: SceneSesionManager prehandle collaborator
1039  * @tc.type: FUNC
1040  */
1041 HWTEST_F(SceneSessionManagerTest3, PreHandleCollaborator, Function | SmallTest | Level3)
1042 {
1043     SessionInfo info;
1044     info.abilityName_ = "PreHandleCollaborator";
1045     info.bundleName_ = "PreHandleCollaborator";
1046     sptr<SceneSession> sceneSession = nullptr;
1047     bool result = ssm_->PreHandleCollaborator(sceneSession);
1048     EXPECT_FALSE(result);
1049 
1050     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1051     ASSERT_NE(nullptr, sceneSession);
1052     result = ssm_->PreHandleCollaborator(sceneSession);
1053     EXPECT_TRUE(result);
1054 
1055     sceneSession = nullptr;
1056     AppExecFwk::ApplicationInfo applicationInfo_;
1057     applicationInfo_.codePath = std::to_string(CollaboratorType::RESERVE_TYPE);
1058     AppExecFwk::AbilityInfo abilityInfo_;
1059     abilityInfo_.applicationInfo = applicationInfo_;
1060     info.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo_);
1061     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1062     ASSERT_NE(nullptr, sceneSession);
1063     result = ssm_->PreHandleCollaborator(sceneSession);
1064     EXPECT_TRUE(result);
1065 
1066     sceneSession = nullptr;
1067     applicationInfo_.codePath = std::to_string(CollaboratorType::OTHERS_TYPE);
1068     abilityInfo_.applicationInfo = applicationInfo_;
1069     info.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo_);
1070     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1071     ASSERT_NE(nullptr, sceneSession);
1072     result = ssm_->PreHandleCollaborator(sceneSession);
1073     EXPECT_TRUE(result);
1074 
1075     EXPECT_EQ(sceneSession->GetSessionInfo().want, nullptr);
1076     sceneSession = nullptr;
1077     info.want = std::make_shared<AAFwk::Want>();
1078     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1079     ASSERT_NE(nullptr, sceneSession);
1080     result = ssm_->PreHandleCollaborator(sceneSession);
1081     EXPECT_TRUE(result);
1082 }
1083 
1084 /**
1085  * @tc.name: CheckCollaboratorType
1086  * @tc.desc: SceneSesionManager check collborator type
1087  * @tc.type: FUNC
1088  */
1089 HWTEST_F(SceneSessionManagerTest3, CheckCollaboratorType, Function | SmallTest | Level3)
1090 {
1091     int32_t type = CollaboratorType::RESERVE_TYPE;
1092     EXPECT_TRUE(ssm_->CheckCollaboratorType(type));
1093     type = CollaboratorType::OTHERS_TYPE;
1094     EXPECT_TRUE(ssm_->CheckCollaboratorType(type));
1095     type = CollaboratorType::DEFAULT_TYPE;
1096     ASSERT_FALSE(ssm_->CheckCollaboratorType(type));
1097 }
1098 
1099 /**
1100  * @tc.name: NotifyUpdateSessionInfo
1101  * @tc.desc: SceneSesionManager notify update session info
1102  * @tc.type: FUNC
1103  */
1104 HWTEST_F(SceneSessionManagerTest3, NotifyUpdateSessionInfo, Function | SmallTest | Level3)
1105 {
1106     SessionInfo info;
1107     info.abilityName_ = "NotifyUpdateSessionInfo";
1108     info.bundleName_ = "NotifyUpdateSessionInfo";
1109     sptr<SceneSession> sceneSession;
1110     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1111     ASSERT_NE(nullptr, sceneSession);
1112     ssm_->NotifyUpdateSessionInfo(nullptr);
1113     ASSERT_EQ(sceneSession->GetSessionInfo().want, nullptr);
1114     ssm_->NotifyUpdateSessionInfo(sceneSession);
1115     int32_t collaboratorType = CollaboratorType::RESERVE_TYPE;
1116     int32_t persistentId = 10086;
1117     ssm_->NotifyMoveSessionToForeground(collaboratorType, persistentId);
1118     ssm_->NotifyClearSession(collaboratorType, persistentId);
1119 }
1120 
1121 /**
1122  * @tc.name: QueryAbilityInfoFromBMS
1123  * @tc.desc: SceneSesionManager QueryAbilityInfoFromBMS NotifyStartAbility
1124  * @tc.type: FUNC
1125  */
1126 HWTEST_F(SceneSessionManagerTest3, QueryAbilityInfoFromBMS, Function | SmallTest | Level3)
1127 {
1128     const int32_t uId = 32;
1129     SessionInfo sessionInfo_;
1130     sessionInfo_.bundleName_ = "BundleName";
1131     sessionInfo_.abilityName_ = "AbilityName";
1132     sessionInfo_.moduleName_ = "ModuleName";
1133     AppExecFwk::AbilityInfo abilityInfo;
1134     int32_t collaboratorType = CollaboratorType::RESERVE_TYPE;
1135     ssm_->QueryAbilityInfoFromBMS(uId,
1136         sessionInfo_.bundleName_, sessionInfo_.abilityName_, sessionInfo_.moduleName_);
1137     EXPECT_EQ(sessionInfo_.want, nullptr);
1138     ssm_->Init();
1139     ssm_->QueryAbilityInfoFromBMS(uId,
1140         sessionInfo_.bundleName_, sessionInfo_.abilityName_, sessionInfo_.moduleName_);
1141     ssm_->NotifyStartAbility(collaboratorType, sessionInfo_);
1142     sessionInfo_.want = std::make_shared<AAFwk::Want>();
1143     collaboratorType = CollaboratorType::OTHERS_TYPE;
1144     ssm_->NotifyStartAbility(collaboratorType, sessionInfo_);
1145     ASSERT_NE(sessionInfo_.want, nullptr);
1146 }
1147 
1148 /**
1149  * @tc.name: NotifyStartAbility
1150  * @tc.desc: SceneSesionManager NotifyStartAbility
1151  * @tc.type: FUNC
1152  */
1153 HWTEST_F(SceneSessionManagerTest3, NotifyStartAbility, Function | SmallTest | Level3)
1154 {
1155     SessionInfo sessionInfo;
1156     sessionInfo.moduleName_ = "SceneSessionManagerTest";
1157     sessionInfo.bundleName_ = "SceneSessionManagerTest3";
1158     sessionInfo.abilityName_ = "NotifyStartAbility";
1159     sptr<AAFwk::IAbilityManagerCollaborator> collaborator =
1160         iface_cast<AAFwk::IAbilityManagerCollaborator>(nullptr);
1161     ssm_->collaboratorMap_.clear();
1162     ssm_->collaboratorMap_.insert(std::make_pair(1, collaborator));
1163     int32_t collaboratorType = 1;
1164     auto ret1 = ssm_->NotifyStartAbility(collaboratorType, sessionInfo);
1165     ASSERT_EQ(ret1, BrokerStates::BROKER_UNKOWN);
1166 
1167     sessionInfo.want = std::make_shared<AAFwk::Want>();
1168     auto ret2 = ssm_->NotifyStartAbility(collaboratorType, sessionInfo);
1169     ASSERT_EQ(ret2, BrokerStates::BROKER_UNKOWN);
1170     ssm_->collaboratorMap_.clear();
1171 }
1172 
1173 /**
1174  * @tc.name: IsSessionClearable
1175  * @tc.desc: SceneSesionManager is session clearable
1176  * @tc.type: FUNC
1177  */
1178 HWTEST_F(SceneSessionManagerTest3, IsSessionClearable, Function | SmallTest | Level3)
1179 {
1180     SessionInfo info;
1181     info.abilityName_ = "IsSessionClearable";
1182     info.bundleName_ = "IsSessionClearable";
1183     sptr<SceneSession> sceneSession;
1184     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1185     ASSERT_NE(nullptr, sceneSession);
1186     EXPECT_FALSE(ssm_->IsSessionClearable(nullptr));
1187     EXPECT_FALSE(ssm_->IsSessionClearable(sceneSession));
1188     AppExecFwk::AbilityInfo abilityInfo_;
1189     abilityInfo_.excludeFromMissions = true;
1190     info.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo_);
1191     sceneSession = nullptr;
1192     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1193     ASSERT_NE(nullptr, sceneSession);
1194     EXPECT_FALSE(ssm_->IsSessionClearable(sceneSession));
1195     abilityInfo_.excludeFromMissions = false;
1196     abilityInfo_.unclearableMission = true;
1197     info.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo_);
1198     sceneSession = nullptr;
1199     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1200     ASSERT_NE(nullptr, sceneSession);
1201     EXPECT_FALSE(ssm_->IsSessionClearable(sceneSession));
1202     abilityInfo_.unclearableMission = false;
1203     info.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo_);
1204     info.lockedState = true;
1205     sceneSession = nullptr;
1206     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1207     ASSERT_NE(nullptr, sceneSession);
1208     EXPECT_FALSE(ssm_->IsSessionClearable(sceneSession));
1209     info.lockedState = false;
1210     info.isSystem_ = true;
1211     sceneSession = nullptr;
1212     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1213     ASSERT_NE(nullptr, sceneSession);
1214     EXPECT_FALSE(ssm_->IsSessionClearable(sceneSession));
1215     info.isSystem_ = false;
1216     sceneSession = nullptr;
1217     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1218     ASSERT_NE(nullptr, sceneSession);
1219     ASSERT_TRUE(ssm_->IsSessionClearable(sceneSession));
1220 }
1221 
1222 /**
1223  * @tc.name: HandleTurnScreenOn
1224  * @tc.desc: SceneSesionManager handle turn screen on and keep screen on
1225  * @tc.type: FUNC
1226  */
1227 HWTEST_F(SceneSessionManagerTest3, HandleTurnScreenOn, Function | SmallTest | Level3)
1228 {
1229     SessionInfo info;
1230     info.abilityName_ = "HandleTurnScreenOn";
1231     info.bundleName_ = "HandleTurnScreenOn";
1232     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1233     ASSERT_NE(sceneSession, nullptr);
1234     ssm_->HandleTurnScreenOn(sceneSession);
1235     std::string lockName = "windowLock";
1236     bool requireLock = true;
1237     ssm_->HandleKeepScreenOn(sceneSession, requireLock, lockName, sceneSession->keepScreenLock_);
1238     requireLock = false;
1239     ssm_->HandleKeepScreenOn(sceneSession, requireLock, lockName, sceneSession->keepScreenLock_);
1240 }
1241 
1242 /**
1243  * @tc.name: HandleHideNonSystemFloatingWindows
1244  * @tc.desc: SceneSesionManager update hide non system floating windows
1245  * @tc.type: FUNC
1246  */
1247 HWTEST_F(SceneSessionManagerTest3, HandleHideNonSystemFloatingWindows, Function | SmallTest | Level3)
1248 {
1249     SessionInfo info;
1250     info.abilityName_ = "HandleHideNonSystemFloatingWindows";
1251     info.bundleName_ = "HandleHideNonSystemFloatingWindows";
1252     sptr<SceneSession> sceneSession;
1253     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1254     ASSERT_NE(nullptr, sceneSession);
1255     sptr<WindowSessionProperty> property = nullptr;
1256     ssm_->UpdateForceHideState(sceneSession, property, true);
1257     property = sptr<WindowSessionProperty>::MakeSptr();
1258     ASSERT_NE(nullptr, property);
1259     ssm_->HandleHideNonSystemFloatingWindows(property, sceneSession);
1260     property->SetHideNonSystemFloatingWindows(true);
1261     ssm_->UpdateForceHideState(sceneSession, property, true);
1262     ssm_->UpdateForceHideState(sceneSession, property, false);
1263     property->SetHideNonSystemFloatingWindows(false);
1264     property->SetFloatingWindowAppType(true);
1265     ssm_->UpdateForceHideState(sceneSession, property, true);
1266     ssm_->UpdateForceHideState(sceneSession, property, false);
1267     uint32_t result = property->GetWindowModeSupportType();
1268     ASSERT_EQ(result, WindowModeSupport::WINDOW_MODE_SUPPORT_ALL);
1269 }
1270 
1271 /**
1272  * @tc.name: UpdateBrightness
1273  * @tc.desc: SceneSesionManager update brightness
1274  * @tc.type: FUNC
1275  */
1276 HWTEST_F(SceneSessionManagerTest3, UpdateBrightness, Function | SmallTest | Level3)
1277 {
1278     int32_t persistentId = 10086;
1279     ssm_->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
1280     WSError result01 = ssm_->UpdateBrightness(persistentId);
1281     EXPECT_EQ(result01, WSError::WS_ERROR_NULLPTR);
1282     ssm_->systemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
1283     result01 = ssm_->UpdateBrightness(persistentId);
1284     EXPECT_EQ(result01, WSError::WS_OK);
1285 }
1286 
1287 /**
1288  * @tc.name: SetDisplayBrightness
1289  * @tc.desc: SceneSesionManager set display brightness
1290  * @tc.type: FUNC
1291  */
1292 HWTEST_F(SceneSessionManagerTest3, SetDisplayBrightness, Function | SmallTest | Level3)
1293 {
1294     float brightness = 2.0f;
1295     float result01 = ssm_->GetDisplayBrightness();
1296     EXPECT_EQ(result01, UNDEFINED_BRIGHTNESS);
1297     ssm_->SetDisplayBrightness(brightness);
1298     float result02 = ssm_->GetDisplayBrightness();
1299     ASSERT_EQ(result02, 2.0f);
1300 }
1301 
1302 /**
1303  * @tc.name: SetGestureNavigationEnabled02
1304  * @tc.desc: SceneSesionManager set gesture navigation enable
1305  * @tc.type: FUNC
1306  */
1307 HWTEST_F(SceneSessionManagerTest3, SetGestureNavigationEnabled02, Function | SmallTest | Level3)
1308 {
1309     bool enable = true;
1310     WMError result01 = ssm_->SetGestureNavigationEnabled(enable);
1311     EXPECT_EQ(result01, WMError::WM_OK);
1312     ProcessGestureNavigationEnabledChangeFunc funcGesture_ = SceneSessionManagerTest3::callbackFunc_;
1313     ssm_->SetGestureNavigationEnabledChangeListener(funcGesture_);
1314     WMError result02 = ssm_->SetGestureNavigationEnabled(enable);
1315     EXPECT_EQ(result02, WMError::WM_OK);
1316     ProcessStatusBarEnabledChangeFunc funcStatus_ = ProcessStatusBarEnabledChangeFuncTest;
1317     ssm_->SetStatusBarEnabledChangeListener(funcStatus_);
1318     WMError result03 = ssm_->SetGestureNavigationEnabled(enable);
1319     ASSERT_EQ(result03, WMError::WM_OK);
1320 }
1321 
1322 /**
1323  * @tc.name: SetFocusedSessionId
1324  * @tc.desc: SceneSesionManager set focused session id
1325  * @tc.type: FUNC
1326  */
1327 HWTEST_F(SceneSessionManagerTest3, SetFocusedSessionId, Function | SmallTest | Level3)
1328 {
1329     int32_t focusedSession = ssm_->GetFocusedSessionId();
1330     EXPECT_EQ(focusedSession, INVALID_SESSION_ID);
1331     int32_t persistentId = INVALID_SESSION_ID;
1332     WSError result01 = ssm_->SetFocusedSessionId(persistentId, DEFAULT_DISPLAY_ID);
1333     EXPECT_EQ(result01, WSError::WS_DO_NOTHING);
1334     persistentId = 10086;
1335     WSError result02 = ssm_->SetFocusedSessionId(persistentId, DEFAULT_DISPLAY_ID);
1336     EXPECT_EQ(result02, WSError::WS_OK);
1337     ASSERT_EQ(ssm_->GetFocusedSessionId(), 10086);
1338 }
1339 
1340 /**
1341  * @tc.name: RequestFocusStatus
1342  * @tc.desc: SceneSesionManager request focus status
1343  * @tc.type: FUNC
1344  */
1345 HWTEST_F(SceneSessionManagerTest3, RequestFocusStatus, Function | SmallTest | Level3)
1346 {
1347     int32_t focusedSession = ssm_->GetFocusedSessionId();
1348     EXPECT_EQ(focusedSession, 10086);
1349 
1350     int32_t persistentId = INVALID_SESSION_ID;
1351     WMError result01 = ssm_->RequestFocusStatus(persistentId, true);
1352     EXPECT_EQ(result01, WMError::WM_ERROR_NULLPTR);
1353     FocusChangeReason reasonResult = ssm_->GetFocusChangeReason();
1354     EXPECT_EQ(reasonResult, FocusChangeReason::DEFAULT);
1355 
1356     persistentId = 10000;
1357     FocusChangeReason reasonInput = FocusChangeReason::SCB_SESSION_REQUEST;
1358     WMError result02 = ssm_->RequestFocusStatus(persistentId, true, true, reasonInput);
1359     EXPECT_EQ(result02, WMError::WM_ERROR_NULLPTR);
1360     reasonResult = ssm_->GetFocusChangeReason();
1361     EXPECT_EQ(reasonResult, FocusChangeReason::DEFAULT);
1362 
1363     reasonInput = FocusChangeReason::SPLIT_SCREEN;
1364     WMError result03 = ssm_->RequestFocusStatus(persistentId, false, true, reasonInput);
1365     EXPECT_EQ(result03, WMError::WM_ERROR_NULLPTR);
1366     reasonResult = ssm_->GetFocusChangeReason();
1367     EXPECT_EQ(reasonResult, FocusChangeReason::DEFAULT);
1368 }
1369 
1370 /**
1371  * @tc.name: RequestFocusStatusBySA
1372  * @tc.desc: SceneSesionManager request focus status by SA
1373  * @tc.type: FUNC
1374  */
1375 HWTEST_F(SceneSessionManagerTest3, RequestFocusStatusBySA, Function | SmallTest | Level3)
1376 {
1377     int32_t persistentId = 3;
1378     bool isFocused = true;
1379     bool byForeground = true;
1380     FocusChangeReason reason = FocusChangeReason::CLICK;
1381     auto result = ssm_->SceneSessionManager::RequestFocusStatusBySA(
1382         persistentId, isFocused, byForeground, reason);
1383     ASSERT_EQ(result, WMError::WM_ERROR_INVALID_PERMISSION);
1384 }
1385 
1386 /**
1387  * @tc.name: NotifyRequestFocusStatusNotifyManager
1388  * @tc.desc: NotifyRequestFocusStatusNotifyManager test.
1389  * @tc.type: FUNC
1390  */
1391 HWTEST_F(SceneSessionManagerTest3, NotifyRequestFocusStatusNotifyManager, Function | SmallTest | Level3)
1392 {
1393     SessionInfo info;
1394     info.abilityName_ = "NotifyRequestFocusStatusNotifyManager";
1395     info.bundleName_ = "NotifyRequestFocusStatusNotifyManager";
1396     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1397     EXPECT_NE(sceneSession, nullptr);
1398     ssm_->RegisterRequestFocusStatusNotifyManagerFunc(sceneSession);
1399 
1400     FocusChangeReason reasonInput = FocusChangeReason::DEFAULT;
1401     sceneSession->NotifyRequestFocusStatusNotifyManager(true, true, reasonInput);
1402     FocusChangeReason reasonResult = ssm_->GetFocusChangeReason();
1403 
1404     ASSERT_EQ(reasonInput, reasonResult);
1405 }
1406 
1407 /**
1408  * @tc.name: GetTopNearestBlockingFocusSession
1409  * @tc.desc: SceneSesionManager Gets the most recent session whose blockingType property is true
1410  * @tc.type: FUNC
1411  */
1412 HWTEST_F(SceneSessionManagerTest3, GetTopNearestBlockingFocusSession, Function | SmallTest | Level3)
1413 {
1414     uint32_t zOrder = 9999;
1415     sptr<SceneSession> session = ssm_->GetTopNearestBlockingFocusSession(DEFAULT_DISPLAY_ID, zOrder, true);
1416     EXPECT_EQ(session, nullptr);
1417 
1418     session = ssm_->GetTopNearestBlockingFocusSession(DEFAULT_DISPLAY_ID, zOrder, false);
1419     EXPECT_EQ(session, nullptr);
1420 }
1421 
1422 /**
1423  * @tc.name: RaiseWindowToTop
1424  * @tc.desc: SceneSesionManager raise window to top
1425  * @tc.type: FUNC
1426  */
1427 HWTEST_F(SceneSessionManagerTest3, RaiseWindowToTop, Function | SmallTest | Level3)
1428 {
1429     int32_t focusedSession = ssm_->GetFocusedSessionId();
1430     EXPECT_EQ(focusedSession, 10086);
1431     int32_t persistentId = INVALID_SESSION_ID;
1432     WSError result01 = ssm_->RaiseWindowToTop(persistentId);
1433     EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_PERMISSION);
1434     persistentId = 10000;
1435     WSError result02 = ssm_->RaiseWindowToTop(persistentId);
1436     EXPECT_EQ(result02, WSError::WS_ERROR_INVALID_PERMISSION);
1437     WSError result03 = ssm_->RaiseWindowToTop(persistentId);
1438     EXPECT_EQ(result03, WSError::WS_ERROR_INVALID_PERMISSION);
1439 }
1440 
1441 /**
1442  * @tc.name: ShiftAppWindowFocus
1443  * @tc.desc: SceneSesionManager shift app window focus
1444  * @tc.type: FUNC
1445  */
1446 HWTEST_F(SceneSessionManagerTest3, ShiftAppWindowFocus, Function | SmallTest | Level3)
1447 {
1448     int32_t focusedSession = ssm_->GetFocusedSessionId();
1449     EXPECT_EQ(focusedSession, 10086);
1450     int32_t sourcePersistentId = 1;
1451     int32_t targetPersistentId = 10086;
1452     WSError result01 = ssm_->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId);
1453     EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_SESSION);
1454     SessionInfo info;
1455     info.abilityName_ = "ShiftAppWindowFocus";
1456     info.bundleName_ = "ShiftAppWindowFocus";
1457     auto sourceSceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1458     sourceSceneSession->persistentId_ = 1;
1459     sourceSceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1460     ssm_->sceneSessionMap_.insert(std::make_pair(1, sourceSceneSession));
1461     result01 = ssm_->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId);
1462     EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_OPERATION);
1463 
1464     auto targetSceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1465     targetSceneSession->persistentId_ = 10086;
1466     targetSceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1467     ssm_->sceneSessionMap_.insert(std::make_pair(10086, targetSceneSession));
1468     result01 = ssm_->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId);
1469     EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_OPERATION);
1470     sourcePersistentId = 10086;
1471     WSError result02 = ssm_->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId);
1472     EXPECT_EQ(result02, WSError::WS_DO_NOTHING);
1473 }
1474 
1475 /**
1476  * @tc.name: RegisterSessionExceptionFunc
1477  * @tc.desc: SceneSesionManager register session expection func
1478  * @tc.type: FUNC
1479  */
1480 HWTEST_F(SceneSessionManagerTest3, RegisterSessionExceptionFunc, Function | SmallTest | Level3)
1481 {
1482     SessionInfo info;
1483     info.abilityName_ = "RegisterSessionExceptionFunc";
1484     info.bundleName_ = "RegisterSessionExceptionFunc";
1485     sptr<SceneSession> sceneSession = nullptr;
1486     ssm_->RegisterSessionExceptionFunc(sceneSession);
1487     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1488     ASSERT_NE(nullptr, sceneSession);
1489     ssm_->RegisterSessionExceptionFunc(sceneSession);
1490     bool result01 = ssm_->IsSessionVisibleForeground(sceneSession);
1491     EXPECT_FALSE(result01);
1492 }
1493 
1494 /**
1495  * @tc.name: DumpSessionInfo
1496  * @tc.desc: SceneSesionManager dump session info
1497  * @tc.type: FUNC
1498  */
1499 HWTEST_F(SceneSessionManagerTest3, DumpSessionInfo, Function | SmallTest | Level3)
1500 {
1501     SessionInfo info;
1502     std::ostringstream oss;
1503     std::string dumpInfo;
1504     info.abilityName_ = "DumpSessionInfo";
1505     info.bundleName_ = "DumpSessionInfo";
1506     info.isSystem_ = false;
1507     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1508     ASSERT_NE(nullptr, sceneSession);
1509     ssm_->DumpSessionInfo(sceneSession, oss);
1510     EXPECT_FALSE(sceneSession->IsVisible());
1511 
1512     sptr<SceneSession::SpecificSessionCallback> specific = sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1513     EXPECT_NE(nullptr, specific);
1514     sceneSession = sptr<SceneSession>::MakeSptr(info, specific);
1515     ASSERT_NE(nullptr, sceneSession);
1516     ssm_->DumpSessionInfo(sceneSession, oss);
1517     EXPECT_FALSE(sceneSession->IsVisible());
1518     sceneSession = nullptr;
1519     info.isSystem_ = true;
1520     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1521     ssm_->DumpSessionInfo(sceneSession, oss);
1522 }
1523 
1524 /**
1525  * @tc.name: DumpSessionElementInfo
1526  * @tc.desc: SceneSesionManager dump session element info
1527  * @tc.type: FUNC
1528  */
1529 HWTEST_F(SceneSessionManagerTest3, DumpSessionElementInfo, Function | SmallTest | Level3)
1530 {
1531     DumpRootSceneElementInfoFunc func_ = DumpRootSceneElementInfoFuncTest;
1532     ssm_->SetDumpRootSceneElementInfoListener(func_);
1533     SessionInfo info;
1534     info.abilityName_ = "DumpSessionElementInfo";
1535     info.bundleName_ = "DumpSessionElementInfo";
1536     info.isSystem_ = false;
1537     std::string strId = "10086";
1538     sptr<SceneSession> sceneSession = nullptr;
1539     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1540     ASSERT_NE(nullptr, sceneSession);
1541     std::vector<std::string> params_(5, "");
1542     std::string dumpInfo;
1543     ssm_->DumpSessionElementInfo(sceneSession, params_, dumpInfo);
1544     sceneSession = nullptr;
1545     info.isSystem_ = true;
1546     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1547     ASSERT_NE(nullptr, sceneSession);
1548     ssm_->DumpSessionElementInfo(sceneSession, params_, dumpInfo);
1549     WSError result01 = ssm_->GetSpecifiedSessionDumpInfo(dumpInfo, params_, strId);
1550     EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_PARAM);
1551 }
1552 
1553 /**
1554  * @tc.name: NotifyDumpInfoResult
1555  * @tc.desc: SceneSesionManager notify dump info result
1556  * @tc.type: FUNC
1557  */
1558 HWTEST_F(SceneSessionManagerTest3, NotifyDumpInfoResult, Function | SmallTest | Level3)
1559 {
1560     std::vector<std::string> info = {"std::", "vector", "<std::string>"};
1561     ssm_->NotifyDumpInfoResult(info);
1562     std::vector<std::string> params = {"-a"};
1563     std::string dumpInfo = "";
1564     WSError result01 = ssm_->GetSessionDumpInfo(params, dumpInfo);
1565     EXPECT_EQ(result01, WSError::WS_OK);
1566     params.clear();
1567     params.push_back("-w");
1568     params.push_back("23456");
1569     WSError result02 = ssm_->GetSessionDumpInfo(params, dumpInfo);
1570     EXPECT_NE(result02, WSError::WS_OK);
1571     params.clear();
1572     WSError result03 = ssm_->GetSessionDumpInfo(params, dumpInfo);
1573     EXPECT_NE(result03, WSError::WS_OK);
1574 }
1575 
1576 /**
1577  * @tc.name: UpdateFocus
1578  * @tc.desc: SceneSesionManager update focus
1579  * @tc.type: FUNC
1580  */
1581 HWTEST_F(SceneSessionManagerTest3, UpdateFocus, Function | SmallTest | Level3)
1582 {
1583     int32_t persistentId = 10086;
1584     SessionInfo info;
1585     info.bundleName_ = "bundleName_";
1586     bool isFocused = true;
1587     WSError result = ssm_->UpdateFocus(persistentId, isFocused);
1588     ASSERT_EQ(result, WSError::WS_OK);
1589 }
1590 
1591 /**
1592  * @tc.name: UpdateWindowMode
1593  * @tc.desc: SceneSesionManager update window mode
1594  * @tc.type: FUNC
1595  */
1596 HWTEST_F(SceneSessionManagerTest3, UpdateWindowMode, Function | SmallTest | Level3)
1597 {
1598     int32_t persistentId = 10086;
1599     int32_t windowMode = 3;
1600     WSError result = ssm_->UpdateWindowMode(persistentId, windowMode);
1601     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_WINDOW);
__anonc10c36570502(int32_t persistentId, WindowUpdateType type) 1602     WindowChangedFunc func = [](int32_t persistentId, WindowUpdateType type) {
1603         OHOS::Rosen::WindowChangedFuncTest(persistentId, type);
1604     };
1605     ssm_->RegisterWindowChanged(func);
1606 }
1607 
1608 /**
1609  * @tc.name: SetScreenLocked && IsScreenLocked
1610  * @tc.desc: SceneSesionManager update screen locked state
1611  * @tc.type: FUNC
1612  */
1613 HWTEST_F(SceneSessionManagerTest3, IsScreenLocked, Function | SmallTest | Level3)
1614 {
1615     ssm_->sceneSessionMap_.clear();
1616     ssm_->SetScreenLocked(true);
1617     sleep(1);
1618     EXPECT_TRUE(ssm_->IsScreenLocked());
1619     ssm_->SetScreenLocked(false);
1620     sleep(1);
1621     EXPECT_FALSE(ssm_->IsScreenLocked());
1622 }
1623 
1624 /**
1625  * @tc.name: UpdatePrivateStateAndNotify
1626  * @tc.desc: SceneSesionManager update private state and notify
1627  * @tc.type: FUNC
1628  */
1629 HWTEST_F(SceneSessionManagerTest3, UpdatePrivateStateAndNotify, Function | SmallTest | Level3)
1630 {
1631     int32_t persistentId = 10086;
1632     SessionInfo info;
1633     info.bundleName_ = "bundleName";
1634     sptr<SceneSession> sceneSession = nullptr;
1635     ssm_->RegisterSessionStateChangeNotifyManagerFunc(sceneSession);
1636     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1637     ASSERT_NE(sceneSession, nullptr);
1638     ssm_->RegisterSessionStateChangeNotifyManagerFunc(sceneSession);
1639     ssm_->UpdatePrivateStateAndNotify(persistentId);
1640     auto displayId = sceneSession->GetSessionProperty()->GetDisplayId();
1641     std::unordered_set<string> privacyBundleList;
1642     ssm_->GetSceneSessionPrivacyModeBundles(displayId, privacyBundleList);
1643     EXPECT_EQ(privacyBundleList.size(), 0);
1644 }
1645 
1646 /**
1647  * @tc.name: UpdatePrivateStateAndNotifyForAllScreens
1648  * @tc.desc: SceneSesionManager update private state and notify for all screens
1649  * @tc.type: FUNC
1650  */
1651 HWTEST_F(SceneSessionManagerTest3, UpdatePrivateStateAndNotifyForAllScreens, Function | SmallTest | Level3)
1652 {
1653     SessionInfo info;
1654     info.bundleName_ = "bundleName";
1655     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1656     ASSERT_NE(sceneSession, nullptr);
1657 
1658     ssm_->UpdatePrivateStateAndNotifyForAllScreens();
1659     auto displayId = sceneSession->GetSessionProperty()->GetDisplayId();
1660     std::unordered_set<std::string> privacyBundleList;
1661     ssm_->GetSceneSessionPrivacyModeBundles(displayId, privacyBundleList);
1662     EXPECT_EQ(privacyBundleList.size(), 0);
1663 }
1664 
1665 /**
1666  * @tc.name: GerPrivacyBundleListOneWindow
1667  * @tc.desc: get privacy bundle list when one window exist only.
1668  * @tc.type: FUNC
1669  */
1670 HWTEST_F(SceneSessionManagerTest3, GerPrivacyBundleListOneWindow, Function | SmallTest | Level3)
1671 {
1672     SessionInfo sessionInfo;
1673     sessionInfo.bundleName_ = "privacy.test";
1674     sessionInfo.abilityName_ = "privacyAbilityName";
1675     sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(sessionInfo, nullptr);
1676     ASSERT_NE(sceneSession, nullptr);
1677 
1678     sceneSession->GetSessionProperty()->displayId_ = 0;
1679     sceneSession->GetSessionProperty()->isPrivacyMode_ = true;
1680     sceneSession->state_ = SessionState::STATE_FOREGROUND;
1681     ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
1682 
1683     std::unordered_set<std::string> privacyBundleList;
1684     sceneSession->GetSessionProperty()->isPrivacyMode_ = false;
1685     privacyBundleList.clear();
1686     ssm_->GetSceneSessionPrivacyModeBundles(0, privacyBundleList);
1687     EXPECT_EQ(privacyBundleList.size(), 0);
1688 
1689     sceneSession->GetSessionProperty()->isPrivacyMode_ = true;
1690     sceneSession->state_ = SessionState::STATE_BACKGROUND;
1691     privacyBundleList.clear();
1692     ssm_->GetSceneSessionPrivacyModeBundles(0, privacyBundleList);
1693     EXPECT_EQ(privacyBundleList.size(), 0);
1694 
1695     sceneSession->GetSessionProperty()->isPrivacyMode_ = true;
1696     sceneSession->state_ = SessionState::STATE_FOREGROUND;
1697     privacyBundleList.clear();
1698     ssm_->GetSceneSessionPrivacyModeBundles(0, privacyBundleList);
1699     EXPECT_EQ(privacyBundleList.size(), 1);
1700 
1701     privacyBundleList.clear();
1702     ssm_->GetSceneSessionPrivacyModeBundles(1, privacyBundleList);
1703     EXPECT_EQ(privacyBundleList.size(), 0);
1704 }
1705 
1706 /**
1707  * @tc.name: GetTopWindowId
1708  * @tc.desc: get top window id by main window id.
1709  * @tc.type: FUNC
1710  */
1711 HWTEST_F(SceneSessionManagerTest3, GetTopWindowId, Function | SmallTest | Level3)
1712 {
1713     SessionInfo sessionInfo1;
1714     sessionInfo1.bundleName_ = "mainWin";
1715     sessionInfo1.abilityName_ = "mainAbilityName";
1716     sessionInfo1.persistentId_ = 100;
1717     auto sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
1718     ASSERT_NE(sceneSession1, nullptr);
1719     sceneSession1->SetCallingPid(65534);
1720     ssm_->sceneSessionMap_.insert({100, sceneSession1});
1721 
1722     SessionInfo sessionInfo2;
1723     sessionInfo2.bundleName_ = "subWin1";
1724     sessionInfo2.abilityName_ = "subAbilityName1";
1725     sessionInfo2.persistentId_ = 101;
1726     auto sceneSession2 = sptr<SceneSession>::MakeSptr(sessionInfo2, nullptr);
1727     ASSERT_NE(sceneSession2, nullptr);
1728     sceneSession2->SetCallingPid(65535);
1729     ssm_->sceneSessionMap_.insert({101, sceneSession2});
1730 
1731     SessionInfo sessionInfo3;
1732     sessionInfo3.bundleName_ = "subWin2";
1733     sessionInfo3.abilityName_ = "subAbilityName2";
1734     sessionInfo3.persistentId_ = 102;
1735     auto sceneSession3 = sptr<SceneSession>::MakeSptr(sessionInfo3, nullptr);
1736     ASSERT_NE(sceneSession3, nullptr);
1737     sceneSession3->SetCallingPid(65534);
1738     ssm_->sceneSessionMap_.insert({102, sceneSession3});
1739 
1740     sceneSession1->AddSubSession(sceneSession2);
1741     sceneSession1->AddSubSession(sceneSession3);
1742     uint32_t topWinId;
1743     ASSERT_NE(ssm_->GetTopWindowId(static_cast<uint32_t>(sceneSession1->GetPersistentId()), topWinId),
1744         WMError::WM_ERROR_INVALID_WINDOW);
1745 }
1746 
1747 /**
1748  * @tc.name: ConfigWindowImmersive
1749  * @tc.desc: ConfigWindowImmersive SwitchFreeMultiWindow
1750  * @tc.type: FUNC
1751  */
1752 HWTEST_F(SceneSessionManagerTest3, ConfigWindowImmersive01, Function | SmallTest | Level3)
1753 {
1754     WindowSceneConfig::ConfigItem immersiveConfig;
1755     immersiveConfig.boolValue_ = false;
1756     ASSERT_NE(ssm_, nullptr);
1757     ssm_->ConfigWindowImmersive(immersiveConfig);
1758 
1759     ASSERT_NE(ssm_->SwitchFreeMultiWindow(false), WSError::WS_OK);
1760     SystemSessionConfig systemConfig;
1761     systemConfig.freeMultiWindowSupport_ = true;
1762     ssm_->SwitchFreeMultiWindow(false);
1763 }
1764 
1765 /**
1766  * @tc.name: ConfigDecor
1767  * @tc.desc: SceneSesionManager config decor
1768  * @tc.type: FUNC
1769  */
1770 HWTEST_F(SceneSessionManagerTest3, ConfigDecor02, Function | SmallTest | Level3)
1771 {
1772     ASSERT_NE(ssm_, nullptr);
1773     WindowSceneConfig::ConfigItem* item = new WindowSceneConfig::ConfigItem;
1774     ASSERT_NE(item, nullptr);
1775     ssm_->ConfigDecor(*item, false);
1776     delete item;
1777 }
1778 
1779 /**
1780  * @tc.name: ConfigAppWindowShadow
1781  * @tc.desc: SceneSesionManager config app window shadow
1782  * @tc.type: FUNC
1783  */
1784 HWTEST_F(SceneSessionManagerTest3, ConfigAppWindowShadow02, Function | SmallTest | Level3)
1785 {
1786     WindowSceneConfig::ConfigItem item;
1787     WindowSceneConfig::ConfigItem shadowConfig;
1788     WindowShadowConfig outShadow;
1789     std::vector<float> floatTest = {};
1790     bool result = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
1791     ASSERT_EQ(result, true);
1792 
1793     item.SetValue(floatTest);
1794     shadowConfig.SetValue({{"radius", item}});
1795     result = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
1796     ASSERT_EQ(result, false);
1797 
1798     item.SetValue(new std::string(""));
1799     shadowConfig.SetValue({{"", item}});
1800     result = ssm_->ConfigAppWindowShadow(shadowConfig, outShadow);
1801     ASSERT_EQ(result, true);
1802 }
1803 
1804 /**
1805  * @tc.name: ConfigWindowAnimation
1806  * @tc.desc: SceneSesionManager config window animation
1807  * @tc.type: FUNC
1808  */
1809 HWTEST_F(SceneSessionManagerTest3, ConfigWindowAnimation02, Function | SmallTest | Level3)
1810 {
1811     WindowSceneConfig::ConfigItem windowAnimationConfig;
1812     WindowSceneConfig::ConfigItem item;
1813     std::vector<float> rotation = {0.1f, 0.2f, 0.3f, 0.4f};
1814     ASSERT_NE(ssm_, nullptr);
1815 
1816     item.SetValue(rotation);
1817     item.SetValue({{"curve", item}});
1818     windowAnimationConfig.SetValue({{"timing", item}});
1819     ssm_->ConfigWindowAnimation(windowAnimationConfig);
1820 }
1821 
1822 /**
1823  * @tc.name: ConfigStartingWindowAnimation
1824  * @tc.desc: SceneSesionManager config start window animation
1825  * @tc.type: FUNC
1826  */
1827 HWTEST_F(SceneSessionManagerTest3, ConfigStartingWindowAnimation02, Function | SmallTest | Level3)
1828 {
1829     std::vector<float> midFloat = {0.1f};
1830     std::vector<int> midInt = {1};
1831     ASSERT_NE(ssm_, nullptr);
1832     WindowSceneConfig::ConfigItem middleFloat;
1833     middleFloat.SetValue(midFloat);
1834     ssm_->ConfigStartingWindowAnimation(middleFloat);
1835     WindowSceneConfig::ConfigItem middleInt;
1836     middleInt.SetValue(midInt);
1837     ssm_->ConfigStartingWindowAnimation(middleInt);
1838 
1839     WindowSceneConfig::ConfigItem curve;
1840     curve.SetValue(midFloat);
1841     curve.SetValue({{"curve", curve}});
1842     ssm_->ConfigStartingWindowAnimation(curve);
1843 }
1844 
1845 /**
1846  * @tc.name: ConfigMainWindowSizeLimits
1847  * @tc.desc: call ConfigMainWindowSizeLimits and check the systemConfig_.
1848  * @tc.type: FUNC
1849  */
1850 HWTEST_F(SceneSessionManagerTest3, ConfigMainWindowSizeLimits02, Function | SmallTest | Level3)
1851 {
1852     ASSERT_NE(ssm_, nullptr);
1853     std::vector<int> maInt = {1, 2, 3, 4};
1854     WindowSceneConfig::ConfigItem mainleInt;
1855     mainleInt.SetValue(maInt);
1856     mainleInt.SetValue({{"miniWidth", mainleInt}});
1857     ssm_->ConfigMainWindowSizeLimits(mainleInt);
1858     mainleInt.ClearValue();
1859 
1860     std::vector<float> maFloat = {0.1f};
1861     WindowSceneConfig::ConfigItem mainFloat;
1862     mainFloat.SetValue(maFloat);
1863     mainFloat.SetValue({{"miniWidth", mainFloat}});
1864     ssm_->ConfigMainWindowSizeLimits(mainFloat);
1865     mainFloat.ClearValue();
1866 
1867     WindowSceneConfig::ConfigItem mainleInt02;
1868     mainleInt02.SetValue(maInt);
1869     mainleInt02.SetValue({{"miniHeight", mainleInt02}});
1870     ssm_->ConfigMainWindowSizeLimits(mainleInt02);
1871 
1872     WindowSceneConfig::ConfigItem mainFloat02;
1873     mainFloat02.SetValue(maFloat);
1874     mainFloat02.SetValue({{"miniHeight", mainFloat02}});
1875     ssm_->ConfigMainWindowSizeLimits(mainFloat02);
1876 }
1877 
1878 /**
1879  * @tc.name: ConfigSubWindowSizeLimits
1880  * @tc.desc: call ConfigSubWindowSizeLimits
1881  * @tc.type: FUNC
1882  */
1883 HWTEST_F(SceneSessionManagerTest3, ConfigSubWindowSizeLimits02, Function | SmallTest | Level3)
1884 {
1885     ASSERT_NE(ssm_, nullptr);
1886     std::vector<int> subInt = {1, 2, 3, 4};
1887     WindowSceneConfig::ConfigItem subleInt;
1888     subleInt.SetValue(subInt);
1889     subleInt.SetValue({{"miniWidth", subleInt}});
1890     ssm_->ConfigSubWindowSizeLimits(subleInt);
1891     subleInt.ClearValue();
1892 
1893     std::vector<float> subFloat = {0.1f};
1894     WindowSceneConfig::ConfigItem mainFloat;
1895     mainFloat.SetValue(subFloat);
1896     mainFloat.SetValue({{"miniWidth", mainFloat}});
1897     ssm_->ConfigSubWindowSizeLimits(mainFloat);
1898     mainFloat.ClearValue();
1899 
1900     WindowSceneConfig::ConfigItem subleInt02;
1901     subleInt02.SetValue(subInt);
1902     subleInt02.SetValue({{"miniHeight", subleInt02}});
1903     ssm_->ConfigSubWindowSizeLimits(subleInt02);
1904 
1905     WindowSceneConfig::ConfigItem mainFloat02;
1906     mainFloat02.SetValue(subFloat);
1907     mainFloat02.SetValue({{"miniHeight", mainFloat02}});
1908     ssm_->ConfigSubWindowSizeLimits(mainFloat02);
1909 }
1910 
1911 /**
1912  * @tc.name: ConfigDialogWindowSizeLimits
1913  * @tc.desc: call ConfigDialogWindowSizeLimits
1914  * @tc.type: FUNC
1915  */
1916 HWTEST_F(SceneSessionManagerTest3, ConfigDialogWindowSizeLimits01, Function | SmallTest | Level3)
1917 {
1918     ASSERT_NE(ssm_, nullptr);
1919     std::vector<int> subInt = {1, 2, 3, 4};
1920     WindowSceneConfig::ConfigItem subleInt;
1921     subleInt.SetValue(subInt);
1922     subleInt.SetValue({{"miniWidth", subleInt}});
1923     ssm_->ConfigDialogWindowSizeLimits(subleInt);
1924     subleInt.ClearValue();
1925 
1926     std::vector<float> subFloat = {0.1f};
1927     WindowSceneConfig::ConfigItem mainFloat;
1928     mainFloat.SetValue(subFloat);
1929     mainFloat.SetValue({{"miniWidth", mainFloat}});
1930     ssm_->ConfigDialogWindowSizeLimits(mainFloat);
1931     mainFloat.ClearValue();
1932 
1933     WindowSceneConfig::ConfigItem subleInt02;
1934     subleInt02.SetValue(subInt);
1935     subleInt02.SetValue({{"miniHeight", subleInt02}});
1936     ssm_->ConfigDialogWindowSizeLimits(subleInt02);
1937 
1938     WindowSceneConfig::ConfigItem mainFloat02;
1939     mainFloat02.SetValue(subFloat);
1940     mainFloat02.SetValue({{"miniHeight", mainFloat02}});
1941     ssm_->ConfigDialogWindowSizeLimits(mainFloat02);
1942 }
1943 }
1944 } // namespace Rosen
1945 } // namespace OHOS