1 /* 2 * Copyright (c) 2021-2024 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 #include "extension_context.h" 17 18 #include "hilog_tag_wrapper.h" 19 20 namespace OHOS { 21 namespace AbilityRuntime { 22 const size_t ExtensionContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("ExtensionContext")); 23 SetAbilityInfo(const std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> & abilityInfo)24void ExtensionContext::SetAbilityInfo(const std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> &abilityInfo) 25 { 26 if (abilityInfo == nullptr) { 27 TAG_LOGE(AAFwkTag::APPKIT, "abilityInfo == nullptr"); 28 return; 29 } 30 abilityInfo_ = abilityInfo; 31 } 32 GetAbilityInfo() const33std::shared_ptr<AppExecFwk::AbilityInfo> ExtensionContext::GetAbilityInfo() const 34 { 35 return abilityInfo_; 36 } 37 } // namespace AbilityRuntime 38 } // namespace OHOS 39