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 #ifndef OHOS_ROSEN_SCREEN_SESSION_DUMPER_H
17 #define OHOS_ROSEN_SCREEN_SESSION_DUMPER_H
18 
19 #include <string>
20 #include <locale>
21 #include <codecvt>
22 #include <vector>
23 #include <set>
24 #include <refbase.h>
25 
26 #include "event_tracker.h"
27 #include "dm_common.h"
28 #include "window_manager_hilog.h"
29 #include "screen_session_manager.h"
30 #include "screen_rotation_property.h"
31 
32 namespace OHOS {
33 namespace Rosen {
34 
35 class ScreenSessionDumper : public RefBase {
36 public:
37     ScreenSessionDumper(int fd, const std::vector<std::u16string>& args);
38     ~ScreenSessionDumper() = default;
39 
40     bool IsNumber(std::string str);
41     void ExcuteDumpCmd();
42     void DumpEventTracker(EventTracker& tracker);
43     void DumpFreezedPidList(std::set<int32_t> pidList);
44     void DumpMultiUserInfo(std::vector<int32_t> oldScbPids, int32_t userId, int32_t ScbPid);
45 
46 private:
47     void ShowHelpInfo();
48     void ShowAllScreenInfo();
49     void DumpFoldStatus();
50     void DumpTentMode();
51     void OutputDumpInfo();
52     void DumpScreenSessionById(ScreenId id);
53     void DumpRsInfoById(ScreenId id);
54     void DumpRsInfoById01(sptr<ScreenSession> screenSession);
55     void DumpCutoutInfoById(ScreenId id);
56     void DumpScreenInfoById(ScreenId id);
57     void DumpScreenPropertyById(ScreenId id);
58     void ExcuteInjectCmd();
59     void ExcuteInjectCmd2();
60 /*
61     hidumper 命令注入隔离
62 */
63     void ShowNotifyFoldStatusChangedInfo();
64     void ShowIllegalArgsInfo();
65     void SetMotionSensorvalue(std::string input);
66     void SetRotationLockedvalue(std::string input);
67     void SetEnterOrExitTentMode(std::string input);
68     void SetHoverStatusChange(std::string input);
69     bool IsValidDisplayModeCommand(std::string command);
70     int SetFoldDisplayMode();
71     int SetFoldStatusLocked();
72     void SetHallAndPostureValue(std::string input);
73     void SetHallAndPostureStatus(std::string input);
74 private:
75     int fd_;
76     std::vector<std::string> params_;
77     std::string dumpInfo_;
78 /*
79     依赖的外部定义
80 */
81 private:
82     typedef struct EXTHALLData {
83         float flag = 0.0;
84         float hall = 0.0;
85     } ExtHallData;
86 };
87 } // Rosen
88 } // OHOS
89 #endif // OHOS_ROSEN_SCREEN_SESSION_DUMPER_H