diff --git a/frameworks/src/core/context/js_app_context.cpp b/frameworks/src/core/context/js_app_context.cpp index c7437ee..f1c6555 100755 --- a/frameworks/src/core/context/js_app_context.cpp +++ b/frameworks/src/core/context/js_app_context.cpp @@ -19,7 +19,9 @@ #if (defined(__LINUX__) || defined(__LITEOS__)) #include "ace_ability.h" #endif +#ifdef FEATURE_API_VERSION #include "bundle_manager.h" +#endif // FEATURE_API_VERSION #include "component_factory.h" #include "component_utils.h" #include "fatal_handler.h" @@ -344,6 +346,7 @@ char *JsAppContext::GetResourcePath(const char *uri) const void JsAppContext::LoadApiVersion() { +#ifdef FEATURE_API_VERSION BundleInfo bundle = {0}; uint8_t retCode = GetBundleInfo(currentBundleName_, false, &bundle); if (retCode != 0) { @@ -352,14 +355,19 @@ void JsAppContext::LoadApiVersion() } compatibleApi_ = bundle.compatibleApi; targetApi_ = bundle.targetApi; +#else + const int32_t currentApiVersion = 6; + compatibleApi_ = currentApiVersion; + targetApi_ = currentApiVersion; +#endif } -const int32_t JsAppContext::GetCompatibleApi() const +int32_t JsAppContext::GetCompatibleApi() const { return compatibleApi_; } -const int32_t JsAppContext::GetTargetApi() const +int32_t JsAppContext::GetTargetApi() const { return targetApi_; } diff --git a/frameworks/src/core/context/js_app_context.h b/frameworks/src/core/context/js_app_context.h index 5b81790..ce93ccb 100755 --- a/frameworks/src/core/context/js_app_context.h +++ b/frameworks/src/core/context/js_app_context.h @@ -97,8 +97,8 @@ public: topJSAbilityImpl_ = object; } void LoadApiVersion(); - const int32_t GetCompatibleApi() const; - const int32_t GetTargetApi() const; + int32_t GetCompatibleApi() const; + int32_t GetTargetApi() const; const AppStyleManager *GetStyleManager() { diff --git a/frameworks/targets/linux/acelite_config.h b/frameworks/targets/linux/acelite_config.h index 7e0ef8a..8c4e99a 100755 --- a/frameworks/targets/linux/acelite_config.h +++ b/frameworks/targets/linux/acelite_config.h @@ -100,6 +100,8 @@ #define FEATURE_ACELITE_LITE_DFX_MODULE +#define FEATURE_API_VERSION + /** * enable Canvas component Feature API on ipcamera real devices */ diff --git a/frameworks/targets/liteos_a/acelite_config.h b/frameworks/targets/liteos_a/acelite_config.h index 9866241..41fe71e 100755 --- a/frameworks/targets/liteos_a/acelite_config.h +++ b/frameworks/targets/liteos_a/acelite_config.h @@ -102,6 +102,8 @@ */ #define FEATURE_DATE_FORMAT +#define FEATURE_API_VERSION + /** * support lite ace dfx module */ diff --git a/frameworks/targets/liteos_m/acelite_config.h b/frameworks/targets/liteos_m/acelite_config.h index a292610..ad16e44 100755 --- a/frameworks/targets/liteos_m/acelite_config.h +++ b/frameworks/targets/liteos_m/acelite_config.h @@ -142,6 +142,8 @@ */ #define FEATURE_DATE_FORMAT +#define FEATURE_API_VERSION + #define JS_ENGINE_STATIC_MULTI_CONTEXTS_ENABLED /**