1 /* 2 * Copyright (c) 2022 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 CONTEXT_CALLBACK_IMPL_H 17 #define CONTEXT_CALLBACK_IMPL_H 18 19 #include "iam_hitrace_helper.h" 20 #include "iam_defines.h" 21 22 #include "context_callback.h" 23 24 namespace OHOS { 25 namespace UserIam { 26 namespace UserAuth { 27 class ContextCallbackImpl : public ContextCallback, public NoCopyable { 28 public: 29 explicit ContextCallbackImpl(sptr<IamCallbackInterface> iamCallback, OperationType operationType); 30 ~ContextCallbackImpl() override = default; 31 void OnResult(int32_t resultCode, const Attributes &finalResult) override; 32 void OnAcquireInfo(ExecutorRole src, int32_t moduleType, const std::vector<uint8_t> &acquireMsg) const override; 33 void SetTraceUserId(int32_t userId) override; 34 void SetTraceRemainTime(int32_t remainTime) override; 35 void SetTraceFreezingTime(int32_t freezingTime) override; 36 void SetTraceSdkVersion(int32_t version) override; 37 void SetTraceCallingUid(uint64_t callingUid) override; 38 void SetTraceAuthType(AuthType authType) override; 39 void SetTraceAuthWidgetType(uint32_t authWidgetType) override; 40 void SetTraceAuthTrustLevel(AuthTrustLevel atl) override; 41 void SetCleaner(Context::ContextStopCallback callback) override; 42 43 private: 44 sptr<IamCallbackInterface> iamCallback_ {nullptr}; 45 Context::ContextStopCallback stopCallback_ {nullptr}; 46 ContextCallbackNotifyListener::MetaData metaData_; 47 std::shared_ptr<IamHitraceHelper> iamHitraceHelper_; 48 }; 49 } // namespace UserAuth 50 } // namespace UserIam 51 } // namespace OHOS 52 #endif // CONTEXT_CALLBACK_IMPL_H