mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 09:21:28 +00:00
modify log
Signed-off-by: chenxinzhan <chenxinzhan@huawei.com>
This commit is contained in:
parent
bbbddde5af
commit
4dc86cbd35
@ -33,16 +33,16 @@ constexpr int32_t RESULT_CANCEL = 1;
|
||||
|
||||
napi_value ResultCodeInit(napi_env env)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "call");
|
||||
if (env == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Invalid input parameters.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Invalid input parameters");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value objValue = nullptr;
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed to get object");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed get object");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "JsDialogRequest::Finalizer is called");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
std::unique_ptr<JsDialogRequest>(static_cast<JsDialogRequest*>(data));
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
private:
|
||||
napi_value OnGetRequestInfo(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Params not match");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -85,14 +85,14 @@ private:
|
||||
|
||||
OHOS::AAFwk::Want want;
|
||||
if (!OHOS::AppExecFwk::UnwrapWant(env, info.argv[0], want)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Parse param want failed, must be a Want.");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, must be a Want.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "UnwrapWant failed");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, must be a Want");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> callerToken = want.GetRemoteObject(RequestConstants::REQUEST_TOKEN_KEY);
|
||||
if (!callerToken) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "get token from target want failed.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "get token from target want failed");
|
||||
ThrowInvalidParamError(env, "Parameter error: get token from target want failed.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -104,7 +104,7 @@ private:
|
||||
auto requestInfo = new RequestInfo(callerToken, left, top, width, height);
|
||||
auto jsRequestInfo = RequestInfo::WrapRequestInfo(env, requestInfo);
|
||||
if (jsRequestInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Wrap Param requestInfo failed, must be a RequestInfo.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "WrapRequestInfo failed");
|
||||
ThrowInvalidParamError(env, "Wrap Param requestInfo failed, must be a RequestInfo.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -114,7 +114,7 @@ private:
|
||||
|
||||
napi_value OnGetRequestCallback(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Params is not match");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -123,21 +123,21 @@ private:
|
||||
|
||||
OHOS::AAFwk::Want want;
|
||||
if (!OHOS::AppExecFwk::UnwrapWant(env, info.argv[0], want)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "The input want is invalid.");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, must be a Want.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "The input want is invalid");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, must be a Want");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remoteObj = want.GetRemoteObject(RequestConstants::REQUEST_CALLBACK_KEY);
|
||||
if (!remoteObj) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Wrap Param requestCallback failed, must be a RequestCallback.");
|
||||
ThrowInvalidParamError(env, "Wrap Param requestCallback failed, must be a RequestCallback.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Wrap Param requestCallback failed, must be a RequestCallback");
|
||||
ThrowInvalidParamError(env, "Wrap Param requestCallback failed, must be a RequestCallback");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
sptr<IDialogRequestCallback> callback = iface_cast<IDialogRequestCallback>(remoteObj);
|
||||
if (!callback) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Cast to IDialogRequestCallback failed.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Cast to IDialogRequestCallback failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -148,9 +148,9 @@ private:
|
||||
|
||||
napi_value JsDialogRequestInit(napi_env env, napi_value exportObj)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "call");
|
||||
if (env == nullptr || exportObj == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "Invalid input parameters");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "Invalid input");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "call");
|
||||
std::unique_ptr<JsDialogRequestCallback>(static_cast<JsDialogRequestCallback*>(data));
|
||||
}
|
||||
|
||||
static napi_value SetRequestResult(napi_env env, napi_callback_info info)
|
||||
{
|
||||
if (env == nullptr || info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "input parameters %{public}s is nullptr", ((env == nullptr) ? "env" : "info"));
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "null %{public}s", ((env == nullptr) ? "env" : "info"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
private:
|
||||
napi_value OnSetRequestResult(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "function called");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (info.argc < 1) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Params not match");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -58,7 +58,7 @@ private:
|
||||
}
|
||||
|
||||
if (!CheckTypeForNapiValue(env, info.argv[0], napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "param type mismatch!");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "param type error");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -67,7 +67,7 @@ private:
|
||||
napi_get_named_property(env, info.argv[0], "result", &resultCode);
|
||||
int32_t resultCodeValue = 0;
|
||||
if (!ConvertFromJsValue(env, resultCode, resultCodeValue)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Convert result failed!");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Convert result failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -98,16 +98,16 @@ private:
|
||||
|
||||
napi_value CreateJsDialogRequestCallback(napi_env env, const sptr<IDialogRequestCallback> &remoteObj)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "CreateJsDialogRequestCallback");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (!remoteObj) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "remoteObj is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "remoteObj invalid.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
napi_value objValue = nullptr;
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "object is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "object invalid.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ napi_value CreateJsDialogRequestCallback(napi_env env, const sptr<IDialogRequest
|
||||
const char *moduleName = "JsDialogRequestCallback";
|
||||
BindNativeFunction(env, objValue, "setRequestResult", moduleName, JsDialogRequestCallback::SetRequestResult);
|
||||
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "CreateJsDialogRequestCallback end");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "end");
|
||||
return objValue;
|
||||
}
|
||||
} // AbilityRuntime
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "JsDialogSession::Finalizer is called");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
std::unique_ptr<JsDialogSession>(static_cast<JsDialogSession*>(data));
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
private:
|
||||
napi_value OnGetDialogSessionInfo(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "argc = %{public}d", static_cast<int32_t>(info.argc));
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "argc:%{public}d", static_cast<int32_t>(info.argc));
|
||||
if (info.argc < 1) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -63,7 +63,7 @@ private:
|
||||
}
|
||||
std::string dialogSessionId = "";
|
||||
if (!ConvertFromJsValue(env, info.argv[0], dialogSessionId)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed to unwrap dialogSessionId");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed unwrap dialogSessionId");
|
||||
ThrowInvalidParamError(env, "Parameter error: dialogSessionId must be a valid string.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@ -82,7 +82,7 @@ private:
|
||||
|
||||
napi_value OnSendDialogResult(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "argc = %{public}d", static_cast<int32_t>(info.argc));
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "argc:%{public}d", static_cast<int32_t>(info.argc));
|
||||
if (info.argc < ARGC_THREE) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@ -90,20 +90,20 @@ private:
|
||||
}
|
||||
std::string dialogSessionId = "";
|
||||
if (!ConvertFromJsValue(env, info.argv[0], dialogSessionId)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed to unwrap dialogSessionId");
|
||||
ThrowInvalidParamError(env, "Parameter error: dialogSessionId must be a valid string.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed unwrap dialogSessionId");
|
||||
ThrowInvalidParamError(env, "Parameter error: dialogSessionId must be a valid string");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnwrapWant(env, info.argv[1], want)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed to unwrap want");
|
||||
ThrowInvalidParamError(env, "Parameter error: want must be a Want.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed unwrap want");
|
||||
ThrowInvalidParamError(env, "Parameter error: want must be a Want");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
bool isAllow = false;
|
||||
if (!ConvertFromJsValue(env, info.argv[ARGC_TWO], isAllow)) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed to unwrap isAllow");
|
||||
ThrowInvalidParamError(env, "Parameter error: isAllow must be a Boolean.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "Failed unwrap isAllow");
|
||||
ThrowInvalidParamError(env, "Parameter error: isAllow must be a Boolean");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
@ -127,9 +127,9 @@ private:
|
||||
|
||||
napi_value JsDialogSessionInit(napi_env env, napi_value exportObj)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "JsDialogSessionInit is called");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (env == nullptr || exportObj == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "Invalid input parameters");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "Invalid input");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@ namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
void DialogRequestCallbackImpl::SendResult(int32_t resultCode, const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "called");
|
||||
TAG_LOGI(AAFwkTag::DIALOG, "call");
|
||||
if (task_) {
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "result code:%{public}d.", resultCode);
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "result code:%{public}d", resultCode);
|
||||
task_(resultCode, want);
|
||||
}
|
||||
}
|
||||
|
@ -22,17 +22,17 @@ DialogUIExtensionCallback::DialogUIExtensionCallback(const std::weak_ptr<AppExec
|
||||
{}
|
||||
void DialogUIExtensionCallback::OnRelease()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Call");
|
||||
auto abilityCallback = abilityCallback_.lock();
|
||||
if (abilityCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback null");
|
||||
return;
|
||||
}
|
||||
#ifdef SUPPORT_SCREEN
|
||||
abilityCallback->EraseUIExtension(sessionId_);
|
||||
|
||||
if (uiContent_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "uiContent_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "uiContent_ null");
|
||||
return;
|
||||
}
|
||||
uiContent_->CloseModalUIExtension(sessionId_);
|
||||
@ -41,16 +41,16 @@ void DialogUIExtensionCallback::OnRelease()
|
||||
|
||||
void DialogUIExtensionCallback::OnError()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Call");
|
||||
auto abilityCallback = abilityCallback_.lock();
|
||||
if (abilityCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback null");
|
||||
return;
|
||||
}
|
||||
#ifdef SUPPORT_SCREEN
|
||||
abilityCallback->EraseUIExtension(sessionId_);
|
||||
if (uiContent_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "uiContent_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "uiContent_ null");
|
||||
return;
|
||||
}
|
||||
uiContent_->CloseModalUIExtension(sessionId_);
|
||||
@ -59,10 +59,10 @@ void DialogUIExtensionCallback::OnError()
|
||||
|
||||
void DialogUIExtensionCallback::OnDestroy()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Called");
|
||||
TAG_LOGD(AAFwkTag::DIALOG, "Call");
|
||||
auto abilityCallback = abilityCallback_.lock();
|
||||
if (abilityCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DIALOG, "abilityCallback null");
|
||||
return;
|
||||
}
|
||||
#ifdef SUPPORT_SCREEN
|
||||
|
Loading…
Reference in New Issue
Block a user