From f22d16579835310d56debc9be29574946d8a1a07 Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Sat, 10 May 2025 14:40:09 +0800 Subject: [PATCH] add ndk interface Signed-off-by: lanhaoyu --- .../bundle/include/native_interface_bundle.h | 65 +++++++++++++++++++ .../bundle/libbundle.ndk.json | 8 +++ 2 files changed, 73 insertions(+) diff --git a/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h b/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h index 04bb5d331..9ffbb73b9 100644 --- a/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h +++ b/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h @@ -37,6 +37,9 @@ #ifndef FOUNDATION_APPEXECFWK_STANDARD_KITS_APPKIT_NATIVE_BUNDLE_INCLUDE_NATIVE_INTERFACE_BUNDLE_H #define FOUNDATION_APPEXECFWK_STANDARD_KITS_APPKIT_NATIVE_BUNDLE_INCLUDE_NATIVE_INTERFACE_BUNDLE_H +#include +#include + #ifdef __cplusplus extern "C" { #endif @@ -76,6 +79,46 @@ struct OH_NativeBundle_ElementName { char* abilityName; }; +/** + * @brief Indicates information of metadata + * + * @since 20 + */ +typedef struct OH_NativeBundle_Metadata { + /** + * @brief Indicates the metadata name + */ + char* name; + /** + * @brief Indicates the metadata value + */ + char* value; + /** + * @brief Indicates the metadata resource + */ + char* resource; +} OH_NativeBundle_Metadata; + +/** + * @brief Indicates information of module metadata + * + * @since 20 + */ +typedef struct OH_NativeBundle_ModuleMetadata { + /** + * @brief Indicates the moduleName of module + */ + char* moduleName; + /** + * @brief Indicates the metadata array of module + */ + OH_NativeBundle_Metadata* metadataArray; + /** + * @brief Indicates the metadata array size of module + */ + size_t metadataArraySize; +} OH_NativeBundle_ModuleMetadata; + /** * @brief Indicates information of application * @@ -159,6 +202,28 @@ OH_NativeBundle_ElementName OH_NativeBundle_GetMainElementName(); * @version 1.0 */ char* OH_NativeBundle_GetCompatibleDeviceType(); + +/** + * @brief Obtains the application debug mode. + * + * @param isDebugMode Indicates whether the application is in debug mode. + * @return Returns true if call successful, false otherwise. + * @since 20 + */ +bool OH_NativeBundle_IsDebugMode(bool* isDebugMode); + +/** + * @brief Obtains the module metadata array of the current application. + * After utilizing this interface, to prevent memory leaks, + * it is necessary to manually release the pointer returned by the interface. + * + * @param size Indicates the module metadata array size. + * @return Returns the newly created module metadata array, if the returned object is NULL, + * it indicates creation failure. The possible cause of failure could be that the application address space is full, + * leading to space allocation failure. + * @since 20 + */ +OH_NativeBundle_ModuleMetadata* OH_NativeBundle_GetModuleMetadata(size_t* size); #ifdef __cplusplus }; #endif diff --git a/bundlemanager/bundle_framework/bundle/libbundle.ndk.json b/bundlemanager/bundle_framework/bundle/libbundle.ndk.json index f61863508..7c05eef7b 100644 --- a/bundlemanager/bundle_framework/bundle/libbundle.ndk.json +++ b/bundlemanager/bundle_framework/bundle/libbundle.ndk.json @@ -18,5 +18,13 @@ { "first_introduced": "14", "name": "OH_NativeBundle_GetCompatibleDeviceType" + }, + { + "first_introduced": "20", + "name": "OH_NativeBundle_IsDebugMode" + }, + { + "first_introduced": "20", + "name": "OH_NativeBundle_GetModuleMetadata" } ] -- Gitee