mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
ability runtime日志优化:
PROCESSMGR,AUTO_STARTUP,SER_ROUTER,EXTMGR,SERVICE_EXT, AUTOFILL_EXT,EXT,DATA_ABILITY,ECOLOGICAL_RULE,CONNECTION, MISSION,AUTOFILLMGR Signed-off-by: hanchenZz <wanghanchen1@huawei.com>
This commit is contained in:
@@ -135,7 +135,7 @@ napi_value CreateJsAbilityStateData(napi_env env, const AbilityStateData &abilit
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "ObjValue nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null ObjValue");
|
||||
return nullptr;
|
||||
}
|
||||
napi_set_named_property(env, object, "bundleName", CreateJsValue(env, abilityStateData.bundleName));
|
||||
|
||||
@@ -81,7 +81,7 @@ napi_value JsAutoFillManager::OnRequestAutoSave(napi_env env, NapiCallbackInfo &
|
||||
|
||||
if (info.argc != ARGC_ONE) {
|
||||
if (!CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Second input parameter error.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Second parameter error");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM),
|
||||
"Parameter error. The second parameter is not of type callback.");
|
||||
return CreateJsUndefined(env);
|
||||
@@ -109,7 +109,7 @@ void JsAutoFillManager::OnRequestAutoSaveInner(napi_env env, int32_t instanceId,
|
||||
AbilityRuntime::AutoFill::AutoFillResult result;
|
||||
auto ret = AutoFillManager::GetInstance().RequestAutoSave(uiContent, request, saveRequestCallback, result);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Request auto save error[%{public}d].", ret);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "RequestAutoSave error[%{public}d]", ret);
|
||||
ThrowError(env, GetJsErrorCodeByNativeError(ret));
|
||||
return;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ napi_value JsAutoFillManagerInit(napi_env env, napi_value exportObj)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (env == nullptr || exportObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Env or exportObj nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null Env or exportObj");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void JsAutoSaveRequestCallback::JSCallFunctionWorker(const std::string &methodNa
|
||||
|
||||
napi_value funcObject;
|
||||
if (napi_get_named_property(env_, obj, methodName.c_str(), &funcObject) != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Get function by name failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Get function failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void JsAutoSaveRequestCallback::JSCallFunctionWorker(const std::string &methodNa
|
||||
bool JsAutoSaveRequestCallback::IsJsCallbackEquals(std::shared_ptr<NativeReference> callback, napi_value value)
|
||||
{
|
||||
if (callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Invalid jsCallback.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Invalid jsCallback");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ bool JsAutoSaveRequestCallback::IsJsCallbackEquals(std::shared_ptr<NativeReferen
|
||||
|
||||
bool result = false;
|
||||
if (napi_strict_equals(env_, object, value, &result) != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Object does not match value.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Object not match");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "%{public}s::Finalizer is called", PROCESS_MANAGER_NAME);
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Called");
|
||||
std::unique_ptr<JsChildProcessManager>(static_cast<JsChildProcessManager*>(data));
|
||||
}
|
||||
|
||||
@@ -68,26 +68,26 @@ private:
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (argc < ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
std::string srcEntry;
|
||||
int32_t startMode;
|
||||
if (!ConvertFromJsValue(env, argv[PARAM0], srcEntry)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Parse param srcEntry failed");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Parse srcEntry failed");
|
||||
ThrowInvalidParamError(env, "Parse param srcEntry failed, must be a valid string.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (!ConvertFromJsValue(env, argv[PARAM1], startMode)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Parse param startMode failed");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Parse startMode failed");
|
||||
ThrowInvalidParamError(env,
|
||||
"Unsupported startMode, must be StartMode.SELF_FORK or StartMode.APP_SPAWN_FORK.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "StartMode: %{public}d", startMode);
|
||||
if (startMode != MODE_SELF_FORK && startMode != MODE_APP_SPAWN_FORK) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Not supported StartMode");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Invalid StartMode");
|
||||
ThrowInvalidParamError(env,
|
||||
"Unsupported startMode, must be StartMode.SELF_FORK or StartMode.APP_SPAWN_FORK.");
|
||||
return CreateJsUndefined(env);
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
auto pid = std::make_shared<pid_t>(ERR_INVALID_VALUE);
|
||||
NapiAsyncTask::ExecuteCallback execute = [srcEntry, pid, innerErrorCode]() {
|
||||
if (!pid || !innerErrorCode) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "innerErrorCode or pid is nullptr");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null innerErrorCode or pid");
|
||||
return;
|
||||
}
|
||||
*innerErrorCode = ChildProcessManager::GetInstance().StartChildProcessByAppSpawnFork(srcEntry, *pid);
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[pid, innerErrorCode](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
if (!pid || !innerErrorCode) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "innerErrorCode or pid is nullptr");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null innerErrorCode or pid");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ bool InnerWrapJsWantParamsWantParams(
|
||||
|
||||
bool WrapJsWantParamsArray(napi_env env, napi_value object, const std::string &key, sptr<AAFwk::IArray> &ao)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called. key=%{public}s", key.c_str());
|
||||
TAG_LOGI(AAFwkTag::MISSION, "key:%{public}s", key.c_str());
|
||||
if (AAFwk::Array::IsStringArray(ao)) {
|
||||
return InnerWrapWantParamsArray<AAFwk::IString, AAFwk::String, std::string>(
|
||||
env, object, key, ao);
|
||||
|
||||
@@ -90,9 +90,9 @@ bool JsMissionListener::IsEmpty()
|
||||
|
||||
void JsMissionListener::CallJsMethod(const std::string &methodName, int32_t missionId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::MISSION, "methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGD(AAFwkTag::MISSION, "methodName:%{public}s", methodName.c_str());
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ nullptr");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null env_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ void JsMissionListener::CallJsFunction(
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "method:%{public}s", methodName);
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get object");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "get obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ void JsMissionListener::CallJsFunction(
|
||||
napi_get_named_property(env_, obj, methodName, &method);
|
||||
if (method == nullptr || AppExecFwk::IsTypeForNapiValue(env_, method, napi_undefined)
|
||||
|| AppExecFwk::IsTypeForNapiValue(env_, method, napi_null)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get %{public}s from object", methodName);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get %{public}s", methodName);
|
||||
return;
|
||||
}
|
||||
napi_value callResult = nullptr;
|
||||
@@ -151,14 +151,14 @@ void JsMissionListener::CallJsFunction(
|
||||
#ifdef SUPPORT_SCREEN
|
||||
void JsMissionListener::OnMissionIconUpdated(int32_t missionId, const std::shared_ptr<Media::PixelMap> &icon)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::MISSION, "OnMissionIconUpdated, missionId = %{public}d", missionId);
|
||||
TAG_LOGD(AAFwkTag::MISSION, "missionId: %{public}d", missionId);
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null env_");
|
||||
return;
|
||||
}
|
||||
|
||||
if (missionId <= 0 || !icon) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "missionId or icon is invalid, missionId:%{public}d", missionId);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid missionId or icon, missionId:%{public}d", missionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void JsMissionListener::OnMissionIconUpdated(int32_t missionId, const std::share
|
||||
void JsMissionListener::CallJsMissionIconUpdated(int32_t missionId, const std::shared_ptr<Media::PixelMap> &icon)
|
||||
{
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ is nullptr, not call js mission updated.");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null env_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -191,14 +191,14 @@ void JsMissionListener::CallJsMissionIconUpdated(int32_t missionId, const std::s
|
||||
for (auto &item : tmpMap) {
|
||||
napi_value obj = (item.second)->GetNapiValue();
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get js object");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "get js obj failed");
|
||||
continue;
|
||||
}
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, "onMissionIconUpdated", &method);
|
||||
if (method == nullptr || AppExecFwk::IsTypeForNapiValue(env_, method, napi_undefined)
|
||||
|| AppExecFwk::IsTypeForNapiValue(env_, method, napi_null)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get onMissionIconUpdated method from object");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "get onMissionIconUpdated method from obj failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
missionListener_->AddJsListenerObject(missionListenerId_, argv[ARGC_ONE]);
|
||||
return CreateJsValue(env, missionListenerId_);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "RegisterMissionListener failed, ret = %{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "RegisterMissionListener failed, ret:%{public}d", ret);
|
||||
missionListener_ = nullptr;
|
||||
if (ret == CHECK_PERMISSION_FAILED) {
|
||||
ThrowNoPermissionError(env, PermissionConstants::PERMISSION_MANAGE_MISSION);
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
missionListener_->AddJsListenerObject(missionListenerId_, argv[INDEX_ONE], true);
|
||||
return CreateJsValue(env, missionListenerId_);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "RegisterMissionListener failed, ret = %{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "RegisterMissionListener failed, ret:%{public}d", ret);
|
||||
missionListener_ = nullptr;
|
||||
if (ret == CHECK_PERMISSION_FAILED) {
|
||||
ThrowNoPermissionError(env, PermissionConstants::PERMISSION_MANAGE_MISSION);
|
||||
@@ -223,7 +223,7 @@ private:
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ private:
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ private:
|
||||
}
|
||||
|
||||
if (missionListener_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "missionListener_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null missionListener_");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ private:
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (!missionListener_->IsEmpty()) {
|
||||
TAG_LOGD(AAFwkTag::MISSION, "Off success, missionListener is not empty");
|
||||
TAG_LOGD(AAFwkTag::MISSION, "Off success, missionListener not empty");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
auto ret = AbilityManagerClient::GetInstance()->UnRegisterMissionListener(missionListener_);
|
||||
@@ -316,9 +316,9 @@ private:
|
||||
|
||||
napi_value OnGetMissionInfos(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -356,9 +356,9 @@ private:
|
||||
|
||||
napi_value OnGetMissionInfo(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -408,7 +408,7 @@ private:
|
||||
|
||||
napi_value GetMissionSnapShot(napi_env env, size_t argc, napi_value* argv, bool isLowResolution)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
std::string deviceId;
|
||||
int32_t missionId = -1;
|
||||
if (!CheckMissionSnapShotParams(env, argc, argv, deviceId, missionId)) {
|
||||
@@ -481,15 +481,15 @@ private:
|
||||
|
||||
napi_value OnLockMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnLockMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnLockMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionId failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -514,15 +514,15 @@ private:
|
||||
|
||||
napi_value OnUnlockMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnUnlockMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnUnlockMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionId failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -547,15 +547,15 @@ private:
|
||||
|
||||
napi_value OnClearMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnClearMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnClearMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionId failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -580,7 +580,7 @@ private:
|
||||
|
||||
napi_value OnClearAllMissions(napi_env env, const size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
auto ret = AbilityManagerClient::GetInstance()->CleanAllMissions();
|
||||
@@ -601,15 +601,15 @@ private:
|
||||
|
||||
napi_value OnMoveMissionToFront(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionToFront Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionToFront Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionId failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -617,7 +617,7 @@ private:
|
||||
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (argc > ARGC_ONE && AppExecFwk::IsTypeForNapiValue(env, argv[1], napi_object)) {
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnMoveMissionToFront start options is used.");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "start options used");
|
||||
AppExecFwk::UnwrapStartOptions(env, argv[1], startOptions);
|
||||
unwrapArgc++;
|
||||
}
|
||||
@@ -642,17 +642,17 @@ private:
|
||||
|
||||
napi_value OnMoveMissionsToForeground(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
std::vector<int32_t> missionIds;
|
||||
if (argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToForeground Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
uint32_t nativeArrayLen = 0;
|
||||
napi_get_array_length(env, argv[0], &nativeArrayLen);
|
||||
if (nativeArrayLen == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToForeground MissionId is null");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null MissionId");
|
||||
ThrowInvalidParamError(env, "Parse param missionIds failed, the size of missionIds must above zero.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -661,7 +661,7 @@ private:
|
||||
int32_t missionId = 0;
|
||||
napi_get_element(env, argv[0], i, &element);
|
||||
if (!ConvertFromJsValue(env, element, missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToForeground Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionIds failed, missionId must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -672,7 +672,7 @@ private:
|
||||
decltype(argc) unwrapArgc = 1;
|
||||
if (argc > ARGC_ONE && AppExecFwk::IsTypeForNapiValue(env, argv[1], napi_number)) {
|
||||
if (!ConvertFromJsValue(env, argv[1], topMissionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToForeground Parse topMissionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse topMissionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param topMission failed, must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -700,17 +700,17 @@ private:
|
||||
|
||||
napi_value OnMoveMissionsToBackground(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
std::vector<int32_t> missionIds;
|
||||
if (argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToBackground Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
uint32_t nativeArrayLen = 0;
|
||||
napi_get_array_length(env, argv[0], &nativeArrayLen);
|
||||
if (nativeArrayLen == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToBackground MissionId is null");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null MissionId");
|
||||
ThrowInvalidParamError(env, "Parse param missionIds failed, the size of missionIds must above zero.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -719,7 +719,7 @@ private:
|
||||
int32_t missionId;
|
||||
napi_get_element(env, argv[0], i, &element);
|
||||
if (!ConvertFromJsValue(env, element, missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionsToBackground Parse topMissionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse topMissionId failed");
|
||||
ThrowInvalidParamError(env, "Parse param missionIds failed, missionId must be a number.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -757,18 +757,18 @@ private:
|
||||
}
|
||||
|
||||
if (!AppExecFwk::IsTypeForNapiValue(env, argv[0], napi_string)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "CheckOnOffType, Param 0 is not string");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Param 0 not string");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string type;
|
||||
if (!ConvertFromJsValue(env, argv[0], type)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "CheckOnOffType, Parse on off type failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse on off type failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type != ON_OFF_TYPE) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "CheckOnOffType, args[0] should be mission.");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "args[0] should be mission");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -791,7 +791,7 @@ napi_value JsMissionManagerInit(napi_env env, napi_value exportObj)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::MISSION, "called");
|
||||
if (env == nullptr || exportObj == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::MISSION, "Invalid input parameters");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "Invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ bool CheckContinueKeyExist(napi_env &env, const napi_value &value)
|
||||
bool isWantParam = false;
|
||||
napi_has_named_property(env, value, "wantParam", &isWantParam);
|
||||
if (!isSrcDeviceId && !isDstDeviceId && !isMissionId && !isWantParam) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "%{public}s, Wrong argument key.", __func__);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Wrong argument key");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -30,7 +30,7 @@ bool DmsSaClient::SubscribeDmsSA()
|
||||
sptr<DmsSystemAbilityStatusChange> callback(new DmsSystemAbilityStatusChange());
|
||||
int32_t ret = saMgrProxy_->SubscribeSystemAbility(DISTRIBUTED_SCHED_SA_ID, callback);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to subscribe system ability DISTRIBUTED_SCHED_SA_ID ret:%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SubscribeSystemAbility ret:%{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -38,10 +38,10 @@ bool DmsSaClient::SubscribeDmsSA()
|
||||
|
||||
int32_t DmsSaClient::AddListener(const std::string& type, const sptr<IRemoteOnListener>& listener)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s called, the type is %{public}s", __func__, type.c_str());
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, type: %{public}s", type.c_str());
|
||||
saMgrProxy_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (saMgrProxy_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "fail to get saMgrProxy.");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "get saMgrProxy failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (saMgrProxy_->CheckSystemAbility(DISTRIBUTED_SCHED_SA_ID)) {
|
||||
@@ -61,7 +61,7 @@ int32_t DmsSaClient::AddListener(const std::string& type, const sptr<IRemoteOnLi
|
||||
|
||||
int32_t DmsSaClient::DelListener(const std::string& type, const sptr<IRemoteOnListener>& listener)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s called, the type is %{public}s", __func__, type.c_str());
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, type: %{public}s", type.c_str());
|
||||
if (saMgrProxy_->CheckSystemAbility(DISTRIBUTED_SCHED_SA_ID)) {
|
||||
AbilityManagerClient::GetInstance()->RegisterOffListener(type, listener);
|
||||
}
|
||||
@@ -72,60 +72,60 @@ int32_t DmsSaClient::DelListener(const std::string& type, const sptr<IRemoteOnLi
|
||||
|
||||
void DmsSaClient::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s called, the systemAbilityId is %{public}d", __func__, systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, systemAbilityId: %{public}d", systemAbilityId);
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
if (systemAbilityId == DISTRIBUTED_SCHED_SA_ID) {
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s listeners size: %{public}zu .", __func__, listeners_.size());
|
||||
TAG_LOGI(AAFwkTag::MISSION, "listeners size: %{public}zu", listeners_.size());
|
||||
for (auto& listener : listeners_) {
|
||||
AbilityManagerClient::GetInstance()->RegisterOnListener(listener.first, listener.second);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %{public}d",
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId: %{public}d, need DISTRIBUTED_SCHED_SA_ID",
|
||||
systemAbilityId);
|
||||
}
|
||||
}
|
||||
|
||||
void DmsSaClient::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s called, the systemAbilityId is %{public}d", __func__, systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, systemAbilityId: %{public}d", systemAbilityId);
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
if (systemAbilityId == DISTRIBUTED_SCHED_SA_ID) {
|
||||
for (auto& listener : listeners_) {
|
||||
AbilityManagerClient::GetInstance()->RegisterOffListener(listener.first, listener.second);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %{public}d",
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId: %{public}d, need DISTRIBUTED_SCHED_SA_ID",
|
||||
systemAbilityId);
|
||||
}
|
||||
}
|
||||
|
||||
DmsSystemAbilityStatusChange::DmsSystemAbilityStatusChange()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "DmsSystemAbilityStatusChange create");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "create");
|
||||
}
|
||||
|
||||
DmsSystemAbilityStatusChange::~DmsSystemAbilityStatusChange()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "DmsSystemAbilityStatusChange delete");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "delete");
|
||||
}
|
||||
|
||||
void DmsSystemAbilityStatusChange::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnAddSystemAbility called, the systemAbilityId is %d", systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, systemAbilityId: %d", systemAbilityId);
|
||||
if (systemAbilityId != DISTRIBUTED_SCHED_SA_ID) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %d", systemAbilityId);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId: %d, need DISTRIBUTED_SCHED_SA_ID", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
|
||||
DmsSaClient::GetInstance().OnAddSystemAbility(systemAbilityId, deviceId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnAddSystemAbility called end, the systemAbilityId is %d", systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called end, systemAbilityId: %d", systemAbilityId);
|
||||
}
|
||||
|
||||
void DmsSystemAbilityStatusChange::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnRemoveSystemAbility called, the systemAbilityId is %d", systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called, systemAbilityId: %d", systemAbilityId);
|
||||
if (systemAbilityId != DISTRIBUTED_SCHED_SA_ID) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %d", systemAbilityId);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "SystemAbilityId: %d, need DISTRIBUTED_SCHED_SA_ID", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ bool JsMissionListener::IsEmpty()
|
||||
|
||||
void JsMissionListener::CallJsMethod(const std::string &methodName, int32_t missionId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "methodName = %{public}s", methodName.c_str());
|
||||
TAG_LOGI(AAFwkTag::MISSION, "methodName: %{public}s", methodName.c_str());
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ null");
|
||||
return;
|
||||
@@ -113,7 +113,7 @@ void JsMissionListener::CallJsMethodInner(const std::string &methodName, int32_t
|
||||
napi_get_named_property(env_, obj, methodName.c_str(), &method);
|
||||
if (method == nullptr || AppExecFwk::IsTypeForNapiValue(env_, method, napi_undefined)
|
||||
|| AppExecFwk::IsTypeForNapiValue(env_, method, napi_null)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get %{public}s from object", methodName.c_str());
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get %{public}s", methodName.c_str());
|
||||
continue;
|
||||
}
|
||||
napi_value argv[] = { CreateJsValue(env_, missionId) };
|
||||
@@ -125,14 +125,14 @@ void JsMissionListener::CallJsMethodInner(const std::string &methodName, int32_t
|
||||
#ifdef SUPPORT_SCREEN
|
||||
void JsMissionListener::OnMissionIconUpdated(int32_t missionId, const std::shared_ptr<Media::PixelMap> &icon)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnMissionIconUpdated, missionId = %{public}d.", missionId);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "missionId: %{public}d", missionId);
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ is null");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (missionId <= 0 || !icon) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "missionId or icon is invalid, missionId:%{public}d.", missionId);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid missionId or icon, missionId:%{public}d", missionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ void JsMissionListener::OnMissionIconUpdated(int32_t missionId, const std::share
|
||||
void JsMissionListener::CallJsMissionIconUpdated(int32_t missionId, const std::shared_ptr<Media::PixelMap> &icon)
|
||||
{
|
||||
if (env_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "env_ is null, not call js mission updated.");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "null env_, return");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,14 +165,14 @@ void JsMissionListener::CallJsMissionIconUpdated(int32_t missionId, const std::s
|
||||
for (auto &item : tmpMap) {
|
||||
napi_value obj = (item.second)->GetNapiValue();
|
||||
if (obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get js object");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "get js obj failed");
|
||||
continue;
|
||||
}
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, "onMissionIconUpdated", &method);
|
||||
if (method == nullptr || AppExecFwk::IsTypeForNapiValue(env_, method, napi_undefined)
|
||||
|| AppExecFwk::IsTypeForNapiValue(env_, method, napi_null)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get onMissionIconUpdated method from object");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Failed to get onMissionIconUpdated");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ int32_t MissionContinueStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
if (data.ReadInterfaceToken() != GetDescriptor()) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Local descriptor is not equal to remote");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ int32_t MissionContinueStub::OnRemoteRequest(
|
||||
return NO_ERROR;
|
||||
}
|
||||
default: {
|
||||
TAG_LOGW(AAFwkTag::MISSION, "MissionContinueStub::OnRemoteRequest code: %{public}d", code);
|
||||
TAG_LOGW(AAFwkTag::MISSION, "code: %{public}d", code);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "JsMissionManager::Finalizer is called");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
std::unique_ptr<JsMissionManager>(static_cast<JsMissionManager*>(data));
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
private:
|
||||
napi_value OnRegisterMissionListener(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < 1) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Params not match");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
missionListener_->AddJsListenerObject(missionListenerId_, argv[0]);
|
||||
return CreateJsValue(env, missionListenerId_);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "RegisterMissionListener error, ret = %{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::MISSION, "error, ret: %{public}d", ret);
|
||||
missionListener_ = nullptr;
|
||||
if (ret == CHECK_PERMISSION_FAILED) {
|
||||
ThrowNoPermissionError(env, PermissionConstants::PERMISSION_MANAGE_MISSION);
|
||||
@@ -143,9 +143,9 @@ private:
|
||||
|
||||
napi_value OnUnregisterMissionListener(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < 1) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -188,9 +188,9 @@ private:
|
||||
|
||||
napi_value OnGetMissionInfos(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) { // at least 2 parameters.
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -228,9 +228,9 @@ private:
|
||||
|
||||
napi_value OnGetMissionInfo(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc < ARG_COUNT_TWO) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -352,15 +352,15 @@ private:
|
||||
|
||||
napi_value OnLockMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnLockMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnLockMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -385,15 +385,15 @@ private:
|
||||
|
||||
napi_value OnUnlockMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnUnlockMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnUnlockMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -418,15 +418,15 @@ private:
|
||||
|
||||
napi_value OnClearMission(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnClearMission Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnClearMission Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -451,7 +451,7 @@ private:
|
||||
|
||||
napi_value OnClearAllMissions(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
auto ret = AbilityManagerClient::GetInstance()->CleanAllMissions();
|
||||
@@ -472,15 +472,15 @@ private:
|
||||
|
||||
napi_value OnMoveMissionToFront(napi_env env, size_t argc, napi_value* argv)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "%{public}s is called", __FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (argc == 0) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionToFront Not enough params");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
int32_t missionId = -1;
|
||||
if (!ConvertFromJsValue(env, argv[0], missionId)) {
|
||||
TAG_LOGE(AAFwkTag::MISSION, "OnMoveMissionToFront Parse missionId failed");
|
||||
TAG_LOGE(AAFwkTag::MISSION, "Parse missionId failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -488,7 +488,7 @@ private:
|
||||
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (argc > ARGC_ONE && AppExecFwk::IsTypeForNapiValue(env, argv[1], napi_object)) {
|
||||
TAG_LOGI(AAFwkTag::MISSION, "OnMoveMissionToFront start options is used.");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "start options used");
|
||||
AppExecFwk::UnwrapStartOptions(env, argv[1], startOptions);
|
||||
unwrapArgc++;
|
||||
}
|
||||
@@ -517,9 +517,9 @@ private:
|
||||
|
||||
napi_value JsMissionManagerInit(napi_env env, napi_value exportObj)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::MISSION, "JsMissionManagerInit is called");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "called");
|
||||
if (env == nullptr || exportObj == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::MISSION, "Invalid input parameters");
|
||||
TAG_LOGI(AAFwkTag::MISSION, "Invalid input param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ void AbilityConnection::OnAbilityConnectDone(
|
||||
mutex_.unlock();
|
||||
sptr<AbilityConnection> connection(this);
|
||||
if (ConnectionManager::GetInstance().DisconnectNonexistentService(element, connection)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "No need to call onConnect callback.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "No need onConnect callback");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void AbilityConnection::OnAbilityConnectDone(
|
||||
(*item)->OnAbilityConnectDone(element, remoteObject, resultCode);
|
||||
item++;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "end, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "end, bundleName:%{public}s, abilityName:%{public}s",
|
||||
element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void AbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& e
|
||||
bool ret = ConnectionManager::GetInstance().RemoveConnection(connection);
|
||||
if (ret) {
|
||||
ConnectionManager::GetInstance().ReportConnectionLeakEvent(getpid(), gettid());
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "The service connection is not disconnected.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "not disconnected");
|
||||
}
|
||||
resultCode = DIED + 1;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ void AbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& e
|
||||
(*item)->OnAbilityDisconnectDone(element, resultCode);
|
||||
item++;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "bundleName:%{public}s, abilityName:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "bundleName:%{public}s, abilityName:%{public}s",
|
||||
element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject>& connec
|
||||
const AAFwk::Want& want, int accountId, const sptr<AbilityConnectCallback>& connectCallback)
|
||||
{
|
||||
if (connectCaller == nullptr || connectCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connectCaller or connectCallback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null connectCaller or connectCallback");
|
||||
return AAFwk::ERR_INVALID_CALLER;
|
||||
}
|
||||
|
||||
AppExecFwk::ElementName connectReceiver = want.GetElement();
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "connectReceiver: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "connectReceiver: %{public}s",
|
||||
(connectReceiver.GetBundleName() + ":" + connectReceiver.GetAbilityName()).c_str());
|
||||
|
||||
sptr<AbilityConnection> abilityConnection;
|
||||
@@ -65,13 +65,13 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject>& connec
|
||||
break;
|
||||
}
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize: %{public}zu.", abilityConnections_.size());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize: %{public}zu", abilityConnections_.size());
|
||||
if (connectionIter != abilityConnections_.end()) {
|
||||
std::vector<sptr<AbilityConnectCallback>>& callbacks = connectionIter->second;
|
||||
callbacks.push_back(connectCallback);
|
||||
abilityConnection = connectionIter->first.abilityConnection;
|
||||
abilityConnection->AddConnectCallback(connectCallback);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "find abilityConnection exist, callbackSize:%{public}zu.", callbacks.size());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnection exist, callbackSize:%{public}zu", callbacks.size());
|
||||
if (abilityConnection->GetConnectionState() == CONNECTION_STATE_CONNECTED) {
|
||||
connectCallback->OnAbilityConnectDone(connectReceiver, abilityConnection->GetRemoteObject(),
|
||||
abilityConnection->GetResultCode());
|
||||
@@ -79,7 +79,7 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject>& connec
|
||||
} else if (abilityConnection->GetConnectionState() == CONNECTION_STATE_CONNECTING) {
|
||||
return ERR_OK;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AbilityConnection has disconnected, erase it and reconnect.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AbilityConnection disconnected, erase it and reconnect");
|
||||
abilityConnections_.erase(connectionIter);
|
||||
return CreateConnection(connectCaller, want, accountId, connectCallback);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ ErrCode ConnectionManager::CreateConnection(const sptr<IRemoteObject>& connectCa
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "called");
|
||||
sptr<AbilityConnection> abilityConnection = new AbilityConnection();
|
||||
if (abilityConnection == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "create connection failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "create connection failed");
|
||||
return AAFwk::ERR_INVALID_CALLER;
|
||||
}
|
||||
abilityConnection->AddConnectCallback(connectCallback);
|
||||
@@ -145,7 +145,7 @@ ErrCode ConnectionManager::CreateConnection(const sptr<IRemoteObject>& connectCa
|
||||
callbacks.push_back(connectCallback);
|
||||
abilityConnections_[connectionInfo] = callbacks;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Call AbilityManagerService's ConnectAbility error:%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AMS ConnectAbility error:%{public}d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -163,12 +163,12 @@ ErrCode ConnectionManager::DisconnectAbility(const sptr<IRemoteObject>& connectC
|
||||
int32_t accountId)
|
||||
{
|
||||
if (connectCaller == nullptr || connectCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connectCaller or connectCallback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null connectCaller or connectCallback");
|
||||
return AAFwk::ERR_INVALID_CALLER;
|
||||
}
|
||||
|
||||
auto element = connectReceiver.GetElement();
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "connectReceiver: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "connectReceiver: %{public}s",
|
||||
(element.GetBundleName() + ":" + element.GetAbilityName()).c_str());
|
||||
std::lock_guard<std::recursive_mutex> lock(connectionsLock_);
|
||||
auto item = std::find_if(abilityConnections_.begin(), abilityConnections_.end(),
|
||||
@@ -176,7 +176,7 @@ ErrCode ConnectionManager::DisconnectAbility(const sptr<IRemoteObject>& connectC
|
||||
return MatchConnection(connectCaller, connectReceiver, accountId, obj);
|
||||
});
|
||||
if (item != abilityConnections_.end()) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "remove callback, Size:%{public}zu.", item->second.size());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "remove callback, Size:%{public}zu", item->second.size());
|
||||
auto iter = item->second.begin();
|
||||
while (iter != item->second.end()) {
|
||||
if (*iter == connectCallback) {
|
||||
@@ -188,20 +188,20 @@ ErrCode ConnectionManager::DisconnectAbility(const sptr<IRemoteObject>& connectC
|
||||
|
||||
sptr<AbilityConnection> abilityConnection = item->first.abilityConnection;
|
||||
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "find abilityConnection exist, abilityConnectionsSize:%{public}zu.",
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnection exist, size:%{public}zu",
|
||||
abilityConnections_.size());
|
||||
if (item->second.empty()) {
|
||||
abilityConnections_.erase(item);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no callback left, so disconnectAbility.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no callback left, disconnectAbility");
|
||||
return AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(abilityConnection);
|
||||
} else {
|
||||
connectCallback->OnAbilityDisconnectDone(element, ERR_OK);
|
||||
abilityConnection->RemoveConnectCallback(connectCallback);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "callbacks is not empty, do not need disconnectAbility.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "callbacks not empty, no need disconnectAbility");
|
||||
return ERR_OK;
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "not find conn exist.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "not find conn");
|
||||
return AAFwk::CONNECTION_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
@@ -210,22 +210,22 @@ bool ConnectionManager::DisconnectCaller(const sptr<IRemoteObject>& connectCalle
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "call");
|
||||
if (connectCaller == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connectCaller is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null connectCaller");
|
||||
return false;
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> lock(connectionsLock_);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize:%{public}zu.", abilityConnections_.size());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize:%{public}zu", abilityConnections_.size());
|
||||
|
||||
bool isDisconnect = false;
|
||||
auto iter = abilityConnections_.begin();
|
||||
while (iter != abilityConnections_.end()) {
|
||||
ConnectionInfo connectionInfo = iter->first;
|
||||
if (IsConnectCallerEqual(connectionInfo.connectCaller, connectCaller)) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "DisconnectAbility.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "DisconnectAbility");
|
||||
ErrCode ret =
|
||||
AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(connectionInfo.abilityConnection);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ability manager service->DisconnectAbility error, ret=%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AMS DisconnectAbility error, ret:%{public}d", ret);
|
||||
}
|
||||
iter = abilityConnections_.erase(iter);
|
||||
isDisconnect = true;
|
||||
@@ -234,7 +234,7 @@ bool ConnectionManager::DisconnectCaller(const sptr<IRemoteObject>& connectCalle
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize:%{public}zu.", abilityConnections_.size());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "abilityConnectionsSize:%{public}zu", abilityConnections_.size());
|
||||
return isDisconnect;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ bool ConnectionManager::RemoveConnection(const sptr<AbilityConnection> connectio
|
||||
while (iter != abilityConnections_.end()) {
|
||||
ConnectionInfo connectionInfo = iter->first;
|
||||
if (connectionInfo.abilityConnection == connection) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "Remove connection.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "Remove connection");
|
||||
iter = abilityConnections_.erase(iter);
|
||||
isDisconnect = true;
|
||||
} else {
|
||||
@@ -273,13 +273,13 @@ bool ConnectionManager::DisconnectNonexistentService(
|
||||
ConnectionInfo connectionInfo = abilityConnection.first;
|
||||
if (connectionInfo.abilityConnection == connection &&
|
||||
connectionInfo.connectReceiver.GetBundleName() == element.GetBundleName()) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "find connection.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "find connection");
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exit) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "this service need disconnect");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "service need disconnect");
|
||||
AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(connection);
|
||||
return true;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ bool ConnectionManager::DisconnectNonexistentService(
|
||||
|
||||
void ConnectionManager::ReportConnectionLeakEvent(const int pid, const int tid)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "pid:%{public}d, tid:%{public}d.", pid, tid);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "pid:%{public}d, tid:%{public}d", pid, tid);
|
||||
#ifdef SUPPORT_HICHECKER
|
||||
if (HiChecker::Contains(Rule::RULE_CHECK_ABILITY_CONNECTION_LEAK)) {
|
||||
DfxDumpCatcher dumpLog;
|
||||
@@ -298,11 +298,11 @@ void ConnectionManager::ReportConnectionLeakEvent(const int pid, const int tid)
|
||||
std::string cautionMsg = "TriggerRule:RULE_CHECK_ABILITY_CONNECTION_LEAK-pid=" +
|
||||
std::to_string(pid) + "-tid=" + std::to_string(tid) + ", has leaked connection" +
|
||||
", Are you missing a call to DisconnectAbility()";
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "cautionMsg:%{public}s.", cautionMsg.c_str());
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "cautionMsg:%{public}s", cautionMsg.c_str());
|
||||
Caution caution(Rule::RULE_CHECK_ABILITY_CONNECTION_LEAK, cautionMsg, stackTrace);
|
||||
HiChecker::NotifyAbilityConnectionLeak(caution);
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "dumpCatch stackTrace failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "dumpCatch stackTrace failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ std::shared_ptr<AutoFillExtensionContext> AutoFillExtension::CreateAndInitContex
|
||||
std::shared_ptr<AutoFillExtensionContext> context =
|
||||
ExtensionBase<AutoFillExtensionContext>::CreateAndInitContext(record, application, handler, token);
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "UIExtension CreateAndInitContext context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null context");
|
||||
return context;
|
||||
}
|
||||
return context;
|
||||
|
||||
+2
-2
@@ -34,12 +34,12 @@ int32_t AutoFillExtensionContext::ReloadInModal(const CustomData &customData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Session info is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null sessionInfo_");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
auto autoFillExtensionCallback = autoFillExtensionCallback_.lock();
|
||||
if (autoFillExtensionCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Auto fill extension callback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null autoFillExtensionCallback");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
return autoFillExtensionCallback->OnReloadInModal(sessionInfo_, customData);
|
||||
|
||||
+58
-58
@@ -58,24 +58,24 @@ napi_value AttachAutoFillExtensionContext(napi_env env, void *value, void *)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (value == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid parameter.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<AutoFillExtensionContext> *>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = JsAutoFillExtensionContext::CreateJsAutoFillExtensionContext(env, ptr);
|
||||
auto systemModule = JsRuntime::LoadSystemModuleByEngine(env, "application.AutoFillExtensionContext", &object, 1);
|
||||
if (systemModule == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Load system module failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Load system module failed");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = systemModule->GetNapiValue();
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Load context error.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Load context error");
|
||||
return nullptr;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(
|
||||
@@ -105,7 +105,7 @@ JsAutoFillExtension::JsAutoFillExtension(JsRuntime& jsRuntime) : jsRuntime_(jsRu
|
||||
|
||||
JsAutoFillExtension::~JsAutoFillExtension()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Destructor.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Destructor");
|
||||
auto context = GetContext();
|
||||
if (context) {
|
||||
context->Unbind();
|
||||
@@ -127,7 +127,7 @@ void JsAutoFillExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
AutoFillExtension::Init(record, application, handler, token);
|
||||
if (abilityInfo_ == nullptr || abilityInfo_->srcEntrance.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Init ability info failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Init ability info failed");
|
||||
return;
|
||||
}
|
||||
std::string srcPath(abilityInfo_->moduleName + "/");
|
||||
@@ -145,13 +145,13 @@ void JsAutoFillExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "LoadModule moduleName:%{public}s, srcPath:%{public}s, hapPath:%{public}s",
|
||||
moduleName.c_str(), srcPath.c_str(), abilityInfo_->hapPath.c_str());
|
||||
if (jsObj_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Js object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null jsObj_");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get js auto fill extension object.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get js auto fill extension obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,31 +166,31 @@ void JsAutoFillExtension::BindContext(napi_env env, napi_value obj)
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get context failed");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Create js auto fill extension context.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Create js auto fill extension context");
|
||||
context->SetAutoFillExtensionCallback(std::static_pointer_cast<JsAutoFillExtension>(shared_from_this()));
|
||||
napi_value contextObj = JsAutoFillExtensionContext::CreateJsAutoFillExtensionContext(env, context);
|
||||
if (contextObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Create js ui extension context failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Create js ui extension context failed");
|
||||
return;
|
||||
}
|
||||
|
||||
shellContextRef_ = JsRuntime::LoadSystemModuleByEngine(
|
||||
env, "application.AutoFillExtensionContext", &contextObj, ARGC_ONE);
|
||||
if (shellContextRef_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Load system module by engine failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "LoadSystemModuleByEngine failed");
|
||||
return;
|
||||
}
|
||||
contextObj = shellContextRef_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, contextObj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context native object.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get context native obj failed");
|
||||
return;
|
||||
}
|
||||
auto workContext = new (std::nothrow) std::weak_ptr<AutoFillExtensionContext>(context);
|
||||
if (workContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "workContext is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null workContext");
|
||||
return;
|
||||
}
|
||||
napi_coerce_to_native_binding_object(
|
||||
@@ -247,7 +247,7 @@ void JsAutoFillExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *c
|
||||
auto asyncCallback = [extensionWeakPtr = weakPtr]() {
|
||||
auto JsAutoFillExtension = extensionWeakPtr.lock();
|
||||
if (JsAutoFillExtension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null Extension");
|
||||
return;
|
||||
}
|
||||
JsAutoFillExtension->OnStopCallBack();
|
||||
@@ -255,7 +255,7 @@ void JsAutoFillExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *c
|
||||
callbackInfo->Push(asyncCallback);
|
||||
isAsyncCallback = CallPromise(result, callbackInfo);
|
||||
if (!isAsyncCallback) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to call promise.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "call promise failed");
|
||||
OnStopCallBack();
|
||||
}
|
||||
}
|
||||
@@ -265,14 +265,14 @@ void JsAutoFillExtension::OnStopCallBack()
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get context failed");
|
||||
return;
|
||||
}
|
||||
|
||||
bool ret = ConnectionManager::GetInstance().DisconnectCaller(context->GetToken());
|
||||
if (ret) {
|
||||
ConnectionManager::GetInstance().ReportConnectionLeakEvent(getpid(), gettid());
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "The service connection is not disconnected.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "service connection not disconnected");
|
||||
}
|
||||
|
||||
auto applicationContext = Context::GetApplicationContext();
|
||||
@@ -285,7 +285,7 @@ void JsAutoFillExtension::OnStopCallBack()
|
||||
bool JsAutoFillExtension::CheckPromise(napi_value result)
|
||||
{
|
||||
if (result == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Result is null, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "null result, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ bool JsAutoFillExtension::CheckPromise(napi_value result)
|
||||
bool isPromise = false;
|
||||
napi_is_promise(env, result, &isPromise);
|
||||
if (!isPromise) {
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Result is not promise, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "not promise, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -305,7 +305,7 @@ napi_value PromiseCallback(napi_env env, napi_callback_info info)
|
||||
NAPI_CALL_NO_THROW(napi_get_cb_info(env, info, nullptr, nullptr, nullptr, &data), nullptr);
|
||||
auto *callbackInfo = static_cast<AppExecFwk::AbilityTransactionCallbackInfo<> *>(data);
|
||||
if (callbackInfo == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Invalid input info.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Invalid input info");
|
||||
return nullptr;
|
||||
}
|
||||
callbackInfo->Call();
|
||||
@@ -318,19 +318,19 @@ bool JsAutoFillExtension::CallPromise(napi_value result, AppExecFwk::AbilityTran
|
||||
{
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
if (!CheckTypeForNapiValue(env, result, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to convert native value to NativeObject.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to convert native value to NativeObject");
|
||||
return false;
|
||||
}
|
||||
napi_value then = nullptr;
|
||||
napi_get_named_property(env, result, "then", &then);
|
||||
if (then == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get property: then.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get property: then");
|
||||
return false;
|
||||
}
|
||||
bool isCallable = false;
|
||||
napi_is_callable(env, then, &isCallable);
|
||||
if (!isCallable) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Property then is not callable.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Property then not callable");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@@ -347,7 +347,7 @@ void JsAutoFillExtension::OnCommandWindow(
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Session info is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null sessionInfo");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Begin. persistentId: %{private}d, winCmd: %{public}d",
|
||||
@@ -364,7 +364,7 @@ void JsAutoFillExtension::OnCommandWindow(
|
||||
DestroyWindow(sessionInfo);
|
||||
break;
|
||||
default:
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Unsupported cmd.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Unsupported cmd");
|
||||
break;
|
||||
}
|
||||
OnCommandWindowDone(sessionInfo, winCmd);
|
||||
@@ -375,7 +375,7 @@ void JsAutoFillExtension::OnCommandWindowDone(const sptr<AAFwk::SessionInfo> &se
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
AAFwk::AbilityCommand abilityCmd;
|
||||
@@ -388,14 +388,14 @@ void JsAutoFillExtension::OnCommandWindowDone(const sptr<AAFwk::SessionInfo> &se
|
||||
}
|
||||
AAFwk::AbilityManagerClient::GetInstance()->ScheduleCommandAbilityWindowDone(
|
||||
context->GetToken(), sessionInfo, winCmd, abilityCmd);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "End");
|
||||
}
|
||||
|
||||
void JsAutoFillExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Begin");
|
||||
Extension::OnCommand(want, restart, startId);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "JsAutoFillExtension OnCommand begin restart= %{public}s, startId= %{public}d.",
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "begin restart= %{public}s, startId= %{public}d.",
|
||||
restart ? "true" : "false", startId);
|
||||
// wrap want
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@@ -406,7 +406,7 @@ void JsAutoFillExtension::OnCommand(const AAFwk::Want &want, bool restart, int s
|
||||
napi_create_int32(env, startId, &napiStartId);
|
||||
napi_value argv[] = {napiWant, napiStartId};
|
||||
CallObjectMethod("onRequest", argv, ARGC_TWO);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "End");
|
||||
}
|
||||
|
||||
void JsAutoFillExtension::OnForeground(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
@@ -430,12 +430,12 @@ int32_t JsAutoFillExtension::OnReloadInModal(const sptr<AAFwk::SessionInfo> &ses
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (!isPopup_) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "The current window type is not popup.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "current window type not popup");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "SessionInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null sessionInfo");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ int32_t JsAutoFillExtension::OnReloadInModal(const sptr<AAFwk::SessionInfo> &ses
|
||||
auto obj = sessionInfo->sessionToken;
|
||||
auto &uiWindow = uiWindowMap_[obj];
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "UI window is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null uiWindow");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
AAFwk::WantParams wantParams;
|
||||
@@ -453,7 +453,7 @@ int32_t JsAutoFillExtension::OnReloadInModal(const sptr<AAFwk::SessionInfo> &ses
|
||||
wantParams.SetParam(WANT_PARAMS_CUSTOM_DATA, AAFwk::String::Box(customDataString));
|
||||
auto ret = static_cast<int32_t>(uiWindow->TransferExtensionData(wantParams));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer extension data failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer extension data failed");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -466,7 +466,7 @@ void JsAutoFillExtension::UpdateRequest(const AAFwk::WantParams &wantParams)
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
napi_value request = JsAutoFillExtensionUtil::WrapUpdateRequest(wantParams, env);
|
||||
if (request == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create update request.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create update request");
|
||||
return;
|
||||
}
|
||||
napi_value argv[] = { request };
|
||||
@@ -477,7 +477,7 @@ bool JsAutoFillExtension::HandleAutoFillCreate(const AAFwk::Want &want, const sp
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr || sessionInfo->sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid session info.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid sessionInfo");
|
||||
return false;
|
||||
}
|
||||
auto obj = sessionInfo->sessionToken;
|
||||
@@ -485,7 +485,7 @@ bool JsAutoFillExtension::HandleAutoFillCreate(const AAFwk::Want &want, const sp
|
||||
sptr<Rosen::WindowOption> option = new Rosen::WindowOption();
|
||||
auto context = GetContext();
|
||||
if (context == nullptr || context->GetAbilityInfo() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context");
|
||||
return false;
|
||||
}
|
||||
option->SetWindowName(context->GetBundleName() + context->GetAbilityInfo()->name);
|
||||
@@ -495,7 +495,7 @@ bool JsAutoFillExtension::HandleAutoFillCreate(const AAFwk::Want &want, const sp
|
||||
option->SetUIExtensionUsage(static_cast<uint32_t>(sessionInfo->uiExtensionUsage));
|
||||
auto uiWindow = Rosen::Window::Create(option, GetContext(), sessionInfo->sessionToken);
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Create ui window error.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Create uiWindow error");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@@ -517,13 +517,13 @@ void JsAutoFillExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<A
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "sessionInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null sessionInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -532,14 +532,14 @@ void JsAutoFillExtension::ForegroundWindow(const AAFwk::Want &want, const sptr<A
|
||||
}
|
||||
|
||||
if (!HandleAutoFillCreate(want, sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Handle auto fill create failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "HandleAutoFillCreate failed");
|
||||
return;
|
||||
}
|
||||
auto obj = sessionInfo->sessionToken;
|
||||
auto& uiWindow = uiWindowMap_[obj];
|
||||
if (uiWindow) {
|
||||
uiWindow->Show();
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "UI window show.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "uiWindow show");
|
||||
foregroundWindows_.emplace(obj);
|
||||
|
||||
RegisterTransferComponentDataListener(uiWindow);
|
||||
@@ -554,12 +554,12 @@ void JsAutoFillExtension::BackgroundWindow(const sptr<AAFwk::SessionInfo> &sessi
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr || sessionInfo->sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
auto obj = sessionInfo->sessionToken;
|
||||
if (uiWindowMap_.find(obj) == uiWindowMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Fail to find ui window.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Fail to find ui window");
|
||||
return;
|
||||
}
|
||||
auto& uiWindow = uiWindowMap_[obj];
|
||||
@@ -573,7 +573,7 @@ void JsAutoFillExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionI
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr || sessionInfo->sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid sessionInfo.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid sessionInfo");
|
||||
return;
|
||||
}
|
||||
auto obj = sessionInfo->sessionToken;
|
||||
@@ -598,9 +598,9 @@ void JsAutoFillExtension::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionI
|
||||
|
||||
napi_value JsAutoFillExtension::CallObjectMethod(const char *name, napi_value const *argv, size_t argc, bool withResult)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Called, name is (%{public}s)", name);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Called, name: (%{public}s)", name);
|
||||
if (!jsObj_) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Not found AutoFillExtension.js.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Not found AutoFillExtension.js");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -609,14 +609,14 @@ napi_value JsAutoFillExtension::CallObjectMethod(const char *name, napi_value co
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get auto fill extension object.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get auto fill extension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, name, &method);
|
||||
if (!CheckTypeForNapiValue(env, method, napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to get '%{public}s' from auto fill extension object.", name);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "get '%{public}s' from auto fill extension obj failed", name);
|
||||
return nullptr;
|
||||
}
|
||||
if (withResult) {
|
||||
@@ -624,7 +624,7 @@ napi_value JsAutoFillExtension::CallObjectMethod(const char *name, napi_value co
|
||||
napi_call_function(env, obj, method, argc, argv, &result);
|
||||
return handleEscape.Escape(result);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Call function: (%{public}s) success.", name);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Call func: (%{public}s) success", name);
|
||||
napi_call_function(env, obj, method, argc, argv, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -634,19 +634,19 @@ void JsAutoFillExtension::CallJsOnRequest(
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "sessionInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null sessionInfo");
|
||||
return;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
if (env == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Env is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null env");
|
||||
return;
|
||||
}
|
||||
napi_value nativeContentSession =
|
||||
JsUIExtensionContentSession::CreateJsUIExtensionContentSession(env, sessionInfo, uiWindow);
|
||||
if (nativeContentSession == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create session.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create session");
|
||||
return;
|
||||
}
|
||||
napi_ref ref = nullptr;
|
||||
@@ -656,7 +656,7 @@ void JsAutoFillExtension::CallJsOnRequest(
|
||||
|
||||
napi_value request = JsAutoFillExtensionUtil::WrapFillRequest(want, env);
|
||||
if (request == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Fill request is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null fill request");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ void JsAutoFillExtension::CallJsOnRequest(
|
||||
napi_value argv[] = { nativeContentSession, request, callback };
|
||||
CallObjectMethod("onFillRequest", argv, ARGC_THREE);
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Invalid auto fill request type.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "Invalid auto fill request type");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -685,13 +685,13 @@ void JsAutoFillExtension::RegisterTransferComponentDataListener(const sptr<Rosen
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (uiWindow == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid ui window object.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Invalid ui window obj");
|
||||
return;
|
||||
}
|
||||
|
||||
auto handler = std::make_shared<AppExecFwk::EventHandler>(AppExecFwk::EventRunner::GetMainEventRunner());
|
||||
if (handler == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create event handler.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create event handler");
|
||||
return;
|
||||
}
|
||||
uiWindow->RegisterTransferComponentDataListener([this, handler](
|
||||
|
||||
+6
-6
@@ -43,7 +43,7 @@ napi_value JsAutoFillExtensionContext::OnReloadInModal(napi_env env, NapiCallbac
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Not enough params");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "invalid argc");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ napi_value JsAutoFillExtensionContext::OnReloadInModal(napi_env env, NapiCallbac
|
||||
napi_value jsCustomData = GetPropertyValueByPropertyName(env, info.argv[INDEX_ZERO], "data", napi_object);
|
||||
CustomData customData;
|
||||
if (jsCustomData == nullptr || !AppExecFwk::UnwrapWantParams(env, jsCustomData, customData.data)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Parse custom data failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Parse custom data failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -60,12 +60,12 @@ napi_value JsAutoFillExtensionContext::OnReloadInModal(napi_env env, NapiCallbac
|
||||
NapiAsyncTask::ExecuteCallback execute = [weak = context_, customData, ret = retVal, env]() {
|
||||
auto context = weak.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null context");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
if (ret == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "The param is invalid.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "invalid param");
|
||||
return;
|
||||
}
|
||||
*ret = context->ReloadInModal(customData);
|
||||
@@ -73,12 +73,12 @@ napi_value JsAutoFillExtensionContext::OnReloadInModal(napi_env env, NapiCallbac
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete = [ret = retVal](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
if (ret == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "The param is invalid.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "invalid param");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
if (*ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed error is %{public}d.", *ret);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed error %{public}d", *ret);
|
||||
task.Reject(env, CreateJsError(env, GetJsErrorCodeByNativeError(*ret)));
|
||||
return;
|
||||
}
|
||||
|
||||
+8
-8
@@ -89,7 +89,7 @@ napi_value JsAutoFillExtensionUtil::WrapViewData(const napi_env env, const Abili
|
||||
if (jsSubValue != nullptr && napi_set_element(env, jsArray, index, jsSubValue) == napi_ok) {
|
||||
index++;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Set element fail.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Set element fail");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ void JsAutoFillExtensionUtil::UnwrapViewData(
|
||||
if (jsValue != nullptr) {
|
||||
uint32_t jsProCount = 0;
|
||||
if (!IsArrayForNapiValue(env, jsValue, jsProCount)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Get PAGE_NODE_INFOS from JS failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Get PAGE_NODE_INFOS from JS failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ napi_value JsAutoFillExtensionUtil::WrapFillRequest(const AAFwk::Want &want, con
|
||||
napi_value jsObject = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &jsObject));
|
||||
if (jsObject == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create jsObject.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "create jsObject failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ napi_value JsAutoFillExtensionUtil::WrapFillRequest(const AAFwk::Want &want, con
|
||||
if (want.HasParameter(WANT_PARAMS_VIEW_DATA)) {
|
||||
std::string viewDataString = want.GetStringParam(WANT_PARAMS_VIEW_DATA);
|
||||
if (viewDataString.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "View data is empty.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "empty view data");
|
||||
return jsObject;
|
||||
}
|
||||
|
||||
@@ -290,11 +290,11 @@ napi_value JsAutoFillExtensionUtil::WrapFillRequest(const AAFwk::Want &want, con
|
||||
if (want.HasParameter(WANT_PARAMS_CUSTOM_DATA)) {
|
||||
std::string customDataString = want.GetStringParam(WANT_PARAMS_CUSTOM_DATA);
|
||||
if (customDataString.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Custom data is empty.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "empty custom data");
|
||||
return jsObject;
|
||||
}
|
||||
if (!AAFwk::WantParamWrapper::ValidateStr(customDataString)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Custom data string is invalid.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "invalid Custom data string");
|
||||
return jsObject;
|
||||
}
|
||||
AAFwk::WantParams param = AAFwk::WantParamWrapper::ParseWantParams(customDataString);
|
||||
@@ -311,13 +311,13 @@ napi_value JsAutoFillExtensionUtil::WrapUpdateRequest(const AAFwk::WantParams &w
|
||||
napi_value jsObject = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &jsObject));
|
||||
if (jsObject == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create Object.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to create Object");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string viewDataString = wantParams.GetStringParam(WANT_PARAMS_VIEW_DATA);
|
||||
if (viewDataString.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "View data is empty.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "empty view data");
|
||||
return jsObject;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -61,7 +61,7 @@ JsFillRequestCallback::JsFillRequestCallback(
|
||||
|
||||
void JsFillRequestCallback::Finalizer(napi_env env, void* data, void *hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "JsFillRequestCallback Finalizer is called");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
std::unique_ptr<JsFillRequestCallback>(static_cast<JsFillRequestCallback*>(data));
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ napi_value JsFillRequestCallback::OnFillRequestSuccess(napi_env env, NapiCallbac
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (info.argc < ARGC_ONE || !IsTypeForNapiValue(env, info.argv[INDEX_ZERO], napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to parse viewData JsonString!");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "parse viewData failed");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM), ERROR_MSG_VIEWDATA_INVALID);
|
||||
SendResultCodeAndViewData(
|
||||
JsAutoFillExtensionUtil::AutoFillResultCode::CALLBACK_FAILED_INVALID_PARAM, "");
|
||||
@@ -100,7 +100,7 @@ napi_value JsFillRequestCallback::OnFillRequestSuccess(napi_env env, NapiCallbac
|
||||
JsAutoFillExtensionUtil::UnwrapFillResponse(env, info.argv[INDEX_ZERO], response);
|
||||
std::string jsonString = response.viewData.ToJsonString();
|
||||
if (jsonString.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "JsonString is empty");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "empty jsonString");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INVALID_PARAM);
|
||||
SendResultCodeAndViewData(
|
||||
JsAutoFillExtensionUtil::AutoFillResultCode::CALLBACK_FAILED_INVALID_PARAM, "");
|
||||
@@ -126,7 +126,7 @@ napi_value JsFillRequestCallback::OnFillRequestCanceled(napi_env env, NapiCallba
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (!IsTypeForNapiValue(env, info.argv[INDEX_ZERO], napi_string)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to parse fillContent JsonString!");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "parse fillContent failed");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM), ERROR_MSG_PARAMETER_INVALID);
|
||||
SendResultCodeAndViewData(
|
||||
JsAutoFillExtensionUtil::AutoFillResultCode::CALLBACK_FAILED_INVALID_PARAM, "");
|
||||
@@ -134,7 +134,7 @@ napi_value JsFillRequestCallback::OnFillRequestCanceled(napi_env env, NapiCallba
|
||||
}
|
||||
std::string jsonString = UnwrapStringFromJS(env, info.argv[INDEX_ZERO], "");
|
||||
if (jsonString.empty()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "JsonString is empty");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "empty jsonString");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM), ERROR_MSG_INVALID_EMPTY);
|
||||
SendResultCodeAndViewData(
|
||||
JsAutoFillExtensionUtil::AutoFillResultCode::CALLBACK_FAILED_INVALID_PARAM, "");
|
||||
@@ -149,18 +149,18 @@ napi_value JsFillRequestCallback::OnFillRequestAutoFillPopupConfig(napi_env env,
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
auto selfToken = IPCSkeleton::GetSelfTokenID();
|
||||
if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "application is not system-app, can not use system-api");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Non-system app forbidden to call");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_NOT_SYSTEM_APP);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
if (uiWindow_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "UIWindow is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null uiWindow");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
if (info.argc < ARGC_ONE || !IsTypeForNapiValue(env, info.argv[INDEX_ZERO], napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Failed to parse resize data!");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "parse resize failed");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM),
|
||||
ERROR_MSG_AUTOFILLPOPUPCONFIG_INVALID);
|
||||
return CreateJsUndefined(env);
|
||||
@@ -171,7 +171,7 @@ napi_value JsFillRequestCallback::OnFillRequestAutoFillPopupConfig(napi_env env,
|
||||
if (isValueChanged) {
|
||||
auto ret = uiWindow_->TransferExtensionData(wantParams);
|
||||
if (ret != Rosen::WMError::WM_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer ability result failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer ability result failed");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void JsFillRequestCallback::SendResultCodeAndViewData(
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (uiWindow_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "UiWindow is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null uiWindow");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -224,13 +224,13 @@ void JsFillRequestCallback::SendResultCodeAndViewData(
|
||||
|
||||
auto ret = uiWindow_->TransferAbilityResult(resultCode, want);
|
||||
if (ret != Rosen::WMError::WM_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer ability result failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "TransferAbilityResult failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto errorCode = AAFwk::AbilityManagerClient::GetInstance()->TerminateUIExtensionAbility(sessionInfo_);
|
||||
if (errorCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Terminate ui extension ability failed, errorCode: %{public}d", errorCode);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "TerminateUIExtensionAbility error: %{public}d", errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ napi_value JsFillRequestCallback::CreateJsFillRequestCallback(napi_env env,
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Object is null");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null object");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -70,20 +70,20 @@ void JsSaveRequestCallback::SendResultCodeAndViewData(const JsAutoFillExtensionU
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILL_EXT, "called");
|
||||
if (uiWindow_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "UI window is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null uiWindow_");
|
||||
return;
|
||||
}
|
||||
|
||||
AAFwk::Want want;
|
||||
auto ret = uiWindow_->TransferAbilityResult(resultCode, want);
|
||||
if (ret != Rosen::WMError::WM_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Transfer ability result failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "TransferAbilityResult failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto errorCode = AAFwk::AbilityManagerClient::GetInstance()->TerminateUIExtensionAbility(sessionInfo_);
|
||||
if (errorCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Terminate ui extension ability failed, errorCode: %{public}d", errorCode);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "TerminateUIExtensionAbility error: %{public}d", errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ napi_value JsSaveRequestCallback::CreateJsSaveRequestCallback(napi_env env,
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "Object is null");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILL_EXT, "null object");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,18 @@ void AutoStartupCallBackProxy::OnAutoStartupOn(const AutoStartupInfo &info)
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(AutoStartupCallBackProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write interface token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&info)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write AutoStartupInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write info failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = SendRequest(AbilityManagerInterfaceCode::ON_AUTO_STARTUP_ON, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Send request error: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Send request error: %{public}d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,18 +50,18 @@ void AutoStartupCallBackProxy::OnAutoStartupOff(const AutoStartupInfo &info)
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(AutoStartupCallBackProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write interface token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&info)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write AutoStartupInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Write info failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = SendRequest(AbilityManagerInterfaceCode::ON_AUTO_STARTUP_OFF, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Send request error: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Send request error: %{public}d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ ErrCode AutoStartupCallBackProxy::SendRequest(
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Remote is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null remote");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ int AutoStartupCallBackStub::OnRemoteRequest(
|
||||
std::u16string autoStartUpCallBackDescriptor = AutoStartupCallBackStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (autoStartUpCallBackDescriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Local descriptor is not equal to remote.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ int AutoStartupCallBackStub::OnRemoteRequest(
|
||||
break;
|
||||
}
|
||||
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Default case, need check.");
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Default case");
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ int32_t AutoStartupCallBackStub::OnAutoStartupOnInner(MessageParcel &data, Messa
|
||||
{
|
||||
sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>();
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to read parcelable.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Read info failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ int32_t AutoStartupCallBackStub::OnAutoStartupOnInner(MessageParcel &data, Messa
|
||||
handler->PostSyncTask([weak, info]() {
|
||||
auto autoStartUpCallBackStub = weak.promote();
|
||||
if (autoStartUpCallBackStub == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "autoStartUpCallBackStub is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null autoStartUpCallBackStub");
|
||||
return;
|
||||
}
|
||||
autoStartUpCallBackStub->OnAutoStartupOn(*info);
|
||||
@@ -84,7 +84,7 @@ int32_t AutoStartupCallBackStub::OnAutoStartupOffInner(MessageParcel &data, Mess
|
||||
{
|
||||
sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>();
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to read parcelable.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Read info failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ int32_t AutoStartupCallBackStub::OnAutoStartupOffInner(MessageParcel &data, Mess
|
||||
handler->PostSyncTask([weak, info]() {
|
||||
auto autoStartUpCallBackStub = weak.promote();
|
||||
if (autoStartUpCallBackStub == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "autoStartUpCallBackStub is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null autoStartUpCallBackStub");
|
||||
return;
|
||||
}
|
||||
autoStartUpCallBackStub->OnAutoStartupOff(*info);
|
||||
|
||||
@@ -59,12 +59,12 @@ ChildProcessManager &ChildProcessManager::GetInstance()
|
||||
|
||||
ChildProcessManager::ChildProcessManager()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "ChildProcessManager constructor called");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "called");
|
||||
}
|
||||
|
||||
ChildProcessManager::~ChildProcessManager()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "ChildProcessManager deconstructor called");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "called");
|
||||
}
|
||||
|
||||
ChildProcessManagerErrorCode ChildProcessManager::StartChildProcessBySelfFork(const std::string &srcEntry, pid_t &pid)
|
||||
@@ -77,7 +77,7 @@ ChildProcessManagerErrorCode ChildProcessManager::StartChildProcessBySelfFork(co
|
||||
|
||||
AppExecFwk::BundleInfo bundleInfo;
|
||||
if (!GetBundleInfo(bundleInfo)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetBundleInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetBundleInfo failed");
|
||||
return ChildProcessManagerErrorCode::ERR_GET_BUNDLE_INFO_FAILED;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ ChildProcessManagerErrorCode ChildProcessManager::StartArkChildProcess(
|
||||
const std::string &srcEntry, pid_t &pid, int32_t childProcessType, const AppExecFwk::ChildProcessArgs &args,
|
||||
const AppExecFwk::ChildProcessOptions &options)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "StartChildProcessByAppSpawnFork, startWitDebug: %{public}d, processName:"
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "startWitDebug: %{public}d, processName:"
|
||||
"%{public}s, native:%{public}d, entryParams:%{private}s, fdsSize:%{public}zu, options.isolationMode:%{public}d",
|
||||
g_debugOption.isStartWithDebug, g_debugOption.processName.c_str(), g_debugOption.isStartWithNative,
|
||||
args.entryParams.c_str(), args.fds.size(), options.isolationMode);
|
||||
@@ -120,7 +120,7 @@ ChildProcessManagerErrorCode ChildProcessManager::StartArkChildProcess(
|
||||
}
|
||||
sptr<AppExecFwk::IAppMgr> appMgr = GetAppMgr();
|
||||
if (appMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed");
|
||||
return ChildProcessManagerErrorCode::ERR_GET_APP_MGR_FAILED;
|
||||
}
|
||||
AppExecFwk::ChildProcessRequest request;
|
||||
@@ -135,7 +135,7 @@ ChildProcessManagerErrorCode ChildProcessManager::StartArkChildProcess(
|
||||
childProcessCount_++;
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "AppMgr StartChildProcess ret:%{public}d", ret);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "AppMgr StartChildProcess failed, ret:%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "StartChildProcess error:%{public}d", ret);
|
||||
return ChildProcessManagerErrorCode::ERR_GET_APP_MGR_START_PROCESS_FAILED;
|
||||
}
|
||||
return ChildProcessManagerErrorCode::ERR_OK;
|
||||
@@ -144,7 +144,7 @@ ChildProcessManagerErrorCode ChildProcessManager::StartArkChildProcess(
|
||||
ChildProcessManagerErrorCode ChildProcessManager::StartNativeChildProcessByAppSpawnFork(
|
||||
const std::string &libName, const sptr<IRemoteObject> &callbackStub)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "called, libName:%{private}s", libName.c_str());
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "libName:%{private}s", libName.c_str());
|
||||
ChildProcessManagerErrorCode errorCode = PreCheckNativeProcess();
|
||||
if (errorCode != ChildProcessManagerErrorCode::ERR_OK) {
|
||||
return errorCode;
|
||||
@@ -152,16 +152,16 @@ ChildProcessManagerErrorCode ChildProcessManager::StartNativeChildProcessByAppSp
|
||||
|
||||
sptr<AppExecFwk::IAppMgr> appMgr = GetAppMgr();
|
||||
if (appMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr for native child process failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed");
|
||||
return ChildProcessManagerErrorCode::ERR_GET_APP_MGR_FAILED;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(childProcessCountLock_);
|
||||
auto ret = appMgr->StartNativeChildProcess(libName, childProcessCount_, callbackStub);
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "AppMgr StartNativeChildProcess ret:%{public}d", ret);
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "StartNativeChildProcess ret:%{public}d", ret);
|
||||
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "AppMgr StartNativeChildProcess failed, ret:%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "StartNativeChildProcess error:%{public}d", ret);
|
||||
if (ret == ERR_OVERFLOW) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Max native child processes readched");
|
||||
return ChildProcessManagerErrorCode::ERR_MAX_NATIVE_CHILD_PROCESSES;
|
||||
@@ -192,7 +192,7 @@ void ChildProcessManager::HandleSigChild(int32_t signo)
|
||||
ChildProcessManagerErrorCode ChildProcessManager::PreCheck(bool useNewErrorCode)
|
||||
{
|
||||
if (!AAFwk::AppUtils::GetInstance().IsMultiProcessModel()) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Multi process model is not enabled");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Multi process model disabled");
|
||||
return useNewErrorCode ? ChildProcessManagerErrorCode::ERR_MULTI_PROCESS_MODEL_DISABLED_NEW :
|
||||
ChildProcessManagerErrorCode::ERR_MULTI_PROCESS_MODEL_DISABLED;
|
||||
}
|
||||
@@ -226,34 +226,34 @@ bool ChildProcessManager::IsChildProcess()
|
||||
void ChildProcessManager::HandleChildProcessBySelfFork(const std::string &srcEntry,
|
||||
const AppExecFwk::BundleInfo &bundleInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "HandleChildProcessBySelfFork start.");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "start");
|
||||
isChildProcessBySelfFork_ = true;
|
||||
std::shared_ptr<AppExecFwk::EventRunner> eventRunner = AppExecFwk::EventRunner::GetMainEventRunner();
|
||||
if (eventRunner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get main eventRunner failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null eventRunner");
|
||||
return;
|
||||
}
|
||||
eventRunner->Stop();
|
||||
|
||||
AppExecFwk::HapModuleInfo hapModuleInfo;
|
||||
if (!GetEntryHapModuleInfo(bundleInfo, hapModuleInfo)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetHapModuleInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetHapModuleInfo failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto runtime = CreateRuntime(bundleInfo, hapModuleInfo, false, g_jitEnabled);
|
||||
if (!runtime) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to create child process runtime");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Create runtime failed");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "StartDebugMode, isStartWithDebug is %{public}d, processName is %{public}s, "
|
||||
"isDebugApp is %{public}d, isStartWithNative is %{public}d.", g_debugOption.isStartWithDebug,
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "StartDebugMode, isStartWithDebug: %{public}d, processName: %{public}s, "
|
||||
"isDebugApp: %{public}d, isStartWithNative: %{public}d", g_debugOption.isStartWithDebug,
|
||||
g_debugOption.processName.c_str(), g_debugOption.isDebugApp, g_debugOption.isStartWithNative);
|
||||
runtime->StartDebugMode(g_debugOption);
|
||||
std::string srcPath;
|
||||
srcPath.append(hapModuleInfo.moduleName).append("/").append(srcEntry);
|
||||
LoadJsFile(srcPath, hapModuleInfo, runtime);
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "HandleChildProcessBySelfFork end.");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "end");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -270,12 +270,12 @@ bool ChildProcessManager::LoadJsFile(const std::string &srcEntry, const AppExecF
|
||||
|
||||
auto process = ChildProcess::Create(runtime);
|
||||
if (process == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to create ChildProcess.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Create ChildProcess failed");
|
||||
return false;
|
||||
}
|
||||
bool ret = process->Init(processStartInfo);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "JsChildProcess init failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "init failed");
|
||||
return false;
|
||||
}
|
||||
if (args) {
|
||||
@@ -283,7 +283,7 @@ bool ChildProcessManager::LoadJsFile(const std::string &srcEntry, const AppExecF
|
||||
} else {
|
||||
process->OnStart();
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "LoadJsFile end.");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "end");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -302,12 +302,12 @@ bool ChildProcessManager::LoadNativeLib(const std::string &moduleName,
|
||||
processStartInfo->srcEntry = libPath;
|
||||
processStartInfo->ipcObj = mainProcessCb;
|
||||
if (!childProcess->Init(processStartInfo)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "NativeChildIpcProcess init failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "NativeChildIpcProcess init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
childProcess->OnStart();
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "LoadNativeLib end.");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "end");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -344,17 +344,17 @@ bool ChildProcessManager::GetBundleInfo(AppExecFwk::BundleInfo &bundleInfo)
|
||||
{
|
||||
auto sysMrgClient = DelayedSingleton<AppExecFwk::SysMrgClient>::GetInstance();
|
||||
if (sysMrgClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to get SysMrgClient.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get SysMrgClient failed");
|
||||
return false;
|
||||
}
|
||||
auto bundleObj = sysMrgClient->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (bundleObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to get bundle manager service.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null bundleObj");
|
||||
return false;
|
||||
}
|
||||
auto bundleMgr = iface_cast<AppExecFwk::IBundleMgr>(bundleObj);
|
||||
if (bundleMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Bundle manager is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null bundleMgr");
|
||||
return false;
|
||||
}
|
||||
return (bundleMgr->GetBundleInfoForSelf(
|
||||
@@ -367,7 +367,7 @@ bool ChildProcessManager::GetEntryHapModuleInfo(const AppExecFwk::BundleInfo &bu
|
||||
AppExecFwk::HapModuleInfo &hapModuleInfo)
|
||||
{
|
||||
if (bundleInfo.hapModuleInfos.empty()) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "hapModuleInfos empty!");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "hapModuleInfos empty");
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "hapModueInfos size: %{public}zu", bundleInfo.hapModuleInfos.size());
|
||||
@@ -405,7 +405,7 @@ bool ChildProcessManager::HasChildProcessRecord()
|
||||
{
|
||||
sptr<AppExecFwk::IAppMgr> appMgr = GetAppMgr();
|
||||
if (appMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed");
|
||||
return false;
|
||||
}
|
||||
AppExecFwk::ChildProcessInfo info;
|
||||
@@ -416,12 +416,12 @@ sptr<AppExecFwk::IAppMgr> ChildProcessManager::GetAppMgr()
|
||||
{
|
||||
auto sysMrgClient = DelayedSingleton<AppExecFwk::SysMrgClient>::GetInstance();
|
||||
if (sysMrgClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get SysMrgClient failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get SysMrgClient failed");
|
||||
return nullptr;
|
||||
}
|
||||
auto object = sysMrgClient->GetSystemAbility(APP_MGR_SERVICE_ID);
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "GetAppMgr failed");
|
||||
return nullptr;
|
||||
}
|
||||
return iface_cast<AppExecFwk::IAppMgr>(object);
|
||||
@@ -458,9 +458,9 @@ void ChildProcessManager::MakeProcessName(const std::string &srcEntry)
|
||||
{
|
||||
std::string processName = g_debugOption.bundleName;
|
||||
if (srcEntry.empty()) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "srcEntry empty.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "srcEntry empty");
|
||||
} else {
|
||||
TAG_LOGW(AAFwkTag::PROCESSMGR, "srcEntry is not empty.");
|
||||
TAG_LOGW(AAFwkTag::PROCESSMGR, "srcEntry not empty");
|
||||
std::string filename = std::filesystem::path(srcEntry).stem();
|
||||
if (!filename.empty()) {
|
||||
processName.append(":");
|
||||
@@ -470,7 +470,7 @@ void ChildProcessManager::MakeProcessName(const std::string &srcEntry)
|
||||
std::lock_guard<std::mutex> lock(childProcessCountLock_);
|
||||
processName.append(std::to_string(childProcessCount_));
|
||||
childProcessCount_++;
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "SetForkProcessDebugOption processName is %{public}s", processName.c_str());
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "processName: %{public}s", processName.c_str());
|
||||
g_debugOption.processName = processName;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,24 +31,24 @@ std::shared_ptr<ChildProcess> JsChildProcess::Create(const std::unique_ptr<Runti
|
||||
JsChildProcess::JsChildProcess(JsRuntime &jsRuntime) : jsRuntime_(jsRuntime) {}
|
||||
JsChildProcess::~JsChildProcess()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "JsChildProcess destructor.");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "Called");
|
||||
jsRuntime_.FreeNativeReference(std::move(jsChildProcessObj_));
|
||||
}
|
||||
|
||||
bool JsChildProcess::Init(const std::shared_ptr<ChildProcessStartInfo> &info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "JsChildProcess Init called");
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "called");
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "info is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null info");
|
||||
return false;
|
||||
}
|
||||
bool ret = ChildProcess::Init(info);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "ChildProcess init failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "ChildProcess init failed");
|
||||
return false;
|
||||
}
|
||||
if (info->srcEntry.empty()) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "ChildProcessStartInfo srcEntry is empty");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Empty info srcEntry");
|
||||
return false;
|
||||
}
|
||||
std::string srcPath = info->srcEntry;
|
||||
@@ -62,7 +62,7 @@ bool JsChildProcess::Init(const std::shared_ptr<ChildProcessStartInfo> &info)
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
jsChildProcessObj_ = jsRuntime_.LoadModule(moduleName, srcPath, info->hapPath, info->isEsModule);
|
||||
if (jsChildProcessObj_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to get ChildProcess object");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null jsChildProcessObj_");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -70,7 +70,7 @@ bool JsChildProcess::Init(const std::shared_ptr<ChildProcessStartInfo> &info)
|
||||
|
||||
void JsChildProcess::OnStart()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "JsChildProcess OnStart called");
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "called");
|
||||
ChildProcess::OnStart();
|
||||
CallObjectMethod("onStart");
|
||||
}
|
||||
@@ -94,9 +94,9 @@ void JsChildProcess::OnStart(std::shared_ptr<AppExecFwk::ChildProcessArgs> args)
|
||||
|
||||
napi_value JsChildProcess::CallObjectMethod(const char *name, napi_value const *argv, size_t argc)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "JsChildProcess::CallObjectMethod(%{public}s)", name);
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "called, name:%{public}s", name);
|
||||
if (jsChildProcessObj_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "ChildProcess.js not found");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null jsChildProcessObj_");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -105,14 +105,14 @@ napi_value JsChildProcess::CallObjectMethod(const char *name, napi_value const *
|
||||
|
||||
napi_value obj = jsChildProcessObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to get ChildProcess object");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get ChildProcess obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value methodOnCreate = nullptr;
|
||||
napi_get_named_property(env, obj, name, &methodOnCreate);
|
||||
if (methodOnCreate == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Failed to get '%{public}s' from ChildProcess object", name);
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get '%{public}s' failed", name);
|
||||
return nullptr;
|
||||
}
|
||||
napi_call_function(env, obj, methodOnCreate, argc, argv, nullptr);
|
||||
|
||||
+11
-11
@@ -35,20 +35,20 @@ NativeChildIpcProcess::~NativeChildIpcProcess()
|
||||
|
||||
bool NativeChildIpcProcess::Init(const std::shared_ptr<ChildProcessStartInfo> &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "NativeChildIpcProcess init");
|
||||
TAG_LOGD(AAFwkTag::PROCESSMGR, "init");
|
||||
if (info == nullptr || info->ipcObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "info or ipc callback is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ChildProcess::Init(info)) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Base class init failed.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto iNotify = iface_cast<OHOS::AppExecFwk::INativeChildNotify>(info->ipcObj);
|
||||
if (iNotify == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Faild cvt interface to INativeChildNotify");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null iNotify");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ void NativeChildIpcProcess::OnStart()
|
||||
ChildProcess::OnStart();
|
||||
OHIPCRemoteStub *ipcStub = funcNativeLibOnConnect_();
|
||||
if (ipcStub == nullptr || ipcStub->remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Native lib OnConnect function return null stub");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null ipctub");
|
||||
mainProcessCb_->OnError(static_cast<int32_t>(ChildProcessManagerErrorCode::ERR_CONNECTION_FAILED));
|
||||
return;
|
||||
}
|
||||
@@ -83,9 +83,9 @@ void NativeChildIpcProcess::OnStart()
|
||||
mainProcessCb_->OnNativeChildStarted(childIpcStub);
|
||||
});
|
||||
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Enter native lib MainProc");
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Enter MainProc");
|
||||
funcNativeLibMainProc_();
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Native lib MainProc returned");
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "MainProc returned");
|
||||
|
||||
if (cbThread.joinable()) {
|
||||
cbThread.join();
|
||||
@@ -100,7 +100,7 @@ bool NativeChildIpcProcess::LoadNativeLib(const std::shared_ptr<ChildProcessStar
|
||||
}
|
||||
|
||||
if (info->moduleName.empty()) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Module name is empty");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "empty module name");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -108,14 +108,14 @@ bool NativeChildIpcProcess::LoadNativeLib(const std::shared_ptr<ChildProcessStar
|
||||
std::string appDlNameSpace = "moduleNs_" + info->moduleName;
|
||||
int ret = dlns_get(appDlNameSpace.c_str(), &dlnsApp);
|
||||
if (ret != 0) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get app dlNamespace(%{private}s) failed, err:%{public}d",
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get dlns(%{private}s) err:%{public}d",
|
||||
appDlNameSpace.c_str(), ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
void *libHandle = dlopen_ns(&dlnsApp, info->srcEntry.c_str(), RTLD_LAZY);
|
||||
if (libHandle == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Load lib file %{private}s failed, err %{public}s",
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Load lib file %{private}s err %{public}s",
|
||||
info->srcEntry.c_str(), dlerror());
|
||||
return false;
|
||||
}
|
||||
@@ -124,14 +124,14 @@ bool NativeChildIpcProcess::LoadNativeLib(const std::shared_ptr<ChildProcessStar
|
||||
NativeChildProcess_OnConnect funcOnConnect =
|
||||
reinterpret_cast<NativeChildProcess_OnConnect>(dlsym(libHandle, "NativeChildProcess_OnConnect"));
|
||||
if (funcOnConnect == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get OnConnect function address failed, err %{public}s", dlerror());
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null funcOnConnect, err %{public}s", dlerror());
|
||||
break;
|
||||
}
|
||||
|
||||
NativeChildProcess_MainProc funcMainProc =
|
||||
reinterpret_cast<NativeChildProcess_MainProc>(dlsym(libHandle, "NativeChildProcess_MainProc"));
|
||||
if (funcMainProc == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Get MainProc function address failed, err %{public}s", dlerror());
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null funcMainProc, err %{public}s", dlerror());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ DataAbilityHelper::DataAbilityHelper(const std::shared_ptr<DataShare::DataShareH
|
||||
*/
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(const std::shared_ptr<Context> context)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with context.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with context");
|
||||
DataAbilityHelper *ptrDataAbilityHelper = nullptr;
|
||||
std::shared_ptr<DataAbilityHelperImpl> dataAbilityHelperImpl = DataAbilityHelperImpl::Creator(context);
|
||||
if (dataAbilityHelperImpl) {
|
||||
@@ -62,9 +62,9 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(const std::shared_
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
const std::shared_ptr<Context> context, const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with context & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with context & uri");
|
||||
if (!context || !uri) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, context or uri is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
auto sharedPtrDataAbilityHelper = DataAbilityHelper::Creator(context, uri, false);
|
||||
@@ -72,8 +72,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
return sharedPtrDataAbilityHelper;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"Call DataAbilityHelperImpl Creator failed, Call DataShareHelper Creator with context & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator failed");
|
||||
Uri dataShareUri("");
|
||||
if (!DataAbilityHelper::TransferScheme(*uri, dataShareUri)) {
|
||||
return nullptr;
|
||||
@@ -83,7 +82,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
if (dataShareHelper) {
|
||||
ptrDataAbilityHelper = new DataAbilityHelper(dataShareHelper);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Creator end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return std::shared_ptr<DataAbilityHelper>(ptrDataAbilityHelper);
|
||||
}
|
||||
|
||||
@@ -98,9 +97,9 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
const std::shared_ptr<OHOS::AbilityRuntime::Context> context, const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with ability runtime context & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with ability runtime context & uri");
|
||||
if (!context || !uri) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, ability runtime context or uri is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
auto sharedPtrDataAbilityHelper = DataAbilityHelper::Creator(context, uri, false);
|
||||
@@ -108,8 +107,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
return sharedPtrDataAbilityHelper;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator failed, "
|
||||
"Call DataShareHelper Creator with ability runtime context & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator failed");
|
||||
Uri dataShareUri("");
|
||||
if (!DataAbilityHelper::TransferScheme(*uri, dataShareUri)) {
|
||||
return nullptr;
|
||||
@@ -137,7 +135,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
const std::shared_ptr<Context> context, const std::shared_ptr<Uri> &uri, const bool tryBind)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with context & uri & tryBind.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with context & uri & tryBind");
|
||||
DataAbilityHelper *ptrDataAbilityHelper = nullptr;
|
||||
auto dataAbilityHelperImpl = DataAbilityHelperImpl::Creator(context, uri, tryBind);
|
||||
if (dataAbilityHelperImpl) {
|
||||
@@ -162,7 +160,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
const std::shared_ptr<OHOS::AbilityRuntime::Context> context, const std::shared_ptr<Uri> &uri, const bool tryBind)
|
||||
{
|
||||
TAG_LOGI(
|
||||
AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with ability runtime context & uri & tryBind.");
|
||||
AAFwkTag::DATA_ABILITY, "Creator with ability runtime context & uri & tryBind");
|
||||
DataAbilityHelper *ptrDataAbilityHelper = nullptr;
|
||||
auto dataAbilityHelperImpl = DataAbilityHelperImpl::Creator(context, uri, tryBind);
|
||||
if (dataAbilityHelperImpl) {
|
||||
@@ -180,7 +178,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
*/
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(const sptr<IRemoteObject> token)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with token.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with token");
|
||||
DataAbilityHelper *ptrDataAbilityHelper = nullptr;
|
||||
auto dataAbilityHelperImpl = DataAbilityHelperImpl::Creator(token);
|
||||
if (dataAbilityHelperImpl) {
|
||||
@@ -202,9 +200,9 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(const sptr<IRemote
|
||||
std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
const sptr<IRemoteObject> token, const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Creator with token & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator with token & uri");
|
||||
if (!token || !uri) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, token or uri is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
DataAbilityHelper *ptrDataAbilityHelper = nullptr;
|
||||
@@ -212,8 +210,7 @@ std::shared_ptr<DataAbilityHelper> DataAbilityHelper::Creator(
|
||||
if (dataAbilityHelperImpl) {
|
||||
ptrDataAbilityHelper = new DataAbilityHelper(dataAbilityHelperImpl);
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"Call DataAbilityHelperImpl Creator failed, Call DataShareHelper Creator with token & uri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Creator failed");
|
||||
Uri dataShareUri("");
|
||||
if (!DataAbilityHelper::TransferScheme(*uri, dataShareUri)) {
|
||||
return nullptr;
|
||||
@@ -237,11 +234,11 @@ bool DataAbilityHelper::Release()
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
bool ret = false;
|
||||
if (dataAbilityHelperImpl_) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Release.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityHelperImpl Release");
|
||||
ret = dataAbilityHelperImpl_->Release();
|
||||
}
|
||||
if (dataShareHelper_) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Release.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataShareHelper Release");
|
||||
ret = dataShareHelper_->Release();
|
||||
dataShareHelper_.reset();
|
||||
}
|
||||
@@ -263,12 +260,12 @@ std::vector<std::string> DataAbilityHelper::GetFileTypes(Uri &uri, const std::st
|
||||
std::vector<std::string> matchedMIMEs;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl GetFileTypes.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability GetFileTypes");
|
||||
matchedMIMEs = dataAbilityHelperImpl->GetFileTypes(uri, mimeTypeFilter);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper GetFileTypes.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share GetFileTypes");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
matchedMIMEs = dataShareHelper->GetFileTypes(dataShareUri, mimeTypeFilter);
|
||||
@@ -294,15 +291,15 @@ int DataAbilityHelper::OpenFile(Uri &uri, const std::string &mode)
|
||||
int fd = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl OpenFile.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability OpenFile");
|
||||
fd = dataAbilityHelperImpl->OpenFile(uri, mode);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
if (callFromJs_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Call DataShareHelper OpenFile, DataShareHelper no this interface.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Share no this interface");
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper OpenFile.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share OpenFile");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
fd = dataShareHelper->OpenFile(dataShareUri, mode);
|
||||
@@ -330,12 +327,12 @@ int DataAbilityHelper::OpenRawFile(Uri &uri, const std::string &mode)
|
||||
int fd = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl OpenRawFile.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability OpenRawFile");
|
||||
fd = dataAbilityHelperImpl->OpenRawFile(uri, mode);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper OpenFile.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share OpenFile");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
fd = dataShareHelper->OpenRawFile(dataShareUri, mode);
|
||||
@@ -359,12 +356,12 @@ int DataAbilityHelper::Insert(Uri &uri, const NativeRdb::ValuesBucket &value)
|
||||
int index = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Insert.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability Insert");
|
||||
index = dataAbilityHelperImpl->Insert(uri, value);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Insert.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share Insert");
|
||||
DataShare::DataShareValuesBucket dataShareValue = RdbDataAbilityUtils::ToDataShareValuesBucket(value);
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
@@ -381,11 +378,11 @@ std::shared_ptr<AppExecFwk::PacMap> DataAbilityHelper::Call(
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Call.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability Call");
|
||||
result = dataAbilityHelperImpl->Call(uri, method, arg, pacMap);
|
||||
}
|
||||
if (dataShareHelper_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Call, DataShareHelper no this interface.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Share no Call");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -407,12 +404,12 @@ int DataAbilityHelper::Update(
|
||||
int index = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Update.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability Update");
|
||||
index = dataAbilityHelperImpl->Update(uri, value, predicates);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Update.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share Update");
|
||||
DataShare::DataShareValuesBucket dataShareValue = RdbDataAbilityUtils::ToDataShareValuesBucket(value);
|
||||
DataShare::DataSharePredicates dataSharePredicates = RdbDataAbilityUtils::ToDataSharePredicates(predicates);
|
||||
Uri dataShareUri("");
|
||||
@@ -438,12 +435,12 @@ int DataAbilityHelper::Delete(Uri &uri, const NativeRdb::DataAbilityPredicates &
|
||||
int index = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Delete.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability Delete");
|
||||
return dataAbilityHelperImpl->Delete(uri, predicates);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Delete.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share Delete");
|
||||
DataShare::DataSharePredicates dataSharePredicates = RdbDataAbilityUtils::ToDataSharePredicates(predicates);
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
@@ -470,24 +467,24 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> DataAbilityHelper::Query(
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> resultSet = nullptr;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Query.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Ability Query");
|
||||
return dataAbilityHelperImpl->Query(uri, columns, predicates);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Query.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Share Query");
|
||||
DataShare::DataSharePredicates dataSharePredicates = RdbDataAbilityUtils::ToDataSharePredicates(predicates);
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
std::shared_ptr<DataShare::DataShareResultSet> dataShareResultSet
|
||||
= dataShareHelper->Query(dataShareUri, dataSharePredicates, columns);
|
||||
if (!dataShareResultSet) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Return dataShareResultSet is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null dataShareResultSet");
|
||||
return nullptr;
|
||||
}
|
||||
resultSet = RdbDataAbilityUtils::ToAbsSharedResultSet(dataShareResultSet);
|
||||
if (!resultSet) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Transfer to AbsSharedResultSet failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Transfer to AbsSharedResultSet failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,12 +506,12 @@ std::string DataAbilityHelper::GetType(Uri &uri)
|
||||
std::string type;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl GetType.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability GetType");
|
||||
type = dataAbilityHelperImpl->GetType(uri);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper GetType.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share GetType");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
type = dataShareHelper->GetType(dataShareUri);
|
||||
@@ -539,11 +536,11 @@ bool DataAbilityHelper::Reload(Uri &uri, const PacMap &extras)
|
||||
bool ret = false;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl Reload.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability Reload");
|
||||
ret = dataAbilityHelperImpl->Reload(uri, extras);
|
||||
}
|
||||
if (dataShareHelper_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Call DataShareHelper Reload, DataShareHelper no this interface.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Share no Reload");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -563,12 +560,12 @@ int DataAbilityHelper::BatchInsert(Uri &uri, const std::vector<NativeRdb::Values
|
||||
int ret = -1;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl BatchInsert.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability BatchInsert");
|
||||
ret = dataAbilityHelperImpl->BatchInsert(uri, values);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper BatchInsert.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share BatchInsert");
|
||||
std::vector<DataShare::DataShareValuesBucket> dataShareValues;
|
||||
for (auto value : values) {
|
||||
DataShare::DataShareValuesBucket dataShareValue = RdbDataAbilityUtils::ToDataShareValuesBucket(value);
|
||||
@@ -593,12 +590,12 @@ void DataAbilityHelper::RegisterObserver(const Uri &uri, const sptr<AAFwk::IData
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl RegisterObserver.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability RegisterObserver");
|
||||
dataAbilityHelperImpl->RegisterObserver(uri, dataObserver);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper RegisterObserver.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share RegisterObserver");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
dataShareHelper->RegisterObserver(dataShareUri, dataObserver);
|
||||
@@ -617,12 +614,12 @@ void DataAbilityHelper::UnregisterObserver(const Uri &uri, const sptr<AAFwk::IDa
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl UnregisterObserver.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability UnregisterObserver");
|
||||
dataAbilityHelperImpl->UnregisterObserver(uri, dataObserver);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper UnregisterObserver.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share UnregisterObserver");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
dataShareHelper->UnregisterObserver(dataShareUri, dataObserver);
|
||||
@@ -641,12 +638,12 @@ void DataAbilityHelper::NotifyChange(const Uri &uri)
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl NotifyChange.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability NotifyChange");
|
||||
dataAbilityHelperImpl->NotifyChange(uri);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper NotifyChange.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share NotifyChange");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
dataShareHelper->NotifyChange(dataShareUri);
|
||||
@@ -673,12 +670,12 @@ Uri DataAbilityHelper::NormalizeUri(Uri &uri)
|
||||
Uri urivalue("");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl NormalizeUri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability NormalizeUri");
|
||||
urivalue = dataAbilityHelperImpl->NormalizeUri(uri);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper NormalizeUri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share NormalizeUri");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
urivalue = dataShareHelper->NormalizeUri(dataShareUri);
|
||||
@@ -704,12 +701,12 @@ Uri DataAbilityHelper::DenormalizeUri(Uri &uri)
|
||||
Uri urivalue("");
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl DenormalizeUri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability DenormalizeUri");
|
||||
urivalue = dataAbilityHelperImpl->DenormalizeUri(uri);
|
||||
}
|
||||
auto dataShareHelper = GetDataShareHelper();
|
||||
if (dataShareHelper) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataShareHelper DenormalizeUri.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Share DenormalizeUri");
|
||||
Uri dataShareUri("");
|
||||
if (TransferScheme(uri, dataShareUri)) {
|
||||
urivalue = dataShareHelper->DenormalizeUri(dataShareUri);
|
||||
@@ -725,11 +722,11 @@ std::vector<std::shared_ptr<DataAbilityResult>> DataAbilityHelper::ExecuteBatch(
|
||||
std::vector<std::shared_ptr<DataAbilityResult>> results;
|
||||
auto dataAbilityHelperImpl = GetDataAbilityHelperImpl();
|
||||
if (dataAbilityHelperImpl) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Call DataAbilityHelperImpl ExecuteBatch.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability ExecuteBatch");
|
||||
results = dataAbilityHelperImpl->ExecuteBatch(uri, operations);
|
||||
}
|
||||
if (dataShareHelper_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Call DataShareHelper ExecuteBatch, DataShareHelper no this interface.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Share no ExecuteBatch");
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -745,7 +742,7 @@ bool DataAbilityHelper::TransferScheme(const Uri &uri, Uri &dataShareUri)
|
||||
Uri inputUri = uri;
|
||||
if (inputUri.GetScheme() == dataShareScheme) {
|
||||
dataShareUri = Uri(inputUri.ToString());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "input uri is data share uri, uri: %{public}s, no need transfer.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "data share uri: %{public}s no need transfer",
|
||||
inputUri.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
@@ -754,7 +751,7 @@ bool DataAbilityHelper::TransferScheme(const Uri &uri, Uri &dataShareUri)
|
||||
string uriStr = inputUri.ToString();
|
||||
uriStr.replace(0, dataAbilityScheme.length(), dataShareScheme);
|
||||
dataShareUri = Uri(uriStr);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "data ability uri: %{public}s transfer to data share uri: %{public}s.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ability uri: %{public}s transfer to share uri: %{public}s",
|
||||
inputUri.ToString().c_str(), dataShareUri.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
@@ -763,12 +760,12 @@ bool DataAbilityHelper::TransferScheme(const Uri &uri, Uri &dataShareUri)
|
||||
string uriStr = inputUri.ToString();
|
||||
uriStr.replace(0, filePrefix.length(), dataSharePrefix);
|
||||
dataShareUri = Uri(uriStr);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "file uri: %{public}s transfer to data share uri: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "file uri: %{public}s transfer to share uri: %{public}s",
|
||||
inputUri.ToString().c_str(), dataShareUri.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, uri: %{private}s", inputUri.ToString().c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param, uri: %{private}s", inputUri.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ DataAbilityHelperImpl::DataAbilityHelperImpl(const sptr<IRemoteObject> &token)
|
||||
void DataAbilityHelperImpl::AddDataAbilityDeathRecipient(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
if (token != nullptr && callerDeathRecipient_ != nullptr) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Remove death recipient.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Remove death recipient");
|
||||
token->RemoveDeathRecipient(callerDeathRecipient_);
|
||||
}
|
||||
if (callerDeathRecipient_ == nullptr) {
|
||||
@@ -89,15 +89,15 @@ void DataAbilityHelperImpl::AddDataAbilityDeathRecipient(const sptr<IRemoteObjec
|
||||
}
|
||||
});
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Add death recipient.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Add death recipient");
|
||||
if (token == nullptr || !token->AddDeathRecipient(callerDeathRecipient_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AddDeathRecipient failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AddDeathRecipient failed");
|
||||
}
|
||||
}
|
||||
|
||||
void DataAbilityHelperImpl::OnSchedulerDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "On scheduler died.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
auto object = remote.promote();
|
||||
object = nullptr;
|
||||
@@ -115,13 +115,13 @@ void DataAbilityHelperImpl::OnSchedulerDied(const wptr<IRemoteObject> &remote)
|
||||
std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(const std::shared_ptr<Context> &context)
|
||||
{
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptrDataAbilityHelperImpl = new (std::nothrow) DataAbilityHelperImpl(context);
|
||||
if (ptrDataAbilityHelperImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New DataAbilityHelperImpl failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -144,25 +144,25 @@ std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(
|
||||
const std::shared_ptr<Context> &context, const std::shared_ptr<Uri> &uri, const bool tryBind)
|
||||
{
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, context is null.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CheckUri(uri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "uri is invalid");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid uri");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<IAbilityScheduler> dataAbilityProxy =
|
||||
AbilityManagerClient::GetInstance()->AcquireDataAbility(*uri.get(), tryBind, context->GetToken());
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Acquire data ability error.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AcquireDataAbility error");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptrDataAbilityHelperImpl = new (std::nothrow) DataAbilityHelperImpl(context, uri, dataAbilityProxy, tryBind);
|
||||
if (ptrDataAbilityHelperImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New DataAbilityHelperImpl error.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New error");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -185,25 +185,25 @@ std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(
|
||||
const std::shared_ptr<OHOS::AbilityRuntime::Context> &context, const std::shared_ptr<Uri> &uri, const bool tryBind)
|
||||
{
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CheckUri(uri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "uri is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid uri");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<IAbilityScheduler> dataAbilityProxy =
|
||||
AbilityManagerClient::GetInstance()->AcquireDataAbility(*uri.get(), tryBind, context->GetToken());
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Acquire data ability failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AcquireDataAbility failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptrDataAbilityHelperImpl = new (std::nothrow) DataAbilityHelperImpl(context, uri, dataAbilityProxy, tryBind);
|
||||
if (ptrDataAbilityHelperImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New DataAbilityHelperImpl failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -220,13 +220,13 @@ std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(
|
||||
std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, token is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptrDataAbilityHelperImpl = new (std::nothrow) DataAbilityHelperImpl(token);
|
||||
if (ptrDataAbilityHelperImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New DataAbilityHelperImpl failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -247,25 +247,25 @@ std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(
|
||||
const sptr<IRemoteObject> &token, const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, token is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "param invalid");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CheckUri(uri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "uri is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid uri");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<IAbilityScheduler> dataAbilityProxy =
|
||||
AbilityManagerClient::GetInstance()->AcquireDataAbility(*uri.get(), false, token);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Acquire data ability failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AcquireDataAbility failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptrDataAbilityHelperImpl = new (std::nothrow) DataAbilityHelperImpl(token, uri, dataAbilityProxy);
|
||||
if (ptrDataAbilityHelperImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New DataAbilityHelperImpl failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "New failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -281,13 +281,13 @@ std::shared_ptr<DataAbilityHelperImpl> DataAbilityHelperImpl::Creator(
|
||||
bool DataAbilityHelperImpl::Release()
|
||||
{
|
||||
if (uri_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Release failed, uri_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Release failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
int err = AbilityManagerClient::GetInstance()->ReleaseDataAbility(dataAbilityProxy_, token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Release data ability failed, err = %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReleaseDataAbility err:%{public}d", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -307,14 +307,14 @@ std::vector<std::string> DataAbilityHelperImpl::GetFileTypes(Uri &uri, const std
|
||||
std::vector<std::string> matchedMIMEs;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return matchedMIMEs;
|
||||
}
|
||||
|
||||
matchedMIMEs = dataAbilityProxy->GetFileTypes(uri, mimeTypeFilter);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return matchedMIMEs size: %{public}zu.", matchedMIMEs.size());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "matchedMIMEs size: %{public}zu", matchedMIMEs.size());
|
||||
return matchedMIMEs;
|
||||
}
|
||||
|
||||
@@ -334,14 +334,14 @@ int DataAbilityHelperImpl::OpenFile(Uri &uri, const std::string &mode)
|
||||
int fd = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return fd;
|
||||
}
|
||||
|
||||
fd = dataAbilityProxy->OpenFile(uri, mode);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return fd: %{public}d.", fd);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "fd: %{public}d", fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -362,14 +362,14 @@ int DataAbilityHelperImpl::OpenRawFile(Uri &uri, const std::string &mode)
|
||||
int fd = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return fd;
|
||||
}
|
||||
|
||||
fd = dataAbilityProxy->OpenRawFile(uri, mode);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return fd: %{public}d.", fd);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "fd: %{public}d", fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -386,14 +386,14 @@ int DataAbilityHelperImpl::Insert(Uri &uri, const NativeRdb::ValuesBucket &value
|
||||
int index = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return index;
|
||||
}
|
||||
|
||||
index = dataAbilityProxy->Insert(uri, value);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return index: %{public}d.", index);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "index: %{public}d", index);
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -403,14 +403,14 @@ std::shared_ptr<AppExecFwk::PacMap> DataAbilityHelperImpl::Call(
|
||||
std::shared_ptr<AppExecFwk::PacMap> result = nullptr;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return result;
|
||||
}
|
||||
|
||||
result = dataAbilityProxy->Call(uri, method, arg, pacMap);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return result is or not nullptr: %{public}d.", result == nullptr);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "null result?: %{public}d", result == nullptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -429,14 +429,14 @@ int DataAbilityHelperImpl::Update(
|
||||
int index = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return index;
|
||||
}
|
||||
|
||||
index = dataAbilityProxy->Update(uri, value, predicates);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return index: %{public}d.", index);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "index: %{public}d", index);
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -453,14 +453,14 @@ int DataAbilityHelperImpl::Delete(Uri &uri, const NativeRdb::DataAbilityPredicat
|
||||
int index = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return index;
|
||||
}
|
||||
|
||||
index = dataAbilityProxy->Delete(uri, predicates);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return index: %{public}d.", index);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "index: %{public}d", index);
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -479,14 +479,14 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> DataAbilityHelperImpl::Query(
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> resultset = nullptr;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return resultset;
|
||||
}
|
||||
|
||||
resultset = dataAbilityProxy->Query(uri, columns, predicates);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Return resultset is or not nullptr: %{public}d.", resultset == nullptr);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null resultset?: %{public}d.", resultset == nullptr);
|
||||
return resultset;
|
||||
}
|
||||
|
||||
@@ -503,14 +503,14 @@ std::string DataAbilityHelperImpl::GetType(Uri &uri)
|
||||
std::string type;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return type;
|
||||
}
|
||||
|
||||
type = dataAbilityProxy->GetType(uri);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return type: %{public}s.", type.c_str());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "type: %{public}s", type.c_str());
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -529,14 +529,14 @@ bool DataAbilityHelperImpl::Reload(Uri &uri, const PacMap &extras)
|
||||
bool ret = false;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = dataAbilityProxy->Reload(uri, extras);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return ret: %{public}d.", ret);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ret: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -553,14 +553,14 @@ int DataAbilityHelperImpl::BatchInsert(Uri &uri, const std::vector<NativeRdb::Va
|
||||
int ret = -1;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = dataAbilityProxy->BatchInsert(uri, values);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return ret: %{public}d.", ret);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ret: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ bool DataAbilityHelperImpl::CheckUriParam(const Uri &uri)
|
||||
{
|
||||
Uri checkUri(uri.ToString());
|
||||
if (!CheckOhosUri(checkUri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check ohos uri failed, uri: %{public}s.", uri.ToString().c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check failed, uri: %{public}s", uri.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -577,12 +577,12 @@ bool DataAbilityHelperImpl::CheckUriParam(const Uri &uri)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
if (!uri_) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "uri_ is nullptr, no need check.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "no need check");
|
||||
return true;
|
||||
}
|
||||
Uri checkUri(uri_->ToString());
|
||||
if (!CheckOhosUri(checkUri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check ohos uri failed, uri_: %{public}s.", uri_->ToString().c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check failed, uri_: %{public}s", uri_->ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ bool DataAbilityHelperImpl::CheckUriParam(const Uri &uri)
|
||||
std::vector<std::string> checkSegments;
|
||||
checkUri.GetPathSegments(checkSegments);
|
||||
if (checkSegments.empty() || segments.empty() || checkSegments[0] != segments[0]) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "The dataability in uri doesn't equal the one in uri_.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "uri different");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -604,19 +604,19 @@ bool DataAbilityHelperImpl::CheckOhosUri(const Uri &checkUri)
|
||||
Uri uri(checkUri);
|
||||
if (uri.GetScheme() != SchemeOhos) {
|
||||
TAG_LOGE(
|
||||
AAFwkTag::DATA_ABILITY, "Input uri is not a dataability one, uri: %{public}s.", uri.ToString().c_str());
|
||||
AAFwkTag::DATA_ABILITY, "not dataability uri: %{public}s", uri.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> segments;
|
||||
uri.GetPathSegments(segments);
|
||||
if (segments.empty()) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "There is no segments in the uri, uri: %{public}s.", uri.ToString().c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "no segments in uri: %{public}s", uri.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uri.GetPath() == "") {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "The path in the uri is empty, uri: %{public}s.", uri.ToString().c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "path empty in uri: %{public}s", uri.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ bool DataAbilityHelperImpl::CheckOhosUri(const Uri &checkUri)
|
||||
void DataAbilityHelperImpl::RegisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver)
|
||||
{
|
||||
if (!CheckUriAndDataObserver(uri, dataObserver)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "RegisterObserver param is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ void DataAbilityHelperImpl::RegisterObserver(const Uri &uri, const sptr<AAFwk::I
|
||||
return;
|
||||
}
|
||||
if (path->second != tmpUri.GetPath()) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input uri's path is not equal the one the observer used.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input uri's path diff from observer's");
|
||||
return;
|
||||
}
|
||||
dataAbilityProxy = dataability->second;
|
||||
@@ -662,7 +662,7 @@ void DataAbilityHelperImpl::RegisterObserver(const Uri &uri, const sptr<AAFwk::I
|
||||
}
|
||||
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "dataAbilityProxy is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null dataAbilityProxy");
|
||||
registerMap_.erase(dataObserver);
|
||||
uriMap_.erase(dataObserver);
|
||||
return;
|
||||
@@ -679,7 +679,7 @@ void DataAbilityHelperImpl::RegisterObserver(const Uri &uri, const sptr<AAFwk::I
|
||||
void DataAbilityHelperImpl::UnregisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver)
|
||||
{
|
||||
if (!CheckUriAndDataObserver(uri, dataObserver)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "UnregisterObserver param is invalid.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ void DataAbilityHelperImpl::UnregisterObserver(const Uri &uri, const sptr<AAFwk:
|
||||
return;
|
||||
}
|
||||
if (path->second != tmpUri.GetPath()) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input uri's path is not equal the one the observer used.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input uri's path diff from observer's");
|
||||
return;
|
||||
}
|
||||
dataAbilityProxy = dataability->second;
|
||||
@@ -705,7 +705,7 @@ void DataAbilityHelperImpl::UnregisterObserver(const Uri &uri, const sptr<AAFwk:
|
||||
}
|
||||
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "dataAbilityProxy is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null dataAbilityProxy");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ void DataAbilityHelperImpl::NotifyChange(const Uri &uri)
|
||||
{
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -752,14 +752,14 @@ Uri DataAbilityHelperImpl::NormalizeUri(Uri &uri)
|
||||
Uri urivalue("");
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
urivalue = dataAbilityProxy->NormalizeUri(uri);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return uri: %{public}s.", urivalue.ToString().c_str());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "uri: %{public}s", urivalue.ToString().c_str());
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
@@ -778,14 +778,14 @@ Uri DataAbilityHelperImpl::DenormalizeUri(Uri &uri)
|
||||
Uri urivalue("");
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
urivalue = dataAbilityProxy->DenormalizeUri(uri);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return uri: %{public}s.", urivalue.ToString().c_str());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "uri: %{public}s", urivalue.ToString().c_str());
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
@@ -795,31 +795,31 @@ std::vector<std::shared_ptr<DataAbilityResult>> DataAbilityHelperImpl::ExecuteBa
|
||||
std::vector<std::shared_ptr<DataAbilityResult>> results;
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = GetDataAbilityProxy(uri, false);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Get data ability proxy failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetDataAbilityProxy failed");
|
||||
return results;
|
||||
}
|
||||
|
||||
results = dataAbilityProxy->ExecuteBatch(operations);
|
||||
|
||||
ReleaseDataAbility(dataAbilityProxy);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Return results size: %{public}zu.", results.size());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "results size: %{public}zu", results.size());
|
||||
return results;
|
||||
}
|
||||
|
||||
sptr<AAFwk::IAbilityScheduler> DataAbilityHelperImpl::GetDataAbilityProxy(const Uri &uri, bool addDeathRecipient)
|
||||
{
|
||||
if (!CheckUriParam(uri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check uri param failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check uri failed");
|
||||
return nullptr;
|
||||
}
|
||||
// if uri_ is nullptr, it indicates the operation(such as insert, delete and so on) is temporary,
|
||||
// so, we need acquire the dataability before the operation.
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = dataAbilityProxy_;
|
||||
if (uri_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "The uri_ is nullptr, need acquire data ability.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "null uri_");
|
||||
dataAbilityProxy = AbilityManagerClient::GetInstance()->AcquireDataAbility(uri, tryBind_, token_);
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Acquire data ability failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "AcquireDataAbility failed");
|
||||
return nullptr;
|
||||
}
|
||||
if (addDeathRecipient && isSystemCaller_) {
|
||||
@@ -833,23 +833,23 @@ void DataAbilityHelperImpl::ReleaseDataAbility(sptr<AAFwk::IAbilityScheduler> da
|
||||
{
|
||||
// if uri_ is nullptr, it indicates the operation(such as insert, delete and so on) is temporary,
|
||||
// so, we need release the dataability after the operation.
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ReleaseDataAbility start.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (!uri_ && dataAbilityProxy && token_) {
|
||||
int ret = AbilityManagerClient::GetInstance()->ReleaseDataAbility(dataAbilityProxy, token_);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Release data ability, ret: %{public}d.", ret);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ReleaseDataAbility ret: %{public}d", ret);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "ReleaseDataAbility end.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "end");
|
||||
}
|
||||
|
||||
bool DataAbilityHelperImpl::CheckUri(const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
if (uri == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, uri is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uri->GetScheme() != SchemeOhos) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, the uri is not dataability, Scheme: %{private}s.",
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param, uri not dataability, Scheme: %{private}s",
|
||||
uri->GetScheme().c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -861,12 +861,12 @@ bool DataAbilityHelperImpl::CheckUriAndDataObserver(const Uri &uri,
|
||||
const sptr<AAFwk::IDataAbilityObserver> &dataObserver)
|
||||
{
|
||||
if (!CheckUriParam(uri)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check uri param failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Check uri failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dataObserver == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Input param invalid, dataObserver is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -875,11 +875,11 @@ bool DataAbilityHelperImpl::CheckUriAndDataObserver(const Uri &uri,
|
||||
|
||||
void DataAbilityDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "recv DataAbilityDeathRecipient death notice.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
if (handler_) {
|
||||
handler_(remote);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "OnRemoteDied end.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "end");
|
||||
}
|
||||
|
||||
DataAbilityDeathRecipient::DataAbilityDeathRecipient(RemoteDiedHandler handler) : handler_(handler)
|
||||
|
||||
@@ -35,10 +35,10 @@ void DataAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Li
|
||||
sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityImpl::sourceState:%{public}d; targetState: %{public}d; isNewWant: %{public}d", lifecycleState_,
|
||||
"sourceState:%{public}d; targetState:%{public}d; isNewWant:%{public}d", lifecycleState_,
|
||||
targetState.state, targetState.isNewWant);
|
||||
if ((lifecycleState_ == targetState.state) && !targetState.isNewWant) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Org lifeCycleState equals to Dst lifeCycleState.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "lifeCycleState equals");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void DataAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Li
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::HandleAbilityTransaction state is error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "state error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ std::vector<std::string> DataAbilityImpl::GetFileTypes(const Uri &uri, const std
|
||||
{
|
||||
std::vector<std::string> types;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::GetFileTypes ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return types;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ int DataAbilityImpl::OpenFile(const Uri &uri, const std::string &mode)
|
||||
{
|
||||
int fd = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::OpenFile ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ int DataAbilityImpl::OpenRawFile(const Uri &uri, const std::string &mode)
|
||||
{
|
||||
int fd = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::OpenRawFile ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -149,12 +149,12 @@ int DataAbilityImpl::Insert(const Uri &uri, const NativeRdb::ValuesBucket &value
|
||||
{
|
||||
int index = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Insert ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return index;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Insert failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -176,12 +176,12 @@ int DataAbilityImpl::Update(
|
||||
{
|
||||
int index = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Update ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return index;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Update failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -201,12 +201,12 @@ int DataAbilityImpl::Delete(const Uri &uri, const NativeRdb::DataAbilityPredicat
|
||||
{
|
||||
int index = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Delete ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return index;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Delete failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -227,12 +227,12 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> DataAbilityImpl::Query(
|
||||
const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Query ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(READ)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Query failed, do not have read permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no read permission");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ std::shared_ptr<AppExecFwk::PacMap> DataAbilityImpl::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Call ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ std::string DataAbilityImpl::GetType(const Uri &uri)
|
||||
{
|
||||
std::string type;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::GetType ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return type;
|
||||
}
|
||||
type = ability_->GetType(uri);
|
||||
@@ -283,7 +283,7 @@ bool DataAbilityImpl::Reload(const Uri &uri, const PacMap &extras)
|
||||
{
|
||||
bool ret = false;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::Reload ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return ret;
|
||||
}
|
||||
ret = ability_->Reload(uri, extras);
|
||||
@@ -302,12 +302,12 @@ int DataAbilityImpl::BatchInsert(const Uri &uri, const std::vector<NativeRdb::Va
|
||||
{
|
||||
int ret = -1;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::BatchInsert ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::BatchInsert failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -330,12 +330,12 @@ Uri DataAbilityImpl::NormalizeUri(const Uri &uri)
|
||||
{
|
||||
Uri urivalue("");
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::NormalizeUri ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(READ)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::NormalizeUri failed, do not have read permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no read permission");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
@@ -359,12 +359,12 @@ Uri DataAbilityImpl::DenormalizeUri(const Uri &uri)
|
||||
{
|
||||
Uri urivalue("");
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::DenormalizeUri ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
if (!CheckReadAndWritePermission(READ)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::DenormalizeUri failed, do not have read permission");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "no read permission");
|
||||
return urivalue;
|
||||
}
|
||||
|
||||
@@ -375,10 +375,10 @@ Uri DataAbilityImpl::DenormalizeUri(const Uri &uri)
|
||||
std::vector<std::shared_ptr<DataAbilityResult>> DataAbilityImpl::ExecuteBatch(
|
||||
const std::vector<std::shared_ptr<DataAbilityOperation>> &operations)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::ExecuteBatch start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "start");
|
||||
std::vector<std::shared_ptr<DataAbilityResult>> results;
|
||||
if (ability_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::ExecuteBatch ability_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null ability_");
|
||||
results.clear();
|
||||
return results;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ std::vector<std::shared_ptr<DataAbilityResult>> DataAbilityImpl::ExecuteBatch(
|
||||
}
|
||||
|
||||
results = ability_->ExecuteBatch(operations);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::ExecuteBatch end, results size:%{public}zu", results.size());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "end, results size:%{public}zu", results.size());
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ bool DataAbilityImpl::CheckExecuteBatchPermission(
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
std::shared_ptr<DataAbilityOperation> operation = operations[i];
|
||||
if (operation == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "operation[i] is nullptr, index: %{public}d", static_cast<int32_t>(i));
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null operation, index: %{public}d", static_cast<int32_t>(i));
|
||||
return false;
|
||||
}
|
||||
if (operation->IsInsertOperation() || operation->IsUpdateOperation() || operation->IsDeleteOperation()) {
|
||||
@@ -418,14 +418,14 @@ bool DataAbilityImpl::CheckExecuteBatchPermission(
|
||||
|
||||
if (needCheckReadPermission) {
|
||||
if (!CheckReadAndWritePermission(READ)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::ExecuteBatch failed, do not have read permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no read permission");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (needCheckWritePermission) {
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::ExecuteBatch failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -437,12 +437,12 @@ bool DataAbilityImpl::CheckOpenFilePermission(const std::string &mode) const
|
||||
{
|
||||
if (mode.find(READ) != string::npos) {
|
||||
if (!CheckReadAndWritePermission(READ)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::OpenFile failed, do not have read permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no read permission");
|
||||
return false;
|
||||
}
|
||||
} else if (mode.find(WRITE) != string::npos) {
|
||||
if (!CheckReadAndWritePermission(WRITE)) {
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "DataAbilityImpl::OpenFile failed, do not have write permission");
|
||||
TAG_LOGW(AAFwkTag::DATA_ABILITY, "no write permission");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,131 +140,131 @@ DataAbilityOperation &DataAbilityOperation::operator=(const DataAbilityOperation
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperation::NewInsertBuilder(const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewInsertBuilder start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (uri == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewInsertBuilder uri is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null uri");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> builder =
|
||||
std::make_shared<DataAbilityOperationBuilder>(TYPE_INSERT, uri);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewInsertBuilder end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return builder;
|
||||
}
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperation::NewUpdateBuilder(const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewUpdateBuilder start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (uri == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewUpdateBuilder uri is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null uri");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> builder =
|
||||
std::make_shared<DataAbilityOperationBuilder>(TYPE_UPDATE, uri);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewUpdateBuilder end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return builder;
|
||||
}
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperation::NewDeleteBuilder(const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewDeleteBuilder start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (uri == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewDeleteBuilder uri is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null uri");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> builder =
|
||||
std::make_shared<DataAbilityOperationBuilder>(TYPE_DELETE, uri);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewDeleteBuilder end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return builder;
|
||||
}
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperation::NewAssertBuilder(const std::shared_ptr<Uri> &uri)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewAssertBuilder start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (uri == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewAssertBuilder uri is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null uri");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> builder =
|
||||
std::make_shared<DataAbilityOperationBuilder>(TYPE_ASSERT, uri);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::NewAssertBuilder end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return builder;
|
||||
}
|
||||
|
||||
int DataAbilityOperation::GetType() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetType");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return type_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Uri> DataAbilityOperation::GetUri() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetUri");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return uri_;
|
||||
}
|
||||
|
||||
std::shared_ptr<NativeRdb::ValuesBucket> DataAbilityOperation::GetValuesBucket() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetValuesBucket");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return valuesBucket_;
|
||||
}
|
||||
|
||||
int DataAbilityOperation::GetExpectedCount() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetExpectedCount");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return expectedCount_;
|
||||
}
|
||||
|
||||
std::shared_ptr<NativeRdb::DataAbilityPredicates> DataAbilityOperation::GetDataAbilityPredicates() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetDataAbilityPredicates");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return dataAbilityPredicates_;
|
||||
}
|
||||
|
||||
std::shared_ptr<NativeRdb::ValuesBucket> DataAbilityOperation::GetValuesBucketReferences() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetValuesBucketReferences");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return valuesBucketReferences_;
|
||||
}
|
||||
std::map<int, int> DataAbilityOperation::GetDataAbilityPredicatesBackReferences() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::GetDataAbilityPredicatesBackReferences");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
return dataAbilityPredicatesBackReferences_;
|
||||
}
|
||||
bool DataAbilityOperation::IsValidOperation() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsValidOperation: type is %{public}d", type_);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "type: %{public}d", type_);
|
||||
return (type_ == TYPE_INSERT || type_ == TYPE_UPDATE || type_ == TYPE_DELETE || type_ == TYPE_ASSERT);
|
||||
}
|
||||
bool DataAbilityOperation::IsInsertOperation() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsInsertOperation: %{public}d", type_ == TYPE_INSERT);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "TYPE_INSERT?: %{public}d", type_ == TYPE_INSERT);
|
||||
return type_ == TYPE_INSERT;
|
||||
}
|
||||
bool DataAbilityOperation::IsUpdateOperation() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsUpdateOperation: %{public}d", type_ == TYPE_UPDATE);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "TYPE_UPDATE?: %{public}d", type_ == TYPE_UPDATE);
|
||||
return type_ == TYPE_UPDATE;
|
||||
}
|
||||
bool DataAbilityOperation::IsDeleteOperation() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsDeleteOperation: %{public}d", type_ == TYPE_DELETE);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "TYPE_DELETE?: %{public}d", type_ == TYPE_DELETE);
|
||||
return type_ == TYPE_DELETE;
|
||||
}
|
||||
bool DataAbilityOperation::IsAssertOperation() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsAssertOperation: %{public}d", type_ == TYPE_ASSERT);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "TYPE_ASSERT?: %{public}d", type_ == TYPE_ASSERT);
|
||||
return type_ == TYPE_ASSERT;
|
||||
}
|
||||
bool DataAbilityOperation::IsInterruptionAllowed() const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::IsInterruptionAllowed: %{public}d", interrupted_);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "interrupted_: %{public}d", interrupted_);
|
||||
return interrupted_;
|
||||
}
|
||||
|
||||
bool DataAbilityOperation::WriteUri(Parcel &out) const
|
||||
{
|
||||
if (uri_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Uri is nullptr");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null uri_");
|
||||
return out.WriteInt32(VALUE_NULL);
|
||||
}
|
||||
if (!out.WriteInt32(VALUE_OBJECT)) {
|
||||
@@ -281,7 +281,7 @@ bool DataAbilityOperation::WriteUri(Parcel &out) const
|
||||
bool DataAbilityOperation::WriteValuesBucket(Parcel &out) const
|
||||
{
|
||||
if (valuesBucket_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "ValuesBucket is nullptr");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null valuesBucket_");
|
||||
return out.WriteInt32(VALUE_NULL);
|
||||
}
|
||||
if (!out.WriteInt32(VALUE_OBJECT)) {
|
||||
@@ -298,7 +298,7 @@ bool DataAbilityOperation::WriteValuesBucket(Parcel &out) const
|
||||
bool DataAbilityOperation::WritePredicates(Parcel &out) const
|
||||
{
|
||||
if (dataAbilityPredicates_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityPredicates is nullptr");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null dataAbilityPredicates_");
|
||||
return out.WriteInt32(VALUE_NULL);
|
||||
}
|
||||
if (!out.WriteInt32(VALUE_OBJECT)) {
|
||||
@@ -315,7 +315,7 @@ bool DataAbilityOperation::WritePredicates(Parcel &out) const
|
||||
bool DataAbilityOperation::WriteValuesBucketReferences(Parcel &out) const
|
||||
{
|
||||
if (valuesBucketReferences_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "ValuesBucketReferences is nullptr");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null valuesBucketReferences_");
|
||||
return out.WriteInt32(VALUE_NULL);
|
||||
}
|
||||
if (!out.WriteInt32(VALUE_OBJECT)) {
|
||||
@@ -323,7 +323,7 @@ bool DataAbilityOperation::WriteValuesBucketReferences(Parcel &out) const
|
||||
return false;
|
||||
}
|
||||
if (!valuesBucketReferences_->Marshalling(out)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ValuesBucketReferences Marshalling error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Marshalling error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -331,17 +331,17 @@ bool DataAbilityOperation::WriteValuesBucketReferences(Parcel &out) const
|
||||
|
||||
bool DataAbilityOperation::Marshalling(Parcel &out) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (!out.WriteInt32(type_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(type) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(type) error");
|
||||
return false;
|
||||
}
|
||||
if (!out.WriteInt32(expectedCount_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(expectedCount) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(expectedCount) error");
|
||||
return false;
|
||||
}
|
||||
if (!out.WriteBool(interrupted_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(interrupted) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(interrupted) error");
|
||||
return false;
|
||||
}
|
||||
if (!WriteUri(out) || !WriteValuesBucket(out) || !WritePredicates(out) || !WriteValuesBucketReferences(out)) {
|
||||
@@ -350,46 +350,46 @@ bool DataAbilityOperation::Marshalling(Parcel &out) const
|
||||
}
|
||||
int referenceSize = (int)dataAbilityPredicatesBackReferences_.size();
|
||||
if (dataAbilityPredicatesBackReferences_.empty()) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling dataAbilityPredicatesBackReferences_:null");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "dataAbilityPredicatesBackReferences_:null");
|
||||
if (!out.WriteInt32(referenceSize)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(VALUE_OBJECT) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(VALUE_OBJECT) error");
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return true;
|
||||
}
|
||||
if (!out.WriteInt32(referenceSize)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(VALUE_OBJECT) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(VALUE_OBJECT) error");
|
||||
return false;
|
||||
}
|
||||
if (referenceSize >= REFERENCE_THRESHOLD) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling referenceSize >= REFERENCE_THRESHOLD");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "referenceSize >= REFERENCE_THRESHOLD");
|
||||
return true;
|
||||
}
|
||||
for (auto it = dataAbilityPredicatesBackReferences_.begin(); it != dataAbilityPredicatesBackReferences_.end();
|
||||
it++) {
|
||||
if (!out.WriteInt32(it->first)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(VALUE_OBJECT) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(VALUE_OBJECT) error");
|
||||
return false;
|
||||
}
|
||||
if (!out.WriteInt32(it->second)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling WriteInt32(VALUE_OBJECT) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "WriteInt32(VALUE_OBJECT) error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Marshalling end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return true;
|
||||
}
|
||||
DataAbilityOperation *DataAbilityOperation::Unmarshalling(Parcel &in)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Unmarshalling start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
DataAbilityOperation *dataAbilityOperation = new (std::nothrow) DataAbilityOperation();
|
||||
if (dataAbilityOperation != nullptr && !dataAbilityOperation->ReadFromParcel(in)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Unmarshalling dataAbilityOperation error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "dataAbilityOperation error");
|
||||
delete dataAbilityOperation;
|
||||
dataAbilityOperation = nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::Unmarshalling end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return dataAbilityOperation;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ bool DataAbilityOperation::ReadUriFromParcel(Parcel &in)
|
||||
{
|
||||
int empty = VALUE_NULL;
|
||||
if (!in.ReadInt32(empty)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(empty) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(empty) error");
|
||||
return false;
|
||||
}
|
||||
if (empty == VALUE_OBJECT) {
|
||||
@@ -413,7 +413,7 @@ bool DataAbilityOperation::ReadValuesBucketFromParcel(Parcel &in)
|
||||
{
|
||||
int empty = VALUE_NULL;
|
||||
if (!in.ReadInt32(empty)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(empty) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(empty) error");
|
||||
return false;
|
||||
}
|
||||
if (empty == VALUE_OBJECT) {
|
||||
@@ -429,7 +429,7 @@ bool DataAbilityOperation::ReadDataAbilityPredicatesFromParcel(Parcel &in)
|
||||
{
|
||||
int empty = VALUE_NULL;
|
||||
if (!in.ReadInt32(empty)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(empty) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(empty) error");
|
||||
return false;
|
||||
}
|
||||
if (empty == VALUE_OBJECT) {
|
||||
@@ -445,7 +445,7 @@ bool DataAbilityOperation::ReadValuesBucketReferencesFromParcel(Parcel &in)
|
||||
{
|
||||
int empty = VALUE_NULL;
|
||||
if (!in.ReadInt32(empty)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(empty) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(empty) error");
|
||||
return false;
|
||||
}
|
||||
if (empty == VALUE_OBJECT) {
|
||||
@@ -460,29 +460,28 @@ bool DataAbilityOperation::ReadValuesBucketReferencesFromParcel(Parcel &in)
|
||||
|
||||
bool DataAbilityOperation::ReadFromParcel(Parcel &in)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (!in.ReadInt32(type_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(type) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(type) error");
|
||||
return false;
|
||||
}
|
||||
if (!in.ReadInt32(expectedCount_)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel ReadInt32(expectedCount) error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "ReadInt32(expectedCount) error");
|
||||
return false;
|
||||
}
|
||||
interrupted_ = in.ReadBool();
|
||||
if (!ReadUriFromParcel(in) || !ReadValuesBucketFromParcel(in) || !ReadDataAbilityPredicatesFromParcel(in) ||
|
||||
!ReadValuesBucketReferencesFromParcel(in)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel error");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "error");
|
||||
return false;
|
||||
}
|
||||
int referenceSize = 0;
|
||||
if (!in.ReadInt32(referenceSize)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel end");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "end");
|
||||
return false;
|
||||
}
|
||||
if (referenceSize >= REFERENCE_THRESHOLD) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperation::ReadFromParcel referenceSize:%{public}d >= REFERENCE_THRESHOLD:%{public}d",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "referenceSize:%{public}d >= REFERENCE_THRESHOLD:%{public}d",
|
||||
referenceSize, REFERENCE_THRESHOLD);
|
||||
return true;
|
||||
}
|
||||
@@ -491,36 +490,36 @@ bool DataAbilityOperation::ReadFromParcel(Parcel &in)
|
||||
int first = 0;
|
||||
int second = 0;
|
||||
if (!in.ReadInt32(first)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel end");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "end");
|
||||
return false;
|
||||
}
|
||||
if (!in.ReadInt32(second)) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel end");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "end");
|
||||
return false;
|
||||
}
|
||||
dataAbilityPredicatesBackReferences_.insert(std::make_pair(first, second));
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::ReadFromParcel end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return true;
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperation> DataAbilityOperation::CreateFromParcel(Parcel &in)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::CreateFromParcel start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
std::shared_ptr<DataAbilityOperation> operation = std::make_shared<DataAbilityOperation>(in);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::CreateFromParcel end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return operation;
|
||||
}
|
||||
void DataAbilityOperation::PutMap(Parcel &in)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::PutMap start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
int count = in.ReadInt32();
|
||||
if (count > 0 && count < REFERENCE_THRESHOLD) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
dataAbilityPredicatesBackReferences_.insert(std::make_pair(in.ReadInt32(), in.ReadInt32()));
|
||||
}
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperation::PutMap end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -38,118 +38,103 @@ DataAbilityOperationBuilder::~DataAbilityOperationBuilder()
|
||||
|
||||
std::shared_ptr<DataAbilityOperation> DataAbilityOperationBuilder::Build()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::Build start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (type_ != DataAbilityOperation::TYPE_UPDATE || (valuesBucket_ != nullptr && !valuesBucket_->IsEmpty())) {
|
||||
std::shared_ptr<DataAbilityOperation> operation = std::make_shared<DataAbilityOperation>(shared_from_this());
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::Build end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return operation;
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::Build return nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "return null");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithValuesBucket(
|
||||
std::shared_ptr<NativeRdb::ValuesBucket> &values)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithValuesBucket start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (type_ != DataAbilityOperation::TYPE_INSERT && type_ != DataAbilityOperation::TYPE_UPDATE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::WithValuesBucket only inserts, updates and assert can have values,"
|
||||
" type=%{public}d",
|
||||
type_);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "only inserts, updates and assert can have values,"
|
||||
" type:%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
valuesBucket_ = std::make_shared<NativeRdb::ValuesBucket>(*values);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithValuesBucket end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithPredicates(
|
||||
std::shared_ptr<NativeRdb::DataAbilityPredicates> &predicates)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithPredicates start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (type_ != DataAbilityOperation::TYPE_DELETE && type_ != DataAbilityOperation::TYPE_UPDATE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::withPredicates only deletes, updates and assert can have selections,"
|
||||
" type=%{public}d",
|
||||
type_);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "only deletes, updates and assert can have selections,"
|
||||
" type=%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
dataAbilityPredicates_ = predicates;
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithPredicates end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithExpectedCount(int count)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithExpectedCount start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithExpectedCount expectedCount:%{public}d", count);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "expectedCount:%{public}d", count);
|
||||
if (type_ != DataAbilityOperation::TYPE_UPDATE && type_ != DataAbilityOperation::TYPE_DELETE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::withExpectedCount only updates, deletes and assert "
|
||||
"can have expected counts, "
|
||||
"type=%{public}d",
|
||||
type_);
|
||||
"only updates, deletes and assert can have expected counts, "
|
||||
"type=%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
expectedCount_ = count;
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithExpectedCount end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithPredicatesBackReference(
|
||||
int requestArgIndex, int previousResult)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithPredicatesBackReference start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::WithPredicatesBackReference requestArgIndex:%{public}d, "
|
||||
"previousResult:%{public}d",
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "requestArgIndex:%{public}d, previousResult:%{public}d",
|
||||
requestArgIndex, previousResult);
|
||||
if (type_ != DataAbilityOperation::TYPE_UPDATE && type_ != DataAbilityOperation::TYPE_DELETE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::withPredicatesBackReference only updates, deletes, "
|
||||
"and asserts can have select back-references, type=%{public}d",
|
||||
type_);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "only updates, deletes, "
|
||||
"and asserts can have select back-references, type=%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
dataAbilityPredicatesBackReferences_.insert(std::make_pair(requestArgIndex, previousResult));
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithPredicatesBackReference end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithValueBackReferences(
|
||||
std::shared_ptr<NativeRdb::ValuesBucket> &backReferences)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithValueBackReferences start");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
if (type_ != DataAbilityOperation::TYPE_INSERT && type_ != DataAbilityOperation::TYPE_UPDATE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::withValueBackReferences only inserts, updates, and asserts can have "
|
||||
"value back-references, type=%{public}d",
|
||||
type_);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "only inserts, updates, and asserts can have "
|
||||
"value back-references, type=%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
valuesBucketReferences_ = backReferences;
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithValueBackReferences end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
std::shared_ptr<DataAbilityOperationBuilder> DataAbilityOperationBuilder::WithInterruptionAllowed(bool interrupted)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithInterruptionAllowed start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithInterruptionAllowed interrupted=%{public}d",
|
||||
interrupted);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "start");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "interrupted=%{public}d", interrupted);
|
||||
if (type_ != DataAbilityOperation::TYPE_INSERT && type_ != DataAbilityOperation::TYPE_UPDATE &&
|
||||
type_ != DataAbilityOperation::TYPE_ASSERT && type_ != DataAbilityOperation::TYPE_DELETE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY,
|
||||
"DataAbilityOperationBuilder::withInterruptionAllowed only inserts, updates, delete, "
|
||||
"and asserts can have value back-references, type=%{public}d",
|
||||
type_);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "only inserts, updates, delete, "
|
||||
"and asserts can have value back-references, type=%{public}d", type_);
|
||||
return nullptr;
|
||||
}
|
||||
interrupted_ = interrupted;
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "DataAbilityOperationBuilder::WithInterruptionAllowed end");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "end");
|
||||
return shared_from_this();
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -87,7 +87,7 @@ DataAbilityResult *DataAbilityResult::CreateFromParcel(Parcel &parcel)
|
||||
{
|
||||
DataAbilityResult *dataAbilityResult = new (std::nothrow) DataAbilityResult(parcel);
|
||||
if (dataAbilityResult == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "DataAbilityResult::CreateFromParcel dataAbilityResult is nullptr");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null dataAbilityResult");
|
||||
}
|
||||
return dataAbilityResult;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void Extension::Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &reco
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if ((record == nullptr) || (application == nullptr) || (handler == nullptr) || (token == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Extension::init failed, some object is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "init failed, some obj null");
|
||||
return;
|
||||
}
|
||||
abilityInfo_ = record->GetAbilityInfo();
|
||||
@@ -41,7 +41,7 @@ void Extension::Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &reco
|
||||
void Extension::OnStart(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
SetLaunchWant(want);
|
||||
SetLastRequestWant(want);
|
||||
}
|
||||
@@ -49,14 +49,14 @@ void Extension::OnStart(const AAFwk::Want &want)
|
||||
void Extension::OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
SetLaunchWant(want);
|
||||
SetLastRequestWant(want);
|
||||
}
|
||||
|
||||
void Extension::OnStop()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
}
|
||||
|
||||
void Extension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo, bool &isAsyncCallback)
|
||||
@@ -72,7 +72,7 @@ void Extension::OnStopCallBack()
|
||||
sptr<IRemoteObject> Extension::OnConnect(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ sptr<IRemoteObject> Extension::OnConnect(const AAFwk::Want &want,
|
||||
void Extension::OnDisconnect(const AAFwk::Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
}
|
||||
|
||||
void Extension::OnDisconnect(const AAFwk::Want &want, AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo,
|
||||
@@ -98,7 +98,7 @@ void Extension::OnDisconnect(const AAFwk::Want &want, AppExecFwk::AbilityTransac
|
||||
|
||||
void Extension::OnCommand(const AAFwk::Want &want, bool restart, int startId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "restart=%{public}s,startId=%{public}d.",
|
||||
TAG_LOGD(AAFwkTag::EXT, "restart:%{public}s,startId:%{public}d",
|
||||
restart ? "true" : "false",
|
||||
startId);
|
||||
SetLastRequestWant(want);
|
||||
@@ -113,13 +113,13 @@ void Extension::OnCommandWindow(const AAFwk::Want &want, const sptr<AAFwk::Sessi
|
||||
void Extension::OnForeground(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
}
|
||||
|
||||
void Extension::OnBackground()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s.", abilityInfo_->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "extension:%{public}s", abilityInfo_->name.c_str());
|
||||
}
|
||||
|
||||
void Extension::SetLaunchWant(const AAFwk::Want &want)
|
||||
@@ -169,18 +169,18 @@ void Extension::SetExtensionWindowLifeCycleListener(const sptr<Rosen::IWindowLif
|
||||
|
||||
void Extension::OnAbilityResult(int requestCode, int resultCode, const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
}
|
||||
|
||||
void Extension::OnCommandWindowDone(const sptr<AAFwk::SessionInfo> &sessionInfo, AAFwk::WindowCommand winCmd)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
}
|
||||
|
||||
void Extension::OnInsightIntentExecuteDone(const sptr<AAFwk::SessionInfo> &sessionInfo,
|
||||
const AppExecFwk::InsightIntentExecuteResult &result)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
}
|
||||
|
||||
void Extension::SetLaunchParam(const AAFwk::LaunchParam &launchParam)
|
||||
@@ -195,13 +195,13 @@ const AAFwk::LaunchParam &Extension::GetLaunchParam() const
|
||||
|
||||
bool Extension::HandleInsightIntent(const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Extension::OnInsightIntentExecuteDone(uint64_t intentId, const AppExecFwk::InsightIntentExecuteResult &result)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,24 +78,24 @@ std::string ExtensionAbilityThread::CreateAbilityName(
|
||||
{
|
||||
std::string abilityName;
|
||||
if (abilityRecord == nullptr || application == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityRecord or application is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null AbilityRecord or application");
|
||||
return abilityName;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo = abilityRecord->GetAbilityInfo();
|
||||
if (abilityInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityInfo is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityInfo");
|
||||
return abilityName;
|
||||
}
|
||||
|
||||
if (abilityInfo->isNativeAbility || abilityInfo->type != AppExecFwk::AbilityType::EXTENSION) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "Ability info name is %{public}s", abilityInfo->name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "Ability info name:%{public}s", abilityInfo->name.c_str());
|
||||
return abilityInfo->name;
|
||||
}
|
||||
|
||||
application->GetExtensionNameByType(static_cast<int32_t>(abilityInfo->extensionAbilityType), abilityName);
|
||||
if (!abilityName.empty()) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "Get extension name: %{public}s success.", abilityName.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "Get extension name: %{public}s success", abilityName.c_str());
|
||||
return abilityName;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ std::string ExtensionAbilityThread::CreateAbilityName(
|
||||
}
|
||||
#endif
|
||||
CreateExtensionAbilityName(abilityInfo, abilityName);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Ability name is %{public}s.", abilityName.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "Ability name: %{public}s", abilityName.c_str());
|
||||
return abilityName;
|
||||
}
|
||||
|
||||
@@ -172,13 +172,13 @@ void ExtensionAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplic
|
||||
[[maybe_unused]] const std::shared_ptr<Context> &appContext)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (application == nullptr || abilityRecord == nullptr || mainRunner == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "application or abilityRecord or mainRunner is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null application or abilityRecord or mainRunner");
|
||||
return;
|
||||
}
|
||||
HandleAttach(application, abilityRecord, mainRunner);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
|
||||
@@ -186,13 +186,13 @@ void ExtensionAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplic
|
||||
[[maybe_unused]] const std::shared_ptr<Context> &appContext)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if ((application == nullptr) || (abilityRecord == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "application or abilityRecord is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null application or abilityRecord");
|
||||
return;
|
||||
}
|
||||
HandleAttach(application, abilityRecord, nullptr);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleAttach(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
|
||||
@@ -200,33 +200,33 @@ void ExtensionAbilityThread::HandleAttach(const std::shared_ptr<AppExecFwk::OHOS
|
||||
const std::shared_ptr<AppExecFwk::EventRunner> &mainRunner)
|
||||
{
|
||||
if (application == nullptr || abilityRecord == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Application or abilityRecord is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null Application or abilityRecord");
|
||||
return;
|
||||
}
|
||||
|
||||
// 1.new AbilityHandler
|
||||
std::string abilityName = CreateAbilityName(abilityRecord, application);
|
||||
if (abilityName.empty()) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityName is empty.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "empty abilityName");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin, extension: %{public}s.", abilityName.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin, extension: %{public}s", abilityName.c_str());
|
||||
if (mainRunner == nullptr) {
|
||||
runner_ = AppExecFwk::EventRunner::Create(abilityName);
|
||||
if (runner_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "runner_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null runner_");
|
||||
return;
|
||||
}
|
||||
abilityHandler_ = std::make_shared<AppExecFwk::AbilityHandler>(runner_);
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
abilityHandler_ = std::make_shared<AppExecFwk::AbilityHandler>(mainRunner);
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ void ExtensionAbilityThread::HandleAttach(const std::shared_ptr<AppExecFwk::OHOS
|
||||
// 2.new ability
|
||||
auto extension = AppExecFwk::AbilityLoader::GetInstance().GetExtensionByName(abilityName);
|
||||
if (extension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension");
|
||||
return;
|
||||
}
|
||||
currentExtension_.reset(extension);
|
||||
@@ -250,7 +250,7 @@ void ExtensionAbilityThread::HandleAttachInner(const std::shared_ptr<AppExecFwk:
|
||||
{
|
||||
extensionImpl_ = std::make_shared<ExtensionImpl>();
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ void ExtensionAbilityThread::HandleAttachInner(const std::shared_ptr<AppExecFwk:
|
||||
// 4.ipc attach init
|
||||
ErrCode err = AbilityManagerClient::GetInstance()->AttachAbilityThread(this, token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Attach failed err is %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::EXT, "Attach err: %{public}d", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,21 +267,21 @@ void ExtensionAbilityThread::HandleExtensionTransaction(
|
||||
const Want &want, const LifeCycleStateInfo &lifeCycleStateInfo, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
extensionImpl_->HandleExtensionTransaction(want, lifeCycleStateInfo, sessionInfo);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleConnectExtension(const Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
bool isAsyncCallback = false;
|
||||
@@ -289,15 +289,15 @@ void ExtensionAbilityThread::HandleConnectExtension(const Want &want)
|
||||
if (!isAsyncCallback) {
|
||||
extensionImpl_->ConnectExtensionCallback(service);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleDisconnectExtension(const Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,98 +306,98 @@ void ExtensionAbilityThread::HandleDisconnectExtension(const Want &want)
|
||||
if (!isAsyncCallback) {
|
||||
extensionImpl_->DisconnectExtensionCallback();
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleCommandExtension(const Want &want, bool restart, int32_t startId)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
extensionImpl_->CommandExtension(want, restart, startId);
|
||||
ErrCode err = AbilityManagerClient::GetInstance()->ScheduleCommandAbilityDone(token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Failed err is %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::EXT, "err: %{public}d", err);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleInsightIntent(const Want &want)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
auto ret = extensionImpl_->HandleInsightIntent(want);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ HandleInsightIntent failed.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "HandleInsightIntent failed");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleCommandExtensionWindow(
|
||||
const Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo, AAFwk::WindowCommand winCmd)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
extensionImpl_->CommandExtensionWindow(want, sessionInfo, winCmd);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::ScheduleUpdateConfiguration(const AppExecFwk::Configuration &config)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
HandleExtensionUpdateConfiguration(config);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::HandleExtensionUpdateConfiguration(const AppExecFwk::Configuration &config)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
extensionImpl_->ScheduleUpdateConfiguration(config);
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::ScheduleAbilityTransaction(
|
||||
const Want &want, const LifeCycleStateInfo &lifeCycleStateInfo, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Name is %{public}s, targeState is %{public}d, isNewWant is %{public}d",
|
||||
TAG_LOGD(AAFwkTag::EXT, "Name: %{public}s, targeState: %{public}d, isNewWant: %{public}d",
|
||||
want.GetElement().GetAbilityName().c_str(), lifeCycleStateInfo.state, lifeCycleStateInfo.isNewWant);
|
||||
if (token_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "token_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null token_");
|
||||
return;
|
||||
}
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
wptr<ExtensionAbilityThread> weak = this;
|
||||
auto task = [weak, want, lifeCycleStateInfo, sessionInfo]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Ability thread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleExtensionTransaction(want, lifeCycleStateInfo, sessionInfo);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,21 +405,21 @@ void ExtensionAbilityThread::ScheduleConnectAbility(const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
wptr<ExtensionAbilityThread> weak = this;
|
||||
auto task = [weak, want]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleConnectExtension(want);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,21 +428,21 @@ void ExtensionAbilityThread::ScheduleDisconnectAbility(const Want &want)
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
wptr<ExtensionAbilityThread> weak = this;
|
||||
auto task = [weak, want]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleDisconnectExtension(want);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,14 +450,14 @@ void ExtensionAbilityThread::ScheduleCommandAbility(const Want &want, bool resta
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin startId: %{public}d", startId);
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
ScheduleCommandAbilityInner(want, restart, startId);
|
||||
if (AppExecFwk::InsightIntentExecuteParam::IsInsightIntentExecute(want)) {
|
||||
ScheduleInsightIntentInner(want);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::ScheduleCommandAbilityInner(const Want &want, bool restart, int32_t startId)
|
||||
@@ -466,14 +466,14 @@ void ExtensionAbilityThread::ScheduleCommandAbilityInner(const Want &want, bool
|
||||
auto task = [weak, want, restart, startId]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null AbilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleCommandExtension(want, restart, startId);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,46 +483,46 @@ void ExtensionAbilityThread::ScheduleInsightIntentInner(const Want &want)
|
||||
auto task = [weak, want]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null AbilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleInsightIntent(want);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::ScheduleCommandAbilityWindow(
|
||||
const Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo, AAFwk::WindowCommand winCmd)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin, winCmd: %{public}d.", winCmd);
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin, winCmd: %{public}d", winCmd);
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
wptr<ExtensionAbilityThread> weak = this;
|
||||
auto task = [weak, want, sessionInfo, winCmd]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
abilityThread->HandleCommandExtensionWindow(want, sessionInfo, winCmd);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::SendResult(int requestCode, int resultCode, const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (abilityHandler_ == nullptr || requestCode == -1) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "abilityHandler_ is nullptr or requestCode is -1.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityHandler_ or requestCode -1");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -530,28 +530,28 @@ void ExtensionAbilityThread::SendResult(int requestCode, int resultCode, const W
|
||||
auto task = [weak, requestCode, resultCode, want]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
|
||||
if (abilityThread->extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
abilityThread->extensionImpl_->SendResult(requestCode, resultCode, want);
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::NotifyMemoryLevel(int32_t level)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "called, result: %{public}d.", level);
|
||||
TAG_LOGD(AAFwkTag::EXT, "result: %{public}d", level);
|
||||
if (extensionImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl_");
|
||||
return;
|
||||
}
|
||||
extensionImpl_->NotifyMemoryLevel(level);
|
||||
@@ -559,38 +559,38 @@ void ExtensionAbilityThread::NotifyMemoryLevel(int32_t level)
|
||||
|
||||
void ExtensionAbilityThread::DumpAbilityInfo(const std::vector<std::string> ¶ms, std::vector<std::string> &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (token_ == nullptr || abilityHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "token_ or abilityHandler_ is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null token_ or abilityHandler_");
|
||||
return;
|
||||
}
|
||||
wptr<ExtensionAbilityThread> weak = this;
|
||||
auto task = [weak, params, token = token_]() {
|
||||
auto abilityThread = weak.promote();
|
||||
if (abilityThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "AbilityThread is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null abilityThread");
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> dumpInfo;
|
||||
abilityThread->DumpAbilityInfoInner(params, dumpInfo);
|
||||
ErrCode err = AbilityManagerClient::GetInstance()->DumpAbilityInfoDone(dumpInfo, token);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Dump ability info failed err is %{public}d.", err);
|
||||
TAG_LOGE(AAFwkTag::EXT, "Dump ability info err: %{public}d", err);
|
||||
}
|
||||
};
|
||||
bool ret = abilityHandler_->PostTask(task);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "PostTask error");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::DumpAbilityInfoInner(
|
||||
const std::vector<std::string> ¶ms, std::vector<std::string> &info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "Begin");
|
||||
if (currentExtension_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "currentExtension_ is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "null currentExtension_");
|
||||
return;
|
||||
}
|
||||
currentExtension_->Dump(params, info);
|
||||
@@ -603,7 +603,7 @@ void ExtensionAbilityThread::DumpAbilityInfoInner(
|
||||
#else
|
||||
DumpOtherInfo(info);
|
||||
#endif
|
||||
TAG_LOGD(AAFwkTag::EXT, "End.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "End");
|
||||
}
|
||||
|
||||
void ExtensionAbilityThread::DumpOtherInfo(std::vector<std::string> &info)
|
||||
@@ -611,12 +611,12 @@ void ExtensionAbilityThread::DumpOtherInfo(std::vector<std::string> &info)
|
||||
std::string dumpInfo = " event:";
|
||||
info.push_back(dumpInfo);
|
||||
if (abilityHandler_ == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "abilityHandler_ is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "null abilityHandler_");
|
||||
return;
|
||||
}
|
||||
auto runner = abilityHandler_->GetEventRunner();
|
||||
if (runner == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "runner_ is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "null runner_");
|
||||
return;
|
||||
}
|
||||
dumpInfo = "";
|
||||
|
||||
@@ -68,10 +68,10 @@ void ExtensionConfigMgr::Init()
|
||||
|
||||
void ExtensionConfigMgr::AddBlockListItem(const std::string& name, int32_t type)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "AddBlockListItem name = %{public}s, type = %{public}d", name.c_str(), type);
|
||||
TAG_LOGD(AAFwkTag::EXT, "name: %{public}s, type: %{public}d", name.c_str(), type);
|
||||
auto iter = blocklistConfig_.find(name);
|
||||
if (iter == blocklistConfig_.end()) {
|
||||
TAG_LOGD(AAFwkTag::EXT, "Extension name = %{public}s, not exist in blocklist config", name.c_str());
|
||||
TAG_LOGD(AAFwkTag::EXT, "Extension name: %{public}s not exist", name.c_str());
|
||||
return;
|
||||
}
|
||||
extensionBlocklist_.emplace(type, iter->second);
|
||||
@@ -80,10 +80,10 @@ void ExtensionConfigMgr::AddBlockListItem(const std::string& name, int32_t type)
|
||||
void ExtensionConfigMgr::UpdateRuntimeModuleChecker(const std::unique_ptr<AbilityRuntime::Runtime> &runtime)
|
||||
{
|
||||
if (!runtime) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "UpdateRuntimeModuleChecker faild, runtime is null");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null runtime");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "extensionType_ = %{public}d", extensionType_);
|
||||
TAG_LOGD(AAFwkTag::EXT, "extensionType_: %{public}d", extensionType_);
|
||||
auto moduleChecker = std::make_shared<AppModuleChecker>(extensionType_, std::move(extensionBlocklist_));
|
||||
runtime->SetModuleLoadChecker(moduleChecker);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &app
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if ((token == nullptr) || (application == nullptr) || (handler == nullptr) || (record == nullptr) ||
|
||||
extension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::init failed, some object is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "init failed, some obj null");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,17 +66,17 @@ void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &app
|
||||
void ExtensionImpl::PrintTokenInfo() const
|
||||
{
|
||||
if (token_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is null");
|
||||
TAG_LOGI(AAFwkTag::EXT, "null token");
|
||||
return;
|
||||
}
|
||||
if (!token_->IsProxyObject()) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is not proxy");
|
||||
TAG_LOGI(AAFwkTag::EXT, "token not proxy");
|
||||
return;
|
||||
}
|
||||
IPCObjectProxy *tokenProxyObject = reinterpret_cast<IPCObjectProxy *>(token_.GetRefPtr());
|
||||
if (tokenProxyObject != nullptr) {
|
||||
std::string remoteDescriptor = Str16ToStr8(tokenProxyObject->GetInterfaceDescriptor());
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility handle: %{public}d, descriptor: %{public}s",
|
||||
TAG_LOGI(AAFwkTag::EXT, "handle: %{public}d, descriptor: %{public}s",
|
||||
tokenProxyObject->GetHandle(), remoteDescriptor.c_str());
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void ExtensionImpl::HandleExtensionTransaction(const Want &want, const AAFwk::Li
|
||||
TAG_LOGI(AAFwkTag::EXT, "sourceState:%{public}d;targetState:%{public}d;isNewWant:%{public}d",
|
||||
lifecycleState_, targetState.state, targetState.isNewWant);
|
||||
if (lifecycleState_ == targetState.state) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Org lifeCycleState equals to Dst lifeCycleState.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "lifecycle state equal");
|
||||
return;
|
||||
}
|
||||
SetLaunchParam(targetState.launchParam);
|
||||
@@ -131,7 +131,7 @@ void ExtensionImpl::HandleExtensionTransaction(const Want &want, const AAFwk::Li
|
||||
}
|
||||
default: {
|
||||
ret = false;
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::HandleExtensionTransaction state is error");
|
||||
TAG_LOGE(AAFwkTag::EXT, "error state");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void ExtensionImpl::ScheduleUpdateConfiguration(const AppExecFwk::Configuration
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::ScheduleUpdateConfiguration extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ void ExtensionImpl::NotifyMemoryLevel(int level)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::NotifyMemoryLevel extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ void ExtensionImpl::Start(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::Start extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::EXT, "ExtensionImpl::Start");
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if (extension_->abilityInfo_->extensionAbilityType == AppExecFwk::ExtensionAbilityType::WINDOW ||
|
||||
extension_->abilityInfo_->extensionAbilityType == AppExecFwk::ExtensionAbilityType::UI_SERVICE) {
|
||||
extension_->OnStart(want, sessionInfo);
|
||||
@@ -208,7 +208,7 @@ void ExtensionImpl::Stop()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::Stop extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ void ExtensionImpl::Stop(bool &isAsyncCallback, const Want &want, sptr<AAFwk::Se
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::Stop extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
isAsyncCallback = false;
|
||||
return;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ void ExtensionImpl::Stop(bool &isAsyncCallback, const Want &want, sptr<AAFwk::Se
|
||||
auto asyncCallback = [ExtensionImplWeakPtr = weakPtr, state = AAFwk::ABILITY_STATE_INITIAL]() {
|
||||
auto extensionImpl = ExtensionImplWeakPtr.lock();
|
||||
if (extensionImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl");
|
||||
return;
|
||||
}
|
||||
extensionImpl->lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL;
|
||||
@@ -276,7 +276,7 @@ sptr<IRemoteObject> ExtensionImpl::ConnectExtension(const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::ConnectAbility extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ sptr<IRemoteObject> ExtensionImpl::ConnectExtension(const Want &want, bool &isAs
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::ConnectAbility extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
isAsyncCallback = false;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ sptr<IRemoteObject> ExtensionImpl::ConnectExtension(const Want &want, bool &isAs
|
||||
auto asyncCallback = [extensionImplWeakPtr = weakPtr](sptr<IRemoteObject> &service) {
|
||||
auto extensionImpl = extensionImplWeakPtr.lock();
|
||||
if (extensionImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl");
|
||||
return;
|
||||
}
|
||||
extensionImpl->lifecycleState_ = AAFwk::ABILITY_STATE_ACTIVE;
|
||||
@@ -333,7 +333,7 @@ void ExtensionImpl::ConnectExtensionCallback(sptr<IRemoteObject> &service)
|
||||
{
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->ScheduleConnectAbilityDone(token_, service);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "failed err = %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::EXT, "err: %{public}d", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ void ExtensionImpl::DisconnectExtension(const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void ExtensionImpl::DisconnectExtension(const Want &want, bool &isAsyncCallback)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Failed to disconnect, extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
isAsyncCallback = false;
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void ExtensionImpl::DisconnectExtension(const Want &want, bool &isAsyncCallback)
|
||||
auto asyncCallback = [extensionImplWeakPtr = weakPtr]() {
|
||||
auto extensionImpl = extensionImplWeakPtr.lock();
|
||||
if (extensionImpl == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extensionImpl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extensionImpl");
|
||||
return;
|
||||
}
|
||||
extensionImpl->DisconnectExtensionCallback();
|
||||
@@ -392,7 +392,7 @@ void ExtensionImpl::DisconnectExtensionCallback()
|
||||
{
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->ScheduleDisconnectAbilityDone(token_);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "failed err = %{public}d", err);
|
||||
TAG_LOGE(AAFwkTag::EXT, "err: %{public}d", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ void ExtensionImpl::CommandExtension(const Want &want, bool restart, int startId
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::CommandAbility extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
if (!AppExecFwk::InsightIntentExecuteParam::IsInsightIntentExecute(want) || !skipCommandExtensionWithIntent_) {
|
||||
@@ -427,12 +427,12 @@ bool ExtensionImpl::HandleInsightIntent(const Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "call");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::HandleInsightIntent extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return false;
|
||||
}
|
||||
auto ret = extension_->HandleInsightIntent(want);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::extension HandleInsightIntent failed");
|
||||
TAG_LOGE(AAFwkTag::EXT, "handle failed");
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "ok");
|
||||
@@ -444,7 +444,7 @@ void ExtensionImpl::CommandExtensionWindow(const Want &want, const sptr<AAFwk::S
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (extension_ == nullptr || sessionInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extension_ or sessionInfo is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_ or sessionInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -456,21 +456,21 @@ void ExtensionImpl::CommandExtensionWindow(const Want &want, const sptr<AAFwk::S
|
||||
|
||||
void ExtensionImpl::SendResult(int requestCode, int resultCode, const Want &resultData)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "extension_ is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
extension_->OnAbilityResult(requestCode, resultCode, resultData);
|
||||
TAG_LOGD(AAFwkTag::EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::EXT, "end");
|
||||
}
|
||||
|
||||
void ExtensionImpl::SetLaunchParam(const AAFwk::LaunchParam &launchParam)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -480,9 +480,9 @@ void ExtensionImpl::SetLaunchParam(const AAFwk::LaunchParam &launchParam)
|
||||
void ExtensionImpl::Foreground(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "ExtensionImpl::Foreground begin");
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::Foreground ability is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -493,9 +493,9 @@ void ExtensionImpl::Foreground(const Want &want, sptr<AAFwk::SessionInfo> sessio
|
||||
void ExtensionImpl::Background(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::EXT, "ExtensionImpl::Background begin");
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin");
|
||||
if (extension_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ExtensionImpl::Background ability is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null extension_");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ DummyExtensionModuleLoader::~DummyExtensionModuleLoader() = default;
|
||||
ExtensionModuleLoader& GetExtensionModuleLoader(const char* sharedLibrary)
|
||||
{
|
||||
if (sharedLibrary == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Name of shared extension library MUST NOT be null pointer");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null sharedLibrary");
|
||||
return DummyExtensionModuleLoader::GetInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void JsExtensionCommon::OnConfigurationUpdated(const std::shared_ptr<AppExecFwk:
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::EXT, "called");
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "invalid configuration.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "invalid config");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ void JsExtensionCommon::OnMemoryLevel(int level)
|
||||
|
||||
napi_value obj = jsObj_.GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Failed to get js instance object");
|
||||
TAG_LOGE(AAFwkTag::EXT, "get instance obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,14 +91,14 @@ napi_value JsExtensionCommon::CallObjectMethod(const char* name, napi_value cons
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
napi_value obj = jsObj_.GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Failed to get js instance object");
|
||||
TAG_LOGE(AAFwkTag::EXT, "get instance obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, name, &method);
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "Failed to get '%{public}s' from js object", name);
|
||||
TAG_LOGE(AAFwkTag::EXT, "get '%{public}s' failed", name);
|
||||
return nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "(%{public}s), success", name);
|
||||
|
||||
@@ -53,17 +53,17 @@ namespace {
|
||||
sptr<IRemoteObject> GetNativeRemoteObject(napi_env env, napi_value obj)
|
||||
{
|
||||
if (env == nullptr || obj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "obj is null.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null obj");
|
||||
return nullptr;
|
||||
}
|
||||
napi_valuetype type;
|
||||
napi_typeof(env, obj, &type);
|
||||
if (type == napi_undefined || type == napi_null) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "obj is invalid type.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "obj type invalid");
|
||||
return nullptr;
|
||||
}
|
||||
if (type != napi_object) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "obj is not an object.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "obj not object");
|
||||
return nullptr;
|
||||
}
|
||||
return NAPI_ohos_rpc_getNativeRemoteObject(env, obj);
|
||||
@@ -105,19 +105,19 @@ using namespace OHOS::AppExecFwk;
|
||||
napi_value AttachServiceExtensionContext(napi_env env, void *value, void *)
|
||||
{
|
||||
if (value == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "invalid parameter.");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "invalid param");
|
||||
return nullptr;
|
||||
}
|
||||
auto ptr = reinterpret_cast<std::weak_ptr<ServiceExtensionContext> *>(value)->lock();
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "invalid context.");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "invalid context");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value object = CreateJsServiceExtensionContext(env, ptr);
|
||||
auto sysModule = JsRuntime::LoadSystemModuleByEngine(env,
|
||||
"application.ServiceExtensionContext", &object, 1);
|
||||
if (sysModule == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "load module failed.");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "load module failed");
|
||||
return nullptr;
|
||||
}
|
||||
auto contextObj = sysModule->GetNapiValue();
|
||||
@@ -141,7 +141,7 @@ JsServiceExtension* JsServiceExtension::Create(const std::unique_ptr<Runtime>& r
|
||||
JsServiceExtension::JsServiceExtension(JsRuntime& jsRuntime) : jsRuntime_(jsRuntime) {}
|
||||
JsServiceExtension::~JsServiceExtension()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "Js service extension destructor.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
auto context = GetContext();
|
||||
if (context) {
|
||||
context->Unbind();
|
||||
@@ -159,13 +159,13 @@ void JsServiceExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
std::string srcPath = "";
|
||||
GetSrcPath(srcPath);
|
||||
if (srcPath.empty()) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get srcPath");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get srcPath failed");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string moduleName(Extension::abilityInfo_->moduleName);
|
||||
moduleName.append("::").append(abilityInfo_->name);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "JsServiceExtension::Init moduleName:%{public}s,srcPath:%{public}s.",
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called, moduleName:%{public}s,srcPath:%{public}s",
|
||||
moduleName.c_str(), srcPath.c_str());
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
@@ -173,14 +173,14 @@ void JsServiceExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
jsObj_ = jsRuntime_.LoadModule(
|
||||
moduleName, srcPath, abilityInfo_->hapPath, abilityInfo_->compileMode == CompileMode::ES_MODULE);
|
||||
if (jsObj_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get jsObj_");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null jsObj_");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "ConvertNativeValueTo.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "ConvertNativeValueTo");
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get JsServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get JsServiceExtension obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,32 +207,32 @@ void JsServiceExtension::ListenWMS()
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "RegisterDisplayListener");
|
||||
auto abilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (abilityManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get SaMgr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get SaMgr failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto jsServiceExtension = std::static_pointer_cast<JsServiceExtension>(shared_from_this());
|
||||
displayListener_ = sptr<JsServiceExtensionDisplayListener>::MakeSptr(jsServiceExtension);
|
||||
if (displayListener_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to create display listener.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "create displayListener failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto context = GetContext();
|
||||
if (context == nullptr || context->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
auto listener = sptr<SystemAbilityStatusChangeListener>::MakeSptr(displayListener_, context->GetToken());
|
||||
if (listener == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to create status change listener.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "create status change listener failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = abilityManager->SubscribeSystemAbility(WINDOW_MANAGER_SERVICE_ID, listener);
|
||||
if (ret != 0) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "subscribe system ability failed, ret = %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "subscribe system ability error:%{public}d.", ret);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -251,7 +251,7 @@ void JsServiceExtension::BindContext(napi_env env, napi_value obj)
|
||||
{
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get context");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get context failed");
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "call");
|
||||
@@ -259,18 +259,18 @@ void JsServiceExtension::BindContext(napi_env env, napi_value obj)
|
||||
shellContextRef_ = JsRuntime::LoadSystemModuleByEngine(env, "application.ServiceExtensionContext",
|
||||
&contextObj, ARGC_ONE);
|
||||
if (shellContextRef_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to load module");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "load module failed");
|
||||
return;
|
||||
}
|
||||
contextObj = shellContextRef_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, contextObj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get context native object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get context native obj failed");
|
||||
return;
|
||||
}
|
||||
auto workContext = new (std::nothrow) std::weak_ptr<ServiceExtensionContext>(context);
|
||||
napi_coerce_to_native_binding_object(
|
||||
env, contextObj, DetachCallbackFunc, AttachServiceExtensionContext, workContext, nullptr);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "Bind.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "Bind");
|
||||
context->Bind(jsRuntime_, shellContextRef_.get());
|
||||
napi_set_named_property(env, obj, "context", contextObj);
|
||||
|
||||
@@ -280,7 +280,7 @@ void JsServiceExtension::BindContext(napi_env env, napi_value obj)
|
||||
},
|
||||
nullptr, nullptr);
|
||||
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "end.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "end");
|
||||
}
|
||||
|
||||
void JsServiceExtension::OnStart(const AAFwk::Want &want)
|
||||
@@ -321,12 +321,12 @@ void JsServiceExtension::OnStop()
|
||||
bool ret = ConnectionManager::GetInstance().DisconnectCaller(GetContext()->GetToken());
|
||||
if (ret) {
|
||||
ConnectionManager::GetInstance().ReportConnectionLeakEvent(getpid(), gettid());
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "The service extension connection is not disconnected.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "service extension connection not disconnected");
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "UnregisterDisplayInfoChangedListener");
|
||||
auto context = GetContext();
|
||||
if (context == nullptr || context->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid");
|
||||
return;
|
||||
}
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
@@ -343,7 +343,7 @@ sptr<IRemoteObject> JsServiceExtension::OnConnect(const AAFwk::Want &want)
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
auto remoteObj = GetNativeRemoteObject(env, result);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "remoteObj null.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "remoteObj null");
|
||||
}
|
||||
return remoteObj;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ sptr<IRemoteObject> JsServiceExtension::OnConnect(const AAFwk::Want &want,
|
||||
isAsyncCallback = false;
|
||||
sptr<IRemoteObject> remoteObj = GetNativeRemoteObject(env, result);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "remoteObj null.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "remoteObj null");
|
||||
}
|
||||
return remoteObj;
|
||||
}
|
||||
@@ -367,19 +367,19 @@ sptr<IRemoteObject> JsServiceExtension::OnConnect(const AAFwk::Want &want,
|
||||
bool callResult = false;
|
||||
do {
|
||||
if (!CheckTypeForNapiValue(env, result, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, error to convert native value to NativeObject.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, error to convert native value to NativeObject");
|
||||
break;
|
||||
}
|
||||
napi_value then = nullptr;
|
||||
napi_get_named_property(env, result, "then", &then);
|
||||
if (then == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, error to get property: then.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, error to get property then");
|
||||
break;
|
||||
}
|
||||
bool isCallable = false;
|
||||
napi_is_callable(env, then, &isCallable);
|
||||
if (!isCallable) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, property then is not callable");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, property then not callable");
|
||||
break;
|
||||
}
|
||||
napi_value promiseCallback = nullptr;
|
||||
@@ -391,7 +391,7 @@ sptr<IRemoteObject> JsServiceExtension::OnConnect(const AAFwk::Want &want,
|
||||
} while (false);
|
||||
|
||||
if (!callResult) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "error to call promise.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "error to call promise");
|
||||
isAsyncCallback = false;
|
||||
} else {
|
||||
isAsyncCallback = true;
|
||||
@@ -424,7 +424,7 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want,
|
||||
}
|
||||
bool callResult = CallPromise(result, callbackInfo);
|
||||
if (!callResult) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "error to call promise.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "error to call promise");
|
||||
isAsyncCallback = false;
|
||||
} else {
|
||||
isAsyncCallback = true;
|
||||
@@ -436,7 +436,7 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want,
|
||||
void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId)
|
||||
{
|
||||
Extension::OnCommand(want, restart, startId);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "restart=%{public}s,startId=%{public}d.",
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "restart=%{public}s,startId=%{public}d",
|
||||
restart ? "true" : "false",
|
||||
startId);
|
||||
// wrap want
|
||||
@@ -457,13 +457,13 @@ bool JsServiceExtension::HandleInsightIntent(const AAFwk::Want &want)
|
||||
auto callback = std::make_unique<InsightIntentExecutorAsyncCallback>();
|
||||
callback.reset(InsightIntentExecutorAsyncCallback::Create());
|
||||
if (callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Create async callback failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Create async callback failed");
|
||||
return false;
|
||||
}
|
||||
auto executeParam = std::make_shared<AppExecFwk::InsightIntentExecuteParam>();
|
||||
bool ret = AppExecFwk::InsightIntentExecuteParam::GenerateFromWant(want, *executeParam);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Generate execute param failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Generate execute param failed");
|
||||
InsightIntentExecutorMgr::TriggerCallbackInner(std::move(callback),
|
||||
static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
|
||||
return false;
|
||||
@@ -477,19 +477,19 @@ bool JsServiceExtension::HandleInsightIntent(const AAFwk::Want &want)
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "intentId %{public}" PRIu64"", intentId);
|
||||
auto extension = weak.lock();
|
||||
if (extension == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "extension is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null extension");
|
||||
return;
|
||||
}
|
||||
auto ret = extension->OnInsightIntentExecuteDone(intentId, result);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnInsightIntentExecuteDone failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnInsightIntentExecuteDone failed");
|
||||
}
|
||||
};
|
||||
callback->Push(asyncCallback);
|
||||
InsightIntentExecutorInfo executorInfo;
|
||||
ret = GetInsightIntentExecutorInfo(want, executeParam, executorInfo);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Get Intent executor failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Get Intent executor failed");
|
||||
InsightIntentExecutorMgr::TriggerCallbackInner(std::move(callback),
|
||||
static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INVALID_PARAM));
|
||||
return false;
|
||||
@@ -497,7 +497,7 @@ bool JsServiceExtension::HandleInsightIntent(const AAFwk::Want &want)
|
||||
ret = DelayedSingleton<InsightIntentExecutorMgr>::GetInstance()->ExecuteInsightIntent(
|
||||
jsRuntime_, executorInfo, std::move(callback));
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Execute insight intent failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Execute insight intent failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -510,7 +510,7 @@ bool JsServiceExtension::GetInsightIntentExecutorInfo(const Want &want,
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
auto context = GetContext();
|
||||
if (executeParam == nullptr || context == nullptr || abilityInfo_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Param invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -529,12 +529,12 @@ bool JsServiceExtension::OnInsightIntentExecuteDone(uint64_t intentId,
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Notify execute done, intentId %{public}" PRIu64"", intentId);
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "context is null.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
return false;
|
||||
}
|
||||
auto token = context->GetToken();
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "token is null.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null token");
|
||||
return false;
|
||||
}
|
||||
auto ret = AAFwk::AbilityManagerClient::GetInstance()->ExecuteInsightIntentDone(token, intentId, result);
|
||||
@@ -559,14 +559,14 @@ napi_value JsServiceExtension::CallObjectMethod(const char* name, napi_value con
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, name, &method);
|
||||
if (!CheckTypeForNapiValue(env, method, napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get '%{public}s' from ServiceExtension object", name);
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get '%{public}s' from ServiceExtension obj failed", name);
|
||||
return nullptr;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CallFunction(%{public}s) ok", name);
|
||||
@@ -577,7 +577,7 @@ napi_value JsServiceExtension::CallObjectMethod(const char* name, napi_value con
|
||||
|
||||
void JsServiceExtension::GetSrcPath(std::string &srcPath)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "GetSrcPath start.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (!Extension::abilityInfo_->isModuleJson) {
|
||||
/* temporary compatibility api8 + config.json */
|
||||
srcPath.append(Extension::abilityInfo_->package);
|
||||
@@ -612,20 +612,20 @@ napi_value JsServiceExtension::CallOnConnect(const AAFwk::Want &want)
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, "onConnect", &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onConnect from ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get onConnect from ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
napi_value remoteNative = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &remoteNative);
|
||||
if (remoteNative == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "remoteNative nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null remoteNative");
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "ok");
|
||||
return remoteNative;
|
||||
@@ -644,14 +644,14 @@ napi_value JsServiceExtension::CallOnDisconnect(const AAFwk::Want &want, bool wi
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, "onDisconnect", &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onDisconnect from ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get onDisconnect from ServiceExtension obj failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -668,14 +668,14 @@ napi_value JsServiceExtension::CallOnDisconnect(const AAFwk::Want &want, bool wi
|
||||
bool JsServiceExtension::CheckPromise(napi_value result)
|
||||
{
|
||||
if (result == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CheckPromise, result is nullptr, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "null result, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
bool isPromise = false;
|
||||
napi_is_promise(env, result, &isPromise);
|
||||
if (!isPromise) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CheckPromise, result is not promise, no need to call promise.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "result not promise, no need to call promise");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -685,19 +685,19 @@ bool JsServiceExtension::CallPromise(napi_value result, AppExecFwk::AbilityTrans
|
||||
{
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
if (!CheckTypeForNapiValue(env, result, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, Error to convert native value to NativeObject.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Error to convert native value to NativeObject");
|
||||
return false;
|
||||
}
|
||||
napi_value then = nullptr;
|
||||
napi_get_named_property(env, result, "then", &then);
|
||||
if (then == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, Error to get property: then.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Error to get property: then");
|
||||
return false;
|
||||
}
|
||||
bool isCallable = false;
|
||||
napi_is_callable(env, then, &isCallable);
|
||||
if (!isCallable) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "CallPromise, Property then is not callable.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Property then is not callable");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
@@ -716,7 +716,7 @@ void JsServiceExtension::OnConfigurationUpdated(const AppExecFwk::Configuration&
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "call");
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Context is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid Context");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ void JsServiceExtension::ConfigurationUpdated()
|
||||
// Notify extension context
|
||||
auto fullConfig = GetContext()->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "configuration is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -768,7 +768,7 @@ void JsServiceExtension::Dump(const std::vector<std::string> ¶ms, std::vecto
|
||||
|
||||
napi_value obj = jsObj_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get ServiceExtension obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ void JsServiceExtension::Dump(const std::vector<std::string> ¶ms, std::vecto
|
||||
method = nullptr;
|
||||
napi_get_named_property(env, obj, "dump", &method);
|
||||
if (!CheckTypeForNapiValue(env, method, napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onConnect from ServiceExtension object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get onConnect from ServiceExtension obj failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -786,7 +786,7 @@ void JsServiceExtension::Dump(const std::vector<std::string> ¶ms, std::vecto
|
||||
napi_value dumpInfo = nullptr;
|
||||
napi_call_function(env, obj, method, ARGC_ONE, argv, &dumpInfo);
|
||||
if (dumpInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "dumpInfo nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null dumpInfo");
|
||||
return;
|
||||
}
|
||||
uint32_t len = 0;
|
||||
@@ -796,7 +796,7 @@ void JsServiceExtension::Dump(const std::vector<std::string> ¶ms, std::vecto
|
||||
napi_value element = nullptr;
|
||||
napi_get_element(env, dumpInfo, i, &element);
|
||||
if (!ConvertFromJsValue(env, element, dumpInfoStr)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Parse dumpInfoStr failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Parse dumpInfoStr failed");
|
||||
return;
|
||||
}
|
||||
info.push_back(dumpInfoStr);
|
||||
@@ -807,12 +807,12 @@ void JsServiceExtension::Dump(const std::vector<std::string> ¶ms, std::vecto
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
void JsServiceExtension::OnCreate(Rosen::DisplayId displayId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "enter.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "enter");
|
||||
}
|
||||
|
||||
void JsServiceExtension::OnDestroy(Rosen::DisplayId displayId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "exit.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "exit");
|
||||
}
|
||||
|
||||
void JsServiceExtension::OnDisplayInfoChange(const sptr<IRemoteObject>& token, Rosen::DisplayId displayId,
|
||||
@@ -821,13 +821,13 @@ void JsServiceExtension::OnDisplayInfoChange(const sptr<IRemoteObject>& token, R
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "displayId: %{public}" PRIu64, displayId);
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Context is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
return;
|
||||
}
|
||||
|
||||
auto contextConfig = context->GetConfiguration();
|
||||
if (contextConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Configuration is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid Configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ void JsServiceExtension::OnDisplayInfoChange(const sptr<IRemoteObject>& token, R
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "finished.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "finished");
|
||||
}
|
||||
|
||||
void JsServiceExtension::OnChange(Rosen::DisplayId displayId)
|
||||
@@ -857,13 +857,13 @@ void JsServiceExtension::OnChange(Rosen::DisplayId displayId)
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "displayId: %{public}" PRIu64"", displayId);
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Context is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
return;
|
||||
}
|
||||
|
||||
auto contextConfig = context->GetConfiguration();
|
||||
if (contextConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Configuration is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid Configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ void JsServiceExtension::OnChange(Rosen::DisplayId displayId)
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "finished.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "finished");
|
||||
}
|
||||
#endif
|
||||
} // AbilityRuntime
|
||||
|
||||
@@ -75,13 +75,13 @@ void RemoveConnection(int64_t connectId)
|
||||
return connectId == obj.first.id;
|
||||
});
|
||||
if (item != g_connects.end()) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "remove conn ability exist.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "remove conn ability exist");
|
||||
if (item->second) {
|
||||
item->second->RemoveConnectionObject();
|
||||
}
|
||||
g_connects.erase(item);
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "remove conn ability not exist.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "remove conn ability not exist");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
|
||||
static void Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "JsAbilityContext::Finalizer is called");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
std::unique_ptr<JsServiceExtensionContext>(static_cast<JsServiceExtensionContext*>(data));
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ private:
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
auto context = serviceContext.lock();
|
||||
if (context == nullptr || callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "clear failed call of startup input param is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context or callback");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -205,14 +205,14 @@ private:
|
||||
freeInstallObserver_ = new JsFreeInstallObserver(env);
|
||||
auto context = context_.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
return;
|
||||
}
|
||||
ret = context->AddFreeInstallObserver(freeInstallObserver_);
|
||||
}
|
||||
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "AddFreeInstallObserver failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "AddFreeInstallObserver failed");
|
||||
} else {
|
||||
// build a callback observer with last param
|
||||
std::string bundleName = want.GetElement().GetBundleName();
|
||||
@@ -286,7 +286,7 @@ private:
|
||||
AAFwk::OpenLinkOptions &openLinkOptions, AAFwk::Want &want)
|
||||
{
|
||||
if (info.argc != ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "wrong arguments num");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "wrong argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return false;
|
||||
}
|
||||
@@ -297,13 +297,13 @@ private:
|
||||
return false;
|
||||
}
|
||||
if (!ConvertFromJsValue(env, info.argv[ARGC_ZERO], linkValue) || !CheckUrl(linkValue)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "link parameter invalid");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "param link invalid");
|
||||
ThrowInvalidParamError(env, "link parameter invalid.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OpenLinkOptions is used.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OpenLinkOptions used");
|
||||
if (!AppExecFwk::UnwrapOpenLinkOptions(env, info.argv[INDEX_ONE], openLinkOptions, want)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OpenLinkOptions parse failed");
|
||||
ThrowInvalidParamError(env, "Parse param options failed, must be a OpenLinkOptions.");
|
||||
@@ -325,7 +325,7 @@ private:
|
||||
want.SetParam(AppExecFwk::APP_LINKING_ONLY, false);
|
||||
|
||||
if (!ParseOpenLinkParams(env, info, linkValue, openLinkOptions, want)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse openLink arguments failed");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse OpenLinkParams failed");
|
||||
ThrowInvalidParamError(env,
|
||||
"Parse param link or openLinkOptions failed, link must be string, openLinkOptions must be options.");
|
||||
return CreateJsUndefined(env);
|
||||
@@ -337,7 +337,7 @@ private:
|
||||
NapiAsyncTask::ExecuteCallback execute = [weak = context_, want, innerErrorCode]() {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
*innerErrorCode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
@@ -346,10 +346,10 @@ private:
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete = [innerErrorCode](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
if (*innerErrorCode == 0) {
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OpenLink success.");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OpenLink success");
|
||||
task.ResolveWithNoError(env, CreateJsUndefined(env));
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OpenLink failed.");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OpenLink failed");
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, *innerErrorCode));
|
||||
}
|
||||
};
|
||||
@@ -388,7 +388,7 @@ private:
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "startAbility begin");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -425,7 +425,7 @@ private:
|
||||
}
|
||||
++unwrapArgc;
|
||||
if (info.argc > ARGC_ONE && CheckTypeForNapiValue(env, info.argv[1], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbility start options is used.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbility start options used");
|
||||
AppExecFwk::UnwrapStartOptions(env, info.argv[1], startOptions);
|
||||
unwrapArgc++;
|
||||
}
|
||||
@@ -454,20 +454,20 @@ private:
|
||||
|
||||
auto context = context_.lock();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall context is nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
auto ret = context->StartAbilityByCall(want, calls->callerCallBack, accountId);
|
||||
if (ret) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall is failed");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall failed");
|
||||
ThrowErrorByNativeErr(env, ret);
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
|
||||
if (calls->remoteCallee == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall async wait execute");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "async wait execute");
|
||||
NapiAsyncTask::ScheduleHighQos("JsAbilityContext::OnStartAbilityByCall", env,
|
||||
CreateAsyncTaskWithLastParam(
|
||||
env, nullptr, GetCallExecute(calls), GetCallComplete(calls), &retsult));
|
||||
@@ -489,18 +489,18 @@ private:
|
||||
if (info.argc > static_cast<size_t>(INDEX_ONE)) {
|
||||
if (CheckTypeForNapiValue(env, info.argv[INDEX_ONE], napi_number)) {
|
||||
if (!ConvertFromJsValue(env, info.argv[1], accountId)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "check input param accountId failed");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "check param accountId failed");
|
||||
ThrowInvalidParamError(env, "Parse param accountId failed, must be a number.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "input parameter type invalid");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "param type invalid");
|
||||
ThrowInvalidParamError(env, "Parse param accountId failed, must be a number.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "CheckStartAbilityByCallInputParam, callee:%{public}s.%{public}s.",
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "callee:%{public}s.%{public}s.",
|
||||
want.GetBundle().c_str(),
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
return true;
|
||||
@@ -511,7 +511,7 @@ private:
|
||||
auto callComplete = [weak = context_, calldata = calls] (
|
||||
napi_env env, NapiAsyncTask& task, int32_t) {
|
||||
if (calldata->err != 0) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callComplete err is %{public}d", calldata->err);
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "callComplete err: %{public}d", calldata->err);
|
||||
ClearFailedCallConnection(weak, calldata->callerCallBack);
|
||||
task.Reject(env, CreateJsError(env, calldata->err, "callComplete err."));
|
||||
return;
|
||||
@@ -523,7 +523,7 @@ private:
|
||||
const std::shared_ptr<CallerCallBack> &callback) -> ErrCode {
|
||||
auto contextForRelease = weak.lock();
|
||||
if (contextForRelease == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "releaseCallFunction, context is nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null contextForRelease");
|
||||
return -1;
|
||||
}
|
||||
return contextForRelease->ReleaseCall(callback);
|
||||
@@ -532,13 +532,13 @@ private:
|
||||
CreateJsCallerComplex(
|
||||
env, releaseCallFunc, calldata->remoteCallee, calldata->callerCallBack));
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callComplete params error %{public}s is nullptr",
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null %{public}s",
|
||||
context == nullptr ? "context" :
|
||||
(calldata->remoteCallee == nullptr ? "remoteCallee" : "callerCallBack"));
|
||||
task.Reject(env, CreateJsError(env, -1, "Create Call Failed."));
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callComplete end");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "end");
|
||||
};
|
||||
return callComplete;
|
||||
}
|
||||
@@ -549,15 +549,15 @@ private:
|
||||
constexpr int callerTimeOut = 10; // 10s
|
||||
std::unique_lock<std::mutex> lock(calldata->mutexlock);
|
||||
if (calldata->remoteCallee != nullptr) {
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callExecute callee isn`t null");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "callee isn`t null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (calldata->condition.wait_for(lock, std::chrono::seconds(callerTimeOut)) == std::cv_status::timeout) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callExecute waiting callee timeout");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "waiting callee timeout");
|
||||
calldata->err = -1;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callExecute exit");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "exit");
|
||||
};
|
||||
return callExecute;
|
||||
}
|
||||
@@ -565,12 +565,12 @@ private:
|
||||
CallerCallBack::CallBackClosure GetCallBackDone(std::shared_ptr<StartAbilityByCallParameters> calls)
|
||||
{
|
||||
auto callBackDone = [calldata = calls] (const sptr<IRemoteObject> &obj) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callBackDone mutexlock");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "mutexlock");
|
||||
std::unique_lock<std::mutex> lock(calldata->mutexlock);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callBackDone remoteCallee assignment");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "remoteCallee assignment");
|
||||
calldata->remoteCallee = obj;
|
||||
calldata->condition.notify_all();
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall callBackDone is called end");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "end");
|
||||
};
|
||||
return callBackDone;
|
||||
}
|
||||
@@ -578,7 +578,7 @@ private:
|
||||
CallerCallBack::OnReleaseClosure GetReleaseListen()
|
||||
{
|
||||
auto releaseListen = [](const std::string &str) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityByCall releaseListen is called %{public}s", str.c_str());
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called, %{public}s", str.c_str());
|
||||
};
|
||||
return releaseListen;
|
||||
}
|
||||
@@ -601,7 +601,7 @@ private:
|
||||
|
||||
AAFwk::StartOptions startOptions;
|
||||
if (info.argc > ARGC_TWO && CheckTypeForNapiValue(env, info.argv[INDEX_TWO], napi_object)) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnStartAbilityWithAccount start options is used.");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "start options used");
|
||||
AppExecFwk::UnwrapStartOptions(env, info.argv[INDEX_TWO], startOptions);
|
||||
unwrapArgc++;
|
||||
}
|
||||
@@ -659,7 +659,7 @@ private:
|
||||
[weak = context_](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
@@ -705,12 +705,12 @@ private:
|
||||
NapiAsyncTask::CompleteCallback complete = [connection, connectId, innerErrorCode](napi_env env,
|
||||
NapiAsyncTask& task, int32_t status) {
|
||||
if (*innerErrorCode == 0) {
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Connect ability success.");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Connect ability success");
|
||||
task.ResolveWithNoError(env, CreateJsUndefined(env));
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Connect ability failed.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Connect ability failed");
|
||||
int32_t errcode = static_cast<int32_t>(AbilityRuntime::GetJsErrorCodeByNativeError(*innerErrorCode));
|
||||
if (errcode) {
|
||||
connection->CallJsFailed(errcode);
|
||||
@@ -750,12 +750,12 @@ private:
|
||||
napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, ERROR_CODE_ONE, "Context is released"));
|
||||
RemoveConnection(connectId);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "ConnectAbilityWithAccount connection:%{public}d",
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "connection:%{public}d",
|
||||
static_cast<int32_t>(connectId));
|
||||
auto innerErrorCode = context->ConnectAbilityWithAccount(want, accountId, connection);
|
||||
int32_t errcode = static_cast<int32_t>(AbilityRuntime::GetJsErrorCodeByNativeError(innerErrorCode));
|
||||
@@ -775,7 +775,7 @@ private:
|
||||
sptr<JSServiceExtensionConnection>& connection, AAFwk::Want& want, int32_t accountId = -1) const
|
||||
{
|
||||
if (!CheckTypeForNapiValue(env, value, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get connection object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get connection obj failed");
|
||||
return false;
|
||||
}
|
||||
connection->SetJsConnectionObject(value);
|
||||
@@ -799,7 +799,7 @@ private:
|
||||
|
||||
napi_value OnDisconnectAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "DisconnectAbility start");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -821,12 +821,12 @@ private:
|
||||
napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, ERROR_CODE_ONE, "Context is released"));
|
||||
return;
|
||||
}
|
||||
if (connection == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "connection null");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "null connection");
|
||||
task.Reject(env, CreateJsError(env, ERROR_CODE_TWO, "not found connection"));
|
||||
return;
|
||||
}
|
||||
@@ -849,7 +849,7 @@ private:
|
||||
void FindConnection(AAFwk::Want& want, sptr<JSServiceExtensionConnection>& connection, int64_t& connectId,
|
||||
int32_t &accountId) const
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Disconnect ability begin, connection:%{public}d.",
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "Disconnect ability begin, connection:%{public}d",
|
||||
static_cast<int32_t>(connectId));
|
||||
std::lock_guard guard(g_connectsMutex);
|
||||
auto item = std::find_if(g_connects.begin(),
|
||||
@@ -869,7 +869,7 @@ private:
|
||||
|
||||
napi_value OnStartExtensionAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "StartExtensionAbility");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -885,7 +885,7 @@ private:
|
||||
[weak = context_, want](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -906,7 +906,7 @@ private:
|
||||
|
||||
napi_value OnStartUIServiceExtension(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "OnStartUIServiceExtension is enter");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc <ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -915,7 +915,7 @@ private:
|
||||
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnwrapWant(env, info.argv[INDEX_ZERO], want)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to parse want!");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse want failed");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, want must be Want.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -924,7 +924,7 @@ private:
|
||||
[weak = context_, want](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -945,7 +945,7 @@ private:
|
||||
|
||||
napi_value OnStartExtensionAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "StartExtensionAbilityWithAccount");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc < ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -962,7 +962,7 @@ private:
|
||||
[weak = context_, want, accountId](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -983,7 +983,7 @@ private:
|
||||
|
||||
napi_value OnStopExtensionAbility(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "StopExtensionAbility");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc < ARGC_ONE) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -999,7 +999,7 @@ private:
|
||||
[weak = context_, want](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -1020,7 +1020,7 @@ private:
|
||||
|
||||
napi_value OnStopExtensionAbilityWithAccount(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "StopExtensionAbilityWithAccount");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (info.argc < ARGC_TWO) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
@@ -1037,7 +1037,7 @@ private:
|
||||
[weak = context_, want, accountId](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -1067,7 +1067,7 @@ private:
|
||||
|
||||
AAFwk::Want want;
|
||||
if (!AppExecFwk::UnwrapWant(env, info.argv[0], want)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to parse want!");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse want failed");
|
||||
ThrowInvalidParamError(env, "Parse param want failed, must be a Want.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ private:
|
||||
NapiAsyncTask::ExecuteCallback execute = [serviceContext = context_, want, innerErrCode]() {
|
||||
auto context = serviceContext.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is released");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context released");
|
||||
*innerErrCode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INNER);
|
||||
return;
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ private:
|
||||
std::string& moduleName, std::string& abilityName, std::string& startTime)
|
||||
{
|
||||
if (info.argc < ARGC_FOUR) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "wrong arguments num");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "invalid argc");
|
||||
ThrowTooFewParametersError(env);
|
||||
return false;
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ private:
|
||||
return false;
|
||||
}
|
||||
if (!ConvertFromJsValue(env, info.argv[i], args[i])) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parameter invalid");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "param invalid");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ private:
|
||||
std::string abilityName;
|
||||
std::string startTime;
|
||||
if (!ParsePreStartMissionArgs(env, info, bundleName, moduleName, abilityName, startTime)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse preStartMission arguments failed");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "parse preStartMission failed");
|
||||
ThrowInvalidParamError(env, "Parse params failed, params must be strings.");
|
||||
return CreateJsUndefined(env);
|
||||
}
|
||||
@@ -1150,7 +1150,7 @@ private:
|
||||
napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT));
|
||||
return;
|
||||
}
|
||||
@@ -1180,7 +1180,7 @@ private:
|
||||
}
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGW(AAFwkTag::SERVICE_EXT, "context released");
|
||||
*retCode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
@@ -1201,12 +1201,12 @@ private:
|
||||
{
|
||||
return [retCode](napi_env env, NapiAsyncTask& task, int32_t) {
|
||||
if (!retCode) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "StartAbility is fail");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "StartAbility failed");
|
||||
task.Reject(env, CreateJsError(env, AbilityErrorCode::ERROR_CODE_INNER));
|
||||
return;
|
||||
}
|
||||
if (*retCode == 0) {
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "StartAbility is success");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "StartAbility success");
|
||||
task.Resolve(env, CreateJsUndefined(env));
|
||||
} else {
|
||||
task.Reject(env, CreateJsErrorByNativeErr(env, *retCode));
|
||||
@@ -1223,7 +1223,7 @@ private:
|
||||
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "context is released");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "context released");
|
||||
*innerErrorCode = static_cast<int>(AbilityErrorCode::ERROR_CODE_INVALID_CONTEXT);
|
||||
return;
|
||||
}
|
||||
@@ -1236,7 +1236,7 @@ private:
|
||||
|
||||
napi_value CreateJsServiceExtensionContext(napi_env env, std::shared_ptr<ServiceExtensionContext> context)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CreateJsServiceExtensionContext");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
|
||||
if (context) {
|
||||
abilityInfo = context->GetAbilityInfo();
|
||||
@@ -1341,13 +1341,13 @@ int64_t JSServiceExtensionConnection::GetConnectionId()
|
||||
void JSServiceExtensionConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
|
||||
const sptr<IRemoteObject> &remoteObject, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnAbilityConnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called, resultCode:%{public}d", resultCode);
|
||||
wptr<JSServiceExtensionConnection> connection = this;
|
||||
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
|
||||
([connection, element, remoteObject, resultCode](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
sptr<JSServiceExtensionConnection> connectionSptr = connection.promote();
|
||||
if (!connectionSptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "connectionSptr nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null connectionSptr");
|
||||
return;
|
||||
}
|
||||
connectionSptr->HandleOnAbilityConnectDone(element, remoteObject, resultCode);
|
||||
@@ -1370,7 +1370,7 @@ void JSServiceExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::
|
||||
napi_value napiRemoteObject = NAPI_ohos_rpc_CreateJsRemoteObject(env_, remoteObject);
|
||||
napi_value argv[] = {napiElementName, napiRemoteObject};
|
||||
if (jsConnectionObject_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "jsConnectionObject_ nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null jsConnectionObject_");
|
||||
return;
|
||||
}
|
||||
napi_value obj = jsConnectionObject_->GetNapiValue();
|
||||
@@ -1381,7 +1381,7 @@ void JSServiceExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::
|
||||
napi_value methodOnConnect = nullptr;
|
||||
napi_get_named_property(env_, obj, "onConnect", &methodOnConnect);
|
||||
if (methodOnConnect == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onConnect from object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null methodOnConnect");
|
||||
return;
|
||||
}
|
||||
napi_call_function(env_, obj, methodOnConnect, ARGC_TWO, argv, nullptr);
|
||||
@@ -1389,13 +1389,13 @@ void JSServiceExtensionConnection::HandleOnAbilityConnectDone(const AppExecFwk::
|
||||
|
||||
void JSServiceExtensionConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "OnAbilityDisconnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called, resultCode:%{public}d", resultCode);
|
||||
wptr<JSServiceExtensionConnection> connection = this;
|
||||
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>
|
||||
([connection, element, resultCode](napi_env env, NapiAsyncTask &task, int32_t status) {
|
||||
sptr<JSServiceExtensionConnection> connectionSptr = connection.promote();
|
||||
if (!connectionSptr) {
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "connectionSptr nullptr");
|
||||
TAG_LOGI(AAFwkTag::SERVICE_EXT, "null connectionSptr");
|
||||
return;
|
||||
}
|
||||
connectionSptr->HandleOnAbilityDisconnectDone(element, resultCode);
|
||||
@@ -1409,11 +1409,11 @@ void JSServiceExtensionConnection::OnAbilityDisconnectDone(const AppExecFwk::Ele
|
||||
void JSServiceExtensionConnection::HandleOnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
|
||||
int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "HandleOnAbilityDisconnectDone, resultCode:%{public}d", resultCode);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called, resultCode:%{public}d", resultCode);
|
||||
napi_value napiElementName = OHOS::AppExecFwk::WrapElementName(env_, element);
|
||||
napi_value argv[] = {napiElementName};
|
||||
if (jsConnectionObject_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "jsConnectionObject_ nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null jsConnectionObject_");
|
||||
return;
|
||||
}
|
||||
napi_value obj = jsConnectionObject_->GetNapiValue();
|
||||
@@ -1425,7 +1425,7 @@ void JSServiceExtensionConnection::HandleOnAbilityDisconnectDone(const AppExecFw
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, "onDisconnect", &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onDisconnect from object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null method");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1467,26 +1467,26 @@ void JSServiceExtensionConnection::RemoveConnectionObject()
|
||||
|
||||
void JSServiceExtensionConnection::CallJsFailed(int32_t errorCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CallJsFailed begin");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "called");
|
||||
if (jsConnectionObject_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "jsConnectionObject_ nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null jsConnectionObject_");
|
||||
return;
|
||||
}
|
||||
napi_value obj = jsConnectionObject_->GetNapiValue();
|
||||
if (!CheckTypeForNapiValue(env_, obj, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Wrong to get object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get obj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env_, obj, "onFailed", &method);
|
||||
if (method == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Failed to get onFailed from object");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "get onFailed failed");
|
||||
return;
|
||||
}
|
||||
napi_value argv[] = {CreateJsValue(env_, errorCode)};
|
||||
napi_call_function(env_, obj, method, ARGC_ONE, argv, nullptr);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "CallJsFailed end");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "end");
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -58,7 +58,7 @@ void ServiceExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
ExtensionBase<ServiceExtensionContext>::Init(record, application, handler, token);
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "ServiceExtension begin init context");
|
||||
TAG_LOGD(AAFwkTag::SERVICE_EXT, "begin init context");
|
||||
}
|
||||
|
||||
std::shared_ptr<ServiceExtensionContext> ServiceExtension::CreateAndInitContext(
|
||||
@@ -70,7 +70,7 @@ std::shared_ptr<ServiceExtensionContext> ServiceExtension::CreateAndInitContext(
|
||||
std::shared_ptr<ServiceExtensionContext> context =
|
||||
ExtensionBase<ServiceExtensionContext>::CreateAndInitContext(record, application, handler, token);
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "ServiceExtension::CreateAndInitContext context is nullptr");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
return context;
|
||||
}
|
||||
return context;
|
||||
@@ -82,7 +82,7 @@ void ServiceExtension::OnConfigurationUpdated(const AppExecFwk::Configuration &c
|
||||
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "Context is invalid.");
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "null context");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1415,17 +1415,17 @@ int32_t ContextImpl::SetSupportedProcessCacheSelf(bool isSupport)
|
||||
void ContextImpl::PrintTokenInfo() const
|
||||
{
|
||||
if (token_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is null");
|
||||
TAG_LOGI(AAFwkTag::EXT, "null token");
|
||||
return;
|
||||
}
|
||||
if (!token_->IsProxyObject()) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is not proxy");
|
||||
TAG_LOGI(AAFwkTag::EXT, "token not proxy");
|
||||
return;
|
||||
}
|
||||
IPCObjectProxy *tokenProxyObject = reinterpret_cast<IPCObjectProxy *>(token_.GetRefPtr());
|
||||
if (tokenProxyObject != nullptr) {
|
||||
std::string remoteDescriptor = Str16ToStr8(tokenProxyObject->GetInterfaceDescriptor());
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility handle: %{public}d, descriptor: %{public}s",
|
||||
TAG_LOGI(AAFwkTag::EXT, "handle: %{public}d, descriptor: %{public}s",
|
||||
tokenProxyObject->GetHandle(), remoteDescriptor.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3431,21 +3431,21 @@ void MainThread::ParseAppConfigurationParams(const std::string configuration, Co
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "start");
|
||||
appConfig.AddItem(AAFwk::GlobalConfigurationKey::APP_FONT_SIZE_SCALE, DEFAULT_APP_FONT_SIZE_SCALE);
|
||||
if (configuration.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "the configuration is empty");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "emptye config");
|
||||
return;
|
||||
}
|
||||
nlohmann::json configurationJson = nlohmann::json::parse(configuration, nullptr, false);
|
||||
if (configurationJson.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "json discarded error");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "discarded error");
|
||||
return;
|
||||
}
|
||||
if (!configurationJson.contains(JSON_KEY_APP_CONFIGURATION)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "app configuration is not exist");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "app config not exist");
|
||||
return;
|
||||
}
|
||||
nlohmann::json jsonObject = configurationJson.at(JSON_KEY_APP_CONFIGURATION).get<nlohmann::json>();
|
||||
if (jsonObject.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "app configuration is null");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null app config");
|
||||
return;
|
||||
}
|
||||
if (jsonObject.contains(JSON_KEY_APP_FONT_SIZE_SCALE)
|
||||
@@ -3479,7 +3479,7 @@ void MainThread::HandleCacheProcess()
|
||||
if (application_ != nullptr) {
|
||||
auto &runtime = application_->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "runtime nullptr");
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null runtime");
|
||||
return;
|
||||
}
|
||||
runtime->ForceFullGC();
|
||||
|
||||
@@ -29,12 +29,12 @@ NativeChildCallback::NativeChildCallback(OH_Ability_OnNativeChildProcessStarted
|
||||
void NativeChildCallback::OnNativeChildStarted(const sptr<IRemoteObject> &nativeChild)
|
||||
{
|
||||
if (callback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Native child process started, but callback is null?");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null callback_");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nativeChild) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Native child process ipc object is null");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null nativeChild");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ void NativeChildCallback::OnNativeChildStarted(const sptr<IRemoteObject> &native
|
||||
void NativeChildCallback::OnError(int32_t errCode)
|
||||
{
|
||||
if (callback_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Native child process start failed, but callback is null?");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "null callback_");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Native child process start failed, err %{public}d", errCode);
|
||||
TAG_LOGI(AAFwkTag::PROCESSMGR, "Native child process start err %{public}d", errCode);
|
||||
callback_(errCode, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,19 +75,19 @@ int OH_Ability_CreateNativeChildProcess(const char* libName, OH_Ability_OnNative
|
||||
|
||||
std::string strLibName(libName);
|
||||
if (strLibName.find("../") != std::string::npos) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Do not allow use relative path");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "relative path not allow");
|
||||
return NCP_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
std::unique_lock autoLock(g_mutexCallBackObj);
|
||||
if (g_Callback != nullptr || g_CallbackStub != nullptr) {
|
||||
TAG_LOGW(AAFwkTag::PROCESSMGR, "Another native process process starting, try again later");
|
||||
TAG_LOGW(AAFwkTag::PROCESSMGR, "Another native process starting");
|
||||
return NCP_ERR_BUSY;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> callbackStub(new (std::nothrow) NativeChildCallback(OnNativeChildProcessStartedWapper));
|
||||
if (!callbackStub) {
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Alloc callback ipc stub object faild.");
|
||||
TAG_LOGE(AAFwkTag::PROCESSMGR, "Alloc callbackStub obj faild");
|
||||
return NCP_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -28,7 +28,7 @@ AbilityFirstFrameStateObserverProxy::AbilityFirstFrameStateObserverProxy(const s
|
||||
bool AbilityFirstFrameStateObserverProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(AbilityFirstFrameStateObserverProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -39,16 +39,16 @@ void AbilityFirstFrameStateObserverProxy::OnAbilityFirstFrameState(
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write Token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write Token failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(&abilityFirstFrameStateData)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Fail to write abilityFirstFrameStateData.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write abilityFirstFrameStateData failed");
|
||||
return;
|
||||
}
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote is NULL.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
@@ -57,7 +57,7 @@ void AbilityFirstFrameStateObserverProxy::OnAbilityFirstFrameState(
|
||||
static_cast<uint32_t>(IAbilityFirstFrameStateObserver::Message::ON_ABILITY_FIRST_FRAME_STATE),
|
||||
data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest is failed, error code: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", ret);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ int32_t AbilityFirstFrameStateObserverStub::OnRemoteRequest(
|
||||
std::u16string descriptor = AbilityFirstFrameStateObserverStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Local descriptor is not equal to remote.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ int32_t AbilityFirstFrameStateObserverStub::HandleOnAbilityFirstFrameStateChange
|
||||
{
|
||||
std::unique_ptr<AbilityFirstFrameStateData> stateData(data.ReadParcelable<AbilityFirstFrameStateData>());
|
||||
if (stateData == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "stateData is null.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null stateData");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
OnAbilityFirstFrameState(*stateData);
|
||||
@@ -64,7 +64,7 @@ AbilityFirstFrameStateObserverRecipient::AbilityFirstFrameStateObserverRecipient
|
||||
|
||||
void AbilityFirstFrameStateObserverRecipient::OnRemoteDied(const wptr<IRemoteObject> &__attribute__((unused)) remote)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote died.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote died");
|
||||
if (handler_) {
|
||||
handler_(remote);
|
||||
}
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ AbilityForegroundStateObserverProxy::AbilityForegroundStateObserverProxy(const s
|
||||
bool AbilityForegroundStateObserverProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(AbilityForegroundStateObserverProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -37,16 +37,16 @@ void AbilityForegroundStateObserverProxy::OnAbilityStateChanged(const AbilitySta
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write Token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write Token failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(&abilityStateData)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Fail to write abilityStateData.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write abilityStateData failed");
|
||||
return;
|
||||
}
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote is NULL.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
@@ -54,7 +54,7 @@ void AbilityForegroundStateObserverProxy::OnAbilityStateChanged(const AbilitySta
|
||||
int32_t ret = remote->SendRequest(
|
||||
static_cast<uint32_t>(IAbilityForegroundStateObserver::Message::ON_ABILITY_STATE_CHANGED), data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest is failed, error code: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d.", ret);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -33,7 +33,7 @@ int32_t AbilityForegroundStateObserverStub::OnRemoteRequest(
|
||||
std::u16string descriptor = AbilityForegroundStateObserverStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Local descriptor is not equal to remote.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ int32_t AbilityForegroundStateObserverStub::HandleOnAbilityStateChanged(MessageP
|
||||
{
|
||||
std::unique_ptr<AbilityStateData> abilityStateData(data.ReadParcelable<AbilityStateData>());
|
||||
if (abilityStateData == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "abilityStateData is null.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null abilityStateData");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ AbilityForegroundStateObserverRecipient::AbilityForegroundStateObserverRecipient
|
||||
|
||||
void AbilityForegroundStateObserverRecipient::OnRemoteDied(const wptr<IRemoteObject> &__attribute__((unused)) remote)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote died.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote died");
|
||||
if (handler_) {
|
||||
handler_(remote);
|
||||
}
|
||||
|
||||
+8
-8
@@ -32,16 +32,16 @@ int32_t StatusBarDelegateProxy::CheckIfStatusBarItemExists(uint32_t accessTokenI
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(IStatusBarDelegate::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write token failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
if (!data.WriteUint32(accessTokenId)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "accessTokenId write failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "accessTokenId write failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
auto ret = SendRequest(StatusBarDelegateCmd::CHECK_IF_STATUS_BAR_ITEM_EXISTS, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = reply.ReadInt32();
|
||||
@@ -56,20 +56,20 @@ int32_t StatusBarDelegateProxy::AttachPidToStatusBarItem(uint32_t accessTokenId,
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(IStatusBarDelegate::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write token failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
if (!data.WriteUint32(accessTokenId)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write accessTokenId failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write accessTokenId failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
if (!data.WriteInt32(pid)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write pid failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write pid failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
auto ret = SendRequest(StatusBarDelegateCmd::ATTACH_PID_TO_STATUS_BAR_ITEM, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -80,7 +80,7 @@ int32_t StatusBarDelegateProxy::SendRequest(
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
return remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ int32_t StatusBarDelegateStub::OnRemoteRequest(
|
||||
std::u16string descriptor = StatusBarDelegateStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "local descriptor is not equal to remote.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ int32_t StatusBarDelegateStub::HandleCheckIfStatusBarItemExists(MessageParcel &d
|
||||
bool isExist = false;
|
||||
auto result = CheckIfStatusBarItemExists(accessTokenId, isExist);
|
||||
if (!reply.WriteBool(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
if (!reply.WriteBool(isExist)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write isExist failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write isExist failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
return NO_ERROR;
|
||||
@@ -68,7 +68,7 @@ int32_t StatusBarDelegateStub::HandleAttachPidToStatusBarItem(MessageParcel &dat
|
||||
int32_t pid = data.ReadInt32();
|
||||
auto result = AttachPidToStatusBarItem(accessTokenId, pid);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed");
|
||||
return AAFwk::ERR_NATIVE_IPC_PARCEL_FAILED;
|
||||
}
|
||||
return NO_ERROR;
|
||||
|
||||
@@ -31,26 +31,26 @@ void WindowManagerServiceHandlerProxy::NotifyWindowTransition(sptr<AbilityTransi
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(fromInfo.GetRefPtr())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write fromInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write fromInfo failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(toInfo.GetRefPtr())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write toInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write toInfo failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteBool(animaEnabled)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write animaEnabled failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write animaEnabled failed");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
int error = SendTransactCmd(WMSCmd::ON_NOTIFY_WINDOW_TRANSITION, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
}
|
||||
animaEnabled = reply.ReadBool();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ int32_t WindowManagerServiceHandlerProxy::GetFocusWindow(sptr<IRemoteObject>& ab
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ int32_t WindowManagerServiceHandlerProxy::GetFocusWindow(sptr<IRemoteObject>& ab
|
||||
MessageOption option;
|
||||
int error = SendTransactCmd(WMSCmd::ON_GET_FOCUS_ABILITY, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
auto ret = reply.ReadInt32();
|
||||
@@ -85,26 +85,26 @@ void WindowManagerServiceHandlerProxy::StartingWindow(sptr<AbilityTransitionInfo
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write interface token.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write token");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(info.GetRefPtr())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write info failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write info failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(pixelMap.get())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write pixelMap failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write pixelMap failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteUint32(bgColor)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write bgColor.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write bgColor");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
int error = SendTransactCmd(WMSCmd::ON_COLD_STARTING_WINDOW, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,22 +114,22 @@ void WindowManagerServiceHandlerProxy::StartingWindow(sptr<AbilityTransitionInfo
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(info.GetRefPtr())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write info failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write info failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(pixelMap.get())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write pixelMap.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write pixelMap");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
int error = SendTransactCmd(WMSCmd::ON_HOT_STARTING_WINDOW, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,21 +138,21 @@ void WindowManagerServiceHandlerProxy::CancelStartingWindow(sptr<IRemoteObject>
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return;
|
||||
}
|
||||
if (!abilityToken) {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write false.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write false");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(true)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write true failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write true failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteRemoteObject(abilityToken)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write abilityToken failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write abilityToken failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ void WindowManagerServiceHandlerProxy::CancelStartingWindow(sptr<IRemoteObject>
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
int error = SendTransactCmd(WMSCmd::ON_CANCEL_STARTING_WINDOW, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,18 +169,18 @@ void WindowManagerServiceHandlerProxy::NotifyAnimationAbilityDied(sptr<AbilityTr
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IWindowManagerServiceHandler::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write token failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(info.GetRefPtr())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write info.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to write info");
|
||||
return;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
int error = SendTransactCmd(WMSCmd::ON_NOTIFY_ANIMATION_ABILITY_DIED, data, reply, option);
|
||||
if (error != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest error: %{public}d", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ int32_t WindowManagerServiceHandlerProxy::MoveMissionsToForeground(const std::ve
|
||||
|
||||
int error = SendTransactCmd(WMSCmd::ON_MOVE_MISSINONS_TO_FOREGROUND, data, reply, option);
|
||||
if (error != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendoRequest failed, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendoRequest error: %{public}d", error);
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -235,7 +235,7 @@ int32_t WindowManagerServiceHandlerProxy::MoveMissionsToBackground(const std::ve
|
||||
|
||||
int error = SendTransactCmd(WMSCmd::ON_MOVE_MISSIONS_TO_BACKGROUND, data, reply, option);
|
||||
if (error != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendoRequest failed, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendoRequest error: %{public}d", error);
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
if (!reply.ReadInt32Vector(&result)) {
|
||||
@@ -250,13 +250,13 @@ int32_t WindowManagerServiceHandlerProxy::SendTransactCmd(uint32_t code, Message
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "remote object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
int32_t ret = remote->SendRequest(code, data, reply, option);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest failed. code is %{public}d, ret is %{public}d.", code, ret);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest failed. code: %{public}d, ret: %{public}d", code, ret);
|
||||
return ret;
|
||||
}
|
||||
return ERR_OK;
|
||||
|
||||
@@ -34,7 +34,7 @@ int WindowManagerServiceHandlerStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
if (data.ReadInterfaceToken() != IWindowManagerServiceHandler::GetDescriptor()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "InterfaceToken not equal IWindowManagerServiceHandler's descriptor.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid descriptor");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ int WindowManagerServiceHandlerStub::OnRemoteRequest(
|
||||
return MoveMissionsToBackgroundInner(data, reply);
|
||||
}
|
||||
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "default case, it needs to be checked.");
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "default case to be checked");
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ int WindowManagerServiceHandlerStub::NotifyWindowTransitionInner(MessageParcel &
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
sptr<AbilityTransitionInfo> fromInfo(data.ReadParcelable<AbilityTransitionInfo>());
|
||||
if (!fromInfo) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read fromInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read fromInfo failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
sptr<AbilityTransitionInfo> toInfo(data.ReadParcelable<AbilityTransitionInfo>());
|
||||
if (!toInfo) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read toInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read toInfo failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
bool animaEnabled = data.ReadBool();
|
||||
@@ -86,21 +86,21 @@ int WindowManagerServiceHandlerStub::GetFocusWindowInner(MessageParcel &data, Me
|
||||
sptr<IRemoteObject> abilityToken = nullptr;
|
||||
int32_t ret = GetFocusWindow(abilityToken);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To write result failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
if (abilityToken) {
|
||||
if (!reply.WriteBool(true)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To write true failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write true failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
if (!reply.WriteRemoteObject(abilityToken)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To write abilityToken failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write abilityToken failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
} else {
|
||||
if (!reply.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To write false failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write false failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -112,13 +112,13 @@ int WindowManagerServiceHandlerStub::StartingWindowCold(MessageParcel &data, Mes
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
sptr<AbilityTransitionInfo> info(data.ReadParcelable<AbilityTransitionInfo>());
|
||||
if (!info) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read info failed!");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read info failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
std::shared_ptr<Media::PixelMap> pixelMap
|
||||
= std::shared_ptr<Media::PixelMap>(data.ReadParcelable<Media::PixelMap>());
|
||||
if (pixelMap == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read pixelMap failed!");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read pixelMap failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
auto bgColor = data.ReadUint32();
|
||||
@@ -131,13 +131,13 @@ int WindowManagerServiceHandlerStub::StartingWindowHot(MessageParcel &data, Mess
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
sptr<AbilityTransitionInfo> info(data.ReadParcelable<AbilityTransitionInfo>());
|
||||
if (!info) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read info failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read info failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
std::shared_ptr<Media::PixelMap> pixelMap
|
||||
= std::shared_ptr<Media::PixelMap>(data.ReadParcelable<Media::PixelMap>());
|
||||
if (pixelMap == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to read pixelMap.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to read pixelMap");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
StartingWindow(info, pixelMap);
|
||||
@@ -149,7 +149,7 @@ int WindowManagerServiceHandlerStub::CancelStartingWindowInner(MessageParcel &da
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
sptr<IRemoteObject> abilityToken = nullptr;
|
||||
if (data.ReadBool()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "abilityToken is valid.");
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "valid abilityToken");
|
||||
abilityToken = data.ReadRemoteObject();
|
||||
}
|
||||
CancelStartingWindow(abilityToken);
|
||||
@@ -161,7 +161,7 @@ int WindowManagerServiceHandlerStub::NotifyAnimationAbilityDiedInner(MessageParc
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
sptr<AbilityTransitionInfo> info(data.ReadParcelable<AbilityTransitionInfo>());
|
||||
if (!info) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "To read info failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "read info failed");
|
||||
return ERR_AAFWK_PARCEL_FAIL;
|
||||
}
|
||||
NotifyAnimationAbilityDied(info);
|
||||
|
||||
@@ -28,7 +28,7 @@ void AutoFillEventHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &e
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (event == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Event is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null Event");
|
||||
return;
|
||||
}
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
|
||||
@@ -50,7 +50,7 @@ AutoFillExtensionCallback::AutoFillExtensionCallback()
|
||||
|
||||
void AutoFillExtensionCallback::OnResult(int32_t errCode, const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, result code is %{public}d.", errCode);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, result code: %{public}d", errCode);
|
||||
AutoFillManager::GetInstance().RemoveEvent(callbackId_);
|
||||
CloseUIExtension();
|
||||
if (autoFillWindowType_ == AutoFill::AutoFillWindowType::POPUP_WINDOW) {
|
||||
@@ -71,7 +71,7 @@ void AutoFillExtensionCallback::OnResult(int32_t errCode, const AAFwk::Want &wan
|
||||
|
||||
void AutoFillExtensionCallback::OnRelease(int32_t errCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, result code is %{public}d.", errCode);
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, result code: %{public}d", errCode);
|
||||
AutoFillManager::GetInstance().RemoveEvent(callbackId_);
|
||||
CloseUIExtension();
|
||||
if (errCode != 0) {
|
||||
@@ -81,7 +81,7 @@ void AutoFillExtensionCallback::OnRelease(int32_t errCode)
|
||||
|
||||
void AutoFillExtensionCallback::OnError(int32_t errCode, const std::string &name, const std::string &message)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, errcode is %{public}d, name is %{public}s, message is %{public}s",
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, errcode: %{public}d, name: %{public}s, message: %{public}s",
|
||||
errCode, name.c_str(), message.c_str());
|
||||
AutoFillManager::GetInstance().RemoveEvent(callbackId_);
|
||||
CloseUIExtension();
|
||||
@@ -104,7 +104,7 @@ void AutoFillExtensionCallback::HandleReloadInModal(const AAFwk::WantParams &wan
|
||||
|
||||
auto uiContent = GetUIContent();
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UI content is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void AutoFillExtensionCallback::HandleReloadInModal(const AAFwk::WantParams &wan
|
||||
isReloadInModal_ = true;
|
||||
uiContent->DestroyCustomPopupUIExtension(oldSessionId);
|
||||
} else {
|
||||
TAG_LOGW(AAFwkTag::AUTOFILLMGR, "Window type is not popup, the window can not be destroyed.");
|
||||
TAG_LOGW(AAFwkTag::AUTOFILLMGR, "Window type not popup, can not be destroyed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ int32_t AutoFillExtensionCallback::ReloadInModal(const AAFwk::WantParams &wantPa
|
||||
std::lock_guard<std::mutex> lock(closeMutex_);
|
||||
auto uiContent = GetUIContent();
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Content is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent");
|
||||
return AutoFill::AUTO_FILL_OBJECT_IS_NULL;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ int32_t AutoFillExtensionCallback::ReloadInModal(const AAFwk::WantParams &wantPa
|
||||
int32_t sessionId = 0;
|
||||
sessionId = uiContent->CreateModalUIExtension(want, callback, config);
|
||||
if (sessionId == 0) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Create ui extension is failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Create ui extension failed");
|
||||
AutoFillManager::GetInstance().RemoveEvent(callbackId_);
|
||||
return AutoFill::AUTO_FILL_CREATE_MODULE_UI_EXTENSION_FAILED;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void AutoFillExtensionCallback::UpdateCustomPopupConfig(const AAFwk::WantParams
|
||||
AutoFillManagerUtil::ConvertToPopupUIExtensionConfig(autoFillCustomConfig, popupConfig);
|
||||
auto uiContent = GetUIContent();
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UIContent is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent");
|
||||
return;
|
||||
}
|
||||
uiContent->UpdateCustomPopupUIExtension(popupConfig);
|
||||
@@ -201,7 +201,7 @@ void AutoFillExtensionCallback::onRemoteReady(const std::shared_ptr<Ace::ModalUI
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (modalUIExtensionProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Proxy is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null proxy");
|
||||
return;
|
||||
}
|
||||
SetModalUIExtensionProxy(modalUIExtensionProxy);
|
||||
@@ -318,7 +318,7 @@ void AutoFillExtensionCallback::UpdateCustomPopupUIExtension(const AbilityBase::
|
||||
{
|
||||
auto modalUIExtensionProxy = GetModalUIExtensionProxy();
|
||||
if (modalUIExtensionProxy == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UIExtensionProxy is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null UIExtensionProxy");
|
||||
return;
|
||||
}
|
||||
AAFwk::WantParams wantParams;
|
||||
@@ -372,7 +372,7 @@ void AutoFillExtensionCallback::CloseUIExtension()
|
||||
std::lock_guard<std::mutex> lock(closeMutex_);
|
||||
uiContent = GetUIContent();
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "uiContent is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "null uiContent");
|
||||
return;
|
||||
}
|
||||
SetInstanceId(-1);
|
||||
|
||||
@@ -61,12 +61,12 @@ int32_t AutoFillManager::RequestAutoFill(Ace::UIContent *uiContent, const AutoFi
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (uiContent == nullptr || fillCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UIContent or fillCallback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent or fillCallback");
|
||||
return AutoFill::AUTO_FILL_OBJECT_IS_NULL;
|
||||
}
|
||||
|
||||
if (request.autoFillType == AbilityBase::AutoFillType::UNSPECIFIED) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Auto fill type is invalid.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "autoFillType invalid");
|
||||
return AutoFill::AUTO_FILL_TYPE_INVALID;
|
||||
}
|
||||
return HandleRequestExecuteInner(uiContent, request, fillCallback, nullptr, result);
|
||||
@@ -77,7 +77,7 @@ int32_t AutoFillManager::RequestAutoSave(Ace::UIContent *uiContent, const AutoFi
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (uiContent == nullptr || saveCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UIContent or save callback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null UIContent or saveCallback");
|
||||
return AutoFill::AUTO_FILL_OBJECT_IS_NULL;
|
||||
}
|
||||
return HandleRequestExecuteInner(uiContent, request, nullptr, saveCallback, result);
|
||||
@@ -89,11 +89,11 @@ int32_t AutoFillManager::HandleRequestExecuteInner(Ace::UIContent *uiContent, co
|
||||
AutoFill::AutoFillResult &result)
|
||||
{
|
||||
if (uiContent == nullptr || (fillCallback == nullptr && saveCallback == nullptr)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "UIContent or fillCallback&saveCallback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent or fillCallback&saveCallback");
|
||||
return AutoFill::AUTO_FILL_OBJECT_IS_NULL;
|
||||
}
|
||||
if (!IsPreviousRequestFinished(uiContent)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Previous request is not finished.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Previous request not finished");
|
||||
return AutoFill::AUTO_FILL_PREVIOUS_REQUEST_NOT_FINISHED;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ int32_t AutoFillManager::HandleRequestExecuteInner(Ace::UIContent *uiContent, co
|
||||
bool isSmartAutoFill = false;
|
||||
AutoFill::AutoFillWindowType autoFillWindowType = AutoFill::AutoFillWindowType::MODAL_WINDOW;
|
||||
if (!ConvertAutoFillWindowType(request, isSmartAutoFill, autoFillWindowType)) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Convert auto fill type failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Convert auto fill type failed");
|
||||
return AutoFill::AUTO_FILL_CREATE_MODULE_UI_EXTENSION_FAILED;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ int32_t AutoFillManager::HandleRequestExecuteInner(Ace::UIContent *uiContent, co
|
||||
result.isPopup = autoFillWindowType == AutoFill::AutoFillWindowType::POPUP_WINDOW ? true : false;
|
||||
auto sessionId = CreateAutoFillExtension(uiContent, request, callback, autoFillWindowType, isSmartAutoFill);
|
||||
if (sessionId == AUTO_FILL_UI_EXTENSION_SESSION_ID_INVALID) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Create ui extension is failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Create ui extension failed");
|
||||
RemoveEvent(callbackId);
|
||||
return AutoFill::AUTO_FILL_CREATE_MODULE_UI_EXTENSION_FAILED;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ int32_t AutoFillManager::HandleRequestExecuteInner(Ace::UIContent *uiContent, co
|
||||
extensionCallback->SetWindowType(autoFillWindowType);
|
||||
extensionCallback->SetExtensionType(isSmartAutoFill);
|
||||
extensionCallback->SetAutoFillRequest(request);
|
||||
TAG_LOGI(AAFwkTag::AUTOFILLMGR, "callbackId: %{public}u.", callbackId);
|
||||
TAG_LOGI(AAFwkTag::AUTOFILLMGR, "callbackId: %{public}u", callbackId);
|
||||
std::lock_guard<std::mutex> lock(extensionCallbacksMutex_);
|
||||
extensionCallbacks_.emplace(callbackId, extensionCallback);
|
||||
return AutoFill::AUTO_FILL_SUCCESS;
|
||||
@@ -139,7 +139,7 @@ void AutoFillManager::UpdateCustomPopupUIExtension(uint32_t autoFillSessionId, c
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
auto extensionCallback = GetAutoFillExtensionCallback(autoFillSessionId);
|
||||
if (extensionCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Extension callback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null extensionCallback");
|
||||
return;
|
||||
}
|
||||
extensionCallback->UpdateCustomPopupUIExtension(viewData);
|
||||
@@ -150,7 +150,7 @@ void AutoFillManager::CloseUIExtension(uint32_t autoFillSessionId)
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
auto extensionCallback = GetAutoFillExtensionCallback(autoFillSessionId);
|
||||
if (extensionCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Extension callback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null extensionCallback");
|
||||
return;
|
||||
}
|
||||
extensionCallback->CloseUIExtension();
|
||||
@@ -191,7 +191,7 @@ int32_t AutoFillManager::CreateAutoFillExtension(Ace::UIContent *uiContent,
|
||||
{
|
||||
int32_t sessionId = AUTO_FILL_UI_EXTENSION_SESSION_ID_INVALID;
|
||||
if (uiContent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Content is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null uiContent");
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ void AutoFillManager::SetTimeOutEvent(uint32_t eventId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (eventHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Eventhandler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null eventHandler");
|
||||
return;
|
||||
}
|
||||
eventHandler_->SendEvent(eventId, AUTO_FILL_REQUEST_TIME_OUT_VALUE);
|
||||
@@ -280,7 +280,7 @@ void AutoFillManager::RemoveEvent(uint32_t eventId)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::AUTOFILLMGR, "called");
|
||||
if (eventHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Eventhandler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null eventHandler");
|
||||
return;
|
||||
}
|
||||
eventHandler_->RemoveEvent(eventId);
|
||||
@@ -291,7 +291,7 @@ void AutoFillManager::HandleTimeOut(uint32_t eventId)
|
||||
TAG_LOGI(AAFwkTag::AUTOFILLMGR, "called");
|
||||
auto extensionCallback = GetAutoFillExtensionCallback(eventId);
|
||||
if (extensionCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Extension callback is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "null extensionCallback");
|
||||
return;
|
||||
}
|
||||
extensionCallback->HandleTimeOut();
|
||||
@@ -317,7 +317,7 @@ std::shared_ptr<AutoFillExtensionCallback> AutoFillManager::GetAutoFillExtension
|
||||
std::lock_guard<std::mutex> lock(extensionCallbacksMutex_);
|
||||
auto iter = extensionCallbacks_.find(callbackId);
|
||||
if (iter == extensionCallbacks_.end()) {
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "callback is not find. callbackId: %{public}u", callbackId);
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "not find, callbackId: %{public}u", callbackId);
|
||||
return nullptr;
|
||||
}
|
||||
return iter->second;
|
||||
|
||||
@@ -133,7 +133,7 @@ Ace::PopupPlacement AutoFillManagerUtil::ConvertPopupPlacement(const AutoFill::P
|
||||
popupPlacement = Ace::PopupPlacement::RIGHT_BOTTOM;
|
||||
break;
|
||||
default:
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Popup placement is invalid.");
|
||||
TAG_LOGE(AAFwkTag::AUTOFILLMGR, "Popup placement invalid");
|
||||
break;
|
||||
}
|
||||
return popupPlacement;
|
||||
|
||||
@@ -95,17 +95,17 @@ bool ConnectionData::ReadFromParcel(Parcel &parcel)
|
||||
extensionType = static_cast<ExtensionAbilityType>(type);
|
||||
|
||||
if (!parcel.ReadInt32(callerUid)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "ConnectionData::ReadFromParcel read callerUid failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read callerUid failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.ReadInt32(callerPid)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "ConnectionData::ReadFromParcel read callerPid failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read callerPid failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.ReadString16(strValue)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "ConnectionData::ReadFromParcel read strValue failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read strValue failed");
|
||||
return false;
|
||||
}
|
||||
callerName = Str16ToStr8(strValue);
|
||||
|
||||
@@ -35,7 +35,7 @@ ConnectionObserverClient& ConnectionObserverClient::GetInstance()
|
||||
int32_t ConnectionObserverClient::RegisterObserver(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (!clientImpl_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClient::RegisterObserver impl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null clientImpl_");
|
||||
return ERR_NO_CLIENT_IMPL;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ int32_t ConnectionObserverClient::RegisterObserver(const std::shared_ptr<Connect
|
||||
int32_t ConnectionObserverClient::UnregisterObserver(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (!clientImpl_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClient::UnregisterObserver impl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null clientImpl_");
|
||||
return ERR_NO_CLIENT_IMPL;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int32_t ConnectionObserverClient::GetDlpConnectionInfos(std::vector<DlpConnectio
|
||||
{
|
||||
#ifdef WITH_DLP
|
||||
if (!clientImpl_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClient::GetDlpConnectionInfos impl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null clientImpl_");
|
||||
return ERR_NO_CLIENT_IMPL;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ int32_t ConnectionObserverClient::GetDlpConnectionInfos(std::vector<DlpConnectio
|
||||
int32_t ConnectionObserverClient::GetConnectionData(std::vector<ConnectionData> &connectionData)
|
||||
{
|
||||
if (!clientImpl_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClient::GetConnectionData impl is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null clientImpl_");
|
||||
return ERR_NO_CLIENT_IMPL;
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -26,7 +26,7 @@ namespace AbilityRuntime {
|
||||
int32_t ConnectionObserverClientImpl::RegisterObserver(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClientImpl::RegisterObserver invalid observer.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid observer");
|
||||
return ERR_INVALID_OBSERVER;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ int32_t ConnectionObserverClientImpl::RegisterObserver(const std::shared_ptr<Con
|
||||
|
||||
std::lock_guard<std::mutex> guard(observerLock_);
|
||||
if (!RegisterObserverToServiceLocked(proxy)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register to service failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register failed");
|
||||
return ERR_REGISTER_FAILED;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ int32_t ConnectionObserverClientImpl::RegisterObserver(const std::shared_ptr<Con
|
||||
int32_t ConnectionObserverClientImpl::UnregisterObserver(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister, observer is invalid.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid observer");
|
||||
return ERR_INVALID_OBSERVER;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ int32_t ConnectionObserverClientImpl::GetDlpConnectionInfos(std::vector<DlpConne
|
||||
{
|
||||
auto proxy = GetServiceProxy();
|
||||
if (!proxy) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetDlpConnectionInfos, observer is invalid.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid observer");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ int32_t ConnectionObserverClientImpl::GetConnectionData(std::vector<ConnectionDa
|
||||
{
|
||||
auto proxy = GetServiceProxy();
|
||||
if (!proxy) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetConnectionData, observer is invalid.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid observer");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ bool ConnectionObserverClientImpl::RegisterObserverToServiceLocked(const std::sh
|
||||
}
|
||||
|
||||
if (!proxy) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail to get service.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail to get service");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ bool ConnectionObserverClientImpl::RegisterObserverToServiceLocked(const std::sh
|
||||
}
|
||||
|
||||
if (proxy->RegisterObserver(observer_) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register connection observer failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register observer failed");
|
||||
return false;
|
||||
}
|
||||
isRegistered_ = true;
|
||||
@@ -163,7 +163,7 @@ void ConnectionObserverClientImpl::UnregisterFromServiceLocked(const std::shared
|
||||
}
|
||||
|
||||
if (proxy->UnregisterObserver(observer_) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister connection observer failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer failed");
|
||||
return;
|
||||
}
|
||||
isRegistered_ = false;
|
||||
@@ -172,7 +172,7 @@ void ConnectionObserverClientImpl::UnregisterFromServiceLocked(const std::shared
|
||||
int32_t ConnectionObserverClientImpl::AddObserversLocked(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (userObservers_.find(observer) != userObservers_.end()) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "observer was already registered.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "observer already registered");
|
||||
return ERR_OBSERVER_ALREADY_REGISTERED;
|
||||
}
|
||||
userObservers_.emplace(observer);
|
||||
@@ -182,7 +182,7 @@ int32_t ConnectionObserverClientImpl::AddObserversLocked(const std::shared_ptr<C
|
||||
int32_t ConnectionObserverClientImpl::RemoveObserversLocked(const std::shared_ptr<ConnectionObserver> &observer)
|
||||
{
|
||||
if (userObservers_.find(observer) == userObservers_.end()) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister no such observer.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such observer");
|
||||
return ERR_OBSERVER_NOT_REGISTERED;
|
||||
}
|
||||
userObservers_.erase(observer);
|
||||
@@ -205,28 +205,28 @@ void ConnectionObserverClientImpl::ConnectLocked()
|
||||
}
|
||||
sptr<ISystemAbilityManager> systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Fail to get system ability registry.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "get system ability registry failed");
|
||||
return;
|
||||
}
|
||||
sptr<IRemoteObject> remoteObj = systemManager->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Fail to connect ability manager service.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connect AMS failed");
|
||||
return;
|
||||
}
|
||||
|
||||
deathRecipient_ = sptr<IRemoteObject::DeathRecipient>(
|
||||
new (std::nothrow) ServiceDeathRecipient(shared_from_this()));
|
||||
if (deathRecipient_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Failed to create AbilityMgrDeathRecipient!");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "create AbilityMgrDeathRecipient failed");
|
||||
return;
|
||||
}
|
||||
if ((remoteObj->IsProxyObject()) && (!remoteObj->AddDeathRecipient(deathRecipient_))) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Add death recipient to AbilityManagerService failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Add death recipient failed");
|
||||
return;
|
||||
}
|
||||
|
||||
serviceAdapter_ = std::make_shared<ServiceProxyAdapter>(remoteObj);
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "Connect ability manager service success.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "Connect AMS success");
|
||||
}
|
||||
|
||||
void ConnectionObserverClientImpl::HandleRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
@@ -281,10 +281,10 @@ std::unordered_set<std::shared_ptr<ConnectionObserver>> ConnectionObserverClient
|
||||
|
||||
void ConnectionObserverClientImpl::ServiceDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "ServiceDeathRecipient handle remote abilityms died.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "called");
|
||||
auto owner = owner_.lock();
|
||||
if (!owner) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "ServiceDeathRecipient handle remote abilityms died.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnRemoteDied");
|
||||
return;
|
||||
}
|
||||
owner->HandleRemoteDied(remote);
|
||||
|
||||
@@ -29,18 +29,18 @@ void ConnectionObserverProxy::OnExtensionConnected(const ConnectionData& connect
|
||||
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "called");
|
||||
if (!data.WriteInterfaceToken(IConnectionObserver::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&connectionData)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write ConnectionData error.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write ConnectionData error");
|
||||
return;
|
||||
}
|
||||
|
||||
int error = SendTransactCmd(IConnectionObserver::ON_EXTENSION_CONNECTED, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnExtensionConnected sned request fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "send request error: %{public}d", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -53,18 +53,18 @@ void ConnectionObserverProxy::OnExtensionDisconnected(const ConnectionData& conn
|
||||
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "called");
|
||||
if (!data.WriteInterfaceToken(IConnectionObserver::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&connectionData)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write ConnectionData error.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write ConnectionData error");
|
||||
return;
|
||||
}
|
||||
|
||||
int error = SendTransactCmd(IConnectionObserver::ON_EXTENSION_DISCONNECTED, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnExtensionDisconnected send request fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "send request error: %{public}d", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -76,20 +76,20 @@ void ConnectionObserverProxy::OnDlpAbilityOpened(const DlpStateData& dlpData)
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "ConnectionObserverProxy OnDlpAbilityOpened.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "called");
|
||||
if (!data.WriteInterfaceToken(IConnectionObserver::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&dlpData)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write DlpStateData error.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write DlpStateData error");
|
||||
return;
|
||||
}
|
||||
|
||||
int error = SendTransactCmd(IConnectionObserver::ON_DLP_ABILITY_OPENED, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnDlpAbilityOpened send request fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "send request error: %{public}d", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -100,20 +100,20 @@ void ConnectionObserverProxy::OnDlpAbilityClosed(const DlpStateData& dlpData)
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "ConnectionObserverProxy OnDlpAbilityClosed.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "called");
|
||||
if (!data.WriteInterfaceToken(IConnectionObserver::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write token failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&dlpData)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write DlpStateData error.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Write DlpStateData error");
|
||||
return;
|
||||
}
|
||||
|
||||
int error = SendTransactCmd(IConnectionObserver::ON_DLP_ABILITY_CLOSED, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnDlpAbilityClosed send request fail, error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "send request error: %{public}d", error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -124,13 +124,13 @@ int32_t ConnectionObserverProxy::SendTransactCmd(uint32_t code, MessageParcel &d
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "remote object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null remote");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
int32_t ret = remote->SendRequest(code, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "SendRequest failed. code is %{public}d, ret is %{public}d.", code, ret);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "SendRequest failed. code: %{public}d, ret: %{public}d.", code, ret);
|
||||
return ret;
|
||||
}
|
||||
return NO_ERROR;
|
||||
|
||||
@@ -29,7 +29,7 @@ int ConnectionObserverStub::OnRemoteRequest(
|
||||
std::u16string descriptor = ConnectionObserverStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "ConnectionObserverStub Local descriptor is not equal to remote.");
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "invalid descriptor");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
if (code < IConnectionObserver::CMD_MAX && code >= 0) {
|
||||
@@ -53,7 +53,7 @@ int ConnectionObserverStub::OnExtensionConnectedInner(MessageParcel &data, Messa
|
||||
{
|
||||
std::unique_ptr<ConnectionData> connectionData(data.ReadParcelable<ConnectionData>());
|
||||
if (!connectionData) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnExensionConnected ReadParcelable<ConnectionData> failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "error connectionData");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ int ConnectionObserverStub::OnExtensionDisconnectedInner(MessageParcel &data, Me
|
||||
{
|
||||
std::unique_ptr<ConnectionData> connectionData(data.ReadParcelable<ConnectionData>());
|
||||
if (!connectionData) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnExtensionDisconnected ReadParcelable<ConnectionData> failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "error connectionData");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ int ConnectionObserverStub::OnDlpAbilityOpenedInner(MessageParcel &data, Message
|
||||
{
|
||||
std::unique_ptr<DlpStateData> dlpData(data.ReadParcelable<DlpStateData>());
|
||||
if (!dlpData) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnDlpAbilityOpened ReadParcelable<DlpStateData> failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "error dlpData");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int ConnectionObserverStub::OnDlpAbilityClosedInner(MessageParcel &data, Message
|
||||
{
|
||||
std::unique_ptr<DlpStateData> dlpData(data.ReadParcelable<DlpStateData>());
|
||||
if (!dlpData) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "OnDlpAbilityClosed ReadParcelable<DlpStateData> failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "error dlpData");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,17 +85,17 @@ bool DlpStateData::ReadFromParcel(Parcel &parcel)
|
||||
targetAbilityName = Str16ToStr8(strValue);
|
||||
|
||||
if (!parcel.ReadInt32(callerUid)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "DlpStateData::ReadFromParcel read callerUid failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read callerUid failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.ReadInt32(callerPid)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "DlpStateData::ReadFromParcel read callerPid failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read callerPid failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.ReadString16(strValue)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "DlpStateData::ReadFromParcel read strValue failed");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "read strValue failed");
|
||||
return false;
|
||||
}
|
||||
callerName = Str16ToStr8(strValue);
|
||||
|
||||
@@ -33,12 +33,12 @@ constexpr int32_t CYCLE_LIMIT = 1000;
|
||||
int32_t ServiceProxyAdapter::RegisterObserver(const sptr<IConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "IConnectObserver is invalid.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid IConnectObserver");
|
||||
return ERR_INVALID_OBSERVER;
|
||||
}
|
||||
|
||||
if (!remoteObj_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no abilityms proxy.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no abilityms proxy");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -47,18 +47,18 @@ int32_t ServiceProxyAdapter::RegisterObserver(const sptr<IConnectionObserver> &o
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(ABILITY_MGR_DESCRIPTOR)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register observer write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write token failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(observer->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register observer write observer remote obj failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write remote obj failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
error = remoteObj_->SendRequest(REGISTER_CONNECTION_OBSERVER, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register observer Send request error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -67,12 +67,12 @@ int32_t ServiceProxyAdapter::RegisterObserver(const sptr<IConnectionObserver> &o
|
||||
int32_t ServiceProxyAdapter::UnregisterObserver(const sptr<IConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer, IConnectObserver is invalid.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "IConnectObserver invalid");
|
||||
return ERR_INVALID_OBSERVER;
|
||||
}
|
||||
|
||||
if (!remoteObj_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer, no abilityms proxy.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no abilityms proxy");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -81,18 +81,18 @@ int32_t ServiceProxyAdapter::UnregisterObserver(const sptr<IConnectionObserver>
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(ABILITY_MGR_DESCRIPTOR)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer, write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write token failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(observer->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer, write observer remote obj failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write remote obj failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
error = remoteObj_->SendRequest(UNREGISTER_CONNECTION_OBSERVER, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "unregister observer, Send request error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -102,7 +102,7 @@ int32_t ServiceProxyAdapter::UnregisterObserver(const sptr<IConnectionObserver>
|
||||
int32_t ServiceProxyAdapter::GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos)
|
||||
{
|
||||
if (!remoteObj_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetDlpConnectionInfos, no abilityms proxy.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no abilityms proxy");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -111,32 +111,32 @@ int32_t ServiceProxyAdapter::GetDlpConnectionInfos(std::vector<DlpConnectionInfo
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(ABILITY_MGR_DESCRIPTOR)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetDlpConnectionInfos, write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write token failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
error = remoteObj_->SendRequest(GET_DLP_CONNECTION_INFOS, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetDlpConnectionInfos, Send request error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
auto result = reply.ReadInt32();
|
||||
if (result != 0) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetDlpConnectionInfos fail, result: %{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail, result: %{public}d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t infoSize = reply.ReadInt32();
|
||||
if (infoSize > CYCLE_LIMIT) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "infoSize is too large");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "infoSize too large");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < infoSize; i++) {
|
||||
std::unique_ptr<DlpConnectionInfo> info(reply.ReadParcelable<DlpConnectionInfo>());
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Read GetDlpConnectionInfo infos failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Read infos failed");
|
||||
return ERR_READ_INFO_FAILED;
|
||||
}
|
||||
infos.emplace_back(*info);
|
||||
@@ -149,7 +149,7 @@ int32_t ServiceProxyAdapter::GetDlpConnectionInfos(std::vector<DlpConnectionInfo
|
||||
int32_t ServiceProxyAdapter::GetConnectionData(std::vector<ConnectionData> &connectionData)
|
||||
{
|
||||
if (!remoteObj_) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetConnectionData, no abilityms proxy.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no abilityms proxy");
|
||||
return ERR_NO_PROXY;
|
||||
}
|
||||
|
||||
@@ -158,32 +158,32 @@ int32_t ServiceProxyAdapter::GetConnectionData(std::vector<ConnectionData> &conn
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(ABILITY_MGR_DESCRIPTOR)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetConnectionData, write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "write token failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
error = remoteObj_->SendRequest(GET_CONNECTION_DATA, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetConnectionData, Send request error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
auto result = reply.ReadInt32();
|
||||
if (result != 0) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "GetConnectionData fail, result: %{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail, result: %{public}d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t infoSize = reply.ReadInt32();
|
||||
if (infoSize > CYCLE_LIMIT) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "infoSize is too large");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "infoSize too large");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < infoSize; i++) {
|
||||
std::unique_ptr<ConnectionData> item(reply.ReadParcelable<ConnectionData>());
|
||||
if (item == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Read GetConnectionData infos failed");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Read infos failed");
|
||||
return ERR_READ_INFO_FAILED;
|
||||
}
|
||||
connectionData.emplace_back(*item);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OHOS {
|
||||
namespace AAFwk {
|
||||
#define CHECK_POINTER_RETURN_NOT_CONNECTED(object) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "proxy is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "null proxy"); \
|
||||
return ABILITY_SERVICE_NOT_CONNECTED; \
|
||||
}
|
||||
|
||||
@@ -52,30 +52,30 @@ void ExtensionManagerClient::Connect()
|
||||
{
|
||||
auto systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Fail to get SAMgr.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Get SAMgr failed");
|
||||
return;
|
||||
}
|
||||
auto remoteObj = systemManager->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Fail to connect ability manager service.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect AMS failed");
|
||||
return;
|
||||
}
|
||||
|
||||
deathRecipient_ = new ExtensionMgrDeathRecipient();
|
||||
if (remoteObj->IsProxyObject() && !remoteObj->AddDeathRecipient(deathRecipient_)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Add death recipient to AbilityManagerService failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "AddDeathRecipient failed");
|
||||
return;
|
||||
}
|
||||
|
||||
proxy_ = sptr<IExtensionManager>(new ExtensionManagerProxy(remoteObj));
|
||||
TAG_LOGD(AAFwkTag::EXTMGR, "Connect ability manager service success.");
|
||||
TAG_LOGD(AAFwkTag::EXTMGR, "Connect AMS success");
|
||||
}
|
||||
|
||||
void ExtensionManagerClient::ResetProxy(const wptr<IRemoteObject>& remote)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (proxy_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::EXTMGR, "proxy_ is nullptr, no need reset.");
|
||||
TAG_LOGI(AAFwkTag::EXTMGR, "null proxy_, no need reset");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void ExtensionManagerClient::ResetProxy(const wptr<IRemoteObject>& remote)
|
||||
|
||||
void ExtensionManagerClient::ExtensionMgrDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::EXTMGR, "ExtensionMgrDeathRecipient handle remote died.");
|
||||
TAG_LOGI(AAFwkTag::EXTMGR, "called");
|
||||
ExtensionManagerClient::GetInstance().ResetProxy(remote);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ ErrCode ExtensionManagerClient::ConnectServiceExtensionAbility(const Want &want,
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
auto abms = GetExtensionManager();
|
||||
if (abms == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect service failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str());
|
||||
return ABILITY_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ ErrCode ExtensionManagerClient::ConnectServiceExtensionAbility(const Want &want,
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
auto abms = GetExtensionManager();
|
||||
if (abms == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect service failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str());
|
||||
return ABILITY_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ ErrCode ExtensionManagerClient::ConnectEnterpriseAdminExtensionAbility(const Wan
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
auto abms = GetExtensionManager();
|
||||
if (abms == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect service failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Connect failed, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str());
|
||||
return ABILITY_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OHOS::AAFwk {
|
||||
bool ExtensionManagerProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(ExtensionManagerProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "write interface token failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "write token failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -36,7 +36,7 @@ int ExtensionManagerProxy::ConnectAbilityCommon(const Want &want, const sptr<IRe
|
||||
bool isQueryExtensionOnly)
|
||||
{
|
||||
if (connect == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "connect is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "null connect");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -45,34 +45,34 @@ int ExtensionManagerProxy::ConnectAbilityCommon(const Want &want, const sptr<IRe
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteParcelable(&want)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "want write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "want write failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (!data.WriteBool(true) || !data.WriteRemoteObject(connect)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag and connect write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag or connect write failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (callerToken) {
|
||||
if (!data.WriteBool(true) || !data.WriteRemoteObject(callerToken)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag and callerToken write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag or callerToken write failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "flag write failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
if (!data.WriteInt32(userId)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "%{public}s, userId write failed.", __func__);
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "userId write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteInt32(static_cast<int32_t>(extensionType))) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "%{public}s, extensionType write failed.", __func__);
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "extensionType write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteBool(isQueryExtensionOnly)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "isQueryExtensionOnly write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "isQueryExtensionOnly write failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ int ExtensionManagerProxy::ConnectAbilityCommon(const Want &want, const sptr<IRe
|
||||
MessageOption option;
|
||||
int error = SendRequest(AbilityManagerInterfaceCode::CONNECT_ABILITY_WITH_TYPE, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "%{public}s, Send request error: %{public}d", __func__, error);
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -89,7 +89,7 @@ int ExtensionManagerProxy::ConnectAbilityCommon(const Want &want, const sptr<IRe
|
||||
int ExtensionManagerProxy::DisconnectAbility(const sptr<IRemoteObject> &connect)
|
||||
{
|
||||
if (connect == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "disconnect ability fail, connect is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "disconnect ability failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ int ExtensionManagerProxy::DisconnectAbility(const sptr<IRemoteObject> &connect)
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteRemoteObject(connect)) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "connect write failed.");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "connect write failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ ErrCode ExtensionManagerProxy::SendRequest(AbilityManagerInterfaceCode code, Mes
|
||||
{
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "Remote() is NULL");
|
||||
TAG_LOGE(AAFwkTag::EXTMGR, "null remote");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ void ExtensionBase<C>::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
Extension::Init(record, application, handler, token);
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin init context");
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin");
|
||||
context_ = CreateAndInitContext(record, application, handler, token);
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ std::shared_ptr<C> ExtensionBase<C>::CreateAndInitContext(const std::shared_ptr<
|
||||
std::shared_ptr<AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin init base");
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin");
|
||||
std::shared_ptr<C> context = std::make_shared<C>();
|
||||
auto appContext = Context::GetApplicationContext();
|
||||
if (appContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext appContext is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null appContext");
|
||||
return context;
|
||||
}
|
||||
context->SetApplicationInfo(appContext->GetApplicationInfo());
|
||||
@@ -49,7 +49,7 @@ std::shared_ptr<C> ExtensionBase<C>::CreateAndInitContext(const std::shared_ptr<
|
||||
context->SetParentContext(appContext);
|
||||
context->SetToken(token);
|
||||
if (record == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext record is nullptr");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null record");
|
||||
return context;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin init abilityInfo");
|
||||
@@ -80,13 +80,13 @@ void ExtensionBase<C>::OnConfigurationUpdated(const AppExecFwk::Configuration &c
|
||||
TAG_LOGD(AAFwkTag::EXT, "called");
|
||||
|
||||
if (!context_) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "context is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null context_");
|
||||
return;
|
||||
}
|
||||
|
||||
auto fullConfig = context_->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "configuration is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::EXT, "null config");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ AppInfo *AppInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
AppInfo *info = new (std::nothrow) AppInfo();
|
||||
if (info && !info->ReadFromParcel(parcel)) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "read from parcel failed");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "Read from parcel failed");
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ BusinessAbilityFilter *BusinessAbilityFilter::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
BusinessAbilityFilter *filter = new (std::nothrow) BusinessAbilityFilter();
|
||||
if (filter && !filter->ReadFromParcel(parcel)) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "read from parcel failed");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "Read from parcel failed");
|
||||
delete filter;
|
||||
filter = nullptr;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ bool BusinessAbilityInfo::ReadFromParcel(Parcel &parcel)
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, size);
|
||||
CONTAINER_SECURITY_VERIFY(parcel, size, &permissions);
|
||||
if (size > CYCLE_LIMIT) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "size is too large.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Size too large");
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < size; i++) {
|
||||
@@ -129,7 +129,7 @@ BusinessAbilityInfo *BusinessAbilityInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
BusinessAbilityInfo *info = new (std::nothrow) BusinessAbilityInfo();
|
||||
if (info && !info->ReadFromParcel(parcel)) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "read from parcel failed");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "Read from parcel failed");
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ bool PurposeInfo::ReadFromParcel(Parcel &parcel)
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, supportDimensionSize);
|
||||
CONTAINER_SECURITY_VERIFY(parcel, supportDimensionSize, &supportDimensions);
|
||||
if (supportDimensionSize > CYCLE_LIMIT) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "supportDimensionSize is too large.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SupportDimensionSize too large");
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < supportDimensionSize; i++) {
|
||||
@@ -184,7 +184,7 @@ PurposeInfo *PurposeInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
PurposeInfo *info = new (std::nothrow) PurposeInfo();
|
||||
if (info && !info->ReadFromParcel(parcel)) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "read from parcel failed");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "Read from parcel failed");
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
void ServiceRouterDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &object)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "OnRemoteDied.");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
ServiceRouterMgrHelper::GetInstance().OnRemoteDiedHandle();
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -25,21 +25,21 @@ void ServiceRouterLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbility
|
||||
{
|
||||
if (systemAbilityId != OHOS::SERVICE_ROUTER_MGR_SERVICE_ID) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER,
|
||||
"OnLoadSystemAbilitySuccess, not matched systemAbilityId: %{public}d", systemAbilityId);
|
||||
"Not matched systemAbilityId: %{public}d", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
if (remoteObject == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER,
|
||||
"OnLoadSystemAbilitySuccess, remoteObject is null, systemAbilityId: %{public}d", systemAbilityId);
|
||||
"null remoteObject, systemAbilityId: %{public}d", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "OnLoadSystemAbilitySuccess, systemAbilityId: %{public}d", systemAbilityId);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "SystemAbilityId: %{public}d", systemAbilityId);
|
||||
ServiceRouterMgrHelper::GetInstance().FinishStartSASuccess(remoteObject);
|
||||
}
|
||||
|
||||
void ServiceRouterLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "OnLoadSystemAbilitySuccess systemAbilityId: %{public}d", systemAbilityId);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SystemAbilityId: %{public}d", systemAbilityId);
|
||||
ServiceRouterMgrHelper::GetInstance().FinishStartSAFail();
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -35,7 +35,7 @@ ServiceRouterMgrHelper::~ServiceRouterMgrHelper()
|
||||
|
||||
void ServiceRouterMgrHelper::OnRemoteDiedHandle()
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Remove service died.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Remove died");
|
||||
SetServiceRouterMgr(nullptr);
|
||||
std::unique_lock<std::mutex> lock(cvLock_);
|
||||
isReady = false;
|
||||
@@ -61,25 +61,25 @@ void ServiceRouterMgrHelper::LoadSA()
|
||||
}
|
||||
sptr<ISystemAbilityManager> saManager = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (saManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "LoadSA, GetSystemAbilityManager is null.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null saManager");
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<ServiceRouterLoadCallback> loadCallback = new (std::nothrow) ServiceRouterLoadCallback();
|
||||
if (loadCallback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "LoadSA, new ServiceRouterLoadCallback return null.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null loadCallback");
|
||||
return;
|
||||
}
|
||||
int32_t result = saManager->LoadSystemAbility(OHOS::SERVICE_ROUTER_MGR_SERVICE_ID, loadCallback);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "LoadSA, LoadSystemAbility result: %{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "LoadSystemAbility result: %{public}d", result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ServiceRouterMgrHelper::FinishStartSASuccess(const sptr<IRemoteObject> &remoteObject)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "FinishStartSASuccess.");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
SetServiceRouterMgr(OHOS::iface_cast<IServiceRouterManager>(remoteObject));
|
||||
|
||||
{
|
||||
@@ -96,7 +96,7 @@ void ServiceRouterMgrHelper::FinishStartSASuccess(const sptr<IRemoteObject> &rem
|
||||
|
||||
void ServiceRouterMgrHelper::FinishStartSAFail()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "FinishStartSAFail.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Called");
|
||||
SetServiceRouterMgr(nullptr);
|
||||
|
||||
{
|
||||
@@ -128,7 +128,7 @@ sptr<IServiceRouterManager> ServiceRouterMgrHelper::GetServiceRouterMgr()
|
||||
|
||||
routerMgr = InnerGetServiceRouterMgr();
|
||||
if (routerMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "GetServiceRouterMgr, after load routerMgr_ is null");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null routerMgr");
|
||||
}
|
||||
return routerMgr;
|
||||
}
|
||||
|
||||
@@ -25,31 +25,31 @@ namespace AbilityRuntime {
|
||||
ServiceRouterMgrProxy::ServiceRouterMgrProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IServiceRouterManager>(object)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrProxy instance is created");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "created");
|
||||
}
|
||||
|
||||
ServiceRouterMgrProxy::~ServiceRouterMgrProxy()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrProxy instance is destroyed");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "destroyed");
|
||||
}
|
||||
|
||||
int32_t ServiceRouterMgrProxy::QueryBusinessAbilityInfos(const BusinessAbilityFilter &filter,
|
||||
std::vector<BusinessAbilityInfo> &abilityInfos)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrProxy QueryBusinessAbilityInfos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write interfaceToken failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write interfaceToken failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteParcelable(&filter)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write filter failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write filter failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
int32_t res = GetParcelableInfos<BusinessAbilityInfo>(ServiceRouterMgrProxy::Message::QUERY_BUSINESS_ABILITY_INFOS,
|
||||
data, abilityInfos);
|
||||
if (res != OHOS::NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "fail to QueryBusinessAbilityInfos from server, error code: %{public}d", res);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryBusinessAbilityInfos error: %{public}d", res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -57,24 +57,24 @@ int32_t ServiceRouterMgrProxy::QueryBusinessAbilityInfos(const BusinessAbilityFi
|
||||
int32_t ServiceRouterMgrProxy::QueryPurposeInfos(const Want &want, const std::string purposeName,
|
||||
std::vector<PurposeInfo> &purposeInfos)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrProxy QueryPurposeInfos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write interfaceToken failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write interfaceToken failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteParcelable(&want)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write want failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write want failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
if (!data.WriteString(purposeName)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write purposeName fail");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write purposeName failed");
|
||||
return false;
|
||||
}
|
||||
int32_t res = GetParcelableInfos<PurposeInfo>(ServiceRouterMgrProxy::Message::QUERY_PURPOSE_INFOS, data,
|
||||
purposeInfos);
|
||||
if (res != OHOS::NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "fail to QueryPurposeInfos from server, error code: %{public}d", res);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryPurposeInfos error: %{public}d", res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -85,30 +85,30 @@ int32_t ServiceRouterMgrProxy::StartUIExtensionAbility(const sptr<SessionInfo> &
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write interfaceToken failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write interfaceToken failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
if (sessionInfo) {
|
||||
if (!data.WriteBool(true) || !data.WriteParcelable(sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag and sessionInfo write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag or sessionInfo write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(userId)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "StartExtensionAbility, userId write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "UserId write failed.");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
int32_t error = SendRequest(ServiceRouterMgrProxy::Message::START_UI_EXTENSION, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "StartExtensionAbility, Send request error: %{public}d", error);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -122,44 +122,44 @@ int32_t ServiceRouterMgrProxy::ConnectUIExtensionAbility(const Want &want, const
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor()) || !data.WriteParcelable(&want)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write interfaceToken or want failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Write interfaceToken or want failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
if (!connect) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "connect ability fail, connect is nullptr");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null connect");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
|
||||
if (connect->AsObject()) {
|
||||
if (!data.WriteBool(true) || !data.WriteRemoteObject(connect->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag and connect write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag or connect write failed.");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
if (sessionInfo) {
|
||||
if (!data.WriteBool(true) || !data.WriteParcelable(sessionInfo)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag and sessionInfo write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag or sessionInfo write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "flag write failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Flag write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
if (!data.WriteInt32(userId)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "%{public}s, userId write failed.", __func__);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "UserId write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
int32_t error = SendRequest(ServiceRouterMgrProxy::Message::CONNECT_UI_EXTENSION, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "%{public}s, Send request error: %{public}d", __func__, error);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
@@ -168,16 +168,16 @@ int32_t ServiceRouterMgrProxy::ConnectUIExtensionAbility(const Want &want, const
|
||||
int32_t ServiceRouterMgrProxy::SendRequest(ServiceRouterMgrProxy::Message code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "ServiceRouterMgrProxy SendRequest");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "fail to send %{public}d cmd to service, remote object is null", code);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null remote");
|
||||
return ERR_APPEXECFWK_FAILED_GET_REMOTE_PROXY;
|
||||
}
|
||||
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
if (result != NO_ERROR) {
|
||||
TAG_LOGE(
|
||||
AAFwkTag::SER_ROUTER, "fail to send %{public}d cmd to service, transact error:%{public}d", code, result);
|
||||
AAFwkTag::SER_ROUTER, "Send %{public}d cmd to service failed, transact error:%{public}d", code, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -190,13 +190,13 @@ int32_t ServiceRouterMgrProxy::GetParcelableInfos(
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
int32_t result = SendRequest(code, data, reply, option);
|
||||
if (result != OHOS::NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SendRequest result false");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SendRequest result failed");
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t res = reply.ReadInt32();
|
||||
if (res != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "reply's result is %{public}d", res);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "reply error: %{public}d", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ int32_t ServiceRouterMgrProxy::GetParcelableInfos(
|
||||
}
|
||||
parcelableInfos.emplace_back(*info);
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "get parcelableInfos success");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Get parcelableInfos success");
|
||||
return OHOS::NO_ERROR;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -53,7 +53,7 @@ static napi_value BusinessAbilityRouterExport(napi_env env, napi_value exports)
|
||||
{
|
||||
napi_value businessType = InitBusinessTypeObject(env);
|
||||
if (businessType == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "failed to create business type object");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null businessType");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,17 +132,17 @@ static void ConvertBusinessAbilityInfos(napi_env env, const std::vector<Business
|
||||
static ErrCode InnerQueryBusinessAbilityInfos(AbilityInfosCallbackInfo *info)
|
||||
{
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "CallbackInfo is null");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null info");
|
||||
return ERROR_BUNDLE_SERVICE_EXCEPTION;
|
||||
}
|
||||
auto serviceRouterMgr = ServiceRouterMgrHelper::GetInstance().GetServiceRouterMgr();
|
||||
if (serviceRouterMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "can not get serviceRouterMgr");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Get serviceRouterMgr failed");
|
||||
return ERROR_BUNDLE_SERVICE_EXCEPTION;
|
||||
}
|
||||
|
||||
auto ret = serviceRouterMgr->QueryBusinessAbilityInfos(info->filter, info->businessAbilityInfos);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "InnerQueryBusinessAbilityInfos ErrCode : %{public}d", ret);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "ErrCode : %{public}d", ret);
|
||||
return CommonFunc::ConvertErrCode(ret);
|
||||
}
|
||||
|
||||
@@ -181,10 +181,10 @@ static bool ParseBusinessAbilityInfo(napi_env env, napi_value args, BusinessAbil
|
||||
|
||||
void QueryBusinessAbilityInfosExec(napi_env env, void *data)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "QueryServiceInfosExec start");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
AbilityInfosCallbackInfo *asyncCallbackInfo = reinterpret_cast<AbilityInfosCallbackInfo*>(data);
|
||||
if (asyncCallbackInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "%{public}s, asyncCallbackInfo == nullptr.", __func__);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null asyncCallbackInfo");
|
||||
return;
|
||||
}
|
||||
asyncCallbackInfo->err = InnerQueryBusinessAbilityInfos(asyncCallbackInfo);
|
||||
@@ -192,10 +192,10 @@ void QueryBusinessAbilityInfosExec(napi_env env, void *data)
|
||||
|
||||
void QueryBusinessAbilityInfosComplete(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "QueryBusinessAbilityInfosComplete start");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
AbilityInfosCallbackInfo *asyncCallbackInfo = reinterpret_cast<AbilityInfosCallbackInfo*>(data);
|
||||
if (asyncCallbackInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "asyncCallbackInfo is null in %{public}s", __func__);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null asyncCallbackInfo");
|
||||
return;
|
||||
}
|
||||
napi_value result[2] = {0};
|
||||
@@ -224,7 +224,7 @@ void QueryBusinessAbilityInfosComplete(napi_env env, napi_status status, void *d
|
||||
|
||||
napi_value QueryBusinessAbilityInfos(napi_env env, napi_callback_info info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "NAPI_QueryBusinessAbilityInfos start");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Called");
|
||||
NapiArg args(env, info);
|
||||
if (!args.Init(ARGS_SIZE_ONE, ARGS_SIZE_TWO)) {
|
||||
BusinessError::ThrowTooFewParametersError(env, ERROR_PARAM_CHECK_ERROR);
|
||||
@@ -250,7 +250,7 @@ napi_value QueryBusinessAbilityInfos(napi_env env, napi_callback_info info)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "parameters error");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Parameters error");
|
||||
BusinessError::ThrowTooFewParametersError(env, ERROR_PARAM_CHECK_ERROR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ public:
|
||||
std::vector<BusinessAbilityInfo> &businessAbilityInfos, const AppInfo &appInfo)
|
||||
{
|
||||
if (bundleInfo.name.empty()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "ConvertBundleInfo, bundleInfo invalid");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "BundleInfo invalid");
|
||||
return false;
|
||||
}
|
||||
ResolveAbilityInfos(bundleInfo.abilityInfos, purposeInfos, appInfo);
|
||||
ResolveExtAbilityInfos(bundleInfo.extensionInfos, purposeInfos, businessAbilityInfos, appInfo);
|
||||
if (purposeInfos.empty() && businessAbilityInfos.empty()) {
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER,
|
||||
"ResolveBundleInfo, not support, bundleName: %{public}s", bundleInfo.name.c_str());
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER,
|
||||
"Not support, bundleName: %{public}s", bundleInfo.name.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -99,6 +99,7 @@ private:
|
||||
static void ConvertAbilityToPurposes(const AbilityInfo &abilityInfo, std::vector<PurposeInfo> &purposeInfos,
|
||||
const AppInfo &appInfo)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Called");
|
||||
std::string supportPurpose = GetAbilityMetadataValue(abilityInfo, SrConstants::METADATA_SUPPORT_PURPOSE_KEY);
|
||||
if (supportPurpose.empty()) {
|
||||
return;
|
||||
@@ -114,8 +115,8 @@ private:
|
||||
purposeInfo.componentType = ComponentType::UI_ABILITY;
|
||||
purposeInfo.appInfo = appInfo;
|
||||
purposeInfos.emplace_back(purposeInfo);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER,
|
||||
"AbilityToPurposes, bundle: %{public}s ,ability: %{public}s, purposeName: %{public}s",
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER,
|
||||
"Bundle: %{public}s ,ability: %{public}s, purposeName: %{public}s",
|
||||
abilityInfo.bundleName.c_str(), abilityInfo.name.c_str(), name.c_str());
|
||||
}
|
||||
}
|
||||
@@ -123,6 +124,7 @@ private:
|
||||
static void ConvertExtAbilityToPurposes(const ExtensionAbilityInfo &extAbilityInfo,
|
||||
std::vector<PurposeInfo> &purposeInfos, const AppInfo &appInfo)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Called");
|
||||
if (extAbilityInfo.type != ExtensionAbilityType::FORM && extAbilityInfo.type != ExtensionAbilityType::UI) {
|
||||
return;
|
||||
}
|
||||
@@ -143,7 +145,7 @@ private:
|
||||
purposeInfo.purposeName = purposeAndCard;
|
||||
purposeInfo.componentType = ComponentType::UI_EXTENSION;
|
||||
purposeInfos.emplace_back(purposeInfo);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER,
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER,
|
||||
"UIExtToPurposes, bundle: %{public}s, abilityName: %{public}s, purposeName: %{public}s",
|
||||
extAbilityInfo.bundleName.c_str(), extAbilityInfo.name.c_str(), purposeAndCard.c_str());
|
||||
} else {
|
||||
@@ -154,12 +156,12 @@ private:
|
||||
purposeInfo.cardName = purposeNameAndCardName[1];
|
||||
purposeInfo.componentType = ComponentType::FORM;
|
||||
purposeInfos.emplace_back(purposeInfo);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER,
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER,
|
||||
"FormToPurposes, bundle: %{public}s, abilityName: %{public}s, purposeName: %{public}s",
|
||||
extAbilityInfo.bundleName.c_str(), extAbilityInfo.name.c_str(),
|
||||
purposeInfo.purposeName.c_str());
|
||||
} else {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "FormToPurposes invalid supportPurpose");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "FormToPurposes invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +174,7 @@ private:
|
||||
return;
|
||||
}
|
||||
BusinessType type = GetBusinessType(extAbilityInfo.metadata);
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "ToService, abilityName: %{public}s, businessType: %{public}d",
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "AbilityName: %{public}s, businessType: %{public}d",
|
||||
extAbilityInfo.name.c_str(), static_cast<int>(type));
|
||||
if (type != BusinessType::UNSPECIFIED) {
|
||||
BusinessAbilityInfo businessAbilityInfo;
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
void UpdateBusinessAbilityInfos(const std::vector<BusinessAbilityInfo> &businessAbilityInfos)
|
||||
{
|
||||
if (businessAbilityInfos.size() == 0) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "UpdateBusinessAbilityInfos, serviceInfos.size is 0");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "serviceInfos size: 0");
|
||||
businessAbilityInfos_.clear();
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
void UpdatePurposeInfos(const std::vector<PurposeInfo> &purposeInfos)
|
||||
{
|
||||
if (purposeInfos.size() == 0) {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "updatePurposeInfos, purposeInfos.size is 0");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "purposeInfos size: 0");
|
||||
purposeInfos_.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,17 +32,17 @@ const std::string SCHEME_SERVICE_ROUTER = "servicerouter";
|
||||
|
||||
bool ServiceRouterDataMgr::LoadAllBundleInfos()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM LoadAllBundleInfos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
ClearAllBundleInfos();
|
||||
auto bundleMgrHelper = DelayedSingleton<AppExecFwk::BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null bundleMgrHelper");
|
||||
return false;
|
||||
}
|
||||
auto flags = (BundleFlag::GET_BUNDLE_WITH_ABILITIES | BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO);
|
||||
std::vector<BundleInfo> bundleInfos;
|
||||
if (!bundleMgrHelper->GetBundleInfos(flags, bundleInfos, SrSamgrHelper::GetCurrentActiveUserId())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Return false.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "return");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,16 +55,16 @@ bool ServiceRouterDataMgr::LoadAllBundleInfos()
|
||||
|
||||
bool ServiceRouterDataMgr::LoadBundleInfo(const std::string &bundleName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM LoadBundleInfo");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
auto bundleMgrHelper = DelayedSingleton<AppExecFwk::BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "null bundleMgrHelper");
|
||||
return false;
|
||||
}
|
||||
BundleInfo bundleInfo;
|
||||
auto flags = (BundleFlag::GET_BUNDLE_WITH_ABILITIES | BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO);
|
||||
if (!bundleMgrHelper->GetBundleInfo(bundleName, flags, bundleInfo, SrSamgrHelper::GetCurrentActiveUserId())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Return false.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "return");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ bool ServiceRouterDataMgr::LoadBundleInfo(const std::string &bundleName)
|
||||
|
||||
void ServiceRouterDataMgr::UpdateBundleInfoLocked(const BundleInfo &bundleInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM UpdateBundleInfo");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
InnerServiceInfo innerServiceInfo;
|
||||
auto infoItem = innerServiceInfos_.find(bundleInfo.name);
|
||||
if (infoItem != innerServiceInfos_.end()) {
|
||||
@@ -94,11 +94,11 @@ void ServiceRouterDataMgr::UpdateBundleInfoLocked(const BundleInfo &bundleInfo)
|
||||
|
||||
void ServiceRouterDataMgr::DeleteBundleInfo(const std::string &bundleName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM DeleteBundleInfo");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
std::lock_guard<std::mutex> lock(bundleInfoMutex_);
|
||||
auto infoItem = innerServiceInfos_.find(bundleName);
|
||||
if (infoItem == innerServiceInfos_.end()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SRDM inner service info not found by bundleName");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "innerServiceInfo not found");
|
||||
return;
|
||||
}
|
||||
innerServiceInfos_.erase(bundleName);
|
||||
@@ -107,10 +107,10 @@ void ServiceRouterDataMgr::DeleteBundleInfo(const std::string &bundleName)
|
||||
int32_t ServiceRouterDataMgr::QueryBusinessAbilityInfos(const BusinessAbilityFilter &filter,
|
||||
std::vector<BusinessAbilityInfo> &businessAbilityInfos) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM QueryBusinessAbilityInfos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
BusinessType validType = GetBusinessType(filter);
|
||||
if (validType == BusinessType::UNSPECIFIED) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SRDM QueryBusinessAbilityInfos, businessType is empty");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "BusinessType empty");
|
||||
return ERR_BUNDLE_MANAGER_PARAM_ERROR;
|
||||
}
|
||||
|
||||
@@ -124,9 +124,9 @@ int32_t ServiceRouterDataMgr::QueryBusinessAbilityInfos(const BusinessAbilityFil
|
||||
int32_t ServiceRouterDataMgr::QueryPurposeInfos(const Want &want, const std::string purposeName,
|
||||
std::vector<PurposeInfo> &purposeInfos) const
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SRDM QueryPurposeInfos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
if (purposeName.empty()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SRDM QueryPurposeInfos, purposeName is empty");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "purposeName empty");
|
||||
return ERR_BUNDLE_MANAGER_PARAM_ERROR;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ int32_t ServiceRouterDataMgr::QueryPurposeInfos(const Want &want, const std::str
|
||||
} else {
|
||||
auto infoItem = innerServiceInfos_.find(bundleName);
|
||||
if (infoItem == innerServiceInfos_.end()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "SRDM QueryPurposeInfos, not found by bundleName.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "innerServiceInfo not found");
|
||||
return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST;
|
||||
}
|
||||
infoItem->second.FindPurposeInfos(purposeName, purposeInfos);
|
||||
@@ -160,7 +160,7 @@ BusinessType ServiceRouterDataMgr::GetBusinessType(const BusinessAbilityFilter &
|
||||
|
||||
OHOS::Uri uri = OHOS::Uri(filter.uri);
|
||||
if (uri.GetScheme().empty() || uri.GetHost().empty() || uri.GetScheme() != SCHEME_SERVICE_ROUTER) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "GetExtensionServiceType, invalid uri: %{public}s", filter.uri.c_str());
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Invalid uri: %{public}s", filter.uri.c_str());
|
||||
return BusinessType::UNSPECIFIED;
|
||||
}
|
||||
return BundleInfoResolveUtil::findBusinessType(uri.GetHost());
|
||||
|
||||
@@ -61,16 +61,16 @@ void ServiceRouterMgrService::OnStart()
|
||||
Init();
|
||||
bool ret = Publish(this);
|
||||
if (!ret) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Publish SRMS failed!");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Publish SRMS failed");
|
||||
return;
|
||||
}
|
||||
DelayUnloadTask();
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "SRMS start success.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "SRMS start success");
|
||||
}
|
||||
|
||||
void ServiceRouterMgrService::OnStop()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Stop SRMS.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Stop SRMS");
|
||||
}
|
||||
|
||||
void ServiceRouterMgrService::Init()
|
||||
@@ -83,35 +83,35 @@ void ServiceRouterMgrService::Init()
|
||||
void ServiceRouterMgrService::DelayUnloadTask()
|
||||
{
|
||||
if (handler_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "DelayUnloadTask, handler_ is nullptr");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "null handler_");
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(delayTaskMutex_);
|
||||
handler_->RemoveTask(TASK_NAME);
|
||||
auto task = [this]() {
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "UnloadSA start.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "UnloadSA start");
|
||||
sptr<ISystemAbilityManager> saManager =
|
||||
OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (saManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "UnloadSA, GetSystemAbilityManager is null.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null saManager");
|
||||
return;
|
||||
}
|
||||
int32_t result = saManager->UnloadSystemAbility(OHOS::SERVICE_ROUTER_MGR_SERVICE_ID);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "UnloadSA, UnloadSystemAbility result: %{public}d", result);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "UnloadSystemAbility ret: %{public}d", result);
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "UnloadSA success.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "UnloadSA success");
|
||||
};
|
||||
handler_->PostTask(task, TASK_NAME, UNLOAD_DELAY_TIME);
|
||||
}
|
||||
|
||||
bool ServiceRouterMgrService::LoadAllBundleInfos()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "LoadAllBundleInfos start");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "start");
|
||||
bool ret = ServiceRouterDataMgr::GetInstance().LoadAllBundleInfos();
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "LoadAllBundleInfos end");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "end");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -120,12 +120,12 @@ bool ServiceRouterMgrService::InitEventRunnerAndHandler()
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
runner_ = EventRunner::Create(NAME_SERVICE_ROUTER_MGR_SERVICE);
|
||||
if (runner_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "%{public}s fail, Failed to init due to create runner error", __func__);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null runner_");
|
||||
return false;
|
||||
}
|
||||
handler_ = std::make_shared<EventHandler>(runner_);
|
||||
if (handler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "%{public}s fail, Failed to init due to create handler error", __func__);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null handler_");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -134,7 +134,7 @@ bool ServiceRouterMgrService::InitEventRunnerAndHandler()
|
||||
bool ServiceRouterMgrService::ServiceRouterMgrService::SubscribeCommonEvent()
|
||||
{
|
||||
if (eventSubscriber_ != nullptr) {
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "subscribeCommonEvent already subscribed.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Already subscribed");
|
||||
return true;
|
||||
}
|
||||
EventFwk::MatchingSkills matchingSkills;
|
||||
@@ -148,17 +148,17 @@ bool ServiceRouterMgrService::ServiceRouterMgrService::SubscribeCommonEvent()
|
||||
eventSubscriber_ = std::make_shared<SrCommonEventSubscriber>(subscribeInfo);
|
||||
eventSubscriber_->SetEventHandler(handler_);
|
||||
if (!EventFwk::CommonEventManager::SubscribeCommonEvent(eventSubscriber_)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "subscribeCommonEvent subscribed failure.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Subscribed failed");
|
||||
return false;
|
||||
};
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "subscribeCommonEvent subscribed success.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Subscribed success");
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t ServiceRouterMgrService::QueryBusinessAbilityInfos(const BusinessAbilityFilter &filter,
|
||||
std::vector< BusinessAbilityInfo> &businessAbilityInfos)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "coldStart:");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "coldStart");
|
||||
DelayUnloadTask();
|
||||
return ServiceRouterDataMgr::GetInstance().QueryBusinessAbilityInfos(filter, businessAbilityInfos);
|
||||
}
|
||||
@@ -166,14 +166,14 @@ int32_t ServiceRouterMgrService::QueryBusinessAbilityInfos(const BusinessAbility
|
||||
int32_t ServiceRouterMgrService::QueryPurposeInfos(const Want &want, const std::string purposeName,
|
||||
std::vector<PurposeInfo> &purposeInfos)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "coldStart:");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "coldStart");
|
||||
DelayUnloadTask();
|
||||
return ServiceRouterDataMgr::GetInstance().QueryPurposeInfos(want, purposeName, purposeInfos);
|
||||
}
|
||||
|
||||
int32_t ServiceRouterMgrService::StartUIExtensionAbility(const sptr<SessionInfo> &sessionInfo, int32_t userId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "StartUIExtensionAbility start:");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
DelayUnloadTask();
|
||||
return IN_PROCESS_CALL(AbilityManagerClient::GetInstance()->StartUIExtensionAbility(sessionInfo, userId));
|
||||
}
|
||||
@@ -181,7 +181,7 @@ int32_t ServiceRouterMgrService::StartUIExtensionAbility(const sptr<SessionInfo>
|
||||
int32_t ServiceRouterMgrService::ConnectUIExtensionAbility(const Want &want, const sptr<IAbilityConnection> &connect,
|
||||
const sptr<SessionInfo> &sessionInfo, int32_t userId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ConnectUIExtensionAbility start:");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
DelayUnloadTask();
|
||||
return IN_PROCESS_CALL(AbilityManagerClient::GetInstance()->
|
||||
ConnectUIExtensionAbility(want, connect, sessionInfo, userId));
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
ServiceRouterMgrStub::ServiceRouterMgrStub()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub instance is created");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "instance created");
|
||||
}
|
||||
|
||||
ServiceRouterMgrStub::~ServiceRouterMgrStub()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub instance is destroyed");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "instance destroyed");
|
||||
}
|
||||
|
||||
int ServiceRouterMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
@@ -43,7 +43,7 @@ int ServiceRouterMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me
|
||||
std::u16string descriptor = ServiceRouterMgrStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "local descriptor is not equal to remote");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "descriptor diff from remote");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -53,14 +53,14 @@ int ServiceRouterMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me
|
||||
case static_cast<uint32_t>(IServiceRouterManager::Message::QUERY_PURPOSE_INFOS):
|
||||
return HandleQueryPurposeInfos(data, reply);
|
||||
default:
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub receives unknown code, code = %{public}d", code);
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "receives unknown code: %{public}d", code);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
}
|
||||
|
||||
int ServiceRouterMgrStub::HandleQueryBusinessAbilityInfos(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub handle query service infos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
if (!VerifySystemApp()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "verify system app failed");
|
||||
return ERR_BUNDLE_MANAGER_SYSTEM_API_DENIED;
|
||||
@@ -83,7 +83,7 @@ int ServiceRouterMgrStub::HandleQueryBusinessAbilityInfos(MessageParcel &data, M
|
||||
}
|
||||
if (ret == ERR_OK) {
|
||||
if (!WriteParcelableVector<BusinessAbilityInfo>(infos, reply)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryBusinessAbilityInfos write failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write infos failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ int ServiceRouterMgrStub::HandleQueryBusinessAbilityInfos(MessageParcel &data, M
|
||||
|
||||
int ServiceRouterMgrStub::HandleQueryPurposeInfos(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub handle query purpose infos");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
if (!VerifyCallingPermission(Constants::PERMISSION_GET_BUNDLE_INFO_PRIVILEGED)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "verify GET_BUNDLE_INFO_PRIVILEGED failed");
|
||||
return ERR_BUNDLE_MANAGER_PERMISSION_DENIED;
|
||||
@@ -111,7 +111,7 @@ int ServiceRouterMgrStub::HandleQueryPurposeInfos(MessageParcel &data, MessagePa
|
||||
}
|
||||
if (ret == ERR_OK) {
|
||||
if (!WriteParcelableVector<PurposeInfo>(infos, reply)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryPurposeInfos write failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write infos failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ int ServiceRouterMgrStub::HandleQueryPurposeInfos(MessageParcel &data, MessagePa
|
||||
|
||||
int ServiceRouterMgrStub::HandleStartUIExtensionAbility(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub handle start ui extension ability");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
sptr<SessionInfo> sessionInfo = nullptr;
|
||||
if (data.ReadBool()) {
|
||||
sessionInfo = data.ReadParcelable<SessionInfo>();
|
||||
@@ -136,7 +136,7 @@ int ServiceRouterMgrStub::HandleStartUIExtensionAbility(MessageParcel &data, Mes
|
||||
|
||||
int ServiceRouterMgrStub::HandleConnectUIExtensionAbility(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "ServiceRouterMgrStub handle connect ui extension ability");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
std::unique_ptr<Want> want(data.ReadParcelable<Want>());
|
||||
if (want == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "ReadParcelable<want> failed");
|
||||
@@ -161,7 +161,7 @@ int ServiceRouterMgrStub::HandleConnectUIExtensionAbility(MessageParcel &data, M
|
||||
|
||||
bool ServiceRouterMgrStub::VerifyCallingPermission(const std::string &permissionName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "VerifyCallingPermission permission %{public}s", permissionName.c_str());
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Verify: %{public}s", permissionName.c_str());
|
||||
OHOS::Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
|
||||
OHOS::Security::AccessToken::ATokenTypeEnum tokenType =
|
||||
OHOS::Security::AccessToken::AccessTokenKit::GetTokenTypeFlag(callerToken);
|
||||
@@ -178,7 +178,7 @@ bool ServiceRouterMgrStub::VerifyCallingPermission(const std::string &permission
|
||||
|
||||
bool ServiceRouterMgrStub::VerifySystemApp()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "verifying systemApp");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Called");
|
||||
Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
|
||||
Security::AccessToken::ATokenTypeEnum tokenType =
|
||||
Security::AccessToken::AccessTokenKit::GetTokenTypeFlag(callerToken);
|
||||
@@ -198,13 +198,13 @@ template <typename T>
|
||||
bool ServiceRouterMgrStub::WriteParcelableVector(std::vector<T> &parcelableVector, Parcel &reply)
|
||||
{
|
||||
if (!reply.WriteInt32(parcelableVector.size())) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write ParcelableVector size failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write size failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto &parcelable : parcelableVector) {
|
||||
if (!reply.WriteParcelable(&parcelable)) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write ParcelableVector failed");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "write failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace AbilityRuntime {
|
||||
SrCommonEventSubscriber::SrCommonEventSubscriber(const EventFwk::CommonEventSubscribeInfo &subscribeInfo)
|
||||
: EventFwk::CommonEventSubscriber(subscribeInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SrCommonEventSubscriber created");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "created");
|
||||
}
|
||||
|
||||
SrCommonEventSubscriber::~SrCommonEventSubscriber()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "SrCommonEventSubscriber destroyed");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "destroyed");
|
||||
}
|
||||
|
||||
void SrCommonEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &eventData)
|
||||
@@ -38,16 +38,16 @@ void SrCommonEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &ev
|
||||
const AAFwk::Want& want = eventData.GetWant();
|
||||
std::string action = want.GetAction();
|
||||
std::string bundleName = want.GetElement().GetBundleName();
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "action:%{public}s.", action.c_str());
|
||||
if (action.empty() || eventHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "failed, empty action: %{public}s, or invalid event handler", action.c_str());
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Invalid action or event handler");
|
||||
return;
|
||||
}
|
||||
if (bundleName.empty() && action != EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "failed, invalid param, action: %{public}s, bundleName: %{public}s",
|
||||
action.c_str(), bundleName.c_str());
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "invalid param, bundleName: %{public}s",
|
||||
bundleName.c_str());
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "action:%{public}s.", action.c_str());
|
||||
std::weak_ptr<SrCommonEventSubscriber> weakThis = shared_from_this();
|
||||
if (action == EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED) {
|
||||
int32_t userId = eventData.GetCode();
|
||||
@@ -79,7 +79,7 @@ void SrCommonEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &ev
|
||||
};
|
||||
eventHandler_->PostTask(task, "SrCommonEventSubscriber:DeleteBundleInfo");
|
||||
} else {
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "invalid action.");
|
||||
TAG_LOGW(AAFwkTag::SER_ROUTER, "Invalid action");
|
||||
}
|
||||
}
|
||||
} // AbilityRuntime
|
||||
|
||||
@@ -50,14 +50,14 @@ int32_t SrSamgrHelper::GetCurrentActiveUserId()
|
||||
std::vector<int32_t> activeIds;
|
||||
int ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(activeIds);
|
||||
if (ret != 0) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryActiveOsAccountIds failed ret:%{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Query error:%{public}d", ret);
|
||||
return Constants::INVALID_USERID;
|
||||
}
|
||||
if (activeIds.empty()) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryActiveOsAccountIds activeIds empty");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "activeIds empty");
|
||||
return Constants::INVALID_USERID;
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "QueryActiveOsAccountIds activeIds ret:%{public}d", activeIds[0]);
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "activeId:%{public}d", activeIds[0]);
|
||||
return activeIds[0];
|
||||
#else
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "ACCOUNT_ENABLE is false");
|
||||
@@ -72,28 +72,28 @@ void SrSamgrHelper::ConnectBundleMgrLocked()
|
||||
}
|
||||
sptr<ISystemAbilityManager> saManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (saManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "failed to get bms saManager.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Get saManager failed");
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remoteObj = saManager->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "failed to get bms remoteObj.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Get remoteObj failed");
|
||||
return;
|
||||
}
|
||||
|
||||
deathRecipient_ = sptr<IRemoteObject::DeathRecipient>(new (std::nothrow) BmsDeathRecipient());
|
||||
if (deathRecipient_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Failed to create BmsDeathRecipient!");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Create deathRecipient_ failed");
|
||||
return;
|
||||
}
|
||||
if ((remoteObj->IsProxyObject()) && (!remoteObj->AddDeathRecipient(deathRecipient_))) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Add death recipient to bms failed.");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "Add death recipient failed");
|
||||
return;
|
||||
}
|
||||
iBundleMgr_ = iface_cast<IBundleMgr>(remoteObj);
|
||||
if (iBundleMgr_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "iface_cast failed, failed to get bms");
|
||||
TAG_LOGE(AAFwkTag::SER_ROUTER, "null iBundleMgr_");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void SrSamgrHelper::ResetProxy(const wptr<IRemoteObject> &remote)
|
||||
|
||||
auto serviceRemote = iBundleMgr_->AsObject();
|
||||
if ((serviceRemote != nullptr) && (serviceRemote == remote.promote())) {
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "To remove death recipient.");
|
||||
TAG_LOGD(AAFwkTag::SER_ROUTER, "Remove death recipient");
|
||||
serviceRemote->RemoveDeathRecipient(deathRecipient_);
|
||||
iBundleMgr_ = nullptr;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void SrSamgrHelper::ResetProxy(const wptr<IRemoteObject> &remote)
|
||||
|
||||
void SrSamgrHelper::BmsDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "BmsDeathRecipient handle remote abilityms died.");
|
||||
TAG_LOGI(AAFwkTag::SER_ROUTER, "Called");
|
||||
SrSamgrHelper::GetInstance().ResetProxy(remote);
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
|
||||
@@ -54,19 +54,19 @@ constexpr const char* JUMP_INTERCEPTOR_DIALOG_CALLER_PKG = "interceptor_callerPk
|
||||
|
||||
#define CHECK_POINTER_CONTINUE(object) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pointer is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null pointer"); \
|
||||
continue; \
|
||||
}
|
||||
|
||||
#define CHECK_POINTER_IS_NULLPTR(object) \
|
||||
if (object == nullptr) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pointer is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null pointer"); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CHECK_POINTER(object) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pointer is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null pointer"); \
|
||||
return; \
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ constexpr const char* JUMP_INTERCEPTOR_DIALOG_CALLER_PKG = "interceptor_callerPk
|
||||
|
||||
#define CHECK_POINTER_AND_RETURN(object, value) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pointer is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null pointer"); \
|
||||
return value; \
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ constexpr const char* JUMP_INTERCEPTOR_DIALOG_CALLER_PKG = "interceptor_callerPk
|
||||
|
||||
#define CHECK_POINTER_RETURN_BOOL(object) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pointer is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null pointer"); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
[[maybe_unused]] static bool ParseJumpInterceptorWant(Want &targetWant, const std::string callerPkg)
|
||||
{
|
||||
if (callerPkg.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s error, get empty callerPkg.", __func__);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "empty callerPkg");
|
||||
return false;
|
||||
}
|
||||
targetWant.SetParam(JUMP_INTERCEPTOR_DIALOG_CALLER_PKG, callerPkg);
|
||||
@@ -185,7 +185,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
std::string &targetPkg)
|
||||
{
|
||||
if (!targetWant.HasParameter(JUMP_INTERCEPTOR_DIALOG_CALLER_PKG)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s error, the interceptor parameter invalid.", __func__);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid interceptor param");
|
||||
return false;
|
||||
}
|
||||
callerPkg = targetWant.GetStringParam(JUMP_INTERCEPTOR_DIALOG_CALLER_PKG);
|
||||
@@ -197,12 +197,12 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
int32_t userId)
|
||||
{
|
||||
if (callerPkg.empty() || targetPkg.empty()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "get invalid inputs");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid inputs");
|
||||
return false;
|
||||
}
|
||||
auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get bundle manager helper failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetBundleManagerHelper failed");
|
||||
return false;
|
||||
}
|
||||
auto appControlMgr = bundleMgrHelper->GetAppControlProxy();
|
||||
@@ -219,7 +219,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
{
|
||||
const std::unordered_set<std::string> whiteListDlpSet = { BUNDLE_NAME_SELECTOR_DIALOG };
|
||||
if (whiteListDlpSet.find(want.GetBundle()) != whiteListDlpSet.end()) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "%{public}s, enter special app", __func__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "enter special app");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
{
|
||||
auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get bundle manager helper failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetBundleManagerHelper failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,11 +251,11 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
bool getTargetResult = IN_PROCESS_CALL(bundleMgrHelper->GetApplicationInfo(targetBundleName,
|
||||
AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO, userId, targetAppInfo));
|
||||
if (!getTargetResult) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get targetAppInfo failed in check atomic service.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get targetAppInfo failed");
|
||||
return false;
|
||||
}
|
||||
if (targetAppInfo.bundleType == AppExecFwk::BundleType::ATOMIC_SERVICE) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "the target is atomic service");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "target is atomic service");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -263,18 +263,18 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
std::string callerBundleName;
|
||||
ErrCode err = IN_PROCESS_CALL(bundleMgrHelper->GetNameForUid(callerUid, callerBundleName));
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get bms failed in check atomic service.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get bms failed");
|
||||
return false;
|
||||
}
|
||||
AppExecFwk::ApplicationInfo callerAppInfo;
|
||||
bool getCallerResult = IN_PROCESS_CALL(bundleMgrHelper->GetApplicationInfo(callerBundleName,
|
||||
AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO, userId, callerAppInfo));
|
||||
if (!getCallerResult) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get callerAppInfo failed in check atomic service.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get callerAppInfo failed");
|
||||
return false;
|
||||
}
|
||||
if (callerAppInfo.bundleType == AppExecFwk::BundleType::ATOMIC_SERVICE) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "the caller is atomic service");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "caller is atomic service");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -321,10 +321,10 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
windowMode == AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_PRIMARY ||
|
||||
windowMode == AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_SECONDARY)) {
|
||||
want.SetParam(Want::PARAM_RESV_WINDOW_MODE, windowMode);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "set parameter windownMode for inner application split-screen mode");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "set windownMode for inner application split-screen mode");
|
||||
} else if (windowMode == AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_FULLSCREEN) {
|
||||
want.SetParam(Want::PARAM_RESV_WINDOW_MODE, windowMode);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "set parameter windownMode for full screen mode");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "set windownMode for full screen mode");
|
||||
} else {
|
||||
RemoveWindowModeKey(want);
|
||||
}
|
||||
@@ -336,7 +336,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
|
||||
std::string appGalleryBundleName;
|
||||
auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper();
|
||||
if (bundleMgrHelper == nullptr || !bundleMgrHelper->QueryAppGalleryBundleName(appGalleryBundleName)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get bundle manager helper failed or QueryAppGalleryBundleName failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetBundleManagerHelper or QueryAppGalleryBundleName failed");
|
||||
appGalleryBundleName = MARKET_BUNDLE_NAME;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ constexpr const char* BOOTEVENT_BOOT_COMPLETED = "bootevent.boot.completed";
|
||||
[[maybe_unused]] static void AppFwkBootEventCallback(const char *key, const char *value, void *context)
|
||||
{
|
||||
if (strcmp(key, "bootevent.boot.completed") == 0 && strcmp(value, "true") == 0) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "%{public}s %{public}s is true", __func__, key);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "%{public}s is true", key);
|
||||
Want want;
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_BOOT_COMPLETED);
|
||||
EventFwk::CommonEventData commonData {want};
|
||||
EventFwk::CommonEventManager::PublishCommonEvent(commonData);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "%{public}s BootEvent completed", __func__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "BootEvent completed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
|
||||
}
|
||||
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||
if (abilityRecord == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability has already been destroyed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability destroyed");
|
||||
return true;
|
||||
}
|
||||
if (abilityRecord->GetAppIndex() <= AbilityRuntime::GlobalConstant::MAX_APP_CLONE_INDEX) {
|
||||
@@ -60,11 +60,11 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
|
||||
Security::DlpPermission::SandBoxExternalAuthorType authResult;
|
||||
int result = Dlp::GetSandboxExternalAuthorization(uid, want, authResult);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetSandboxExternalAuthorization failed %{public}d.", result);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetSandboxExternalAuthorization failed %{public}d", result);
|
||||
return false;
|
||||
}
|
||||
if (authResult != Security::DlpPermission::SandBoxExternalAuthorType::ALLOW_START_ABILITY) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Auth failed, not allow start %{public}d.", uid);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Auth failed, not allow start %{public}d", uid);
|
||||
return false;
|
||||
}
|
||||
#endif // WITH_DLP
|
||||
@@ -98,11 +98,11 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
|
||||
Security::DlpPermission::SandBoxExternalAuthorType authResult;
|
||||
int result = Dlp::GetSandboxExternalAuthorization(uid, want, authResult);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetSandboxExternalAuthorization failed %{public}d.", result);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetSandboxExternalAuthorization failed %{public}d", result);
|
||||
return false;
|
||||
}
|
||||
if (authResult != Security::DlpPermission::SandBoxExternalAuthorType::ALLOW_START_ABILITY) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Auth failed, not allow start %{public}d.", uid);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Auth failed, not allow start %{public}d", uid);
|
||||
return false;
|
||||
}
|
||||
#endif // WITH_DLP
|
||||
@@ -118,11 +118,11 @@ static bool CheckCallerIsDlpManager(const std::shared_ptr<AppExecFwk::BundleMgrH
|
||||
std::string bundleName;
|
||||
auto callerUid = IPCSkeleton::GetCallingUid();
|
||||
if (IN_PROCESS_CALL(bundleManager->GetNameForUid(callerUid, bundleName)) != ERR_OK) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Get Bundle Name failed.");
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Get Bundle Name failed");
|
||||
return false;
|
||||
}
|
||||
if (bundleName != "com.ohos.dlpmanager") {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Wrong Caller.");
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Wrong Caller");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -27,7 +27,7 @@ std::recursive_mutex AbilityAutoStartupClient::mutex_;
|
||||
|
||||
#define CHECK_POINTER_RETURN_NOT_CONNECTED(object) \
|
||||
if (!(object)) { \
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "proxy is nullptr."); \
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null proxy"); \
|
||||
return ABILITY_SERVICE_NOT_CONNECTED; \
|
||||
}
|
||||
|
||||
@@ -66,27 +66,27 @@ ErrCode AbilityAutoStartupClient::Connect()
|
||||
}
|
||||
sptr<ISystemAbilityManager> systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Fail to get registry.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get registry failed");
|
||||
return GET_ABILITY_SERVICE_FAILED;
|
||||
}
|
||||
sptr<IRemoteObject> remoteObj = systemManager->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
|
||||
if (remoteObj == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Fail to connect ability manager service.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Connect AbilityManagerService failed");
|
||||
return GET_ABILITY_SERVICE_FAILED;
|
||||
}
|
||||
|
||||
deathRecipient_ = sptr<IRemoteObject::DeathRecipient>(new AbilityMgrDeathRecipient());
|
||||
if (deathRecipient_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to create AbilityMgrDeathRecipient!");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Create AbilityMgrDeathRecipient failed");
|
||||
return GET_ABILITY_SERVICE_FAILED;
|
||||
}
|
||||
if ((remoteObj->IsProxyObject()) && (!remoteObj->AddDeathRecipient(deathRecipient_))) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Add death recipient to AbilityManagerService failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Add death recipient to AbilityManagerService failed");
|
||||
return GET_ABILITY_SERVICE_FAILED;
|
||||
}
|
||||
|
||||
proxy_ = iface_cast<IAbilityManager>(remoteObj);
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Connect ability manager service success.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Connect AbilityManagerService success");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ ErrCode AbilityAutoStartupClient::QueryAllAutoStartupApplications(std::vector<Au
|
||||
|
||||
void AbilityAutoStartupClient::AbilityMgrDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::AUTO_STARTUP, "AbilityMgrDeathRecipient handle remote died.");
|
||||
TAG_LOGI(AAFwkTag::AUTO_STARTUP, "Handle remote died");
|
||||
AbilityAutoStartupClient::GetInstance()->ResetProxy(remote);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void AbilityAutoStartupClient::ResetProxy(wptr<IRemoteObject> remote)
|
||||
|
||||
auto serviceRemote = proxy_->AsObject();
|
||||
if ((serviceRemote != nullptr) && (serviceRemote == remote.promote())) {
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "To remove death recipient.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Remove death recipient");
|
||||
serviceRemote->RemoveDeathRecipient(deathRecipient_);
|
||||
proxy_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ DistributedKv::Status AbilityAutoStartupDataManager::GetKvStore()
|
||||
|
||||
DistributedKv::Status status = dataManager_.GetSingleKvStore(options, APP_ID, STORE_ID, kvStorePtr_);
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Return error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Error: %{public}d", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get kvStore success.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get kvStore success");
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ bool AbilityAutoStartupDataManager::CheckKvStore()
|
||||
if (status == DistributedKv::Status::SUCCESS && kvStorePtr_ != nullptr) {
|
||||
return true;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Try times: %{public}d.", tryTimes);
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Try times: %{public}d", tryTimes);
|
||||
usleep(CHECK_INTERVAL);
|
||||
tryTimes--;
|
||||
}
|
||||
@@ -91,19 +91,19 @@ int32_t AbilityAutoStartupDataManager::InsertAutoStartupData(
|
||||
const AutoStartupInfo &info, bool isAutoStartup, bool isEdmForce)
|
||||
{
|
||||
if (info.bundleName.empty() || info.abilityName.empty() || info.accessTokenId.empty() || info.userId == -1) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Invalid value.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Invalid value");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ int32_t AbilityAutoStartupDataManager::InsertAutoStartupData(
|
||||
}
|
||||
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Insert data to kvStore error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Insert data to kvStore error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -127,19 +127,19 @@ int32_t AbilityAutoStartupDataManager::UpdateAutoStartupData(
|
||||
const AutoStartupInfo &info, bool isAutoStartup, bool isEdmForce)
|
||||
{
|
||||
if (info.bundleName.empty() || info.abilityName.empty() || info.accessTokenId.empty() || info.userId == -1) {
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value!");
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ int32_t AbilityAutoStartupDataManager::UpdateAutoStartupData(
|
||||
status = kvStorePtr_->Delete(key);
|
||||
}
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
DistributedKv::Value value = ConvertAutoStartupStatusToValue(isAutoStartup, isEdmForce, info.abilityTypeName);
|
||||
@@ -160,7 +160,7 @@ int32_t AbilityAutoStartupDataManager::UpdateAutoStartupData(
|
||||
status = kvStorePtr_->Put(key, value);
|
||||
}
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Insert data to kvStore error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Insert data to kvStore error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
@@ -170,19 +170,19 @@ int32_t AbilityAutoStartupDataManager::UpdateAutoStartupData(
|
||||
int32_t AbilityAutoStartupDataManager::DeleteAutoStartupData(const AutoStartupInfo &info)
|
||||
{
|
||||
if (info.bundleName.empty() || info.abilityName.empty() || info.accessTokenId.empty() || info.userId == -1) {
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value!");
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ int32_t AbilityAutoStartupDataManager::DeleteAutoStartupData(const AutoStartupIn
|
||||
}
|
||||
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -206,22 +206,22 @@ int32_t AbilityAutoStartupDataManager::DeleteAutoStartupData(const std::string &
|
||||
int32_t userId;
|
||||
if (DelayedSingleton<AppExecFwk::OsAccountManagerWrapper>::GetInstance()->
|
||||
GetOsAccountLocalIdFromUid(uid, userId) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get GetOsAccountLocalIdFromUid failed.");
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "GetOsAccountLocalIdFromUid failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
uint32_t accessTokenId = Security::AccessToken::AccessTokenKit::GetHapTokenID(userId, bundleName, 0);
|
||||
auto accessTokenIdStr = std::to_string(accessTokenId);
|
||||
if (bundleName.empty() || accessTokenIdStr.empty()) {
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value!");
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "bundleName: %{public}s, accessTokenId: %{public}s.",
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "bundleName: %{public}s, accessTokenId: %{public}s",
|
||||
bundleName.c_str(), accessTokenIdStr.c_str());
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ int32_t AbilityAutoStartupDataManager::DeleteAutoStartupData(const std::string &
|
||||
std::vector<DistributedKv::Entry> allEntries;
|
||||
DistributedKv::Status status = kvStorePtr_->GetEntries(nullptr, allEntries);
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ int32_t AbilityAutoStartupDataManager::DeleteAutoStartupData(const std::string &
|
||||
status = kvStorePtr_->Delete(item.key);
|
||||
}
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Delete data from kvStore error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
}
|
||||
@@ -253,20 +253,20 @@ AutoStartupStatus AbilityAutoStartupDataManager::QueryAutoStartupData(const Auto
|
||||
{
|
||||
AutoStartupStatus asustatus;
|
||||
if (info.bundleName.empty() || info.abilityName.empty() || info.accessTokenId.empty() || info.userId == -1) {
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value!");
|
||||
TAG_LOGW(AAFwkTag::AUTO_STARTUP, "Invalid value");
|
||||
asustatus.code = ERR_INVALID_VALUE;
|
||||
return asustatus;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
asustatus.code = ERR_NO_INIT;
|
||||
return asustatus;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ AutoStartupStatus AbilityAutoStartupDataManager::QueryAutoStartupData(const Auto
|
||||
std::vector<DistributedKv::Entry> allEntries;
|
||||
DistributedKv::Status status = kvStorePtr_->GetEntries(nullptr, allEntries);
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d", status);
|
||||
asustatus.code = ERR_INVALID_OPERATION;
|
||||
return asustatus;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ int32_t AbilityAutoStartupDataManager::QueryAllAutoStartupApplications(std::vect
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ int32_t AbilityAutoStartupDataManager::QueryAllAutoStartupApplications(std::vect
|
||||
std::vector<DistributedKv::Entry> allEntries;
|
||||
DistributedKv::Status status = kvStorePtr_->GetEntries(nullptr, allEntries);
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ int32_t AbilityAutoStartupDataManager::QueryAllAutoStartupApplications(std::vect
|
||||
infoList.emplace_back(ConvertAutoStartupInfoFromKeyAndValue(item.key, item.value));
|
||||
}
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "InfoList.size: %{public}zu.", infoList.size());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "InfoList.size: %{public}zu", infoList.size());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ int32_t AbilityAutoStartupDataManager::GetCurrentAppAutoStartupData(
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
|
||||
if (!CheckKvStore()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "kvStore is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null kvStore");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ int32_t AbilityAutoStartupDataManager::GetCurrentAppAutoStartupData(
|
||||
std::vector<DistributedKv::Entry> allEntries;
|
||||
DistributedKv::Status status = kvStorePtr_->GetEntries(nullptr, allEntries);
|
||||
if (status != DistributedKv::Status::SUCCESS) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d.", status);
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get entries error: %{public}d", status);
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ int32_t AbilityAutoStartupDataManager::GetCurrentAppAutoStartupData(
|
||||
infoList.emplace_back(ConvertAutoStartupInfoFromKeyAndValue(item.key, item.value));
|
||||
}
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "InfoList.size: %{public}zu.", infoList.size());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "InfoList.size: %{public}zu", infoList.size());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ DistributedKv::Value AbilityAutoStartupDataManager::ConvertAutoStartupStatusToVa
|
||||
{ JSON_KEY_TYPE_NAME, abilityTypeName },
|
||||
};
|
||||
DistributedKv::Value value(jsonObject.dump());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "value: %{public}s.", value.ToString().c_str());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "value: %{public}s", value.ToString().c_str());
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ void AbilityAutoStartupDataManager::ConvertAutoStartupStatusFromValue(
|
||||
{
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(value.ToString(), nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse json string.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse json string failed");
|
||||
return;
|
||||
}
|
||||
if (jsonObject.contains(JSON_KEY_IS_AUTO_STARTUP) && jsonObject[JSON_KEY_IS_AUTO_STARTUP].is_boolean()) {
|
||||
@@ -392,7 +392,7 @@ DistributedKv::Key AbilityAutoStartupDataManager::ConvertAutoStartupDataToKey(co
|
||||
{ JSON_KEY_USERID, info.userId },
|
||||
};
|
||||
DistributedKv::Key key(jsonObject.dump());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "key: %{public}s.", key.ToString().c_str());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "key: %{public}s", key.ToString().c_str());
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ AutoStartupInfo AbilityAutoStartupDataManager::ConvertAutoStartupInfoFromKeyAndV
|
||||
AutoStartupInfo info;
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(key.ToString(), nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse jsonObject.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse jsonObject failed");
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ AutoStartupInfo AbilityAutoStartupDataManager::ConvertAutoStartupInfoFromKeyAndV
|
||||
|
||||
nlohmann::json jsonValueObject = nlohmann::json::parse(value.ToString(), nullptr, false);
|
||||
if (jsonValueObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse jsonValueObject.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse jsonValueObject failed");
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ bool AbilityAutoStartupDataManager::IsEqual(const DistributedKv::Key &key, const
|
||||
{
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(key.ToString(), nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse json string.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse json string failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ bool AbilityAutoStartupDataManager::IsEqual(const DistributedKv::Key &key, const
|
||||
{
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(key.ToString(), nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse json string.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse json string failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ bool AbilityAutoStartupDataManager::IsEqual(const DistributedKv::Key &key, int32
|
||||
{
|
||||
nlohmann::json jsonObject = nlohmann::json::parse(key.ToString(), nullptr, false);
|
||||
if (jsonObject.is_discarded()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to parse json string.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Parse json string failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ int32_t AbilityAutoStartupService::RegisterAutoStartupSystemCallback(const sptr<
|
||||
SetDeathRecipient(
|
||||
callback, new (std::nothrow) AbilityAutoStartupService::ClientDeathRecipient(weak_from_this()));
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Callback is already exist.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Callback already exist");
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -85,7 +85,7 @@ int32_t AbilityAutoStartupService::UnregisterAutoStartupSystemCallback(const spt
|
||||
}
|
||||
}
|
||||
if (!isFound) {
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Callback is not exist.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Callback not exist");
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -95,7 +95,7 @@ int32_t AbilityAutoStartupService::SetApplicationAutoStartup(const AutoStartupIn
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"Called, bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
int32_t code = CheckPermissionForSystem();
|
||||
@@ -108,12 +108,12 @@ int32_t AbilityAutoStartupService::SetApplicationAutoStartup(const AutoStartupIn
|
||||
std::string abilityTypeName;
|
||||
std::string accessTokenId;
|
||||
if (!GetAbilityData(info, isVisible, abilityTypeName, accessTokenId, userId)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get ability data.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get ability data failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
if (!isVisible) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability is not visible.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability not visible");
|
||||
return ABILITY_VISIBLE_FALSE_DENY_REQUEST;
|
||||
}
|
||||
|
||||
@@ -130,13 +130,13 @@ int32_t AbilityAutoStartupService::InnerSetApplicationAutoStartup(const AutoStar
|
||||
AutoStartupStatus status =
|
||||
DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->QueryAutoStartupData(info);
|
||||
if (status.code != ERR_OK && status.code != ERR_NAME_NOT_FOUND) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed");
|
||||
return status.code;
|
||||
}
|
||||
|
||||
int32_t result;
|
||||
if (status.code == ERR_NAME_NOT_FOUND) {
|
||||
TAG_LOGI(AAFwkTag::AUTO_STARTUP, "Query data is not exist.");
|
||||
TAG_LOGI(AAFwkTag::AUTO_STARTUP, "Not found");
|
||||
result =
|
||||
DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->InsertAutoStartupData(info, true, false);
|
||||
if (result == ERR_OK) {
|
||||
@@ -145,7 +145,7 @@ int32_t AbilityAutoStartupService::InnerSetApplicationAutoStartup(const AutoStar
|
||||
return result;
|
||||
}
|
||||
if (status.isEdmForce) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Edm application abnormal.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Edm application abnormal");
|
||||
return ERR_EDM_APP_CONTROLLED;
|
||||
}
|
||||
if (!status.isAutoStartup) {
|
||||
@@ -163,7 +163,7 @@ int32_t AbilityAutoStartupService::CancelApplicationAutoStartup(const AutoStartu
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"Called, bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
int32_t code = CheckPermissionForSystem();
|
||||
@@ -176,12 +176,12 @@ int32_t AbilityAutoStartupService::CancelApplicationAutoStartup(const AutoStartu
|
||||
std::string accessTokenId;
|
||||
int32_t userId;
|
||||
if (!GetAbilityData(info, isVisible, abilityTypeName, accessTokenId, userId)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get ability data.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get ability data failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
if (!isVisible) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability is not visible.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability not visible");
|
||||
return ABILITY_VISIBLE_FALSE_DENY_REQUEST;
|
||||
}
|
||||
|
||||
@@ -198,12 +198,12 @@ int32_t AbilityAutoStartupService::InnerCancelApplicationAutoStartup(const AutoS
|
||||
AutoStartupStatus status =
|
||||
DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->QueryAutoStartupData(info);
|
||||
if (status.code != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed");
|
||||
return status.code;
|
||||
}
|
||||
|
||||
if (status.isEdmForce) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Edm application abnormal.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Edm application abnormal");
|
||||
return ERR_EDM_APP_CONTROLLED;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ int32_t AbilityAutoStartupService::QueryAllAutoStartupApplications(std::vector<A
|
||||
int32_t code = CheckPermissionForEDM();
|
||||
code = code == ERR_OK ? code : CheckPermissionForSystem();
|
||||
if (code != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Permission verification failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Permission verification failed");
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ int32_t AbilityAutoStartupService::QueryAllAutoStartupApplicationsWithoutPermiss
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "called");
|
||||
if (!system::GetBoolParameter(PRODUCT_APPBOOT_SETTING_ENABLED, false)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Product configuration item is disable.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Disabled Product config");
|
||||
return ERR_NOT_SUPPORTED_PRODUCT_TYPE;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ int32_t AbilityAutoStartupService::CheckAutoStartupData(const std::string &bundl
|
||||
int32_t result = DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->GetCurrentAppAutoStartupData(
|
||||
bundleName, infoList, accessTokenIdStr);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get auto startup data.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get auto startup data failed");
|
||||
return result;
|
||||
}
|
||||
if (infoList.size() == 0) {
|
||||
@@ -284,7 +284,7 @@ int32_t AbilityAutoStartupService::CheckAutoStartupData(const std::string &bundl
|
||||
}
|
||||
|
||||
if (!isFound) {
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Current bundleName not found in Datebase.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Current bundleName not found");
|
||||
return DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->DeleteAutoStartupData(bundleName, uid);
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -294,7 +294,7 @@ void AbilityAutoStartupService::ExecuteCallbacks(bool isCallOn, const AutoStartu
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"Called, bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
for (auto item : callbackVector_) {
|
||||
@@ -326,7 +326,7 @@ void AbilityAutoStartupService::SetDeathRecipient(
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "called");
|
||||
if (callback == nullptr || deathRecipient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "The callerToken or the deathRecipient is empty.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "CallerToken or deathRecipient empty");
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(deathRecipientsMutex_);
|
||||
@@ -336,7 +336,7 @@ void AbilityAutoStartupService::SetDeathRecipient(
|
||||
callback->AddDeathRecipient(deathRecipient);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "The deathRecipient has been added.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "DeathRecipient added");
|
||||
}
|
||||
|
||||
void AbilityAutoStartupService::CleanResource(const wptr<IRemoteObject> &remote)
|
||||
@@ -344,7 +344,7 @@ void AbilityAutoStartupService::CleanResource(const wptr<IRemoteObject> &remote)
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "called");
|
||||
auto object = remote.promote();
|
||||
if (object == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Remote object is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null remote obj");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void AbilityAutoStartupService::ClientDeathRecipient::OnRemoteDied(const wptr<IR
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "called");
|
||||
auto abilityAutoStartupService = weakPtr_.lock();
|
||||
if (abilityAutoStartupService == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "abilityAutoStartupService is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null abilityAutoStartupService");
|
||||
return;
|
||||
}
|
||||
abilityAutoStartupService->CleanResource(remote);
|
||||
@@ -400,23 +400,23 @@ std::string AbilityAutoStartupService::GetSelfApplicationBundleName()
|
||||
{
|
||||
auto bundleMgrClient = GetBundleMgrClient();
|
||||
if (bundleMgrClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get BundleMgrClient.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get BundleMgrClient failed");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string bundleName;
|
||||
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
||||
if (IN_PROCESS_CALL(bundleMgrClient->GetNameForUid(callerUid, bundleName)) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get Bundle Name failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get Bundle Name failed");
|
||||
return "";
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get bundle name: %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get bundle name: %{public}s", bundleName.c_str());
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
bool AbilityAutoStartupService::CheckSelfApplication(const std::string &bundleName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Called, bundleName: %{public}s.", bundleName.c_str());
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Called, bundleName: %{public}s", bundleName.c_str());
|
||||
return GetSelfApplicationBundleName() == bundleName ? true : false;
|
||||
}
|
||||
|
||||
@@ -433,15 +433,15 @@ bool AbilityAutoStartupService::GetBundleInfo(const std::string &bundleName,
|
||||
if (userId == 0) {
|
||||
auto abilityMgr = DelayedSingleton<AbilityManagerService>::GetInstance();
|
||||
if (abilityMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "The abilityMgr is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null abilityMgr");
|
||||
return false;
|
||||
}
|
||||
userId = abilityMgr->GetUserId();
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Current userId: %{public}d.", userId);
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "userId: %{public}d", userId);
|
||||
auto bundleMgrHelper = DelayedSingleton<AppExecFwk::BundleMgrHelper>::GetInstance();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "null bundleMgrHelper");
|
||||
return false;
|
||||
}
|
||||
if (appIndex == 0) {
|
||||
@@ -449,7 +449,7 @@ bool AbilityAutoStartupService::GetBundleInfo(const std::string &bundleName,
|
||||
AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES | AppExecFwk::BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO;
|
||||
if (!IN_PROCESS_CALL(bundleMgrHelper->GetBundleInfo(
|
||||
bundleName, static_cast<AppExecFwk::BundleFlag>(flags), bundleInfo, userId))) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get bundle info.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get bundle info failed");
|
||||
return false;
|
||||
}
|
||||
} else if (appIndex <= GlobalConstant::MAX_APP_CLONE_INDEX) {
|
||||
@@ -460,12 +460,12 @@ bool AbilityAutoStartupService::GetBundleInfo(const std::string &bundleName,
|
||||
auto bundleMgrResult = IN_PROCESS_CALL(
|
||||
bundleMgrHelper->GetCloneBundleInfo(bundleName, bundleFlag, appIndex, bundleInfo, userId));
|
||||
if (bundleMgrResult != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "bundleMgrResult is not ERR_OK.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "error bundleMgrResult");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!IN_PROCESS_CALL(bundleMgrHelper->GetSandboxBundleInfo(bundleName, appIndex, userId, bundleInfo))) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "fail to GetSandboxBundleInfo.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "GetSandboxBundleInfo failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -477,7 +477,7 @@ bool AbilityAutoStartupService::GetAbilityData(const AutoStartupInfo &info, bool
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s,"
|
||||
" accessTokenId: %{public}s, userId: %{public}d.",
|
||||
" accessTokenId: %{public}s, userId: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(),
|
||||
info.abilityName.c_str(), info.accessTokenId.c_str(), info.userId);
|
||||
AppExecFwk::BundleInfo bundleInfo;
|
||||
@@ -496,7 +496,7 @@ bool AbilityAutoStartupService::GetAbilityData(const AutoStartupInfo &info, bool
|
||||
(info.moduleName.empty() || (abilityInfo.moduleName == info.moduleName))) {
|
||||
isVisible = abilityInfo.visible;
|
||||
abilityTypeName = GetAbilityTypeName(abilityInfo);
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get ability info success.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get ability info success");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -507,7 +507,7 @@ bool AbilityAutoStartupService::GetAbilityData(const AutoStartupInfo &info, bool
|
||||
if (info.moduleName.empty() || (extensionInfo.moduleName == info.moduleName)) {
|
||||
isVisible = extensionInfo.visible;
|
||||
abilityTypeName = GetExtensionTypeName(extensionInfo);
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get extension info success.");
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP, "Get extension info success");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -545,18 +545,18 @@ std::shared_ptr<AppExecFwk::BundleMgrClient> AbilityAutoStartupService::GetBundl
|
||||
int32_t AbilityAutoStartupService::CheckPermissionForSystem()
|
||||
{
|
||||
if (!system::GetBoolParameter(PRODUCT_APPBOOT_SETTING_ENABLED, false)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Product configuration item is disable.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Disabled Product config");
|
||||
return ERR_NOT_SUPPORTED_PRODUCT_TYPE;
|
||||
}
|
||||
|
||||
if (!PermissionVerification::GetInstance()->JudgeCallerIsAllowedToUseSystemAPI()) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "The caller is not system-app, can not use system-api.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Caller is not system-app, can not use system-api");
|
||||
return ERR_NOT_SYSTEM_APP;
|
||||
}
|
||||
|
||||
if (!PermissionVerification::GetInstance()->VerifyCallingPermission(
|
||||
PermissionConstants::PERMISSION_MANAGE_APP_BOOT)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Not have PERMISSION_MANAGE_APP_BOOT approval.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, " Verify PERMISSION_MANAGE_APP_BOOT failed");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
}
|
||||
|
||||
@@ -566,12 +566,12 @@ int32_t AbilityAutoStartupService::CheckPermissionForSystem()
|
||||
int32_t AbilityAutoStartupService::CheckPermissionForSelf(const std::string &bundleName)
|
||||
{
|
||||
if (!system::GetBoolParameter(PRODUCT_APPBOOT_SETTING_ENABLED, false)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Product configuration item is disable.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Disabled Product config");
|
||||
return ERR_NOT_SUPPORTED_PRODUCT_TYPE;
|
||||
}
|
||||
|
||||
if (!CheckSelfApplication(bundleName)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Not self application.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Not self application");
|
||||
return ERR_NOT_SELF_APPLICATION;
|
||||
}
|
||||
return ERR_OK;
|
||||
@@ -582,12 +582,12 @@ int32_t AbilityAutoStartupService::GetAbilityInfo(
|
||||
{
|
||||
bool isVisible = false;
|
||||
if (!GetAbilityData(info, isVisible, abilityTypeName, accessTokenId, userId)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Failed to get ability data.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Get ability data failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
if (!isVisible) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability is not visible.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Current ability not visible");
|
||||
return ABILITY_VISIBLE_FALSE_DENY_REQUEST;
|
||||
}
|
||||
|
||||
@@ -639,13 +639,13 @@ int32_t AbilityAutoStartupService::InnerApplicationAutoStartupByEDM(const AutoSt
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::AUTO_STARTUP,
|
||||
"Called, bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s, accessTokenId: %{public}s,"
|
||||
" userId: %{public}d, isSet: %{public}d, flag: %{public}d.",
|
||||
" userId: %{public}d, isSet: %{public}d, flag: %{public}d",
|
||||
info.bundleName.c_str(), info.moduleName.c_str(), info.abilityName.c_str(),
|
||||
info.accessTokenId.c_str(), info.userId, isSet, flag);
|
||||
AutoStartupStatus status =
|
||||
DelayedSingleton<AbilityAutoStartupDataManager>::GetInstance()->QueryAutoStartupData(info);
|
||||
if (status.code != ERR_OK && status.code != ERR_NAME_NOT_FOUND) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Query auto startup data failed");
|
||||
return status.code;
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ int32_t AbilityAutoStartupService::CheckPermissionForEDM()
|
||||
{
|
||||
if (!PermissionVerification::GetInstance()->VerifyCallingPermission(
|
||||
PermissionConstants::PERMISSION_MANAGE_APP_BOOT_INTERNAL)) {
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Not have ohos.permission.MANAGE_APP_BOOT_INTERNAL approval.");
|
||||
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Verify ohos.permission.MANAGE_APP_BOOT_INTERNAL failed");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
}
|
||||
return ERR_OK;
|
||||
|
||||
@@ -24,15 +24,15 @@ void AbilityBackgroundConnection::OnAbilityConnectDone(
|
||||
const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode)
|
||||
{
|
||||
if (resultCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s, abilityName:%{public}s, resultCode:%{public}d",
|
||||
__func__, element.GetAbilityName().c_str(), resultCode);
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "abilityName:%{public}s, resultCode:%{public}d",
|
||||
element.GetAbilityName().c_str(), resultCode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AbilityBackgroundConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "OnAbilityDisconnectDone");
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace OHOS::AbilityRuntime;
|
||||
int ConnectionObserverController::AddObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "observer is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid observer");
|
||||
return AbilityRuntime::ERR_INVALID_OBSERVER;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ int ConnectionObserverController::AddObserver(const sptr<AbilityRuntime::IConnec
|
||||
return (item && item->AsObject() == observer->AsObject());
|
||||
});
|
||||
if (it != observers_.end()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "observer was already added, do not add again");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "observer already added");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ int ConnectionObserverController::AddObserver(const sptr<AbilityRuntime::IConnec
|
||||
}
|
||||
auto observerObj = observer->AsObject();
|
||||
if (!observerObj || !observerObj->AddDeathRecipient(observerDeathRecipient_)) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddDeathRecipient failed.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddDeathRecipient failed");
|
||||
}
|
||||
observers_.emplace_back(observer);
|
||||
|
||||
@@ -59,7 +59,7 @@ int ConnectionObserverController::AddObserver(const sptr<AbilityRuntime::IConnec
|
||||
void ConnectionObserverController::RemoveObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer)
|
||||
{
|
||||
if (!observer) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "observer is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "observer invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,10 +102,10 @@ std::vector<sptr<AbilityRuntime::IConnectionObserver>> ConnectionObserverControl
|
||||
|
||||
void ConnectionObserverController::HandleRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "remote connection oberver was died.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "remote connection oberver died");
|
||||
auto remoteObj = remote.promote();
|
||||
if (!remoteObj) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "invalid remote object.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "invalid remoteObj");
|
||||
return;
|
||||
}
|
||||
remoteObj->RemoveDeathRecipient(observerDeathRecipient_);
|
||||
|
||||
@@ -88,7 +88,7 @@ void ConnectionRecord::ClearConnCallBack()
|
||||
int ConnectionRecord::DisconnectAbility()
|
||||
{
|
||||
if (state_ != ConnectionState::CONNECTED) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "The connection has not established, connectionState: %{public}d.",
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connection not established, state: %{public}d",
|
||||
static_cast<int32_t>(state_));
|
||||
return INVALID_CONNECTION_STATE;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ int ConnectionRecord::DisconnectAbility()
|
||||
std::string taskName("DisconnectTimeout_");
|
||||
taskName += std::to_string(recordId_);
|
||||
auto disconnectTask = [connectionRecord = shared_from_this()]() {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Disconnect ability timeout");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "Disconnect timeout");
|
||||
connectionRecord->DisconnectTimeout();
|
||||
};
|
||||
int disconnectTimeout =
|
||||
@@ -124,7 +124,7 @@ int ConnectionRecord::DisconnectAbility()
|
||||
}
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION,
|
||||
"The current connection count is %{public}zu, no need to disconnect, just remove connection.", connectNums);
|
||||
"current connection count: %{public}zu, no need disconnect, just remove", connectNums);
|
||||
targetService_->RemoveConnectRecordFromList(shared_from_this());
|
||||
SetConnectState(ConnectionState::DISCONNECTED);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ void ConnectionRecord::CompleteConnect(int resultCode)
|
||||
auto callback = GetAbilityConnectCallback();
|
||||
auto handler = DelayedSingleton<AbilityManagerService>::GetInstance()->GetTaskHandler();
|
||||
if (remoteObject == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "extension returned null object: %{public}s", element.GetURI().c_str());
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "extension returned null: %{public}s", element.GetURI().c_str());
|
||||
if (handler) {
|
||||
SetConnectState(ConnectionState::DISCONNECTING);
|
||||
handler->SubmitTask([service = targetService_]() {
|
||||
@@ -164,7 +164,7 @@ void ConnectionRecord::CompleteConnect(int resultCode)
|
||||
});
|
||||
}
|
||||
DelayedSingleton<ConnectionStateManager>::GetInstance()->AddConnection(shared_from_this());
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "result: %{public}d. connectState:%{public}d.", resultCode, state_);
|
||||
TAG_LOGI(AAFwkTag::CONNECTION, "result: %{public}d, connectState:%{public}d", resultCode, state_);
|
||||
}
|
||||
|
||||
void ConnectionRecord::CompleteDisconnect(int resultCode, bool isCallerDied, bool isTargetDied)
|
||||
@@ -178,27 +178,27 @@ void ConnectionRecord::CompleteDisconnect(int resultCode, bool isCallerDied, boo
|
||||
abilityInfo.name, abilityInfo.moduleName);
|
||||
auto code = isTargetDied ? (resultCode - 1) : resultCode;
|
||||
auto onDisconnectDoneTask = [connCallback = GetAbilityConnectCallback(), element, code]() {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "OnAbilityDisconnectDone.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "OnAbilityDisconnectDone");
|
||||
if (!connCallback) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "connCallback is nullptr.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "null connCallback");
|
||||
return;
|
||||
}
|
||||
connCallback->OnAbilityDisconnectDone(element, code);
|
||||
};
|
||||
auto handler = DelayedSingleton<AbilityManagerService>::GetInstance()->GetTaskHandler();
|
||||
if (handler == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "handler is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "null handler");
|
||||
return;
|
||||
}
|
||||
handler->SubmitTask(onDisconnectDoneTask);
|
||||
DelayedSingleton<ConnectionStateManager>::GetInstance()->RemoveConnection(shared_from_this(), isCallerDied);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "result: %{public}d. connectState:%{public}d.", resultCode, state_);
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "result: %{public}d, connectState:%{public}d", resultCode, state_);
|
||||
}
|
||||
|
||||
void ConnectionRecord::ScheduleDisconnectAbilityDone()
|
||||
{
|
||||
if (state_ != ConnectionState::DISCONNECTING) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail to schedule disconnect ability done, current state is not disconnecting.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed, current state not disconnecting");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void ConnectionRecord::ScheduleDisconnectAbilityDone()
|
||||
void ConnectionRecord::ScheduleConnectAbilityDone()
|
||||
{
|
||||
if (state_ != ConnectionState::CONNECTING) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "fail to schedule connect ability done, current state is not connecting.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed, current state not connecting");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -263,19 +263,19 @@ bool ConnectionStateItem::AddConnection(std::shared_ptr<ConnectionRecord> record
|
||||
AbilityRuntime::ConnectionData &data)
|
||||
{
|
||||
if (!record) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddConnection, invalid connection record.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connection record");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto token = record->GetTargetToken();
|
||||
if (!token) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddConnection, invalid token.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid token");
|
||||
return false;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> connectionObj = record->GetConnection();
|
||||
if (!connectionObj) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddConnection, no connection callback for this connect.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no connection callback");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ bool ConnectionStateItem::AddConnection(std::shared_ptr<ConnectionRecord> record
|
||||
}
|
||||
|
||||
if (!connectedExtension) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "AddConnection, connectedExtension is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connectedExtension");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -307,31 +307,31 @@ bool ConnectionStateItem::RemoveConnection(std::shared_ptr<ConnectionRecord> rec
|
||||
AbilityRuntime::ConnectionData &data)
|
||||
{
|
||||
if (!record) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveConnection, invalid connection record.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connection record");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto token = record->GetTargetToken();
|
||||
if (!token) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveConnection, invalid token.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid token");
|
||||
return false;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> connectionObj = record->GetConnection();
|
||||
if (!connectionObj) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveConnection, no connection callback for this connect.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no connection callback");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto it = connectionMap_.find(token);
|
||||
if (it == connectionMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveConnection, no such connectedExtension.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such connectedExtension");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto connectedExtension = it->second;
|
||||
if (!connectedExtension) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveConnection, can not find such connectedExtension");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such connectedExtension");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -348,13 +348,13 @@ bool ConnectionStateItem::AddDataAbilityConnection(const DataAbilityCaller &call
|
||||
const std::shared_ptr<DataAbilityRecord> &dataAbility, AbilityRuntime::ConnectionData &data)
|
||||
{
|
||||
if (!dataAbility) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid dataAbility.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid dataAbility");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto token = dataAbility->GetToken();
|
||||
if (!token) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid dataAbility token.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid dataAbility token");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ bool ConnectionStateItem::AddDataAbilityConnection(const DataAbilityCaller &call
|
||||
}
|
||||
|
||||
if (!connectedAbility) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connectedAbility is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connectedAbility");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -386,25 +386,25 @@ bool ConnectionStateItem::RemoveDataAbilityConnection(const DataAbilityCaller &c
|
||||
const std::shared_ptr<DataAbilityRecord> &dataAbility, AbilityRuntime::ConnectionData &data)
|
||||
{
|
||||
if (!dataAbility) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveDataAbilityConnection, invalid data ability record.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability record");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto token = dataAbility->GetToken();
|
||||
if (!token) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveDataAbilityConnection, invalid data ability token.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability token");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto it = dataAbilityMap_.find(token);
|
||||
if (it == dataAbilityMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveDataAbilityConnection, no such connected data ability.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such connected data ability");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto connectedDataAbility = it->second;
|
||||
if (!connectedDataAbility) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "RemoveDataAbilityConnection, can not find such connectedDataAbility");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such connectedDataAbility");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -426,13 +426,13 @@ bool ConnectionStateItem::HandleDataAbilityDied(const sptr<IRemoteObject> &token
|
||||
|
||||
auto it = dataAbilityMap_.find(token);
|
||||
if (it == dataAbilityMap_.end()) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "HandleDataAbilityDied, no such connected data ability.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no such data ability");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto connectedDataAbility = it->second;
|
||||
if (!connectedDataAbility) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "HandleDataAbilityDied, can not find such connectedDataAbility");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "no connectedDataAbility");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void ConnectionStateManager::Init(const std::shared_ptr<TaskHandlerWrap> &handle
|
||||
}
|
||||
handler_ = handler;
|
||||
if (!handler) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "eventhandler is invalid");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid eventhandler");
|
||||
InitAppStateObserver();
|
||||
return;
|
||||
}
|
||||
@@ -97,13 +97,13 @@ void ConnectionStateManager::AddConnection(std::shared_ptr<ConnectionRecord> con
|
||||
}
|
||||
|
||||
if (!connectionRecord) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connection record is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connection record");
|
||||
return;
|
||||
}
|
||||
|
||||
ConnectionData connectionData;
|
||||
if (!AddConnectionInner(connectionRecord, connectionData)) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "add connection, no need to notify observers");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need notify observers");
|
||||
return;
|
||||
}
|
||||
controller->NotifyExtensionConnected(connectionData);
|
||||
@@ -118,7 +118,7 @@ void ConnectionStateManager::RemoveConnection(std::shared_ptr<ConnectionRecord>
|
||||
}
|
||||
|
||||
if (!connectionRecord) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "connection record is invalid when remove connection");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid connection record");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void ConnectionStateManager::RemoveConnection(std::shared_ptr<ConnectionRecord>
|
||||
|
||||
ConnectionData connectionData;
|
||||
if (!RemoveConnectionInner(connectionRecord, connectionData)) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "remove connection, no need to notify observers");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need notify observers");
|
||||
return;
|
||||
}
|
||||
controller->NotifyExtensionDisconnected(connectionData);
|
||||
@@ -145,7 +145,7 @@ void ConnectionStateManager::AddDataAbilityConnection(const DataAbilityCaller &c
|
||||
|
||||
ConnectionData connectionData;
|
||||
if (!AddDataAbilityConnectionInner(caller, record, connectionData)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "add data ability onnection, no need to notify observers");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "no need notify observers");
|
||||
return;
|
||||
}
|
||||
observerController_->NotifyExtensionConnected(connectionData);
|
||||
@@ -160,7 +160,7 @@ void ConnectionStateManager::RemoveDataAbilityConnection(const DataAbilityCaller
|
||||
|
||||
ConnectionData connectionData;
|
||||
if (!RemoveDataAbilityConnectionInner(caller, record, connectionData)) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "remove data ability, no need to notify observers");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "no need notify observers");
|
||||
return;
|
||||
}
|
||||
observerController_->NotifyExtensionDisconnected(connectionData);
|
||||
@@ -174,12 +174,12 @@ bool ConnectionStateManager::CheckDataAbilityConnectionParams(const DataAbilityC
|
||||
}
|
||||
|
||||
if (!record) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "data ability record is invalid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability record");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (caller.callerPid == 0) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "data ability, invalid caller pid");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid callerPid");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -189,20 +189,20 @@ bool ConnectionStateManager::CheckDataAbilityConnectionParams(const DataAbilityC
|
||||
void ConnectionStateManager::HandleDataAbilityDied(const std::shared_ptr<DataAbilityRecord> &record)
|
||||
{
|
||||
if (!record) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability");
|
||||
return;
|
||||
}
|
||||
|
||||
auto token = record->GetToken();
|
||||
if (!token) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid data ability token.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "invalid token");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<AbilityRuntime::ConnectionData> allData;
|
||||
HandleDataAbilityDiedInner(token, allData);
|
||||
if (allData.empty()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "allConnectionData is empty.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "empty allData");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void ConnectionStateManager::HandleDataAbilityDied(const std::shared_ptr<DataAbi
|
||||
void ConnectionStateManager::HandleDataAbilityCallerDied(int32_t callerPid)
|
||||
{
|
||||
if (callerPid <= 0) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid data ability caller pid.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid callerPid");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ void ConnectionStateManager::AddDlpAbility(const std::shared_ptr<AbilityRecord>
|
||||
|
||||
DlpStateData dlpData;
|
||||
if (!HandleDlpAbilityInner(dlpAbility, true, dlpData)) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need to report dlp opened connection state.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need report dlp opened conn state");
|
||||
return;
|
||||
}
|
||||
controller->NotifyDlpAbilityOpened(dlpData);
|
||||
@@ -275,7 +275,7 @@ void ConnectionStateManager::RemoveDlpAbility(const std::shared_ptr<AbilityRecor
|
||||
|
||||
DlpStateData dlpData;
|
||||
if (!HandleDlpAbilityInner(dlpAbility, false, dlpData)) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need to report dlp closed connection state.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no need report dlp closed conn state");
|
||||
return;
|
||||
}
|
||||
controller->NotifyDlpAbilityClosed(dlpData);
|
||||
@@ -338,7 +338,7 @@ bool ConnectionStateManager::AddConnectionInner(std::shared_ptr<ConnectionRecord
|
||||
}
|
||||
|
||||
if (!targetItem) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed to find target connection state item.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "find targetItem failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -352,13 +352,13 @@ bool ConnectionStateManager::RemoveConnectionInner(std::shared_ptr<ConnectionRec
|
||||
std::lock_guard<ffrt::mutex> guard(stateLock_);
|
||||
auto it = connectionStates_.find(callerPid);
|
||||
if (it == connectionStates_.end()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "can not find target item, connection caller pid:%{public}d.", callerPid);
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "find target failed, callerPid:%{public}d", callerPid);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto targetItem = it->second;
|
||||
if (!targetItem) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed to find target connection state item.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "find targetItem failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -373,14 +373,14 @@ void ConnectionStateManager::HandleCallerDied(int32_t callerPid)
|
||||
{
|
||||
auto connectionStateItem = RemoveDiedCaller(callerPid);
|
||||
if (!connectionStateItem) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no connectionStateItem, may already handled.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "no connectionStateItem");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<AbilityRuntime::ConnectionData> allConnectionData;
|
||||
connectionStateItem->GenerateAllConnectionData(allConnectionData);
|
||||
if (allConnectionData.empty()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "allConnectionData is empty.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "empty allConnectionData");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ std::shared_ptr<ConnectionStateItem> ConnectionStateManager::RemoveDiedCaller(in
|
||||
std::lock_guard<ffrt::mutex> guard(stateLock_);
|
||||
auto it = connectionStates_.find(callerPid);
|
||||
if (it == connectionStates_.end()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "connection caller pid:%{public}d.", callerPid);
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "callerPid:%{public}d.", callerPid);
|
||||
return nullptr;
|
||||
}
|
||||
auto stateItem = it->second;
|
||||
@@ -424,7 +424,7 @@ bool ConnectionStateManager::AddDataAbilityConnectionInner(const DataAbilityCall
|
||||
}
|
||||
|
||||
if (!targetItem) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed to find target connection state item.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "find targetItem failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -437,13 +437,13 @@ bool ConnectionStateManager::RemoveDataAbilityConnectionInner(const DataAbilityC
|
||||
std::lock_guard<ffrt::mutex> guard(stateLock_);
|
||||
auto it = connectionStates_.find(caller.callerPid);
|
||||
if (it == connectionStates_.end()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "can not find target item, connection caller pid:%{public}d.", caller.callerPid);
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "find target item failed, callerPid:%{public}d", caller.callerPid);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto targetItem = it->second;
|
||||
if (!targetItem) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "failed to find target data ability state item.");
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "find targetItem failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -483,25 +483,25 @@ bool ConnectionStateManager::HandleDlpAbilityInner(const std::shared_ptr<Ability
|
||||
bool isAdd, AbilityRuntime::DlpStateData &dlpData)
|
||||
{
|
||||
if (!dlpAbility) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "invalid dlp ability.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "invalid dlp ability");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dlpAbility->GetAppIndex() <= AbilityRuntime::GlobalConstant::MAX_APP_CLONE_INDEX) {
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, "this is not dlp ability, do not report connection stat.");
|
||||
TAG_LOGD(AAFwkTag::CONNECTION, " not dlp ability, do not report connection stat");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::lock_guard<ffrt::mutex> guard(dlpLock_);
|
||||
auto it = dlpItems_.find(dlpAbility->GetOwnerMissionUserId());
|
||||
if (it == dlpItems_.end()) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "no dlp manager, invalid state.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid state");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto dlpItem = it->second;
|
||||
if (!dlpItem) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid dlpItem.");
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "invalid dlpItem");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ void ConnectionStateManager::InitAppStateObserver()
|
||||
|
||||
sptr<OHOS::AppExecFwk::IAppMgr> appManager = GetAppMgr();
|
||||
if (!appManager) {
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "%{public}s app manager nullptr! retry:%{public}d", __func__, retry_);
|
||||
TAG_LOGW(AAFwkTag::CONNECTION, "null appManager, retry:%{public}d", retry_);
|
||||
if (retry_ < MAX_RETRY && handler_) {
|
||||
auto initConnectionStateManagerTask = [weak = weak_from_this()]() {
|
||||
auto self = weak.lock();
|
||||
@@ -542,7 +542,7 @@ void ConnectionStateManager::InitAppStateObserver()
|
||||
});
|
||||
int32_t err = appManager->RegisterApplicationStateObserver(appStateObserver_);
|
||||
if (err != 0) {
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "%{public}s register to appmanager failed. err:%{public}d", __func__, err);
|
||||
TAG_LOGE(AAFwkTag::CONNECTION, "register to appmanager err:%{public}d", err);
|
||||
appStateObserver_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OHOS {
|
||||
namespace AAFwk {
|
||||
void DataAbilityCallerRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "recv DataAbilityCallerRecipient death notice");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "recv death notice");
|
||||
|
||||
if (handler_) {
|
||||
handler_(remote);
|
||||
@@ -29,12 +29,12 @@ void DataAbilityCallerRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
|
||||
DataAbilityCallerRecipient::DataAbilityCallerRecipient(RemoteDiedHandler handler) : handler_(handler)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "%{public}s", __func__);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "called");
|
||||
}
|
||||
|
||||
DataAbilityCallerRecipient::~DataAbilityCallerRecipient()
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "%{public}s", __func__);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "called");
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -46,12 +46,12 @@ sptr<IAbilityScheduler> DataAbilityManager::Acquire(
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call");
|
||||
|
||||
if (abilityRequest.abilityInfo.type != AppExecFwk::AbilityType::DATA) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability manager acquire: not a data ability.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not a data ability");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (abilityRequest.abilityInfo.bundleName.empty() || abilityRequest.abilityInfo.name.empty()) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability manager acquire: invalid name.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid name");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ sptr<IAbilityScheduler> DataAbilityManager::Acquire(
|
||||
if (client && !isNotHap) {
|
||||
clientAbilityRecord = Token::GetAbilityRecordByToken(client);
|
||||
if (!clientAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability manager acquire: invalid client token.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid client token");
|
||||
return nullptr;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Ability '%{public}s' acquiring data ability '%{public}s'...",
|
||||
@@ -80,22 +80,22 @@ sptr<IAbilityScheduler> DataAbilityManager::Acquire(
|
||||
|
||||
auto it = dataAbilityRecordsLoaded_.find(dataAbilityName);
|
||||
if (it == dataAbilityRecordsLoaded_.end()) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Acquiring data ability is not existed, loading...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "data ability not existed, loading...");
|
||||
dataAbilityRecord = LoadLocked(dataAbilityName, abilityRequest);
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Acquiring data ability is existed .");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "data ability existed");
|
||||
dataAbilityRecord = it->second;
|
||||
}
|
||||
|
||||
if (!dataAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to load data ability '%{public}s'.", dataAbilityName.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to load '%{public}s'", dataAbilityName.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto scheduler = dataAbilityRecord->GetScheduler();
|
||||
if (!scheduler) {
|
||||
if (DEBUG_ENABLED) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "BUG: data ability '%{public}s' is not loaded, removing it...",
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "'%{public}s' not loaded, removing",
|
||||
dataAbilityName.c_str());
|
||||
}
|
||||
auto it = dataAbilityRecordsLoaded_.find(dataAbilityName);
|
||||
@@ -138,13 +138,13 @@ int DataAbilityManager::Release(
|
||||
if (it->second && it->second->GetScheduler() &&
|
||||
it->second->GetScheduler()->AsObject() == scheduler->AsObject()) {
|
||||
dataAbilityRecord = it->second;
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Releasing data ability '%{public}s'...", it->first.c_str());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Releasing '%{public}s'...", it->first.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dataAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Releasing not existed data ability.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "data ability not exist");
|
||||
return ERR_UNKNOWN_OBJECT;
|
||||
}
|
||||
|
||||
@@ -154,12 +154,12 @@ int DataAbilityManager::Release(
|
||||
CHECK_POINTER_AND_RETURN(abilityMs, GET_ABILITY_SERVICE_FAILED);
|
||||
int result = abilityMs->JudgeAbilityVisibleControl(abilityRecord->GetAbilityInfo());
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "JudgeAbilityVisibleControl error.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "JudgeAbilityVisibleControl error");
|
||||
return result;
|
||||
}
|
||||
|
||||
if (dataAbilityRecord->GetClientCount(client) == 0) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Release data ability with wrong client.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "client wrong");
|
||||
return ERR_UNKNOWN_OBJECT;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ int DataAbilityManager::AttachAbilityThread(const sptr<IAbilityScheduler> &sched
|
||||
DumpLocked(__func__, __LINE__);
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Attaching data ability...");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Attaching data ability");
|
||||
|
||||
auto record = Token::GetAbilityRecordByToken(token);
|
||||
std::string abilityName = "";
|
||||
@@ -222,22 +222,21 @@ int DataAbilityManager::AttachAbilityThread(const sptr<IAbilityScheduler> &sched
|
||||
}
|
||||
|
||||
if (!dataAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attaching data ability '%{public}s' is not in loading state.",
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attaching '%{public}s' not in loading state",
|
||||
abilityName.c_str());
|
||||
return ERR_UNKNOWN_OBJECT;
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED && dataAbilityRecord->GetClientCount() > 0) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "BUG: Attaching data ability '%{public}s' has clients.", abilityName.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attachingy '%{public}s' has clients", abilityName.c_str());
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED && dataAbilityRecord->GetScheduler()) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "BUG: Attaching data ability '%{public}s' has ready.", abilityName.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attaching '%{public}s' has ready", abilityName.c_str());
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED && dataAbilityRecordsLoaded_.count(it->first) != 0) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "BUG: The attaching data ability '%{public}s' has already existed.",
|
||||
abilityName.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "attaching '%{public}s' exist", abilityName.c_str());
|
||||
}
|
||||
|
||||
return dataAbilityRecord->Attach(scheduler);
|
||||
@@ -255,7 +254,7 @@ int DataAbilityManager::AbilityTransitionDone(const sptr<IRemoteObject> &token,
|
||||
DumpLocked(__func__, __LINE__);
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Handling data ability transition done %{public}d...", state);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "transition done %{public}d", state);
|
||||
|
||||
DataAbilityRecordPtrMap::iterator it;
|
||||
DataAbilityRecordPtr dataAbilityRecord;
|
||||
@@ -271,7 +270,7 @@ int DataAbilityManager::AbilityTransitionDone(const sptr<IRemoteObject> &token,
|
||||
}
|
||||
}
|
||||
if (!dataAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attaching data ability '%{public}s' is not existed.", abilityName.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "'%{public}s' not exist", abilityName.c_str());
|
||||
return ERR_UNKNOWN_OBJECT;
|
||||
}
|
||||
|
||||
@@ -373,7 +372,7 @@ void DataAbilityManager::OnAppStateChanged(const AppInfo &info)
|
||||
|
||||
std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordById(int64_t id)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call");
|
||||
|
||||
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||
|
||||
@@ -392,7 +391,7 @@ std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordById(int64_t
|
||||
|
||||
std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordByToken(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call");
|
||||
|
||||
CHECK_POINTER_AND_RETURN(token, nullptr);
|
||||
|
||||
@@ -420,7 +419,7 @@ std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordByToken(const
|
||||
|
||||
std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordByScheduler(const sptr<IAbilityScheduler> &scheduler)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call");
|
||||
|
||||
CHECK_POINTER_AND_RETURN(scheduler, nullptr);
|
||||
|
||||
@@ -438,7 +437,7 @@ std::shared_ptr<AbilityRecord> DataAbilityManager::GetAbilityRecordByScheduler(c
|
||||
|
||||
void DataAbilityManager::Dump(const char *func, int line)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Call");
|
||||
|
||||
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||
|
||||
@@ -454,7 +453,7 @@ DataAbilityManager::DataAbilityRecordPtr DataAbilityManager::LoadLocked(
|
||||
|
||||
auto it = dataAbilityRecordsLoading_.find(name);
|
||||
if (it == dataAbilityRecordsLoading_.end()) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Acquiring data ability is not in loading, trying to load it...");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "data ability not in loading");
|
||||
|
||||
dataAbilityRecord = std::make_shared<DataAbilityRecord>(req);
|
||||
// Start data ability loading process asynchronously.
|
||||
@@ -466,16 +465,16 @@ DataAbilityManager::DataAbilityRecordPtr DataAbilityManager::LoadLocked(
|
||||
|
||||
auto insertResult = dataAbilityRecordsLoading_.insert({name, dataAbilityRecord});
|
||||
if (!insertResult.second) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to insert data ability to loading map.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, " insert data ability failed");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Acquired data ability is loading...");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "data ability loading");
|
||||
dataAbilityRecord = it->second;
|
||||
}
|
||||
|
||||
if (!dataAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to load data ability '%{public}s'.", name.c_str());
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to load '%{public}s'", name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -484,7 +483,7 @@ DataAbilityManager::DataAbilityRecordPtr DataAbilityManager::LoadLocked(
|
||||
// Waiting for data ability loaded.
|
||||
int ret = dataAbilityRecord->WaitForLoaded(mutex_, DATA_ABILITY_LOAD_TIMEOUT);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Wait for data ability failed %{public}d.", ret);
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Wait failed %{public}d", ret);
|
||||
it = dataAbilityRecordsLoading_.find(name);
|
||||
if (it != dataAbilityRecordsLoading_.end()) {
|
||||
dataAbilityRecordsLoading_.erase(it);
|
||||
@@ -499,12 +498,12 @@ DataAbilityManager::DataAbilityRecordPtr DataAbilityManager::LoadLocked(
|
||||
void DataAbilityManager::DumpLocked(const char *func, int line)
|
||||
{
|
||||
if (func && line >= 0) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability manager dump at %{public}s(%{public}d)", func, line);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "dump at %{public}s(%{public}d)", func, line);
|
||||
} else {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability manager dump");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "dump");
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Available data ability count: %{public}zu", dataAbilityRecordsLoaded_.size());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Available count: %{public}zu", dataAbilityRecordsLoaded_.size());
|
||||
|
||||
for (auto it = dataAbilityRecordsLoaded_.begin(); it != dataAbilityRecordsLoaded_.end(); ++it) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "'%{public}s':", it->first.c_str());
|
||||
@@ -513,7 +512,7 @@ void DataAbilityManager::DumpLocked(const char *func, int line)
|
||||
}
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Loading data ability count: %{public}zu", dataAbilityRecordsLoading_.size());
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Loading count: %{public}zu", dataAbilityRecordsLoading_.size());
|
||||
|
||||
for (auto it = dataAbilityRecordsLoading_.begin(); it != dataAbilityRecordsLoading_.end(); ++it) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "'%{public}s':", it->first.c_str());
|
||||
@@ -600,7 +599,7 @@ void DataAbilityManager::DumpSysState(std::vector<std::string> &info, bool isCli
|
||||
|
||||
void DataAbilityManager::GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info, bool isPerm)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Get ability running infos");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||
|
||||
auto queryInfo = [&info, isPerm](DataAbilityRecordPtrMap::reference data) {
|
||||
@@ -638,7 +637,7 @@ void DataAbilityManager::RestartDataAbility(const std::shared_ptr<AbilityRecord>
|
||||
bool getBundleInfos = bundleMgrHelper->GetBundleInfos(
|
||||
OHOS::AppExecFwk::GET_BUNDLE_DEFAULT, bundleInfos, USER_ID_NO_HEAD);
|
||||
if (!getBundleInfos) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Handle ability died task, get bundle infos failed.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "GetBundleInfos failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -663,7 +662,7 @@ void DataAbilityManager::RestartDataAbility(const std::shared_ptr<AbilityRecord>
|
||||
bool getDataAbilityUri = OHOS::DelayedSingleton<AbilityManagerService>::GetInstance()->GetDataAbilityUri(
|
||||
hapModuleInfo.abilityInfos, mainElement, uriStr);
|
||||
if (getDataAbilityUri) {
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "restart data ability: %{public}s, uri: %{public}s.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "restart data ability: %{public}s, uri: %{public}s",
|
||||
abilityRecord->GetAbilityInfo().name.c_str(), uriStr.c_str());
|
||||
Uri uri(uriStr);
|
||||
OHOS::DelayedSingleton<AbilityManagerService>::GetInstance()->AcquireDataAbility(uri, true, nullptr);
|
||||
|
||||
@@ -22,41 +22,41 @@ namespace OHOS {
|
||||
namespace AAFwk {
|
||||
DataAbilityRecord::DataAbilityRecord(const AbilityRequest &req) : request_(req)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
|
||||
if (request_.abilityInfo.type != AppExecFwk::AbilityType::DATA) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "BUG: Construct a data ability with wrong ability type.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "wrong ability type");
|
||||
}
|
||||
}
|
||||
|
||||
DataAbilityRecord::~DataAbilityRecord()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
}
|
||||
|
||||
int DataAbilityRecord::StartLoading()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Start data ability loading...");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
|
||||
if (ability_ || scheduler_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability already started.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "already started");
|
||||
return ERR_ALREADY_EXISTS;
|
||||
}
|
||||
|
||||
if (request_.abilityInfo.type != AppExecFwk::AbilityType::DATA) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Start a data ability with wrong ability type.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "wrong ability type");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto ability = AbilityRecord::CreateAbilityRecord(request_);
|
||||
if (!ability) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to allocate ability for DataAbilityRecord.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "allocate ability failed");
|
||||
return ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
int ret = ability->LoadAbility();
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Failed to start data ability loading.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "LoadAbility failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -105,35 +105,35 @@ sptr<IAbilityScheduler> DataAbilityRecord::GetScheduler()
|
||||
|
||||
int DataAbilityRecord::Attach(const sptr<IAbilityScheduler> &scheduler)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
|
||||
if (!scheduler) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attach data ability: invalid scheduler.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid scheduler");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (!ability_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability attach: not startloading.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not startloading");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (scheduler_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attach data ability: already attached.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "already attached");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
// INITIAL => ACTIVATING
|
||||
|
||||
if (ability_->GetAbilityState() != INITIAL) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Attaching data ability: not in 'INITIAL' state.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not in 'INITIAL' state");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Attaching data ability...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Attaching");
|
||||
ability_->SetScheduler(scheduler);
|
||||
scheduler_ = scheduler;
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Scheduling 'OnStart' for data ability '%{public}s|%{public}s'...",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Scheduling 'OnStart' for '%{public}s|%{public}s'",
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
ability_->GetAbilityInfo().name.c_str());
|
||||
|
||||
@@ -153,12 +153,12 @@ int DataAbilityRecord::OnTransitionDone(int state)
|
||||
CHECK_POINTER_AND_RETURN(scheduler_, ERR_INVALID_STATE);
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVATING) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability on transition done: not in 'ACTIVATING' state.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not in 'ACTIVATING' state");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (state != AbilityLifeCycleState::ABILITY_STATE_ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability on transition done: not ACTIVE.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not ACTIVE");
|
||||
ability_->SetAbilityState(INITIAL);
|
||||
loadedCond_.notify_all();
|
||||
return ERR_INVALID_STATE;
|
||||
@@ -170,7 +170,7 @@ int DataAbilityRecord::OnTransitionDone(int state)
|
||||
ability_->SetAbilityState(ACTIVE);
|
||||
loadedCond_.notify_all();
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s' is loaded.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "'%{public}s|%{public}s' loaded",
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
ability_->GetAbilityInfo().name.c_str());
|
||||
|
||||
@@ -180,27 +180,27 @@ int DataAbilityRecord::OnTransitionDone(int state)
|
||||
int DataAbilityRecord::AddClient(const sptr<IRemoteObject> &client, bool tryBind, bool isNotHap)
|
||||
{
|
||||
if (!client) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability add client: invalid param.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid param");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!ability_ || !scheduler_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability add client: not attached.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not attached");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability add client: not loaded.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not loaded");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto appScheduler = DelayedSingleton<AppScheduler>::GetInstance();
|
||||
if (!appScheduler) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability add client: failed to get app scheduler.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "get appScheduler failed");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "add death monitoring for data ability caller.");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "add death monitoring for caller");
|
||||
if (client != nullptr && callerDeathRecipient_ != nullptr) {
|
||||
client->RemoveDeathRecipient(callerDeathRecipient_);
|
||||
}
|
||||
@@ -229,32 +229,32 @@ int DataAbilityRecord::AddClient(const sptr<IRemoteObject> &client, bool tryBind
|
||||
|
||||
int DataAbilityRecord::RemoveClient(const sptr<IRemoteObject> &client, bool isNotHap)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Removing data ability client...");
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
|
||||
if (!client) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove client: invalid client.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid client");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!ability_ || !scheduler_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove clients: not attached.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not attached");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove client: not loaded.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not loaded");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (clients_.empty()) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "BUG: Data ability record has no clients.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "no clients");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
for (auto it(clients_.begin()); it != clients_.end(); ++it) {
|
||||
if (it->client == client) {
|
||||
clients_.erase(it);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'",
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
ability_->GetAbilityInfo().name.c_str());
|
||||
break;
|
||||
@@ -266,37 +266,37 @@ int DataAbilityRecord::RemoveClient(const sptr<IRemoteObject> &client, bool isNo
|
||||
|
||||
int DataAbilityRecord::RemoveClients(const std::shared_ptr<AbilityRecord> &client)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "called");
|
||||
|
||||
if (!ability_ || !scheduler_) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove clients: not attached.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not attached");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove clients: not loaded.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not loaded");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (clients_.empty()) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Data ability remove clients: no clients.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "no clients");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
auto appScheduler = DelayedSingleton<AppScheduler>::GetInstance();
|
||||
if (!appScheduler) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove clients: invalid app scheduler.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid app scheduler");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
if (client) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Removing data ability clients with filter...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Removing with filter");
|
||||
auto it = clients_.begin();
|
||||
while (it != clients_.end()) {
|
||||
if (!it->isNotHap) {
|
||||
auto clientAbilityRecord = Token::GetAbilityRecordByToken(it->client);
|
||||
if (!clientAbilityRecord) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "clientAbilityRecord is nullptr, continue.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "null clientAbilityRecord");
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ int DataAbilityRecord::RemoveClients(const std::shared_ptr<AbilityRecord> &clien
|
||||
ability_->GetToken(), clientAbilityRecord->GetToken(), 0, 0, 0);
|
||||
it = clients_.erase(it);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"Ability '%{public}s|%{public}s' --X-> Data ability '%{public}s|%{public}s'.",
|
||||
"Ability '%{public}s|%{public}s' --X-> Data ability '%{public}s|%{public}s'",
|
||||
client->GetApplicationInfo().bundleName.c_str(),
|
||||
client->GetAbilityInfo().name.c_str(),
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
@@ -318,13 +318,13 @@ int DataAbilityRecord::RemoveClients(const std::shared_ptr<AbilityRecord> &clien
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Removing data ability clients...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "Removing clients");
|
||||
auto it = clients_.begin();
|
||||
while (it != clients_.end()) {
|
||||
if (!it->isNotHap) {
|
||||
auto clientAbilityRecord = Token::GetAbilityRecordByToken(it->client);
|
||||
if (!clientAbilityRecord) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "clientAbilityRecord is null,clear record");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "null clientAbilityRecord");
|
||||
it = clients_.erase(it);
|
||||
continue;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ size_t DataAbilityRecord::GetClientCount(const sptr<IRemoteObject> &client) cons
|
||||
CHECK_POINTER_AND_RETURN(scheduler_, 0);
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability get client count: not loaded.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not loaded");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -363,13 +363,13 @@ int DataAbilityRecord::KillBoundClientProcesses()
|
||||
CHECK_POINTER_AND_RETURN(scheduler_, ERR_INVALID_STATE);
|
||||
|
||||
if (ability_->GetAbilityState() != ACTIVE) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability kill bound clients: not loaded.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "not loaded");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto appScheduler = DelayedSingleton<AppScheduler>::GetInstance();
|
||||
if (!appScheduler) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability kill bound clients: invalid app scheduler.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid app scheduler");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ int DataAbilityRecord::KillBoundClientProcesses()
|
||||
auto clientAbilityRecord = Token::GetAbilityRecordByToken(it->client);
|
||||
CHECK_POINTER_CONTINUE(clientAbilityRecord);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY,
|
||||
"Killing bound client '%{public}s|%{public}s' of data ability '%{public}s|%{public}s'...",
|
||||
"Killing bound client '%{public}s|%{public}s' of data ability '%{public}s|%{public}s'",
|
||||
clientAbilityRecord->GetApplicationInfo().bundleName.c_str(),
|
||||
clientAbilityRecord->GetAbilityInfo().name.c_str(),
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
@@ -470,18 +470,18 @@ void DataAbilityRecord::Dump(std::vector<std::string> &info) const
|
||||
|
||||
void DataAbilityRecord::OnSchedulerDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "'%{public}s':", __func__);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "called");
|
||||
auto object = remote.promote();
|
||||
DelayedSingleton<ConnectionStateManager>::GetInstance()->HandleDataAbilityCallerDied(GetDiedCallerPid(object));
|
||||
|
||||
if (clients_.empty()) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "BUG: Data ability record has no clients.");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "no clients");
|
||||
return;
|
||||
}
|
||||
|
||||
auto appScheduler = DelayedSingleton<AppScheduler>::GetInstance();
|
||||
if (!appScheduler) {
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "Data ability remove clients: invalid app scheduler.");
|
||||
TAG_LOGE(AAFwkTag::DATA_ABILITY, "invalid app scheduler");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -489,9 +489,9 @@ void DataAbilityRecord::OnSchedulerDied(const wptr<IRemoteObject> &remote)
|
||||
auto it = clients_.begin();
|
||||
while (it != clients_.end()) {
|
||||
if (it->client == object) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "remove system caller record with filter...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "remove system caller");
|
||||
it = clients_.erase(it);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'",
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
ability_->GetAbilityInfo().name.c_str());
|
||||
} else {
|
||||
@@ -502,9 +502,9 @@ void DataAbilityRecord::OnSchedulerDied(const wptr<IRemoteObject> &remote)
|
||||
auto it = clients_.begin();
|
||||
while (it != clients_.end()) {
|
||||
if (it->isNotHap) {
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "remove system caller record...");
|
||||
TAG_LOGD(AAFwkTag::DATA_ABILITY, "remove system caller");
|
||||
it = clients_.erase(it);
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'.",
|
||||
TAG_LOGI(AAFwkTag::DATA_ABILITY, "Data ability '%{public}s|%{public}s'",
|
||||
ability_->GetApplicationInfo().bundleName.c_str(),
|
||||
ability_->GetAbilityInfo().name.c_str());
|
||||
} else {
|
||||
|
||||
@@ -84,7 +84,7 @@ sptr<IAbilityEcologicalRuleMgrService> AbilityEcologicalRuleMgrServiceClient::Co
|
||||
|
||||
sptr<IAbilityEcologicalRuleMgrService> service = iface_cast<IAbilityEcologicalRuleMgrService>(systemAbility);
|
||||
if (service == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "The erms has transfer to foundation.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "erms transfered to foundation");
|
||||
service = new AbilityEcologicalRuleMgrServiceProxy(systemAbility);
|
||||
}
|
||||
return service;
|
||||
@@ -124,7 +124,7 @@ int32_t AbilityEcologicalRuleMgrServiceClient::EvaluateResolveInfos(const AAFwk:
|
||||
int32_t res = ecologicalRuleMgrServiceProxy_->EvaluateResolveInfos(want, callerInfo, type, abilityInfos);
|
||||
int64_t cost = GetCurrentTimeMicro() - start;
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE,
|
||||
"[ERMS-DFX] EvaluateResolveInfos interface cost %{public}" PRId64 " mirco seconds.", cost);
|
||||
"[ERMS-DFX] cost %{public}" PRId64 " ms", cost);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ int32_t AbilityEcologicalRuleMgrServiceClient::QueryStartExperience(const OHOS::
|
||||
}
|
||||
int64_t cost = GetCurrentTimeMicro() - start;
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE,
|
||||
"[ERMS-DFX] QueryStartExperience interface cost %{public}" PRId64 " mirco seconds.", cost);
|
||||
"[ERMS-DFX] cost %{public}" PRId64 " ms", cost);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -204,13 +204,13 @@ int32_t AbilityEcologicalRuleMgrServiceProxy::EvaluateResolveInfos(const Want &w
|
||||
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "get Remote failed.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "get remote failed");
|
||||
return ERR_FAILED;
|
||||
}
|
||||
|
||||
int32_t ret = remote->SendRequest(EVALUATE_RESOLVE_INFO_CMD, data, reply, option);
|
||||
if (ret != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "SendRequest error, ret = %{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "SendRequest error:%{public}d", ret);
|
||||
return ERR_FAILED;
|
||||
}
|
||||
|
||||
@@ -226,14 +226,14 @@ bool AbilityEcologicalRuleMgrServiceProxy::ReadParcelableVector(std::vector<T> &
|
||||
{
|
||||
int32_t infoSize = reply.ReadInt32();
|
||||
if (infoSize > CYCLE_LIMIT) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "size is too large.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "size too large");
|
||||
return false;
|
||||
}
|
||||
parcelableVector.clear();
|
||||
for (int32_t i = 0; i < infoSize; i++) {
|
||||
sptr<T> info = reply.ReadParcelable<T>();
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "read Parcelable infos failed");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "read info failed");
|
||||
return false;
|
||||
}
|
||||
parcelableVector.emplace_back(*info);
|
||||
@@ -273,7 +273,7 @@ int32_t AbilityEcologicalRuleMgrServiceProxy::QueryStartExperience(const Want &w
|
||||
|
||||
int32_t ret = remote->SendRequest(QUERY_START_EXPERIENCE_CMD, data, reply, option);
|
||||
if (ret != ERR_NONE) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "SendRequest error, ret = %{public}d", ret);
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "SendRequest error: %{public}d", ret);
|
||||
return ERR_FAILED;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ AbilityCallerInfo *AbilityCallerInfo::Unmarshalling(Parcel &in)
|
||||
{
|
||||
auto *info = new (std::nothrow) AbilityCallerInfo();
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "new callerInfo failed, return nullptr");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "info null");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param)
|
||||
}
|
||||
if (param.want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) ==
|
||||
param.want.GetElement().GetBundleName()) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "The same bundle, do not intercept.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "same bundle");
|
||||
return ERR_OK;
|
||||
}
|
||||
ErmsCallerInfo callerInfo;
|
||||
@@ -47,7 +47,7 @@ ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param)
|
||||
if (param.callerToken != nullptr) {
|
||||
auto abilityRecord = Token::GetAbilityRecordByToken(param.callerToken);
|
||||
if (abilityRecord && !abilityRecord->GetAbilityInfo().isStageBasedModel) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "callerModelType is FA.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "FA callerModelType");
|
||||
callerInfo.callerModelType = ErmsCallerInfo::MODEL_FA;
|
||||
}
|
||||
}
|
||||
@@ -58,19 +58,19 @@ ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param)
|
||||
int ret = IN_PROCESS_CALL(AbilityEcologicalRuleMgrServiceClient::GetInstance()->QueryStartExperience(newWant,
|
||||
callerInfo, rule));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed, keep going.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed");
|
||||
return ERR_OK;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule success");
|
||||
StartAbilityUtils::ermsResultCode = rule.resultCode;
|
||||
if (rule.resultCode == ERMS_ISALLOW_RESULTCODE) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "ecological rule is allow, keep going.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "allow ecological rule");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
std::string supportErms = OHOS::system::GetParameter(ABILITY_SUPPORT_ECOLOGICAL_RULEMGRSERVICE, "true");
|
||||
if (supportErms == "false") {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Abilityms not support Erms between applications.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "erms between apps not supported");
|
||||
return ERR_OK;
|
||||
}
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
@@ -86,12 +86,12 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == want.GetElement().GetBundleName()) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "The same bundle, do not intercept.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "same bundle");
|
||||
return true;
|
||||
}
|
||||
std::string supportErms = OHOS::system::GetParameter(ABILITY_SUPPORT_ECOLOGICAL_RULEMGRSERVICE, "true");
|
||||
if (supportErms == "false") {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Abilityms not support Erms between applications.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Erms between apps not supported");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId)
|
||||
Want launchWant;
|
||||
auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundle(), launchWant, userId));
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "GetLaunchWantForBundle returns %{public}d.", errCode);
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "GetLaunchWantForBundle err: %{public}d", errCode);
|
||||
return false;
|
||||
}
|
||||
want.SetElement(launchWant.GetElement());
|
||||
@@ -109,7 +109,7 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId)
|
||||
StartAbilityUtils::startAbilityInfo = StartAbilityInfo::CreateStartAbilityInfo(want,
|
||||
userId, appIndex);
|
||||
if (StartAbilityUtils::startAbilityInfo->status != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Get targetApplicationInfo failed.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Get targetApplicationInfo failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId)
|
||||
auto ret = IN_PROCESS_CALL(AbilityEcologicalRuleMgrServiceClient::GetInstance()->QueryStartExperience(newWant,
|
||||
callerInfo, rule));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed, keep going.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed");
|
||||
return true;
|
||||
}
|
||||
return rule.resultCode == ERMS_ISALLOW_RESULTCODE;
|
||||
@@ -168,36 +168,36 @@ void EcologicalRuleInterceptor::GetEcologicalCallerInfo(const Want &want, ErmsCa
|
||||
} else {
|
||||
auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper();
|
||||
if (bundleMgrHelper == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "The bundleMgrHelper is nullptr.");
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "null bundleMgrHelper");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string callerBundleName;
|
||||
ErrCode err = IN_PROCESS_CALL(bundleMgrHelper->GetNameForUid(callerInfo.uid, callerBundleName));
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Get callerBundleName failed,uid: %{public}d.", callerInfo.uid);
|
||||
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "Get callerBundleName failed,uid: %{public}d", callerInfo.uid);
|
||||
return;
|
||||
}
|
||||
bool getCallerResult = IN_PROCESS_CALL(bundleMgrHelper->GetApplicationInfo(callerBundleName,
|
||||
AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO, userId, callerAppInfo));
|
||||
if (!getCallerResult) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "Get callerAppInfo failed.");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "Get callerAppInfo failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
callerInfo.callerAppProvisionType = callerAppInfo.appProvisionType;
|
||||
if (callerAppInfo.bundleType == AppExecFwk::BundleType::ATOMIC_SERVICE) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "the caller type is atomic service");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "atomic service caller type");
|
||||
callerInfo.callerAppType = ErmsCallerInfo::TYPE_ATOM_SERVICE;
|
||||
} else if (callerAppInfo.bundleType == AppExecFwk::BundleType::APP) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "the caller type is app");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "app caller type");
|
||||
callerInfo.callerAppType = ErmsCallerInfo::TYPE_HARMONY_APP;
|
||||
if (callerInfo.packageName == "" && callerAppInfo.name == BUNDLE_NAME_SCENEBOARD) {
|
||||
callerInfo.packageName = BUNDLE_NAME_SCENEBOARD;
|
||||
}
|
||||
} else if (callerAppInfo.bundleType == AppExecFwk::BundleType::APP_SERVICE_FWK) {
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "the caller type is app service");
|
||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "app service caller type");
|
||||
callerInfo.callerAppType = ErmsCallerInfo::TYPE_APP_SERVICE;
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void EcologicalRuleInterceptor::InitErmsCallerInfo(const Want &want,
|
||||
|
||||
GetEcologicalTargetInfo(want, abilityInfo, callerInfo);
|
||||
GetEcologicalCallerInfo(want, callerInfo, userId, callerToken);
|
||||
TAG_LOGI(AAFwkTag::ECOLOGICAL_RULE, "The ERMS's %{public}s", callerInfo.ToString().c_str());
|
||||
TAG_LOGI(AAFwkTag::ECOLOGICAL_RULE, "ERMS's %{public}s", callerInfo.ToString().c_str());
|
||||
}
|
||||
|
||||
int32_t EcologicalRuleInterceptor::GetAppTypeByBundleType(int32_t bundleType)
|
||||
|
||||
Reference in New Issue
Block a user