1 /* 2 * Copyright (c) 2023 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_MOCK_SCREEN_MANAGER_SERVICE_H 17 #define OHOS_ROSEN_MOCK_SCREEN_MANAGER_SERVICE_H 18 19 #include <system_ability.h> 20 #include <iremote_object.h> 21 22 #include "dm_common.h" 23 #include "singleton_delegator.h" 24 #include "zidl/mock_screen_manager_service_stub.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 class MockScreenManagerService : public SystemAbility, public MockScreenManagerServiceStub { 29 DECLARE_SYSTEM_ABILITY(MockScreenManagerService); 30 WM_DECLARE_SINGLE_INSTANCE_BASE(MockScreenManagerService); 31 public: 32 void OnStart() override; 33 void GetScreenDumpInfo(const std::vector<std::string>& params, std::string& info) override; 34 int Dump(int fd, const std::vector<std::u16string>& args) override; 35 bool RegisterMockScreenManagerService(); 36 void SetSessionManagerService(const sptr<IRemoteObject>& sessionManagerService); 37 protected: 38 MockScreenManagerService(); 39 virtual ~MockScreenManagerService() = default; 40 private: 41 void ShowHelpInfo(std::string& dumpInfo); 42 void ShowIllegalArgsInfo(std::string& dumpInfo); 43 int DumpScreenInfo(const std::vector<std::string>& args, std::string& dumpInfo); 44 int DumpAllScreenInfo(std::string& dumpInfo); 45 int DumpSpecifiedScreenInfo(ScreenId screenId, std::string& dumpInfo); 46 bool IsValidDigitString(const std::string& idStr) const; 47 48 void InitScreenSessionManager(); 49 50 static inline SingletonDelegator<MockScreenManagerService> delegator; 51 sptr<IRemoteObject> sessionManagerService_ = nullptr; 52 sptr<IRemoteObject> screenSessionManager_ = nullptr; 53 }; 54 } // namespace Rosen 55 } // namespace OHOS 56 #endif // OHOS_ROSEN_MOCK_SCREEN_MANAGER_SERVICE_H