aafwk->ability

Signed-off-by: zhoushicheng <zhoushicheng2@huawei.com>
Change-Id: Iddbd66301d3595dfba3c13f8213fd9348cc9d68c
This commit is contained in:
zhoushicheng 2022-06-23 11:27:36 +08:00
commit 0cee8d64ad
321 changed files with 2649 additions and 3036 deletions

View File

@ -22,7 +22,6 @@ ability_runtime_system_test_app_path =
"${ability_runtime_path}/test/resource/amssystemtestability/abilitySrc"
bundlefwk_path = "//foundation/bundlemanager/bundle_framework"
bundlefwk_innerkits_path = "${bundlefwk_path}/interfaces/innerkits"
bundlefwk_inner_api_path = "${bundlefwk_path}/interfaces/inner_api"
multimedia_path = "//foundation/multimedia/image_standard"
@ -38,12 +37,17 @@ distributeddatamgr_path = "//foundation/distributeddatamgr"
form_fwk_napi_path = "${form_fwk_path}/frameworks/js/napi"
ability_base_innerapi_path = "${ability_base_path}/interfaces/inner_api"
ability_base_native_path = "${ability_base_path}/frameworks/native"
appspawn_path = "//base/startup/appspawn"
declare_args() {
background_task_mgr_continuous_task_enable = true
distributed_data_object_enable = true
ability_runtime_graphics = true
ability_runtime_power = true
ability_runtime_relational = true
ability_runtime_ces = true
ability_runtime_resource = true
ability_runtime_appspawn = true
if (!defined(global_parts_info) ||
defined(global_parts_info.account_os_account)) {
@ -51,6 +55,7 @@ declare_args() {
} else {
os_account_part_enabled = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_background_task_mgr)) {
background_task_mgr_continuous_task_enable = false
@ -60,4 +65,24 @@ declare_args() {
!defined(global_parts_info.distributeddatamgr_distributeddataobject)) {
distributed_data_object_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.distributeddatamgr_relational_store)) {
ability_runtime_relational = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.notification_common_event_service)) {
ability_runtime_ces = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.global_resource_management)) {
ability_runtime_resource = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.startup_appspawn)) {
ability_runtime_appspawn = false
}
}

View File

