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 WINDOW_MANAGER_MODAL_SYSTEM_UI_EXTENSION_H 17 #define WINDOW_MANAGER_MODAL_SYSTEM_UI_EXTENSION_H 18 19 #include <mutex> 20 #include <string> 21 #include <element_name.h> 22 #include <ability_connect_callback_interface.h> 23 #include <ability_connect_callback_stub.h> 24 25 namespace OHOS { 26 namespace Rosen { 27 class ModalSystemUiExtension { 28 public: 29 ModalSystemUiExtension(); 30 ~ModalSystemUiExtension(); 31 32 bool CreateModalUIExtension(const AAFwk::Want& want); 33 static std::string ToString(const AAFwk::WantParams& wantParams_); 34 35 private: 36 class DialogAbilityConnection : public OHOS::AAFwk::AbilityConnectionStub { 37 public: DialogAbilityConnection(const AAFwk::Want & want)38 DialogAbilityConnection(const AAFwk::Want& want) 39 { 40 want_ = want; 41 } 42 virtual ~DialogAbilityConnection() = default; 43 44 void OnAbilityConnectDone(const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, 45 int resultCode) override; 46 void OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int resultCode) override; 47 48 private: 49 std::mutex mutex_; 50 AAFwk::Want want_; 51 }; 52 53 sptr<OHOS::AAFwk::IAbilityConnection> dialogConnectionCallback_{ nullptr }; 54 }; 55 } // namespace Rosen 56 } // namespace OHOS 57 58 #endif // WINDOW_MANAGER_MODAL_SYSTEM_UI_EXTENSION_H