diff --git a/download/ability/BUILD.gn b/download/ability/BUILD.gn index 03a847a6..45b73539 100644 --- a/download/ability/BUILD.gn +++ b/download/ability/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") import("//build/lite/config/component/lite_component.gni") +import("//build/ohos.gni") ## Build download_dataability.hap ohos_hap("download_dataability") { @@ -26,26 +26,26 @@ ohos_hap("download_dataability") { ## Build downloaddataability.so {{{ config("downloaddataability_public_config") { - visibility = [ ":*" ] - include_dirs = [ + visibility = [ ":*" ] + include_dirs = [ "//third_party/node/src", "include", ] - cflags = [ ] + cflags = [] } - + ohos_shared_library("downloaddataability") { sources = [ + "src/common_event.cpp", + "src/db_path.cpp", "src/download_data_ability.cpp", "src/download_database.cpp", - "src/uri_utils.cpp", "src/file_utils.cpp", "src/predicates_convert.cpp", - "src/common_event.cpp", "src/sql_analyzer.cpp", - "src/db_path.cpp", - ] -include_dirs=[ + "src/uri_utils.cpp", + ] + include_dirs = [ "//utils/native/base/include", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", "//third_party/jsoncpp", @@ -60,37 +60,38 @@ include_dirs=[ "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include", "//foundation/aafwk/standard/services/abilitymgr/include", "//foundation/appexecfwk/standard/common/log/include", - "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include", "//foundation/aafwk/standard/frameworks/kits/ability/native/include", "//base/notification/ces_standard/interfaces/innerkits/native/include/", - "//base/miscservices/request/download/utils/include" - ] + "//base/miscservices/request/download/utils/include", + "//foundation/aafwk/standard/interfaces/innerkits/uri/include", + ] -deps = [ - "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", - "//utils/native/base:utils", - "//foundation/ace/napi:ace_napi", - "//third_party/jsoncpp:jsoncpp", + deps = [ "//base/notification/ces_standard/frameworks/core:cesfwk_core", "//base/notification/ces_standard/frameworks/native:cesfwk_innerkits", "//base/notification/ces_standard/services:cesfwk_services", - "//foundation/aafwk/standard/interfaces/innerkits/want/:want", - "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", + "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", + "//foundation/aafwk/standard/interfaces/innerkits/want/:want", + "//foundation/ace/napi:ace_napi", "//foundation/appexecfwk/standard/common:libappexecfwk_common", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core", - "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", + "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", + "//third_party/jsoncpp:jsoncpp", + "//utils/native/base:utils", "//utils/native/base:utilsbase", ] public_configs = [ ":downloaddataability_public_config" ] external_deps = [ - "ability_runtime:ability_manager", "ability_base:want", + "ability_base:zuri", + "ability_runtime:ability_manager", + "ces_standard:cesfwk_innerkits", "eventhandler:libeventhandler", "ipc:ipc_core", - "ces_standard:cesfwk_innerkits", "native_appdatamgr:native_appdatafwk", "native_appdatamgr:native_dataability", "native_appdatamgr:native_preferences", diff --git a/download/ability/config.json b/download/ability/config.json index 1280f10d..6a8c357a 100644 --- a/download/ability/config.json +++ b/download/ability/config.json @@ -26,9 +26,6 @@ }, "abilities": [ { - "permissions": [ - "com.ohos.download.DataAbilityShellProvider.PROVIDER" - ], "name": "DownloadDataAbility", "icon": "$media:icon", "description": "dataability_description", diff --git a/download/interfaces/innerkits/include/download_service_interface.h b/download/interfaces/innerkits/include/download_service_interface.h index c61f515e..8ac01506 100644 --- a/download/interfaces/innerkits/include/download_service_interface.h +++ b/download/interfaces/innerkits/include/download_service_interface.h @@ -35,6 +35,7 @@ public: virtual bool Resume(uint32_t taskId) = 0; virtual bool On(uint32_t taskId, const std::string &type, const sptr &listener) = 0; virtual bool Off(uint32_t taskId, const std::string &type) = 0; + virtual bool CheckPermission() = 0; }; enum { @@ -46,6 +47,7 @@ enum { CMD_RESUME, CMD_ON, CMD_OFF, + CMD_CHECKPERMISSION, }; } // namespace OHOS::Request::Download -#endif // DOWNLOAD_SERVICE_INTERFACE_H \ No newline at end of file +#endif // DOWNLOAD_SERVICE_INTERFACE_H diff --git a/download/interfaces/kits/js/napi/download_single/BUILD.gn b/download/interfaces/kits/js/napi/download_single/BUILD.gn index 55b83e55..ec959e1d 100644 --- a/download/interfaces/kits/js/napi/download_single/BUILD.gn +++ b/download/interfaces/kits/js/napi/download_single/BUILD.gn @@ -13,9 +13,7 @@ import("//build/ohos.gni") config("download_interfaces_kits_napi_config") { visibility = [ ":*" ] - include_dirs = [ - "include", - ] + include_dirs = [ "include" ] cflags_cc = [ "-fexceptions" ] } @@ -42,51 +40,49 @@ ohos_shared_library("downloadsingle") { "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include", "//foundation/appexecfwk/standard/kits/appkit/native/app", "//foundation/appexecfwk/standard/common/log/include", + "//foundation/aafwk/standard/interfaces/innerkits/uri/include", ] - public_configs = [ - ":download_interfaces_kits_napi_config", - ] + public_configs = [ ":download_interfaces_kits_napi_config" ] sources = [ - "src/napi_utils.cpp", + "src/async_call.cpp", + "src/download_base_notify.cpp", "src/download_config.cpp", + "src/download_event.cpp", + "src/download_fail_notify.cpp", "src/download_info.cpp", + "src/download_manager.cpp", + "src/download_notify_stub.cpp", "src/download_pause.cpp", + "src/download_progress_notify.cpp", "src/download_query.cpp", "src/download_query_mimetype.cpp", "src/download_remove.cpp", "src/download_resume.cpp", "src/download_service_proxy.cpp", - "src/download_manager.cpp", - "src/download_task_napi.cpp", - "src/async_call.cpp", "src/download_task.cpp", - "src/download_event.cpp", - "src/download_notify_stub.cpp", - "src/download_base_notify.cpp", - "src/download_fail_notify.cpp", - "src/download_progress_notify.cpp", + "src/download_task_napi.cpp", + "src/napi_utils.cpp", ] deps = [ + "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", + "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", "//foundation/ace/napi:ace_napi", + "//foundation/appexecfwk/standard/common:libappexecfwk_common", + "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", + "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core", "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//utils/native/base:utils", - - "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes", - "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", - "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", - "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core", - "//foundation/appexecfwk/standard/common:libappexecfwk_common", - "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", ] external_deps = [ + "ability_base:want", + "ability_base:zuri", + "ability_runtime:ability_manager", + "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", - - "ability_runtime:ability_manager", - "ability_base:want", - "eventhandler:libeventhandler", "native_appdatamgr:native_appdatafwk", "native_appdatamgr:native_dataability", "native_appdatamgr:native_preferences", @@ -95,4 +91,4 @@ ohos_shared_library("downloadsingle") { relative_install_dir = "module" subsystem_name = "miscservices" part_name = "request" -} \ No newline at end of file +} diff --git a/download/interfaces/kits/js/napi/download_single/include/download_manager.h b/download/interfaces/kits/js/napi/download_single/include/download_manager.h index 7bb784cc..637aac17 100644 --- a/download/interfaces/kits/js/napi/download_single/include/download_manager.h +++ b/download/interfaces/kits/js/napi/download_single/include/download_manager.h @@ -51,6 +51,8 @@ public: bool On(uint32_t taskId, const std::string &type, const sptr &listener); bool Off(uint32_t taskId, const std::string &type); + + bool CheckPermission(); void OnRemoteSaDied(const wptr &object); void SetDataAbilityHelper(std::shared_ptr dataAbilityHelper); diff --git a/download/interfaces/kits/js/napi/download_single/include/download_service_proxy.h b/download/interfaces/kits/js/napi/download_single/include/download_service_proxy.h index 8e060148..e9813ac4 100644 --- a/download/interfaces/kits/js/napi/download_single/include/download_service_proxy.h +++ b/download/interfaces/kits/js/napi/download_single/include/download_service_proxy.h @@ -36,6 +36,7 @@ public: bool On(uint32_t taskId, const std::string &type, const sptr &listener) override; bool Off(uint32_t taskId, const std::string &type) override; + bool CheckPermission() override; private: static inline BrokerDelegator delegator_; diff --git a/download/interfaces/kits/js/napi/download_single/src/download_event.cpp b/download/interfaces/kits/js/napi/download_single/src/download_event.cpp index e0f361ec..404f20e7 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_event.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_event.cpp @@ -27,6 +27,10 @@ namespace OHOS::Request::Download { napi_value DownloadEvent::On(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } napi_value result = nullptr; size_t argc = NapiUtils::MAX_ARGC; napi_value argv[NapiUtils::MAX_ARGC] = {nullptr}; @@ -73,6 +77,10 @@ napi_value DownloadEvent::On(napi_env env, napi_callback_info info) napi_value DownloadEvent::Off(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); napi_value result = nullptr; size_t argc = NapiUtils::MAX_ARGC; diff --git a/download/interfaces/kits/js/napi/download_single/src/download_fail_notify.cpp b/download/interfaces/kits/js/napi/download_single/src/download_fail_notify.cpp index fba4c151..7970b445 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_fail_notify.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_fail_notify.cpp @@ -31,7 +31,7 @@ DownloadFailNotify::~DownloadFailNotify() void DownloadFailNotify::OnCallBack(MessageParcel &data) { - DOWNLOAD_HILOGD("Pause callback in"); + DOWNLOAD_HILOGD("Failed callback in"); uv_loop_s *loop = nullptr; napi_get_uv_event_loop(env_, &loop); if (loop == nullptr) { @@ -51,11 +51,12 @@ void DownloadFailNotify::OnCallBack(MessageParcel &data) notifyData->task = task_; notifyData->firstArgv = data.ReadUint32(); DOWNLOAD_HILOGD("recv error code is %{public}d", notifyData->firstArgv); - work->data = this; - + work->data = notifyData; + uv_queue_work( loop, work, [](uv_work_t *work) {}, [](uv_work_t *work, int statusInt) { + DOWNLOAD_HILOGD("this is new fail callback"); NotifyData *notifyData = static_cast(work->data); napi_value undefined = 0; napi_get_undefined(notifyData->env, &undefined); @@ -74,4 +75,4 @@ void DownloadFailNotify::OnCallBack(MessageParcel &data) notifyData = nullptr; }); } -} // namespace OHOS::Request::Download \ No newline at end of file +} // namespace OHOS::Request::Download diff --git a/download/interfaces/kits/js/napi/download_single/src/download_manager.cpp b/download/interfaces/kits/js/napi/download_single/src/download_manager.cpp index efc57b20..94b6b679 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_manager.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_manager.cpp @@ -64,34 +64,6 @@ DownloadTask* DownloadManager::EnqueueTask(const DownloadConfig &config) { DOWNLOAD_HILOGD("DownloadManager EnqueueTask start."); - OHOS::Uri uriDownload("dataability:///com.ohos.download/download/downloadInfo"); - OHOS::NativeRdb::ValuesBucket rawContactValues; - rawContactValues.PutString("title", "test1"); - int rowId = dataAbilityHelper_->Insert(uriDownload, rawContactValues); - DOWNLOAD_HILOGI("DownloadManager EnqueueTask rowId = %{public}d", rowId); - - std::vector columns; - columns.push_back("taskid"); - columns.push_back("title"); - - OHOS::NativeRdb::DataAbilityPredicates predicates; - predicates.GreaterThan("taskid", "0"); - std::shared_ptr resultSet; - resultSet = dataAbilityHelper_->Query(uriDownload, columns, predicates); - int rowCount = 0; - resultSet->GetRowCount(rowCount); - DOWNLOAD_HILOGI("DownloadManager ResultSet rowCount = %{public}d", rowCount); - int resultSetNum = resultSet->GoToFirstRow(); - while (resultSetNum == 0) { - int id = 0; - std::string contactIdKey = "taskid"; - int contactIndex = 0; - resultSet->GetColumnIndex(contactIdKey, contactIndex); - resultSet->GetInt(contactIndex, id); - DOWNLOAD_HILOGI("DownloadManager query result id = %{public}d", id); - resultSetNum = resultSet->GoToNextRow(); - } - resultSet->Close(); if (downloadServiceProxy_ == nullptr) { DOWNLOAD_HILOGW("Redo GetDownloadServiceProxy"); downloadServiceProxy_ = GetDownloadServiceProxy(); @@ -100,8 +72,23 @@ DownloadTask* DownloadManager::EnqueueTask(const DownloadConfig &config) DOWNLOAD_HILOGE("Pause quit because redoing GetDownloadServiceProxy failed."); return nullptr; } - DOWNLOAD_HILOGD("DownloadManager Pause succeeded."); uint32_t taskId = downloadServiceProxy_->Request(config); + DOWNLOAD_HILOGD("DownloadManager EnqueueTask succeeded."); + + DOWNLOAD_HILOGD("DownloadManager EnqueueTask Save Data."); + OHOS::Uri uriDownload("dataability:///com.ohos.download/download/downloadInfo"); + OHOS::NativeRdb::ValuesBucket rawContactValues; + rawContactValues.PutInt("taskId", taskId); + rawContactValues.PutString("url", config.GetUrl().c_str()); + rawContactValues.PutString("description", config.GetDescription().c_str()); + rawContactValues.PutString("title", config.GetTitle().c_str()); + rawContactValues.PutString("filePath", config.GetFilePath().c_str()); + rawContactValues.PutBool("metered", config.GetMetered()); + rawContactValues.PutBool("roaming", config.GetRoaming()); + rawContactValues.PutInt("network", config.GetNetworkType()); + + int rowId = dataAbilityHelper_->Insert(uriDownload, rawContactValues); + DOWNLOAD_HILOGI("DownloadManager EnqueueTask rowId = %{public}d", rowId); return new DownloadTask(taskId); } @@ -185,7 +172,7 @@ bool DownloadManager::On(uint32_t taskId, const std::string &type, const sptrOn(taskId, type, listener); } @@ -199,10 +186,25 @@ bool DownloadManager::Off(uint32_t taskId, const std::string &type) DOWNLOAD_HILOGE("Resume quit because redoing GetDownloadServiceProxy failed."); return false; } - DOWNLOAD_HILOGD("DownloadManager Resume succeeded."); + DOWNLOAD_HILOGD("DownloadManager Off succeeded."); return downloadServiceProxy_->Off(taskId, type); } +bool DownloadManager::CheckPermission() +{ + if (downloadServiceProxy_ == nullptr) { + DOWNLOAD_HILOGW("Redo GetDownloadServiceProxy"); + downloadServiceProxy_ = GetDownloadServiceProxy(); + } + if (downloadServiceProxy_ == nullptr) { + DOWNLOAD_HILOGE("Resume quit because redoing GetDownloadServiceProxy failed."); + return false; + } + DOWNLOAD_HILOGD("DownloadManager CheckPermission succeeded."); + DOWNLOAD_HILOGD("Check Permission enable"); + return downloadServiceProxy_->CheckPermission(); +} + sptr DownloadManager::GetDownloadServiceProxy() { sptr systemAbilityManager = diff --git a/download/interfaces/kits/js/napi/download_single/src/download_pause.cpp b/download/interfaces/kits/js/napi/download_single/src/download_pause.cpp index a0cb047d..32172f20 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_pause.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_pause.cpp @@ -22,13 +22,19 @@ namespace OHOS::Request::Download { napi_value DownloadPause::Exec(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); auto input = [context](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status { NAPI_ASSERT_BASE(env, argc == 0, " should 0 parameter!", napi_invalid_arg); return napi_ok; }; auto output = [context](napi_env env, napi_value *result) -> napi_status { - return napi_ok; + napi_status status = napi_get_boolean(env, context->result, result); + DOWNLOAD_HILOGD("output ---- [%{public}s], status[%{public}d]", context->result ? "true" : "false", status); + return status; }; auto exec = [context](AsyncCall::Context *ctx) { context->result = DownloadManager::GetInstance()->Pause(context->task_->GetId()); diff --git a/download/interfaces/kits/js/napi/download_single/src/download_progress_notify.cpp b/download/interfaces/kits/js/napi/download_single/src/download_progress_notify.cpp index be803c83..52a66aa7 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_progress_notify.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_progress_notify.cpp @@ -34,7 +34,7 @@ DownloadProgressNotify::~DownloadProgressNotify() void DownloadProgressNotify::OnCallBack(MessageParcel &data) { - DOWNLOAD_HILOGD("Pause callback in"); + DOWNLOAD_HILOGD("Progress callback in"); uv_loop_s *loop = nullptr; napi_get_uv_event_loop(env_, &loop); if (loop == nullptr) { diff --git a/download/interfaces/kits/js/napi/download_single/src/download_query.cpp b/download/interfaces/kits/js/napi/download_single/src/download_query.cpp index 7826d7ef..6f890e7b 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_query.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_query.cpp @@ -22,6 +22,10 @@ namespace OHOS::Request::Download { napi_value DownloadQuery::Exec(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); auto input = [context](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status { NAPI_ASSERT_BASE(env, argc == 0, " should 0 parameter!", napi_invalid_arg); diff --git a/download/interfaces/kits/js/napi/download_single/src/download_query_mimetype.cpp b/download/interfaces/kits/js/napi/download_single/src/download_query_mimetype.cpp index 147dbc3d..60d7a596 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_query_mimetype.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_query_mimetype.cpp @@ -23,6 +23,10 @@ namespace OHOS::Request::Download { napi_value DownloadQueryMimeType::Exec(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); auto input = [context](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status { NAPI_ASSERT_BASE(env, argc == 0, " should 0 parameter!", napi_invalid_arg); @@ -42,4 +46,4 @@ napi_value DownloadQueryMimeType::Exec(napi_env env, napi_callback_info info) AsyncCall asyncCall(env, info, std::dynamic_pointer_cast(context), 0); return asyncCall.Call(env, exec); } -} // namespace OHOS::Request::Download \ No newline at end of file +} // namespace OHOS::Request::Download diff --git a/download/interfaces/kits/js/napi/download_single/src/download_remove.cpp b/download/interfaces/kits/js/napi/download_single/src/download_remove.cpp index 1145458d..49fa90a7 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_remove.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_remove.cpp @@ -21,13 +21,19 @@ namespace OHOS::Request::Download { napi_value DownloadRemove::Exec(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); auto input = [context](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status { NAPI_ASSERT_BASE(env, argc == 0, " should 0 parameter!", napi_invalid_arg); return napi_ok; }; auto output = [context](napi_env env, napi_value *result) -> napi_status { - return napi_ok; + napi_status status = napi_get_boolean(env, context->result, result); + DOWNLOAD_HILOGD("output ---- [%{public}s], status[%{public}d]", context->result ? "true" : "false", status); + return status; }; auto exec = [context](AsyncCall::Context *ctx) { context->result = DownloadManager::GetInstance()->Remove(context->task_->GetId()); @@ -39,4 +45,4 @@ napi_value DownloadRemove::Exec(napi_env env, napi_callback_info info) AsyncCall asyncCall(env, info, std::dynamic_pointer_cast(context), 0); return asyncCall.Call(env, exec); } -} // namespace OHOS::Request::Download \ No newline at end of file +} // namespace OHOS::Request::Download diff --git a/download/interfaces/kits/js/napi/download_single/src/download_resume.cpp b/download/interfaces/kits/js/napi/download_single/src/download_resume.cpp index a81fe5de..6baa67f6 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_resume.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_resume.cpp @@ -21,13 +21,19 @@ namespace OHOS::Request::Download { napi_value DownloadResume::Exec(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter ---->"); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } auto context = std::make_shared(); auto input = [context](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status { NAPI_ASSERT_BASE(env, argc == 0, " should 0 parameter!", napi_invalid_arg); return napi_ok; }; auto output = [context](napi_env env, napi_value *result) -> napi_status { - return napi_ok; + napi_status status = napi_get_boolean(env, context->result, result); + DOWNLOAD_HILOGD("output ---- [%{public}s], status[%{public}d]", context->result ? "true" : "false", status); + return status; }; auto exec = [context](AsyncCall::Context *ctx) { context->result = DownloadManager::GetInstance()->Resume(context->task_->GetId()); diff --git a/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp b/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp index 53872b76..c94df7d2 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp @@ -223,4 +223,24 @@ bool DownloadServiceProxy::Off(uint32_t taskId, const std::string &type) DOWNLOAD_HILOGD("DownloadServiceProxy::Off out [ret: %{public}d]", ret); return ret; } + +bool DownloadServiceProxy::CheckPermission() +{ + DOWNLOAD_HILOGD("DownloadServiceProxy::CheckPermission in"); + MessageParcel data, reply; + MessageOption option; + if (!data.WriteInterfaceToken(GetDescriptor())) { + DOWNLOAD_HILOGE(" Failed to write parcelable "); + return false; + } + + int32_t result = Remote()->SendRequest(CMD_CHECKPERMISSION, data, reply, option); + if (result != ERR_NONE) { + DOWNLOAD_HILOGE(" DownloadServiceProxy::CheckPermission fail, ret = %{public}d ", result); + return false; + } + bool ret = reply.ReadBool(); + DOWNLOAD_HILOGD("DownloadServiceProxy::CheckPermission out [ret: %{public}d]", ret); + return ret; +} } // namespace OHOS::Request::Download diff --git a/download/interfaces/kits/js/napi/download_single/src/download_task_napi.cpp b/download/interfaces/kits/js/napi/download_single/src/download_task_napi.cpp index 5a7be564..124373bb 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_task_napi.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_task_napi.cpp @@ -51,6 +51,10 @@ __thread napi_ref DownloadTaskNapi::globalCtor = nullptr; napi_value DownloadTaskNapi::JsMain(napi_env env, napi_callback_info info) { DOWNLOAD_HILOGD("Enter download JsMain."); + if (!DownloadManager::GetInstance()->CheckPermission()) { + DOWNLOAD_HILOGD("no permission to access download service"); + return nullptr; + } struct ContextInfo { napi_ref ref = nullptr; }; @@ -188,9 +192,12 @@ std::shared_ptr DownloadTaskNapi::GetDataAb } std::shared_ptr uriPtr = std::make_shared("dataability:///com.ohos.download"); if (dataAbilityHelper_ == nullptr) { - DOWNLOAD_HILOGE("dataAbilityHelper_ is not nullptr!"); + DOWNLOAD_HILOGE("Try to get dataAbilityHelper_!"); dataAbilityHelper_ = OHOS::AppExecFwk::DataAbilityHelper::Creator(ability->GetContext(), uriPtr); } + if (dataAbilityHelper_ != nullptr) { + DOWNLOAD_HILOGE("dataAbilityHelper_ is not nullptr!"); + } return dataAbilityHelper_; } } // namespace OHOS::Request::Download diff --git a/download/sa_profile/3706.xml b/download/sa_profile/3706.xml index 1bd4b796..f123019a 100644 --- a/download/sa_profile/3706.xml +++ b/download/sa_profile/3706.xml @@ -15,7 +15,7 @@ download_server - 3705 + 3706 libdownload_server.z.so true false diff --git a/download/services/BUILD.gn b/download/services/BUILD.gn index b5033668..58cd92cb 100644 --- a/download/services/BUILD.gn +++ b/download/services/BUILD.gn @@ -15,60 +15,59 @@ import("//build/ohos.gni") config("download_service_config") { visibility = [ ":*" ] - include_dirs = [ - "include", - ] + include_dirs = [ "include" ] cflags_cc = [ "-fexceptions" ] } ohos_shared_library("download_server") { sources = [ - "src/download_service_ability.cpp", - "src/download_service_stub.cpp", - "src/download_notify_proxy.cpp", - "src/download_service_manager.cpp", - "src/download_service_task.cpp", - "src/download_thread.cpp", - "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/src/download_config.cpp", - "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/src/download_info.cpp", + "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/src/download_config.cpp", + "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/src/download_info.cpp", + "src/download_notify_proxy.cpp", + "src/download_service_ability.cpp", + "src/download_service_manager.cpp", + "src/download_service_stub.cpp", + "src/download_service_task.cpp", + "src/download_thread.cpp", ] public_configs = [ "//utils/native/base:utils_config", ":download_service_config", ] - include_dirs = [ + include_dirs = [ "//utils/native/base/include", - "//utils/system/safwk/native/include", + "//utils/system/safwk/native/include", "//base/miscservices/request/download/interfaces/innerkits/include", "//base/miscservices/request/download/utils/include", "//third_party/json/include", "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/include", "//third_party/curl/include", + "//foundation/aafwk/standard/interfaces/innerkits/uri/include", ] deps = [ - "//utils/native/base:utils", + "//base/telephony/core_service/interfaces/innerkits:tel_core_service_api", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler", "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//base/telephony/core_service/interfaces/innerkits:tel_core_service_api", "//third_party/curl:curl", + "//utils/native/base:utils", ] - + defines = [ "NO_SSL_CERTIFICATION=1" ] - + external_deps = [ - "ipc:ipc_core", - "ril_adapter:hril_innerkits", - "hiviewdfx_hilog_native:libhilog", + "ability_base:zuri", + "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_core", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", "multimedia_image_standard:image_native", - "os_account_standard:os_account_innerkits", + "os_account_standard:os_account_innerkits", + "ril_adapter:hril_innerkits", ] subsystem_name = "miscservices" part_name = "request" } - - - diff --git a/download/services/include/download_service_ability.h b/download/services/include/download_service_ability.h index c0f973af..9d9b2dc0 100644 --- a/download/services/include/download_service_ability.h +++ b/download/services/include/download_service_ability.h @@ -50,6 +50,8 @@ public: bool On(uint32_t taskId, const std::string &type, const sptr &listener) override; bool Off(uint32_t taskId, const std::string &type) override; + bool CheckPermission() override; + static void NotifyHandler(const std::string& type, uint32_t taskId, uint32_t argv1, uint32_t argv2); protected: @@ -75,4 +77,4 @@ private: const int32_t extraMonth_ = 1; }; } // namespace OHOS::Request::Download -#endif // DOWNLOAD_SYSTEM_ABILITY_H \ No newline at end of file +#endif // DOWNLOAD_SYSTEM_ABILITY_H diff --git a/download/services/include/download_service_stub.h b/download/services/include/download_service_stub.h index 32e921ba..894b1d3e 100644 --- a/download/services/include/download_service_stub.h +++ b/download/services/include/download_service_stub.h @@ -34,6 +34,7 @@ private: bool OnResume(MessageParcel &data, MessageParcel &reply); bool OnEventOn(MessageParcel &data, MessageParcel &reply); bool OnEventOff(MessageParcel &data, MessageParcel &reply); + bool OnCheckPermission(MessageParcel &data, MessageParcel &reply); }; } // namespace OHOS::Request::Download -#endif // DOWNLOAD_SERVICE_STUB_H \ No newline at end of file +#endif // DOWNLOAD_SERVICE_STUB_H diff --git a/download/services/include/download_service_task.h b/download/services/include/download_service_task.h index 71ab6968..062decf6 100644 --- a/download/services/include/download_service_task.h +++ b/download/services/include/download_service_task.h @@ -88,6 +88,7 @@ private: bool isPartialMode_; bool forceStop_; + bool isRemoved_; uint32_t retryTime_; DownloadTaskCallback eventCb_; diff --git a/download/services/src/download_service_ability.cpp b/download/services/src/download_service_ability.cpp index 5a4bd732..8480f07d 100644 --- a/download/services/src/download_service_ability.cpp +++ b/download/services/src/download_service_ability.cpp @@ -22,6 +22,7 @@ #include "core_service_client.h" #include "ipc_skeleton.h" +#include "accesstoken_kit.h" #include "iservice_registry.h" #include "system_ability.h" #include "system_ability_definition.h" @@ -33,6 +34,11 @@ namespace OHOS::Request::Download { using namespace std; using namespace OHOS::HiviewDFX; +using namespace Security::AccessToken; + +static const std::string DOWNLOAD_PERMISSION_NAME_INTERNET = "ohos.permission.INTERNET"; +static const std::string DOWNLOAD_PERMISSION_NAME_SESSION = "ohos.permission.DOWNLOAD_SESSION_MANAGER"; + REGISTER_SYSTEM_ABILITY_BY_ID(DownloadServiceAbility, DOWNLOAD_SERVICE_ID, true); const std::int64_t INIT_INTERVAL = 5000L; @@ -219,6 +225,21 @@ bool DownloadServiceAbility::Off(uint32_t taskId, const std::string &type) return false; } +bool DownloadServiceAbility::CheckPermission() +{ + AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID(); + int result = PERMISSION_DENIED; + if (AccessTokenKit::GetTokenTypeFlag(callerToken) == TOKEN_NATIVE) { + result = AccessTokenKit::VerifyNativeToken(callerToken, DOWNLOAD_PERMISSION_NAME_INTERNET); + } else if (AccessTokenKit::GetTokenTypeFlag(callerToken) == TOKEN_HAP) { + result = AccessTokenKit::VerifyAccessToken(callerToken, DOWNLOAD_PERMISSION_NAME_INTERNET); + } else { + DOWNLOAD_HILOGE("invalid token id %{public}d", callerToken); + } + DOWNLOAD_HILOGI("Current token permission is %{public}d", result); + return result == PERMISSION_GRANTED; +} + void DownloadServiceAbility::NotifyHandler(const std::string& type, uint32_t taskId, uint32_t argv1, uint32_t argv2) { std::string combineType = type + "-" + std::to_string(taskId); diff --git a/download/services/src/download_service_stub.cpp b/download/services/src/download_service_stub.cpp index 4ae35097..3d191902 100644 --- a/download/services/src/download_service_stub.cpp +++ b/download/services/src/download_service_stub.cpp @@ -52,6 +52,9 @@ int32_t DownloadServiceStub::OnRemoteRequest( case CMD_OFF: return OnEventOff(data, reply); break; + case CMD_CHECKPERMISSION: + return OnCheckPermission(data, reply); + break; default: DOWNLOAD_HILOGE("Default value received, check needed."); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); @@ -197,4 +200,16 @@ bool DownloadServiceStub::OnEventOff(MessageParcel &data, MessageParcel &reply) DOWNLOAD_HILOGD("DownloadServiceStub::OnEventOff out"); return true; } + +bool DownloadServiceStub::OnCheckPermission(MessageParcel &data, MessageParcel &reply) +{ + DOWNLOAD_HILOGD("DownloadServiceStub::OnCheckPermission in"); + + bool result = CheckPermission(); + if (!reply.WriteBool(result)) { + return false; + } + DOWNLOAD_HILOGD("DownloadServiceStub::OnCheckPermission out"); + return true; +} } // namespace OHOS::Request::Download diff --git a/download/services/src/download_service_task.cpp b/download/services/src/download_service_task.cpp index 8f36cd94..bf1071ea 100644 --- a/download/services/src/download_service_task.cpp +++ b/download/services/src/download_service_task.cpp @@ -23,7 +23,7 @@ namespace OHOS::Request::Download { DownloadServiceTask::DownloadServiceTask(uint32_t taskId, const DownloadConfig &config) : taskId_(taskId), config_(config), status_(SESSION_UNKNOWN), code_(ERROR_UNKNOWN), reason_(PAUSED_UNKNOWN), mimeType_(""), file_(nullptr), totalSize_(0), downloadSize_(0), isPartialMode_(false), forceStop_(false), - retryTime_(10), eventCb_(nullptr) { + isRemoved_(false), retryTime_(10), eventCb_(nullptr) { } DownloadServiceTask::~DownloadServiceTask(void) @@ -96,6 +96,7 @@ bool DownloadServiceTask::Resume() bool DownloadServiceTask::Remove() { DOWNLOAD_HILOGD("Remove Task[%{public}d], current status is %{public}d\n", taskId_, status_); + isRemoved_ = true; ForceStopRunning(); if (eventCb_ != nullptr) { eventCb_("remove", taskId_, 0, 0); @@ -380,7 +381,10 @@ int DownloadServiceTask::ProgressCallback(void *pParam, double dltotal, double d { DownloadServiceTask *this_ = static_cast(pParam); if (this_ != nullptr) { - if (this_->eventCb_ != nullptr) { + if (this_->isRemoved_) { + DOWNLOAD_HILOGD("download task has been removed\n"); + } + if (this_->eventCb_ != nullptr && !this_->isRemoved_) { this_->eventCb_("progress", this_->taskId_, this_->downloadSize_, this_->totalSize_); } if (this_->forceStop_) { @@ -440,6 +444,7 @@ bool DownloadServiceTask::ExecHttp() } CURLcode code = curl_easy_perform(handle.get()); + if (file_ != nullptr) { fflush(file_); fclose(file_); @@ -551,6 +556,9 @@ bool DownloadServiceTask::GetFileSize(uint32_t &result) if (res == CURLE_OK) { result = static_cast(size); } + if (result == -1) { + result = 0; + } DOWNLOAD_HILOGD("fetch file size %{public}d", result); return true; } @@ -562,6 +570,10 @@ std::string DownloadServiceTask::GetTmpPath() void DownloadServiceTask::HandleResponseCode(CURLcode code, int32_t httpCode) { + if (isRemoved_) { + DOWNLOAD_HILOGD("download task has been removed"); + return; + } switch (code) { case CURLE_OK: if (httpCode == HTTP_OK || (isPartialMode_ && httpCode == HTTP_PARIAL_FILE)) { diff --git a/download/utils/include/constant.h b/download/utils/include/constant.h index 70de4a7d..ca4414b6 100644 --- a/download/utils/include/constant.h +++ b/download/utils/include/constant.h @@ -26,10 +26,10 @@ enum NetworkType { enum ErrorCode { ERROR_CANNOT_RESUME, ERROR_DEVICE_NOT_FOUND, - ERROR_INSUFFICIENT_SPACE, ERROR_FILE_ALREADY_EXISTS, ERROR_FILE_ERROR, ERROR_HTTP_DATA_ERROR, + ERROR_INSUFFICIENT_SPACE, ERROR_TOO_MANY_REDIRECTS, ERROR_UNHANDLED_HTTP_CODE, ERROR_UNKNOWN, diff --git a/figures/download_architecture.png b/figures/download_architecture.png index 7b72d794..6ac6a2b9 100644 Binary files a/figures/download_architecture.png and b/figures/download_architecture.png differ diff --git a/upload/frameworks/libs/BUILD.gn b/upload/frameworks/libs/BUILD.gn index 1ef39d95..95504b26 100644 --- a/upload/frameworks/libs/BUILD.gn +++ b/upload/frameworks/libs/BUILD.gn @@ -53,12 +53,13 @@ ohos_shared_library("upload_lib") { deps = [ "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", "//foundation/aafwk/standard/interfaces/innerkits/want:want", - "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", "//third_party/curl/:curl", ] external_deps = [ + "ability_base:zuri", "ability_runtime:ability_manager", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/upload/interfaces/kits/napi/BUILD.gn b/upload/interfaces/kits/napi/BUILD.gn index 74970883..e6d7d9f6 100644 --- a/upload/interfaces/kits/napi/BUILD.gn +++ b/upload/interfaces/kits/napi/BUILD.gn @@ -29,6 +29,7 @@ config("upload_native_public_config") { "//third_party/libuv/include", "./", "//base/miscservices/request/download/interfaces/kits/js/napi/download_single/include", + "//base/miscservices/request/download/utils/include", ] } diff --git a/upload/interfaces/kits/napi/src/request_module.cpp b/upload/interfaces/kits/napi/src/request_module.cpp index 3c53934f..6823224c 100644 --- a/upload/interfaces/kits/napi/src/request_module.cpp +++ b/upload/interfaces/kits/napi/src/request_module.cpp @@ -18,14 +18,89 @@ #include "upload_task_napi.h" #include "js_util.h" #include "download_task_napi.h" +#include "constant.h" using namespace OHOS::Request::UploadNapi; using namespace OHOS::Request::Upload; using namespace OHOS::Request::Download; +// fix code rule issue +static napi_value network_mobile = nullptr; +static napi_value network_wifi = nullptr; +static napi_value err_cannot_resume = nullptr; +static napi_value err_dev_not_found = nullptr; +static napi_value err_file_exist = nullptr; +static napi_value err_file_error = nullptr; +static napi_value err_http_data = nullptr; +static napi_value err_no_space = nullptr; +static napi_value err_many_redirect = nullptr; +static napi_value err_http_code = nullptr; +static napi_value err_unknown = nullptr; +static napi_value paused_queue_wifi = nullptr; +static napi_value paused_for_network = nullptr; +static napi_value paused_to_retry = nullptr; +static napi_value paused_by_user = nullptr; +static napi_value session_success = nullptr; +static napi_value session_running = nullptr; +static napi_value session_pending = nullptr; +static napi_value session_paused = nullptr; +static napi_value session_failed = nullptr; + static napi_value Init(napi_env env, napi_value exports) { + /* Create Network Type Const */ + napi_create_int32(env, static_cast(NETWORK_MOBILE), &network_mobile); + napi_create_int32(env, static_cast(NETWORK_WIFI), &network_wifi); + + /* Create error cause const */ + napi_create_int32(env, static_cast(ERROR_CANNOT_RESUME), &err_cannot_resume); + napi_create_int32(env, static_cast(ERROR_DEVICE_NOT_FOUND), &err_dev_not_found); + napi_create_int32(env, static_cast(ERROR_FILE_ALREADY_EXISTS), &err_file_exist); + napi_create_int32(env, static_cast(ERROR_FILE_ERROR), &err_file_error); + napi_create_int32(env, static_cast(ERROR_HTTP_DATA_ERROR), &err_http_data); + napi_create_int32(env, static_cast(ERROR_INSUFFICIENT_SPACE), &err_no_space); + napi_create_int32(env, static_cast(ERROR_TOO_MANY_REDIRECTS), &err_many_redirect); + napi_create_int32(env, static_cast(ERROR_UNHANDLED_HTTP_CODE), &err_http_code); + napi_create_int32(env, static_cast(ERROR_UNKNOWN), &err_unknown); + + /* Create paused reason Const */ + napi_create_int32(env, static_cast(PAUSED_QUEUED_FOR_WIFI), &paused_queue_wifi); + napi_create_int32(env, static_cast(PAUSED_WAITING_FOR_NETWORK), &paused_for_network); + napi_create_int32(env, static_cast(PAUSED_WAITING_TO_RETRY), &paused_to_retry); + napi_create_int32(env, static_cast(PAUSED_BY_USER), &paused_by_user); + + /* Create session status Const */ + napi_create_int32(env, static_cast(SESSION_SUCCESS), &session_success); + napi_create_int32(env, static_cast(SESSION_RUNNING), &session_running); + napi_create_int32(env, static_cast(SESSION_PENDING), &session_pending); + napi_create_int32(env, static_cast(SESSION_PAUSED), &session_paused); + napi_create_int32(env, static_cast(SESSION_FAILED), &session_failed); + napi_property_descriptor desc[] = { + DECLARE_NAPI_STATIC_PROPERTY("NETWORK_MOBILE", network_mobile), + DECLARE_NAPI_STATIC_PROPERTY("NETWORK_WIFI", network_wifi), + + DECLARE_NAPI_STATIC_PROPERTY("ERROR_CANNOT_RESUME", err_cannot_resume), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_DEVICE_NOT_FOUND", err_dev_not_found), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_FILE_ALREADY_EXISTS", err_file_exist), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_FILE_ERROR", err_file_error), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_HTTP_DATA_ERROR", err_http_data), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_INSUFFICIENT_SPACE", err_no_space), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_TOO_MANY_REDIRECTS", err_many_redirect), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_UNHANDLED_HTTP_CODE", err_http_code), + DECLARE_NAPI_STATIC_PROPERTY("ERROR_UNKNOWN", err_unknown), + + DECLARE_NAPI_STATIC_PROPERTY("PAUSED_QUEUED_FOR_WIFI", paused_queue_wifi), + DECLARE_NAPI_STATIC_PROPERTY("PAUSED_WAITING_FOR_NETWORK", paused_for_network), + DECLARE_NAPI_STATIC_PROPERTY("PAUSED_WAITING_TO_RETRY", paused_to_retry), + DECLARE_NAPI_STATIC_PROPERTY("PAUSED_BY_USER", paused_by_user), + + DECLARE_NAPI_STATIC_PROPERTY("SESSION_SUCCESS", session_success), + DECLARE_NAPI_STATIC_PROPERTY("SESSION_RUNNING", session_running), + DECLARE_NAPI_STATIC_PROPERTY("SESSION_PENDING", session_pending), + DECLARE_NAPI_STATIC_PROPERTY("SESSION_PAUSED", session_paused), + DECLARE_NAPI_STATIC_PROPERTY("SESSION_FAILED", session_failed), + DECLARE_NAPI_METHOD("download", DownloadTaskNapi::JsMain), DECLARE_NAPI_METHOD("upload", UploadTaskNapi::JsUpload), }; @@ -48,4 +123,4 @@ static __attribute__((constructor)) void RegisterModule() }; napi_module_register(&module); UPLOAD_HILOGD(UPLOAD_MODULE_JS_NAPI, "module register request"); -} \ No newline at end of file +} diff --git a/upload/unitest/BUILD.gn b/upload/unitest/BUILD.gn index c202fd81..758ea9b2 100644 --- a/upload/unitest/BUILD.gn +++ b/upload/unitest/BUILD.gn @@ -33,12 +33,15 @@ ohos_unittest("upload_obtain_file_UT_test") { deps = [ "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", "//foundation/aafwk/standard/interfaces/innerkits/want:want", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", - "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", ] - external_deps = [ "ability_runtime:ability_manager" ] + external_deps = [ + "ability_base:zuri", + "ability_runtime:ability_manager", + ] } ohos_unittest("upload_UT_test") { @@ -71,13 +74,14 @@ ohos_unittest("upload_UT_test") { deps = [ "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", "//foundation/aafwk/standard/frameworks/kits/appkit:app_context", + "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri", "//foundation/aafwk/standard/interfaces/innerkits/want:want", - "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", "//third_party/curl/:curl", "//utils/native/base:utils", ] external_deps = [ + "ability_base:zuri", "ability_runtime:ability_context_native", "ability_runtime:ability_manager", "ability_runtime:napi_base_context",