@ -29,7 +29,7 @@ ohos_shared_library("abilitymanager_napi") {
]
deps = [
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
"${ability_runtime_services_path}/abilitymgr:abilityms",
]
@ -47,7 +47,6 @@ ohos_shared_library("abilitymanager_napi") {
"ipc:ipc_core",
"ipc_js:rpc",
"napi:ace_napi",
"resource_management:global_resmgr",
"safwk:system_ability_fwk",
"samgr_standard:samgr_proxy",
"utils_base:utils",

View File

@ -95,8 +95,9 @@ private:
NativeValue* lastParam = (info.argc == 0) ? nullptr : info.argv[0];
NativeValue* result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JsAbilityManager::OnGetAbilityRunningInfos",
engine, CreateAsyncTaskWithLastParam(engine,
lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -126,8 +127,9 @@ private:
NativeValue* lastParam = (info.argc == 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JsAbilityManager::OnGetExtensionRunningInfos",
engine, CreateAsyncTaskWithLastParam(engine,
lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -166,8 +168,9 @@ private:
NativeValue* lastParam = (info.argc == 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JsAbilityManager::OnGetExtensionRunningInfos",
engine, CreateAsyncTaskWithLastParam(engine,
lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -182,8 +185,9 @@ private:
NativeValue* lastParam = (info.argc == 0) ? nullptr : info.argv[0];
NativeValue* result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JsAbilityManager::OnGetTopAbility",
engine, CreateAsyncTaskWithLastParam(engine,
lastParam, nullptr, std::move(complete), &result));
return result;
}
};

View File

@ -35,7 +35,7 @@ ohos_shared_library("abilitydelegatorregistry") {
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:app_context_utils",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
]
external_deps = [

View File

@ -180,7 +180,7 @@ NativeValue *JSAbilityDelegator::OnAddAbilityMonitor(NativeEngine &engine, Nativ
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnAddAbilityMonitor",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -209,8 +209,9 @@ NativeValue *JSAbilityDelegator::OnRemoveAbilityMonitor(NativeEngine &engine, Na
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JSAbilityDelegator::OnRemoveAbilityMonitor",
engine, CreateAsyncTaskWithLastParam(engine,
lastParam, nullptr, std::move(complete), &result));
if (AbilityDelegatorRegistry::GetAbilityDelegator()) {
for (auto iter = monitorRecord_.begin(); iter != monitorRecord_.end(); ++iter) {
@ -283,7 +284,7 @@ NativeValue *JSAbilityDelegator::OnWaitAbilityMonitor(NativeEngine &engine, Nati
}
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnWaitAbilityMonitor",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, std::move(execute), std::move(complete), &result));
return result;
}
@ -311,7 +312,7 @@ NativeValue *JSAbilityDelegator::OnPrint(NativeEngine &engine, NativeCallbackInf
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnPrint",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -387,7 +388,7 @@ NativeValue *JSAbilityDelegator::OnExecuteShellCommand(NativeEngine &engine, Nat
}
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnExecuteShellCommand:" + cmd,
engine, CreateAsyncTaskWithLastParam(engine, lastParam, std::move(execute), std::move(complete), &result));
return result;
}
@ -470,7 +471,7 @@ NativeValue *JSAbilityDelegator::OnGetCurrentTopAbility(NativeEngine &engine, Na
NativeValue *lastParam = (info.argc >= ARGC_ONE) ? info.argv[INDEX_ZERO] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnGetCurrentTopAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -502,7 +503,7 @@ NativeValue *JSAbilityDelegator::OnStartAbility(NativeEngine &engine, NativeCall
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnStartAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -530,7 +531,7 @@ NativeValue *JSAbilityDelegator::OnDoAbilityForeground(NativeEngine &engine, Nat
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnDoAbilityForeground",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -558,7 +559,7 @@ NativeValue *JSAbilityDelegator::OnDoAbilityBackground(NativeEngine &engine, Nat
NativeValue *lastParam = (info.argc > ARGC_ONE) ? info.argv[INDEX_ONE] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnDoAbilityBackground",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -586,7 +587,7 @@ NativeValue *JSAbilityDelegator::OnFinishTest(NativeEngine &engine, NativeCallba
};
NativeValue *lastParam = (info.argc > ARGC_TWO) ? info.argv[INDEX_TWO] : nullptr;
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAbilityDelegator::OnFinishTest",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}

View File

@ -27,9 +27,9 @@ ohos_shared_library("appmanager_napi") {
"js_app_manager_utils.cpp",
]
configs = [ "${ability_runtime_path}/services/common:common_config" ]
configs = [ "${ability_runtime_services_path}/common:common_config" ]
deps = [ "${ability_runtime_path}/services/abilitymgr:abilityms" ]
deps = [ "${ability_runtime_services_path}/abilitymgr:abilityms" ]
external_deps = [
"ability_base:base",

View File

@ -142,7 +142,7 @@ private:
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnRegisterApplicationStateObserver",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return engine.CreateNumber(observerId);
}
@ -195,7 +195,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[INDEX_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnUnregisterApplicationStateObserver",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -229,7 +229,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ZERO) ? nullptr : info.argv[INDEX_ZERO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnGetForegroundApplications",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -250,7 +250,7 @@ private:
NativeValue* lastParam = (info.argc == 0) ? nullptr : info.argv[0];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnGetProcessRunningInfos",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -277,7 +277,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ZERO) ? nullptr : info.argv[INDEX_ZERO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnIsRunningInStabilityTest",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -292,7 +292,7 @@ private:
std::string bundleName;
if (!ConvertFromJsValue(engine, info.argv[0], bundleName)) {
HILOG_ERROR("get bundelName failed!");
HILOG_ERROR("get bundleName failed!");
return engine.CreateUndefined();
}
@ -314,7 +314,7 @@ private:
NativeValue* lastParam = (info.argc == 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnkillProcess",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -329,7 +329,7 @@ private:
std::string bundleName;
if (!ConvertFromJsValue(engine, info.argv[0], bundleName)) {
HILOG_ERROR("get bundelName failed!");
HILOG_ERROR("get bundleName failed!");
return engine.CreateUndefined();
}
@ -351,7 +351,7 @@ private:
NativeValue* lastParam = (info.argc == 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnClearUpApplicationData",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -386,7 +386,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_TWO) ? nullptr : info.argv[INDEX_TWO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSAppManager::OnKillProcessWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -473,7 +473,7 @@ void JSApplicationStateObserver::OnForegroundApplicationChanged(const AppStateDa
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSApplicationStateObserver::OnForegroundApplicationChanged",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
@ -500,7 +500,7 @@ void JSApplicationStateObserver::OnAbilityStateChanged(const AbilityStateData &a
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSApplicationStateObserver::OnAbilityStateChanged",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
@ -526,7 +526,7 @@ void JSApplicationStateObserver::OnExtensionStateChanged(const AbilityStateData
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSApplicationStateObserver::OnExtensionStateChanged",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
@ -552,7 +552,7 @@ void JSApplicationStateObserver::OnProcessCreated(const ProcessData &processData
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSApplicationStateObserver::OnProcessCreated",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
@ -578,7 +578,7 @@ void JSApplicationStateObserver::OnProcessDied(const ProcessData &processData)
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSApplicationStateObserver::OnProcessCreated",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}

View File

@ -27,9 +27,9 @@ ohos_shared_library("errormanager_napi") {
"js_error_observer.cpp",
]
configs = [ "${ability_runtime_path}/services/common:common_config" ]
configs = [ "${ability_runtime_services_path}/common:common_config" ]
deps = [ "${ability_runtime_path}/frameworks/kits/appkit:appkit_native" ]
deps = [ "${ability_runtime_kits_path}/appkit:appkit_native" ]
external_deps = [
"ability_base:base",

View File

@ -114,7 +114,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[INDEX_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSErrorManager::OnUnregisterErrorObserver",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}

View File

@ -42,7 +42,7 @@ void JsErrorObserver::OnUnhandledException(std::string errMsg)
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsErrorObserver::OnUnhandledException",
engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}

View File

@ -19,6 +19,7 @@ class ExtensionContext extends Context {
super(obj);
this.currentHapModuleInfo = obj.currentHapModuleInfo
this.config = obj.config
this.extensionAbilityInfo = obj.extensionAbilityInfo
}
onUpdateConfiguration(config) {

View File

@ -36,7 +36,7 @@ ohos_shared_library("featureability") {
deps = [
"${ability_runtime_innerkits_path}/dataobs_manager:dataobs_manager",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
"//third_party/libuv:uv_static",
]
@ -56,7 +56,6 @@ ohos_shared_library("featureability") {
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"napi:ace_napi",
"relational_store:native_appdatafwk",
"relational_store:native_rdb",
"relational_store:rdb_data_share_adapter",
"utils_base:utils",

View File

@ -25,7 +25,7 @@ ohos_shared_library("featureability_napi") {
configs = [ "${ability_runtime_services_path}/common:common_config" ]
deps = [ "${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common" ]
deps = [ "${ability_runtime_napi_path}/inner/napi_common:napi_common" ]
external_deps = [
"ability_base:want",

View File

@ -127,7 +127,7 @@ NativeValue* JsFeatureAbility::OnStartAbility(NativeEngine &engine, NativeCallba
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSFeatureAbility::OnStartAbility",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return result;
}
@ -234,7 +234,7 @@ NativeValue *JsFeatureAbility::OnFinishWithResult(NativeEngine &engine, NativeCa
};
NativeValue *result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSFeatureAbility::OnFinishWithResult",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return result;
}

View File

@ -53,8 +53,6 @@ ohos_shared_library("napi_common") {
"ipc:ipc_core",
"ipc_js:rpc",
"napi:ace_napi",
"relational_store:native_appdatafwk",
"relational_store:native_rdb",
"utils_base:utils",
]

View File

@ -4128,7 +4128,7 @@ void NAPIAbilityConnection::OnAbilityConnectDone(
return;
}
uv_work_t *work = new uv_work_t;
uv_work_t *work = new(std::nothrow) uv_work_t;
if (work == nullptr) {
HILOG_ERROR("%{public}s, work==nullptr.", __func__);
return;
@ -4237,7 +4237,7 @@ void NAPIAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementNam
HILOG_INFO("%{public}s bundleName:%{public}s abilityName:%{public}s moduleName:%{public}s, resultCode:%{public}d",
__func__, element.GetBundleName().c_str(), element.GetAbilityName().c_str(), moduleName_.c_str(), resultCode);
uv_work_t *work = new uv_work_t;
uv_work_t *work = new(std::nothrow) uv_work_t;
if (work == nullptr) {
HILOG_ERROR("%{public}s, work == nullptr.", __func__);
return;

View File

@ -29,7 +29,7 @@ ohos_shared_library("missionmanager_napi") {
]
deps = [
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
"${ability_runtime_services_path}/abilitymgr:abilityms",
]
@ -44,7 +44,6 @@ ohos_shared_library("missionmanager_napi") {
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc_js:rpc",
"resource_management:global_resmgr",
"safwk:system_ability_fwk",
"samgr_standard:samgr_proxy",
"utils_base:utils",
@ -80,7 +79,7 @@ ohos_shared_library("distributedmissionmanager") {
"mission_continue_stub.cpp",
]
deps = [ "${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common" ]
deps = [ "${ability_runtime_napi_path}/inner/napi_common:napi_common" ]
external_deps = [
"ability_base:want",

View File

@ -306,109 +306,109 @@ napi_value NAPI_StopSyncRemoteMissions(napi_env env, napi_callback_info info)
return result;
}
RegisterMissonCB *CreateRegisterMissonCBCBInfo(napi_env env)
RegisterMissionCB *CreateRegisterMissionCBCBInfo(napi_env env)
{
HILOG_INFO("%{public}s called.", __func__);
auto registerMissonCB = new (std::nothrow) RegisterMissonCB;
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s registerMissonCB == nullptr", __func__);
auto registerMissionCB = new (std::nothrow) RegisterMissionCB;
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s registerMissionCB == nullptr", __func__);
return nullptr;
}
registerMissonCB->cbBase.cbInfo.env = env;
registerMissonCB->cbBase.asyncWork = nullptr;
registerMissonCB->cbBase.deferred = nullptr;
registerMissonCB->callbackRef = nullptr;
registerMissionCB->cbBase.cbInfo.env = env;
registerMissionCB->cbBase.asyncWork = nullptr;
registerMissionCB->cbBase.deferred = nullptr;
registerMissionCB->callbackRef = nullptr;
HILOG_INFO("%{public}s end.", __func__);
return registerMissonCB;
return registerMissionCB;
}
void RegisterMissonExecuteCB(napi_env env, void *data)
void RegisterMissionExecuteCB(napi_env env, void *data)
{
HILOG_INFO("%{public}s called.", __func__);
auto registerMissonCB = (RegisterMissonCB*)data;
auto registerMissionCB = (RegisterMissionCB*)data;
std::lock_guard<std::mutex> autoLock(registrationLock_);
sptr<NAPIRemoteMissionListener> registration;
auto item = registration_.find(registerMissonCB->deviceId);
auto item = registration_.find(registerMissionCB->deviceId);
if (item != registration_.end()) {
HILOG_INFO("registration exits.");
registration = registration_[registerMissonCB->deviceId];
registration = registration_[registerMissionCB->deviceId];
} else {
HILOG_INFO("registration not exits.");
registration = new (std::nothrow) NAPIRemoteMissionListener();
}
registerMissonCB->missionRegistration = registration;
if (registerMissonCB->missionRegistration == nullptr) {
registerMissionCB->missionRegistration = registration;
if (registerMissionCB->missionRegistration == nullptr) {
HILOG_ERROR("%{public}s missionRegistration == nullptr.", __func__);
registerMissonCB->result = -1;
registerMissionCB->result = -1;
return;
}
registerMissonCB->missionRegistration->SetEnv(env);
registerMissonCB->missionRegistration->
SetNotifyMissionsChangedCBRef(registerMissonCB->missionRegistrationCB.callback[0]);
registerMissonCB->missionRegistration->
SetNotifySnapshotCBRef(registerMissonCB->missionRegistrationCB.callback[1]);
registerMissonCB->missionRegistration->
SetNotifyNetDisconnectCBRef(registerMissonCB->
registerMissionCB->missionRegistration->SetEnv(env);
registerMissionCB->missionRegistration->
SetNotifyMissionsChangedCBRef(registerMissionCB->missionRegistrationCB.callback[0]);
registerMissionCB->missionRegistration->
SetNotifySnapshotCBRef(registerMissionCB->missionRegistrationCB.callback[1]);
registerMissionCB->missionRegistration->
SetNotifyNetDisconnectCBRef(registerMissionCB->
missionRegistrationCB.callback[2]); // 2 refers the second argument
HILOG_INFO("set callback success.");
registerMissonCB->result =
registerMissionCB->result =
AbilityManagerClient::GetInstance()->
RegisterMissionListener(registerMissonCB->deviceId,
registerMissonCB->missionRegistration);
if (registerMissonCB->result == NO_ERROR) {
RegisterMissionListener(registerMissionCB->deviceId,
registerMissionCB->missionRegistration);
if (registerMissionCB->result == NO_ERROR) {
HILOG_INFO("add registration.");
registration_[registerMissonCB->deviceId] = registration;
registration_[registerMissionCB->deviceId] = registration;
}
HILOG_INFO("%{public}s end.deviceId:%{public}d ", __func__, registerMissonCB->result);
HILOG_INFO("%{public}s end.deviceId:%{public}d ", __func__, registerMissionCB->result);
}
void RegisterMissonCallbackCompletedCB(napi_env env, napi_status status, void *data)
void RegisterMissionCallbackCompletedCB(napi_env env, napi_status status, void *data)
{
HILOG_INFO("%{public}s called.", __func__);
auto registerMissonCB = static_cast<RegisterMissonCB *>(data);
auto registerMissionCB = static_cast<RegisterMissionCB *>(data);
// set result
napi_value result[2] = { 0 };
napi_get_undefined(env, &result[1]);
if (registerMissonCB->result == 0) {
if (registerMissionCB->result == 0) {
napi_get_undefined(env, &result[0]);
} else {
napi_value message = nullptr;
napi_create_string_utf8(env, ("registerMissionListener failed, error : " +
std::to_string(registerMissonCB->result)).c_str(), NAPI_AUTO_LENGTH, &message);
std::to_string(registerMissionCB->result)).c_str(), NAPI_AUTO_LENGTH, &message);
napi_create_error(env, nullptr, message, &result[0]);
}
if (registerMissonCB->callbackRef == nullptr) { // promise
if (registerMissonCB->result == 0) {
napi_resolve_deferred(env, registerMissonCB->cbBase.deferred, result[1]);
if (registerMissionCB->callbackRef == nullptr) { // promise
if (registerMissionCB->result == 0) {
napi_resolve_deferred(env, registerMissionCB->cbBase.deferred, result[1]);
} else {
napi_reject_deferred(env, registerMissonCB->cbBase.deferred, result[0]);
napi_reject_deferred(env, registerMissionCB->cbBase.deferred, result[0]);
}
} else { // AsyncCallback
napi_value callback = nullptr;
napi_get_reference_value(env, registerMissonCB->callbackRef, &callback);
napi_get_reference_value(env, registerMissionCB->callbackRef, &callback);
napi_value callResult;
napi_call_function(env, nullptr, callback, ARGS_TWO, &result[0], &callResult);
napi_delete_reference(env, registerMissonCB->callbackRef);
napi_delete_reference(env, registerMissionCB->callbackRef);
}
NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, registerMissonCB->cbBase.asyncWork));
delete registerMissonCB;
registerMissonCB = nullptr;
NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, registerMissionCB->cbBase.asyncWork));
delete registerMissionCB;
registerMissionCB = nullptr;
HILOG_INFO("%{public}s end.", __func__);
}
napi_value RegisterMissonAsync(napi_env env, napi_value *args, RegisterMissonCB *registerMissonCB)
napi_value RegisterMissionAsync(napi_env env, napi_value *args, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s asyncCallback.", __func__);
if (args == nullptr || registerMissonCB == nullptr) {
if (args == nullptr || registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s, param == nullptr.", __func__);
return nullptr;
}
napi_value result = nullptr;
if (registerMissonCB->callbackRef == nullptr) {
napi_create_promise(env, &registerMissonCB->cbBase.deferred, &result);
if (registerMissionCB->callbackRef == nullptr) {
napi_create_promise(env, &registerMissionCB->cbBase.deferred, &result);
} else {
napi_get_undefined(env, &result);
}
@ -418,16 +418,16 @@ napi_value RegisterMissonAsync(napi_env env, napi_value *args, RegisterMissonCB
napi_create_async_work(env,
nullptr,
resourceName,
RegisterMissonExecuteCB,
RegisterMissonCallbackCompletedCB,
(void *)registerMissonCB,
&registerMissonCB->cbBase.asyncWork);
napi_queue_async_work(env, registerMissonCB->cbBase.asyncWork);
RegisterMissionExecuteCB,
RegisterMissionCallbackCompletedCB,
(void *)registerMissionCB,
&registerMissionCB->cbBase.asyncWork);
napi_queue_async_work(env, registerMissionCB->cbBase.asyncWork);
HILOG_INFO("%{public}s asyncCallback end.", __func__);
return result;
}
bool SetCallbackReference(napi_env env, const napi_value& value, RegisterMissonCB *registerMissonCB)
bool SetCallbackReference(napi_env env, const napi_value& value, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s called.", __func__);
bool isFirstCallback = false;
@ -452,7 +452,7 @@ bool SetCallbackReference(napi_env env, const napi_value& value, RegisterMissonC
HILOG_ERROR("%{public}s, notifyMissionsChanged callback error type.", __func__);
return false;
}
napi_create_reference(env, jsMethod, 1, &registerMissonCB->missionRegistrationCB.callback[0]);
napi_create_reference(env, jsMethod, 1, &registerMissionCB->missionRegistrationCB.callback[0]);
napi_get_named_property(env, value, "notifySnapshot", &jsMethod);
if (jsMethod == nullptr) {
@ -464,7 +464,7 @@ bool SetCallbackReference(napi_env env, const napi_value& value, RegisterMissonC
HILOG_ERROR("%{public}s, notifySnapshot callback error type.", __func__);
return false;
}
napi_create_reference(env, jsMethod, 1, &registerMissonCB->missionRegistrationCB.callback[1]);
napi_create_reference(env, jsMethod, 1, &registerMissionCB->missionRegistrationCB.callback[1]);
napi_get_named_property(env, value, "notifyNetDisconnect", &jsMethod);
if (jsMethod == nullptr) {
@ -477,18 +477,18 @@ bool SetCallbackReference(napi_env env, const napi_value& value, RegisterMissonC
return false;
}
napi_create_reference(env, jsMethod, 1,
&registerMissonCB->missionRegistrationCB.callback[2]); // 2 refers the second argument
&registerMissionCB->missionRegistrationCB.callback[2]); // 2 refers the second argument
HILOG_INFO("%{public}s called end.", __func__);
return true;
}
bool CreateCallbackReference(napi_env env, const napi_value& value, RegisterMissonCB *registerMissonCB)
bool CreateCallbackReference(napi_env env, const napi_value& value, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s called.", __func__);
napi_valuetype valuetype = napi_undefined;
napi_typeof(env, value, &valuetype);
if (valuetype == napi_object) {
if (!SetCallbackReference(env, value, registerMissonCB)) {
if (!SetCallbackReference(env, value, registerMissionCB)) {
HILOG_ERROR("%{public}s, Wrong callback.", __func__);
return false;
}
@ -500,7 +500,7 @@ bool CreateCallbackReference(napi_env env, const napi_value& value, RegisterMiss
return true;
}
napi_value RegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMissonCB *registerMissonCB)
napi_value RegisterMissionWrap(napi_env env, napi_callback_info info, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s called.", __func__);
size_t argcAsync = 3;
@ -540,9 +540,9 @@ napi_value RegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMis
HILOG_ERROR("%{public}s, deviceId length not correct", __func__);
return nullptr;
}
registerMissonCB->deviceId = deviceId;
registerMissionCB->deviceId = deviceId;
if (argcAsync > 1 && !CreateCallbackReference(env, args[1], registerMissonCB)) {
if (argcAsync > 1 && !CreateCallbackReference(env, args[1], registerMissionCB)) {
HILOG_ERROR("%{public}s, Wrong arguments.", __func__);
return nullptr;
}
@ -553,10 +553,10 @@ napi_value RegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMis
HILOG_ERROR("%{public}s, callback error type.", __func__);
return nullptr;
}
napi_create_reference(env, args[ARGS_TWO], 1, &registerMissonCB->callbackRef);
napi_create_reference(env, args[ARGS_TWO], 1, &registerMissionCB->callbackRef);
}
ret = RegisterMissonAsync(env, args, registerMissonCB);
ret = RegisterMissionAsync(env, args, registerMissionCB);
HILOG_INFO("%{public}s called end.", __func__);
return ret;
}
@ -564,17 +564,17 @@ napi_value RegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMis
napi_value NAPI_RegisterMissionListener(napi_env env, napi_callback_info info)
{
HILOG_INFO("%{public}s called.", __func__);
RegisterMissonCB *registerMissonCB = CreateRegisterMissonCBCBInfo(env);
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s registerMissonCB == nullptr", __func__);
RegisterMissionCB *registerMissionCB = CreateRegisterMissionCBCBInfo(env);
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s registerMissionCB == nullptr", __func__);
NAPI_ASSERT(env, false, "wrong arguments");
}
napi_value ret = RegisterMissonWrap(env, info, registerMissonCB);
napi_value ret = RegisterMissionWrap(env, info, registerMissionCB);
if (ret == nullptr) {
HILOG_ERROR("%{public}s ret == nullptr", __func__);
delete registerMissonCB;
registerMissonCB = nullptr;
delete registerMissionCB;
registerMissionCB = nullptr;
NAPI_ASSERT(env, false, "wrong arguments");
}
HILOG_INFO("%{public}s end.", __func__);
@ -632,25 +632,26 @@ void UvWorkNotifyMissionChanged(uv_work_t *work, int status)
HILOG_ERROR("UvWorkNotifyMissionChanged, work is null");
return;
}
RegisterMissonCB *registerMissonCB = static_cast<RegisterMissonCB *>(work->data);
if (registerMissonCB == nullptr) {
HILOG_ERROR("UvWorkNotifyMissionChanged, registerMissonCB is null");
RegisterMissionCB *registerMissionCB = static_cast<RegisterMissionCB *>(work->data);
if (registerMissionCB == nullptr) {
HILOG_ERROR("UvWorkNotifyMissionChanged, registerMissionCB is null");
delete work;
return;
}
napi_value result = nullptr;
result =
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
WrapString(registerMissionCB->cbBase.cbInfo.env, registerMissionCB->deviceId.c_str(), "deviceId");
napi_value callback = nullptr;
napi_value undefined = nullptr;
napi_get_undefined(registerMissonCB->cbBase.cbInfo.env, &undefined);
napi_get_undefined(registerMissionCB->cbBase.cbInfo.env, &undefined);
napi_value callResult = nullptr;
napi_get_reference_value(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->cbBase.cbInfo.callback, &callback);
napi_get_reference_value(
registerMissionCB->cbBase.cbInfo.env, registerMissionCB->cbBase.cbInfo.callback, &callback);
napi_call_function(registerMissonCB->cbBase.cbInfo.env, undefined, callback, 1, &result, &callResult);
delete registerMissonCB;
registerMissonCB = nullptr;
napi_call_function(registerMissionCB->cbBase.cbInfo.env, undefined, callback, 1, &result, &callResult);
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
HILOG_INFO("UvWorkNotifyMissionChanged, uv_queue_work end");
}
@ -672,22 +673,22 @@ void NAPIRemoteMissionListener::NotifyMissionsChanged(const std::string& deviceI
return;
}
auto registerMissonCB = new (std::nothrow) RegisterMissonCB;
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissonCB == nullptr.", __func__);
auto registerMissionCB = new (std::nothrow) RegisterMissionCB;
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissionCB == nullptr.", __func__);
delete work;
return;
}
registerMissonCB->cbBase.cbInfo.env = env_;
registerMissonCB->cbBase.cbInfo.callback = notifyMissionsChangedRef_;
registerMissonCB->deviceId = deviceId;
work->data = (void *)registerMissonCB;
registerMissionCB->cbBase.cbInfo.env = env_;
registerMissionCB->cbBase.cbInfo.callback = notifyMissionsChangedRef_;
registerMissionCB->deviceId = deviceId;
work->data = (void *)registerMissionCB;
int rev = uv_queue_work(
loop, work, [](uv_work_t *work) {}, UvWorkNotifyMissionChanged);
if (rev != 0) {
delete registerMissonCB;
registerMissonCB = nullptr;
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
}
HILOG_INFO("%{public}s, end.", __func__);
@ -700,27 +701,28 @@ void UvWorkNotifySnapshot(uv_work_t *work, int status)
HILOG_ERROR("UvWorkNotifySnapshot, work is null");
return;
}
RegisterMissonCB *registerMissonCB = static_cast<RegisterMissonCB *>(work->data);
if (registerMissonCB == nullptr) {
HILOG_ERROR("UvWorkNotifySnapshot, registerMissonCB is null");
RegisterMissionCB *registerMissionCB = static_cast<RegisterMissionCB *>(work->data);
if (registerMissionCB == nullptr) {
HILOG_ERROR("UvWorkNotifySnapshot, registerMissionCB is null");
delete work;
return;
}
napi_value result[2] = {0};
result[0] =
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
WrapString(registerMissionCB->cbBase.cbInfo.env, registerMissionCB->deviceId.c_str(), "deviceId");
result[1] =
WrapInt32(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->missionId, "missionId");
WrapInt32(registerMissionCB->cbBase.cbInfo.env, registerMissionCB->missionId, "missionId");
napi_value callback = nullptr;
napi_value undefined = nullptr;
napi_get_undefined(registerMissonCB->cbBase.cbInfo.env, &undefined);
napi_get_undefined(registerMissionCB->cbBase.cbInfo.env, &undefined);
napi_value callResult = nullptr;
napi_get_reference_value(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->cbBase.cbInfo.callback, &callback);
napi_get_reference_value(
registerMissionCB->cbBase.cbInfo.env, registerMissionCB->cbBase.cbInfo.callback, &callback);
napi_call_function(registerMissonCB->cbBase.cbInfo.env, undefined, callback, ARGS_TWO, &result[0], &callResult);
delete registerMissonCB;
registerMissonCB = nullptr;
napi_call_function(registerMissionCB->cbBase.cbInfo.env, undefined, callback, ARGS_TWO, &result[0], &callResult);
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
HILOG_INFO("UvWorkNotifySnapshot, uv_queue_work end");
}
@ -741,23 +743,23 @@ void NAPIRemoteMissionListener::NotifySnapshot(const std::string& deviceId, int3
return;
}
auto registerMissonCB = new (std::nothrow) RegisterMissonCB;
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissonCB == nullptr.", __func__);
auto registerMissionCB = new (std::nothrow) RegisterMissionCB;
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissionCB == nullptr.", __func__);
delete work;
return;
}
registerMissonCB->cbBase.cbInfo.env = env_;
registerMissonCB->cbBase.cbInfo.callback = notifySnapshotRef_;
registerMissonCB->deviceId = deviceId;
registerMissonCB->missionId = missionId;
work->data = (void *)registerMissonCB;
registerMissionCB->cbBase.cbInfo.env = env_;
registerMissionCB->cbBase.cbInfo.callback = notifySnapshotRef_;
registerMissionCB->deviceId = deviceId;
registerMissionCB->missionId = missionId;
work->data = (void *)registerMissionCB;
int rev = uv_queue_work(
loop, work, [](uv_work_t *work) {}, UvWorkNotifySnapshot);
if (rev != 0) {
delete registerMissonCB;
registerMissonCB = nullptr;
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
}
HILOG_INFO("%{public}s, end.", __func__);
@ -770,28 +772,29 @@ void UvWorkNotifyNetDisconnect(uv_work_t *work, int status)
HILOG_ERROR("UvWorkNotifyNetDisconnect, work is null");
return;
}
RegisterMissonCB *registerMissonCB = static_cast<RegisterMissonCB *>(work->data);
if (registerMissonCB == nullptr) {
HILOG_ERROR("UvWorkNotifyNetDisconnect, registerMissonCB is null");
RegisterMissionCB *registerMissionCB = static_cast<RegisterMissionCB *>(work->data);
if (registerMissionCB == nullptr) {
HILOG_ERROR("UvWorkNotifyNetDisconnect, registerMissionCB is null");
delete work;
return;
}
napi_value result[2] = {0};
result[0] =
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
HILOG_INFO("UvWorkNotifyNetDisconnect, state = %{public}d", registerMissonCB->state);
WrapString(registerMissionCB->cbBase.cbInfo.env, registerMissionCB->deviceId.c_str(), "deviceId");
HILOG_INFO("UvWorkNotifyNetDisconnect, state = %{public}d", registerMissionCB->state);
result[1] =
WrapInt32(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->state, "state");
WrapInt32(registerMissionCB->cbBase.cbInfo.env, registerMissionCB->state, "state");
napi_value callback = nullptr;
napi_value undefined = nullptr;
napi_get_undefined(registerMissonCB->cbBase.cbInfo.env, &undefined);
napi_get_undefined(registerMissionCB->cbBase.cbInfo.env, &undefined);
napi_value callResult = nullptr;
napi_get_reference_value(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->cbBase.cbInfo.callback, &callback);
napi_get_reference_value(
registerMissionCB->cbBase.cbInfo.env, registerMissionCB->cbBase.cbInfo.callback, &callback);
napi_call_function(registerMissonCB->cbBase.cbInfo.env, undefined, callback, ARGS_TWO, &result[0], &callResult);
delete registerMissonCB;
registerMissonCB = nullptr;
napi_call_function(registerMissionCB->cbBase.cbInfo.env, undefined, callback, ARGS_TWO, &result[0], &callResult);
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
HILOG_INFO("UvWorkNotifyNetDisconnect, uv_queue_work end");
}
@ -813,102 +816,102 @@ void NAPIRemoteMissionListener::NotifyNetDisconnect(const std::string& deviceId,
return;
}
auto registerMissonCB = new (std::nothrow) RegisterMissonCB;
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissonCB == nullptr.", __func__);
auto registerMissionCB = new (std::nothrow) RegisterMissionCB;
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s, registerMissionCB == nullptr.", __func__);
delete work;
return;
}
registerMissonCB->cbBase.cbInfo.env = env_;
registerMissonCB->cbBase.cbInfo.callback = notifyNetDisconnectRef_;
registerMissonCB->deviceId = deviceId;
registerMissonCB->state = state;
work->data = (void *)registerMissonCB;
registerMissionCB->cbBase.cbInfo.env = env_;
registerMissionCB->cbBase.cbInfo.callback = notifyNetDisconnectRef_;
registerMissionCB->deviceId = deviceId;
registerMissionCB->state = state;
work->data = (void *)registerMissionCB;
int rev = uv_queue_work(
loop, work, [](uv_work_t *work) {}, UvWorkNotifyNetDisconnect);
if (rev != 0) {
delete registerMissonCB;
registerMissonCB = nullptr;
delete registerMissionCB;
registerMissionCB = nullptr;
delete work;
}
HILOG_INFO("%{public}s, end.", __func__);
}
void UnRegisterMissonExecuteCB(napi_env env, void *data)
void UnRegisterMissionExecuteCB(napi_env env, void *data)
{
HILOG_INFO("%{public}s called.", __func__);
auto registerMissonCB = (RegisterMissonCB*)data;
auto registerMissionCB = (RegisterMissionCB*)data;
std::lock_guard<std::mutex> autoLock(registrationLock_);
sptr<NAPIRemoteMissionListener> registration;
auto item = registration_.find(registerMissonCB->deviceId);
auto item = registration_.find(registerMissionCB->deviceId);
if (item != registration_.end()) {
HILOG_INFO("registration exits.");
registration = registration_[registerMissonCB->deviceId];
registration = registration_[registerMissionCB->deviceId];
} else {
HILOG_INFO("registration not exits.");
registerMissonCB->result = -1;
registerMissionCB->result = -1;
return;
}
registerMissonCB->missionRegistration = registration;
registerMissionCB->missionRegistration = registration;
registerMissonCB->result =
registerMissionCB->result =
AbilityManagerClient::GetInstance()->
UnRegisterMissionListener(registerMissonCB->deviceId,
registerMissonCB->missionRegistration);
if (registerMissonCB->result == NO_ERROR) {
UnRegisterMissionListener(registerMissionCB->deviceId,
registerMissionCB->missionRegistration);
if (registerMissionCB->result == NO_ERROR) {
HILOG_INFO("remove registration.");
registration_.erase(registerMissonCB->deviceId);
registration_.erase(registerMissionCB->deviceId);
}
HILOG_INFO("%{public}s end.deviceId:%{public}d ", __func__, registerMissonCB->result);
HILOG_INFO("%{public}s end.deviceId:%{public}d ", __func__, registerMissionCB->result);
}
void UnRegisterMissonPromiseCompletedCB(napi_env env, napi_status status, void *data)
void UnRegisterMissionPromiseCompletedCB(napi_env env, napi_status status, void *data)
{
HILOG_INFO("%{public}s called.", __func__);
auto registerMissonCB = (RegisterMissonCB*)data;
auto registerMissionCB = (RegisterMissionCB*)data;
// set result
napi_value result[2] = { 0 };
napi_get_undefined(env, &result[1]);
if (registerMissonCB->result == 0) {
if (registerMissionCB->result == 0) {
napi_get_undefined(env, &result[0]);
} else {
napi_value message = nullptr;
napi_create_string_utf8(env, ("unRegisterMissionListener failed, error : " +
std::to_string(registerMissonCB->result)).c_str(), NAPI_AUTO_LENGTH, &message);
std::to_string(registerMissionCB->result)).c_str(), NAPI_AUTO_LENGTH, &message);
napi_create_error(env, nullptr, message, &result[0]);
}
if (registerMissonCB->callbackRef == nullptr) { // promise
if (registerMissonCB->result == 0) {
napi_resolve_deferred(env, registerMissonCB->cbBase.deferred, result[1]);
if (registerMissionCB->callbackRef == nullptr) { // promise
if (registerMissionCB->result == 0) {
napi_resolve_deferred(env, registerMissionCB->cbBase.deferred, result[1]);
} else {
napi_reject_deferred(env, registerMissonCB->cbBase.deferred, result[0]);
napi_reject_deferred(env, registerMissionCB->cbBase.deferred, result[0]);
}
} else { // AsyncCallback
napi_value callback = nullptr;
napi_get_reference_value(env, registerMissonCB->callbackRef, &callback);
napi_get_reference_value(env, registerMissionCB->callbackRef, &callback);
napi_value callResult;
napi_call_function(env, nullptr, callback, ARGS_TWO, &result[0], &callResult);
napi_delete_reference(env, registerMissonCB->callbackRef);
napi_delete_reference(env, registerMissionCB->callbackRef);
}
napi_delete_async_work(env, registerMissonCB->cbBase.asyncWork);
delete registerMissonCB;
registerMissonCB = nullptr;
napi_delete_async_work(env, registerMissionCB->cbBase.asyncWork);
delete registerMissionCB;
registerMissionCB = nullptr;
HILOG_INFO("%{public}s end.", __func__);
}
napi_value UnRegisterMissonPromise(napi_env env, RegisterMissonCB *registerMissonCB)
napi_value UnRegisterMissionPromise(napi_env env, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s asyncCallback.", __func__);
if (registerMissonCB == nullptr) {
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s, param == nullptr.", __func__);
return nullptr;
}
napi_value promise = nullptr;
if (registerMissonCB->callbackRef == nullptr) {
napi_create_promise(env, &registerMissonCB->cbBase.deferred, &promise);
if (registerMissionCB->callbackRef == nullptr) {
napi_create_promise(env, &registerMissionCB->cbBase.deferred, &promise);
} else {
napi_get_undefined(env, &promise);
}
@ -919,16 +922,16 @@ napi_value UnRegisterMissonPromise(napi_env env, RegisterMissonCB *registerMisso
napi_create_async_work(env,
nullptr,
resourceName,
UnRegisterMissonExecuteCB,
UnRegisterMissonPromiseCompletedCB,
(void *)registerMissonCB,
&registerMissonCB->cbBase.asyncWork);
napi_queue_async_work(env, registerMissonCB->cbBase.asyncWork);
UnRegisterMissionExecuteCB,
UnRegisterMissionPromiseCompletedCB,
(void *)registerMissionCB,
&registerMissionCB->cbBase.asyncWork);
napi_queue_async_work(env, registerMissionCB->cbBase.asyncWork);
HILOG_INFO("%{public}s asyncCallback end.", __func__);
return promise;
}
bool GetUnRegisterMissonDeviceId(napi_env env, const napi_value& value, RegisterMissonCB *registerMissonCB)
bool GetUnRegisterMissionDeviceId(napi_env env, const napi_value& value, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s called.", __func__);
napi_value firstNApi = nullptr;
@ -959,12 +962,12 @@ bool GetUnRegisterMissonDeviceId(napi_env env, const napi_value& value, Register
HILOG_ERROR("%{public}s, deviceId length not correct", __func__);
return false;
}
registerMissonCB->deviceId = deviceId;
registerMissionCB->deviceId = deviceId;
HILOG_INFO("%{public}s called end.", __func__);
return true;
}
napi_value UnRegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMissonCB *registerMissonCB)
napi_value UnRegisterMissionWrap(napi_env env, napi_callback_info info, RegisterMissionCB *registerMissionCB)
{
HILOG_INFO("%{public}s called.", __func__);
size_t argc = 2;
@ -978,7 +981,7 @@ napi_value UnRegisterMissonWrap(napi_env env, napi_callback_info info, RegisterM
return nullptr;
}
if (!GetUnRegisterMissonDeviceId(env, args[0], registerMissonCB)) {
if (!GetUnRegisterMissionDeviceId(env, args[0], registerMissionCB)) {
HILOG_ERROR("%{public}s, Wrong argument.", __func__);
return nullptr;
}
@ -990,9 +993,9 @@ napi_value UnRegisterMissonWrap(napi_env env, napi_callback_info info, RegisterM
HILOG_ERROR("%{public}s, callback error type.", __func__);
return nullptr;
}
napi_create_reference(env, args[1], 1, &registerMissonCB->callbackRef);
napi_create_reference(env, args[1], 1, &registerMissionCB->callbackRef);
}
ret = UnRegisterMissonPromise(env, registerMissonCB);
ret = UnRegisterMissionPromise(env, registerMissionCB);
HILOG_INFO("%{public}s called end.", __func__);
return ret;
}
@ -1000,17 +1003,17 @@ napi_value UnRegisterMissonWrap(napi_env env, napi_callback_info info, RegisterM
napi_value NAPI_UnRegisterMissionListener(napi_env env, napi_callback_info info)
{
HILOG_INFO("%{public}s called.", __func__);
RegisterMissonCB *registerMissonCB = CreateRegisterMissonCBCBInfo(env);
if (registerMissonCB == nullptr) {
HILOG_ERROR("%{public}s registerMissonCB == nullptr", __func__);
RegisterMissionCB *registerMissionCB = CreateRegisterMissionCBCBInfo(env);
if (registerMissionCB == nullptr) {
HILOG_ERROR("%{public}s registerMissionCB == nullptr", __func__);
NAPI_ASSERT(env, false, "wrong arguments");
}
napi_value ret = UnRegisterMissonWrap(env, info, registerMissonCB);
napi_value ret = UnRegisterMissionWrap(env, info, registerMissionCB);
if (ret == nullptr) {
HILOG_ERROR("%{public}s ret == nullptr", __func__);
delete registerMissonCB;
registerMissonCB = nullptr;
delete registerMissionCB;
registerMissionCB = nullptr;
NAPI_ASSERT(env, false, "wrong arguments");
}
HILOG_INFO("%{public}s end.", __func__);
@ -1316,19 +1319,19 @@ napi_value NAPI_ContinueAbility(napi_env env, napi_callback_info info)
void UvWorkOnContinueDone(uv_work_t *work, int status)
{
HILOG_INFO("UvWorkOnCountinueDone, uv_queue_work");
HILOG_INFO("UvWorkOnContinueDone, uv_queue_work");
if (work == nullptr) {
HILOG_ERROR("UvWorkOnCountinueDone, work is null");
HILOG_ERROR("UvWorkOnContinueDone, work is null");
return;
}
ContinueAbilityCB *continueAbilityCB = static_cast<ContinueAbilityCB *>(work->data);
if (continueAbilityCB == nullptr) {
HILOG_ERROR("UvWorkOnCountinueDone, continueAbilityCB is null");
HILOG_ERROR("UvWorkOnContinueDone, continueAbilityCB is null");
delete work;
return;
}
napi_value result = nullptr;
HILOG_INFO("UvWorkOnCountinueDone, resultCode = %{public}d", continueAbilityCB->resultCode);
HILOG_INFO("UvWorkOnContinueDone, resultCode = %{public}d", continueAbilityCB->resultCode);
result =
WrapInt32(continueAbilityCB->cbBase.cbInfo.env, continueAbilityCB->resultCode, "resultCode");
@ -1346,7 +1349,7 @@ void UvWorkOnContinueDone(uv_work_t *work, int status)
delete continueAbilityCB;
continueAbilityCB = nullptr;
delete work;
HILOG_INFO("UvWorkOnCountinueDone, uv_queue_work end");
HILOG_INFO("UvWorkOnContinueDone, uv_queue_work end");
}
void NAPIMissionContinue::OnContinueDone(int32_t result)

View File

@ -88,7 +88,7 @@ struct MissionRegistrationCB {
int resultCode = 0;
};
struct RegisterMissonCB {
struct RegisterMissionCB {
CBBase cbBase;
std::string deviceId;
sptr<NAPIRemoteMissionListener> missionRegistration;

View File

@ -81,7 +81,7 @@ void JsMissionListener::CallJsMethod(const std::string &methodName, int32_t miss
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsMissionListener::CallJsMethod:" + methodName,
*engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
@ -129,7 +129,8 @@ void JsMissionListener::OnMissionIconUpdated(int32_t missionId, const std::share
});
NativeReference* callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(*engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
AsyncTask::Schedule("JsMissionListener::OnMissionIconUpdated", *engine_,
std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
void JsMissionListener::CallJsMissionIconUpdated(int32_t missionId, const std::shared_ptr<Media::PixelMap> &icon)

View File

@ -79,7 +79,13 @@ public:
static NativeValue* GetMissionSnapShot(NativeEngine* engine, NativeCallbackInfo* info)
{
JsMissionManager* me = CheckParamsAndGetThis<JsMissionManager>(engine, info);
return (me != nullptr) ? me->OnGetMissionSnapShot(*engine, *info) : nullptr;
return (me != nullptr) ? me->OnGetMissionSnapShot(*engine, *info, false) : nullptr;
}
static NativeValue* GetLowResolutionMissionSnapShot(NativeEngine* engine, NativeCallbackInfo* info)
{
JsMissionManager* me = CheckParamsAndGetThis<JsMissionManager>(engine, info);
return (me != nullptr) ? me->OnGetMissionSnapShot(*engine, *info, true) : nullptr;
}
static NativeValue* LockMission(NativeEngine* engine, NativeCallbackInfo* info)
@ -179,7 +185,7 @@ private:
NativeValue* lastParam = (info.argc <= 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnUnregisterMissionListener",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -220,7 +226,7 @@ private:
NativeValue* lastParam = (info.argc <= 2) ? nullptr : info.argv[2];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnGetMissionInfos",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -261,12 +267,12 @@ private:
NativeValue* lastParam = (info.argc <= 2) ? nullptr : info.argv[2];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnGetMissionInfo",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
NativeValue* OnGetMissionSnapShot(NativeEngine &engine, NativeCallbackInfo &info)
NativeValue* OnGetMissionSnapShot(NativeEngine &engine, NativeCallbackInfo &info, bool isLowResolution)
{
HILOG_INFO("%{public}s is called", __FUNCTION__);
int32_t errCode = 0;
@ -285,14 +291,14 @@ private:
errCode = ERR_NOT_OK;
}
AsyncTask::CompleteCallback complete =
[deviceId, missionId, errCode](NativeEngine &engine, AsyncTask &task, int32_t status) {
[deviceId, missionId, errCode, isLowResolution](NativeEngine &engine, AsyncTask &task, int32_t status) {
if (errCode != 0) {
task.Reject(engine, CreateJsError(engine, errCode, "Invalidate params."));
return;
}
AAFwk::MissionSnapshot missionSnapshot;
auto ret = AbilityManagerClient::GetInstance()->GetMissionSnapshot(
deviceId, missionId, missionSnapshot);
deviceId, missionId, missionSnapshot, isLowResolution);
if (ret == 0) {
NativeValue* objValue = engine.CreateObject();
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
@ -315,7 +321,7 @@ private:
};
NativeValue* lastParam = (info.argc <= ARG_COUNT_TWO) ? nullptr : info.argv[2];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnGetMissionSnapShot",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -350,7 +356,7 @@ private:
NativeValue* lastParam = (info.argc <= 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnLockMission",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -385,7 +391,7 @@ private:
NativeValue* lastParam = (info.argc <= 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnUnlockMission",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -420,7 +426,7 @@ private:
NativeValue* lastParam = (info.argc <= 1) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnClearMission",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -440,7 +446,7 @@ private:
NativeValue* lastParam = (info.argc == 0) ? nullptr : info.argv[0];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnMoveMissionToFront",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -484,7 +490,7 @@ private:
NativeValue* lastParam = (info.argc <= unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("MissioManager::OnMoveMissionToFront",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -515,6 +521,8 @@ NativeValue* JsMissionManagerInit(NativeEngine* engine, NativeValue* exportObj)
BindNativeFunction(*engine, *object, "getMissionInfos", JsMissionManager::GetMissionInfos);
BindNativeFunction(*engine, *object, "getMissionInfo", JsMissionManager::GetMissionInfo);
BindNativeFunction(*engine, *object, "getMissionSnapShot", JsMissionManager::GetMissionSnapShot);
BindNativeFunction(*engine, *object, "getLowResolutionMissionSnapShot",
JsMissionManager::GetLowResolutionMissionSnapShot);
BindNativeFunction(*engine, *object, "lockMission", JsMissionManager::LockMission);
BindNativeFunction(*engine, *object, "unlockMission", JsMissionManager::UnlockMission);
BindNativeFunction(*engine, *object, "clearMission", JsMissionManager::ClearMission);

View File

@ -16,7 +16,7 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni")
ohos_shared_library("particleability") {
include_dirs = [
"//third_party/node/src",
"${ability_runtime_path}/frameworks/js/napi/aafwk/featureAbility",
"${ability_runtime_napi_path}/featureAbility",
"${ability_runtime_services_path}/common/include",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/rdb/include",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/common/include",
@ -26,9 +26,9 @@ ohos_shared_library("particleability") {
]
sources = [
"${ability_runtime_path}/frameworks/js/napi/aafwk/featureAbility/napi_context.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/featureAbility/napi_data_ability_helper.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/featureAbility/napi_data_ability_operation.cpp",
"${ability_runtime_napi_path}/featureAbility/napi_context.cpp",
"${ability_runtime_napi_path}/featureAbility/napi_data_ability_helper.cpp",
"${ability_runtime_napi_path}/featureAbility/napi_data_ability_operation.cpp",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/common/src/js_utils.cpp",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/dataability/src/napi_data_ability_predicates.cpp",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/rdb/src/napi_result_set.cpp",
@ -39,7 +39,7 @@ ohos_shared_library("particleability") {
deps = [
"${ability_runtime_innerkits_path}/dataobs_manager:dataobs_manager",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
"//third_party/jsoncpp:jsoncpp",
"//third_party/libuv:uv_static",
]
@ -59,7 +59,6 @@ ohos_shared_library("particleability") {
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"napi:ace_napi",
"relational_store:native_appdatafwk",
"relational_store:native_rdb",
"relational_store:rdb_data_share_adapter",
"utils_base:utils",

View File

@ -18,7 +18,6 @@ var ExtensionContext = requireNapi("application.ExtensionContext")
class ServiceExtensionContext extends ExtensionContext {
constructor(obj) {
super(obj);
this.extensionAbilityInfo = obj.extensionAbilityInfo
}
startAbility(want, options, callback) {

View File

@ -26,7 +26,7 @@ ohos_shared_library("uripermissionmanager_napi") {
deps = [
"${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
]
external_deps = [

View File

@ -90,7 +90,7 @@ private:
NativeValue* lastParam = (info.argc == argCountThree) ? nullptr : info.argv[argCountThree];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsUriPermMgr::OnVerifyUriPermission",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
HILOG_DEBUG("OnVerifyUriPermission is called end");
return result;

View File

@ -32,7 +32,7 @@ ohos_shared_library("wantagent") {
deps = [
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
]
external_deps = [

View File

@ -121,9 +121,9 @@ struct AsyncTriggerCallbackInfo {
};
struct CallbackInfo {
std::shared_ptr<WantAgent> wantAgent;
napi_env env;
napi_ref ref;
std::shared_ptr<WantAgent> wantAgent = nullptr;
napi_env env = nullptr;
napi_ref ref = 0;
};
struct TriggerReceiveDataWorker {

View File

@ -36,7 +36,8 @@ private:
std::weak_ptr<ExtensionContext> context_;
};
NativeValue* CreateJsExtensionContext(NativeEngine& engine, const std::shared_ptr<ExtensionContext>& context);
NativeValue* CreateJsExtensionContext(NativeEngine& engine, const std::shared_ptr<ExtensionContext>& context,
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr);
} // namespace AbilityRuntime
} // namespace OHOS
#endif // ABILITY_RUNTIME_JS_EXTENSION_CONTEXT_H

View File

@ -453,7 +453,7 @@ ErrCode AbilityContextImpl::StartAbilityByCall(
ErrCode AbilityContextImpl::ReleaseAbility(const std::shared_ptr<CallerCallBack> &callback)
{
HILOG_DEBUG("AbilityContextImpl::Release begain.");
HILOG_DEBUG("AbilityContextImpl::Release begin.");
if (localCallContainer_ == nullptr) {
HILOG_ERROR("%{public}s failed, localCallContainer_ is nullptr.", __func__);
return ERR_INVALID_VALUE;

View File

@ -50,20 +50,75 @@ void JsExtensionContext::ConfigurationUpdated(NativeEngine* engine, const std::s
engine->CallFunction(value, method, argv, 1);
}
NativeValue* CreateJsExtensionContext(NativeEngine& engine, const std::shared_ptr<ExtensionContext> &context)
NativeValue* CreateJsExtensionAbilityInfo(NativeEngine& engine, const AppExecFwk::ExtensionAbilityInfo& info)
{
HILOG_INFO("CreateJsExtensionAbilityInfo");
NativeValue* objValue = engine.CreateObject();
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
HILOG_ERROR("CreateJsExtensionAbilityInfo error, object is nullptr.");
return objValue;
}
object->SetProperty("bundleName", CreateJsValue(engine, info.bundleName));
object->SetProperty("moduleName", CreateJsValue(engine, info.moduleName));
object->SetProperty("name", CreateJsValue(engine, info.name));
object->SetProperty("labelId", CreateJsValue(engine, info.labelId));
object->SetProperty("descriptionId", CreateJsValue(engine, info.descriptionId));
object->SetProperty("iconId", CreateJsValue(engine, info.iconId));
object->SetProperty("isVisible", CreateJsValue(engine, info.visible));
object->SetProperty("extensionAbilityType", CreateJsValue(engine, info.type));
NativeValue *permissionArrayValue = engine.CreateArray(info.permissions.size());
NativeArray *permissionArray = ConvertNativeValueTo<NativeArray>(permissionArrayValue);
if (permissionArray != nullptr) {
int index = 0;
for (auto permission : info.permissions) {
permissionArray->SetElement(index++, CreateJsValue(engine, permission));
}
}
object->SetProperty("permissions", permissionArrayValue);
object->SetProperty("applicationInfo", CreateJsApplicationInfo(engine, info.applicationInfo));
object->SetProperty("metadata", CreateJsMetadataArray(engine, info.metadata));
object->SetProperty("enabled", CreateJsValue(engine, info.enabled));
object->SetProperty("readPermission", CreateJsValue(engine, info.readPermission));
object->SetProperty("writePermission", CreateJsValue(engine, info.writePermission));
return objValue;
}
NativeValue* CreateJsExtensionContext(NativeEngine& engine, const std::shared_ptr<ExtensionContext> &context,
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo)
{
HILOG_INFO("CreateJsExtensionContext begin");
NativeValue* objValue = CreateJsBaseContext(engine, context);
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
if (context == nullptr) {
HILOG_ERROR("Failed to CreateJsExtensionContext, context is nullptr.");
return objValue;
}
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
HILOG_ERROR("Failed to CreateJsExtensionContext, object is nullptr.");
return objValue;
}
auto configuration = context->GetConfiguration();
if (configuration != nullptr && object != nullptr) {
if (configuration != nullptr) {
object->SetProperty("config", CreateJsConfiguration(engine, *configuration));
}
auto hapModuleInfo = context->GetHapModuleInfo();
if (abilityInfo && hapModuleInfo) {
auto isExist = [&abilityInfo](const AppExecFwk::ExtensionAbilityInfo &info) {
HILOG_INFO("%{public}s, %{public}s", info.bundleName.c_str(), info.name.c_str());
return info.bundleName == abilityInfo->bundleName && info.name == abilityInfo->name;
};
auto infoIter = std::find_if(
hapModuleInfo->extensionInfos.begin(), hapModuleInfo->extensionInfos.end(), isExist);
if (infoIter == hapModuleInfo->extensionInfos.end()) {
HILOG_ERROR("Set extensionAbilityInfo fail.");
} else {
object->SetProperty("extensionAbilityInfo", CreateJsExtensionAbilityInfo(engine, *infoIter));
}
}
return objValue;
}
} // namespace AbilityRuntime

View File

@ -149,7 +149,7 @@ public:
}
int GetMissionSnapshot(
const std::string& deviceId, const int32_t missionId, MissionSnapshot& snapshot) override
const std::string& deviceId, const int32_t missionId, MissionSnapshot& snapshot, bool isLowResolution) override
{
return 0;
}

View File

@ -22,24 +22,25 @@ config("module_private_config") {
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
include_dirs = [ "${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS" ]
include_dirs =
[ "${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS" ]
}
ohos_moduletest("ability_caller_fw_module_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"ability_caller_fw_module_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime:ability_context_native",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/ability_runtime:ability_context_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",

View File

@ -119,7 +119,7 @@ HWTEST_F(AbilityCallerTest, AaFwk_Ability_StartAbility_0200, Function | MediumTe
/**
* @tc.number: AaFwk_Ability_StartAbility_0300
* @tc.name: AbilityFwk
* @tc.desc: Ability caller to process StartAbility, and the result is fail because the element of want is empty.
* @tc.desc: Ability caller to process StartAbility, and the result is success because support empty want.
*/
HWTEST_F(AbilityCallerTest, AaFwk_Ability_StartAbility_0300, Function | MediumTest | Level1)
{
@ -129,7 +129,7 @@ HWTEST_F(AbilityCallerTest, AaFwk_Ability_StartAbility_0300, Function | MediumTe
EXPECT_FALSE(callback->IsCallBack());
ErrCode ret = context_->StartAbilityByCall(want, callback);
EXPECT_FALSE(ret == 0);
EXPECT_TRUE(ret == 0);
}
/**

View File

@ -25,25 +25,29 @@ config("module_private_config") {
ohos_unittest("ability_context_impl_ut_test") {
module_out_path = module_out_path
include_dirs = [ "${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS" ]
include_dirs =
[ "${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS" ]
sources = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"ability_context_impl_ut_test.cpp",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime:ability_context_native",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/ability_runtime:ability_context_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [ "ability_base:want" ]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_core",
]
}
ohos_unittest("caller_call_back_ut_test") {
@ -51,8 +55,8 @@ ohos_unittest("caller_call_back_ut_test") {
sources = [ "caller_call_back_ut_test.cpp" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime:ability_context_native",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/ability/ability_runtime:ability_context_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"//third_party/googletest:gtest_main",
]
}
@ -60,49 +64,57 @@ ohos_unittest("caller_call_back_ut_test") {
ohos_unittest("local_call_container_ut_test") {
module_out_path = module_out_path
include_dirs = [ "${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS" ]
include_dirs =
[ "${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS" ]
sources = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"local_call_container_ut_test.cpp",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime:ability_context_native",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/ability_runtime:ability_context_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [ "ability_base:want" ]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_core",
]
}
ohos_unittest("local_call_record_ut_test") {
module_out_path = module_out_path
include_dirs = [ "${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS" ]
include_dirs =
[ "${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS" ]
sources = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"local_call_record_ut_test.cpp",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/ability_runtime:ability_context_native",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/ability_runtime:ability_context_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [ "ability_base:want" ]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_core",
]
}
################################################################################

View File

@ -30,12 +30,11 @@ config("ability_config") {
"${ability_runtime_kits_path}/appkit/native/app/include",
"${form_fwk_path}/interfaces/kits/native/include",
"${ability_runtime_kits_path}/app/native/app/include",
"${ability_runtime_services_path}/common/include",
"//third_party/node/src",
"${ability_runtime_innerkits_path}/ability_manager/include/continuation",
"${ability_runtime_kits_path}/appkit/native/app/include/task",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common",
"${ability_runtime_path}/frameworks/js/napi/aafwk/featureAbility",
"${ability_runtime_napi_path}/inner/napi_common",
"${ability_runtime_napi_path}/featureAbility",
]
cflags = []
@ -71,7 +70,7 @@ config("ability_public_config") {
"//third_party/libuv/include",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context",
"${ability_runtime_innerkits_path}/ability_manager/include/continuation",
"${global_path}/resource_management/interfaces/inner_api/include",
"${ability_runtime_services_path}/common/include",
"//third_party/jsoncpp/include",
"//third_party/json/include",
]
@ -114,7 +113,6 @@ ohos_shared_library("abilitykit_native") {
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/rdb/include",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi//common/include",
"${distributeddatamgr_path}/appdatamgr/frameworks/js/napi/dataability/include",
"${distributeddatamgr_path}/objectstore/interfaces/innerkits/",
]
sources = [
@ -126,11 +124,11 @@ ohos_shared_library("abilitykit_native") {
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/sys_mgr_client.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common/napi_common_ability.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common/napi_common_configuration.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common/napi_common_start_options.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common/napi_common_util.cpp",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common/napi_common_want.cpp",
"${ability_runtime_napi_path}/inner/napi_common/napi_common_ability.cpp",
"${ability_runtime_napi_path}/inner/napi_common/napi_common_configuration.cpp",
"${ability_runtime_napi_path}/inner/napi_common/napi_common_start_options.cpp",
"${ability_runtime_napi_path}/inner/napi_common/napi_common_util.cpp",
"${ability_runtime_napi_path}/inner/napi_common/napi_common_want.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp",
"${ability_runtime_services_path}/abilitymgr/src/launch_param.cpp",
"${ability_runtime_services_path}/common/src/event_report.cpp",
@ -223,12 +221,11 @@ ohos_shared_library("abilitykit_native") {
"dataability:native_dataability",
"hisysevent_native:libhisysevent",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"ipc_js:rpc",
"relational_store:native_appdatafwk",
"relational_store:native_rdb",
"relational_store:rdb_data_share_adapter",
"resource_management:global_resmgr",
"samgr_standard:samgr_proxy",
"utils_base:utils",
]
@ -250,8 +247,6 @@ ohos_shared_library("abilitykit_native") {
}
public_deps = [
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//foundation/arkui/napi:ace_napi",
]
@ -278,7 +273,6 @@ ohos_shared_library("abilitykit_native") {
external_deps += [
"form_fwk:fmskit_native",
"form_fwk:form_manager",
"input:libmmi-client",
"multimedia_image_standard:image",
]

View File

@ -23,9 +23,6 @@
#include "ability_post_event_timeout.h"
#include "ability_runtime/js_ability.h"
#include "abs_shared_result_set.h"
#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE
#include "background_task_mgr_helper.h"
#endif
#include "hitrace_meter.h"
#include "configuration_convertor.h"
#include "connection_manager.h"
@ -33,14 +30,10 @@
#include "continuation_manager.h"
#include "continuation_register_manager.h"
#include "continuation_register_manager_proxy.h"
#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE
#include "continuous_task_param.h"
#endif
#include "data_ability_operation.h"
#include "data_ability_predicates.h"
#include "data_ability_result.h"
#include "data_uri_utils.h"
#include "distributed_objectstore.h"
#include "hilog_wrapper.h"
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
@ -55,6 +48,15 @@
#include "task_handler_client.h"
#include "values_bucket.h"
#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE
#include "background_task_mgr_helper.h"
#include "continuous_task_param.h"
#endif
#ifdef DISTRIBUTED_DATA_OBJECT_ENABLE
#include "distributed_objectstore.h"
#endif
#ifdef SUPPORT_GRAPHICS
#include "display_type.h"
#include "form_host_client.h"

View File

@ -206,7 +206,7 @@ NativeValue* JsAbilityContext::OnStartAbility(NativeEngine& engine, NativeCallba
NativeValue* lastParam = (info.argc == unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStartAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -259,7 +259,7 @@ NativeValue* JsAbilityContext::OnStartAbilityWithAccount(NativeEngine& engine, N
NativeValue* lastParam = (info.argc == unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStartAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -356,14 +356,13 @@ NativeValue* JsAbilityContext::OnStartAbilityByCall(NativeEngine& engine, Native
if (calls->remoteCallee == nullptr) {
HILOG_INFO("OnStartAbilityByCall async wait execute");
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStartAbilityByCall",
engine,
CreateAsyncTaskWithLastParam(
engine, lastParam, std::move(callExecute), std::move(callComplete), &retsult));
} else {
HILOG_INFO("OnStartAbilityByCall promiss return result execute");
AsyncTask::Schedule(
engine,
AsyncTask::Schedule("JsAbilityContext::OnStartAbilityByCall", engine,
CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(callComplete), &retsult));
}
@ -518,7 +517,7 @@ NativeValue* JsAbilityContext::OnStartExtensionAbility(NativeEngine& engine, Nat
NativeValue* lastParam = (info.argc <= ARGC_ONE) ? nullptr : info.argv[ARGC_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStartExtensionAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -566,7 +565,7 @@ NativeValue* JsAbilityContext::OnStartExtensionAbilityWithAccount(NativeEngine&
NativeValue* lastParam = (info.argc <= ARGC_TWO) ? nullptr : info.argv[ARGC_TWO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStartExtensionAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -607,7 +606,7 @@ NativeValue* JsAbilityContext::OnStopExtensionAbility(NativeEngine& engine, Nati
NativeValue* lastParam = (info.argc <= ARGC_ONE) ? nullptr : info.argv[ARGC_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStopExtensionAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -654,7 +653,7 @@ NativeValue* JsAbilityContext::OnStopExtensionAbilityWithAccount(NativeEngine& e
NativeValue* lastParam = (info.argc <= ARGC_TWO) ? nullptr : info.argv[ARGC_TWO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnStopExtensionAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -695,7 +694,7 @@ NativeValue* JsAbilityContext::OnTerminateSelfWithResult(NativeEngine& engine, N
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnTerminateSelfWithResult",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
HILOG_INFO("OnTerminateSelfWithResult is called end");
return result;
@ -748,7 +747,7 @@ NativeValue* JsAbilityContext::OnConnectAbility(NativeEngine& engine, NativeCall
task.Resolve(engine, engine.CreateUndefined());
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnConnectAbility",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return engine.CreateNumber(connectId);
}
@ -809,7 +808,7 @@ NativeValue* JsAbilityContext::OnConnectAbilityWithAccount(NativeEngine& engine,
task.Resolve(engine, engine.CreateUndefined());
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnConnectAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return engine.CreateNumber(connectId);
}
@ -867,7 +866,7 @@ NativeValue* JsAbilityContext::OnDisconnectAbility(NativeEngine& engine, NativeC
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnDisconnectAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -905,7 +904,7 @@ NativeValue* JsAbilityContext::OnTerminateSelf(NativeEngine& engine, NativeCallb
NativeValue* lastParam = (info.argc == ARGC_ZERO) ? nullptr : info.argv[ARGC_ZERO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnTerminateSelf",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -1358,7 +1357,7 @@ NativeValue* JsAbilityContext::OnSetMissionLabel(NativeEngine& engine, NativeCal
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnSetMissionLabel",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -1403,7 +1402,7 @@ NativeValue* JsAbilityContext::OnSetMissionIcon(NativeEngine& engine, NativeCall
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsAbilityContext::OnSetMissionIcon",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}

View File

@ -118,7 +118,7 @@ private:
NativeValue* lastParam =
(info.argc == UPDATE_FORM_PARAMS_SIZE) ? nullptr : info.argv[info.argc - 1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsFormExtensionContext::OnUpdateForm",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -172,7 +172,7 @@ private:
NativeValue* lastParam = (info.argc == unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JsFormExtensionContext::OnStartAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -182,7 +182,11 @@ private:
NativeValue* CreateJsFormExtensionContext(NativeEngine& engine, std::shared_ptr<FormExtensionContext> context)
{
HILOG_INFO("%{public}s called.", __func__);
NativeValue* objValue = CreateJsExtensionContext(engine, context);
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
if (context) {
abilityInfo = context->GetAbilityInfo();
}
NativeValue* objValue = CreateJsExtensionContext(engine, context, abilityInfo);
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
std::unique_ptr<JsFormExtensionContext> jsContext = std::make_unique<JsFormExtensionContext>(context);

View File

@ -166,7 +166,7 @@ private:
NativeValue* lastParam = (info.argc == unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStartAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -230,7 +230,7 @@ private:
NativeValue* lastParam = (info.argc == unwrapArgc) ? nullptr : info.argv[unwrapArgc];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStartAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -264,7 +264,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ZERO) ? nullptr : info.argv[INDEX_ZERO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnTerminateAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -316,7 +316,7 @@ private:
task.Resolve(engine, engine.CreateUndefined());
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnConnectAbility",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return engine.CreateNumber(connectId);
}
@ -377,7 +377,7 @@ private:
task.Resolve(engine, engine.CreateUndefined());
};
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnConnectAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, nullptr, nullptr, std::move(complete), &result));
return engine.CreateNumber(connectId);
}
@ -436,7 +436,7 @@ private:
NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[INDEX_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnDisconnectAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -476,7 +476,7 @@ private:
NativeValue* lastParam = (info.argc <= ARGC_ONE) ? nullptr : info.argv[ARGC_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStartExtensionAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -523,7 +523,7 @@ private:
NativeValue* lastParam = (info.argc <= ARGC_TWO) ? nullptr : info.argv[ARGC_TWO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStartExtensionAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -564,7 +564,7 @@ private:
NativeValue* lastParam = (info.argc <= ARGC_ONE) ? nullptr : info.argv[ARGC_ONE];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStopExtensionAbility",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -611,7 +611,7 @@ private:
NativeValue* lastParam = (info.argc <= ARGC_TWO) ? nullptr : info.argv[ARGC_TWO];
NativeValue* result = nullptr;
AsyncTask::Schedule(
AsyncTask::Schedule("JSServiceExtensionConnection::OnStopExtensionAbilityWithAccount",
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
@ -642,40 +642,14 @@ NativeValue* CreateJsMetadataArray(NativeEngine& engine, const std::vector<AppEx
return arrayValue;
}
NativeValue* CreateJsExtensionAbilityInfo(NativeEngine& engine, const AppExecFwk::ExtensionAbilityInfo& info)
{
HILOG_INFO("CreateJsExtensionAbilityInfo");
NativeValue* objValue = engine.CreateObject();
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
object->SetProperty("bundleName", CreateJsValue(engine, info.bundleName));
object->SetProperty("moduleName", CreateJsValue(engine, info.moduleName));
object->SetProperty("name", CreateJsValue(engine, info.name));
object->SetProperty("labelId", CreateJsValue(engine, info.labelId));
object->SetProperty("descriptionId", CreateJsValue(engine, info.descriptionId));
object->SetProperty("iconId", CreateJsValue(engine, info.iconId));
object->SetProperty("isVisible", CreateJsValue(engine, info.visible));
object->SetProperty("extensionAbilityType", CreateJsValue(engine, info.type));
NativeValue *permissionArrayValue = engine.CreateArray(info.permissions.size());
NativeArray *permissionArray = ConvertNativeValueTo<NativeArray>(permissionArrayValue);
if (permissionArray != nullptr) {
int index = 0;
for (auto permission : info.permissions) {
permissionArray->SetElement(index++, CreateJsValue(engine, permission));
}
}
object->SetProperty("permissions", permissionArrayValue);
object->SetProperty("applicationInfo", CreateJsApplicationInfo(engine, info.applicationInfo));
object->SetProperty("metadata", CreateJsMetadataArray(engine, info.metadata));
object->SetProperty("enabled", CreateJsValue(engine, info.enabled));
object->SetProperty("readPermission", CreateJsValue(engine, info.readPermission));
object->SetProperty("writePermission", CreateJsValue(engine, info.writePermission));
return objValue;
}
NativeValue* CreateJsServiceExtensionContext(NativeEngine& engine, std::shared_ptr<ServiceExtensionContext> context)
{
HILOG_INFO("CreateJsServiceExtensionContext begin");
NativeValue* objValue = CreateJsExtensionContext(engine, context);
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
if (context) {
abilityInfo = context->GetAbilityInfo();
}
NativeValue* objValue = CreateJsExtensionContext(engine, context, abilityInfo);
NativeObject* object = ConvertNativeValueTo<NativeObject>(objValue);
std::unique_ptr<JsServiceExtensionContext> jsContext = std::make_unique<JsServiceExtensionContext>(context);
@ -700,25 +674,6 @@ NativeValue* CreateJsServiceExtensionContext(NativeEngine& engine, std::shared_p
BindNativeFunction(engine, *object, "stopServiceExtensionAbilityWithAccount",
JsServiceExtensionContext::StopServiceExtensionAbilityWithAccount);
if (context) {
HILOG_INFO("Set ExtensionAbilityInfo Property");
auto abilityInfo = context->GetAbilityInfo();
auto hapModuleInfo = context->GetHapModuleInfo();
if (abilityInfo && hapModuleInfo) {
auto isExist = [&abilityInfo](const AppExecFwk::ExtensionAbilityInfo &info) {
HILOG_INFO("%{public}s, %{public}s", info.bundleName.c_str(), info.name.c_str());
return info.bundleName == abilityInfo->bundleName && info.name == abilityInfo->name;
};
auto infoIter = std::find_if(
hapModuleInfo->extensionInfos.begin(), hapModuleInfo->extensionInfos.end(), isExist);
if (infoIter == hapModuleInfo->extensionInfos.end()) {
HILOG_INFO("Get target fail.");
return objValue;
}
object->SetProperty("extensionAbilityInfo", CreateJsExtensionAbilityInfo(engine, *infoIter));
}
}
return objValue;
}

View File

@ -47,7 +47,11 @@ NativeValue* CreateJsStaticSubscriberExtensionContext(NativeEngine& engine,
std::shared_ptr<StaticSubscriberExtensionContext> context)
{
HILOG_INFO("CreateJsStaticSubscriberExtensionContext begin");
NativeValue *objValue = CreateJsExtensionContext(engine, context);
std::shared_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo = nullptr;
if (context) {
abilityInfo = context->GetAbilityInfo();
}
NativeValue *objValue = CreateJsExtensionContext(engine, context, abilityInfo);
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
std::unique_ptr<JsStaticSubscriberExtensionContext> jsContext =

View File

@ -20,19 +20,17 @@ module_output_path = "ability_runtime/ability_test"
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"//base/notification/eventhandler/interfaces/inner_api",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_path}/interfaces/inner_api/app_manager/include/appmgr",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include/task",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/include",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_innerkits_path}/ability_manager/include",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_runtime_kits_path}/ability/native/include",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/appkit/native/app/include",
"${ability_runtime_kits_path}/appkit/native/app/include/task",
"${ability_runtime_kits_path}/appkit/native/test/mock/include",
"${ability_runtime_services_path}/abilitymgr/include",
"${ability_runtime_services_path}/common/include",
"${ability_base_innerapi_path}/uri/include",
"${ability_base_innerapi_path}/want/include",
"${bundlefwk_inner_api_path}/appexecfwk_base/include",
"${distributeddatamgr_path}/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
]
@ -56,18 +54,17 @@ config("module_private_config") {
config("module_ability_context_config") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/include/appmgr",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_base_innerapi_path}/uri/include",
"${ability_base_innerapi_path}/want/include",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/include",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/appkit/native/test/mock/include",
"${ability_runtime_innerkits_path}/ability_manager/include",
"${ability_base_innerapi_path}/base/include",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
"//third_party/googletest/googlemock/include",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include",
"//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
"${ability_runtime_kits_path}/ability/native/include",
"${ability_runtime_kits_path}/appkit/native/app/include",
"${multimodalinput_path}/interfaces/native/innerkits/event/include",
"//third_party/libuv/include",
"${global_path}/resource_management/interfaces/inner_api/include",
@ -85,23 +82,21 @@ config("module_ability_context_config") {
ohos_unittest("ability_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ability_record_mgr.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ability_record_mgr.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"unittest/ability_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -113,7 +108,9 @@ ohos_unittest("ability_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -136,19 +133,19 @@ ohos_unittest("ability_lifecycle_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -168,20 +165,19 @@ ohos_unittest("ability_lifecycle_executor_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -202,14 +198,12 @@ ohos_unittest("ability_context_interface_test") {
configs = [ ":module_ability_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -217,6 +211,7 @@ ohos_unittest("ability_context_interface_test") {
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -236,22 +231,17 @@ ohos_unittest("ability_context_test") {
"unittest/ability_context_test.cpp",
]
include_dirs = [
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common",
"//foundation/arkui/napi/interfaces/kits",
]
include_dirs = [ "${ability_runtime_napi_path}/inner/napi_common" ]
configs = [ ":module_ability_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common:napi_common",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_napi_path}/inner/napi_common:napi_common",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//foundation/arkui/napi:ace_napi",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -259,8 +249,10 @@ ohos_unittest("ability_context_test") {
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"napi:ace_napi",
]
if (ability_runtime_graphics) {
@ -272,7 +264,7 @@ ohos_unittest("page_ability_impl_test") {
module_out_path = module_output_path
if (ability_runtime_graphics) {
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"../src/page_ability_impl.cpp",
"unittest/page_ability_impl_test.cpp",
]
@ -280,21 +272,20 @@ ohos_unittest("page_ability_impl_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"${multimodalinput_path}/frameworks/proxy:libmmi-common",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
@ -313,20 +304,19 @@ ohos_unittest("service_ability_impl_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
@ -347,20 +337,19 @@ ohos_unittest("scene_created_test") {
sources = [ "unittest/scene_created_test.cpp" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
@ -370,17 +359,16 @@ ohos_unittest("scene_created_test") {
ohos_unittest("data_ability_helper_test") {
module_out_path = module_output_path
include_dirs = [ "${ability_runtime_path}/services/abilitymgr/include" ]
include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]
sources = [ "unittest/data_ability_helper_test.cpp" ]
configs = [ ":module_ability_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -391,6 +379,7 @@ ohos_unittest("data_ability_helper_test") {
"ability_base:want",
"ability_base:zuri",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -409,13 +398,11 @@ ohos_unittest("data_ability_operation_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -425,7 +412,9 @@ ohos_unittest("data_ability_operation_test") {
"ability_base:base",
"ability_base:want",
"ability_base:zuri",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -440,22 +429,20 @@ ohos_unittest("data_ability_operation_test") {
ohos_unittest("ability_impl_active_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -465,6 +452,8 @@ ohos_unittest("ability_impl_active_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -478,23 +467,21 @@ ohos_unittest("ability_impl_active_test") {
ohos_unittest("ability_impl_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -505,8 +492,10 @@ ohos_unittest("ability_impl_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -526,13 +515,13 @@ ohos_unittest("ability_impl_test") {
ohos_unittest("ability_thread_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_data_ability_impl.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_data_ability_impl.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"mock/include/mock_ability_manager_client.cpp",
"mock/include/sys_mgr_client_mock.cpp",
"unittest/ability_thread_test.cpp",
@ -541,14 +530,12 @@ ohos_unittest("ability_thread_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -559,7 +546,9 @@ ohos_unittest("ability_thread_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -581,19 +570,17 @@ ohos_unittest("ability_thread_test") {
ohos_unittest("ability_thread_call_request_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"unittest/ability_thread_call_request_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
]
@ -602,13 +589,15 @@ ohos_unittest("ability_thread_call_request_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
]
}
ohos_unittest("form_provider_client_test") {
module_out_path = module_output_path
if (ability_runtime_graphics) {
include_dirs = [ "${bundlefwk_inner_api_path}/appexecfwk_base/include" ]
include_dirs = []
sources = [
"mock/include/mock_form_supply_callback.cpp",
@ -618,24 +607,23 @@ ohos_unittest("form_provider_client_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"${graphic_path}:libwmclient",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:configuration",
"ability_base:want",
"access_token:libaccesstoken_sdk",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"form_fwk:form_manager",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
@ -647,27 +635,25 @@ ohos_unittest("form_provider_client_test") {
ohos_unittest("data_ability_impl_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"unittest/data_ability_impl_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -677,7 +663,9 @@ ohos_unittest("data_ability_impl_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -699,27 +687,25 @@ ohos_unittest("data_ability_impl_test") {
ohos_unittest("data_ability_impl_file_secondpart_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"unittest/data_ability_impl_file_secondpart_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -730,7 +716,9 @@ ohos_unittest("data_ability_impl_file_secondpart_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -752,27 +740,25 @@ ohos_unittest("data_ability_impl_file_secondpart_test") {
ohos_unittest("data_ability_impl_file_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"unittest/data_ability_impl_file_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -783,7 +769,9 @@ ohos_unittest("data_ability_impl_file_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -805,13 +793,13 @@ ohos_unittest("data_ability_impl_file_test") {
ohos_unittest("ability_thread_dataability_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_data_ability_impl.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_data_ability_impl.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_deal.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"mock/include/mock_ability_manager_client.cpp",
"mock/include/sys_mgr_client_mock.cpp",
"unittest/ability_thread_dataability_test.cpp",
@ -820,14 +808,12 @@ ohos_unittest("ability_thread_dataability_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -838,7 +824,9 @@ ohos_unittest("ability_thread_dataability_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -859,8 +847,7 @@ ohos_unittest("ability_thread_dataability_test") {
config("data_uri_utils_test_config") {
visibility = [ ":*" ]
include_dirs =
[ "${ability_runtime_path}/frameworks/kits/ability/native/include/" ]
include_dirs = [ "${ability_runtime_kits_path}/ability/native/include/" ]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
@ -879,21 +866,21 @@ ohos_unittest("data_uri_utils_test") {
]
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/src/data_uri_utils.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/data_uri_utils_test.cpp",
"${ability_runtime_kits_path}/ability/native/src/data_uri_utils.cpp",
"${ability_runtime_kits_path}/ability/native/test/unittest/data_uri_utils_test.cpp",
]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:zuri",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -905,12 +892,11 @@ ohos_unittest("data_uri_utils_test") {
ohos_unittest("pac_map_test") {
module_out_path = module_output_path
sources = [ "${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/pac_map_test.cpp" ]
sources = [ "${ability_runtime_kits_path}/ability/native/test/unittest/pac_map_test.cpp" ]
configs = [ ":module_private_config" ]
deps = [
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -918,6 +904,7 @@ ohos_unittest("pac_map_test") {
external_deps = [
"ability_base:base",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -930,7 +917,7 @@ ohos_unittest("pac_map_test") {
ohos_unittest("ability_permission_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/ability_permission_test.cpp",
"${ability_runtime_kits_path}/ability/native/test/unittest/ability_permission_test.cpp",
"mock/include/mock_ability_manager_service.cpp",
"mock/include/mock_bundle_manager.cpp",
"mock/include/sys_mgr_client_mock.cpp",
@ -939,14 +926,12 @@ ohos_unittest("ability_permission_test") {
configs = [ ":module_ability_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -954,7 +939,9 @@ ohos_unittest("ability_permission_test") {
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -965,12 +952,12 @@ ohos_unittest("ability_permission_test") {
ohos_unittest("task_handler_client_test") {
module_out_path = module_output_path
sources = [ "${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/task_handler_client_test.cpp" ]
sources = [ "${ability_runtime_kits_path}/ability/native/test/unittest/task_handler_client_test.cpp" ]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -987,23 +974,22 @@ ohos_unittest("task_handler_client_test") {
ohos_unittest("ability_thread_for_ability_on_configuration_update") {
module_out_path = module_output_path
sources = [ "${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/ability_thread_for_ability_on_configuration_update.cpp" ]
sources = [ "${ability_runtime_kits_path}/ability/native/test/unittest/ability_thread_for_ability_on_configuration_update.cpp" ]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -1015,12 +1001,12 @@ ohos_unittest("ability_thread_for_ability_on_configuration_update") {
ohos_unittest("data_ability_result_test") {
module_out_path = module_output_path
sources = [ "${ability_runtime_path}/frameworks/kits/ability/native/test/unittest/data_ability_result_test.cpp" ]
sources = [ "${ability_runtime_kits_path}/ability/native/test/unittest/data_ability_result_test.cpp" ]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"//third_party/googletest:gtest_main",
]
@ -1039,11 +1025,11 @@ ohos_unittest("form_host_client_test") {
module_out_path = module_output_path
if (ability_runtime_graphics) {
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ability_record_mgr.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_start_setting.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ability_record_mgr.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp",
"mock/include/mock_bundle_manager_form.cpp",
"unittest/form_host_client_test.cpp",
]
@ -1051,15 +1037,13 @@ ohos_unittest("form_host_client_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"${graphic_path}:libwmclient",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -1069,7 +1053,9 @@ ohos_unittest("form_host_client_test") {
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"form_fwk:fmskit_native",
"form_fwk:form_manager",
"hiviewdfx_hilog_native:libhilog",
@ -1082,23 +1068,21 @@ ohos_unittest("form_host_client_test") {
ohos_unittest("continuation_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/ohos_application.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/ohos_application.cpp",
"unittest/continuation_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -1109,7 +1093,9 @@ ohos_unittest("continuation_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
@ -1125,7 +1111,7 @@ ohos_unittest("new_ability_impl_test") {
module_out_path = module_output_path
if (ability_runtime_graphics) {
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_replace_ability_impl.cpp",
"../src/new_ability_impl.cpp",
"unittest/new_ability_impl_test.cpp",
]
@ -1133,21 +1119,20 @@ ohos_unittest("new_ability_impl_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"${multimodalinput_path}/frameworks/proxy:libmmi-common",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",

View File

@ -192,7 +192,8 @@ public:
{
return 0;
}
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot)
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution)
{
return 0;
}

View File

@ -46,7 +46,7 @@ config("appkit_config") {
}
include_dirs = [
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_kits_path}/ability/native/include",
"//third_party/json/include",
]
}
@ -78,10 +78,10 @@ ohos_shared_library("appkit_native") {
"native/ability_runtime/context",
"native/app/include",
"native/app/include/task",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_path}/frameworks/js/napi/aafwk/inner/napi_common",
"${ability_runtime_services_path}/common/include",
"${ability_runtime_kits_path}/ability/native/include",
"${ability_runtime_services_path}/abilitymgr/include",
"${ability_runtime_napi_path}/inner/napi_common",
]
configs = [ ":appkit_config" ]
@ -115,8 +115,8 @@ ohos_shared_library("appkit_native") {
deps = [
":appkit_delegator",
"${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:app_context_utils",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:app_context_utils",
]
public_deps =
@ -246,7 +246,7 @@ ohos_shared_library("app_context_utils") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_kits_path}/appkit:app_context",
"//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
]
@ -296,8 +296,8 @@ ohos_shared_library("appkit_delegator") {
"native/ability_runtime/app",
"native/ability_runtime/context",
"native/ability_delegator/include",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_services_path}/common/include",
"${ability_runtime_kits_path}/ability/native/include",
]
configs = [ ":appkit_config" ]
@ -325,7 +325,7 @@ ohos_shared_library("appkit_delegator") {
deps = [
":delegator_mgmt_abc",
":delegator_mgmt_js",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_kits_path}/appkit:app_context",
]
external_deps = [

View File

@ -77,7 +77,8 @@ void JsAbilityLifecycleCallback::CallJsMethod(
});
NativeReference *callback = nullptr;
std::unique_ptr<AsyncTask::ExecuteCallback> execute = nullptr;
AsyncTask::Schedule(*engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
AsyncTask::Schedule("JsAbilityLifecycleCallback::CallJsMethod:" + methodName,
*engine_, std::make_unique<AsyncTask>(callback, std::move(execute), std::move(complete)));
}
void JsAbilityLifecycleCallback::OnAbilityCreate(const std::weak_ptr<NativeReference> &abilityObj)

View File

@ -453,7 +453,8 @@ NativeValue *JsApplicationContextUtils::OnUnregisterAbilityLifecycleCallback(
};
NativeValue *lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[INDEX_ONE];
NativeValue *result = nullptr;
AsyncTask::Schedule(engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
AsyncTask::Schedule("JsApplicationContextUtils::OnUnregisterAbilityLifecycleCallback", engine,
CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
return result;
}
} // namespace

View File

@ -460,8 +460,6 @@ private:
*/
void LoadAbilityLibrary(const std::vector<std::string> &libraryPaths);
void LoadNativeLiabrary(std::string &nativeLibraryPath);
void LoadAppLibrary();
void ChangeToLocalPath(const std::string &bundleName,
@ -495,7 +493,6 @@ private:
std::shared_ptr<ContextDeal> &contextDeal, ApplicationInfo &appInfo, BundleInfo& bundleInfo,
const Configuration &config);
std::vector<std::string> fileEntries_;
std::vector<std::string> nativeFileEntries_;
std::vector<void *> handleAbilityLib_; // the handler of ACE Library.
#endif // ABILITY_LIBRARY_LOADER
#ifdef APPLICATION_LIBRARY_LOADER

View File

@ -107,7 +107,6 @@ MainThread::MainThread()
{
#ifdef ABILITY_LIBRARY_LOADER
fileEntries_.clear();
nativeFileEntries_.clear();
handleAbilityLib_.clear();
#endif // ABILITY_LIBRARY_LOADER
}
@ -812,17 +811,13 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
return;
}
ApplicationInfo appInfo = appLaunchData.GetApplicationInfo();
if (appLaunchData.IsNativeApplication()) {
HILOG_INFO("%{public}s load native application so.", __func__);
std::vector<std::string> localPaths;
ChangeToLocalPath(appLaunchData.GetApplicationInfo().bundleName,
appLaunchData.GetApplicationInfo().moduleSourceDirs, localPaths);
LoadAbilityLibrary(localPaths);
LoadNativeLiabrary(appInfo.nativeLibraryPath);
}
std::vector<std::string> localPaths;
ChangeToLocalPath(appLaunchData.GetApplicationInfo().bundleName,
appLaunchData.GetApplicationInfo().moduleSourceDirs, localPaths);
LoadAbilityLibrary(localPaths);
LoadAppLibrary();
ApplicationInfo appInfo = appLaunchData.GetApplicationInfo();
ProcessInfo processInfo = appLaunchData.GetProcessInfo();
Profile appProfile = appLaunchData.GetProfile();
@ -897,7 +892,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
}
std::string libPath = LOCAL_CODE_PATH;
libPath += (libPath.back() == '/') ? nativeLibraryPath : "/" + nativeLibraryPath;
HILOG_INFO("napi lib path = %{public}s", libPath.c_str());
HILOG_INFO("napi lib path = %{private}s", libPath.c_str());
options.packagePath = libPath;
}
auto runtime = AbilityRuntime::Runtime::Create(options);
@ -1019,46 +1014,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
HILOG_INFO("MainThread::handleLaunchApplication called end.");
}
void MainThread::LoadNativeLiabrary(std::string &nativeLibraryPath)
{
#ifdef ABILITY_LIBRARY_LOADER
if (nativeLibraryPath.empty()) {
HILOG_INFO("Native library path is empty.");
return;
}
if (nativeLibraryPath.back() == '/') {
nativeLibraryPath.pop_back();
}
std::string libPath = LOCAL_CODE_PATH;
libPath += (libPath.back() == '/') ? nativeLibraryPath : "/" + nativeLibraryPath;
HILOG_INFO("native library path = %{public}s", libPath.c_str());
if (!ScanDir(libPath, nativeFileEntries_)) {
HILOG_INFO("%{public}s scanDir %{public}s not exits", __func__, libPath.c_str());
}
if (nativeFileEntries_.empty()) {
HILOG_INFO("No native library");
return;
}
void *handleAbilityLib = nullptr;
for (auto fileEntry : nativeFileEntries_) {
if (!fileEntry.empty()) {
handleAbilityLib = dlopen(fileEntry.c_str(), RTLD_NOW | RTLD_GLOBAL);
if (handleAbilityLib == nullptr) {
HILOG_ERROR("%{public}s Fail to dlopen %{public}s, [%{public}s]",
__func__, fileEntry.c_str(), dlerror());
exit(-1);
}
HILOG_INFO("%{public}s Success to dlopen %{public}s", __func__, fileEntry.c_str());
handleAbilityLib_.emplace_back(handleAbilityLib);
}
}
#endif
}
void MainThread::ChangeToLocalPath(const std::string &bundleName,
const std::vector<std::string> &sourceDirs, std::vector<std::string> &localPath)
{
@ -1803,7 +1758,6 @@ void MainThread::CloseAbilityLibrary()
}
handleAbilityLib_.clear();
fileEntries_.clear();
nativeFileEntries_.clear();
}
bool MainThread::ScanDir(const std::string &dirPath, std::vector<std::string> &files)

View File

@ -15,21 +15,20 @@ import("//build/test.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")
module_output_path = "ability_runtime/application_test"
ABILITY_INNERKITS_PATH = "${ability_runtime_path}/interfaces/inner_api"
ABILITY_INNERKITS_PATH = "${ability_runtime_innerkits_path}"
###############################################################################
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/context",
"${ability_runtime_path}/interfaces/inner_api/app_manager/include/appmgr",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_base_innerapi_path}/uri/include",
"${bundlefwk_inner_api_path}/appexecfwk_core/include/bundlemgr",
"${ability_base_innerapi_path}/want/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include/task",
"${ability_runtime_kits_path}/appkit/native/test/mock/include",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/ability/native/include",
"${ability_runtime_kits_path}/appkit/native/app/include/task",
]
cflags = []
if (target_cpu == "arm") {
@ -44,16 +43,13 @@ config("module_private_config") {
config("module_context_config") {
visibility = [ ":*" ]
include_dirs = [
"//base/notification/eventhandler/interfaces/inner_api",
"${ability_runtime_path}/interfaces/inner_api/app_manager/include/appmgr",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_base_innerapi_path}/uri/include",
"${ability_base_innerapi_path}/want/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${bundlefwk_inner_api_path}/appexecfwk_core/include/bundlemgr",
"${bundlefwk_inner_api_path}/appexecfwk_base/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include/task",
"${ability_runtime_path}/frameworks/kits/ability/native/include",
"${ability_runtime_kits_path}/appkit/native/test/mock/include",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/appkit/native/app/include/task",
"${ability_runtime_kits_path}/ability/native/include",
]
cflags = []
if (target_cpu == "arm") {
@ -76,20 +72,19 @@ ohos_unittest("context_deal_interface_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
external_deps = [
"ability_base:want",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -102,8 +97,8 @@ ohos_unittest("context_deal_interface_test") {
ohos_unittest("application_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"../app/src/ohos_application.cpp",
"unittest/ability_stage_test.cpp",
"unittest/application_data_manager_test.cpp",
@ -114,25 +109,24 @@ ohos_unittest("application_test") {
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
#"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
]
external_deps = [
"ability_base:base",
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -141,9 +135,9 @@ ohos_unittest("application_test") {
ohos_unittest("context_container_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"../app/src/ohos_application.cpp",
"unittest/context_container_test.cpp",
]
@ -151,13 +145,11 @@ ohos_unittest("context_container_test") {
configs = [ ":module_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -166,6 +158,8 @@ ohos_unittest("context_container_test") {
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -174,9 +168,9 @@ ohos_unittest("context_container_test") {
ohos_unittest("context_deal_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"../app/src/ohos_application.cpp",
"mock/include/mock_ability_manager_client.cpp",
"unittest/context_deal_test.cpp",
@ -185,13 +179,11 @@ ohos_unittest("context_deal_test") {
configs = [ ":module_context_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -201,6 +193,8 @@ ohos_unittest("context_deal_test") {
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -209,8 +203,8 @@ ohos_unittest("context_deal_test") {
ohos_unittest("application_impl_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_context.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/app_loader.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_context.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/app_loader.cpp",
"../app/src/application_impl.cpp",
"../app/src/ohos_application.cpp",
"unittest/application_impl_test.cpp",
@ -220,14 +214,12 @@ ohos_unittest("application_impl_test") {
deps = [
"${ABILITY_INNERKITS_PATH}/uri_permission:uri_permission_mgr",
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
@ -236,7 +228,9 @@ ohos_unittest("application_impl_test") {
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
@ -245,10 +239,9 @@ ohos_unittest("application_impl_test") {
config("ability_start_setting_config") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include",
"//foundation/appexecfwk/common/log/include/",
"${ability_runtime_kits_path}/appkit/native/app/include",
"//utils/native/base/include",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_innerkits_path}/ability_manager/include",
]
}
@ -261,12 +254,12 @@ ohos_unittest("ability_start_setting_test") {
]
sources = [
"${ability_runtime_path}/services/abilitymgr/src/ability_start_setting.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp",
"unittest/ability_start_setting_test.cpp",
]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
"//utils/native/base:utilsbase",
@ -294,7 +287,7 @@ ohos_unittest("watchdog_test") {
sources = [ "unittest/watchdog_test.cpp" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
"//utils/native/base:utilsbase",
@ -302,6 +295,8 @@ ohos_unittest("watchdog_test") {
external_deps = [
"ability_base:base",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]

View File

@ -97,7 +97,7 @@ int MockAbilityDelegatorStub::ReleaseAbility(const sptr<IAbilityConnection> &con
}
int MockAbilityDelegatorStub::GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot)
MissionSnapshot& snapshot, bool isLowResolution)
{
return 0;
}
@ -279,7 +279,7 @@ int MockAbilityDelegatorStub2::ReleaseAbility(const sptr<IAbilityConnection> &co
}
int MockAbilityDelegatorStub2::GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot)
MissionSnapshot& snapshot, bool isLowResolution)
{
return 0;
}

View File

@ -125,7 +125,8 @@ public:
const Want &want, const sptr<IAbilityConnection> &connect, const sptr<IRemoteObject> &callerToken) override;
virtual int ReleaseAbility(const sptr<IAbilityConnection> &connect,
const AppExecFwk::ElementName &element) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution) override;
virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
virtual int SendANRProcessID(int pid) override;
virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,
@ -260,7 +261,8 @@ public:
const Want &want, const sptr<IAbilityConnection> &connect, const sptr<IRemoteObject> &callerToken) override;
virtual int ReleaseAbility(const sptr<IAbilityConnection> &connect,
const AppExecFwk::ElementName &element) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution) override;
virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
virtual int SendANRProcessID(int pid) override;
virtual int SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,

View File

@ -137,11 +137,6 @@ ErrCode AbilityManagerClient::StopServiceAbility(const Want &want, const sptr<IR
return ERR_OK;
}
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshot &snapshot)
{
return ERR_OK;
}
ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)
{
return ERR_OK;

View File

@ -16,9 +16,9 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni")
module_output_path = "ability_delegator/"
ability_delegator_mock_sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_ability_delegator_stub.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_iability_monitor.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_test_observer_stub.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_ability_delegator_stub.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_iability_monitor.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_test_observer_stub.cpp",
"${ability_runtime_path}/tools/aa/src/test_observer.cpp",
"${ability_runtime_path}/tools/aa/src/test_observer_stub.cpp",
]
@ -27,16 +27,16 @@ ability_delegator_mock_sources = [
config("moduletest_include_dir") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_delegator/include/",
"${ability_runtime_kits_path}/appkit/native/ability_delegator/include/",
"${ability_runtime_path}/tools/aa/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_delegator/include/runner_runtime/",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator",
"${ability_runtime_kits_path}/appkit/native/ability_delegator/include/runner_runtime/",
"${ability_runtime_innerkits_path}/ability_manager/include",
"//third_party/googletest/googlemock/include",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/context/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/app/",
"${ability_runtime_services_path}/abilitymgr/include",
"${ability_runtime_kits_path}/appkit/native/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/app/",
]
cflags = []
if (target_cpu == "arm") {
@ -53,10 +53,10 @@ ohos_moduletest("shell_cmd_result_moduletest") {
sources = [ "shell_cmd_result_module_test.cpp" ]
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -70,10 +70,10 @@ ohos_moduletest("ability_delegator_args_moduletest") {
sources = [ "ability_delegator_args_module_test.cpp" ]
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -90,10 +90,10 @@ ohos_moduletest("delegator_thread_moduletest") {
sources = [ "delegator_thread_module_test.cpp" ]
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -112,15 +112,15 @@ ohos_moduletest("ability_delegator_registry_moduletest") {
sources += ability_delegator_mock_sources
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -140,11 +140,11 @@ ohos_moduletest("iability_monitor_moduletest") {
sources += ability_delegator_mock_sources
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -164,14 +164,14 @@ ohos_moduletest("ability_delegator_moduletest") {
sources += ability_delegator_mock_sources
configs = [ ":moduletest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -192,17 +192,17 @@ ohos_moduletest("js_test_runner_moduletest") {
configs = [ ":moduletest_include_dir" ]
configs += [
"${ability_runtime_path}/services/common:common_config",
"${ability_runtime_services_path}/common:common_config",
"//ark/js_runtime:ark_jsruntime_public_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//ark/js_runtime:libark_jsruntime",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",

View File

@ -16,10 +16,10 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni")
module_output_path = "ability_delegator/"
ability_delegator_mock_sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_ability_delegator_stub.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_iability_monitor.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_test_observer_stub.cpp",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator/mock_test_runner.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_ability_delegator_stub.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_iability_monitor.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_test_observer_stub.cpp",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator/mock_test_runner.cpp",
"${ability_runtime_path}/tools/aa/src/test_observer.cpp",
"${ability_runtime_path}/tools/aa/src/test_observer_stub.cpp",
]
@ -28,19 +28,17 @@ ability_delegator_mock_sources = [
config("unittest_include_dir") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_delegator/include/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_delegator/include/runner_runtime/",
"${ability_runtime_kits_path}/appkit/native/ability_delegator/include/",
"${ability_runtime_kits_path}/appkit/native/ability_delegator/include/runner_runtime/",
"${ability_runtime_path}/tools/aa/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/ability_delegator",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_kits_path}/appkit/native/test/mock/ability_delegator",
"${ability_runtime_innerkits_path}/ability_manager/include",
"//third_party/googletest/googlemock/include",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/context/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/app/",
"${ability_runtime_path}/interfaces/inner_api/runtime/include/",
"//utils/native/base/include",
"${ability_runtime_services_path}/abilitymgr/include",
"${ability_runtime_kits_path}/appkit/native/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/app/",
"${ability_runtime_innerkits_path}/runtime/include/",
]
cflags = []
if (target_cpu == "arm") {
@ -57,10 +55,10 @@ ohos_unittest("shell_cmd_result_unittest") {
sources = [ "shell_cmd_result_test.cpp" ]
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -74,10 +72,10 @@ ohos_unittest("ability_delegator_args_unittest") {
sources = [ "ability_delegator_args_test.cpp" ]
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -95,11 +93,11 @@ ohos_unittest("iability_monitor_unittest") {
sources += ability_delegator_mock_sources
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -119,14 +117,14 @@ ohos_unittest("ability_delegator_unittest") {
sources += ability_delegator_mock_sources
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -146,10 +144,10 @@ ohos_unittest("delegator_thread_unittest") {
sources = [ "delegator_thread_test.cpp" ]
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -168,15 +166,15 @@ ohos_unittest("ability_delegator_registry_unittest") {
sources += ability_delegator_mock_sources
configs = [ ":unittest_include_dir" ]
configs += [ "${ability_runtime_path}/services/common:common_config" ]
configs += [ "${ability_runtime_services_path}/common:common_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -197,17 +195,17 @@ ohos_unittest("js_test_runner_unittest") {
configs = [ ":unittest_include_dir" ]
configs += [
"${ability_runtime_path}/services/common:common_config",
"${ability_runtime_services_path}/common:common_config",
"//ark/js_runtime:ark_jsruntime_public_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_delegator",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_delegator",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//ark/js_runtime:libark_jsruntime",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",

View File

@ -25,7 +25,7 @@ using namespace OHOS::AppExecFwk;
namespace OHOS {
namespace AppExecFwk {
const int USleepTime = 16000;
const int USleepTime = 13000; // Corresponding to INI_TIMER_FIRST_SECOND and INI_TIMER_SECOND
class WatchDogTest : public testing::Test {
public:
WatchDogTest()

View File

@ -20,18 +20,13 @@ module_output_path = "ability_runtime/moduletest/application_test/"
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/include/appmgr",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_base_innerapi_path}/uri/include",
"${ability_base_innerapi_path}/want/include/ohos/aafwk_L2/content",
"${ability_runtime_path}/frameworks/kits/appkit/native/test/mock/include",
"${ability_runtime_kits_path}/appkit/native/test/mock/include",
#"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/appkit/test/Mock/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/app/include",
#"//foundation/communication/utils/include",
#"//foundation/communication/ipc/ipc/native/src/core/include",
#"//foundation/communication/ipc/utils/include",
#"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/appkit/test/Mock/include",
"${ability_runtime_kits_path}/appkit/native/app/include",
]
defines = [
@ -43,7 +38,7 @@ config("module_private_config") {
ohos_moduletest("appexecfwk_appkit_native_app_module_test_first") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_mgr_stub.cpp",
"Mock/include/mock_app_thread.cpp",
"Mock/include/mock_application.cpp",
"Mock/include/sys_mgr_client_mock.cpp",
@ -56,13 +51,11 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_first") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -71,7 +64,9 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_first") {
external_deps = [
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
@ -81,7 +76,7 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_first") {
ohos_moduletest("appexecfwk_appkit_native_app_module_test_second") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_mgr_stub.cpp",
"Mock/include/mock_app_thread.cpp",
"Mock/include/mock_application.cpp",
"Mock/include/sys_mgr_client_mock.cpp",
@ -94,13 +89,11 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_second") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -109,7 +102,9 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_second") {
external_deps = [
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
@ -119,7 +114,7 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_second") {
ohos_moduletest("appexecfwk_appkit_native_app_module_test_third") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_mgr_stub.cpp",
"Mock/include/mock_app_thread.cpp",
"Mock/include/mock_application.cpp",
"Mock/include/sys_mgr_client_mock.cpp",
@ -132,13 +127,11 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_third") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -147,7 +140,9 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_third") {
external_deps = [
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
@ -157,7 +152,7 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_third") {
ohos_moduletest("appexecfwk_appkit_native_app_module_test_fourth") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp",
"${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_mgr_stub.cpp",
"Mock/include/mock_app_thread.cpp",
"Mock/include/mock_application.cpp",
"Mock/include/sys_mgr_client_mock.cpp",
@ -170,13 +165,11 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_fourth") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
@ -185,7 +178,9 @@ ohos_moduletest("appexecfwk_appkit_native_app_module_test_fourth") {
external_deps = [
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"eventhandler:libeventhandler",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",

View File

@ -139,9 +139,9 @@ AsyncTask::AsyncTask(NativeReference* callbackRef, std::unique_ptr<AsyncTask::Ex
AsyncTask::~AsyncTask() = default;
void AsyncTask::Schedule(NativeEngine& engine, std::unique_ptr<AsyncTask>&& task)
void AsyncTask::Schedule(const std::string &name, NativeEngine& engine, std::unique_ptr<AsyncTask>&& task)
{
if (task && task->Start(engine)) {
if (task && task->Start(name, engine)) {
task.release();
}
}
@ -203,9 +203,9 @@ void AsyncTask::Complete(NativeEngine* engine, int32_t status, void* data)
}
}
bool AsyncTask::Start(NativeEngine& engine)
bool AsyncTask::Start(const std::string &name, NativeEngine& engine)
{
work_.reset(engine.CreateAsyncWork(Execute, Complete, this));
work_.reset(engine.CreateAsyncWork(name, Execute, Complete, this));
return work_->Queue();
}

View File

@ -14,7 +14,7 @@
import("//build/test.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")
module_output_path = "ability_runtime/aafwk_L2"
module_output_path = "ability_runtime/test"
###############################################################################
config("module_private_config") {
@ -24,21 +24,18 @@ config("module_private_config") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
include_dirs = [
"//base/notification/eventhandler/interfaces/inner_api",
"//third_party/json/include",
"//utils/native/base/include",
"//sdk/appexecfwk_L2/appexecfwk_base/include",
"${ability_runtime_path}/interfaces/inner_api/ability_manager/include",
"${ability_runtime_innerkits_path}/ability_manager/include",
"${ability_base_innerapi_path}/uri/include",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_services_path}/common/include",
"${ability_runtime_kits_path}/test/mock/AMS",
"${ability_runtime_services_path}/common/include",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_kits_path}/test/mock/DemoAbility",
"${ability_runtime_services_path}/abilitymgr/include",
"//third_party/jsoncpp/include",
"${ability_runtime_path}/interfaces/inner_api/dataobs_manager/include",
"${ability_runtime_innerkits_path}/dataobs_manager/include",
]
}
@ -46,45 +43,44 @@ ohos_moduletest("ability_moduletest") {
module_out_path = module_output_path
sources = [
"${ability_base_path}/frameworks/native/configuration/src/configuration.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_ability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/caller_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/image_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/launch_param.cpp",
"${ability_runtime_path}/services/abilitymgr/src/lifecycle_state_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_listener_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_listener_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_snapshot.cpp",
"${ability_runtime_path}/services/abilitymgr/src/remote_mission_listener_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/remote_mission_listener_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/sender_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/want_sender_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/wants_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_ability_manager_service.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/caller_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/image_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/launch_param.cpp",
"${ability_runtime_services_path}/abilitymgr/src/lifecycle_state_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_listener_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_listener_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_snapshot.cpp",
"${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/sender_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/want_sender_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/wants_info.cpp",
"moduletest/cpp/abilitytest/ability_test.cpp",
]
configs = [
":module_private_config",
"${ability_base_path}:want_public_config",
"${ability_runtime_path}/frameworks/kits/ability/native:ability_config",
"${ability_runtime_kits_path}/ability/native:ability_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
@ -98,6 +94,7 @@ ohos_moduletest("ability_moduletest") {
"ability_base:base",
"ability_base:want",
"ability_base:zuri",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"dataability:native_dataability",
"hiviewdfx_hilog_native:libhilog",
@ -115,35 +112,34 @@ ohos_moduletest("ability_moduletest") {
ohos_moduletest("ability_conetxt_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/caller_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/launch_param.cpp",
"${ability_runtime_path}/services/abilitymgr/src/lifecycle_state_info.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_serviceability_manager_service.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/caller_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/launch_param.cpp",
"${ability_runtime_services_path}/abilitymgr/src/lifecycle_state_info.cpp",
"moduletest/cpp/abilitytest/ability_context_test.cpp",
]
configs = [
":module_private_config",
"${ability_base_path}:want_public_config",
"${ability_runtime_path}/frameworks/kits/ability/native:ability_config",
"${ability_runtime_kits_path}/ability/native:ability_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//third_party/googletest:gmock_main",
@ -157,6 +153,7 @@ ohos_moduletest("ability_conetxt_test") {
"ability_base:configuration",
"ability_base:want",
"ability_base:zuri",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"dataability:native_dataability",
"hiviewdfx_hilog_native:libhilog",
@ -172,19 +169,17 @@ ohos_moduletest("ability_conetxt_test") {
ohos_moduletest("ability_thread_call_request_module_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/appkit/native/app/src/context_container.cpp",
"${ability_runtime_path}/frameworks/kits/test/moduletest/cpp/abilitytest/ability_thread_call_request_module_test.cpp",
"${ability_runtime_kits_path}/appkit/native/app/src/context_container.cpp",
"${ability_runtime_kits_path}/test/moduletest/cpp/abilitytest/ability_thread_call_request_module_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:app_context",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"//third_party/googletest:gtest_main",
]
@ -193,51 +188,52 @@ ohos_moduletest("ability_thread_call_request_module_test") {
"ability_base:want",
"ability_base:zuri",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"eventhandler:libeventhandler",
]
}
ohos_moduletest("data_ability_operation_moduletest") {
module_out_path = module_output_path
sources = [
"${ability_runtime_path}/frameworks/kits/ability/native/src/data_ability_operation.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/src/data_ability_operation_builder.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/AMS/mock_ability_manager_service.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/caller_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/lifecycle_state_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_listener_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_listener_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/mission_snapshot.cpp",
"${ability_runtime_path}/services/abilitymgr/src/remote_mission_listener_proxy.cpp",
"${ability_runtime_path}/services/abilitymgr/src/remote_mission_listener_stub.cpp",
"${ability_runtime_path}/services/abilitymgr/src/sender_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/want_sender_info.cpp",
"${ability_runtime_path}/services/abilitymgr/src/wants_info.cpp",
"${ability_runtime_kits_path}/ability/native/src/data_ability_operation.cpp",
"${ability_runtime_kits_path}/ability/native/src/data_ability_operation_builder.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/mock_bundle_manager.cpp",
"${ability_runtime_kits_path}/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_ability_manager_client.cpp",
"${ability_runtime_kits_path}/test/mock/AMS/mock_ability_manager_service.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/demo_ability_test.cpp",
"${ability_runtime_kits_path}/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_connect_callback_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_manager_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/ability_scheduler_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/caller_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/lifecycle_state_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_listener_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_listener_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/mission_snapshot.cpp",
"${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_proxy.cpp",
"${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_stub.cpp",
"${ability_runtime_services_path}/abilitymgr/src/sender_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/want_sender_info.cpp",
"${ability_runtime_services_path}/abilitymgr/src/wants_info.cpp",
"moduletest/cpp/abilitytest/data_ability_operation_module_test.cpp",
]
configs = [
":module_private_config",
"${ability_base_path}:want_public_config",
"${ability_runtime_path}/frameworks/kits/ability/native:ability_config",
"${ability_runtime_kits_path}/ability/native:ability_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${ability_runtime_path}/interfaces/inner_api/app_manager:app_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"${global_path}/resource_management/frameworks/resmgr:global_resmgr",
"//third_party/googletest:gmock_main",
@ -269,29 +265,26 @@ ohos_moduletest("data_ability_helper_module_test") {
module_out_path = module_output_path
include_dirs = [
"${ability_runtime_path}/frameworks/kits/test/mock/DemoAbility",
"${ability_runtime_path}/frameworks/kits/test/mock/DemoObServer",
"${ability_runtime_path}/frameworks/kits/ability/native/test/mock/include",
"${ability_runtime_path}/services/dataobsmgr/include",
"${ability_runtime_path}/interfaces/inner_api/dataobs_manager/include",
"${ability_runtime_kits_path}/test/mock/DemoAbility",
"${ability_runtime_kits_path}/test/mock/DemoObServer",
"${ability_runtime_kits_path}/ability/native/test/mock/include",
"${ability_runtime_services_path}/dataobsmgr/include",
"${ability_runtime_innerkits_path}/dataobs_manager/include",
"${distributedschedule_path}/samgr/services/samgr/native/include",
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
]
sources = [ "${ability_runtime_path}/frameworks/kits/test/moduletest/cpp/abilitytest/data_ability_helper_module_test.cpp" ]
sources = [ "${ability_runtime_kits_path}/test/moduletest/cpp/abilitytest/data_ability_helper_module_test.cpp" ]
configs = [
":module_private_config",
"${ability_base_path}:want_public_config",
"${ability_runtime_path}/frameworks/kits/ability/native:ability_config",
"${ability_runtime_kits_path}/ability/native:ability_config",
]
deps = [
"${ability_runtime_path}/frameworks/kits/ability/native:abilitykit_native",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager",
"${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
"//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_kits_path}/ability/native:abilitykit_native",
"${ability_runtime_kits_path}/appkit:appkit_native",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
@ -300,7 +293,9 @@ ohos_moduletest("data_ability_helper_module_test") {
"ability_base:base",
"ability_base:want",
"ability_base:zuri",
"bundle_framework:appexecfwk_base",
"dataability:native_dataability",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",

View File

@ -176,7 +176,8 @@ public:
{
return 0;
}
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot)
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution)
{
return 0;
}

View File

@ -188,7 +188,8 @@ public:
return 0;
}
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot)
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution)
{
return 0;
}

View File

@ -63,11 +63,9 @@ ohos_shared_library("wantagent_innerkits") {
"ability_runtime:ability_manager",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"common_event_service:cesfwk_core",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"resource_management:global_resmgr",
"samgr_standard:samgr_proxy",
"utils_base:utils",
]

View File

@ -19,7 +19,7 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("completed_dispatcher_test") {
module_out_path = module_output_path
include_dirs = [ "${ability_runtime_path}/services/abilitymgr/include" ]
include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]
sources = [ "completed_dispatcher_test.cpp" ]
@ -29,9 +29,9 @@ ohos_unittest("completed_dispatcher_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -20,11 +20,9 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("pending_want_test") {
module_out_path = module_output_path
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/context/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime",
"${ability_runtime_path}/services/abilitymgr/include",
"//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include/",
"//utils/native/base/include",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime",
"${ability_runtime_services_path}/abilitymgr/include",
]
sources = [ "pending_want_test.cpp" ]
@ -35,10 +33,10 @@ ohos_unittest("pending_want_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -19,7 +19,7 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("trigger_Info_test") {
module_out_path = module_output_path
include_dirs = [ "${ability_runtime_path}/services/abilitymgr/include" ]
include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]
sources = [ "trigger_Info_test.cpp" ]
@ -29,9 +29,9 @@ ohos_unittest("trigger_Info_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -20,9 +20,9 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("want_agent_helper_test") {
module_out_path = module_output_path
include_dirs = [
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime/context/",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime",
"${ability_runtime_path}/services/abilitymgr/include",
"${ability_runtime_kits_path}/appkit/native/ability_runtime/context/",
"${ability_runtime_kits_path}/appkit/native/ability_runtime",
"${ability_runtime_services_path}/abilitymgr/include",
]
sources = [ "want_agent_helper_test.cpp" ]
@ -33,10 +33,10 @@ ohos_unittest("want_agent_helper_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:app_context",
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:app_context",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -19,7 +19,7 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("want_agent_info_test") {
module_out_path = module_output_path
include_dirs = [ "${ability_runtime_path}/services/abilitymgr/include" ]
include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]
sources = [ "want_agent_info_test.cpp" ]
@ -29,9 +29,9 @@ ohos_unittest("want_agent_info_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -19,7 +19,7 @@ module_output_path = "ans_standard/wantagent"
ohos_unittest("want_agent_test") {
module_out_path = module_output_path
include_dirs = [ "${ability_runtime_path}/services/abilitymgr/include" ]
include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]
sources = [ "want_agent_test.cpp" ]
@ -29,9 +29,9 @@ ohos_unittest("want_agent_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/frameworks/kits/appkit:appkit_native",
"${ability_runtime_path}/frameworks/kits/wantagent:wantagent_innerkits",
"${ability_runtime_path}/services/abilitymgr:abilityms",
"${ability_runtime_kits_path}/appkit:appkit_native",
"${ability_runtime_kits_path}/wantagent:wantagent_innerkits",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",

View File

@ -23,15 +23,11 @@ config("ability_manager_public_config") {
"${ability_base_innerapi_path}/uri/include",
"//third_party/jsoncpp/include",
"${ability_base_innerapi_path}/want/include",
"//utils/native/base/include",
"${ability_runtime_kits_path}/ability/native/include",
"${bundlefwk_inner_api_path}/appexecfwk_base/include",
"${bundlefwk_inner_api_path}/appexecfwk_core/include/bundlemgr",
"${ability_runtime_innerkits_path}/app_manager/include/appmgr",
"${ability_runtime_kits_path}/appkit/native/app/include",
"${distributeddatamgr_path}/appdatamgr/interfaces/inner_api/native/rdb/include",
"${distributeddatamgr_path}/appdatamgr/interfaces/inner_api/native/appdatafwk/include",
"${distributeddatamgr_path}/appdatamgr/interfaces/inner_api/native/dataability/include",
"${ability_runtime_innerkits_path}/dataobs_manager/include",
]
@ -109,7 +105,6 @@ ohos_shared_library("ability_manager") {
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_appdatafwk",
"relational_store:native_rdb",
"samgr_standard:samgr_proxy",
"utils_base:utils",

View File

@ -311,14 +311,6 @@ public:
*/
ErrCode StopServiceAbility(const Want &want);
/**
* Get mission snapshot by mission id
*
* @param missionId the id of the mission to retrieve the sAutoapshots
* @return Returns ERR_OK on success, others on failure.
*/
ErrCode GetMissionSnapshot(const int32_t missionId, MissionSnapshot &missionSnapshot);
/**
* Kill the process immediately.
*
@ -376,7 +368,7 @@ public:
* @param SystemMemoryAttr, memory information.
*/
void GetSystemMemoryAttr(AppExecFwk::SystemMemoryAttr &memoryInfo);
ErrCode GetAppMemorySize();
bool IsRamConstrainedDevice();
@ -502,10 +494,12 @@ public:
* @brief Get the Mission Snapshot Info object
* @param deviceId local or remote deviceid.
* @param missionId Id of target mission.
* @param snapshot snapshot of target mission
* @param snapshot snapshot of target mission.
* @param isLowResolution get low resolution snapshot.
* @return Returns ERR_OK on success, others on failure.
*/
ErrCode GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot);
ErrCode GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution = false);
/**
* @brief Clean mission by id.

View File

@ -120,9 +120,9 @@ enum {
*/
TERMINATE_SERVICE_IS_CONNECTED,
/**
* Result(2097172) for StartAbility:The ability to start is already activing..
* Result(2097172) for StartAbility:The ability to start is already activating..
*/
START_SERVICE_ABILITY_ACTIVING,
START_SERVICE_ABILITY_ACTIVATING,
/**
* Result(2097173) for move mission to top: An error of moving stack.
*/
@ -165,7 +165,7 @@ enum {
GET_BUNDLENAME_BY_UID_FAIL,
/**
* Result(2097182) for misson not found.
* Result(2097182) for mission not found.
*/
MISSION_NOT_FOUND,

View File

@ -438,7 +438,8 @@ public:
virtual int GetMissionInfo(const std::string &deviceId, int32_t missionId, MissionInfo &missionInfo) = 0;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot) = 0;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution) = 0;
virtual int CleanMission(int32_t missionId) = 0;

View File

@ -55,7 +55,7 @@ public:
ON_HOT_STARTING_WINDOW,
// ipc id for CancelStartingWindow
ON_CANCLE_STARTING_WINDOW,
ON_CANCEL_STARTING_WINDOW,
};
};
} // namespace AAFwk

View File

@ -151,7 +151,7 @@ void WindowManagerServiceHandlerProxy::CancelStartingWindow(sptr<IRemoteObject>
}
MessageParcel reply;
MessageOption option(MessageOption::TF_ASYNC);
int error = Remote()->SendRequest(WMSCmd::ON_CANCLE_STARTING_WINDOW, data, reply, option);
int error = Remote()->SendRequest(WMSCmd::ON_CANCEL_STARTING_WINDOW, data, reply, option);
if (error != ERR_OK) {
HILOG_ERROR("SendRequest fail, error: %{public}d", error);
}

View File

@ -37,7 +37,7 @@ void WindowManagerServiceHandlerStub::Init()
requestFuncMap_[ON_GET_FOCUS_ABILITY] = &WindowManagerServiceHandlerStub::GetFocusWindowInner;
requestFuncMap_[ON_COLD_STARTING_WINDOW] = &WindowManagerServiceHandlerStub::StartingWindowCold;
requestFuncMap_[ON_HOT_STARTING_WINDOW] = &WindowManagerServiceHandlerStub::StartingWindowHot;
requestFuncMap_[ON_CANCLE_STARTING_WINDOW] = &WindowManagerServiceHandlerStub::CancelStartingWindowInner;
requestFuncMap_[ON_CANCEL_STARTING_WINDOW] = &WindowManagerServiceHandlerStub::CancelStartingWindowInner;
}
int WindowManagerServiceHandlerStub::OnRemoteRequest(

View File

@ -35,8 +35,8 @@ config("appmgr_core_config") {
ohos_shared_library("app_manager") {
include_dirs = [
"//third_party/json/include",
"${ability_runtime_path}/services/appmgr/include",
"${ability_runtime_path}/services/common/include",
"${ability_runtime_services_path}/appmgr/include",
"${ability_runtime_services_path}/common/include",
]
sources = [
@ -94,8 +94,6 @@ ohos_shared_library("app_manager") {
"ability_base:configuration",
"ability_base:want",
"bundle_framework:appexecfwk_base",
"common_event_service:cesfwk_core",
"common_event_service:cesfwk_innerkits",
"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",

View File

@ -50,7 +50,7 @@ public:
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
*
* @param token, token, he unique identification to terminate the ability.
* @param clearMissionFlag, indicates whether terminate the ability when clearMision.
* @param clearMissionFlag, indicates whether terminate the ability when clearMission.
* @return
*/
virtual void TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag) = 0;

View File

@ -44,7 +44,7 @@ public:
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
*
* @param token, token, he unique identification to terminate the ability.
* @param clearMissionFlag, indicates whether terminate the ability when clearMision.
* @param clearMissionFlag, indicates whether terminate the ability when clearMission.
* @return
*/
virtual void TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag) override;

View File

@ -145,26 +145,6 @@ public:
return userTestRecord_;
}
/**
* Save native application tag.
*
* @param isNativeApplication Indicates whether it is a native application.
*/
inline void SetNativeApplicatonTag(bool isNativeApplication)
{
isNativeApplication_ = isNativeApplication;
}
/**
* Get native application tag.
*
* @return native application tag.
*/
inline bool IsNativeApplication() const
{
return isNativeApplication_;
}
/**
* @brief read this Sequenceable object from a Parcel.
*
@ -194,7 +174,6 @@ private:
int32_t recordId_ = 0;
int32_t uId_ = 0;
std::shared_ptr<UserTestRecord> userTestRecord_ = nullptr;
bool isNativeApplication_ = false;
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -48,7 +48,7 @@ public:
* Terminate ability.
*
* @param token Ability identify.
* @param clearMissionFlag, indicates whether terminate the ability when clearMision.
* @param clearMissionFlag, indicates whether terminate the ability when clearMission.
* @return Returns RESULT_OK on success, others on failure.
*/
virtual AppMgrResultCode TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag);

View File

@ -78,11 +78,6 @@ bool AppLaunchData::Marshalling(Parcel &parcel) const
return false;
}
}
if (!parcel.WriteBool(isNativeApplication_)) {
HILOG_ERROR("Failed to write isNativeApplication_");
return false;
}
return true;
}
@ -120,8 +115,6 @@ bool AppLaunchData::ReadFromParcel(Parcel &parcel)
return false;
}
}
isNativeApplication_ = parcel.ReadBool();
return true;
}

View File

@ -18,8 +18,6 @@ config("dataobs_manager_public_config") {
visibility = [ ":*" ]
include_dirs = [
"include/",
"//base/notification/eventhandler/interfaces/inner_api",
"//utils/native/base/include",
"//utils/system/safwk/native/include",
"${ability_runtime_kits_path}/ability/native/include",
"${ability_runtime_services_path}/dataobsmgr/include",

View File

@ -147,7 +147,7 @@ public:
using ExecuteCallback = std::function<void()>;
using CompleteCallback = std::function<void(NativeEngine&, AsyncTask&, int32_t)>;
static void Schedule(NativeEngine& engine, std::unique_ptr<AsyncTask>&& task);
static void Schedule(const std::string &name, NativeEngine& engine, std::unique_ptr<AsyncTask>&& task);
AsyncTask(NativeDeferred* deferred, std::unique_ptr<ExecuteCallback>&& execute,
std::unique_ptr<CompleteCallback>&& complete);
@ -162,7 +162,7 @@ private:
static void Execute(NativeEngine* engine, void* data);
static void Complete(NativeEngine* engine, int32_t status, void* data);
bool Start(NativeEngine& engine);
bool Start(const std::string &name, NativeEngine& engine);
std::unique_ptr<NativeDeferred> deferred_;
std::unique_ptr<NativeReference> callbackRef_;

View File

@ -33,7 +33,6 @@ config("abilityms_config") {
"${ability_base_innerapi_path}/uri/include",
"${ability_base_innerapi_path}/want/include",
"${ability_runtime_services_path}/common/include",
"//utils/native/base/include",
"//prebuilts/jdk/jdk8/linux-x86/include",
"//prebuilts/jdk/jdk8/linux-x86/include/linux",
"//third_party/json/include",
@ -47,10 +46,9 @@ config("abilityms_config") {
"//base/account/os_account/frameworks/common/account_error/include",
"//base/account/os_account/frameworks/common/database/include",
"//base/account/os_account/interfaces/innerkits/osaccount/native/include",
"//base/hiviewdfx/hicollie/interfaces/native/innerkits/include",
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
"${ability_runtime_path}/interfaces/inner_api/wantagent/include",
"${ability_runtime_path}/frameworks/kits/appkit/native/ability_runtime",
"${ability_runtime_innerkits_path}/wantagent/include",
"${ability_runtime_kits_path}ive/ability_runtime",
"${bgtaskmgr_interfaces_path}/innerkits/include",
"${bgtaskmgr_frameworks_path}/common/include",
"${bgtaskmgr_frameworks_path}/include",
@ -105,7 +103,6 @@ ohos_shared_library("abilityms") {
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"common_event_service:cesfwk_core",
"common_event_service:cesfwk_innerkits",
"dataability:native_dataability",
"dsoftbus:softbus_client",
"eventhandler:libeventhandler",
@ -115,7 +112,6 @@ ohos_shared_library("abilityms") {
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"relational_store:native_rdb",
"resource_management:global_resmgr",
"safwk:system_ability_fwk",
"samgr_standard:samgr_proxy",
"startup_l2:syspara",

View File

@ -474,7 +474,8 @@ public:
virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot) override;
virtual int GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution) override;
virtual int StartUserTest(const Want &want, const sptr<IRemoteObject> &observer) override;

View File

@ -628,7 +628,7 @@ public:
virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
virtual int32_t GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot) override;
MissionSnapshot& snapshot, bool isLowResolution) override;
/**
* Set ability controller.
@ -952,7 +952,7 @@ private:
const std::string &args, std::vector<std::string> &info, bool isClient, bool isUserID, int userId);
ErrCode ProcessMultiParam(std::vector<std::string> &argsStr, std::string &result);
void ShowHelp(std::string &result);
void ShowIllealInfomation(std::string &result);
void ShowIllegalInfomation(std::string &result);
void InitConnectManager(int32_t userId, bool switchUser);
void InitDataAbilityManager(int32_t userId, bool switchUser);

View File

@ -902,7 +902,7 @@ private:
bool clearMissionFlag_ = false;
int32_t restartCount_ = -1;
int32_t restratMax_ = -1;
int32_t restartMax_ = -1;
std::string specifiedFlag_;
std::mutex lock_;
mutable std::mutex dumpInfoLock_;

View File

@ -124,17 +124,17 @@ public:
* terminate ability with token.
*
* @param token, the token of ability.
* @param clearMissionFlag, indicates whether terminate the ability when clearMision.
* @param clearMissionFlag, indicates whether terminate the ability when clearMission.
* @return true on success ,false on failure.
*/
int TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag);
/**
* move ability to forground.
* move ability to foreground.
*
* @param token, the token of ability.
*/
void MoveToForground(const sptr<IRemoteObject> &token);
void MoveToForeground(const sptr<IRemoteObject> &token);
/**
* move ability to background.

View File

@ -29,8 +29,12 @@ namespace AAFwk {
const std::string TASK_DATA_FILE_BASE_PATH = "/data/service/el1/public/AbilityManagerService";
const std::string MISSION_DATA_FILE_PATH = "MissionInfo";
const std::string MISSION_JSON_FILE_PREFIX = "mission";
const std::string LOW_RESOLUTION_FLAG = "little";
const std::string JSON_FILE_SUFFIX = ".json";
const std::string PNG_FILE_SUFFIX = ".png";
const std::string FILE_SEPARATOR = "/";
const std::string UNDERLINE_SEPARATOR = "_";
const int32_t SCALE = 2;
class MissionDataStorage : public std::enable_shared_from_this<MissionDataStorage> {
public:
@ -73,25 +77,31 @@ public:
/**
* @brief Get the Mission Snapshot object
* @param missionId
* @param missionSnapshot
* @param missionId id of mission.
* @param missionSnapshot snapshot of target mission id.
* @param isLowResolution low resolution.
* @return Returns true if this function is successfully called; returns false otherwise.
*/
bool GetMissionSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot);
bool GetMissionSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot, bool isLowResolution);
#ifdef SUPPORT_GRAPHICS
public:
/**
* Get low resoultion pixelmap of source.
*
* @param source source pixelmap.
* @return return reduced pixel map.
*/
static std::shared_ptr<OHOS::Media::PixelMap> GetReducedPixelMap(
const std::shared_ptr<OHOS::Media::PixelMap>& source);
/**
* @brief Get the Snapshot object
* @param missionId Indicates this mission id.
* @return Returns PixelMap of snapshot.
*/
sptr<Media::PixelMap> GetSnapshot(int missionId) const;
std::unique_ptr<Media::PixelMap> GetPixelMap(int missionId) const;
sptr<Media::PixelMap> GetSnapshot(int missionId, bool isLowResolution = false) const;
private:
std::map<int32_t, std::shared_ptr<Media::PixelMap>> cachedPixelMap_;
std::unique_ptr<Media::PixelMap> GetPixelMap(int missionId, bool isLowResolution) const;
#endif
private:
@ -99,10 +109,11 @@ private:
std::string GetMissionDataFilePath(int missionId);
std::string GetMissionSnapshotPath(int32_t missionId) const;
std::string GetMissionSnapshotPath(int32_t missionId, bool isLowResolution) const;
bool CheckFileNameValid(const std::string &fileName);
#ifdef SUPPORT_GRAPHICS
bool WriteToPng(const char* fileName, uint32_t width, uint32_t height, const uint8_t* data);
bool GetCachedSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot);
@ -110,13 +121,20 @@ private:
bool SaveCachedSnapshot(int32_t missionId, const MissionSnapshot& missionSnapshot);
bool DeleteCachedSnapshot(int32_t missionId);
void DeleteMissionSnapshot(int32_t missionId, bool isLowResolution);
void SaveSnapshotFile(int32_t missionId, const MissionSnapshot& missionSnapshot);
void SaveSnapshotFile(int32_t missionId, const std::shared_ptr<OHOS::Media::PixelMap>& snapshot,
bool isPrivate, bool isLowResolution);
std::map<int32_t, std::shared_ptr<Media::PixelMap>> cachedPixelMap_;
#endif
int userId_ = 0;
std::shared_ptr<AppExecFwk::EventHandler> handler_;
std::mutex cachedPixelMapMutex_;
};
} // namespace AAFwk
} // namespace OHOS
#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_MISSION_DATA_STORAGE_H
#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_MISSION_DATA_STORAGE_H

View File

@ -36,10 +36,10 @@ class MissionInfoMgr : public std::enable_shared_from_this<MissionInfoMgr> {
public:
/**
* @brief generate mission id of mission info object.
* @param misisonId Indicates the missionInfo object of user to operate.
* @param missionId Indicates the missionInfo object of user to operate.
* @return Returns true if the missionId is successfully generated; returns false otherwise.
*/
bool GenerateMissionId(int32_t &misisonId);
bool GenerateMissionId(int32_t &missionId);
/**
* @brief initialization of mission info manager.
@ -137,10 +137,11 @@ public:
* @param missionId mission id
* @param abilityToken abilityToken to get current mission snapshot
* @param missionSnapshot result of snapshot
* @param isLowResolution low resolution snapshot.
* @return return true if update mission snapshot success, else false
*/
bool UpdateMissionSnapshot(int32_t missionId, const sptr<IRemoteObject>& abilityToken,
MissionSnapshot& missionSnapshot) const;
MissionSnapshot& missionSnapshot, bool isLowResolution = false) const;
#ifdef SUPPORT_GRAPHICS
/**
@ -156,11 +157,12 @@ public:
* @param missionId mission id
* @param abilityToken abilityToken to get current mission snapshot
* @param missionSnapshot result of snapshot
# @param isLowResolution low resolution.
* @param force force get snapshot from window manager service.
* @return true return true if get mission snapshot success, else false
*/
bool GetMissionSnapshot(int32_t missionId, const sptr<IRemoteObject>& abilityToken,
MissionSnapshot& missionSnapshot, bool force = false) const;
MissionSnapshot& missionSnapshot, bool isLowResolution, bool force = false) const;
/**
* @brief register snapshotHandler
@ -179,8 +181,8 @@ private:
void GetMatchedMission(const std::string &bundleName, int32_t uid, std::list<int32_t> &missions);
private:
int32_t currentMisionId_ = MIN_MISSION_ID;
std::unordered_map<int32_t, bool> missionIdMap_; // key:distributed misisonid, vaule: has been saved
int32_t currentMissionId_ = MIN_MISSION_ID;
std::unordered_map<int32_t, bool> missionIdMap_; // key:distributed missionid, vaule: has been saved
std::list<InnerMissionInfo> missionInfoList_;
std::shared_ptr<TaskDataPersistenceMgr> taskDataPersistenceMgr_;
sptr<ISnapshotHandler> snapshotHandler_;

View File

@ -93,23 +93,23 @@ public:
int AttachAbilityThread(const sptr<AAFwk::IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token);
/**
* push waitting ability to queue.
* push waiting ability to queue.
*
* @param abilityRequest, the request of ability.
*/
void EnqueueWaittingAbility(const AbilityRequest &abilityRequest);
void EnqueueWaitingAbility(const AbilityRequest &abilityRequest);
/**
* push front waitting ability to queue.
* push front waiting ability to queue.
*
* @param abilityRequest, the request of ability.
*/
void EnqueueWaittingAbilityToFront(const AbilityRequest &abilityRequest);
void EnqueueWaitingAbilityToFront(const AbilityRequest &abilityRequest);
/**
* start waitting ability.
* start waiting ability.
*/
void StartWaittingAbility();
void StartWaitingAbility();
/**
* @brief Get the Ability Record By Token object
@ -230,9 +230,9 @@ public:
void OnAbilityDied(std::shared_ptr<AbilityRecord> abilityRecord, int32_t currentUserId);
/**
* @brief handle when call contection died
* @brief handle when call connection died
*
* @param callRecord the died call contection
* @param callRecord the died call connection
*/
void OnCallConnectDied(const std::shared_ptr<CallRecord> &callRecord);
@ -293,7 +293,7 @@ public:
void OnStartSpecifiedAbilityTimeoutResponse(const AAFwk::Want &want);
/**
* resolve the call ipc of ability for schudeling oncall.
* resolve the call ipc of ability for scheduling oncall.
*
* @param abilityRequest, target ability request.
*/
@ -317,10 +317,11 @@ public:
* @param missionId mission id
* @param abilityToken abilityToken to get current mission snapshot
* @param missionSnapshot result of snapshot
* @param isLowResolution low resolution.
* @return Returns true on success, false on failure.
*/
bool GetMissionSnapshot(int32_t missionId, const sptr<IRemoteObject>& abilityToken,
MissionSnapshot& missionSnapshot);
MissionSnapshot& missionSnapshot, bool isLowResolution);
void GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info, bool isPerm);
#ifdef ABILITY_COMMAND_FOR_TEST
@ -330,7 +331,7 @@ public:
* @param abilityRecordId The Ability Record Id.
* @return Returns ERR_OK on success, others on failure.
*/
int BlockAbility(int abilityReocrdId);
int BlockAbility(int abilityRecordId);
#endif
void UninstallApp(const std::string &bundleName, int32_t uid);
@ -348,7 +349,7 @@ public:
*
* @param abilityToken target ability token.
* @param label target label.
* @return Retun 0 if success.
* @return Return 0 if success.
*/
int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label);
@ -357,7 +358,7 @@ public:
*
* @param token target ability token.
* @param icon target label.
* @return Retun 0 if success.
* @return Return 0 if success.
*/
int SetMissionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon);
@ -407,7 +408,7 @@ private:
const std::shared_ptr<AbilityRecord> &caller, int requestCode);
std::shared_ptr<MissionList> GetTargetMissionList(int missionId, std::shared_ptr<Mission> &mission);
void UpdateMissionTimeStamp(const std::shared_ptr<AbilityRecord> &abilityRecord);
void PostStartWaittingAbility();
void PostStartWaitingAbility();
void HandleAbilityDied(std::shared_ptr<AbilityRecord> abilityRecord);
void HandleLauncherDied(std::shared_ptr<AbilityRecord> ability);
void HandleAbilityDiedByDefault(std::shared_ptr<AbilityRecord> abilityRecord);
@ -420,7 +421,7 @@ private:
// handle timeout event
void HandleLoadTimeout(const std::shared_ptr<AbilityRecord> &ability);
void HandleForgroundTimeout(const std::shared_ptr<AbilityRecord> &ability);
void HandleForegroundTimeout(const std::shared_ptr<AbilityRecord> &ability);
void HandleTimeoutAndResumeAbility(const std::shared_ptr<AbilityRecord> &ability);
void MoveToTerminateList(const std::shared_ptr<AbilityRecord> &ability);
void DelayedResumeTimeout(const std::shared_ptr<AbilityRecord> &callerAbility);
@ -433,7 +434,7 @@ private:
int CallAbilityLocked(const AbilityRequest &abilityRequest);
void UpdateMissionSnapshot(const std::shared_ptr<AbilityRecord> &abilityRecord);
void AddUninstallTags(const std::string &bundleName, int32_t uid);
void EraseWaittingAbility(const std::string &bundleName, int32_t uid);
void EraseWaitingAbility(const std::string &bundleName, int32_t uid);
void RemoveMissionLocked(int32_t missionId);
void TerminatePreviousAbility(const std::shared_ptr<AbilityRecord> &abilityRecord);
@ -448,7 +449,7 @@ private:
std::shared_ptr<MissionList> launcherList_;
std::list<std::shared_ptr<AbilityRecord>> terminateAbilityList_;
std::queue<AbilityRequest> waittingAbilityQueue_;
std::queue<AbilityRequest> waitingAbilityQueue_;
std::shared_ptr<MissionListenerController> listenerController_;
class MissionDmInitCallback : public DistributedHardware::DmInitCallback {

View File

@ -88,10 +88,11 @@ public:
/**
* @brief Get the mission snapshot object
* @param missionId id of mission
* @param missionSnapshot
* @param missionSnapshot output snapshot of mission.
* @param isLowResolution low resolution.
* @return return true if update mission snapshot success, else false
*/
bool GetMissionSnapshot(int missionId, MissionSnapshot& missionSnapshot);
bool GetMissionSnapshot(int missionId, MissionSnapshot& missionSnapshot, bool isLowResolution);
private:
std::unordered_map<int, std::shared_ptr<MissionDataStorage>> missionDataStorageMgr_;

View File

@ -3,7 +3,7 @@
"startup_settings_data": true,
"mission_save_time" : 43200000,
"root_launcher_restart_max":15,
"app_not_response_process_timeout_time" : 5000,
"app_not_response_process_timeout_time" : 1000,
"ams_timeout_time" : 180,
"device_type": "phone"
},

View File

@ -113,8 +113,8 @@ int AbilityConnectManager::StartAbilityLocked(const AbilityRequest &abilityReque
// It may have been started through connect
CommandAbility(targetService);
} else {
HILOG_ERROR("Target service is already activing.");
return START_SERVICE_ABILITY_ACTIVING;
HILOG_ERROR("Target service is already activating.");
return START_SERVICE_ABILITY_ACTIVATING;
}
sptr<Token> token = targetService->GetToken();
@ -285,7 +285,7 @@ int AbilityConnectManager::ConnectAbilityLocked(const AbilityRequest &abilityReq
ConnectAbility(targetService);
}
} else {
HILOG_ERROR("Target service is already activing.");
HILOG_ERROR("Target service is already activating.");
}
auto token = targetService->GetToken();
@ -327,7 +327,7 @@ int AbilityConnectManager::DisconnectAbilityLocked(const sptr<IAbilityConnection
}
}
// 3. target servie has another connection, this record callback disconnected directly.
// 3. target service has another connection, this record callback disconnected directly.
if (eventHandler_ != nullptr) {
auto task = [connectRecordList, connectManager = shared_from_this()]() {
connectManager->HandleDisconnectTask(connectRecordList);
@ -363,15 +363,15 @@ void AbilityConnectManager::OnAbilityRequestDone(const sptr<IRemoteObject> &toke
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
std::lock_guard<std::recursive_mutex> guard(Lock_);
auto abilitState = DelayedSingleton<AppScheduler>::GetInstance()->ConvertToAppAbilityState(state);
auto abilityState = DelayedSingleton<AppScheduler>::GetInstance()->ConvertToAppAbilityState(state);
auto abilityRecord = GetServiceRecordByToken(token);
CHECK_POINTER(abilityRecord);
std::string element = abilityRecord->GetWant().GetElement().GetURI();
HILOG_INFO("Ability: %{public}s", element.c_str());
if (abilitState == AppAbilityState::ABILITY_STATE_FOREGROUND) {
if (abilityState == AppAbilityState::ABILITY_STATE_FOREGROUND) {
abilityRecord->Inactivate();
} else if (abilitState == AppAbilityState::ABILITY_STATE_BACKGROUND) {
} else if (abilityState == AppAbilityState::ABILITY_STATE_BACKGROUND) {
DelayedSingleton<AppScheduler>::GetInstance()->TerminateAbility(token, false);
RemoveServiceAbility(abilityRecord);
}
@ -1049,8 +1049,8 @@ bool AbilityConnectManager::IsAbilityNeedRestart(const std::shared_ptr<AbilityRe
}
};
auto findKeepAliveAbility = [abilityRecord](const std::string &mainElemen) {
return (abilityRecord->GetAbilityInfo().name == mainElemen ||
auto findKeepAliveAbility = [abilityRecord](const std::string &mainElement) {
return (abilityRecord->GetAbilityInfo().name == mainElement ||
abilityRecord->GetAbilityInfo().name == AbilityConfig::SYSTEM_UI_ABILITY_NAME ||
abilityRecord->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME);
};

View File

@ -741,11 +741,11 @@ ErrCode AbilityManagerClient::RegisterSnapshotHandler(const sptr<ISnapshotHandle
}
ErrCode AbilityManagerClient::GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot)
MissionSnapshot& snapshot, bool isLowResolution)
{
auto abms = GetAbilityManager();
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
return abms->GetMissionSnapshot(deviceId, missionId, snapshot);
return abms->GetMissionSnapshot(deviceId, missionId, snapshot, isLowResolution);
}
ErrCode AbilityManagerClient::StartUserTest(const Want &want, const sptr<IRemoteObject> &observer)

View File

@ -843,7 +843,8 @@ int AbilityManagerProxy::GetParcelableInfos(MessageParcel &reply, std::vector<T>
return NO_ERROR;
}
int AbilityManagerProxy::GetMissionSnapshot(const std::string& deviceId, int32_t missionId, MissionSnapshot& snapshot)
int AbilityManagerProxy::GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& snapshot, bool isLowResolution)
{
int error;
MessageParcel data;
@ -861,6 +862,10 @@ int AbilityManagerProxy::GetMissionSnapshot(const std::string& deviceId, int32_t
HILOG_ERROR("missionId write failed.");
return ERR_INVALID_VALUE;
}
if (!data.WriteBool(isLowResolution)) {
HILOG_ERROR("isLowResolution write failed.");
return ERR_INVALID_VALUE;
}
error = Remote()->SendRequest(IAbilityManager::GET_MISSION_SNAPSHOT_INFO, data, reply, option);
if (error != NO_ERROR) {
HILOG_ERROR("Send request error: %{public}d", error);

View File

@ -131,7 +131,7 @@ const std::map<std::string, AbilityManagerService::DumpKey> AbilityManagerServic
std::map<std::string, AbilityManagerService::DumpKey>::value_type("-m", KEY_DUMP_MISSION),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("--top", KEY_DUMP_TOP_ABILITY),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("-t", KEY_DUMP_TOP_ABILITY),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("--waitting-queue", KEY_DUMP_WAIT_QUEUE),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("--waiting-queue", KEY_DUMP_WAIT_QUEUE),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("-w", KEY_DUMP_WAIT_QUEUE),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("--serv", KEY_DUMP_SERVICE),
std::map<std::string, AbilityManagerService::DumpKey>::value_type("-e", KEY_DUMP_SERVICE),
@ -2750,7 +2750,7 @@ void AbilityManagerService::StartHighestPriorityAbility(bool isBoot)
auto userId = GetUserId();
HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId);
/* Query the highest priority abiltiy or extension ability, and start it. usually, it is OOBE or launcher */
/* Query the highest priority ability or extension ability, and start it. usually, it is OOBE or launcher */
Want want;
want.AddEntity(HIGHEST_PRIORITY_ABILITY_ENTITY);
AppExecFwk::AbilityInfo abilityInfo;
@ -2775,13 +2775,13 @@ void AbilityManagerService::StartHighestPriorityAbility(bool isBoot)
Want abilityWant; // donot use 'want' here, because the entity of 'want' is not empty
if (!abilityInfo.name.empty()) {
/* highest priority abiltiy */
/* highest priority ability */
HILOG_INFO("Start the highest priority ability. bundleName: %{public}s, ability:%{public}s",
abilityInfo.bundleName.c_str(), abilityInfo.name.c_str());
abilityWant.SetElementName(abilityInfo.bundleName, abilityInfo.name);
} else {
/* highest priority extension abiltiy */
HILOG_INFO("Start the highest priority entension ability. bundleName: %{public}s, ability:%{public}s",
/* highest priority extension ability */
HILOG_INFO("Start the highest priority extension ability. bundleName: %{public}s, ability:%{public}s",
extensionAbilityInfo.bundleName.c_str(), extensionAbilityInfo.name.c_str());
abilityWant.SetElementName(extensionAbilityInfo.bundleName, extensionAbilityInfo.name);
}
@ -3795,7 +3795,7 @@ int AbilityManagerService::RegisterSnapshotHandler(const sptr<ISnapshotHandler>&
}
int32_t AbilityManagerService::GetMissionSnapshot(const std::string& deviceId, int32_t missionId,
MissionSnapshot& missionSnapshot)
MissionSnapshot& missionSnapshot, bool isLowResolution)
{
if (VerifyMissionPermission() == CHECK_PERMISSION_FAILED) {
HILOG_ERROR("%{public}s: Permission verification failed", __func__);
@ -3812,7 +3812,7 @@ int32_t AbilityManagerService::GetMissionSnapshot(const std::string& deviceId, i
return INNER_ERR;
}
auto token = GetAbilityTokenByMissionId(missionId);
bool result = currentMissionListManager_->GetMissionSnapshot(missionId, token, missionSnapshot);
bool result = currentMissionListManager_->GetMissionSnapshot(missionId, token, missionSnapshot, isLowResolution);
if (!result) {
return INNER_ERR;
}
@ -4623,10 +4623,10 @@ int AbilityManagerService::BlockAmsService()
{
HILOG_DEBUG("%{public}s", __func__);
if (handler_) {
HILOG_DEBUG("%{public}s begain post block ams service task", __func__);
HILOG_DEBUG("%{public}s begin post block ams service task", __func__);
auto BlockAmsServiceTask = [aams = shared_from_this()]() {
while (1) {
HILOG_DEBUG("%{public}s begain waiting", __func__);
HILOG_DEBUG("%{public}s begin waiting", __func__);
std::this_thread::sleep_for(BLOCK_AMS_SERVICE_TIME*1s);
}
};
@ -4709,7 +4709,7 @@ int AbilityManagerService::Dump(int fd, const std::vector<std::u16string> &args)
} else {
errCode = ProcessMultiParam(argsStr, result);
if (errCode == ERR_AAFWK_HIDUMP_INVALID_ARGS) {
ShowIllealInfomation(result);
ShowIllegalInfomation(result);
}
}
@ -4791,7 +4791,7 @@ void AbilityManagerService::ShowHelp(std::string &result)
.append("dump all data ability infomation in the system");
}
void AbilityManagerService::ShowIllealInfomation(std::string &result)
void AbilityManagerService::ShowIllegalInfomation(std::string &result)
{
result.append(ILLEGAL_INFOMATION);
}

View File

@ -1188,8 +1188,9 @@ int AbilityManagerStub::GetMissionSnapshotInfoInner(MessageParcel &data, Message
{
std::string deviceId = data.ReadString();
int32_t missionId = data.ReadInt32();
bool isLowResolution = data.ReadBool();
MissionSnapshot missionSnapshot;
int32_t result = GetMissionSnapshot(deviceId, missionId, missionSnapshot);
int32_t result = GetMissionSnapshot(deviceId, missionId, missionSnapshot, isLowResolution);
HILOG_INFO("snapshot: AbilityManagerStub get snapshot result = %{public}d", result);
if (!reply.WriteParcelable(&missionSnapshot)) {
HILOG_ERROR("GetMissionSnapshot error");
@ -1339,8 +1340,8 @@ int AbilityManagerStub::ForceTimeoutForTestInner(MessageParcel &data, MessagePar
int AbilityManagerStub::BlockAbilityInner(MessageParcel &data, MessageParcel &reply)
{
int32_t abilityReocrdId = data.ReadInt32();
int32_t result = BlockAbility(abilityReocrdId);
int32_t abilityRecordId = data.ReadInt32();
int32_t result = BlockAbility(abilityRecordId);
if (!reply.WriteInt32(result)) {
HILOG_ERROR("reply write failed.");
return ERR_INVALID_VALUE;

View File

@ -112,9 +112,9 @@ AbilityRecord::AbilityRecord(const Want &want, const AppExecFwk::AbilityInfo &ab
recordId_ = abilityRecordId++;
auto abilityMgr = DelayedSingleton<AbilityManagerService>::GetInstance();
if (abilityMgr) {
abilityMgr->GetMaxRestartNum(restratMax_);
abilityMgr->GetMaxRestartNum(restartMax_);
}
restartCount_ = restratMax_;
restartCount_ = restartMax_;
}
AbilityRecord::~AbilityRecord()
@ -256,10 +256,10 @@ void AbilityRecord::ProcessForegroundAbility(uint32_t sceneFlag)
if (isReady_) {
if (IsAbilityState(AbilityState::BACKGROUND)) {
// background to activte state
HILOG_DEBUG("MoveToForground, %{public}s", element.c_str());
// background to active state
HILOG_DEBUG("MoveToForeground, %{public}s", element.c_str());
lifeCycleStateInfo_.sceneFlagBak = sceneFlag;
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForground(token_);
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForeground(token_);
} else {
HILOG_DEBUG("Activate %{public}s", element.c_str());
ForegroundAbility(nullptr, sceneFlag);
@ -282,15 +282,15 @@ void AbilityRecord::ProcessForegroundAbility(bool isRecent, const AbilityRequest
if (isReady_) {
if (IsAbilityState(AbilityState::BACKGROUND)) {
// background to activte state
HILOG_DEBUG("MoveToForground, %{public}s", element.c_str());
// background to active state
HILOG_DEBUG("MoveToForeground, %{public}s", element.c_str());
lifeCycleStateInfo_.sceneFlagBak = sceneFlag;
StartingWindowTask(isRecent, false, abilityRequest, startOptions);
AnimationTask(isRecent, abilityRequest, startOptions, callerAbility);
CancelStartingWindowHotTask();
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForground(token_);
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForeground(token_);
} else {
HILOG_DEBUG("Activate %{public}s", element.c_str());
ForegroundAbility(nullptr, sceneFlag);
@ -1021,13 +1021,13 @@ void AbilityRecord::SaveResultToCallers(const int resultCode, const Want *result
HILOG_WARN("callerRecordList is empty.");
return;
}
auto lastestCaller = callerRecordList.back();
auto latestCaller = callerRecordList.back();
for (auto caller : callerRecordList) {
if (caller == nullptr) {
HILOG_WARN("Caller record is nullptr.");
continue;
}
if (caller == lastestCaller) {
if (caller == latestCaller) {
HILOG_INFO("Caller record is the latest.");
SaveResult(resultCode, resultWant, caller);
continue;
@ -1566,7 +1566,7 @@ void AbilityRecord::SetRestarting(const bool isRestart)
HILOG_DEBUG("SetRestarting: %{public}d", isRestarting_);
if (isLauncherRoot_ && IsLauncherAbility()) {
restartCount_ = isRestart ? (--restartCount_) : restratMax_;
restartCount_ = isRestart ? (--restartCount_) : restartMax_;
HILOG_INFO("root launcher restart count: %{public}d", restartCount_);
}
}
@ -1577,7 +1577,7 @@ void AbilityRecord::SetRestarting(const bool isRestart, int32_t canReStartCount)
HILOG_DEBUG("SetRestarting: %{public}d, restart count: %{public}d", isRestarting_, canReStartCount);
if (isLauncherRoot_ && IsLauncherAbility()) {
restartCount_ = isRestart ? canReStartCount : restratMax_;
restartCount_ = isRestart ? canReStartCount : restartMax_;
HILOG_INFO("root launcher restart count: %{public}d", restartCount_);
}
}
@ -1731,7 +1731,7 @@ ResolveResultType AbilityRecord::Resolve(const AbilityRequest &abilityRequest)
{
auto callback = abilityRequest.connect;
if (abilityRequest.callType != AbilityCallType::CALL_REQUEST_TYPE || !callback) {
HILOG_ERROR("only startd by call type can create a call record.");
HILOG_ERROR("only start by call type can create a call record.");
return ResolveResultType::NG_INNER_ERROR;
}
if (!callContainer_) {
@ -1970,7 +1970,7 @@ int AbilityRecord::BlockAbility()
{
HILOG_INFO("BlockAbility.");
if (scheduler_) {
HILOG_INFO("scheduler_ begain to call BlockAbility %{public}s", __func__);
HILOG_INFO("scheduler_ begin to call BlockAbility %{public}s", __func__);
return scheduler_->BlockAbility();
}
return ERR_NO_INIT;

View File

@ -125,7 +125,7 @@ int AmsConfigurationParameter::LoadAppConfigurationForStartUpService(nlohmann::j
Object.at(AmsConfig::SERVICE_ITEM_AMS).at(AmsConfig::AMS_TIMEOUT_TIME).get<int>();
maxRestartNum_ = Object.at(AmsConfig::SERVICE_ITEM_AMS).at(AmsConfig::ROOT_LAUNCHER_RESTART_MAX).get<int>();
deviceType_ = Object.at(AmsConfig::SERVICE_ITEM_AMS).at(AmsConfig::DEVICE_TYPE).get<std::string>();
HILOG_INFO("get ams service config succes!");
HILOG_INFO("get ams service config success!");
ret = 0;
}

View File

@ -104,7 +104,7 @@ int AppScheduler::TerminateAbility(const sptr<IRemoteObject> &token, bool clearM
return ERR_OK;
}
void AppScheduler::MoveToForground(const sptr<IRemoteObject> &token)
void AppScheduler::MoveToForeground(const sptr<IRemoteObject> &token)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
HILOG_DEBUG("Start to move the ability to foreground.");

View File

@ -103,6 +103,46 @@ void MissionDataStorage::DeleteMissionInfo(int missionId)
DeleteMissionSnapshot(missionId);
}
void MissionDataStorage::SaveMissionSnapshot(int32_t missionId, const MissionSnapshot& missionSnapshot)
{
#ifdef SUPPORT_GRAPHICS
HILOG_INFO("snapshot: save snapshot from cache, missionId = %{public}d", missionId);
SaveCachedSnapshot(missionId, missionSnapshot);
SaveSnapshotFile(missionId, missionSnapshot);
HILOG_INFO("snapshot: delete snapshot from cache, missionId = %{public}d", missionId);
DeleteCachedSnapshot(missionId);
#endif
}
void MissionDataStorage::DeleteMissionSnapshot(int32_t missionId)
{
#ifdef SUPPORT_GRAPHICS
DeleteMissionSnapshot(missionId, false);
DeleteMissionSnapshot(missionId, true);
#endif
}
bool MissionDataStorage::GetMissionSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot, bool isLowResolution)
{
#ifdef SUPPORT_GRAPHICS
if (GetCachedSnapshot(missionId, missionSnapshot)) {
if (isLowResolution) {
missionSnapshot.snapshot = GetReducedPixelMap(missionSnapshot.snapshot);
}
HILOG_INFO("snapshot: GetMissionSnapshot from cache, missionId = %{public}d", missionId);
return true;
}
auto pixelMap = GetPixelMap(missionId, isLowResolution);
if (!pixelMap) {
HILOG_ERROR("%{public}s: GetPixelMap failed.", __func__);
return false;
}
missionSnapshot.snapshot = std::move(pixelMap);
#endif
return true;
}
std::string MissionDataStorage::GetMissionDataDirPath() const
{
return TASK_DATA_FILE_BASE_PATH + "/" + std::to_string(userId_) + "/" + MISSION_DATA_FILE_PATH;
@ -114,6 +154,17 @@ std::string MissionDataStorage::GetMissionDataFilePath(int missionId)
+ MISSION_JSON_FILE_PREFIX + "_" + std::to_string(missionId) + JSON_FILE_SUFFIX;
}
std::string MissionDataStorage::GetMissionSnapshotPath(int32_t missionId, bool isLowResolution) const
{
std::string filePath = GetMissionDataDirPath() + FILE_SEPARATOR + MISSION_JSON_FILE_PREFIX +
UNDERLINE_SEPARATOR + std::to_string(missionId);
if (isLowResolution) {
filePath = filePath + UNDERLINE_SEPARATOR + LOW_RESOLUTION_FLAG;
}
filePath = filePath + PNG_FILE_SUFFIX;
return filePath;
}
bool MissionDataStorage::CheckFileNameValid(const std::string &fileName)
{
std::string fileNameExcludePath = OHOS::HiviewDFX::FileUtil::ExtractFileName(fileName);
@ -140,9 +191,21 @@ bool MissionDataStorage::CheckFileNameValid(const std::string &fileName)
return true;
}
#ifdef SUPPORT_GRAPHICS
void MissionDataStorage::SaveSnapshotFile(int32_t missionId, const MissionSnapshot& missionSnapshot)
{
std::string filePath = GetMissionSnapshotPath(missionId);
SaveSnapshotFile(missionId, missionSnapshot.snapshot, missionSnapshot.isPrivate, false);
SaveSnapshotFile(missionId, GetReducedPixelMap(missionSnapshot.snapshot), missionSnapshot.isPrivate, true);
}
void MissionDataStorage::SaveSnapshotFile(int32_t missionId, const std::shared_ptr<OHOS::Media::PixelMap>& snapshot,
bool isPrivate, bool isLowResolution)
{
if (!snapshot) {
return;
}
std::string filePath = GetMissionSnapshotPath(missionId, isLowResolution);
std::string dirPath = OHOS::HiviewDFX::FileUtil::ExtractFilePath(filePath);
if (!OHOS::HiviewDFX::FileUtil::FileExists(dirPath)) {
bool createDir = OHOS::HiviewDFX::FileUtil::ForceCreateDirectory(dirPath);
@ -151,79 +214,75 @@ void MissionDataStorage::SaveSnapshotFile(int32_t missionId, const MissionSnapsh
return;
}
}
#ifdef SUPPORT_GRAPHICS
bool saveMissionFile = false;
if (missionSnapshot.isPrivate) {
ssize_t dataLength = missionSnapshot.snapshot->GetWidth() * missionSnapshot.snapshot->GetHeight() * BPP;
if (isPrivate) {
ssize_t dataLength = snapshot->GetWidth() * snapshot->GetHeight() * BPP;
uint8_t* data = (uint8_t*) malloc(dataLength);
if (memset_s(data, dataLength, 0xff, dataLength) == EOK) {
saveMissionFile = WriteToPng(filePath.c_str(), missionSnapshot.snapshot->GetWidth(),
missionSnapshot.snapshot->GetHeight(), data);
saveMissionFile = WriteToPng(filePath.c_str(), snapshot->GetWidth(), snapshot->GetHeight(), data);
}
free(data);
} else {
const uint8_t* data = missionSnapshot.snapshot->GetPixels();
saveMissionFile = WriteToPng(filePath.c_str(), missionSnapshot.snapshot->GetWidth(),
missionSnapshot.snapshot->GetHeight(), data);
const uint8_t* data = snapshot->GetPixels();
saveMissionFile = WriteToPng(filePath.c_str(), snapshot->GetWidth(), snapshot->GetHeight(), data);
}
if (!saveMissionFile) {
HILOG_ERROR("snapshot: save mission snapshot failed, path = %{public}s.", filePath.c_str());
}
#endif
}
void MissionDataStorage::SaveMissionSnapshot(int32_t missionId, const MissionSnapshot& missionSnapshot)
std::shared_ptr<OHOS::Media::PixelMap> MissionDataStorage::GetReducedPixelMap(
const std::shared_ptr<OHOS::Media::PixelMap>& snapshot)
{
HILOG_INFO("snapshot: save snapshot from cache, missionId = %{public}d", missionId);
SaveCachedSnapshot(missionId, missionSnapshot);
SaveSnapshotFile(missionId, missionSnapshot);
HILOG_INFO("snapshot: delete snapshot from cache, missionId = %{public}d", missionId);
DeleteCachedSnapshot(missionId);
if (!snapshot) {
return nullptr;
}
OHOS::Media::InitializationOptions options;
options.size.width = snapshot->GetWidth() / SCALE;
options.size.height = snapshot->GetHeight() / SCALE;
std::unique_ptr<OHOS::Media::PixelMap> reducedPixelMap = OHOS::Media::PixelMap::Create(*snapshot, options);
return std::shared_ptr<OHOS::Media::PixelMap>(reducedPixelMap.release());
}
bool MissionDataStorage::GetCachedSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot)
{
#ifdef SUPPORT_GRAPHICS
std::lock_guard<std::mutex> lock(cachedPixelMapMutex_);
auto pixelMap = cachedPixelMap_.find(missionId);
if (pixelMap != cachedPixelMap_.end()) {
missionSnapshot.snapshot = pixelMap->second;
return true;
}
#endif
return false;
}
bool MissionDataStorage::SaveCachedSnapshot(int32_t missionId, const MissionSnapshot& missionSnapshot)
{
#ifdef SUPPORT_GRAPHICS
std::lock_guard<std::mutex> lock(cachedPixelMapMutex_);
auto result = cachedPixelMap_.insert_or_assign(missionId, missionSnapshot.snapshot);
if (!result.second) {
HILOG_ERROR("snapshot: save snapshot cache failed, missionId = %{public}d", missionId);
return false;
}
#endif
return true;
}
bool MissionDataStorage::DeleteCachedSnapshot(int32_t missionId)
{
#ifdef SUPPORT_GRAPHICS
std::lock_guard<std::mutex> lock(cachedPixelMapMutex_);
auto result = cachedPixelMap_.erase(missionId);
if (result != 1) {
HILOG_ERROR("snapshot: delete snapshot cache failed, missionId = %{public}d", missionId);
return false;
}
#endif
return true;
}
void MissionDataStorage::DeleteMissionSnapshot(int32_t missionId)
void MissionDataStorage::DeleteMissionSnapshot(int32_t missionId, bool isLowResolution)
{
std::string filePath = GetMissionSnapshotPath(missionId);
std::string filePath = GetMissionSnapshotPath(missionId, isLowResolution);
std::string dirPath = OHOS::HiviewDFX::FileUtil::ExtractFilePath(filePath);
if (!OHOS::HiviewDFX::FileUtil::FileExists(filePath)) {
HILOG_WARN("snapshot: remove snapshot file %{public}s failed, file not exists", filePath.c_str());
@ -235,10 +294,9 @@ void MissionDataStorage::DeleteMissionSnapshot(int32_t missionId)
}
}
#ifdef SUPPORT_GRAPHICS
sptr<Media::PixelMap> MissionDataStorage::GetSnapshot(int missionId) const
sptr<Media::PixelMap> MissionDataStorage::GetSnapshot(int missionId, bool isLowResolution) const
{
auto pixelMapPtr = GetPixelMap(missionId);
auto pixelMapPtr = GetPixelMap(missionId, isLowResolution);
if (!pixelMapPtr) {
HILOG_ERROR("%{public}s: GetPixelMap failed.", __func__);
return nullptr;
@ -246,9 +304,9 @@ sptr<Media::PixelMap> MissionDataStorage::GetSnapshot(int missionId) const
return sptr<Media::PixelMap>(pixelMapPtr.release());
}
std::unique_ptr<Media::PixelMap> MissionDataStorage::GetPixelMap(int missionId) const
std::unique_ptr<Media::PixelMap> MissionDataStorage::GetPixelMap(int missionId, bool isLowResolution) const
{
std::string filePath = GetMissionSnapshotPath(missionId);
std::string filePath = GetMissionSnapshotPath(missionId, isLowResolution);
if (!OHOS::HiviewDFX::FileUtil::FileExists(filePath)) {
HILOG_INFO("snapshot: storage snapshot not exists, missionId = %{public}d", missionId);
return nullptr;
@ -268,35 +326,9 @@ std::unique_ptr<Media::PixelMap> MissionDataStorage::GetPixelMap(int missionId)
}
return pixelMapPtr;
}
#endif
bool MissionDataStorage::GetMissionSnapshot(int32_t missionId, MissionSnapshot& missionSnapshot)
{
#ifdef SUPPORT_GRAPHICS
if (GetCachedSnapshot(missionId, missionSnapshot)) {
HILOG_INFO("snapshot: GetMissionSnapshot from cache, missionId = %{public}d", missionId);
return true;
}
auto pixelMap = GetPixelMap(missionId);
if (!pixelMap) {
HILOG_ERROR("%{public}s: GetPixelMap failed.", __func__);
return false;
}
missionSnapshot.snapshot = std::move(pixelMap);
#endif
return true;
}
std::string MissionDataStorage::GetMissionSnapshotPath(int32_t missionId) const
{
return GetMissionDataDirPath() + "/"
+ MISSION_JSON_FILE_PREFIX + "_" + std::to_string(missionId) + PNG_FILE_SUFFIX;
}
bool MissionDataStorage::WriteToPng(const char* fileName, uint32_t width, uint32_t height, const uint8_t* data)
{
#ifdef SUPPORT_GRAPHICS
if (data == nullptr) {
HILOG_ERROR("snapshot: data error, nullptr!\n");
return false;
@ -347,8 +379,9 @@ bool MissionDataStorage::WriteToPng(const char* fileName, uint32_t width, uint32
// free memory
png_destroy_write_struct(&png_ptr, &info_ptr);
(void)fclose(fp);
#endif
return true;
}
#endif
} // namespace AAFwk
} // namespace OHOS
} // namespace OHOS

Some files were not shown because too many files have changed in this diff Show More