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 OHOS_ABILITY_RUNTIME_ETS_CONTEXT_UTILS_H 17 #define OHOS_ABILITY_RUNTIME_ETS_CONTEXT_UTILS_H 18 19 #include "ani.h" 20 #include "context.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 namespace ContextUtil { 25 void BindApplicationInfo(ani_env *aniEnv, ani_class contextClass, ani_object contextObj, 26 std::shared_ptr<Context> context); 27 void BindResourceManager(ani_env *aniEnv, ani_class contextClass, ani_object contextObj, 28 std::shared_ptr<Context> context); 29 void CreateEtsBaseContext(ani_env *aniEnv, ani_class contextClass, ani_object contextObj, 30 std::shared_ptr<Context> context); 31 ani_object GetApplicationContextSync(ani_env *env, ani_object aniObj); 32 std::shared_ptr<Context> GetBaseContext(ani_env *env, ani_object aniObj); 33 void SwitchArea(ani_env *env, ani_object obj, ani_enum_item areaModeItem); 34 ani_enum_item GetArea(ani_env *env, ani_object obj); 35 ani_object CreateModuleResourceManagerSync(ani_env *env, ani_object aniObj, 36 ani_string bundleName, ani_string moduleName); 37 void Clean(ani_env *env, ani_object object); 38 bool SetNativeContextLong(ani_env *env, ani_object aniObj, ani_long nativeContextLong); 39 } 40 } // namespace AbilityRuntime 41 } // namespace OHOS 42 #endif // OHOS_ABILITY_RUNTIME_ETS_CONTEXT_UTILS_H