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_SESSION_MANAGER_SERVICE_H 17 #define OHOS_ROSEN_MOCK_SESSION_MANAGER_SERVICE_H 18 19 #include <system_ability.h> 20 21 #include "wm_single_instance.h" 22 #include "zidl/mock_session_manager_service_stub.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class MockSessionManagerService : public SystemAbility, public MockSessionManagerServiceStub { 27 DECLARE_SYSTEM_ABILITY(MockSessionManagerService); 28 WM_DECLARE_SINGLE_INSTANCE_BASE(MockSessionManagerService); 29 public: 30 bool SetSessionManagerService(const sptr<IRemoteObject>& sessionManagerService); 31 sptr<IRemoteObject> GetSessionManagerService() override; 32 sptr<IRemoteObject> GetSceneSessionManager(); 33 void OnStart() override; 34 int Dump(int fd, const std::vector<std::u16string> &args) override; 35 36 protected: 37 MockSessionManagerService(); 38 virtual ~MockSessionManagerService() = default; 39 40 private: 41 bool RegisterMockSessionManagerService(); 42 int DumpSessionInfo(const std::vector<std::string>& args, std::string& dumpInfo); 43 void ShowHelpInfo(std::string& dumpInfo); 44 void ShowAceDumpHelp(std::string& dumpInfo); 45 void ShowIllegalArgsInfo(std::string& dumpInfo); 46 47 class SMSDeathRecipient : public IRemoteObject::DeathRecipient { 48 public: 49 void OnRemoteDied(const wptr<IRemoteObject>& object) override; 50 }; 51 52 sptr<IRemoteObject> sessionManagerService_; 53 sptr<IRemoteObject> sceneSessionManager_; 54 sptr<SMSDeathRecipient> smsDeathRecipient_; 55 }; 56 } // namespace Rosen 57 } // namespace OHOS 58 59 #endif // OHOS_ROSEN_MOCK_SESSION_MANAGER_SERVICE_H 60