17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci/**
177777dab0Sopenharmony_ci * @addtogroup AbilityRuntime
187777dab0Sopenharmony_ci * @{
197777dab0Sopenharmony_ci *
207777dab0Sopenharmony_ci * @brief Describe the functions provided by the application context.
217777dab0Sopenharmony_ci *
227777dab0Sopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core
237777dab0Sopenharmony_ci * @since 13
247777dab0Sopenharmony_ci */
257777dab0Sopenharmony_ci
267777dab0Sopenharmony_ci/**
277777dab0Sopenharmony_ci * @file application_context.h
287777dab0Sopenharmony_ci *
297777dab0Sopenharmony_ci * @brief Defines the application context APIs.
307777dab0Sopenharmony_ci *
317777dab0Sopenharmony_ci * @library libability_runtime.so
327777dab0Sopenharmony_ci * @kit AbilityKit
337777dab0Sopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core
347777dab0Sopenharmony_ci * @since 13
357777dab0Sopenharmony_ci */
367777dab0Sopenharmony_ci
377777dab0Sopenharmony_ci#ifndef ABILITY_RUNTIME_APPLICATION_CONTEXT_H
387777dab0Sopenharmony_ci#define ABILITY_RUNTIME_APPLICATION_CONTEXT_H
397777dab0Sopenharmony_ci
407777dab0Sopenharmony_ci#include <stdint.h>
417777dab0Sopenharmony_ci#include <stddef.h>
427777dab0Sopenharmony_ci#include "ability_runtime_common.h"
437777dab0Sopenharmony_ci#include "context_constant.h"
447777dab0Sopenharmony_ci
457777dab0Sopenharmony_ci#ifdef __cplusplus
467777dab0Sopenharmony_ciextern "C" {
477777dab0Sopenharmony_ci#endif
487777dab0Sopenharmony_ci
497777dab0Sopenharmony_ci/**
507777dab0Sopenharmony_ci * @brief Obtain the cache directory of the application.
517777dab0Sopenharmony_ci *
527777dab0Sopenharmony_ci * @param buffer A pointer to a buffer that receives the cache directory of the application.
537777dab0Sopenharmony_ci * @param bufferSize The length of the buffer.
547777dab0Sopenharmony_ci * @param writeLength The string length actually written to the buffer,
557777dab0Sopenharmony_ci *                    when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
567777dab0Sopenharmony_ci * @return The error code.
577777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
587777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
597777dab0Sopenharmony_ci *         or the buffer size is less than the minimum buffer size.
607777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
617777dab0Sopenharmony_ci * @since 13
627777dab0Sopenharmony_ci */
637777dab0Sopenharmony_ciAbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir(
647777dab0Sopenharmony_ci    char* buffer, int32_t bufferSize, int32_t* writeLength);
657777dab0Sopenharmony_ci
667777dab0Sopenharmony_ci/**
677777dab0Sopenharmony_ci * @brief Obtain the area mode of the application.
687777dab0Sopenharmony_ci *
697777dab0Sopenharmony_ci * @param areaMode A pointer to the area mode.
707777dab0Sopenharmony_ci * @return The error code.
717777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
727777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the areaMode is null.
737777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
747777dab0Sopenharmony_ci * @since 13
757777dab0Sopenharmony_ci */
767777dab0Sopenharmony_ciAbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(AbilityRuntime_AreaMode* areaMode);
777777dab0Sopenharmony_ci
787777dab0Sopenharmony_ci/**
797777dab0Sopenharmony_ci * @brief Obtain the bundle name.
807777dab0Sopenharmony_ci *
817777dab0Sopenharmony_ci * @param buffer A pointer to a buffer that receives the bundle name.
827777dab0Sopenharmony_ci * @param bufferSize The length of the buffer.
837777dab0Sopenharmony_ci * @param writeLength The string length actually written to the buffer,
847777dab0Sopenharmony_ci  *                   when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
857777dab0Sopenharmony_ci * @return The error code.
867777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
877777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
887777dab0Sopenharmony_ci *         or the buffer size is less than the minimum buffer size.
897777dab0Sopenharmony_ci *         {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
907777dab0Sopenharmony_ci * @since 13
917777dab0Sopenharmony_ci */
927777dab0Sopenharmony_ciAbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName(
937777dab0Sopenharmony_ci    char* buffer, int32_t bufferSize, int32_t* writeLength);
947777dab0Sopenharmony_ci
957777dab0Sopenharmony_ci#ifdef __cplusplus
967777dab0Sopenharmony_ci} // extern "C"
977777dab0Sopenharmony_ci#endif
987777dab0Sopenharmony_ci
997777dab0Sopenharmony_ci/** @} */
1007777dab0Sopenharmony_ci#endif // ABILITY_RUNTIME_APPLICATION_CONTEXT_H
101