1 /* 2 * Copyright (c) 2025 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_MIGRATE_DATA_USER_AUTH_CALLBACK_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_MIGRATE_DATA_USER_AUTH_CALLBACK_H 18 19 #ifdef BMS_USER_AUTH_FRAMEWORK_ENABLED 20 #include <atomic> 21 #include <future> 22 23 #include "user_auth_client_callback.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 using namespace OHOS::UserIam::UserAuth; 28 class MigrateDataUserAuthCallback final : public AuthenticationCallback { 29 public: 30 MigrateDataUserAuthCallback(); 31 ~MigrateDataUserAuthCallback(); 32 void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) override; 33 void OnResult(int32_t result, const Attributes &extraInfo) override; 34 int32_t GetUserAuthResult(); 35 36 private: 37 std::atomic<bool> isComplete_{ false }; 38 std::promise<int32_t> resultPromise_; 39 std::shared_future<int32_t> future_ = resultPromise_.get_future().share(); 40 int32_t result_{ 0 }; 41 }; 42 } // namespace AppExecFwk 43 } // namespace OHOS 44 #endif // BMS_USER_AUTH_FRAMEWORK_ENABLED 45 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_MIGRATE_DATA_USER_AUTH_CALLBACK_H