diff --git a/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp b/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp index 38a3abb5ca51db58278036e99389815c520ccecc..09273855d87f2024821b26a5ebe5201b5b278a13 100644 --- a/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp +++ b/interfaces/inner_api/file_access/src/file_access_ext_proxy.cpp @@ -572,8 +572,8 @@ static int ReadFileFilterResults(MessageParcel &reply, SharedMemoryInfo &memInfo return ERR_OK; } -int FileAccessExtProxy::ListFile(const FileInfo &fileInfo, const int64_t offset, const FileFilter &filter, - SharedMemoryInfo &memInfo) +int FileAccessExtProxy::ListFile(const FileInfo &fileInfo, const int64_t offset, + const FileFilter &filter, SharedMemoryInfo &memInfo) { UserAccessTracer trace; trace.Start("ListFile"); diff --git a/interfaces/kits/picker/include/picker_n_exporter.h b/interfaces/kits/picker/include/picker_n_exporter.h index d85f9d2a745aac0818c303987de636f74c5887d8..fc72bc9cb4ff3516cac1a3834b77043b99d64063 100644 --- a/interfaces/kits/picker/include/picker_n_exporter.h +++ b/interfaces/kits/picker/include/picker_n_exporter.h @@ -24,6 +24,7 @@ #include "picker_napi_utils.h" #include "napi_base_context.h" #include "napi_common_want.h" +#include "ui_extension_context.h" namespace OHOS { @@ -51,6 +52,8 @@ struct PickerAsyncContext { std::shared_ptr pickerCallBack; }; +static sptr window_; + class PickerNExporter final : public FileManagement::LibN::NExporter { public: inline static const std::string className_ = "Picker"; diff --git a/interfaces/kits/picker/include/picker_napi_utils.h b/interfaces/kits/picker/include/picker_napi_utils.h index 474181568f6c2d251a3abd1ad5d2161d4557fa75..2816b337c6cce19e0bbbf4a2a47325e8a20db6ca 100644 --- a/interfaces/kits/picker/include/picker_napi_utils.h +++ b/interfaces/kits/picker/include/picker_napi_utils.h @@ -44,9 +44,10 @@ constexpr uint32_t NAPI_INIT_REF_COUNT = 1; constexpr size_t NAPI_ARGC_MAX = 5; // Error codes -const int32_t ERR_DEFAULT = 0; +const int32_t ERR_OK = 0; const int32_t ERR_MEM_ALLOCATION = 2; const int32_t ERR_INVALID_OUTPUT = 3; +const int32_t ERR_INV = -1; struct JSAsyncContextOutput { napi_value error; diff --git a/interfaces/kits/picker/picker.js b/interfaces/kits/picker/picker.js index 52626fb892269eaa98ec666032e83c03670b44e3..143479311d3b246d4dbceda841f6bf0f9c5328d8 100644 --- a/interfaces/kits/picker/picker.js +++ b/interfaces/kits/picker/picker.js @@ -78,6 +78,7 @@ const ARGS_ONE = 1; const ARGS_TWO = 2; const RESULT_CODE_ERROR = -1; const RESULT_CODE_OK = 0; +const FILENAME_LENGTH = 3; /* * UTF-8字符编码数值对应的存储长度: @@ -307,7 +308,7 @@ function parseAudioPickerSelectOption(args, action) { config.parameters.key_pick_num = option.maxSelectNumber; } } - console.log('modal picker: audio select config: ' + JSON.stringify(config)); + console.log('[picker] audio select config: ' + JSON.stringify(config)); return config; } @@ -316,7 +317,7 @@ function getDocumentPickerSelectResult(args) { error: undefined, data: undefined }; - if (args.resultCode === undefined) { + if (args === undefined || args.resultCode === undefined) { selectResult.error = getErr(ErrCode.RESULT_ERROR); console.log('[picker] document select selectResult: ' + JSON.stringify(selectResult)); return selectResult; @@ -347,6 +348,7 @@ async function documentPickerSelect(...args) { let documentSelectConfig = undefined; let documentSelectResult = undefined; let selectResult = undefined; + let documentSelectWindow = undefined; try { if (this.context !== undefined) { @@ -363,9 +365,12 @@ async function documentPickerSelect(...args) { console.error('[picker] documentSelectContext == undefined'); throw getErr(ErrCode.CONTEXT_NO_EXIST); } + if (this.window !== undefined) { + documentSelectWindow = this.window; + } documentSelectConfig = parseDocumentPickerSelectOption(args, ACTION.SELECT_ACTION_MODAL); console.error('[picker] DocumentSelect documentSelectConfig: ' + JSON.stringify(documentSelectConfig)); - documentSelectResult = await modalPicker(args, documentSelectContext, documentSelectConfig); + documentSelectResult = await modalPicker(documentSelectContext, documentSelectConfig, documentSelectWindow); } catch (paramError) { console.error('[picker] DocumentSelect paramError: ' + JSON.stringify(paramError)); } @@ -413,7 +418,7 @@ function getAudioPickerSelectResult(args) { error: undefined, data: undefined }; - if (args.resultCode === undefined) { + if (args === undefined || args.resultCode === undefined) { selectResult.error = getErr(ErrCode.RESULT_ERROR); console.log('[picker] getAudioPickerSelectResult selectResult: ' + JSON.stringify(selectResult)); return selectResult; @@ -430,8 +435,9 @@ function getAudioPickerSelectResult(args) { selectResult.data = []; selectResult.error = args.resultCode; } + console.log('[picker] getAudioPickerSelectResult selectResult: errorcode is = ' + selectResult.error + - ', selecturi is = ' + anonymousPathArray(selectResult.data)); + ', selecturi is = ' + anonymousPathArray(selectResult.data)); return selectResult; } @@ -441,7 +447,7 @@ function getDocumentPickerSaveResult(args) { error: undefined, data: undefined }; - if (args.resultCode === undefined) { + if (args === undefined || args.resultCode === undefined) { saveResult.error = getErr(ErrCode.RESULT_ERROR); console.log('[picker] getDocumentPickerSaveResult saveResult: ' + JSON.stringify(saveResult)); return saveResult; @@ -455,38 +461,42 @@ function getDocumentPickerSaveResult(args) { saveResult.data = []; saveResult.error = args.resultCode; } + console.log('[picker] getDocumentPickerSaveResult saveResult: errorcode is = ' + saveResult.error + - ', selecturi is = ' + anonymousPathArray(saveResult.data) + ', usersavesuffix = ' + saveResult.suffix); + ', selecturi is = ' + anonymousPathArray(saveResult.data) + ', usersavesuffix = ' + saveResult.suffix); return saveResult; } -function startModalPicker(context, config) { +function startModalPicker(context, config, window) { if (context === undefined) { - console.log('[picker] modal picker: startModalPicker context undefined.'); - throw Error('[picker] modal picker: startModalPicker context undefined.'); + throw Error('[picker] Context undefined.'); } if (config === undefined) { - console.log('[picker] modal picker: startModalPicker config undefined.'); - throw Error('[picker] modal picker: startModalPicker config undefined.'); + throw Error('[picker] Config undefined.'); } gContext = context; if (pickerHelper === undefined) { - console.log('[picker] modal picker: pickerHelper undefined.'); + throw Error('[picker] PickerHelper undefined.'); + } + let helper; + if (window !== undefined) { + helper = pickerHelper.startModalPicker(gContext, config, window); + } else { + helper = pickerHelper.startModalPicker(gContext, config); } - let helper = pickerHelper.startModalPicker(gContext, config); if (helper === undefined) { - console.log('[picker] modal picker: startModalPicker helper undefined.'); + throw Error('[picker] Please check the parameter you entered.'); } return helper; } -async function modalPicker(args, context, config) { +async function modalPicker(context, config, window) { try { - console.log('[picker] modal picker: config: ' + JSON.stringify(config)); - let modalResult = await startModalPicker(context, config); + console.log('[picker] Config: ' + JSON.stringify(config)); + let modalResult = await startModalPicker(context, config, window); return modalResult; } catch (resultError) { - console.error('[picker] modal picker: Result error: ' + resultError); + console.error('[picker] Result error: ' + resultError); return undefined; } } @@ -502,6 +512,7 @@ async function documentPickerSave(...args) { let documentSaveConfig = undefined; let documentSaveResult = undefined; let saveResult = undefined; + let documentSaveWindow = undefined; try { if (this.context !== undefined) { @@ -513,11 +524,14 @@ async function documentPickerSave(...args) { console.error('[picker] getContext error: ' + getContextError); throw getErr(ErrCode.CONTEXT_NO_EXIST); } + if (this.window !== undefined) { + documentSaveWindow = this.window; + } documentSaveConfig = parseDocumentPickerSaveOption(args, ACTION.SAVE_ACTION_MODAL); console.log('[picker] document save start'); - documentSaveResult = await modalPicker(args, documentSaveContext, documentSaveConfig); + documentSaveResult = await modalPicker(documentSaveContext, documentSaveConfig, documentSaveWindow); saveResult = getDocumentPickerSaveResult(documentSaveResult); return sendResult(args, saveResult); } @@ -557,6 +571,7 @@ async function audioPickerSelect(...args) { console.log('[picker] audio select config: ' + JSON.stringify(audioSelectConfig)); let audioSelectContext = undefined; + let audipSelectWindow = undefined; try { if (this.context !== undefined) { audioSelectContext = this.context; @@ -572,7 +587,7 @@ async function audioPickerSelect(...args) { console.error('[picker] audioSelectContext == undefined'); throw getErr(ErrCode.CONTEXT_NO_EXIST); } - let modalSelectResult = await modalPicker(args, audioSelectContext, audioSelectConfig); + let modalSelectResult = await modalPicker(audioSelectContext, audioSelectConfig, audipSelectWindow); let saveResult = getAudioPickerSelectResult(modalSelectResult); return sendResult(args, saveResult); } catch (error) { @@ -617,12 +632,26 @@ function AudioSaveOptions() { function ParseContext(args) { - if (args.length > ARGS_ONE || args.length < ARGS_ZERO || typeof args[ARGS_ZERO] !== 'object') { + if (args.length > ARGS_TWO || args.length < ARGS_ZERO || typeof args[ARGS_ZERO] !== 'object') { return undefined; } return args[ARGS_ZERO]; } +function parseWindow(args) +{ + if (args.length !== ARGS_TWO) { + console.log('[picker] ParseWindow: not window mode.'); + return undefined; + } + if (args.length === ARGS_TWO && typeof args[ARGS_ONE] !== 'object') { + console.log('[picker] ParseWindow: not window mode or type err.'); + return undefined; + } + console.log('[picker] ParseWindow: window mode.'); + return args[ARGS_ONE]; +} + function PhotoViewPicker(...args) { this.select = photoPickerSelect; this.save = documentPickerSave; @@ -633,6 +662,7 @@ function DocumentViewPicker(...args) { this.select = documentPickerSelect; this.save = documentPickerSave; this.context = ParseContext(args); + this.window = parseWindow(args); } function AudioViewPicker(...args) { diff --git a/interfaces/kits/picker/src/modal_ui_callback.cpp b/interfaces/kits/picker/src/modal_ui_callback.cpp index e9b24d9ea1c9fbafd754eafed61cb849d5d345f7..6c09f6bccb82a5cc7fc4c52ed50e159b7b085e06 100644 --- a/interfaces/kits/picker/src/modal_ui_callback.cpp +++ b/interfaces/kits/picker/src/modal_ui_callback.cpp @@ -33,14 +33,14 @@ void ModalUICallback::SetSessionId(int32_t sessionId) void ModalUICallback::OnRelease(int32_t releaseCode) { - HILOG_INFO("modal picker: OnRelease enter. release code is %{public}d", releaseCode); + HILOG_INFO("[picker] OnRelease enter. release code is %{public}d", releaseCode); this->uiContent->CloseModalUIExtension(this->sessionId_); pickerCallBack_->ready = true; } void ModalUICallback::OnError(int32_t code, const std::string& name, const std::string& message) { - HILOG_ERROR("modal picker: OnError enter. errorCode=%{public}d, name=%{public}s, message=%{public}s", + HILOG_ERROR("[picker] OnError enter. errorCode=%{public}d, name=%{public}s, message=%{public}s", code, name.c_str(), message.c_str()); this->uiContent->CloseModalUIExtension(this->sessionId_); } @@ -54,12 +54,12 @@ void ModalUICallback::OnResultForModal(int32_t resultCode, const OHOS::AAFwk::Wa void ModalUICallback::OnReceive(const OHOS::AAFwk::WantParams &request) { - HILOG_INFO("modal picker: OnReceive enter."); + HILOG_INFO("[picker] OnReceive enter."); } void ModalUICallback::OnDestroy() { - HILOG_INFO("modal picker: OnDestroy enter."); + HILOG_INFO("[picker] OnDestroy enter."); } } // namespace Picker } // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/picker/src/picker_n_exporter.cpp b/interfaces/kits/picker/src/picker_n_exporter.cpp index 11b684df9315a9128bd678b30d5096a7d7db49de..1496b9c27f51296c892424aaaa609e1695bde9dc 100644 --- a/interfaces/kits/picker/src/picker_n_exporter.cpp +++ b/interfaces/kits/picker/src/picker_n_exporter.cpp @@ -47,12 +47,12 @@ string PickerNExporter::GetClassName() static void StartModalPickerExecute(napi_env env, void *data) { - HILOG_INFO("modal picker: StartModalPickerExecute begin"); + HILOG_INFO("[picker]: StartModalPickerExecute begin"); auto *context = static_cast(data); while (!context->pickerCallBack->ready) { std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_TIME_MS)); } - HILOG_INFO("modal picker: StartModalPickerExecute is ready."); + HILOG_INFO("[picker]: StartModalPickerExecute is ready."); } static void MakeResultWithArr(napi_env env, std::string key, napi_value &result, @@ -63,7 +63,7 @@ static void MakeResultWithArr(napi_env env, std::string key, napi_value &result, napi_status status = napi_generic_failure; if (pickerCallBack->want.GetParams().HasParam(key.c_str())) { std::vector list = pickerCallBack->want.GetStringArrayParam(key.c_str()); - HILOG_INFO("modal picker: %{public}s size. %{public}zu ", key.c_str(), list.size()); + HILOG_INFO("[picker]: %{public}s size. %{public}zu ", key.c_str(), list.size()); for (size_t i = 0; i < list.size(); i++) { napi_value uri = nullptr; napi_create_string_utf8(env, list[i].c_str(), NAPI_AUTO_LENGTH, &uri); @@ -74,7 +74,7 @@ static void MakeResultWithArr(napi_env env, std::string key, napi_value &result, } status = napi_set_named_property(env, result, key.c_str(), array); if (status != napi_ok) { - HILOG_ERROR("modal picker: napi_set_named_property uri failed"); + HILOG_ERROR("[picker]: napi_set_named_property uri failed"); } } } @@ -95,7 +95,7 @@ static napi_value MakeResultWithPickerCallBack(napi_env env, std::shared_ptr(data); if (context == nullptr) { HILOG_ERROR("Async context is null"); @@ -114,11 +114,11 @@ static void StartModalPickerAsyncCallbackComplete(napi_env env, napi_status stat jsContext->status = false; status = napi_get_undefined(env, &jsContext->data); if (status != napi_ok) { - HILOG_ERROR("modal picker: napi_get_undefined jsContext->data failed"); + HILOG_ERROR("[picker]: napi_get_undefined jsContext->data failed"); } status = napi_get_undefined(env, &jsContext->error); if (status != napi_ok) { - HILOG_ERROR("modal picker: napi_get_undefined jsContext->error failed"); + HILOG_ERROR("[picker]: napi_get_undefined jsContext->error failed"); } napi_value result = MakeResultWithPickerCallBack(env, context->pickerCallBack); if (result != nullptr) { @@ -133,6 +133,83 @@ static void StartModalPickerAsyncCallbackComplete(napi_env env, napi_status stat context->work, *jsContext); } delete context; + if (window_) { + window_ = nullptr; + } +} + +static bool IsTypeRight(napi_env env, napi_value val, napi_valuetype type) +{ + napi_valuetype valueType; + napi_status status = napi_typeof(env, val, &valueType); + if (status != napi_ok || valueType != type) { + HILOG_ERROR("[picker] Type is not right, type: %{public}d", valueType); + return false; + } + return true; +} + +static ErrCode GetWindowName(napi_env env, napi_value properties, sptr &window) +{ + HILOG_INFO("[picker] Begin GetWindowName."); + napi_value name; + napi_status status = napi_get_named_property(env, properties, "name", &name); + if (status != napi_ok) { + HILOG_ERROR("Get name from properties fail."); + return ERR_INV; + } + size_t nameLen; + status = napi_get_value_string_utf8(env, name, NULL, 0, &nameLen); + if (status != napi_ok) { + HILOG_ERROR("[picker] Get window name length fail."); + return ERR_INV; + } + char *nameBuf = new char[nameLen + 1]; + status = napi_get_value_string_utf8(env, name, nameBuf, nameLen + 1, &nameLen); + if (status != napi_ok) { + HILOG_ERROR("[picker] Get value string UTF8 fail."); + return ERR_INV; + } + HILOG_INFO("[picker] Get window name: %{public}s", nameBuf); + auto customWindow = Rosen::Window::Find(nameBuf); + if (!customWindow) { + HILOG_ERROR("[picker] Window find fail."); + return ERR_INV; + } + window = customWindow; + HILOG_INFO("[picker] Window found: %{public}s", nameBuf); + delete[] nameBuf; + return ERR_OK; +} + +template +static ErrCode GetCustomShowingWindow(napi_env env, AsyncContext &asyncContext, + const napi_callback_info info, sptr &window) +{ + HILOG_INFO("[picker] GetCustomShowingWindow enter."); + napi_status status; + if (!IsTypeRight(env, asyncContext->argv[ARGS_TWO], napi_object)) { + HILOG_ERROR("[picker] The type of the parameter transferred to the window is not object."); + return ERR_INV; + } + auto windowObj = asyncContext->argv[ARGS_TWO]; + napi_value getPropertiesFunc; + status = napi_get_named_property(env, windowObj, "getWindowProperties", &getPropertiesFunc); + if (status != napi_ok || !getPropertiesFunc) { + HILOG_ERROR("[picker] getWindowProperties fail."); + return ERR_INV; + } + if (!IsTypeRight(env, getPropertiesFunc, napi_function)) { + HILOG_ERROR("[picker] The type of the parameter transferred to the getPropertiesFunc is not function."); + return ERR_INV; + } + napi_value properties; + status = napi_call_function(env, windowObj, getPropertiesFunc, 0, nullptr, &properties); + if (status != napi_ok || !properties) { + HILOG_INFO("[picker] Call getPropertiesFunc fail."); + return ERR_INV; + } + return GetWindowName(env, properties, window); } Ace::UIContent *GetUIContent(napi_env env, napi_callback_info info, @@ -141,19 +218,19 @@ Ace::UIContent *GetUIContent(napi_env env, napi_callback_info info, bool isStageMode = false; napi_status status = AbilityRuntime::IsStageContext(env, AsyncContext->argv[ARGS_ZERO], isStageMode); if (status != napi_ok || !isStageMode) { - HILOG_ERROR("modal picker: is not StageMode context"); + HILOG_ERROR("[picker]: is not StageMode context"); return nullptr; } auto context = AbilityRuntime::GetStageModeContext(env, AsyncContext->argv[ARGS_ZERO]); if (context == nullptr) { - HILOG_ERROR("modal picker: Failed to get native stage context instance"); + HILOG_ERROR("[picker]: Failed to get native stage context instance"); return nullptr; } auto abilityContext = AbilityRuntime::Context::ConvertTo(context); if (abilityContext == nullptr) { auto uiExtensionContext = AbilityRuntime::Context::ConvertTo(context); if (uiExtensionContext == nullptr) { - HILOG_ERROR("modal picker: Fail to convert to abilityContext or uiExtensionContext"); + HILOG_ERROR("[picker]: Fail to convert to abilityContext or uiExtensionContext"); return nullptr; } return uiExtensionContext->GetUIContent(); @@ -162,16 +239,24 @@ Ace::UIContent *GetUIContent(napi_env env, napi_callback_info info, } static napi_value StartPickerExtension(napi_env env, napi_callback_info info, - unique_ptr &AsyncContext) + unique_ptr &asyncContext) { - HILOG_INFO("modal picker: StartPickerExtension begin."); - Ace::UIContent *uiContent = GetUIContent(env, info, AsyncContext); + HILOG_INFO("[picker]: StartPickerExtension begin."); + Ace::UIContent *uiContent; + if (asyncContext->argc == ARGS_THREE && window_) { + HILOG_INFO("[picker] Will get uiContent by window."); + uiContent = window_->GetUIContent(); + } else { + HILOG_INFO("[picker] Will get uiContent by context."); + uiContent= GetUIContent(env, info, asyncContext); + } + if (uiContent == nullptr) { - HILOG_ERROR("modal picker: get uiContent failed"); + HILOG_ERROR("[picker]: get uiContent failed"); return nullptr; } AAFwk::Want request; - AppExecFwk::UnwrapWant(env, AsyncContext->argv[ARGS_ONE], request); + AppExecFwk::UnwrapWant(env, asyncContext->argv[ARGS_ONE], request); std::string targetType = request.GetStringParam("extType"); std::string pickerType; @@ -179,8 +264,8 @@ static napi_value StartPickerExtension(napi_env env, napi_callback_info info, pickerType = request.GetStringParam("pickerType"); } request.SetParam(ABILITY_WANT_PARAMS_UIEXTENSIONTARGETTYPE, targetType); - AsyncContext->pickerCallBack = make_shared(); - auto callback = std::make_shared(uiContent, AsyncContext->pickerCallBack); + asyncContext->pickerCallBack = make_shared(); + auto callback = std::make_shared(uiContent, asyncContext->pickerCallBack); Ace::ModalUIExtensionCallbacks extensionCallback = { .onRelease = std::bind(&ModalUICallback::OnRelease, callback, std::placeholders::_1), .onResult = std::bind(&ModalUICallback::OnResultForModal, callback, std::placeholders::_1, @@ -191,11 +276,11 @@ static napi_value StartPickerExtension(napi_env env, napi_callback_info info, .onDestroy = std::bind(&ModalUICallback::OnDestroy, callback), }; Ace::ModalUIExtensionConfig config; - HILOG_INFO("modal picker: will CreateModalUIExtension by extType: %{public}s, pickerType: %{public}s", + HILOG_INFO("[picker]: will CreateModalUIExtension by extType: %{public}s, pickerType: %{public}s", targetType.c_str(), pickerType.c_str()); int sessionId = uiContent->CreateModalUIExtension(request, extensionCallback, config); if (sessionId == 0) { - HILOG_ERROR("modal picker: create modalUIExtension failed"); + HILOG_ERROR("[picker]: create modalUIExtension failed"); return nullptr; } callback->SetSessionId(sessionId); @@ -208,22 +293,29 @@ template static napi_status AsyncContextSetStaticObjectInfo(napi_env env, napi_callback_info info, AsyncContext &asyncContext, const size_t minArgs, const size_t maxArgs) { - HILOG_INFO("modal picker: AsyncContextSetStaticObjectInfo begin."); + HILOG_INFO("[picker]: AsyncContextSetStaticObjectInfo begin."); napi_value thisVar = nullptr; asyncContext->argc = maxArgs; napi_status ret = napi_get_cb_info(env, info, &asyncContext->argc, &(asyncContext->argv[ARGS_ZERO]), &thisVar, nullptr); if (ret != napi_ok) { - HILOG_ERROR("modal picker: Failed to get cb info"); + HILOG_ERROR("[picker]: Failed to get cb info"); return ret; } + if (asyncContext->argc == ARGS_THREE) { + int res = GetCustomShowingWindow(env, asyncContext, info, window_); + if (res != ERR_OK) { + HILOG_ERROR("[picker] Failed to get cb window_ info."); + return napi_invalid_arg; + } + } if (!((asyncContext->argc >= minArgs) && (asyncContext->argc <= maxArgs))) { - HILOG_ERROR("modal picker: Number of args is invalid"); + HILOG_ERROR("[picker]: Number of args is invalid"); return napi_invalid_arg; } if (minArgs > 0) { if (asyncContext->argv[ARGS_ZERO] == nullptr) { - HILOG_ERROR("modal picker: Argument list is empty"); + HILOG_ERROR("[picker]: Argument list is empty"); return napi_invalid_arg; } } @@ -233,12 +325,13 @@ static napi_status AsyncContextSetStaticObjectInfo(napi_env env, napi_callback_i static napi_value ParseArgsStartModalPicker(napi_env env, napi_callback_info info, unique_ptr &context) { - HILOG_INFO("modal picker: ParseArgsStartModalPicker begin."); + HILOG_INFO("[picker]: ParseArgsStartModalPicker begin."); constexpr size_t minArgs = ARGS_TWO; constexpr size_t maxArgs = ARGS_THREE; napi_status status = AsyncContextSetStaticObjectInfo(env, info, context, minArgs, maxArgs); if (status != napi_ok) { - HILOG_ERROR("modal picker: AsyncContextSetStaticObjectInfo faild"); + HILOG_ERROR("[picker]: AsyncContextSetStaticObjectInfo faild"); + return nullptr; } napi_value result = nullptr; napi_value ret = StartPickerExtension(env, info, context); @@ -251,7 +344,7 @@ static napi_value ParseArgsStartModalPicker(napi_env env, napi_callback_info inf napi_value PickerNExporter::StartModalPicker(napi_env env, napi_callback_info info) { - HILOG_INFO("modal picker: StartModalPicker begin."); + HILOG_INFO("[picker]: StartModalPicker begin."); unique_ptr asyncContext = make_unique(); napi_value ret = ParseArgsStartModalPicker(env, info, asyncContext); if (ret == nullptr) {