/* * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_DM_DIALOG_MANAGER_H #define OHOS_DM_DIALOG_MANAGER_H #include #include #include "ability_connect_callback_interface.h" #include "ability_connect_callback_stub.h" #include "dm_single_instance.h" namespace OHOS { namespace DistributedHardware { class DmDialogManager { DM_DECLARE_SINGLE_INSTANCE_BASE(DmDialogManager); public: void ConnectExtension(); void ShowConfirmDialog(const std::string param); void ShowPinDialog(const std::string param); void ShowInputDialog(const std::string param); void CloseDialog(); void OnAbilityConnectDone( const AppExecFwk::ElementName& element, const sptr& remoteObject, int resultCode); void OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int resultCode); private: DmDialogManager(); ~DmDialogManager(); void SendMsgRequest(const sptr& remoteObject); class DialogAbilityConnection : public OHOS::AAFwk::AbilityConnectionStub { public: void OnAbilityConnectDone( const AppExecFwk::ElementName& element, const sptr& remoteObject, int resultCode) override; void OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int resultCode) override; }; std::string bundleName_; std::string abilityName_; std::string deviceName_; std::string targetDeviceName_; std::string appOperationStr_; std::string customDescriptionStr_; std::string pinCode_; std::string hostPkgLabel_; int32_t deviceType_ = -1; bool isProxyBind_ = false; std::string appUserData_; std::string title_; std::mutex mutex_; sptr dialogConnectionCallback_ = nullptr; sptr g_remoteObject = nullptr; std::atomic isConnectSystemUI_{false}; std::atomic isCloseDialog_{false}; }; } // namespace DistributedHardware } // namespace OHOS #endif