diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 78b642a44e7110b3c950aea0b08ec678dafe533c..0809911362102aa3060bd5db035c0dc761d3be05 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1528,17 +1528,27 @@ void MainThread::HandleLaunchAbility(const std::shared_ptr & AbilityThread::AbilityThreadMain(application_, abilityRecord, mainHandler_->GetEventRunner(), stageContext); #endif - if (runtime) { - std::vector> hqfFilePair; - if (GetHqfFileAndHapPath(appInfo->bundleName, hqfFilePair)) { - for (auto it = hqfFilePair.begin(); it != hqfFilePair.end(); it++) { - HILOG_INFO("hqfFile: %{private}s, hapPath: %{private}s.", it->first.c_str(), it->second.c_str()); - runtime->LoadRepairPatch(it->first, it->second); - } - } + // if (runtime) { + // std::vector> hqfFilePair; + // if (GetHqfFileAndHapPath(appInfo->bundleName, hqfFilePair)) { + // for (auto it = hqfFilePair.begin(); it != hqfFilePair.end(); it++) { + // HILOG_INFO("hqfFile: %{private}s, hapPath: %{private}s.", it->first.c_str(), it->second.c_str()); + // runtime->LoadRepairPatch(it->first, it->second); + // } + // } + // } + + if (runtime && !appInfo->appQuickFix.deployedAppqfInfo.hqfInfos.empty()) { + runtime->RegisterQuickFixQueryFunc(callback); } } +bool callback(std::string baseFileName, std::string &patchFileName, + void **patchBuffer, size_t &patchSize) +{ + return true; +} + /** * * @brief Clean the ability but don't notify ams. diff --git a/frameworks/native/runtime/js_runtime.cpp b/frameworks/native/runtime/js_runtime.cpp index 44aab9e85d145a18d0253d67a545b469fce798d5..b4ad6e38cff22660c43c1dd3dc247e3bd62bb074 100644 --- a/frameworks/native/runtime/js_runtime.cpp +++ b/frameworks/native/runtime/js_runtime.cpp @@ -321,6 +321,7 @@ bool JsRuntime::LoadRepairPatch(const std::string& hqfFile, const std::string& h HILOG_DEBUG("LoadRepairPatch, LoadPatch, patchFile: %{private}s, baseFile: %{private}s.", patchFile.c_str(), resolvedHapPath.c_str()); + // zhuhan auto ret = panda::JSNApi::LoadPatch(vm, patchFile, patchBuffer.data(), patchBuffer.size(), resolvedHapPath, baseBuffer.data(), baseBuffer.size()); if (ret != panda::JSNApi::PatchErrorCode::SUCCESS) { @@ -921,5 +922,11 @@ bool JsRuntime::IsUseAbilityRuntime(const Options& options) const { return (options.isStageModel) || (options.isTestFramework); } + +void JsRuntime::RegisterQuickFixQueryFunc(panda::QuickFixQueryCallBack callBack) +{ + auto vm = GetEcmaVm(); + panda::JSNApi::RegisterQuickFixQueryFunc(vm, callBack); +} } // namespace AbilityRuntime } // namespace OHOS diff --git a/interfaces/inner_api/runtime/include/js_runtime.h b/interfaces/inner_api/runtime/include/js_runtime.h index 1a5e450093c1d6db6bc4ab4c629e8460c063c991..30fe494bad38bf7f9410743713d70a462e64066b 100644 --- a/interfaces/inner_api/runtime/include/js_runtime.h +++ b/interfaces/inner_api/runtime/include/js_runtime.h @@ -27,6 +27,12 @@ #include "runtime.h" #include "source_map.h" +// zhuhan +using QuickFixQueryCallBack = bool (*)(std::string baseFileName, + std::string &patchFileName, + void **patchBuffer, + size_t &patchSize); + namespace OHOS { namespace AppExecFwk { class EventHandler; @@ -94,6 +100,8 @@ public: NativeEngine* GetNativeEnginePointer() const; panda::ecmascript::EcmaVM* GetEcmaVm() const; + void RegisterQuickFixQueryFunc(QuickFixQueryCallBack callBack); + private: void FinishPreload() override;