diff --git a/js/builtin/deviceinfokit/include/nativeapi_deviceinfo.h b/js/builtin/deviceinfokit/include/nativeapi_deviceinfo.h index 977a0837cb3c6aece09e5c79560ed80027278996..4e14729c5024dd839955a988e67afd4ab8feae5c 100644 --- a/js/builtin/deviceinfokit/include/nativeapi_deviceinfo.h +++ b/js/builtin/deviceinfokit/include/nativeapi_deviceinfo.h @@ -20,19 +20,45 @@ namespace OHOS { namespace ACELite { -class NativeapiDeviceInfo { +class NativeApiDeviceInfoJS { public: NativeapiDeviceInfo() = default; ~NativeapiDeviceInfo() = default; - static JSIValue GetDeviceInfo(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); - static bool GetProductInfo(JSIValue result); - -private: - static bool GetLanguage(JSIValue result); - static bool GetRegion(JSIValue result); - static bool GetAPILevel(JSIValue result); - static bool GetDeviceType(JSIValue result); + static JSIValue JSGetDeviceType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetManufacture(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBrand(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetMarketName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetProductSeries(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetProductModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetSoftwareModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetHardwareModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetHardwareProfile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetSerial(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum);; + static JSIValue JSGetBootloaderVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetAbiList(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetSecurityPatchTag(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDisplayVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetIncrementalVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetOsReleaseType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetOSFullName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetMajorVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetSeniorVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetFeatureVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetSdkApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetFirstApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetVersionId(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildUser(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildHost(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildTime(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetBuildRootHash(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDevUdid(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDistributionOSName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDistributionOSVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDistributionOSApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue JSGetDistributionOSReleaseType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); }; } // ACELite } // OHOS diff --git a/js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp b/js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp index 0291b2ec3e715755330931b5a02920042e848aa6..38d557550ae771263a61a0708be655d9ae9b923e 100644 --- a/js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp +++ b/js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp @@ -26,130 +26,308 @@ namespace OHOS { namespace ACELite { namespace { +static constexpr int MAX_BUFFER = 65; +static constexpr int DECIMAL_BASE = 10; +} + +using GetDeviceInfoStringFunc = std::function; +using GetDeviceInfoIntFunc = std::function; +using GetDeviceUdidFunc = std::funcion; + +struct DeviceInfoFunParams : public FuncParams { + GetDeviceInfoStringFunc getDeviceInfoStringFunc; + GetDeviceInfoIntFunc getDeviceInfoIntFunc; + GetDeviceUdidFunc getDeviceUdidFunc; +} + +JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, + uint8_t argsNum, GetDeviceInfoStringFunc getDeviceInfoStringFunc, bool flag = false) +{ + JSIValue undefValue = JSI::CreateUndefined(); + DeviceInfoFunParams* params = new(std::nothrow) DeviceInfoFunParams(); + if (params == nullptr) { + return undefValue; + } + + params->getDeviceInfoStringFunc = getDeviceInfoStringFunc; + JsAsyncWork::DispatchAsyncWork(ExecuteGetDeviceInfo, reinterpret_cast(params)); + return undefValue; +} + JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, - uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) + uint8_t argsNum, GetDeviceInfoIntFunc getDeviceInfoIntFunc, bool flag = false) { JSIValue undefValue = JSI::CreateUndefined(); - if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { + DeviceInfoFunParams* params = new(std::nothrow) DeviceInfoFunParams(); + if (params == nullptr) { return undefValue; } - FuncParams* params = new(std::nothrow) FuncParams(); + + params->getDeviceInfoIntFunc = getDeviceInfoIntFunc; + JsAsyncWork::DispatchAsyncWork(ExecuteGetDeviceInfo, reinterpret_cast(params)); + return undefValue; +} + +JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, + uint8_t argsNum, GetDeviceUdidFunc getDeviceUdidFunc, bool flag = false) +{ + JSIValue undefValue = JSI::CreateUndefined(); + DeviceInfoFunParams* params = new(std::nothrow) DeviceInfoFunParams(); if (params == nullptr) { return undefValue; } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - params->flag = flag; - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + + params->getDeviceUdidFunc = getDeviceUdidFunc; + JsAsyncWork::DispatchAsyncWork(ExecuteGetDeviceInfo, reinterpret_cast(params)); return undefValue; } -void ExecuteGetInfo(void* data) +void ExecuteGetDeviceInfo(void* data) { - FuncParams* params = reinterpret_cast(data); + DeviceInfoFunParams* params = reinterpret_cast(data); if (params == nullptr) { return; } JSIValue args = params->args; JSIValue thisVal = params->thisVal; - JSIValue result = JSI::CreateObject(); - if (!NativeapiDeviceInfo::GetProductInfo(result)) { - NativeapiCommon::FailCallBack(thisVal, args, ERROR_CODE_GENERAL); - } else { - NativeapiCommon::SuccessCallBack(thisVal, args, result); + JSIValue result = JSI::CreateUndefined(); + + int ret = ERROR_CODE_GENERAL + const char *value = NULL; + char buffer[MAX_BUFFER] = { 0 }; + + if (params->getDeviceInfoStringFunc != NULL) { + value = params->getDeviceInfoStringFunc(); + } elseif (params->getDeviceInfoIntFunc != NULL) { + int info = params->getDeviceInfoIntFunc(); + ret = snprintf(buff, sizeof(buff) - 1, "%d", info); + value = (ret > 0) ? buffer : NULL; + } elseif (params->getDeviceUdidFunc !=NULL) { + ret = params->getDeviceUdidFunc(buffer, sizeof(buffer)); + value = (ret == 0) ? buffer : NULL; + } + + if (value == NULL) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; + params = nullptr; + return; } + + result = JSI::CreateString(value); + NativeapiCommon::SuccessCallBack(thisVal, args, result); JSI::ReleaseValueList(args, thisVal, result, ARGS_END); delete params; params = nullptr; } + +JSIValue NativeApiDeviceInfoJS::JSGetDeviceType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDeviceType, false); } -void InitDeviceModule(JSIValue exports) +JSIValue NativeApiDeviceInfoJS::JSGetManufacture(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) { - JSI::SetModuleAPI(exports, "getInfo", NativeapiDeviceInfo::GetDeviceInfo); + return ExecuteAsyncWork(thisVal, args, argsNum, GetManufacture, false); } -bool NativeapiDeviceInfo::GetAPILevel(JSIValue result) +JSIValue NativeApiDeviceInfoJS::JSGetBrand(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) { - int apiLevel = GetSdkApiVersion(); - if (apiLevel < 1) { - return false; - } - JSI::SetStringProperty(result, "apiVersion", std::to_string(apiLevel).c_str()); - return true; + return ExecuteAsyncWork(thisVal, args, argsNum, GetBrand, false); } -JSIValue NativeapiDeviceInfo::GetDeviceInfo(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +JSIValue NativeApiDeviceInfoJS::JSGetMarketName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) { - return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGetInfo); + return ExecuteAsyncWork(thisVal, args, argsNum, GetMarketName, false); } -bool NativeapiDeviceInfo::GetDeviceType(JSIValue result) +JSIValue NativeApiDeviceInfoJS::JSGetProductSeries(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) { - const char* deviceType = ::GetDeviceType(); - if (deviceType == nullptr) { - return false; - } - JSI::SetStringProperty(result, "deviceType", deviceType); - return true; + return ExecuteAsyncWork(thisVal, args, argsNum, GetProductSeries, false); } -bool NativeapiDeviceInfo::GetLanguage(JSIValue result) +JSIValue NativeApiDeviceInfoJS::JSGetProductModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) { - // because of MAX_LANGUAGE_LENGTH is little,we use array instead of pointer - char langStr[MAX_LANGUAGE_LENGTH + 1] = {0}; - if (GLOBAL_GetLanguage(langStr, MAX_LANGUAGE_LENGTH) != 0) { - JSI::SetStringProperty(result, "language", ""); - } else { - JSI::SetStringProperty(result, "language", langStr); - } - return true; -} - -bool NativeapiDeviceInfo::GetProductInfo(JSIValue result) -{ - bool isSuccess = true; - const char* brand = GetBrand(); - const char* manufacture = GetManufacture(); - const char* model = GetProductModel(); - if (brand == nullptr || manufacture == nullptr || model == nullptr) { - isSuccess = false; - } else { - JSI::SetStringProperty(result, "brand", brand); - JSI::SetStringProperty(result, "manufacturer", manufacture); - JSI::SetStringProperty(result, "model", model); - JSI::SetStringProperty(result, "product", model); - } - if (isSuccess) { - if (!NativeapiDeviceInfo::GetDeviceType(result) || - !NativeapiDeviceInfo::GetLanguage(result) || - !NativeapiDeviceInfo::GetAPILevel(result) || - !NativeapiDeviceInfo::GetRegion(result)) { - isSuccess = false; - } - } + return ExecuteAsyncWork(thisVal, args, argsNum, GetProductModel, false); +} - Screen &screen = Screen::GetInstance(); - JSI::SetNumberProperty(result, "windowWidth", static_cast(screen.GetWidth())); - JSI::SetNumberProperty(result, "windowHeight", static_cast(screen.GetHeight())); - // set default value - const uint8_t defaultScreenDensity = 195; - const char * const defaultScreenShape = "rect"; - JSI::SetNumberProperty(result, "screenDensity", static_cast(defaultScreenDensity)); - JSI::SetStringProperty(result, "screenShape", defaultScreenShape); - return isSuccess; -} - -bool NativeapiDeviceInfo::GetRegion(JSIValue result) -{ - // because of MAX_REGION_LENGTH is little,we use array instead of pointer - char region[MAX_REGION_LENGTH + 1] = {0}; - if (GLOBAL_GetRegion(region, MAX_REGION_LENGTH) != 0) { - JSI::SetStringProperty(result, "region", ""); - } else { - JSI::SetStringProperty(result, "region", region); - } - return true; +JSIValue NativeApiDeviceInfoJS::JSGetSoftwareModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetSoftwareModel, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetHardwareModel(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetHardwareModel, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetHardwareProfile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetHardwareProfile, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetSerial(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetSerial, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBootloaderVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBootloaderVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetAbiList(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetAbiList, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetSecurityPatchTag(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetSecurityPatchTag, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDisplayVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDisplayVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetIncrementalVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetIncrementalVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetOsReleaseType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetOsReleaseType, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetOSFullName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetOSFullName, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetMajorVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetMajorVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetSeniorVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetSeniorVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetFeatureVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetFeatureVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetSdkApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetSdkApiVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetFirstApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetFirstApiVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetVersionId(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetVersionId, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildType, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildUser(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildUser, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildHost(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildHost, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildTime(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildTime, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetBuildRootHash(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetBuildRootHash, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDevUdid(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDevUdid, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDistributionOSName(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDistributionOSName, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDistributionOSVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDistributionOSVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDistributionOSApiVersion(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDistributionOSApiVersion, false); +} + +JSIValue NativeApiDeviceInfoJS::JSGetDistributionOSReleaseType(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, GetDistributionOSReleaseType, false); +} + +void InitNativeApiKv(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "deviceType", NativeApiDeviceInfoJS::JSGetDeviceType); + JSI::SetModuleAPI(exports, "manufacture", NativeApiDeviceInfoJS::JSGetManufacture); + JSI::SetModuleAPI(exports, "brand", NativeApiDeviceInfoJS::JSGetBrand); + JSI::SetModuleAPI(exports, "marketName", NativeApiDeviceInfoJS::JSGetMarketName); + JSI::SetModuleAPI(exports, "productSeries", NativeApiDeviceInfoJS::JSGetProductSeries); + JSI::SetModuleAPI(exports, "productModel", NativeApiDeviceInfoJS::JSGetProductModel); + JSI::SetModuleAPI(exports, "softwareModel", NativeApiDeviceInfoJS::JSGetSoftwareModel); + JSI::SetModuleAPI(exports, "hardwareModel", NativeApiDeviceInfoJS::JSGetHardwareModel); + JSI::SetModuleAPI(exports, "hardwareProfile", NativeApiDeviceInfoJS::JSGetHardwareProfile); + JSI::SetModuleAPI(exports, "serial", NativeApiDeviceInfoJS::JSGetSerial); + JSI::SetModuleAPI(exports, "bootloaderVersion", NativeApiDeviceInfoJS::JSGetBootloaderVersion); + JSI::SetModuleAPI(exports, "abiList", NativeApiDeviceInfoJS::JSGetAbiList); + JSI::SetModuleAPI(exports, "securityPatchTag", NativeApiDeviceInfoJS::JSGetSecurityPatchTag); + JSI::SetModuleAPI(exports, "displayVersion", NativeApiDeviceInfoJS::JSGetDisplayVersion); + JSI::SetModuleAPI(exports, "incrementalVersion", NativeApiDeviceInfoJS::JSGetIncrementalVersion); + JSI::SetModuleAPI(exports, "osReleaseType", NativeApiDeviceInfoJS::JSGetOsReleaseType); + JSI::SetModuleAPI(exports, "osFullName", NativeApiDeviceInfoJS::JSGetOSFullName); + JSI::SetModuleAPI(exports, "majorVersion", NativeApiDeviceInfoJS::JSGetMajorVersion); + JSI::SetModuleAPI(exports, "seniorVersion", NativeApiDeviceInfoJS::JSGetSeniorVersion); + JSI::SetModuleAPI(exports, "featureVersion", NativeApiDeviceInfoJS::JSGetFeatureVersion); + JSI::SetModuleAPI(exports, "buildVersion", NativeApiDeviceInfoJS::JSGetBuildVersion); + JSI::SetModuleAPI(exports, "sdkApiVersion", NativeApiDeviceInfoJS::JSGetSdkApiVersion); + JSI::SetModuleAPI(exports, "firstApiVersion", NativeApiDeviceInfoJS::JSGetFirstApiVersion); + JSI::SetModuleAPI(exports, "versionId", NativeApiDeviceInfoJS::JSGetVersionId); + JSI::SetModuleAPI(exports, "buildType", NativeApiDeviceInfoJS::JSGetBuildType); + JSI::SetModuleAPI(exports, "buildUser", NativeApiDeviceInfoJS::JSGetBuildUser); + JSI::SetModuleAPI(exports, "buildHost", NativeApiDeviceInfoJS::JSGetBuildHost); + JSI::SetModuleAPI(exports, "buildTime", NativeApiDeviceInfoJS::JSGetBuildTime); + JSI::SetModuleAPI(exports, "buildRootHash", NativeApiDeviceInfoJS::JSGetBuildRootHash); + JSI::SetModuleAPI(exports, "udid", NativeApiDeviceInfoJS::JSGetDevUdid); + JSI::SetModuleAPI(exports, "distributionOSName", NativeApiDeviceInfoJS::JSGetDistributionOSName); + JSI::SetModuleAPI(exports, "distributionOSVersion", NativeApiDeviceInfoJS::JSGetDistributionOSVersion); + JSI::SetModuleAPI(exports, "distributionOSApiVersion", NativeApiDeviceInfoJS::JSGetDistributionOSApiVersion); + JSI::SetModuleAPI(exports, "distributionOSReleaseType", NativeApiDeviceInfoJS::JSGetDistributionOSReleaseType); } } // ACELite -} // OHOS +}