diff --git a/frameworks/cj/ffi/application_context/include/cj_utils_ffi.h b/frameworks/cj/ffi/application_context/include/cj_utils_ffi.h index e95d1ae63a..12e858eac9 100644 --- a/frameworks/cj/ffi/application_context/include/cj_utils_ffi.h +++ b/frameworks/cj/ffi/application_context/include/cj_utils_ffi.h @@ -19,7 +19,6 @@ #include #include "configuration.h" -#include "cj_common_ffi.h" namespace OHOS { namespace AbilityRuntime { @@ -37,6 +36,11 @@ struct CConfiguration { char* mnc; }; +struct CArrString { + char** head; + int64_t size; +}; + struct CProcessInformation { int32_t pid; int32_t uid; @@ -52,12 +56,12 @@ struct CArrProcessInformation { int64_t size; }; +CConfiguration CreateCConfiguration(const OHOS::AppExecFwk::Configuration &configuration); } } // The return variable needs free in CJ. char* CreateCStringFromString(const std::string& source); char** VectorToCArrString(const std::vector& vec); -OHOS::AbilityRuntime::CConfiguration CreateCConfiguration(const OHOS::AppExecFwk::Configuration &configuration); #endif // OHOS_ABILITY_RUNTIME_CJ_UTILS_FFI_H diff --git a/frameworks/cj/ffi/application_context/src/cj_utils_ffi.cpp b/frameworks/cj/ffi/application_context/src/cj_utils_ffi.cpp index bb2f6c7d35..861d0e4314 100644 --- a/frameworks/cj/ffi/application_context/src/cj_utils_ffi.cpp +++ b/frameworks/cj/ffi/application_context/src/cj_utils_ffi.cpp @@ -113,9 +113,12 @@ int32_t ConvertDisplayId(std::string displayId) return std::stoi(displayId); } -OHOS::AbilityRuntime::CConfiguration CreateCConfiguration(const OHOS::AppExecFwk::Configuration &configuration) +namespace OHOS { +namespace AbilityRuntime { + +CConfiguration CreateCConfiguration(const OHOS::AppExecFwk::Configuration &configuration) { - OHOS::AbilityRuntime::CConfiguration cfg; + CConfiguration cfg; cfg.language = CreateCStringFromString(configuration.GetItem( OHOS::AAFwk::GlobalConfigurationKey::SYSTEM_LANGUAGE)); cfg.colorMode = ConvertColorMode(configuration.GetItem(OHOS::AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE)); @@ -135,4 +138,6 @@ OHOS::AbilityRuntime::CConfiguration CreateCConfiguration(const OHOS::AppExecFwk cfg.mcc = CreateCStringFromString(configuration.GetItem(OHOS::AAFwk::GlobalConfigurationKey::SYSTEM_MCC)); cfg.mnc = CreateCStringFromString(configuration.GetItem(OHOS::AAFwk::GlobalConfigurationKey::SYSTEM_MNC)); return cfg; +} +} } \ No newline at end of file diff --git a/test/unittest/cj_application_context_test/BUILD.gn b/test/unittest/cj_application_context_test/BUILD.gn index 8252cea4db..606a96b0dd 100644 --- a/test/unittest/cj_application_context_test/BUILD.gn +++ b/test/unittest/cj_application_context_test/BUILD.gn @@ -49,6 +49,7 @@ ohos_unittest("cj_application_context_test") { "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", "${ability_runtime_innerkits_path}/ability_manager:mission_info", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_native_path}/ability:ability_context_native", "${ability_runtime_native_path}/ability/native:ability_thread",