/* * Copyright (c) 2021 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_SYSTEM_DEVICE_ID_KITS_S #define OHOS_SYSTEM_DEVICE_ID_KITS_S #include #include "idevice_info.h" #include "singleton.h" #include "beget_ext.h" namespace OHOS { namespace device_info { class INIT_LOCAL_API DeviceInfoKits final : public DelayedRefSingleton { DECLARE_DELAYED_REF_SINGLETON(DeviceInfoKits); public: DISALLOW_COPY_AND_MOVE(DeviceInfoKits); static DeviceInfoKits &GetInstance(); int32_t GetUdid(std::string& result); int32_t GetSerialID(std::string& result); void FinishStartSASuccess(const sptr &remoteObject); void FinishStartSAFailed(); void ResetService(const wptr &remote); private: // For death event procession class DeathRecipient final : public IRemoteObject::DeathRecipient { public: DeathRecipient(void) = default; ~DeathRecipient(void) final = default; DISALLOW_COPY_AND_MOVE(DeathRecipient); void OnRemoteDied(const wptr &remote) final; }; sptr GetDeathRecipient(void) { return deathRecipient_; } void LoadDeviceInfoSa(std::unique_lock &lock); sptr GetService(std::unique_lock &lock); std::mutex lock_; std::condition_variable deviceInfoLoadCon_; sptr deathRecipient_ {}; sptr deviceInfoService_ {}; }; } // namespace device_info } // namespace OHOS #endif // OHOS_SYSTEM_DEVICE_ID_KITS_S