ability_resource_info.h
Overview
The file declares the APIs for obtaining the following ability resource information: bundle name, module name, ability name, icon, clone index, and whether the application is a default application.
File to include: <bundle/ability_resource_info.h>
Library: libbundle_ndk.z.so
System capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 21
Related module: Native_Bundle
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| OH_NativeBundle_AbilityResourceInfo | OH_NativeBundle_AbilityResourceInfo | Describes the ability resource information. |
Functions
Function Description
OH_NativeBundle_GetBundleName()
BundleManager_ErrorCode OH_NativeBundle_GetBundleName(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, char** bundleName)
Description
Obtains the bundle name of the ability. After using this function, you must manually release the pointer returned to prevent memory leakage.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| char** bundleName | Double pointer to the bundle name. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetModuleName()
BundleManager_ErrorCode OH_NativeBundle_GetModuleName(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, char** moduleName)
Description
Obtains the module name of the ability. After using this function, you must manually release the pointer returned to prevent memory leakage.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| char** moduleName | Double pointer to the module name. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetAbilityName()
BundleManager_ErrorCode OH_NativeBundle_GetAbilityName(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, char** abilityName)
Description
Obtains the ability name. After using this function, you must manually release the pointer returned to prevent memory leakage.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| char** abilityName | Double pointer to the ability name. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetDrawableDescriptor()
BundleManager_ErrorCode OH_NativeBundle_GetDrawableDescriptor(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, ArkUI_DrawableDescriptor** drawableIcon)
Description
Obtains the DrawableDescriptor object of the ability icon resource. After using this function, you must manually call OH_AbilityResourceInfo_Destroy to release the pointer returned to prevent memory leakage.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| ArkUI_DrawableDescriptor** drawableIcon | Double pointer to the DrawableDescriptor object. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetLabel()
BundleManager_ErrorCode OH_NativeBundle_GetLabel(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, char** label)
Description
Obtains the application name of the ability. After using this function, you must manually release the pointer returned to prevent memory leakage.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| char** label | Double pointer to the application name. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetAppIndex()
BundleManager_ErrorCode OH_NativeBundle_GetAppIndex(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, int* appIndex)
Description
Obtains the clone index of the ability.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| int* appIndex | Double pointer to the clone index. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The retrieval is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The retrieval fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_CheckDefaultApp()
BundleManager_ErrorCode OH_NativeBundle_CheckDefaultApp(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, bool* isDefault)
Description
Checks whether the application to which the ability belongs is a default application.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| bool* isDefault | Pointer to the check result for whether the application is a default application. A default application is the preferred application set by the user for a specific file type or operation. true if the application is a default application, false otherwise. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The query is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The query fails because the abilityResourceInfo parameter is nullptr. |
OH_AbilityResourceInfo_Destroy()
BundleManager_ErrorCode OH_AbilityResourceInfo_Destroy(OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo, size_t count)
Description
Releases memory allocated for ability resource information.
Since: 21
Parameters
| Name | Description |
|---|---|
| OH_NativeBundle_AbilityResourceInfo* abilityResourceInfo | Pointer to the ability resource information. |
| size_t count | Size of the ability resource information array. |
Returns
| Type | Description |
|---|---|
| BundleManager_ErrorCode | One of the following operation results: BUNDLE_MANAGER_ERROR_CODE_NO_ERROR: The release is successful. BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID: The release fails because the abilityResourceInfo parameter is nullptr. |
OH_NativeBundle_GetSize()
int OH_NativeBundle_GetSize()
Description
Obtains the size of a single OH_NativeBundle_AbilityResourceInfo struct.
Since: 21
Returns
| Type | Description |
|---|---|
| int | Size of a single OH_NativeBundle_AbilityResourceInfo struct. |