/* * Copyright (c) 2023 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 PINAUTH_REGISTER_IMPL_H #define PINAUTH_REGISTER_IMPL_H #include #include #include "iremote_object.h" #include "nocopyable.h" #include "pinauth_register.h" #include "pin_auth_interface.h" namespace OHOS { namespace UserIam { namespace PinAuth { class PinAuthRegisterImpl : public PinAuthRegister, public NoCopyable { public: static PinAuthRegisterImpl& Instance(); bool RegisterInputer(std::shared_ptr inputer) override; void UnRegisterInputer() override; private: PinAuthRegisterImpl() = default; ~ PinAuthRegisterImpl() override = default; class PinAuthDeathRecipient : public IRemoteObject::DeathRecipient, public NoCopyable { public: PinAuthDeathRecipient() = default; ~PinAuthDeathRecipient() override = default; void OnRemoteDied(const wptr& remote) override; }; void ResetProxy(const wptr& remote); sptr GetProxy(); sptr proxy_ {nullptr}; sptr deathRecipient_ {nullptr}; std::mutex mutex_; }; } // namespace PinAuth } // namespace UserIam } // namespace OHOS #endif // PINAUTH_REGISTER_IMPL_H