From 84dcab72e123a1c5dfecc194a28f03cb57510be9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2022 15:40:50 +0800 Subject: [PATCH 01/27] add accountId Signed-off-by: unknown --- .../ability/native/include/ability_context.h | 4 +-- .../ability/native/src/ability_context.cpp | 4 +-- .../kits/appkit/native/app/include/context.h | 1 + .../native/app/include/context_container.h | 4 +-- .../native/app/src/context_container.cpp | 27 +++++++------------ 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/frameworks/kits/ability/native/include/ability_context.h b/frameworks/kits/ability/native/include/ability_context.h index 02466e25abe..7c4ffcf967c 100644 --- a/frameworks/kits/ability/native/include/ability_context.h +++ b/frameworks/kits/ability/native/include/ability_context.h @@ -368,15 +368,15 @@ public: * @brief Creates a Context object for an application with the given bundle name. * * @param bundleName Indicates the bundle name of the application. - * * @param flag Indicates the flag for creating a Context object. It can be 0, any of * the following values, or any combination of the following values: CONTEXT_IGNORE_SECURITY, * CONTEXT_INCLUDE_CODE, and CONTEXT_RESTRICTED. The value 0 indicates that there is no restriction * on creating contexts for applications. + * @param accountId Indicates the account Id. * * @return Returns a Context object created for the specified application. */ - std::shared_ptr CreateBundleContext(std::string bundleName, int flag); + std::shared_ptr CreateBundleContext(std::string bundleName, int flag, int accountId = DEFAULT_ACCOUNT_ID); /** * @brief Obtains a resource manager. diff --git a/frameworks/kits/ability/native/src/ability_context.cpp b/frameworks/kits/ability/native/src/ability_context.cpp index 24165c79bfe..89a120c423f 100644 --- a/frameworks/kits/ability/native/src/ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_context.cpp @@ -321,9 +321,9 @@ AppExecFwk::AbilityType AbilityContext::GetAbilityInfoType() return info->type; } -std::shared_ptr AbilityContext::CreateBundleContext(std::string bundleName, int flag) +std::shared_ptr AbilityContext::CreateBundleContext(std::string bundleName, int flag, int accountId) { - return ContextContainer::CreateBundleContext(bundleName, flag); + return ContextContainer::CreateBundleContext(bundleName, flag, accountId); } std::shared_ptr AbilityContext::GetResourceManager() const diff --git a/frameworks/kits/appkit/native/app/include/context.h b/frameworks/kits/appkit/native/app/include/context.h index d250982db14..96360e5afd2 100644 --- a/frameworks/kits/appkit/native/app/include/context.h +++ b/frameworks/kits/appkit/native/app/include/context.h @@ -50,6 +50,7 @@ using AbilityStartSetting = AAFwk::AbilityStartSetting; #define OHOS_REQUEST_PERMISSION_VALUE 1 constexpr int INVALID_RESOURCE_VALUE = -1; // GetColor() Failed return Value +constexpr int DEFAULT_ACCOUNT_ID = -1; class DataAbilityHelper; class DataShareHelper; diff --git a/frameworks/kits/appkit/native/app/include/context_container.h b/frameworks/kits/appkit/native/app/include/context_container.h index 034c1159c1e..51827dd13ad 100755 --- a/frameworks/kits/appkit/native/app/include/context_container.h +++ b/frameworks/kits/appkit/native/app/include/context_container.h @@ -338,15 +338,15 @@ public: * @brief Creates a Context object for an application with the given bundle name. * * @param bundleName Indicates the bundle name of the application. - * * @param flag Indicates the flag for creating a Context object. It can be 0, any of * the following values, or any combination of the following values: CONTEXT_IGNORE_SECURITY, * CONTEXT_INCLUDE_CODE, and CONTEXT_RESTRICTED. The value 0 indicates that there is no restriction * on creating contexts for applications. + * @param accountId Indicates the account id. * * @return Returns a Context object created for the specified application. */ - std::shared_ptr CreateBundleContext(std::string bundleName, int flag); + std::shared_ptr CreateBundleContext(std::string bundleName, int flag, int accountId = DEFAULT_ACCOUNT_ID); /** * @brief Obtains information about the caller of this ability. diff --git a/frameworks/kits/appkit/native/app/src/context_container.cpp b/frameworks/kits/appkit/native/app/src/context_container.cpp index 9b8cead2083..651485b8f3c 100644 --- a/frameworks/kits/appkit/native/app/src/context_container.cpp +++ b/frameworks/kits/appkit/native/app/src/context_container.cpp @@ -26,7 +26,7 @@ namespace OHOS { namespace AppExecFwk { // for api7 demo special -constexpr int CURRENT_USERID = 100; +constexpr int CURRENT_ACCOUNT_ID = 100; /** * Attaches a Context object to the current ability. * Generally, this method is called after Ability is loaded to provide the application context for the current ability. @@ -608,19 +608,7 @@ void ContextContainer::RequestPermissionsFromUser(std::vector &perm } } -/** - * @brief Creates a Context object for an application with the given bundle name. - * - * @param bundleName Indicates the bundle name of the application. - * - * @param flag Indicates the flag for creating a Context object. It can be 0, any of - * the following values, or any combination of the following values: CONTEXT_IGNORE_SECURITY, - * CONTEXT_INCLUDE_CODE, and CONTEXT_RESTRICTED. The value 0 indicates that there is no restriction - * on creating contexts for applications. - * - * @return Returns a Context object created for the specified application. - */ -std::shared_ptr ContextContainer::CreateBundleContext(std::string bundleName, int flag) +std::shared_ptr ContextContainer::CreateBundleContext(std::string bundleName, int flag, int accountId) { if (bundleName.empty()) { APP_LOGE("ContextContainer::CreateBundleContext bundleName is empty"); @@ -638,10 +626,13 @@ std::shared_ptr ContextContainer::CreateBundleContext(std::string bundl } BundleInfo bundleInfo; - APP_LOGI("ContextContainer::CreateBundleContext length: %{public}zu, bundleName: %{public}s", - bundleName.length(), - bundleName.c_str()); - bundleMgr->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, CURRENT_USERID); + APP_LOGI("ContextContainer::CreateBundleContext length: %{public}zu, bundleName: %{public}s, accountId is %{public}d", + bundleName.length(), bundleName.c_str(), accountId); + int realAccountId = CURRENT_ACCOUNT_ID; + if (accountId != DEFAULT_ACCOUNT_ID) { + realAccountId = accountId; + } + bundleMgr->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, realAccountId); if (bundleInfo.name.empty() || bundleInfo.applicationInfo.name.empty()) { APP_LOGE("ContextContainer::CreateBundleContext GetBundleInfo is error"); -- Gitee From 3c0d6e7bad9c6bc9f28e5493a8b5e41d54a69450 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2022 16:09:57 +0800 Subject: [PATCH 02/27] add accountId Signed-off-by: unknown --- frameworks/kits/appkit/native/app/src/context_container.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/kits/appkit/native/app/src/context_container.cpp b/frameworks/kits/appkit/native/app/src/context_container.cpp index 651485b8f3c..a63cb549b9d 100644 --- a/frameworks/kits/appkit/native/app/src/context_container.cpp +++ b/frameworks/kits/appkit/native/app/src/context_container.cpp @@ -626,7 +626,7 @@ std::shared_ptr ContextContainer::CreateBundleContext(std::string bundl } BundleInfo bundleInfo; - APP_LOGI("ContextContainer::CreateBundleContext length: %{public}zu, bundleName: %{public}s, accountId is %{public}d", + APP_LOGI("CreateBundleContext length: %{public}zu, bundleName: %{public}s, accountId is %{public}d", bundleName.length(), bundleName.c_str(), accountId); int realAccountId = CURRENT_ACCOUNT_ID; if (accountId != DEFAULT_ACCOUNT_ID) { -- Gitee From 5052b828e203977f4fe98479681cd78732eb8ffd Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Tue, 22 Feb 2022 10:53:27 +0800 Subject: [PATCH 03/27] zhongjianfei@huawei.com Signed-off-by: zhongjianfei Change-Id: I2cb1a738a42775f0eb1807d4fd0495248f88d705 --- .../src/ohos/aafwk/content/intent_params.cpp | 6 ++++ .../abilitymgr/src/ability_stack_manager.cpp | 36 ++++++++++++------- services/appmgr/src/app_running_manager.cpp | 19 +++++----- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/intent_params.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/intent_params.cpp index 4def9d5145a..e1cb9682b74 100644 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/intent_params.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/intent_params.cpp @@ -260,6 +260,9 @@ static void SetArray(const InterfaceID &id, const std::vector &value, sptr::size_type size = value.size(); ao = new (std::nothrow) Array(size, id); + if (ao == nullptr) { + return; + } for (typename std::vector::size_type i = 0; i < size; i++) { ao->Set(i, T2::Box(value[i])); } @@ -275,6 +278,9 @@ bool IntentParams::ReadArrayToParcel(Parcel &parcel, int type, sptr &ao) } std::vector::size_type size = value.size(); ao = new (std::nothrow) Array(size, g_IID_IString); + if (ao == nullptr) { + return false; + } for (std::vector::size_type i = 0; i < size; i++) { ao->Set(i, String::Box(Str16ToStr8(value[i]))); } diff --git a/services/abilitymgr/src/ability_stack_manager.cpp b/services/abilitymgr/src/ability_stack_manager.cpp index 08a1509e291..05e8121db5c 100644 --- a/services/abilitymgr/src/ability_stack_manager.cpp +++ b/services/abilitymgr/src/ability_stack_manager.cpp @@ -1480,6 +1480,10 @@ void AbilityStackManager::CompleteActive(const std::shared_ptr &a auto self(shared_from_this()); auto startWaittingAbilityTask = [self]() { self->StartWaittingAbility(); }; auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); + if (handler == nullptr) { + HILOG_ERROR("handler is nullptr."); + return; + } // multi window moving, complete state. if (abilityRecord->GetInMovingState()) { @@ -2735,20 +2739,26 @@ void AbilityStackManager::HandleAbilityDied(std::shared_ptr abili auto stack = mission->GetMissionStack(); if (IsSplitScreenStack(stack->GetMissionStackId())) { auto friendMission = GetFriendMissionBySplitScreen(stack, mission->GetMissionRecordId()); + if (friendMission == nullptr) { + HILOG_ERROR("friendMission is null."); + return; + } auto friendStack = friendMission->GetMissionStack(); - if (friendMission && friendStack) { - UpdateMissionOption(friendMission, defaultMissionStack_, - AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_FULLSCREEN); - - friendStack->RemoveMissionRecord(friendMission->GetMissionRecordId()); - defaultMissionStack_->AddMissionRecordToEnd(friendMission); - - auto friendTopAbility = friendMission->GetTopAbilityRecord(); - if (friendTopAbility && - (friendTopAbility->IsAbilityState(ACTIVE) || friendTopAbility->IsAbilityState(ACTIVATING))) { - friendTopAbility->SetMovingBackgroundFlag(true); - friendTopAbility->Inactivate(); - } + if (friendStack == nullptr) { + HILOG_ERROR("friendStack is null."); + return; + } + UpdateMissionOption(friendMission, defaultMissionStack_, + AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_FULLSCREEN); + + friendStack->RemoveMissionRecord(friendMission->GetMissionRecordId()); + defaultMissionStack_->AddMissionRecordToEnd(friendMission); + + auto friendTopAbility = friendMission->GetTopAbilityRecord(); + if (friendTopAbility && + (friendTopAbility->IsAbilityState(ACTIVE) || friendTopAbility->IsAbilityState(ACTIVATING))) { + friendTopAbility->SetMovingBackgroundFlag(true); + friendTopAbility->Inactivate(); } } RemoveMissionRecordById(mission->GetMissionRecordId()); diff --git a/services/appmgr/src/app_running_manager.cpp b/services/appmgr/src/app_running_manager.cpp index db78229fbce..3b3c210475a 100644 --- a/services/appmgr/src/app_running_manager.cpp +++ b/services/appmgr/src/app_running_manager.cpp @@ -86,8 +86,8 @@ std::shared_ptr AppRunningManager::CheckAppRunningRecordIsExis if (jointUserId.empty()) { for (const auto &item : appRunningRecordMap_) { const auto &appRecord = item.second; - APP_LOGI("appRecord->GetProcessName() : %{public}s", appRecord->GetProcessName().c_str()); if (appRecord && appRecord->GetProcessName() == processName && !(appRecord->IsTerminating())) { + APP_LOGI("appRecord->GetProcessName() : %{public}s", appRecord->GetProcessName().c_str()); auto appInfoList = appRecord->GetAppInfoList(); APP_LOGI("appInfoList : %{public}zu", appInfoList.size()); auto isExist = [&appName, &uid](const std::shared_ptr &appInfo) { @@ -217,15 +217,16 @@ std::shared_ptr AppRunningManager::OnRemoteDied(const wptrsecond; + if (iter == appRunningRecordMap_.end()) { + APP_LOGE("remote is not exist in the map."); + return nullptr; + } + auto appRecord = iter->second; + if (appRecord != nullptr) { appRecord->SetApplicationClient(nullptr); - appRunningRecordMap_.erase(iter); - if (appRecord) { - return appRecord; - } } - return nullptr; + appRunningRecordMap_.erase(iter); + return appRecord; } const std::map> &AppRunningManager::GetAppRunningRecordMap() @@ -462,4 +463,4 @@ void AppRunningManager::UpdateConfiguration(const Configuration &config) } } } // namespace AppExecFwk -} // namespace OHOS \ No newline at end of file +} // namespace OHOS -- Gitee From f719a0ad4028136f7c148f64e689e7733b933be9 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 22 Feb 2022 09:59:30 +0000 Subject: [PATCH 04/27] Modify timer mode Signed-off-by: wanchengzhen --- frameworks/kits/appkit/BUILD.gn | 1 + .../kits/appkit/native/app/include/watchdog.h | 18 +++-- .../appkit/native/app/src/main_thread.cpp | 9 ++- .../kits/appkit/native/app/src/watchdog.cpp | 72 ++++++++++++------- services/appmgr/BUILD.gn | 1 + 5 files changed, 71 insertions(+), 30 deletions(-) diff --git a/frameworks/kits/appkit/BUILD.gn b/frameworks/kits/appkit/BUILD.gn index 373125fd86f..43cb6d0433d 100644 --- a/frameworks/kits/appkit/BUILD.gn +++ b/frameworks/kits/appkit/BUILD.gn @@ -168,6 +168,7 @@ ohos_shared_library("appkit_native") { "ability_base:configuration", "ability_runtime:runtime", "bytrace_standard:bytrace_core", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "napi:ace_napi", diff --git a/frameworks/kits/appkit/native/app/include/watchdog.h b/frameworks/kits/appkit/native/app/include/watchdog.h index 63f1afd0bff..86833785980 100644 --- a/frameworks/kits/appkit/native/app/include/watchdog.h +++ b/frameworks/kits/appkit/native/app/include/watchdog.h @@ -20,14 +20,14 @@ #include #include "event_handler.h" #include "inner_event.h" +#include "application_impl.h" namespace OHOS { namespace AppExecFwk { const uint32_t MAIN_THREAD_IS_ALIVE = 0; const uint32_t MAIN_THREAD_TIMEOUT_TIME = 3000; -const uint32_t INI_ZERO = 0; -const uint32_t INI_TIMER_FIRST_SECOND = 10; -const uint32_t INI_TIMER_SECOND = 3; +const uint32_t INI_TIMER_FIRST_SECOND = 10000; +const uint32_t INI_TIMER_SECOND = 3000; const std::string MAIN_THREAD_IS_ALIVE_MSG = "MAIN_THREAD_IS_ALIVE"; class WatchDog : public EventHandler { public: @@ -42,7 +42,7 @@ public: * */ void ProcessEvent(const OHOS::AppExecFwk::InnerEvent::Pointer &event) override; - static void Timer(int sig); + bool Timer(); /** * @@ -60,6 +60,13 @@ public: */ void Stop(); + /** + * + * @brief Stop the mainthread function of watchdog. + * + */ + void SetApplicationInfo(const std::shared_ptr &applicationInfo); + /** * * @brief Get the eventHandler of watchdog thread. @@ -77,6 +84,9 @@ public: static bool GetAppMainThreadState(); private: + std::atomic_bool stopWatchDog_ = false; + std::shared_ptr applicationInfo_ = nullptr; + std::shared_ptr watchDogThread_ = nullptr; std::shared_ptr watchDogRunner_; static bool appMainThreadIsAlive_; static std::shared_ptr appMainHandler_; diff --git a/frameworks/kits/appkit/native/app/src/main_thread.cpp b/frameworks/kits/appkit/native/app/src/main_thread.cpp index 6f467769144..17d79f6385b 100644 --- a/frameworks/kits/appkit/native/app/src/main_thread.cpp +++ b/frameworks/kits/appkit/native/app/src/main_thread.cpp @@ -707,6 +707,10 @@ bool MainThread::InitCreate( return false; } + if (watchDogHandler_ != nullptr) { + watchDogHandler_->SetApplicationInfo(applicationInfo_); + } + contextDeal->SetProcessInfo(processInfo_); contextDeal->SetApplicationInfo(applicationInfo_); contextDeal->SetProfile(appProfile_); @@ -1352,8 +1356,9 @@ void MainThread::Init(const std::shared_ptr &runner, const std::sha APP_LOGE("MainThread::Init WatchDog postTask task failed"); } TaskTimeoutDetected(runner); - // watchDogHandler_->Init(mainHandler_, watchDogHandler_) - // APP_LOGI("MainThread:Init before CreateRunner.") + + watchDogHandler_->Init(mainHandler_, watchDogHandler_); + APP_LOGI("MainThread:Init before CreateRunner."); TaskHandlerClient::GetInstance()->CreateRunner(); APP_LOGI("MainThread:Init after CreateRunner."); APP_LOGI("MainThread:Init end."); diff --git a/frameworks/kits/appkit/native/app/src/watchdog.cpp b/frameworks/kits/appkit/native/app/src/watchdog.cpp index 4b25197344d..c1aa47eff4c 100644 --- a/frameworks/kits/appkit/native/app/src/watchdog.cpp +++ b/frameworks/kits/appkit/native/app/src/watchdog.cpp @@ -15,15 +15,20 @@ #include "watchdog.h" -#include -#include #include - +#include +#include "hisysevent.h" #include "app_log_wrapper.h" - namespace OHOS { namespace AppExecFwk { +namespace { +constexpr char EVENT_KEY_UID[] = "UID"; +constexpr char EVENT_KEY_PID[] = "PID"; +constexpr char EVENT_KEY_MESSAGE[] = "MSG"; +constexpr char EVENT_KEY_PACKAGE_NAME[] = "PACKAGE_NAME"; +constexpr char EVENT_KEY_PROCESS_NAME[] = "PROCESS_NAME"; +} std::shared_ptr WatchDog::appMainHandler_ = nullptr; std::shared_ptr WatchDog::currentHandler_ = nullptr; bool WatchDog::appMainThreadIsAlive_ = false; @@ -50,33 +55,36 @@ void WatchDog::ProcessEvent(const OHOS::AppExecFwk::InnerEvent::Pointer &event) void WatchDog::Init(const std::shared_ptr &mainHandler, const std::shared_ptr &watchDogHandler) { - APP_LOGI("watchdog is run !"); WatchDog::appMainHandler_ = mainHandler; WatchDog::currentHandler_ = watchDogHandler; - struct itimerval tick; - tick.it_value.tv_sec = INI_TIMER_FIRST_SECOND; - tick.it_value.tv_usec = INI_ZERO; - tick.it_interval.tv_sec = INI_TIMER_SECOND; - tick.it_interval.tv_usec = INI_ZERO; - - if (signal(SIGALRM, &WatchDog::Timer) == SIG_ERR) { - APP_LOGE("WatchDog::Timer signal fail."); - } - - if (setitimer(ITIMER_REAL, &tick, NULL) < INI_ZERO) { - APP_LOGE("Init WatchDog timer failed"); + if (watchDogThread_ == nullptr) { + watchDogThread_ = std::make_shared(&WatchDog::Timer, this); + APP_LOGI("Watchdog is running!"); } } void WatchDog::Stop() { APP_LOGI("Watchdog is stop !"); + stopWatchDog_.store(true); + if (watchDogThread_ != nullptr && watchDogThread_->joinable()) { + watchDogThread_->join(); + watchDogThread_ = nullptr; + } if (watchDogRunner_) { watchDogRunner_.reset(); } if (currentHandler_) { currentHandler_.reset(); } + if (appMainHandler_) { + appMainHandler_.reset(); + } +} + +void WatchDog::SetApplicationInfo(const std::shared_ptr &applicationInfo) +{ + applicationInfo_ = applicationInfo; } std::shared_ptr WatchDog::GetCurrentHandler() @@ -89,14 +97,30 @@ bool WatchDog::GetAppMainThreadState() return appMainThreadIsAlive_; } -void WatchDog::Timer(int sig) +bool WatchDog::Timer() { - auto timeoutTask1 = [&]() { - appMainThreadIsAlive_ = false; - APP_LOGI("Waring : main thread is not response!"); - }; - currentHandler_->PostTask(timeoutTask1, MAIN_THREAD_IS_ALIVE_MSG, MAIN_THREAD_TIMEOUT_TIME); - appMainHandler_->SendEvent(MAIN_THREAD_IS_ALIVE); + std::this_thread::sleep_for(std::chrono::milliseconds(INI_TIMER_FIRST_SECOND)); + while (!stopWatchDog_) { + std::this_thread::sleep_for(std::chrono::milliseconds(INI_TIMER_SECOND)); + auto timeoutTask1 = [&]() { + appMainThreadIsAlive_ = false; + std::string eventType = "APP_MAIN_THREAD_TIMEOUT"; + std::string msgContent = "app main thread is not response!"; + if (applicationInfo_ != nullptr) { + OHOS::HiviewDFX::HiSysEvent::Write(OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventType, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + EVENT_KEY_UID, std::to_string(applicationInfo_->uid), + EVENT_KEY_PID, std::to_string(getpid()), + EVENT_KEY_PACKAGE_NAME, applicationInfo_->bundleName, + EVENT_KEY_PROCESS_NAME, applicationInfo_->process, + EVENT_KEY_MESSAGE, msgContent); + } + APP_LOGI("Waring : main thread is not response!"); + }; + currentHandler_->PostTask(timeoutTask1, MAIN_THREAD_IS_ALIVE_MSG, MAIN_THREAD_TIMEOUT_TIME); + appMainHandler_->SendEvent(MAIN_THREAD_IS_ALIVE); + } + return true; } } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index 720816bb8c4..4647bde21cc 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -130,6 +130,7 @@ ohos_shared_library("libams") { "bytrace_standard:bytrace_core", "ces_standard:cesfwk_core", "ces_standard:cesfwk_innerkits", + "hicollie_native:libhicollie", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] -- Gitee From e9705418ac4ac383291d912f8d7cc8d5cc354a67 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 22 Feb 2022 19:22:12 +0000 Subject: [PATCH 05/27] Fix dump bug Signed-off-by: wanchengzhen --- tools/aa/src/ability_command.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/aa/src/ability_command.cpp b/tools/aa/src/ability_command.cpp index 7c436da7d4f..6cae6b34f6a 100644 --- a/tools/aa/src/ability_command.cpp +++ b/tools/aa/src/ability_command.cpp @@ -566,8 +566,8 @@ ErrCode AbilityManagerShellCommand::RunAsDumpsysCommand() bool isfirstCommand = false; std::string args; - for (size_t i = 0; i < argList_.size(); i++) { - if (argList_[i] == "-c" || argList_[i] == "--client") { + for (auto it = argList_.begin(); it != argList_.end(); it++) { + if (*it == "-c" || *it == "--client") { if (isClient == false) { isClient = true; } else { @@ -575,9 +575,13 @@ ErrCode AbilityManagerShellCommand::RunAsDumpsysCommand() resultReceiver_.append(HELP_MSG_DUMPSYS); return result; } - - } else if (argList_[i] == "-u" || argList_[i] == "--userId") { - (void)StrToInt(argList_[i + 1], userID); + } else if (*it == "-u" || *it == "--userId") { + if (it + 1 == argList_.end()) { + result = OHOS::ERR_INVALID_VALUE; + resultReceiver_.append(HELP_MSG_DUMPSYS); + return result; + } + (void)StrToInt(*(it + 1), userID); if (userID == DEFAULT_INVAL_VALUE) { result = OHOS::ERR_INVALID_VALUE; resultReceiver_.append(HELP_MSG_DUMPSYS); @@ -590,11 +594,10 @@ ErrCode AbilityManagerShellCommand::RunAsDumpsysCommand() resultReceiver_.append(HELP_MSG_DUMPSYS); return result; } - - } else if (argList_[i] == std::to_string(userID)) { + } else if (*it == std::to_string(userID)) { continue; } else { - args += argList_[i]; + args += *it; args += " "; } } -- Gitee From a80fabcb2ddacc1d4157298b238979c280ed7b65 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 22 Feb 2022 18:26:35 +0000 Subject: [PATCH 06/27] d.ts file delete Signed-off-by: wanchengzhen --- .../kits/js/@ohos.ability.dataUriUtils.d.ts | 60 --- .../kits/js/@ohos.ability.featureAbility.d.ts | 150 -------- .../js/@ohos.ability.particleAbility.d.ts | 90 ----- .../kits/js/@ohos.ability.wantConstant.d.ts | 341 ----------------- .../kits/js/@ohos.app.abilityManager.d.ts | 83 ----- ...@ohos.application.DataShareExtAbility.d.ts | 178 --------- interfaces/kits/js/@ohos.bundle.d.ts | 347 ------------------ interfaces/kits/js/@ohos.data.dataShare.d.ts | 213 ----------- interfaces/kits/js/@ohos.wantAgent.d.ts | 204 ---------- interfaces/kits/js/ability/abilityResult.d.ts | 37 -- .../kits/js/ability/connectOptions.d.ts | 52 --- .../kits/js/ability/dataAbilityHelper.d.ts | 224 ----------- .../kits/js/ability/dataAbilityOperation.d.ts | 107 ------ .../js/ability/startAbilityParameter.d.ts | 50 --- interfaces/kits/js/ability/want.d.ts | 105 ------ .../kits/js/app/abilityMissionInfo.d.ts | 57 --- interfaces/kits/js/app/activeProcessInfo.d.ts | 52 --- .../kits/js/app/activeServiceAbilityInfo.d.ts | 55 --- interfaces/kits/js/app/context.d.ts | 105 ------ interfaces/kits/js/app/memoryMapInfo.d.ts | 63 ---- interfaces/kits/js/app/missionSnapshot.d.ts | 37 -- interfaces/kits/js/app/processErrorInfo.d.ts | 56 --- interfaces/kits/js/app/splitMissionInfo.d.ts | 47 --- interfaces/kits/js/app/systemMemoryAttr.d.ts | 44 --- interfaces/kits/js/bundle/abilityInfo.d.ts | 244 ------------ .../kits/js/bundle/applicationInfo.d.ts | 138 ------- interfaces/kits/js/bundle/bundleInfo.d.ts | 237 ------------ .../kits/js/bundle/bundleInstaller.d.ts | 107 ------ interfaces/kits/js/bundle/customizeData.d.ts | 37 -- interfaces/kits/js/bundle/customizedata.ts | 19 - interfaces/kits/js/bundle/elementName.d.ts | 71 ---- interfaces/kits/js/bundle/hapModuleInfo.d.ts | 116 ------ interfaces/kits/js/bundle/moduleInfo.d.ts | 43 --- .../kits/js/bundle/moduleUsageRecord.d.ts | 103 ------ .../kits/js/bundle/moduleusagerecord1.d.ts | 30 -- interfaces/kits/js/bundle/shortcutInfo.d.ts | 107 ------ interfaces/kits/js/bundle/shortcutinfo1.d.ts | 31 -- interfaces/kits/js/wantAgent/triggerInfo.d.ts | 53 --- .../kits/js/wantAgent/wantAgentInfo.d.ts | 53 --- 39 files changed, 4146 deletions(-) delete mode 100644 interfaces/kits/js/@ohos.ability.dataUriUtils.d.ts delete mode 100644 interfaces/kits/js/@ohos.ability.featureAbility.d.ts delete mode 100644 interfaces/kits/js/@ohos.ability.particleAbility.d.ts delete mode 100644 interfaces/kits/js/@ohos.ability.wantConstant.d.ts delete mode 100644 interfaces/kits/js/@ohos.app.abilityManager.d.ts delete mode 100644 interfaces/kits/js/@ohos.application.DataShareExtAbility.d.ts delete mode 100644 interfaces/kits/js/@ohos.bundle.d.ts delete mode 100644 interfaces/kits/js/@ohos.data.dataShare.d.ts delete mode 100644 interfaces/kits/js/@ohos.wantAgent.d.ts delete mode 100644 interfaces/kits/js/ability/abilityResult.d.ts delete mode 100644 interfaces/kits/js/ability/connectOptions.d.ts delete mode 100644 interfaces/kits/js/ability/dataAbilityHelper.d.ts delete mode 100644 interfaces/kits/js/ability/dataAbilityOperation.d.ts delete mode 100644 interfaces/kits/js/ability/startAbilityParameter.d.ts delete mode 100644 interfaces/kits/js/ability/want.d.ts delete mode 100755 interfaces/kits/js/app/abilityMissionInfo.d.ts delete mode 100755 interfaces/kits/js/app/activeProcessInfo.d.ts delete mode 100755 interfaces/kits/js/app/activeServiceAbilityInfo.d.ts delete mode 100755 interfaces/kits/js/app/context.d.ts delete mode 100755 interfaces/kits/js/app/memoryMapInfo.d.ts delete mode 100755 interfaces/kits/js/app/missionSnapshot.d.ts delete mode 100755 interfaces/kits/js/app/processErrorInfo.d.ts delete mode 100755 interfaces/kits/js/app/splitMissionInfo.d.ts delete mode 100755 interfaces/kits/js/app/systemMemoryAttr.d.ts delete mode 100644 interfaces/kits/js/bundle/abilityInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/applicationInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/bundleInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/bundleInstaller.d.ts delete mode 100644 interfaces/kits/js/bundle/customizeData.d.ts delete mode 100644 interfaces/kits/js/bundle/customizedata.ts delete mode 100644 interfaces/kits/js/bundle/elementName.d.ts delete mode 100644 interfaces/kits/js/bundle/hapModuleInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/moduleInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/moduleUsageRecord.d.ts delete mode 100644 interfaces/kits/js/bundle/moduleusagerecord1.d.ts delete mode 100644 interfaces/kits/js/bundle/shortcutInfo.d.ts delete mode 100644 interfaces/kits/js/bundle/shortcutinfo1.d.ts delete mode 100644 interfaces/kits/js/wantAgent/triggerInfo.d.ts delete mode 100644 interfaces/kits/js/wantAgent/wantAgentInfo.d.ts diff --git a/interfaces/kits/js/@ohos.ability.dataUriUtils.d.ts b/interfaces/kits/js/@ohos.ability.dataUriUtils.d.ts deleted file mode 100644 index 912ae82a7cf..00000000000 --- a/interfaces/kits/js/@ohos.ability.dataUriUtils.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -declare namespace dataUriUtils { - /** - * Obtains the ID attached to the end of the path component of the given URI. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param dataUri Indicates the Uri object from which the ID is to be obtained. - * @return Returns the ID attached to the end of the path component; - * returns -1 if the given dataUri does not contain a path component. - */ - function getIdSync(URI: string): number; - - /** - * Attaches the given ID to the end of the path component of the given URI. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param dataUri Indicates the Uri object to which the ID is to be attached. - * @param id Indicates the ID to attach. - * @return Returns the Uri object with the given ID attached. - */ - function attachIdSync(URI: string, id: number): string; - - /** - * Deletes the ID from the end of the path component of the given URI. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param dataUri Indicates the Uri object from which the ID is to be deleted. - * @return Returns the Uri object with the ID deleted. - */ - function deleteIdSync(URI: string): string; - - /** - * Updates the ID in the specified dataUri. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param dataUri Indicates the Uri object to be updated. - * @param id Indicates the new ID. - * @return Returns the updated Uri object. - */ - function updateIdSync(URI: string, id: number): string; -} - -export default dataUriUtils; \ No newline at end of file diff --git a/interfaces/kits/js/@ohos.ability.featureAbility.d.ts b/interfaces/kits/js/@ohos.ability.featureAbility.d.ts deleted file mode 100644 index d92e73b8404..00000000000 --- a/interfaces/kits/js/@ohos.ability.featureAbility.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AsyncCallback } from './basic'; -import { Want } from './ability/want'; -import { StartAbilityParameter } from './ability/startAbilityParameter'; -import { AbilityResult } from './ability/abilityResult'; -import { Context } from './app/context'; -import { DataAbilityHelper } from './ability/dataAbilityHelper'; -import { ConnectOptions } from './ability/connectOptions'; - -/** - * A Feature Ability represents an ability with a UI and is designed to interact with users. - * @name featureAbility - * @since 6 - * @sysCap AAFwk - * @devices phone, tablet - * @permission N/A - */ -declare namespace featureAbility { - /** - * Obtain the want sended from the source ability. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @param parameter Indicates the ability to start. - * @return - - */ - function getWant(callback: AsyncCallback): void; - function getWant(): Promise; - - /** - * Starts a new ability. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @param parameter Indicates the ability to start. - * @return - - */ - function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - function startAbility(parameter: StartAbilityParameter): Promise; - - /** - * Obtains the application context. - * - * @return Returns the application context. - * @since 6 - */ - function getContext(): Context; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param parameter Indicates the ability to start. - * @return - - */ - function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; - function startAbilityForResult(parameter: StartAbilityParameter): Promise; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param parameter Indicates the result to return. - * @return - - */ - function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; - function terminateSelfWithResult(parameter: AbilityResult): Promise; - - /** - * Destroys this Page ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @return - - */ - function terminateSelf(callback: AsyncCallback): void; - - /** - * Obtains the dataAbilityHelper. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param uri Indicates the path of the file to open. - * @return Returns the dataAbilityHelper. - */ - function acquireDataAbilityHelper(uri: string): DataAbilityHelper; - - /** - * Checks whether the main window of this ability has window focus. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - */ - function hasWindowFocus(callback: AsyncCallback): void; - function hasWindowFocus(): Promise; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param request The element name of the service ability - * @param options The remote object instance - * @return Returns the number of the ability connected - */ - function connectAbility(request: Want, options:ConnectOptions ): number; - - /** - * The callback interface was connect successfully. - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param connection The number of the ability connected - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; - - export enum AbilityWindowConfiguration { - WINDOW_MODE_UNDEFINED = 0, - WINDOW_MODE_FULLSCREEN = 1, - WINDOW_MODE_SPLIT_PRIMARY = 100, - WINDOW_MODE_SPLIT_SECONDARY = 101, - WINDOW_MODE_FLOATING = 102 - } - - export enum AbilityStartSetting { - BOUNDS_KEY = "abilityBounds", - WINDOW_MODE_KEY = "windowMode", - DISPLAY_ID_KEY = "displayId" - } -} -export default featureAbility; diff --git a/interfaces/kits/js/@ohos.ability.particleAbility.d.ts b/interfaces/kits/js/@ohos.ability.particleAbility.d.ts deleted file mode 100644 index a6db3d53a1c..00000000000 --- a/interfaces/kits/js/@ohos.ability.particleAbility.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AsyncCallback } from './basic'; -import { StartAbilityParameter } from './ability/startAbilityParameter'; -import { Want } from './ability/want'; -import { ConnectOptions } from './ability/connectOptions'; -import { NotificationRequest } from './notification/notificationRequest'; - -/** - * A Particle Ability represents an ability with service. - * @name particleAbility - * @since 7 - * @sysCap AAFwk - * @devices phone, tablet - * @permission N/A - */ -declare namespace particleAbility { - - /** - * Service ability uses this method to start a specific ability. - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - * @param parameter Indicates the ability to start. - * @return - - */ - function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - function startAbility(parameter: StartAbilityParameter): Promise; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param request The element name of the service ability - * @param options The remote object instance - * @return Returns the number of the ability connected - */ - function connectAbility(request: Want, options:ConnectOptions ): number; - - /** - * The callback interface was connect successfully. - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param connection The number of the ability connected - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; - - /** - * Keep this Service ability in the background and display a notification bar. - * - * @since 7 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask - * @permission ohos.permission.KEEP_BACKGROUND_RUNNING - * @param id Identifies the notification bar information. - * @param request Indicates the notificationRequest instance containing information for displaying a notification bar. - * @FAModelOnly - * @deprecated - */ - function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback): void; - function startBackgroundRunning(id: number, request: NotificationRequest): Promise; - - /** - * Cancel background running of this ability to free up system memory. - * - * @since 7 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask - * @FAModelOnly - * @deprecated - */ - function cancelBackgroundRunning(callback: AsyncCallback): void; - function cancelBackgroundRunning(): Promise; -} -export default particleAbility; \ No newline at end of file diff --git a/interfaces/kits/js/@ohos.ability.wantConstant.d.ts b/interfaces/kits/js/@ohos.ability.wantConstant.d.ts deleted file mode 100644 index edae0e993c1..00000000000 --- a/interfaces/kits/js/@ohos.ability.wantConstant.d.ts +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"), - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * the constant for action and entity in the want - * @name wantConstant - * @since 6 - * @sysCap aafwk - * @devices phone, tablet - * @permission N/A - */ -declare namespace wantConstant { - /** - * the constant for action of the want - * @name Action - * @since 6 - * @sysCap aafwk - * @devices phone, tablet - * @permission N/A - */ - export enum Action { - /** - * Indicates the action of backing home. - * - * @since 1 - */ - ACTION_HOME = "ohos.want.action.home", - - /** - * Indicates the action of starting a Page ability that displays a keypad. - * - * @since 6 - */ - ACTION_DIAL = "ohos.want.action.dial", - - /** - * Indicates the action of starting a Page ability for search. - * - * @since 6 - */ - ACTION_SEARCH = "ohos.want.action.search", - - /** - * Indicates the action of starting a Page ability that provides wireless network settings, for example, - * Wi-Fi options. - * - * @since 6 - */ - ACTION_WIRELESS_SETTINGS = "ohos.settings.wireless", - - /** - * Indicates the action of starting a Page ability that manages installed applications. - * - * @since 6 - */ - ACTION_MANAGE_APPLICATIONS_SETTINGS = "ohos.settings.manage.applications", - - /** - * Indicates the action of starting a Page ability that displays details of a specified application. - * - *

You must specify the application bundle name in the {@code package} attribute of the {@code Intent} - * containing this action. - * - * @since 6 - */ - ACTION_APPLICATION_DETAILS_SETTINGS = "ohos.settings.application.details", - - /** - * Indicates the action of starting a Page ability for setting an alarm clock. - * - * @since 6 - */ - ACTION_SET_ALARM = "ohos.want.action.setAlarm", - - /** - * Indicates the action of starting a Page ability that displays all alarm - * clocks. - * - * @since 6 - */ - ACTION_SHOW_ALARMS = "ohos.want.action.showAlarms", - - /** - * Indicates the action of starting a Page ability for snoozing an alarm clock. - * - * @since 6 - */ - ACTION_SNOOZE_ALARM = "ohos.want.action.snoozeAlarm", - - /** - * Indicates the action of starting a Page ability for deleting an alarm clock. - * - * @since 6 - */ - ACTION_DISMISS_ALARM = "ohos.want.action.dismissAlarm", - - /** - * Indicates the action of starting a Page ability for dismissing a timer. - * - * @since 6 - */ - ACTION_DISMISS_TIMER = "ohos.want.action.dismissTimer", - - /** - * Indicates the action of starting a Page ability for sending a sms. - * - * @since 6 - */ - ACTION_SEND_SMS = "ohos.want.action.sendSms", - - /** - * Indicates the action of starting a Page ability for opening contacts or pictures. - * - * @since 6 - */ - ACTION_CHOOSE = "ohos.want.action.choose", - - /** - * Indicates the action of showing the application selection dialog box. - * - * @since 6 - */ - ACTION_SELECT = "ohos.want.action.select", - - /** - * Indicates the action of sending a single data record. - * - * @since 6 - */ - ACTION_SEND_DATA = "ohos.want.action.sendData", - - /** - * Indicates the action of sending multiple data records. - * - * @since 6 - */ - ACTION_SEND_MULTIPLE_DATA = "ohos.want.action.sendMultipleData", - - /** - * Indicates the action of requesting the media scanner to scan files and adding the files to the media library. - * - * @since 6 - */ - ACTION_SCAN_MEDIA_FILE = "ohos.want.action.scanMediaFile", - - /** - * Indicates the action of viewing data. - * - * @since 6 - */ - ACTION_VIEW_DATA = "ohos.want.action.viewData", - - /** - * Indicates the action of editing data. - * - * @since 6 - */ - ACTION_EDIT_DATA = "ohos.want.action.editData", - - /** - * Indicates the choices you will show with {@link #ACTION_PICKER}. - * - * @since 6 - */ - INTENT_PARAMS_INTENT = "ability.want.params.INTENT", - - /** - * Indicates the CharSequence dialog title when used with a {@link #ACTION_PICKER}. - * - * @since 6 - */ - INTENT_PARAMS_TITLE = "ability.want.params.TITLE", - - /** - * Indicates the action of select file. - * - * @since 7 - */ - ACTION_FILE_SELECT = "ohos.action.fileSelect", - - /** - * Indicates the URI holding a stream of data associated with the Intent when used with a {@link #ACTION_SEND_DATA}. - * - * @since 7 - */ - PARAMS_STREAM = "ability.params.stream", - } - - /** - * the constant for Entity of the want - * @name Action - * @since 6 - * @sysCap aafwk - * @devices phone, tablet - * @permission N/A - */ - export enum Entity { - /** - * Indicates the default entity, which is used if the entity is not specified. - * - * @since 6 - */ - ENTITY_DEFAULT = "entity.system.default", - - /** - * Indicates the home screen entity. - * - * @since 6 - */ - ENTITY_HOME = "entity.system.home", - - /** - * Indicates the voice interaction entity. - * - * @since 6 - */ - ENTITY_VOICE = "entity.system.voice", - - /** - * Indicates the browser category. - * - * @since 6 - */ - ENTITY_BROWSABLE = "entity.system.browsable", - - /** - * Indicates the video category. - */ - ENTITY_VIDEO = "entity.system.video" - } - - export enum Flags { - /** - * Indicates the grant to perform read operations on the URI. - * - * @hide - */ - FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, - - /** - * Indicates the grant to perform write operations on the URI. - * - * @hide - */ - FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, - - /** - * Returns the result to the source ability. - */ - FLAG_ABILITY_FORWARD_RESULT = 0x00000004, - - /** - * Determines whether an ability on the local device can be migrated to a remote device. - */ - FLAG_ABILITY_CONTINUATION = 0x00000008, - - /** - * Specifies whether a component does not belong to OHOS. - */ - FLAG_NOT_OHOS_COMPONENT = 0x00000010, - - /** - * Specifies whether an ability is started. - */ - FLAG_ABILITY_FORM_ENABLED = 0x00000020, - - /** - * Indicates the grant for possible persisting on the URI. - * - * @hide - */ - FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040, - - /** - * Returns the result to the source ability slice. - * - * @hide - */ - FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080, - - /** - * Supports multi-device startup in the distributed scheduling system. - */ - FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100, - - /** - * Indicates that an ability using the Service template is started regardless of whether the host application has - * been started. - */ - FLAG_START_FOREGROUND_ABILITY = 0x00000200, - - /** - * Indicates the continuation is reversible. - * - * @hide - */ - FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400, - - /** - * Install the specified ability if it's not installed. - */ - FLAG_INSTALL_ON_DEMAND = 0x00000800, - - /** - * Install the specifiedi ability with background mode if it's not installed. - */ - FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000, - - /** - * Indicates the operation of clearing other missions. This flag can be set for the {@code Intent} passed to - * {@link ohos.app.Context#startAbility} and must be used together with {@link FLAG_ABILITY_NEW_MISSION}. - */ - FLAG_ABILITY_CLEAR_MISSION = 0x00008000, - - /** - * Indicates the operation of creating a task on the historical mission stack. - */ - FLAG_ABILITY_NEW_MISSION = 0x10000000, - - /** - * Indicates that the existing instance of the ability to start will be reused if it is already at the top of - * the mission stack. Otherwise, a new ability instance will be created. - * - */ - FLAG_ABILITY_MISSION_TOP = 0x20000000 - } -} - -export default wantConstant; \ No newline at end of file diff --git a/interfaces/kits/js/@ohos.app.abilityManager.d.ts b/interfaces/kits/js/@ohos.app.abilityManager.d.ts deleted file mode 100644 index 8bec57baa5f..00000000000 --- a/interfaces/kits/js/@ohos.app.abilityManager.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from './basic'; -import { AbilityMissionInfo } from './app/abilityMissionInfo'; -import { ActiveProcessInfo } from './app/activeProcessInfo'; - -/** - * This module provides the capability to manage abilities and obtaining system task information. - * - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @import import abilityManager from '@ohos.app.abilityManager' - * @permission N/A - */ -declare namespace abilityManager { - - /** - * Get information about running processes - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @return a list of ActiveProcessInfo records describing each process. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION - * @systemapi hide this for inner system use - */ - function getActiveProcessInfos(): Promise>; - function getActiveProcessInfos(callback: AsyncCallback>): void; - - /** - * Get information about the running ability missions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @param upperLimit The maximum number of mission infos to return in the array. - * @return an array of AbilityMissionInfo records describing each active mission. - * @permission ohos.permission.ACCESS_MISSIONS - * @systemapi hide this for inner system use - */ - function getActiveAbilityMissionInfos(upperLimit: number): Promise>; - function getActiveAbilityMissionInfos(upperLimit: number, callback: AsyncCallback>): void; - - /** - * Get information about recently run missions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @param upperLimit The maximum number of previous mission infos to return in the array. - * @return an array of AbilityMissionInfo records describing each of the previous mission. - * @permission ohos.permission.ACCESS_MISSIONS_EXTRA - * @systemapi hide this for inner system use - */ - function getPreviousAbilityMissionInfos(upperLimit: number): Promise>; - function getPreviousAbilityMissionInfos(upperLimit: number, callback: AsyncCallback>): void; - - /** - * Delete the specified missions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @param missionIds An array of missions, representing the missions that need to be deleted. - * @permission ohos.permission.DELETE_MISSIONS - * @systemapi hide this for inner system use - */ - function deleteMissions(missionIds: Array): Promise; - function deleteMissions(missionIds: Array, callback: AsyncCallback): void; - -} - -export default abilityManager; diff --git a/interfaces/kits/js/@ohos.application.DataShareExtAbility.d.ts b/interfaces/kits/js/@ohos.application.DataShareExtAbility.d.ts deleted file mode 100644 index 47018ace74d..00000000000 --- a/interfaces/kits/js/@ohos.application.DataShareExtAbility.d.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"), - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from "./basic"; -import { ResultSet } from './data/rdb/resultSet'; -import ExtensionContext from "./application/ExtensionContext"; -import Want from './@ohos.application.Want'; -import dataAbility from './@ohos.data.dataAbility'; -import rdb from './@ohos.data.rdb'; -/** - * class of datashare extension ability. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @systemapi hide for inner use. - */ -export default class DataShareExtAbility { - /** - * Indicates datashare extension ability context. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @systemapi hide for inner use. - */ - context?: ExtensionContext; - - /** - * Called back when a datashare extension ability is started for initialization. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param want Indicates connection information about the datashare extension ability. - * @systemapi hide for inner use. - * @return - - */ - onCreate?(want: Want): void; - - /** - * Obtains the MIME type of files. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME type of the files to obtain. This parameter cannot be set to {@code - * null}. - *

1. "*/*": Obtains all types supported by a data share. - *

2. "image/*": Obtains files whose main type is image of any subtype. - *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data - */ - getFileTypes?(uri: string, mimeTypeFilter: string): Array; - - /** - * Opens a file. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the path of the file to open. - * @param mode Indicates the open mode, which can be "r" for read-only access, "w" for write-only access (erasing - * whatever data is currently in the file), "wt" for write access that truncates any existing file, - * "wa" for write-only access to append to any existing data, "rw" for read and write access on any - * existing data, or "rwt" for read and write access that truncates any existing file. - * @return Returns the file descriptor. - */ - openFile?(uri: string, mode: string): number; - - /** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBucket Indicates the data to insert. - * @return Returns the index of the newly inserted data record. - */ - insert?(uri: string, valueBucket: rdb.ValuesBucket): number; - - /** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the database table storing the data to update. - * @param valueBucket Indicates the data to update. This parameter can be null. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by - * default. - * @return Returns the number of data records updated. - * @return - - */ - update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): number; - - /** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the database table storing the data to delete. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by - * default. - * @return Returns the number of data records deleted. - */ - delete?(uri: string, predicates: dataAbility.DataAbilityPredicates): number; - - /** - * Queries one or more data records in the database. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the database table storing the data to query. - * @param columns Indicates the columns to be queried, in array, for example, {"name","age"}. You should define - * the processing logic when this parameter is null. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be queried by - * default. - * @return Returns the queried data. - */ - query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): ResultSet; - - /** - * Obtains the MIME type matching the data specified by the URI of the data share. This method should be - * implemented by a data share. - * - *

Data abilities supports general data types, including text, HTML, and JPEG.

- * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the uri of the data. - * @return Returns the MIME type that matches the data specified by {@code uri}. - */ - getType?(uri: string): string; - - /** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBuckets Indicates the data to insert. - * @return Returns the number of data records inserted. - */ - batchInsert?(uri: string, valueBuckets: Array): number; - - /** - * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be - * used across devices, persisted, backed up, and restored. It can refer to the same item in the data share - * even if the context has changed. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the uri to normalize. - * @return Returns the normalized uri if the data share supports URI normalization; - */ - normalizeUri?(uri: string): string; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. - * The default implementation of this method returns the original uri passed to it. - * - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Provider - * @param uri Indicates the uri to denormalize. - * @return Returns the denormalized {@code uri} object if the denormalization is successful; returns the original - * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by - * the original {@code uri} cannot be found in the current environment. - */ - denormalizeUri?(uri: string): string; -} \ No newline at end of file diff --git a/interfaces/kits/js/@ohos.bundle.d.ts b/interfaces/kits/js/@ohos.bundle.d.ts deleted file mode 100644 index 6e9ff46b8dd..00000000000 --- a/interfaces/kits/js/@ohos.bundle.d.ts +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback, Callback } from './basic'; -import { ApplicationInfo } from './bundle/applicationInfo'; -import { BundleInfo } from './bundle/bundleInfo'; -import { AbilityInfo } from './bundle/abilityInfo'; -import { Want } from './ability/want'; -import { BundleInstaller } from './bundle/bundleInstaller'; -import { ElementName } from './bundle/elementName'; -import { ShortcutInfo } from './bundle/shortcutInfo'; -import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; - -/** - * bundle. - * @name bundle - * @since 7 - * @sysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable - * @permission NA - */ -declare namespace bundle { - -/** - * @name BundleFlag - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - enum BundleFlag { - GET_BUNDLE_DEFAULT = 0x00000000, - GET_BUNDLE_WITH_ABILITIES = 0x00000001, - GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, - } - -/** - * @name GrantStatus - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum GrantStatus { - PERMISSION_DENIED = -1, - PERMISSION_GRANTED = 0, - } - - /** - * @name AbilityType - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum AbilityType { - /** - * @default Indicates an unknown ability type - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - UNKNOWN, - - /** - * @default Indicates that the ability has a UI - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - PAGE, - - /** - * @default Indicates that the ability does not have a UI - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - SERVICE, - - /** - * @default Indicates that the ability is used to provide data access services - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - DATA, - } - - /** - * @name AbilitySubType - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum AbilitySubType { - UNSPECIFIED = 0, - CA = 1, - } - - /** - * @name DisplayOrientation - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum DisplayOrientation { - /** - * @default Indicates that the system automatically determines the display orientation - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - UNSPECIFIED, - - /** - * @default Indicates the landscape orientation - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - LANDSCAPE, - - /** - * @default Indicates the portrait orientation - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - PORTRAIT, - - /** - * @default Indicates the page ability orientation is the same as that of the nearest ability in the stack - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - FOLLOW_RECENT, - } - - /** - * @name LaunchMode - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum LaunchMode { - /** - * @default Indicates that the ability has only one instance - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - SINGLETON = 0, - - /** - * @default Indicates that the ability can have multiple instances - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - STANDARD = 1, - } - - /** - * @name InstallErrorCode - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import NA - * @permission NA - * @devices phone, tablet, tv, wearable - */ - export enum InstallErrorCode{ - SUCCESS = 0, - STATUS_INSTALL_FAILURE = 1, - STATUS_INSTALL_FAILURE_ABORTED = 2, - STATUS_INSTALL_FAILURE_INVALID = 3, - STATUS_INSTALL_FAILURE_CONFLICT = 4, - STATUS_INSTALL_FAILURE_STORAGE = 5, - STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, - STATUS_UNINSTALL_FAILURE = 7, - STATUS_UNINSTALL_FAILURE_BLOCKED = 8, - STATUS_UNINSTALL_FAILURE_ABORTED = 9, - STATUS_UNINSTALL_FAILURE_CONFLICT = 10, - STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, - STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, - STATUS_ABILITY_NOT_FOUND = 0x40, - STATUS_BMS_SERVICE_ERROR = 0x41 - } - - /** - * Obtains based on a given networkId and bundle name. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param networkId Indicates the device networkId in area network. - * @param bundleName Indicates the application bundle name to be queried. - * @param flags Indicates the flag used to specify information contained in that will be - * returned. - * @return Returns the BundleInfo object. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO - */ - function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; - function getBundleInfo(bundleName: string, bundleFlags: number): Promise; - - /** - * Obtains the interface used to install bundles. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @return Returns the IBundleInstaller interface. - * @permission ohos.permission.INSTALL_BUNDLE - */ - function getBundleInstaller(callback: AsyncCallback): void; - function getBundleInstaller(): Promise; - - /** - * Obtains based on a given bundle name. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param bundleName Indicates the application bundle name to be queried. - * @param flags Indicates the flag used to specify information contained in the ApplicationInfo object - * that will be returned. - * @param userId Indicates the user ID. - * @return Returns the ApplicationInfo object. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO - */ - function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; - function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number) : Promise; - - /** - * Checks whether a specified bundle has been granted a specific permission. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param bundleName Indicates the name of the bundle to check. - * @param permission Indicates the permission to check. - * @return Returns 0 if the bundle has the permission; returns -1 otherwise. - */ - function checkPermission(bundleName: string, permission: string, callback: AsyncCallback): void; - function checkPermission(bundleName: string, permission: string): Promise; - - /** - * Query the AbilityInfo by the given Want. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param intent Indicates the Intent containing the application bundle name to - * be queried. - * @param flags Indicates the flag used to specify information contained in the AbilityInfo objects that - * will be returned. - * @param userId Indicates the user ID. - * @return Returns a list of AbilityInfo objects. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO - */ - function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void; - function queryAbilityByWant(want: Want, bundleFlags: number, userId:number): Promise>; - - /** - * Obtains BundleInfo of all bundles available in the system. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be - * returned. - * @return Returns a list of BundleInfo objects. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - */ - function getAllBundleInfo(bundlelFlag: BundleFlag, callback: AsyncCallback>) : void; - function getAllBundleInfo(bundlelFlag: BundleFlag) : Promise>; - - /** - * Obtains information about all installed applications of a specified user. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param flags Indicates the flag used to specify information contained in the ApplicationInfo objects - * that will be returned. - * @param userId Indicates the user ID. - * @return Returns a list of ApplicationInfo objects. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - */ - function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; - function getAllApplicationInfo(bundleFlags: number, userId: number) : Promise>; - - /** - * Obtains information about an application bundle contained in an ohos Ability Package (HAP). - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param hapFilePath Indicates the path storing the HAP. The path should be the relative path to the data - * directory of the current application. - * @param flags Indicates the flag used to specify information contained in the BundleInfo object to be - * returned. - * @return Returns the BundleInfo object. - */ - function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void - function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise; - - /** - * Obtains information about the shortcuts of the application. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param bundleName Indicates the bundle name of the application. - * @return Returns a list of ShortcutInfo objects containing shortcut information about the application. - * @permission ohos.permission.MANAGE_SHORTCUTS - */ - function getAllShortcutInfo(bundleName: string, callback: AsyncCallback>): void; - function getAllShortcutInfo(bundleName: string): Promise>; - - /** - * get module usage record list in descending order of lastLaunchTime. - * - * @devices phone, tablet, tv, wearable - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @param maxNum the return size of the records, must be in range of 1 to 1000. - * @return Returns ability usage record list. - * @systemapi hide this for inner system use - */ - function getModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; - function getModuleUsageRecords(maxNum: number): Promise>; -} - -export default bundle; diff --git a/interfaces/kits/js/@ohos.data.dataShare.d.ts b/interfaces/kits/js/@ohos.data.dataShare.d.ts deleted file mode 100644 index 20cf3eb02d7..00000000000 --- a/interfaces/kits/js/@ohos.data.dataShare.d.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import { AsyncCallback, Callback } from './basic'; -import { Want } from './ability/want'; -import Context from './application/Context'; -import { ValuesBucket, ResultSet, DataSharePredicates } from './@ohos.data.rdb'; - -declare namespace dataShare { - /** - * Obtains the dataShareHelper. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param context Indicates the application context. - * @param want Indicates The element parameter of the service ability. - * @param uri Indicates the path of the file to open. - * @return Returns the dataShareHelper. - * @systemapi Hide this for inner system use - */ - function createDataShareHelper(context: Context, want: Want, uri: string): DataShareHelper; - - /** - * DataShareHelper - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @systemapi Hide this for inner system use - */ - interface DataShareHelper { - /** - * Opens a file in a specified remote path. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the file to open. - * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access - * (erasing whatever data is currently in the file), "wt" for write access that truncates any existing - * file, "wa" for write-only access to append to any existing data, "rw" for read and write access on - * any existing data, or "rwt" for read and write access that truncates any existing file. - * @param callback Indicates the callback when openfile success - * @systemapi Hide this for inner system use - */ - openFile(uri: string, mode: string, callback: AsyncCallback): void; - openFile(uri: string, mode: string): Promise; - - /** - * Registers an observer to observe data specified by the given uri. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - * @systemapi Hide this for inner system use - */ - on(type: 'dataChange', uri: string, callback: AsyncCallback): void; - - /** - * Deregisters an observer used for monitoring data specified by the given uri. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - * @systemapi Hide this for inner system use - */ - off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; - - /** - * Inserts a single data record into the database. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted. - * @return Returns the index of the inserted data record. - * @systemapi Hide this for inner system use - */ - insert(URI: string, values: ValuesBucket, callback: AsyncCallback): void; - insert(URI: string, values: ValuesBucket): Promise; - - /** - * Deletes one or more data records from the database. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. - * @systemapi Hide this for inner system use - */ - delete(URI: string, predicates: DataSharePredicates, callback: AsyncCallback): void; - delete(URI: string, predicates: DataSharePredicates): Promise; - - /** - * Queries data in the database. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of data to query. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the query result. - * @systemapi Hide this for inner system use - */ - query(URI: string, columns: Array, predicates: DataSharePredicates, callback: AsyncCallback): void; - query(URI: string, columns: Array, predicates: DataSharePredicates): Promise; - - /** - * Updates data records in the database. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of data to update. - * @param value Indicates the data to update. This parameter can be null. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records updated. - * @systemapi Hide this for inner system use - */ - update(URI: string, values: ValuesBucket, predicates: DataSharePredicates, callback: AsyncCallback): void; - update(URI: string, values: ValuesBucket, predicates: DataSharePredicates): Promise; - - /** - * Inserts multiple data records into the database. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param values Indicates the data records to insert. - * @return Returns the number of data records inserted. - * @systemapi Hide this for inner system use - */ - batchInsert(URI: string, values: Array, callback: AsyncCallback): void; - batchInsert(URI: string, values: Array): Promise; - - /** - * Obtains the MIME type of the date specified by the given URI. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @return Returns the MIME type that matches the data specified by uri. - * @systemapi Hide this for inner system use - */ - getType(URI: string, callback: AsyncCallback): void; - getType(URI: string): Promise; - - /** - * Obtains the MIME types of files supported. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME types of the files to obtain. This parameter cannot be null. - *

1. "*/*": Obtains all types supported by Data abilities. - *

2. "image/*": Obtains files whose main type is image of any subtype. - *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the matched MIME types. If there is no match, {@code null} is returned. - * @systemapi Hide this for inner system use - */ - getFileTypes(uri: string, mimeTypeFilter:string, callback: AsyncCallback>): void; - getFileTypes(uri: string, mimeTypeFilter): Promise>; - - /** - * Converts the given {@code uri} that refers to the Data ability into a normalized {@link ohos.utils.net.Uri}. - * A normalized URI can be used across devices, persisted, backed up, and restored. - *

To transfer a normalized URI from another environment to the current environment, you should call this - * method again to re-normalize the URI for the current environment or call {@link #denormalizeUri(Uri)} - * to convert it to a denormalized URI that can be used only in the current environment. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to normalize. - * @return Returns the normalized {@code Uri} object if the Data ability supports URI normalization; - * returns {@code null} otherwise. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #denormalizeUri - * @systemapi Hide this for inner system use - */ - normalizeUri(uri: string, callback: AsyncCallback): void; - normalizeUri(uri: string): Promise; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to denormalize. - * @return Returns the denormalized {@code Uri} object if the denormalization is successful; returns the - * original {@code Uri} passed to this method if there is nothing to do; returns {@code null} if the data - * identified by the normalized {@code Uri} cannot be found in the current environment. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #normalizeUri - * @systemapi Hide this for inner system use - */ - denormalizeUri(uri: string, callback: AsyncCallback): void; - denormalizeUri(uri: string): Promise; - - /** - * Notifies the registered observers of a change to the data resource specified by Uri. - * @since 9 - * @sysCap SystemCapability.DistributedDataMgr.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to notifyChange. - * @systemapi Hide this for inner system use - */ - notifyChange(URI: string, callback: AsyncCallback): void; - notifyChange(URI: string): Promise; - } -} - -export default dataShare; diff --git a/interfaces/kits/js/@ohos.wantAgent.d.ts b/interfaces/kits/js/@ohos.wantAgent.d.ts deleted file mode 100644 index fb40f104721..00000000000 --- a/interfaces/kits/js/@ohos.wantAgent.d.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback , Callback} from './basic'; -import { Want } from './ability/want'; -import { WantAgentInfo } from './wantAgent/wantAgentInfo'; -import { TriggerInfo } from './wantAgent/triggerInfo'; - -/** - * Provide the method obtain trigger, cancel, and compare and to obtain - * the bundle name, UID of an {@link WantAgent} object. - * - * @name wantAgent - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import wantAgent from '@ohos.wantAgent'; - * @permission N/A - */ -declare namespace wantAgent { - /** - * Obtains the bundle name of a WantAgent. - * - * @param WantAgent whose bundle name to obtain. - * @return Returns the bundle name of the {@link WantAgent} if any. - */ - function getBundleName(agent: WantAgent, callback: AsyncCallback): void; - function getBundleName(agent: WantAgent): Promise; - - /** - * Obtains the UID of a WantAgent. - * - * @param WantAgent whose UID to obtain. - * @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise. - */ - function getUid(agent: WantAgent, callback: AsyncCallback): void; - function getUid(agent: WantAgent): Promise; - - /** - * Obtains the {@link Want} of an {@link WantAgent}. - * - * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. - * @return Returns the {@link Want} of the {@link WantAgent}. - * @systemapi Hide this for inner system use. - */ - function getWant(agent: WantAgent, callback: AsyncCallback): void; - - /** - * Obtains the {@link Want} of an {@link WantAgent}. - * - * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. - * @return Returns the {@link Want} of the {@link WantAgent}. - * @systemapi Hide this for inner system use. - */ - function getWant(agent: WantAgent): Promise; - - /** - * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. - * - * @param WantAgent to cancel. - */ - function cancel(agent: WantAgent, callback: AsyncCallback): void; - function cancel(agent: WantAgent): Promise; - - /** - * Triggers a WantAgent. - * - * @param WantAgent to trigger. - * @param Trigger parameters. - * @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered. - */ - function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; - - /** - * Checks whether two WantAgent objects are equal. - * - * @param WantAgent to compare. - * @param WantAgent to compare. - * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. - */ - function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; - function equal(agent: WantAgent, otherAgent: WantAgent): Promise; - - /** - * Obtains a WantAgent object. - * - * @param Information about the WantAgent object to obtain. - * @return Returns the created {@link WantAgent} object. - */ - function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; - function getWantAgent(info: WantAgentInfo): Promise; - - /** - * Enumerates flags for using a WantAgent. - */ - export enum WantAgentFlags { - /** - * Indicates that the WantAgent can be used only once. - * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. - */ - ONE_TIME_FLAG = 0, - - /** - * Indicates that null is returned if the WantAgent does not exist. - * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. - */ - NO_BUILD_FLAG, - - /** - * Indicates that the existing WantAgent should be canceled before a new object is generated. - * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. - */ - CANCEL_PRESENT_FLAG, - - /** - * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object. - * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. - */ - UPDATE_PRESENT_FLAG, - - /** - * Indicates that the created WantAgent should be immutable. - */ - CONSTANT_FLAG - } - - /** - * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. - */ - export enum OperationType { - /** - * Unknown operation. - */ - UNKNOWN_TYPE = 0, - - /** - * Starts an ability with a UI. - */ - START_ABILITY, - - /** - * Starts multiple abilities with a UI. - */ - START_ABILITIES, - - /** - * Starts an ability without a UI. - */ - START_SERVICE, - - /** - * Sends a common event. - */ - SEND_COMMON_EVENT - } - - /** - * Describes the data returned by after wantAgent.trigger is called. - */ - export interface CompleteData { - /** - * Triggered WantAgent. - */ - info: WantAgent; - - /** - * Existing Want that is triggered. - */ - want: Want; - - /** - * Request code used to trigger the WantAgent. - */ - finalCode: number; - - /** - * Final data collected by the common event. - */ - finalData: string; - - /** - * Extra data collected by the common event. - */ - extraInfo?: {[key: string]: any}; - } -} - -/** - * WantAgent object. - */ -export type WantAgent = object; - -export default wantAgent; \ No newline at end of file diff --git a/interfaces/kits/js/ability/abilityResult.d.ts b/interfaces/kits/js/ability/abilityResult.d.ts deleted file mode 100644 index 834f9b505de..00000000000 --- a/interfaces/kits/js/ability/abilityResult.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Want } from './want'; - -export interface AbilityResult { - /** - * Indicates the result code returned after the ability is destroyed. You can define the result - * code to identify an error. - * @default - - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - */ - resultCode: number; - - /** - * Indicates the data returned after the ability is destroyed. You can define the data returned. - * This parameter can be null. - * @default - - * @devices phone, tablet - * @since 7 - * @sysCap AAFwk - */ - want?: Want; -} \ No newline at end of file diff --git a/interfaces/kits/js/ability/connectOptions.d.ts b/interfaces/kits/js/ability/connectOptions.d.ts deleted file mode 100644 index c718f678c3b..00000000000 --- a/interfaces/kits/js/ability/connectOptions.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ElementName } from '../bundle/elementName'; -import rpc from './../@ohos.rpc'; - -export interface ConnectOptions { - /** - * The callback interface was connect successfully. - * - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param elementName The element name of the service ability - * @param remoteObject The remote object instance - */ - onConnect: (elementName: ElementName, remoteObject: RemoteObject) => void; - - /** - * The callback interface was disconnect successfully. - * - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param elementName The element name of the service ability - */ - onDisconnect: (elementName: ElementName) => void; - - /** - * The callback interface was connect failed. - * - * @default - - * @devices phone, tablet - * @since 7 - * @SysCap aafwk - * @param code The error code of the failed. - */ - onFailed: (code: number) => void; -} diff --git a/interfaces/kits/js/ability/dataAbilityHelper.d.ts b/interfaces/kits/js/ability/dataAbilityHelper.d.ts deleted file mode 100644 index 71dd47e5b0f..00000000000 --- a/interfaces/kits/js/ability/dataAbilityHelper.d.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import { AsyncCallback } from './../basic'; -import { DataAbilityOperation } from './dataAbilityOperation'; -import { ValuesBucket, ResultSet, DataAbilityPredicates } from './../@ohos.data.rdb'; - -/** - * DataAbilityHelper - * @devices phone, tablet - * - * @since 7 - */ -export interface DataAbilityHelper { - /** - * Opens a file in a specified remote path. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the file to open. - * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access - * (erasing whatever data is currently in the file), "wt" for write access that truncates any existing - * file, "wa" for write-only access to append to any existing data, "rw" for read and write access on - * any existing data, or "rwt" for read and write access that truncates any existing file. - * @param callback Indicates the callback when openfile success - */ - openFile(uri: string, mode: string, callback: AsyncCallback): void; - openFile(uri: string, mode: string): Promise; - - /** - * Registers an observer to observe data specified by the given uri. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - */ - on(type: 'dataChange', uri: string, callback: AsyncCallback): void; - - /** - * Deregisters an observer used for monitoring data specified by the given uri. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - */ - off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; - - /** - * Inserts a single data record into the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the data to operate. - * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted. - * @return Returns the index of the inserted data record. - */ - insert(URI: string, values: ValuesBucket, callback: AsyncCallback): void; - insert(URI: string, values: ValuesBucket): Promise; - - /** - * Deletes one or more data records from the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the data to operate. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. - */ - delete(URI: string, predicates: DataAbilityPredicates, callback: AsyncCallback): void; - delete(URI: string, predicates: DataAbilityPredicates): Promise; - - /** - * Queries data in the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of data to query. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the query result. - */ - query(URI: string, columns: Array, predicates: DataAbilityPredicates, callback: AsyncCallback): void; - query(URI: string, columns: Array, predicates: DataAbilityPredicates): Promise; - - /** - * Updates data records in the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of data to update. - * @param value Indicates the data to update. This parameter can be null. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records updated. - */ - update(URI: string, values: ValuesBucket, predicates: DataAbilityPredicates, callback: AsyncCallback): void; - update(URI: string, values: ValuesBucket, predicates: DataAbilityPredicates): Promise; - - /** - * Inserts multiple data records into the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the data to operate. - * @param values Indicates the data records to insert. - * @return Returns the number of data records inserted. - */ - batchInsert(URI: string, values: Array, callback: AsyncCallback): void; - batchInsert(URI: string, values: Array): Promise; - - /** - * Performs batch operations on the database. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of data to operate. - * @param operations Indicates a list of database operations on the database. - * @return Returns the result of each operation, in array. - */ - executeBatch(URI: string, operations: Array, callback: AsyncCallback>): void; - executeBatch(URI: string, operations: Array): Promise>; - - /** - * Obtains the MIME type of the date specified by the given URI. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the data to operate. - * @return Returns the MIME type that matches the data specified by uri. - */ - getType(URI: string, callback: AsyncCallback): void; - getType(URI: string): Promise; - - /** - * Obtains the MIME types of files supported. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME types of the files to obtain. This parameter cannot be null. - *

1. "*/*": Obtains all types supported by Data abilities. - *

2. "image/*": Obtains files whose main type is image of any subtype. - *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the matched MIME types. If there is no match, {@code null} is returned. - */ - getFileTypes(uri: string, mimeTypeFilter:string, callback: AsyncCallback>): void; - getFileTypes(uri: string, mimeTypeFilter): Promise>; - - /** - * Converts the given {@code uri} that refers to the Data ability into a normalized {@link ohos.utils.net.Uri}. - * A normalized URI can be used across devices, persisted, backed up, and restored. - *

To transfer a normalized URI from another environment to the current environment, you should call this - * method again to re-normalize the URI for the current environment or call {@link #denormalizeUri(Uri)} - * to convert it to a denormalized URI that can be used only in the current environment. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the {@link ohos.utils.net.Uri} object to normalize. - * @return Returns the normalized {@code Uri} object if the Data ability supports URI normalization; - * returns {@code null} otherwise. - * @throws DataAbilityRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #denormalizeUri - */ - normalizeUri(uri: string, callback: AsyncCallback): void; - normalizeUri(uri: string): Promise; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the {@link ohos.utils.net.Uri} object to denormalize. - * @return Returns the denormalized {@code Uri} object if the denormalization is successful; returns the - * original {@code Uri} passed to this method if there is nothing to do; returns {@code null} if the data - * identified by the normalized {@code Uri} cannot be found in the current environment. - * @throws DataAbilityRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #normalizeUri - */ - denormalizeUri(uri: string, callback: AsyncCallback): void; - denormalizeUri(uri: string): Promise; - - /** - * Releases the client resource of the Data ability. - *

You should call this method to releases client resource after the data operations are complete.

- * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @return Returns {@code true} if the resource is successfully released; returns {@code false} otherwise. - */ - release(callback: AsyncCallback): void; - release(): Promise; - - /** - * Notifies the registered observers of a change to the data resource specified by Uri. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - * @param uri Indicates the {@link ohos.utils.net.Uri} object to notifyChange. - */ - notifyChange(URI: string, callback: AsyncCallback): void; - notifyChange(URI: string): Promise; -} - -export interface DataAbilityResult { - uri?: string; - count?: number; -} \ No newline at end of file diff --git a/interfaces/kits/js/ability/dataAbilityOperation.d.ts b/interfaces/kits/js/ability/dataAbilityOperation.d.ts deleted file mode 100644 index 99074f992c9..00000000000 --- a/interfaces/kits/js/ability/dataAbilityOperation.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ValuesBucket, DataAbilityPredicates } from './../@ohos.data.rdb'; - -/** - * Performs an operation on the database. - * @devices phone, tablet - * - * @since 7 - */ -export interface DataAbilityOperation { - /** - * Obtains the data path of the operation. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - uri: string; - /** - * Creates a DataAbilityOperation instance. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - type: DataAbilityOperationType; - /** - * Sets the data records to be inserted or updated. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - valuesBucket: ValuesBucket; - /** - * Sets filter criteria used for deleting updating or assert query data. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - predicates: DataAbilityPredicates; - /** - * Sets the expected number of rows to update ,delete or assert query. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - expectedCount: number; - /** - * Back reference to be used as a filter criterion in setPredicates(DataAbilityPredicates). - * This method can be used only for update, delete, and assert operations. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - PredicatesBackReferences: {[key: number]: any}; - /** - * Sets an interrupt flag bit for a batch operation, which can be insert, update, delete, or assert. - * - * interrupted Specifies whether a batch operation can be interrupted. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - interrupted: boolean; -} - -export enum DataAbilityOperationType { - /** - * Indicates an insert operation. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - TYPE_INSERT = 1, - /** - * Indicates an update operation. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - TYPE_UPDATE = 2, - /** - * Indicates a delete operation. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - TYPE_DELETE = 3, - /** - * Indicates an assert operation. - * @devices phone, tablet - * @since 7 - * @SysCap AAFwk - */ - TYPE_ASSERT = 4 -} \ No newline at end of file diff --git a/interfaces/kits/js/ability/startAbilityParameter.d.ts b/interfaces/kits/js/ability/startAbilityParameter.d.ts deleted file mode 100644 index a628cffd1d3..00000000000 --- a/interfaces/kits/js/ability/startAbilityParameter.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Want } from './want'; -import { TaskSyncAnimationOptions } from './taskSyncAnimator' - -export interface StartAbilityParameter { - /** - * Indicates the Want containing information about the target ability to start. - * - * @default - - * @devices phone, tablet - * @since 3 - * @SysCap aafwk - */ - want: Want; - - /** - * Indicates the special start setting used in starting ability. - * - * @default - - * @devices phone, tablet - * @since 3 - * @SysCap aafwk - */ - abilityStartSetting?: {[key: string]: any}; - - /** - * Indicates the special start setting used in starting ability with TaskSyncAnimation. - *

Requires Permission: {@code ohos.permission.CONTROL_TASK_SYNC_ANIMATOR} - * - * @default - - * @devices phone, tablet - * @permission ohos.permission.CONTROL_TASK_SYNC_ANIMATOR - * @since 7 - * @SysCap aafwk - */ - taskSyncAnimationOptions?: TaskSyncAnimationOptions; -} diff --git a/interfaces/kits/js/ability/want.d.ts b/interfaces/kits/js/ability/want.d.ts deleted file mode 100644 index af2183ded2e..00000000000 --- a/interfaces/kits/js/ability/want.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Want is the basic communication component of the system. - * @name Want - * @since 6 - * @sysCap AAFwk - * @devices phone, tablet - * @permission N/A - */ -export declare interface Want { - /** - * device id - * @default - - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - */ - deviceId?: string; - - /** - * bundle name - * @default - - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - */ - bundleName?: string; - - /** - * ability name - * @default - - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - */ - abilityName?: string; - - /** - * The description of a URI in a Want. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - uri?: string; - - /** - * The description of the type in this Want. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - type?: string; - - /** - * The options of the flags in this Want. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - flags?: number; - - /** - * The description of an action in an want. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - action?: string; - - /** - * The description of the WantParams object in an Want - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - parameters?: {[key: string]: any}; - - /** - * The description of a entities in a Want. - * @devices phone, tablet - * @since 6 - * @sysCap AAFwk - * @default - - */ - entities?: Array; -} \ No newline at end of file diff --git a/interfaces/kits/js/app/abilityMissionInfo.d.ts b/interfaces/kits/js/app/abilityMissionInfo.d.ts deleted file mode 100755 index bd219349286..00000000000 --- a/interfaces/kits/js/app/abilityMissionInfo.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ElementName } from '../bundle/elementName'; - -/** - * @name Mission information corresponding to ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import import AbilityMissionInfo from 'app/abilityMissionInfo' - * @permission N/A - * @devices phone, tablet, tv, wearable, car - */ -export interface AbilityMissionInfo { - /** - * @default Unique identification of task stack information corresponding to ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - missionId: number; - - /** - * @default The component launched as the first ability in the task stack - * This can be considered the "application" of this task stack - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - bottomAbility: ElementName; - - /** - * @default The ability component at the top of the history stack of the task - * This is what the user is currently doing - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - topAbility: ElementName; - - /** - * @default The corresponding ability description information in the task stack - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - windowMode: number; -} - diff --git a/interfaces/kits/js/app/activeProcessInfo.d.ts b/interfaces/kits/js/app/activeProcessInfo.d.ts deleted file mode 100755 index 4ab5a6aa3d1..00000000000 --- a/interfaces/kits/js/app/activeProcessInfo.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @name This class saves process information about an application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import import app from 'app/activeProcessInfo' - * @permission N/A - * @devices phone, tablet, tv, wearable, car - */ -export interface ActiveProcessInfo { - /** - * @default process id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - pid: number; - - /** - * @default user id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - uid: number; - - /** - * @default the name of the process - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - processName: string; - - /** - * @default an array of the bundleNames running in the process - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - bundleNames: Array; -} diff --git a/interfaces/kits/js/app/activeServiceAbilityInfo.d.ts b/interfaces/kits/js/app/activeServiceAbilityInfo.d.ts deleted file mode 100755 index 8e9c14e1142..00000000000 --- a/interfaces/kits/js/app/activeServiceAbilityInfo.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ElementName } from '../bundle/elementName'; - -/** - * @name information corresponding to active service ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import import AbilityMissionInfo from 'app/activeServiceAbilityInfo' - * @permission N/A - * @devices phone, tablet, tv, wearable, car - */ -export interface ActiveServiceAbilityInfo { - /** - * @default process id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - pid: number; - - /** - * @default user id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - uid: number; - - /** - * @default the name of the process - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - processName: string; - - /** - * @default The element name of the service ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - serviceAbility: ElementName; -} - diff --git a/interfaces/kits/js/app/context.d.ts b/interfaces/kits/js/app/context.d.ts deleted file mode 100755 index 4ccb5f05a9e..00000000000 --- a/interfaces/kits/js/app/context.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import { AsyncCallback } from '../basic'; - -/** - * The context of an ability or an application. It allows access to - * application-specific resources, request and verification permissions. - * Can only be obtained through the ability. - * - * @since 6 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @import import abilityManager from 'app/context' - * @permission N/A - */ -export interface Context { - - /** - * Verify whether the specified permission is allowed for a particular - * pid and uid running in the system. - * @param permission The name of the specified permission - * @param pid process id - * @param uid user id - * @note Pid and uid are optional. If you do not pass in pid and uid, - * it will check your own permission. - * @since 7 - * @sysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @return asynchronous callback with {@code 0} if the PID - * and UID have the permission; callback with {@code -1} otherwise. - */ - verifyPermission(permission: string, options?: PermissionOptions): Promise; - verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback): void; - verifyPermission(permission: string, callback: AsyncCallback): void; - - /** - * Requests certain permissions from the system. - * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null. - * @param requestCode Indicates the request code to be passed to the PermissionRequestResult - * @since 7 - * @sysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - */ - requestPermissionsFromUser(permissions: Array, requestCode: number, resultCallback: AsyncCallback): void; - -} - -/** - * @name the result of requestPermissionsFromUser with asynchronous callback - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission N/A - * @devices phone, tablet, tv, wearable, car - */ -interface PermissionRequestResult { - /** - * @default The request code passed in by the user - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - requestCode: number; - - /** - * @default The permissions passed in by the user - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - permissions: Array; - - /** - * @default The results for the corresponding request permissions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - authResults: Array; -} - -interface PermissionOptions { - /** - * @default The process id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - pid?: number; - - /** - * @default The user id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - uid?: number; -} diff --git a/interfaces/kits/js/app/memoryMapInfo.d.ts b/interfaces/kits/js/app/memoryMapInfo.d.ts deleted file mode 100755 index 4c8ab45c3b1..00000000000 --- a/interfaces/kits/js/app/memoryMapInfo.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @name This class saves memory map information about an application. - * All results are in kB. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import import MemoryMapInfo from 'app/memoryMapInfo' - * @permission N/A - * @devices phone, tablet, tv, wearable, car - * @systemapi hide this for inner system use - */ -export interface MemoryMapInfo { - /** - * @default The pss page size for virtual machine heap - */ - vmPss: number; - /** - * @default The private dirty page size for virtual machine heap - */ - vmPrivateDirty: number; - /** - * @default The shared dirty page size for virtual machine heap - */ - vmSharedDirty: number; - /** - * @default The pss page size for native heap - */ - nativePss: number; - /** - * @default The private dirty page size for native heap - */ - nativePrivateDirty: number; - /** - * @default The shared dirty page size for native heap - */ - nativeSharedDirty: number; - /** - * @default The pss page size for others - */ - otherPss: number; - /** - * @default The private dirty page size for others - */ - otherPrivateDirty: number; - /** - * @default The shared dirty page size for others - */ - otherSharedDirty: number; -} diff --git a/interfaces/kits/js/app/missionSnapshot.d.ts b/interfaces/kits/js/app/missionSnapshot.d.ts deleted file mode 100755 index 01ae787ee8c..00000000000 --- a/interfaces/kits/js/app/missionSnapshot.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ElementName } from '../bundle/elementName'; -import { image } from '../@ohos.multimedia.image'; - -/** - * @name This class represents a mission snapshot. - * @since 7 - * @SysCap appexecfwk - * @import import MissionSnapshot from 'app/missionSnapshot' - * @devices phone, tablet - * @systemapi hide this for inner system use - */ -export interface MissionSnapshot { - /** - * @default The top ability in this mission snapshot - */ - topAbility: ElementName; - - /** - * @default The entity of snapshot - */ - snapshot: image.PixelMap; -} diff --git a/interfaces/kits/js/app/processErrorInfo.d.ts b/interfaces/kits/js/app/processErrorInfo.d.ts deleted file mode 100755 index f08a28f7059..00000000000 --- a/interfaces/kits/js/app/processErrorInfo.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ProcessErrCode } from '../@ohos.app.abilityManager.d.ts'; - -/** - * @name This class saves process error information - * @since 7 - * @SysCap appexecfwk - * @import import app from 'app/processErrorInfo' - * @devices phone, tablet - * @systemapi hide this for inner system use - */ -export interface ProcessErrorInfo { - /** - * @default Error reason, see { ProcessErrCode } in abilityManager - */ - errStatus: ProcessErrCode; - /** - * @default the name of the error process - */ - processName: string; - /** - * @default the process ID - */ - pid: number; - /** - * @default the user ID - */ - uid: number; - /** - * @default the name of the ability corresponding with the error - */ - abilityName: string; - /** - * @default the error message - */ - errMsg: string; - /** - * @default the error trace, for you to find the original error - */ - backTrace: string; -} - diff --git a/interfaces/kits/js/app/splitMissionInfo.d.ts b/interfaces/kits/js/app/splitMissionInfo.d.ts deleted file mode 100755 index 6f911d73360..00000000000 --- a/interfaces/kits/js/app/splitMissionInfo.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { RectBounds } from '../wallpaper'; - -/** - * @name This class is the input param for { moveMissionToFirstSplitScreen }. - * @since 7 - * @SysCap appexecfwk - * @import import app from 'app/splitMissionInfo' - * @devices phone, tablet - * @systemapi hide this for inner system use - */ -export interface SplitMissionInfo { - /** - * @default the mission id that you want to move - */ - missionId: number; - /** - * @default whether the target window is the first one - */ - isFirstWindow: boolean; - /** - * @default whether to move the mission to top - */ - isToTop: boolean; - /** - * @default Whether you want an animation when moving the task - */ - isAnimating: boolean; - /** - * @default The bounds of the split window - */ - initialBounds: RectBounds; -} diff --git a/interfaces/kits/js/app/systemMemoryAttr.d.ts b/interfaces/kits/js/app/systemMemoryAttr.d.ts deleted file mode 100755 index eee6e70681a..00000000000 --- a/interfaces/kits/js/app/systemMemoryAttr.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @name This class saves system memory attributes - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @import import MemoryMapInfo from 'app/systemMemoryAttr' - * @devices phone, tablet, tv, wearable, car - * @systemapi hide this for inner system use - */ - export interface SystemMemoryAttr { - /** - * @default The available memory on the system - */ - availSysMem: number; - /** - * @default The total memory on the system - */ - totalSysMem: number; - /** - * @default The low memory threshold under which the system - * will kill background processes - */ - threshold: number; - /** - * @default Whether the system is in low memory status - */ - isSysInlowMem: boolean; -} - - diff --git a/interfaces/kits/js/bundle/abilityInfo.d.ts b/interfaces/kits/js/bundle/abilityInfo.d.ts deleted file mode 100644 index 7e6904ab2e9..00000000000 --- a/interfaces/kits/js/bundle/abilityInfo.d.ts +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ApplicationInfo } from './applicationInfo'; -import { CustomizeData } from './customizeData' -import bundle from './../@ohos.bundle'; - -/** - * @name Obtains configuration information about an ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface AbilityInfo { - /** - * @default Indicates the name of the bundle containing the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly bundleName: string; - - /** - * @default Ability simplified class name - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly name: string; - - /** - * @default Indicates the label of the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly label: string; - - /** - * @default Describes the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly description: string; - - /** - * @default Indicates the icon of the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly icon: string; - - /** - * @default Indicates the label id of the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly labelId: number; - - /** - * @default Indicates the description id of the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly descriptionId: number; - - /** - * @default Indicates the icon id of the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly iconId: number; - - /** - * @default Indicates the name of the .hap package to which the capability belongs - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleName: string; - - /** - * @default Process of ability, if user do not set it ,the value equal application process - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly process: string; - - /** - * @default Info about which ability is this nick point to - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly targetAbility: string; - - /** - * @default Indicates the background service addressing a specific usage scenario - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly backgroundModes: number; - - /** - * @default Indicates whether an ability can be called by other abilities - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isVisible: boolean; - - /** - * @default Indicates whether the ability provides the embedded card capability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly formEnabled: boolean; - - /** - * @default Enumerates types of templates that can be used by an ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly type: bundle.AbilityType; - - /** - * @default Enumerates the subType of templates used by an ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly subType: bundle.AbilitySubType; - - /** - * @default Enumerates ability display orientations - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly orientation: bundle.DisplayOrientation; - - /** - * @default Enumerates ability launch modes - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly launchMode: bundle.LaunchMode; - - /** - * @default The permissions that others need to launch this ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly permissions: Array; - - /** - * @default The device types that this ability can run on - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly deviceTypes: Array; - - /** - * @default The device capability that this ability needs - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly deviceCapabilities: Array; - - /** - * @default Indicates the permission required for reading ability data - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly readPermission: string; - - /** - * @default Indicates the permission required for writing data to the ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly writePermission: string; - - /** - * @default Obtains configuration information about an application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly applicationInfo: ApplicationInfo; - - /** - * @default Where form can be displayed - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly formEntity: number; - - /** - * @default Minimum height of ability. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly minFormHeight: number; - - /** - * @default Default height of ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly defaultFormHeight: number; - - /** - * @default Minimum width of ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly minFormWidth: number; - - /** - * @default Default width of ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly defaultFormWidth: number; - - /** - * @default Uri of ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly uri: string; - - /** - * @default Indicates the custom metadata of ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - customizeData: Map>; -} diff --git a/interfaces/kits/js/bundle/applicationInfo.d.ts b/interfaces/kits/js/bundle/applicationInfo.d.ts deleted file mode 100644 index 4820474ef88..00000000000 --- a/interfaces/kits/js/bundle/applicationInfo.d.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ModuleInfo } from './moduleInfo'; -import { CustomizeData } from './customizeData' - -/** - * @name Obtains configuration information about an application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface ApplicationInfo { - /** - * @default Indicates the application name, which is the same as {@code bundleName} - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly name: string; - - /** - * @default Description of application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly description: string; - - /** - * @default Indicates the description id of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly descriptionId: number; - - /** - * @default Indicates whether the application is a system application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly systemApp: boolean; - - /** - * @default Indicates whether or not this application may be instantiated - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly enabled: boolean; - - /** - * @default Indicates the label of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly label: string; - - /** - * @default Indicates the label id of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly labelId: string; - - /** - * @default Indicates the icon of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly icon: string; - - /** - * @default Indicates the icon id of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly iconId: string; - - /** - * @default Process of application, if user do not set it ,the value equal bundleName - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly process: string; - - /** - * @default Indicates the running mode supported by the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly supportedModes: number; - - /** - * @default Indicates the path storing the module resources of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleSourceDirs: Array; - - /** - * @default Indicates the permissions required for accessing the application. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly permissions: Array; - - /** - * @default Indicates module information about an application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleInfo: Array; - - /** - * @default Indicates the path where the {@code Entry.hap} file of the application is saved - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly entryDir: string; - - /** - * @default Indicates the custom metadata of the application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - customizeData: Map; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/bundleInfo.d.ts b/interfaces/kits/js/bundle/bundleInfo.d.ts deleted file mode 100644 index 6353eaef993..00000000000 --- a/interfaces/kits/js/bundle/bundleInfo.d.ts +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AbilityInfo } from './abilityInfo'; -import { ApplicationInfo } from './applicationInfo'; -import { HapModuleInfo } from './hapModuleInfo'; - -/** - * @name The scene which is used - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface UsedScene { - /** - * @default Indicates the abilities that need the permission - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - abilities: Array; - - /** - * @default Indicates the time when the permission is used - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - when: string; -} - -/** - * @name Indicates the required permissions details defined in file config.json - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface ReqPermissionDetail { - /** - * @default Indicates the name of this required permissions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - name: string; - - /** - * @default Indicates the reason of this required permissions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - reason: string; - - /** - * @default Indicates the used scene of this required permissions - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - usedScene: UsedScene; -} - -/** - * @name Obtains configuration information about a bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface BundleInfo { - /** - * @default Indicates the name of this bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly name: string; - - /** - * @default Indicates the name of this original bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly type: string; - - /** - * @default Indicates the ID of the application to which this bundle belongs - * The application ID uniquely identifies an application. It is determined by the bundle name and signature - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly appId: string; - - /** - * @default Indicates the UID of the application to which this bundle belongs - * The UID uniquely identifies an application. It is determined by the process and user IDs of the application - * After an application is installed, its UID remains unchanged unless it is uninstalled and then reinstalled - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly uid: number; - - /** - * @default Indicates the hap install time - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly installTime: number; - - /** - * @default Indicates the hap update time - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly updateTime: number; - - /** - * @default Obtains configuration information about an application - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly appInfo: ApplicationInfo; - - /** - * @default Obtains configuration information about an ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityInfo: Array; - - /** - * @default Indicates the required permissions name defined in file config.json - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly reqPermissions: Array; - - /** - * @default Indicates the required permissions details defined in file config.json - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly reqPermissionDetails: Array; - - /** - * @default Describes the bundle vendor - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly vendor: string; - - /** - * @default Indicates the version number of the bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly versionCode: number; - - /** - * @default Indicates the text description of the bundle version - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly versionName: string; - - /** - * @default Indicates the compatible version number of the bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly compatibleVersion: number; - - /** - * @default Indicates the target version number of the bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly targetVersion: number; - - /** - * @default Indicates is compress native libs - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isCompressNativeLibs: boolean; - - /** - * @default Obtains configuration information about an module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly hapModuleInfo: Array; - - /** - * @default Indicates entry module name - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly entryModuleName: string; - - /** - * @default Indicates the cpuAbi information of this bundle. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly cpuAbi: string; - - /** - * @default Indicates is silent installation - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isSilentInstallation: string; - - /** - * @default Indicates the earliest historical version compatible with the bundle - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly minCompatibleVersionCode: number; - - /** - * @default Indicates whether free installation of the entry is supported - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly entryInstallationFree: boolean; -} diff --git a/interfaces/kits/js/bundle/bundleInstaller.d.ts b/interfaces/kits/js/bundle/bundleInstaller.d.ts deleted file mode 100644 index 5cdfc48f780..00000000000 --- a/interfaces/kits/js/bundle/bundleInstaller.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from './../basic'; -import bundle from './../@ohos.bundle'; - -/** - * @name Provides parameters required for installing or uninstalling an application. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface InstallParam { - /** - * @default Indicates the user id - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - userId: number; - - /** - * @default Indicates the install flag - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - installFlag: number; - - /** - * @default Indicates whether the param has data - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - isKeepData: boolean; -} - -/** - * @name Indicates the install or uninstall status - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface InstallStatus { - - /** - * @default Indicates the install or uninstall error code - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - status: bundle.InstallErrorCode; - - /** - * @default Indicates the install or uninstall result string message - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - statusMessage: string; -} - -/** - * @name Offers install, upgrade, and remove bundles on the devices. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface BundleInstaller { - /** - * Install an application in a HAP. - * - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @param bundleFilePaths Indicates the path where the bundle of the application is stored. The path should be the - * relative path to the data directory of the current application. - * @param installParam Indicates other parameters required for the installation. - * @return InstallStatus - * @permission ohos.permission.INSTALL_BUNDLE - */ - install(bundleFilePaths: Array, param: InstallParam, callback: AsyncCallback): void; - - /** - * Uninstall an application. - * - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @param bundleName Indicates the bundle name of the application to be uninstalled. - * @param installParam Indicates other parameters required for the uninstallation. - * @return InstallStatus - * @permission ohos.permission.INSTALL_BUNDLE - */ - uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback): void; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/customizeData.d.ts b/interfaces/kits/js/bundle/customizeData.d.ts deleted file mode 100644 index 17393229f1f..00000000000 --- a/interfaces/kits/js/bundle/customizeData.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * @name Indicates the custom metadata - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface CustomizeData { - /** - * @default Indicates the custom metadata name - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - name: string; - - /** - * @default Indicates the custom metadata value - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - value: string; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/customizedata.ts b/interfaces/kits/js/bundle/customizedata.ts deleted file mode 100644 index 68258099d6e..00000000000 --- a/interfaces/kits/js/bundle/customizedata.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface CustomizeData { - name: string; - value: string; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/elementName.d.ts b/interfaces/kits/js/bundle/elementName.d.ts deleted file mode 100644 index 68fe8ddda30..00000000000 --- a/interfaces/kits/js/bundle/elementName.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Contains basic Ability information, which uniquely identifies an ability. - * You can use this class to obtain values of the fields set in an element, - * such as the device ID, bundle name, and ability name. - * @name Contains basic Ability information, which uniquely identifies an ability - * @since 7 - * @sysCap SystemCapability.Appexecfwk - * @devices phone, tablet, tv, wearable, car - * @permission N/A - */ -export interface ElementName { - /** - * device id - * @default - - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap SystemCapability.Appexecfwk - */ - deviceId?: string; - - /** - * bundle name - * @default - - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap SystemCapability.Appexecfwk - */ - bundleName: string; - - /** - * ability name - * @default ability class name. - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap SystemCapability.Appexecfwk - */ - abilityName: string; - - /** - * uri - * @default - - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap SystemCapability.Appexecfwk - */ - uri?: string; - - /** - * shortName - * @default - - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @sysCap SystemCapability.Appexecfwk - */ - shortName?: string; -} diff --git a/interfaces/kits/js/bundle/hapModuleInfo.d.ts b/interfaces/kits/js/bundle/hapModuleInfo.d.ts deleted file mode 100644 index a62a66955d3..00000000000 --- a/interfaces/kits/js/bundle/hapModuleInfo.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AbilityInfo } from "./abilityInfo"; - -/** - * @name Obtains configuration information about an module. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface HapModuleInfo { - /** - * @default Indicates the name of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly name: string; - /** - * @default Describes the hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly description: string; - /** - * @default Indicates the description of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly descriptionId: number; - /** - * @default Indicates the icon of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly icon: string; - /** - * @default Indicates the label of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly label: string; - /** - * @default Indicates the label id of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly labelId: number; - /** - * @default Indicates the icon id of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly iconId: number; - /** - * @default Indicates the background img of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly backgroundImg: string; - /** - * @default Indicates the supported modes of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly supportedModes: number; - /** - * @default Indicates the req capabilities of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly reqCapabilities: Array; - /** - * @default The device types that this hapmodule can run on - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly deviceTypes: Array; - /** - * @default Obtains configuration information about ability - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityInfo: Array; - /** - * @default Indicates the name of the .hap package to which the capability belongs - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleName: string; - /** - * @default Indicates the main ability name of this hapmodule - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly mainAbilityName: string; - /** - * @default Indicates whether free installation of the hapmodule is supported - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly installationFree: boolean; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/moduleInfo.d.ts b/interfaces/kits/js/bundle/moduleInfo.d.ts deleted file mode 100644 index 437ca90fa90..00000000000 --- a/interfaces/kits/js/bundle/moduleInfo.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @name Stores module information about an application. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface ModuleInfo { - /** - * The module name. - * - * @default Indicates the name of the .hap package to which the capability belongs - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleName: string; - - /** - * The module source path. - * - * @default Indicates the module source dir of this module - * @devices phone, tablet, tv, wearable, car - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly moduleSourceDir: string; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/moduleUsageRecord.d.ts b/interfaces/kits/js/bundle/moduleUsageRecord.d.ts deleted file mode 100644 index 0bc3620102c..00000000000 --- a/interfaces/kits/js/bundle/moduleUsageRecord.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @name Stores FA usage information. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - * @systemapi hide this for inner system use - */ -export interface ModuleUsageRecord { - /** - * @default Indicates the name of the bundle containing the module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly bundleName: string; - /** - * @default Indicates the app label id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly appLabelId: number; - /** - * @default Indicates the name of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly name: string; - /** - * @default Indicates the label id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly labelId: number; - /** - * @default Indicates the description id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly descriptionId: number; - /** - * @default Indicates the ability name of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityName: string; - /** - * @default Indicates the ability label id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityLabelId: number; - /** - * @default Indicates the ability description id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityDescriptionId: number; - /** - * @default Indicates the ability icon id of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly abilityIconId: number; - /** - * @default Indicates the launched count of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly launchedCount: number; - /** - * @default Indicates the last launch time of this module - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly lastLaunchTime: number; - /** - * @default Indicates whether the module is removed - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isRemoved: boolean; - /** - * @default Indicates whether free installation of the module is supported - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly installationFreeSupported: boolean; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/moduleusagerecord1.d.ts b/interfaces/kits/js/bundle/moduleusagerecord1.d.ts deleted file mode 100644 index 8cc84046b05..00000000000 --- a/interfaces/kits/js/bundle/moduleusagerecord1.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface ModuleUsageRecord { - readonly bundleName: string; - readonly appLabelId: number; - readonly name: string; - readonly labelId: number; - readonly descriptionId: number; - readonly abilityName: string; - readonly abilityLabelId: number; - readonly abilityDescriptionId: number; - readonly abilityIconId: number; - readonly launchedCount: number; - readonly lastLaunchTime: number; - readonly isRemoved: boolean; - readonly installationFreeSupported: boolean; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/shortcutInfo.d.ts b/interfaces/kits/js/bundle/shortcutInfo.d.ts deleted file mode 100644 index 0caaa904588..00000000000 --- a/interfaces/kits/js/bundle/shortcutInfo.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * @name Provides methods for obtaining information about the ability that a shortcut will start, including the target - * bundle name and ability class name. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface ShortcutWant{ - /** - * @default Indicates the target bundle of the shortcut want - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly targetBundle: string; - /** - * @default Indicates the target class of the shortcut want - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly targetClass: string; -} - - /** - * @name Provides information about a shortcut, including the shortcut ID and label. - * @since 7 - * @SysCap SystemCapability.Appexecfwk - * @permission NA - * @devices phone, tablet, tv, wearable, car - */ -export interface ShortcutInfo { - /** - * @default Indicates the ID of the application to which this shortcut belongs - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly id: string; - /** - * @default Indicates the name of the bundle containing the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly bundleName: string; - /** - * @default Indicates the host ability of the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly hostAbility: string; - /** - * @default Indicates the icon of the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly icon: string; - /** - * @default Indicates the label of the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly label: string; - /** - * @default Indicates the disableMessage of the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly disableMessage: string; - /** - * @default Indicates the wants of the shortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly wants: Array; - /** - * @default Indicates whether the shortcut is static - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isStatic?: boolean - /** - * @default Indicates whether the shortcut is homeshortcut - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isHomeShortcut?: boolean; - /** - * @default Indicates whether the shortcut is enabled - * @since 7 - * @SysCap SystemCapability.Appexecfwk - */ - readonly isEnabled?: boolean; -} \ No newline at end of file diff --git a/interfaces/kits/js/bundle/shortcutinfo1.d.ts b/interfaces/kits/js/bundle/shortcutinfo1.d.ts deleted file mode 100644 index 1e6ce78bf9d..00000000000 --- a/interfaces/kits/js/bundle/shortcutinfo1.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export interface ShortcutIntent{ - readonly targetBundle: string; - readonly targetClass: string; -} - -export interface ShortcutInfo { - readonly id: string; - readonly bundleName: string; - readonly hostAbility: string; - readonly icon: string; - readonly label: string; - readonly disableMessage: string; - readonly intents: Array; - readonly isStatic?: boolean - readonly isHomeShortcut?: boolean; - readonly isEnabled?: boolean; -} \ No newline at end of file diff --git a/interfaces/kits/js/wantAgent/triggerInfo.d.ts b/interfaces/kits/js/wantAgent/triggerInfo.d.ts deleted file mode 100644 index ff8eaea6e23..00000000000 --- a/interfaces/kits/js/wantAgent/triggerInfo.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Want } from '../ability/want'; - -/** - * Provides the information required for triggering a WantAgent. - * - * @name TriggerInfo - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - */ -export interface TriggerInfo { - /** - * Result code. - */ - code: number; - - /** - * Extra Want. - * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid. - * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE, - * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter - * will be used to replace the corresponding attributes in the original Want, respectively. - * If this parameter is null, the original Want remains unchanged. - */ - want?: Want; - - /** - * Permission required for a WantAgent recipient. - * This parameter is valid only when the WantAgent is triggered to send common events. - * If permission is null, no permission is required on the recipient. - */ - permission?: string; - - /** - * Custom extra data you want to add for triggering a WantAgent. - */ - extraInfo?: {[key: string]: any}; -} \ No newline at end of file diff --git a/interfaces/kits/js/wantAgent/wantAgentInfo.d.ts b/interfaces/kits/js/wantAgent/wantAgentInfo.d.ts deleted file mode 100644 index c6e0bb37e1e..00000000000 --- a/interfaces/kits/js/wantAgent/wantAgentInfo.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Want } from '../ability/want'; -import wantAgent from '../@ohos.wantAgent' - -/** - * Provides the information required for triggering a WantAgent. - * - * @name WantAgentInfo - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - */ -export interface WantAgentInfo { - /** - * An array of all Wants for starting abilities or sending common events. Only Wants can be displayed. - */ - wants: Array; - - /** - * Type of the action specified in a Want. - */ - operationType: wantAgent.OperationType; - - /** - * Request code defined by the user. - */ - requestCode: number; - - /** - * An array of flags for using the WantAgent. - */ - wantAgentFlags?: Array; - - /** - * Extra information about how the Want starts an ability. - * If there is no extra information to set, this constant can be left empty. - */ - extraInfo?: {[key: string]: any}; -} \ No newline at end of file -- Gitee From 9d9722de7da7221f34a5ca7a12dd3ba1e7945b65 Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Tue, 22 Feb 2022 22:03:27 +0800 Subject: [PATCH 07/27] zhongjianfei@huawei.com Signed-off-by: zhongjianfei Change-Id: I26c6636f8771da3ae038bc724fe0d3ef182c305c --- .../app_manager/src/appmgr/configuration.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/interfaces/innerkits/app_manager/src/appmgr/configuration.cpp b/interfaces/innerkits/app_manager/src/appmgr/configuration.cpp index 85b24de01b3..b6b96e4e255 100755 --- a/interfaces/innerkits/app_manager/src/appmgr/configuration.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/configuration.cpp @@ -208,9 +208,20 @@ bool Configuration::ReadFromParcel(Parcel &parcel) std::vector values; keys.clear(); values.clear(); - parcel.ReadStringVector(&keys); - parcel.ReadStringVector(&values); - + if (!parcel.ReadStringVector(&keys)) { + APP_LOGE("ReadStringVector for keys failed."); + return false; + } + if (!parcel.ReadStringVector(&values)) { + APP_LOGE("ReadStringVector for values failed."); + return false; + } + int32_t keySize = keys.size(); + int32_t valueSize = values.size(); + if (keySize != valueSize || configSize != valueSize) { + APP_LOGE("ReadFromParcel failed, invalid size."); + return false; + } std::string key; std::string val; for (int32_t i = 0; i < configSize; i++) { -- Gitee From fe7065fcbce52453825a496b1d42864c26542b08 Mon Sep 17 00:00:00 2001 From: yudechen Date: Mon, 14 Feb 2022 17:22:04 +0800 Subject: [PATCH 08/27] =?UTF-8?q?=E5=B0=86=20napi=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=88=B0=E5=85=83=E8=83=BD=E5=8A=9B=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E3=80=82=20re=20#I4TNBQ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ica68a3f944d8d607833a0529342ab0025bc88371 Signed-off-by: yudechen --- frameworks/kits/runtime/native/js_runtime.cpp | 36 +++++++++++++++++++ interfaces/innerkits/runtime/BUILD.gn | 1 + 2 files changed, 37 insertions(+) diff --git a/frameworks/kits/runtime/native/js_runtime.cpp b/frameworks/kits/runtime/native/js_runtime.cpp index 928bd8ff488..add9ecc8c6c 100644 --- a/frameworks/kits/runtime/native/js_runtime.cpp +++ b/frameworks/kits/runtime/native/js_runtime.cpp @@ -27,9 +27,12 @@ #include "hilog_wrapper.h" #include "js_runtime_utils.h" +#include "systemcapability.h" + namespace OHOS { namespace AbilityRuntime { namespace { +constexpr uint8_t SYSCAP_MAX_SIZE = 64; constexpr int64_t DEFAULT_GC_POOL_SIZE = 0x10000000; // 256MB #if defined(_ARM64_) constexpr char ARK_DEBUGGER_LIB_PATH[] = "/system/lib64/libark_debugger.z.so"; @@ -161,6 +164,33 @@ NativeValue* SetTimeout(NativeEngine* engine, NativeCallbackInfo* info) return jsRuntime.SetCallbackTimer(*engine, *info, false); } +NativeValue* CanIUse(NativeEngine* engine, NativeCallbackInfo* info) +{ + if (engine == nullptr || info == nullptr) { + HILOG_ERROR("get syscap failed since engine or callback info is nullptr."); + return nullptr; + } + + if (info->argc != 1 || info->argv[0]->TypeOf() != NATIVE_STRING) { + HILOG_ERROR("Get syscap failed with invalid parameter."); + return engine->CreateUndefined(); + } + + char syscap[SYSCAP_MAX_SIZE] = { 0 }; + + NativeString* str = ConvertNativeValueTo(info->argv[0]); + if (str == nullptr) { + HILOG_ERROR("Convert to NativeString failed."); + return engine->CreateUndefined(); + } + size_t bufferLen = str->GetLength(); + size_t strLen = 0; + str->GetCString(syscap, bufferLen + 1, &strLen); + + bool ret = HasSystemCapability(syscap); + return engine->CreateBoolean(ret); +} + NativeValue* SetInterval(NativeEngine* engine, NativeCallbackInfo* info) { if (engine == nullptr || info == nullptr) { @@ -191,6 +221,11 @@ void InitTimerModule(NativeEngine& engine, NativeObject& globalObject) BindNativeFunction(engine, globalObject, "clearInterval", ClearTimeoutOrInterval); } +void InitSyscapModule(NativeEngine& engine, NativeObject& globalObject) +{ + BindNativeFunction(engine, globalObject, "canIUse", CanIUse); +} + bool MakeFilePath(const std::string& codePath, const std::string& modulePath, std::string& fileName) { std::string path(codePath); @@ -263,6 +298,7 @@ bool JsRuntime::Initialize(const Options& options) InitConsoleLogModule(*nativeEngine_, *globalObj); InitTimerModule(*nativeEngine_, *globalObj); + InitSyscapModule(*nativeEngine_, *globalObj); // Simple hook function 'isSystemplugin' BindNativeFunction(*nativeEngine_, *globalObj, "isSystemplugin", diff --git a/interfaces/innerkits/runtime/BUILD.gn b/interfaces/innerkits/runtime/BUILD.gn index bc9a9a085f1..4b5f112be49 100644 --- a/interfaces/innerkits/runtime/BUILD.gn +++ b/interfaces/innerkits/runtime/BUILD.gn @@ -71,6 +71,7 @@ ohos_shared_library("runtime") { "bundle_framework:appexecfwk_base", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", + "init:libbegetutil", ] subsystem_name = "aafwk" -- Gitee From a1f9627b2698a7857d8f5c6c55c63d262fa5d9e9 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 22 Feb 2022 19:44:11 +0000 Subject: [PATCH 09/27] Modify the ability_base widget Signed-off-by: wanchengzhen --- .../src/ohos/aafwk/content/element_name.cpp | 113 ++++++++++++++++++ frameworks/kits/content/cpp/test/BUILD.gn | 4 +- interfaces/innerkits/app_manager/BUILD.gn | 16 ++- interfaces/innerkits/base/BUILD.gn | 7 +- interfaces/innerkits/bundle.json | 3 +- interfaces/innerkits/intent/BUILD.gn | 2 +- interfaces/innerkits/want/BUILD.gn | 6 +- .../include/ohos/aafwk/content/element_name.h | 83 +++++++++++++ services/appmgr/test/BUILD.gn | 3 +- 9 files changed, 214 insertions(+), 23 deletions(-) create mode 100644 frameworks/kits/content/cpp/src/ohos/aafwk/content/element_name.cpp create mode 100644 interfaces/innerkits/want/include/ohos/aafwk/content/element_name.h diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/element_name.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/element_name.cpp new file mode 100644 index 00000000000..3f851a8abb8 --- /dev/null +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/element_name.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "element_name.h" + +#include "string_ex.h" + +#include "app_log_wrapper.h" +#include "parcel_macro.h" + +namespace OHOS { +namespace AppExecFwk { +void ElementName::SetElementDeviceID(ElementName *element, const char *deviceId) +{ + if (element == nullptr) { + return; + } + element->SetDeviceID(deviceId); +} + +void ElementName::SetElementBundleName(ElementName *element, const char *bundleName) +{ + if (element == nullptr) { + return; + } + element->SetBundleName(bundleName); +} + +void ElementName::SetElementAbilityName(ElementName *element, const char *abilityName) +{ + if (element == nullptr) { + return; + } + element->SetAbilityName(abilityName); +} + +void ElementName::ClearElement(ElementName *element) +{ + if (element == nullptr) { + return; + } + element->SetDeviceID(""); + element->SetBundleName(""); + element->SetAbilityName(""); +} + +ElementName::ElementName(const std::string &deviceId, const std::string &bundleName, const std::string &abilityName) + : deviceId_(deviceId), bundleName_(bundleName), abilityName_(abilityName) +{ + APP_LOGD("instance is created with parameters"); +} + +ElementName::ElementName() +{ + APP_LOGD("instance is created without parameter"); +} + +ElementName::~ElementName() +{ + APP_LOGD("instance is destroyed"); +} + +std::string ElementName::GetURI() const +{ + return deviceId_ + "/" + bundleName_ + "/" + abilityName_; +} + +bool ElementName::operator==(const ElementName &element) const +{ + return (deviceId_ == element.GetDeviceID() && bundleName_ == element.GetBundleName() && + abilityName_ == element.GetAbilityName()); +} + +bool ElementName::ReadFromParcel(Parcel &parcel) +{ + bundleName_ = Str16ToStr8(parcel.ReadString16()); + abilityName_ = Str16ToStr8(parcel.ReadString16()); + deviceId_ = Str16ToStr8(parcel.ReadString16()); + return true; +} + +ElementName *ElementName::Unmarshalling(Parcel &parcel) +{ + ElementName *elementName = new (std::nothrow) ElementName(); + if (elementName && !elementName->ReadFromParcel(parcel)) { + APP_LOGW("read from parcel failed"); + delete elementName; + elementName = nullptr; + } + return elementName; +} + +bool ElementName::Marshalling(Parcel &parcel) const +{ + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(bundleName_)); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(abilityName_)); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(deviceId_)); + return true; +} +} // namespace AppExecFwk +} // namespace OHOS diff --git a/frameworks/kits/content/cpp/test/BUILD.gn b/frameworks/kits/content/cpp/test/BUILD.gn index 0532001e85e..febece4d003 100644 --- a/frameworks/kits/content/cpp/test/BUILD.gn +++ b/frameworks/kits/content/cpp/test/BUILD.gn @@ -130,7 +130,7 @@ ohos_unittest("intent_parameters_test") { ] external_deps = [ - "bundle_framework:appexecfwk_base", + "ability_base:want", "ipc:ipc_core", ] } @@ -176,7 +176,7 @@ ohos_unittest("intent_filter_test") { "//utils/native/base:utils", ] - external_deps = [ "bundle_framework:appexecfwk_base" ] + external_deps = [ "ability_base:want" ] } ohos_unittest("operation_test") { diff --git a/interfaces/innerkits/app_manager/BUILD.gn b/interfaces/innerkits/app_manager/BUILD.gn index e18d0c74e81..37cda70e72a 100644 --- a/interfaces/innerkits/app_manager/BUILD.gn +++ b/interfaces/innerkits/app_manager/BUILD.gn @@ -100,6 +100,15 @@ ohos_shared_library("app_manager") { part_name = "ability_runtime" } +config("configuration_sdk_config") { + include_dirs = [ + "include/appmgr", + "//foundation/aafwk/standard/frameworks/kits/ability/native/include", + "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include", + "//third_party/json/include", + ] +} + ohos_shared_library("configuration") { include_dirs = [ "//base/global/resmgr_standard/interfaces/innerkits/include" ] @@ -109,7 +118,7 @@ ohos_shared_library("configuration") { "src/appmgr/configuration_convertor.cpp", ] - public_configs = [ ":appmgr_sdk_config" ] + public_configs = [ ":configuration_sdk_config" ] defines = [ "APP_LOG_TAG = \"Configuration\"", @@ -120,16 +129,11 @@ ohos_shared_library("configuration") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ - "//foundation/aafwk/standard/interfaces/innerkits/base:base", - "//foundation/aafwk/standard/interfaces/innerkits/want:want", "//foundation/appexecfwk/standard/common:libappexecfwk_common", - "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", - "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//utils/native/base:utils", ] external_deps = [ - "bytrace_standard:bytrace_core", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/interfaces/innerkits/base/BUILD.gn b/interfaces/innerkits/base/BUILD.gn index 504687d7635..42a2ef6572b 100644 --- a/interfaces/innerkits/base/BUILD.gn +++ b/interfaces/innerkits/base/BUILD.gn @@ -22,8 +22,6 @@ config("base_public_config") { visibility = [ ":*" ] include_dirs = [ "//foundation/aafwk/standard/interfaces/innerkits/base/include", - "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include", - "//third_party/jsoncpp/include", "//utils/native/base/include", ] } @@ -49,10 +47,7 @@ ohos_shared_library("base") { ] configs = [ ":base_config" ] public_configs = [ ":base_public_config" ] - deps = [ - "//third_party/jsoncpp:jsoncpp", - "//utils/native/base:utils", - ] + deps = [ "//utils/native/base:utils" ] subsystem_name = "aafwk" part_name = "ability_base" diff --git a/interfaces/innerkits/bundle.json b/interfaces/innerkits/bundle.json index 2e160347b54..538567b6892 100644 --- a/interfaces/innerkits/bundle.json +++ b/interfaces/innerkits/bundle.json @@ -21,10 +21,8 @@ "ram": "", "deps": { "components": [ - "bundle_framework", "hiviewdfx_hilog_native", "ipc", - "samgr_standard", "utils_base" ], "third_party": [ @@ -63,6 +61,7 @@ "header": { "header_base": "//foundation/aafwk/standard/interfaces/innerkits/want/include/", "header_files": [ + "ohos/aafwk/content/element_name.h", "ohos/aafwk/content/want.h", "ohos/aafwk/content/skills.h", "ohos/aafwk/content/want_params.h", diff --git a/interfaces/innerkits/intent/BUILD.gn b/interfaces/innerkits/intent/BUILD.gn index e1b8cbd0068..cb5dff1164a 100644 --- a/interfaces/innerkits/intent/BUILD.gn +++ b/interfaces/innerkits/intent/BUILD.gn @@ -53,8 +53,8 @@ ohos_shared_library("intent") { deps = [ "//foundation/aafwk/standard/interfaces/innerkits/base:base", + "//foundation/aafwk/standard/interfaces/innerkits/want:want", "//foundation/appexecfwk/standard/common:libappexecfwk_common", - "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base", "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr:lsamgr", diff --git a/interfaces/innerkits/want/BUILD.gn b/interfaces/innerkits/want/BUILD.gn index 7c2452550c4..3adcd133792 100644 --- a/interfaces/innerkits/want/BUILD.gn +++ b/interfaces/innerkits/want/BUILD.gn @@ -46,6 +46,7 @@ wantImpl = "//foundation/aafwk/standard/frameworks/kits/content/cpp/src/ohos/aaf ohos_shared_library("want") { sources = [ + "${wantImpl}/element_name.cpp", "${wantImpl}/extra_params.cpp", "${wantImpl}/operation.cpp", "${wantImpl}/operation_builder.cpp", @@ -61,16 +62,11 @@ ohos_shared_library("want") { "//foundation/aafwk/standard/interfaces/innerkits/base:base", "//foundation/appexecfwk/standard/common:libappexecfwk_common", "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri", - "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", - - #"//foundation/distributeddatamgr/distributeddatamgr:build_module", - "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr:lsamgr", "//third_party/jsoncpp:jsoncpp", "//utils/native/base:utils", ] external_deps = [ - "bundle_framework:appexecfwk_base", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/interfaces/innerkits/want/include/ohos/aafwk/content/element_name.h b/interfaces/innerkits/want/include/ohos/aafwk/content/element_name.h new file mode 100644 index 00000000000..339226529e3 --- /dev/null +++ b/interfaces/innerkits/want/include/ohos/aafwk/content/element_name.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_ELEMENT_NAME_H +#define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_ELEMENT_NAME_H + +#include + +#include "parcel.h" + +namespace OHOS { +namespace AppExecFwk { +class ElementName : public Parcelable { + /* + * How to locate unique Ability: deviceId/bundleName/abilityName + */ +public: + ElementName(const std::string &deviceId, const std::string &bundleName, const std::string &abilityName); + ElementName(); + ~ElementName(); + + std::string GetURI() const; + bool operator==(const ElementName &element) const; + + inline void SetDeviceID(const std::string &id) + { + deviceId_ = id; + } + + inline std::string GetDeviceID() const + { + return deviceId_; + } + + inline void SetBundleName(const std::string &name) + { + bundleName_ = name; + } + + inline std::string GetBundleName() const + { + return bundleName_; + } + + inline void SetAbilityName(const std::string &name) + { + abilityName_ = name; + } + + inline std::string GetAbilityName() const + { + return abilityName_; + } + + bool ReadFromParcel(Parcel &parcel); + virtual bool Marshalling(Parcel &parcel) const override; + static ElementName *Unmarshalling(Parcel &parcel); + + void SetElementDeviceID(ElementName *element, const char *deviceId); + void SetElementBundleName(ElementName *element, const char *bundleName); + void SetElementAbilityName(ElementName *element, const char *abilityName); + void ClearElement(ElementName *element); + +private: + std::string deviceId_; + std::string bundleName_; + std::string abilityName_; +}; +} // namespace AppExecFwk +} // namespace OHOS +#endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_ELEMENT_NAME_H diff --git a/services/appmgr/test/BUILD.gn b/services/appmgr/test/BUILD.gn index 8798c25321a..372b896a424 100644 --- a/services/appmgr/test/BUILD.gn +++ b/services/appmgr/test/BUILD.gn @@ -35,6 +35,7 @@ ohos_source_set("appmgr_test_source") { testonly = true sources = [ + "${aafwk_path}/frameworks/kits/content/cpp/src/ohos/aafwk/content/element_name.cpp", "${aafwk_path}/interfaces/innerkits/app_manager/src/appmgr/app_launch_data.cpp", "${aafwk_path}/interfaces/innerkits/app_manager/src/appmgr/app_mgr_proxy.cpp", "${aafwk_path}/interfaces/innerkits/app_manager/src/appmgr/app_mgr_stub.cpp", @@ -53,10 +54,10 @@ ohos_source_set("appmgr_test_source") { "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/src/application_info.cpp", "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/src/bundle_info.cpp", "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/src/bundle_user_info.cpp", - "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/src/element_name.cpp", ] include_dirs = [ + "${aafwk_path}/interfaces/innerkits/want/include/ohos/aafwk/content", "//third_party/json/include", "${aafwk_path}/services/appmgr/include/lmks", "${appexecfwk_path}/interfaces/innerkits/appexecfwk_core/include", -- Gitee From 0a209f63a02afdd0ca0e4480bf60149f12f07e05 Mon Sep 17 00:00:00 2001 From: ql Date: Wed, 23 Feb 2022 10:45:22 +0800 Subject: [PATCH 10/27] change js function name Signed-off-by: ql Change-Id: I7932b83b41a2ddedcfdea07bde651e974ca3bd31 --- .../napi/aafwk/mission_manager/distributed_mission_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/napi/aafwk/mission_manager/distributed_mission_manager.cpp b/interfaces/kits/napi/aafwk/mission_manager/distributed_mission_manager.cpp index 4b63e20877f..b7de29b6154 100644 --- a/interfaces/kits/napi/aafwk/mission_manager/distributed_mission_manager.cpp +++ b/interfaces/kits/napi/aafwk/mission_manager/distributed_mission_manager.cpp @@ -55,6 +55,7 @@ bool SetStartSyncMissionsContext(const napi_env &env, const napi_value &value, HILOG_ERROR("%{public}s, fixConflict error type.", __func__); return false; } + napi_get_value_bool(env, fixConflictValue, &context->fixConflict); bool isTag = false; napi_has_named_property(env, value, "tag", &isTag); if (!isTag) { @@ -1394,7 +1395,7 @@ napi_value DistributedMissionManagerExport(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("stopSyncRemoteMissions", NAPI_StopSyncRemoteMissions), DECLARE_NAPI_FUNCTION("registerMissionListener", NAPI_RegisterMissionListener), DECLARE_NAPI_FUNCTION("unRegisterMissionListener", NAPI_UnRegisterMissionListener), - DECLARE_NAPI_FUNCTION("continueAbility", NAPI_ContinueAbility), + DECLARE_NAPI_FUNCTION("continueMission", NAPI_ContinueAbility), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(properties) / sizeof(properties[0]), properties)); return exports; -- Gitee From 2675b5655c2eb117ce766086d86f15643995d415 Mon Sep 17 00:00:00 2001 From: "zhangyafei.echo" Date: Tue, 22 Feb 2022 22:51:19 +0800 Subject: [PATCH 11/27] IssueNo: SR000GP4TG SR000GP4TE SR000GP4TG SR000GP4TI Description: 1. Notify total configuration, even one config didn't change. 2. direction and densitydpi distinguish by displayId. 3. because serviceextension use ServiceExtAbilityContext(inherit from ExtAbilityContext), not ExtensionContext, need modify ext_ability_context.js. 4. delete unnecessary interpretation. Sig:SIG_ApplicationFramework Feature or BugFix: Feature Binary Source: No Signed-off-by: zhangyafei.echo Change-Id: I1a29270f2aabad6396fa361d3a3058a46e1755e9 --- .../kits/ability/native/src/ability.cpp | 9 ++++---- .../native/src/ability_runtime/js_ability.cpp | 5 +++-- .../ability/native/src/ability_thread.cpp | 5 ----- .../src/form_runtime/js_form_extension.cpp | 5 +++-- .../native/src/js_service_extension.cpp | 5 +++-- .../ability_runtime/app/js_ability_stage.cpp | 5 +++-- .../appkit/native/app/src/main_thread.cpp | 1 + .../native/js_data_struct_converter.cpp | 21 ++++++++++++------- .../ext_ability_context.js | 5 +++++ .../napi_common/napi_common_configuration.cpp | 10 ++++++--- 10 files changed, 43 insertions(+), 28 deletions(-) diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index a5cf910b1ae..96b450aa285 100755 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -241,8 +241,9 @@ void Ability::OnStart(const Want &want) int32_t width = display->GetWidth(); int32_t height = display->GetHeight(); auto configuration = application_->GetConfiguration(); - configuration->AddItem(ConfigurationInner::APPLICATION_DIRECTION, GetDirectionStr(height, width)); - configuration->AddItem(ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density)); + configuration->AddItem(displayId, ConfigurationInner::APPLICATION_DIRECTION, + GetDirectionStr(height, width)); + configuration->AddItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density)); configuration->AddItem(ConfigurationInner::APPLICATION_DISPLAYID, std::to_string(displayId)); UpdateContextConfiguration(); @@ -3465,8 +3466,8 @@ void Ability::OnChange(Rosen::DisplayId displayId, Rosen::DisplayChangeEvent cha // Notify ability Configuration newConfig; - newConfig.AddItem(ConfigurationInner::APPLICATION_DIRECTION, GetDirectionStr(height, width)); - newConfig.AddItem(ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density)); + newConfig.AddItem(displayId, ConfigurationInner::APPLICATION_DIRECTION, GetDirectionStr(height, width)); + newConfig.AddItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density)); std::vector changeKeyV; auto configuration = application_->GetConfiguration(); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 8aac9cafb3a..efa71ba1bb5 100755 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -305,9 +305,10 @@ void JsAbility::OnConfigurationUpdated(const Configuration &configuration) HandleScope handleScope(jsRuntime_); auto& nativeEngine = jsRuntime_.GetNativeEngine(); - JsAbilityContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, GetAbilityContext()->GetConfiguration()); + auto fullConfig = GetAbilityContext()->GetConfiguration(); + JsAbilityContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, fullConfig); napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration( - reinterpret_cast(&nativeEngine), configuration); + reinterpret_cast(&nativeEngine), *fullConfig); NativeValue* jsConfiguration = reinterpret_cast(napiConfiguration); CallObjectMethod("onConfigurationUpdated", &jsConfiguration, 1); } diff --git a/frameworks/kits/ability/native/src/ability_thread.cpp b/frameworks/kits/ability/native/src/ability_thread.cpp index 33b74c04b5a..d962b23b2c1 100644 --- a/frameworks/kits/ability/native/src/ability_thread.cpp +++ b/frameworks/kits/ability/native/src/ability_thread.cpp @@ -672,11 +672,6 @@ void AbilityThread::ScheduleRestoreAbilityState(const PacMap &state) void AbilityThread::ScheduleUpdateConfiguration(const Configuration &config) { APP_LOGI("AbilityThread::ScheduleUpdateConfiguration begin"); - if (abilityImpl_ == nullptr) { - APP_LOGE("AbilityThread::ScheduleUpdateConfiguration abilityImpl_ is nullptr"); - return; - } - wptr weak = this; auto task = [weak, config]() { auto abilityThread = weak.promote(); diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp index 94bd57d3692..0a97767f7f2 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp @@ -308,10 +308,11 @@ void JsFormExtension::OnConfigurationUpdated(const AppExecFwk::Configuration& co auto& nativeEngine = jsRuntime_.GetNativeEngine(); // Notify extension context - JsExtensionContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, GetContext()->GetConfiguration()); + auto fullConfig = GetContext()->GetConfiguration(); + JsExtensionContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, fullConfig); napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration( - reinterpret_cast(&nativeEngine), configuration); + reinterpret_cast(&nativeEngine), *fullConfig); NativeValue* jsConfiguration = reinterpret_cast(napiConfiguration); CallObjectMethod("onConfigurationUpdated", &jsConfiguration, 1); } diff --git a/frameworks/kits/ability/native/src/js_service_extension.cpp b/frameworks/kits/ability/native/src/js_service_extension.cpp index a492231cba9..7213058c2cd 100755 --- a/frameworks/kits/ability/native/src/js_service_extension.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension.cpp @@ -281,10 +281,11 @@ void JsServiceExtension::OnConfigurationUpdated(const AppExecFwk::Configuration& auto& nativeEngine = jsRuntime_.GetNativeEngine(); // Notify extension context - JsExtensionContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, GetContext()->GetConfiguration()); + auto fullConfig = GetContext()->GetConfiguration(); + JsExtensionContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, fullConfig); napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration( - reinterpret_cast(&nativeEngine), configuration); + reinterpret_cast(&nativeEngine), *fullConfig); NativeValue* jsConfiguration = reinterpret_cast(napiConfiguration); CallObjectMethod("onConfigurationUpdated", &jsConfiguration, 1); } diff --git a/frameworks/kits/appkit/native/ability_runtime/app/js_ability_stage.cpp b/frameworks/kits/appkit/native/ability_runtime/app/js_ability_stage.cpp index dcfb207c300..deffaa191c2 100644 --- a/frameworks/kits/appkit/native/ability_runtime/app/js_ability_stage.cpp +++ b/frameworks/kits/appkit/native/ability_runtime/app/js_ability_stage.cpp @@ -185,10 +185,11 @@ void JsAbilityStage::OnConfigurationUpdated(const AppExecFwk::Configuration& con auto& nativeEngine = jsRuntime_.GetNativeEngine(); // Notify Ability stage context - JsAbilityStageContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, GetContext()->GetConfiguration()); + auto fullConfig = GetContext()->GetConfiguration(); + JsAbilityStageContext::ConfigurationUpdated(&nativeEngine, shellContextRef_, fullConfig); napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration( - reinterpret_cast(&nativeEngine), configuration); + reinterpret_cast(&nativeEngine), *fullConfig); NativeValue* jsConfiguration = reinterpret_cast(napiConfiguration); CallObjectMethod("onConfigurationUpdated", &jsConfiguration, 1); } diff --git a/frameworks/kits/appkit/native/app/src/main_thread.cpp b/frameworks/kits/appkit/native/app/src/main_thread.cpp index 17d79f6385b..8f5a1b348ca 100644 --- a/frameworks/kits/appkit/native/app/src/main_thread.cpp +++ b/frameworks/kits/appkit/native/app/src/main_thread.cpp @@ -902,6 +902,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con application_->AttachBaseContext(contextDeal); application_->SetAbilityRecordMgr(abilityRecordMgr_); application_->SetConfiguration(config); + contextImpl->SetConfiguration(application_->GetConfiguration()); applicationImpl_->SetRecordId(appLaunchData.GetRecordId()); applicationImpl_->SetApplication(application_); diff --git a/frameworks/kits/runtime/native/js_data_struct_converter.cpp b/frameworks/kits/runtime/native/js_data_struct_converter.cpp index 68e0dffc988..a3f108737ed 100644 --- a/frameworks/kits/runtime/native/js_data_struct_converter.cpp +++ b/frameworks/kits/runtime/native/js_data_struct_converter.cpp @@ -21,6 +21,7 @@ namespace OHOS { namespace AbilityRuntime { +using namespace OHOS::AppExecFwk; NativeValue* CreateJsWantObject(NativeEngine& engine, const AAFwk::Want& want) { NativeValue* objValue = engine.CreateObject(); @@ -172,15 +173,19 @@ NativeValue* CreateJsConfiguration(NativeEngine& engine, const AppExecFwk::Confi NativeObject* object = ConvertNativeValueTo(objValue); object->SetProperty("language", CreateJsValue(engine, - configuration.GetItem(AppExecFwk::GlobalConfigurationKey::SYSTEM_LANGUAGE))); + configuration.GetItem(GlobalConfigurationKey::SYSTEM_LANGUAGE))); object->SetProperty("colorMode", CreateJsValue(engine, - AppExecFwk::ConvertColorMode(configuration.GetItem(AppExecFwk::GlobalConfigurationKey::SYSTEM_COLORMODE)))); - object->SetProperty("direction", CreateJsValue(engine, - AppExecFwk::ConvertDirection(configuration.GetItem(AppExecFwk::ConfigurationInner::APPLICATION_DIRECTION)))); - object->SetProperty("screenDensity", CreateJsValue(engine, - AppExecFwk::ConvertDensity(configuration.GetItem(AppExecFwk::ConfigurationInner::APPLICATION_DENSITYDPI)))); - object->SetProperty("displayId", CreateJsValue(engine, - AppExecFwk::ConvertDisplayId(configuration.GetItem(AppExecFwk::ConfigurationInner::APPLICATION_DISPLAYID)))); + ConvertColorMode(configuration.GetItem(GlobalConfigurationKey::SYSTEM_COLORMODE)))); + + int32_t displayId = ConvertDisplayId(configuration.GetItem(ConfigurationInner::APPLICATION_DISPLAYID)); + + std::string direction = configuration.GetItem(displayId, ConfigurationInner::APPLICATION_DIRECTION); + object->SetProperty("direction", CreateJsValue(engine, ConvertDirection(direction))); + + std::string density = configuration.GetItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI); + object->SetProperty("screenDensity", CreateJsValue(engine, ConvertDensity(density))); + + object->SetProperty("displayId", CreateJsValue(engine, displayId)); return objValue; } diff --git a/interfaces/kits/napi/aafwk/ext_ability_context/ext_ability_context.js b/interfaces/kits/napi/aafwk/ext_ability_context/ext_ability_context.js index c1029e0992e..9f0af27655c 100644 --- a/interfaces/kits/napi/aafwk/ext_ability_context/ext_ability_context.js +++ b/interfaces/kits/napi/aafwk/ext_ability_context/ext_ability_context.js @@ -18,6 +18,11 @@ class ExtAbilityContext extends Context { constructor(obj) { super(obj); this.currentHapModuleInfo = obj.currentHapModuleInfo + this.config = obj.config + } + + onUpdateConfiguration(config) { + this.config = config } } diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp index f73406fbd17..60ce79a7186 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp @@ -50,13 +50,17 @@ napi_value WrapConfiguration(napi_env env, const AppExecFwk::Configuration &conf jsValue = WrapInt32ToJS(env, ConvertColorMode(configuration.GetItem(GlobalConfigurationKey::SYSTEM_COLORMODE))); SetPropertyValueByPropertyName(env, jsObject, "colorMode", jsValue); - jsValue = WrapInt32ToJS(env, ConvertDirection(configuration.GetItem(ConfigurationInner::APPLICATION_DIRECTION))); + int32_t displayId = ConvertDisplayId(configuration.GetItem(ConfigurationInner::APPLICATION_DISPLAYID)); + + std::string direction = configuration.GetItem(displayId, ConfigurationInner::APPLICATION_DIRECTION); + jsValue = WrapInt32ToJS(env, ConvertDirection(direction)); SetPropertyValueByPropertyName(env, jsObject, "direction", jsValue); - jsValue = WrapInt32ToJS(env, ConvertDensity(configuration.GetItem(ConfigurationInner::APPLICATION_DENSITYDPI))); + std::string density = configuration.GetItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI); + jsValue = WrapInt32ToJS(env, ConvertDensity(density)); SetPropertyValueByPropertyName(env, jsObject, "screenDensity", jsValue); - jsValue = WrapInt32ToJS(env, ConvertDisplayId(configuration.GetItem(ConfigurationInner::APPLICATION_DISPLAYID))); + jsValue = WrapInt32ToJS(env, displayId); SetPropertyValueByPropertyName(env, jsObject, "displayId", jsValue); return jsObject; -- Gitee From 1364a29329f92767a72dffa30550cfc7ba2508b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 10:07:04 +0800 Subject: [PATCH 12/27] add multi-user Signed-off-by: unknown --- .../include/ability_manager_service.h | 9 +--- .../src/ability_manager_service.cpp | 44 +++++-------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 29e2bdd55d3..b70df235cf3 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -713,13 +713,6 @@ public: void OnCallConnectDied(std::shared_ptr callRecord); void GetMaxRestartNum(int &max); bool IsUseNewMission(); - - /** - * wait for starting system ui. - * - */ - void StartSystemUi(const std::string name); - void HandleLoadTimeOut(int64_t eventId); void HandleActiveTimeOut(int64_t eventId); void HandleInactiveTimeOut(int64_t eventId); @@ -1110,7 +1103,7 @@ private: void SwitchToUser(int32_t userId); void StartLauncherAbility(int32_t userId); void SwitchToUser(int32_t oldUserId, int32_t userId); - void SwitchManagers(int32_t userId); + void SwitchManagers(int32_t userId, bool switchUser = true); void StartUserApps(int32_t userId); void StartSystemAbilityByUser(int32_t userId); void PauseOldUser(int32_t userId); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 6ebfa4f4e01..717835b1de1 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -197,7 +197,7 @@ bool AbilityManagerService::Init() kernalAbilityManager_ = std::make_shared(0); CHECK_POINTER_RETURN_BOOL(kernalAbilityManager_); - InitU0User(); + SwitchManagers(U0_USER_ID, false); int amsTimeOut = amsConfigResolver_->GetAMSTimeOutTime(); if (HiviewDFX::Watchdog::GetInstance().AddThread("AMSWatchdog", handler_, amsTimeOut) != 0) { HILOG_ERROR("HiviewDFX::Watchdog::GetInstance AddThread Fail"); @@ -225,16 +225,6 @@ bool AbilityManagerService::Init() return true; } -void AbilityManagerService::InitU0User() -{ - InitConnectManager(U0_USER_ID, false); - InitDataAbilityManager(U0_USER_ID, false); - InitPendWantManager(U0_USER_ID, false); - SetStackManager(U0_USER_ID, false); - InitMissionListManager(U0_USER_ID, false); -} - - void AbilityManagerService::OnStop() { HILOG_INFO("Stop service."); @@ -2591,16 +2581,6 @@ void AbilityManagerService::StartingMmsAbility() } } -void AbilityManagerService::StartSystemUi(const std::string abilityName) -{ - HILOG_INFO("Starting system ui app."); - Want want; - want.SetElementName(AbilityConfig::SYSTEM_UI_BUNDLE_NAME, abilityName); - HILOG_INFO("Ability name: %{public}s.", abilityName.c_str()); - (void)StartAbility(want, USER_ID_DEFAULT, DEFAULT_INVAL_VALUE); - return; -} - int AbilityManagerService::GenerateAbilityRequest( const Want &want, int requestCode, AbilityRequest &request, const sptr &callerToken, int32_t userId) { @@ -3448,11 +3428,12 @@ void AbilityManagerService::StartSystemApplication() if (!amsConfigResolver_ || amsConfigResolver_->NonConfigFile()) { HILOG_INFO("start all"); StartingSystemUiAbility(); + StartingSettingsDataAbility(); return; } + StartingSettingsDataAbility(); StartingSystemUiAbility(); - StartupResidentProcess(); } @@ -3947,14 +3928,14 @@ void AbilityManagerService::SwitchToUser(int32_t oldUserId, int32_t userId) StartUserApps(userId); } -void AbilityManagerService::SwitchManagers(int32_t userId) +void AbilityManagerService::SwitchManagers(int32_t userId, bool switchUser) { HILOG_INFO("%{public}s, SwitchManagers:%{public}d-----begin", __func__, userId); - InitConnectManager(userId, true); - SetStackManager(userId, true); - InitMissionListManager(userId, true); - InitDataAbilityManager(userId, true); - InitPendWantManager(userId, true); + InitConnectManager(userId, switchUser); + SetStackManager(userId, switchUser); + InitMissionListManager(userId, switchUser); + InitDataAbilityManager(userId, switchUser); + InitPendWantManager(userId, switchUser); HILOG_INFO("%{public}s, SwitchManagers:%{public}d-----end", __func__, userId); } @@ -4026,7 +4007,6 @@ void AbilityManagerService::StartSystemAbilityByUser(int32_t userId) if (!amsConfigResolver_ || amsConfigResolver_->NonConfigFile()) { HILOG_INFO("start all"); StartingLauncherAbility(); - StartingSettingsDataAbility(); StartingScreenLockAbility(); return; } @@ -4036,11 +4016,6 @@ void AbilityManagerService::StartSystemAbilityByUser(int32_t userId) StartingLauncherAbility(); } - if (amsConfigResolver_->GetStartSettingsDataState()) { - HILOG_INFO("start settingsdata"); - StartingSettingsDataAbility(); - } - if (amsConfigResolver_->GetStartScreenLockState()) { StartingScreenLockAbility(); } @@ -4127,6 +4102,7 @@ int32_t AbilityManagerService::GetValidUserId(const int32_t userId) } return validUserId; } + int AbilityManagerService::SetAbilityController(const sptr &abilityController, bool imAStabilityTest) { -- Gitee From e270e9d49d512cb6bbecf090ca835d4a2220f24d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 11:25:09 +0800 Subject: [PATCH 13/27] add multi-user Signed-off-by: unknown --- services/abilitymgr/src/kernal_ability_manager.cpp | 5 +++-- services/abilitymgr/src/kernal_system_app_manager.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/services/abilitymgr/src/kernal_ability_manager.cpp b/services/abilitymgr/src/kernal_ability_manager.cpp index b7e65d4c93a..8c5a6476513 100644 --- a/services/abilitymgr/src/kernal_ability_manager.cpp +++ b/services/abilitymgr/src/kernal_ability_manager.cpp @@ -338,11 +338,12 @@ void KernalAbilityManager::OnAbilityDied(std::shared_ptr abilityR abilityRecord->SetAbilityState(AbilityState::INITIAL); auto timeoutTask = [ams, abilityRecord]() { if (abilityRecord) { - ams->StartSystemUi(abilityRecord->GetAbilityInfo().name); + ams->StartingSystemUiAbility(abilityRecord->GetAbilityInfo().name); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); } + void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) { std::lock_guard guard(stackLock_); @@ -372,7 +373,7 @@ void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) }; handler->PostTask(task); auto timeoutTask = [ams, name]() { - ams->StartSystemUi(name); + ams->StartingSystemUiAbility(name); HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); }; handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); diff --git a/services/abilitymgr/src/kernal_system_app_manager.cpp b/services/abilitymgr/src/kernal_system_app_manager.cpp index bf60d6d38db..6addf70fc7c 100644 --- a/services/abilitymgr/src/kernal_system_app_manager.cpp +++ b/services/abilitymgr/src/kernal_system_app_manager.cpp @@ -353,7 +353,7 @@ void KernalSystemAppManager::OnAbilityDied(std::shared_ptr abilit abilityRecord->SetAbilityState(AbilityState::INITIAL); auto timeoutTask = [ams, abilityRecord]() { if (abilityRecord) { - ams->StartSystemUi(abilityRecord->GetAbilityInfo().name); + ams->StartingSystemUiAbility(abilityRecord->GetAbilityInfo().name); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); @@ -387,7 +387,7 @@ void KernalSystemAppManager::OnTimeOut(uint32_t msgId, int64_t eventId) }; handler->PostTask(task); auto timeoutTask = [abilityMS, name]() { - abilityMS->StartSystemUi(name); + abilityMS->StartingSystemUiAbility(name); HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); }; handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); -- Gitee From 5ee5719d414d1183fd51e2f6a04b6d8ccdb419ae Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 11:27:18 +0800 Subject: [PATCH 14/27] add multi-user Signed-off-by: unknown --- services/abilitymgr/src/kernal_ability_manager.cpp | 4 ++-- services/abilitymgr/src/kernal_system_app_manager.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/abilitymgr/src/kernal_ability_manager.cpp b/services/abilitymgr/src/kernal_ability_manager.cpp index 8c5a6476513..09d350e5809 100644 --- a/services/abilitymgr/src/kernal_ability_manager.cpp +++ b/services/abilitymgr/src/kernal_ability_manager.cpp @@ -338,7 +338,7 @@ void KernalAbilityManager::OnAbilityDied(std::shared_ptr abilityR abilityRecord->SetAbilityState(AbilityState::INITIAL); auto timeoutTask = [ams, abilityRecord]() { if (abilityRecord) { - ams->StartingSystemUiAbility(abilityRecord->GetAbilityInfo().name); + ams->StartingSystemUiAbility(); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); @@ -373,7 +373,7 @@ void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) }; handler->PostTask(task); auto timeoutTask = [ams, name]() { - ams->StartingSystemUiAbility(name); + ams->StartingSystemUiAbility(); HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); }; handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); diff --git a/services/abilitymgr/src/kernal_system_app_manager.cpp b/services/abilitymgr/src/kernal_system_app_manager.cpp index 6addf70fc7c..bde48d93fce 100644 --- a/services/abilitymgr/src/kernal_system_app_manager.cpp +++ b/services/abilitymgr/src/kernal_system_app_manager.cpp @@ -353,7 +353,7 @@ void KernalSystemAppManager::OnAbilityDied(std::shared_ptr abilit abilityRecord->SetAbilityState(AbilityState::INITIAL); auto timeoutTask = [ams, abilityRecord]() { if (abilityRecord) { - ams->StartingSystemUiAbility(abilityRecord->GetAbilityInfo().name); + ams->StartingSystemUiAbility(); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); @@ -387,7 +387,7 @@ void KernalSystemAppManager::OnTimeOut(uint32_t msgId, int64_t eventId) }; handler->PostTask(task); auto timeoutTask = [abilityMS, name]() { - abilityMS->StartingSystemUiAbility(name); + abilityMS->StartingSystemUiAbility(); HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); }; handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); -- Gitee From 9fcfdf861f8a1b40c1f3768c715aa34b4a67e166 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 11:50:27 +0800 Subject: [PATCH 15/27] add multi-user Signed-off-by: unknown --- .../abilitymgr/include/ability_manager_service.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index b70df235cf3..f4487b43e28 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -309,6 +309,12 @@ public: virtual int ScheduleConnectAbilityDone( const sptr &token, const sptr &remoteObject) override; + /** + * starting system ui ServiceExt abilites. + * + */ + void StartingSystemUiAbility(); + /** * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected. * @@ -968,12 +974,6 @@ private: */ void StartingContactsAbility(); - /** - * starting system ui ServiceExt abilites. - * - */ - void StartingSystemUiAbility(); - /** * starting mms ability. * -- Gitee From daa3b4ebb4af183264cd23beadd124ecd03616d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 14:19:30 +0800 Subject: [PATCH 16/27] add multi-user Signed-off-by: unknown --- .../abilitymgr/src/kernal_ability_manager.cpp | 24 +++++++++---------- .../src/kernal_system_app_manager.cpp | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/services/abilitymgr/src/kernal_ability_manager.cpp b/services/abilitymgr/src/kernal_ability_manager.cpp index 09d350e5809..65bec598434 100644 --- a/services/abilitymgr/src/kernal_ability_manager.cpp +++ b/services/abilitymgr/src/kernal_ability_manager.cpp @@ -327,18 +327,18 @@ void KernalAbilityManager::OnAbilityDied(std::shared_ptr abilityR HILOG_ERROR("System UI on scheduler died, record is not exist."); return; } - auto ams = DelayedSingleton::GetInstance(); - CHECK_POINTER(ams); + auto abilityms = DelayedSingleton::GetInstance(); + CHECK_POINTER(abilityms); - auto handler = ams->GetEventHandler(); + auto handler = abilityms->GetEventHandler(); CHECK_POINTER(handler); HILOG_INFO("System UI on scheduler died: '%{public}s'", abilityRecord->GetAbilityInfo().name.c_str()); std::string name = abilityRecord->GetAbilityInfo().name; abilityRecord->SetAbilityState(AbilityState::INITIAL); - auto timeoutTask = [ams, abilityRecord]() { + auto timeoutTask = [abilityms, abilityRecord]() { if (abilityRecord) { - ams->StartingSystemUiAbility(); + abilityms->StartingSystemUiAbility(); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); @@ -355,10 +355,10 @@ void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) auto abilityRecord = GetAbilityRecordByEventId(eventId); CHECK_POINTER(abilityRecord); - auto ams = DelayedSingleton::GetInstance(); - CHECK_POINTER(ams); + auto abilityms = DelayedSingleton::GetInstance(); + CHECK_POINTER(abilityms); - auto handler = ams->GetEventHandler(); + auto handler = abilityms->GetEventHandler(); CHECK_POINTER(handler); switch (msgId) { @@ -367,13 +367,13 @@ void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) std::string bundleName = abilityRecord->GetAbilityInfo().bundleName; std::string name = abilityRecord->GetAbilityInfo().name; RemoveAbilityRecord(abilityRecord); - auto task = [ams, bundleName]() { - ams->KillProcess(bundleName); + auto task = [abilityms, bundleName]() { + abilityms->KillProcess(bundleName); HILOG_ERROR("System UI on time out event: KillProcess:%{public}s", bundleName.c_str()); }; handler->PostTask(task); - auto timeoutTask = [ams, name]() { - ams->StartingSystemUiAbility(); + auto timeoutTask = [abilityms, name]() { + abilityms->StartingSystemUiAbility(); HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); }; handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); diff --git a/services/abilitymgr/src/kernal_system_app_manager.cpp b/services/abilitymgr/src/kernal_system_app_manager.cpp index bde48d93fce..76ab01a7c45 100644 --- a/services/abilitymgr/src/kernal_system_app_manager.cpp +++ b/services/abilitymgr/src/kernal_system_app_manager.cpp @@ -342,18 +342,18 @@ void KernalSystemAppManager::OnAbilityDied(std::shared_ptr abilit HILOG_ERROR("System UI on scheduler died, record is not exist."); return; } - auto ams = DelayedSingleton::GetInstance(); - CHECK_POINTER(ams); + auto abilityms = DelayedSingleton::GetInstance(); + CHECK_POINTER(abilityms); - auto handler = ams->GetEventHandler(); + auto handler = abilityms->GetEventHandler(); CHECK_POINTER(handler); HILOG_INFO("System UI on scheduler died: '%{public}s'", abilityRecord->GetAbilityInfo().name.c_str()); std::string name = abilityRecord->GetAbilityInfo().name; abilityRecord->SetAbilityState(AbilityState::INITIAL); - auto timeoutTask = [ams, abilityRecord]() { + auto timeoutTask = [abilityms, abilityRecord]() { if (abilityRecord) { - ams->StartingSystemUiAbility(); + abilityms->StartingSystemUiAbility(); } }; handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); -- Gitee From a0a0579e52b24e36f39795b39e5c4ebdaec3529f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Feb 2022 14:35:33 +0800 Subject: [PATCH 17/27] add multi-user Signed-off-by: unknown --- services/abilitymgr/src/ability_manager_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 717835b1de1..0ac2bb37eb8 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -3427,8 +3427,8 @@ void AbilityManagerService::StartSystemApplication() if (!amsConfigResolver_ || amsConfigResolver_->NonConfigFile()) { HILOG_INFO("start all"); - StartingSystemUiAbility(); StartingSettingsDataAbility(); + StartingSystemUiAbility(); return; } -- Gitee From ad005ef25f8a5872becd607dc0991d75f1870bd9 Mon Sep 17 00:00:00 2001 From: jiangwensai Date: Tue, 22 Feb 2022 08:39:54 +0000 Subject: [PATCH 18/27] IssueNo: # Description: Fix process. Sig: SIG_ApplicationFramework Feature or Bugfix: Bugfix Binary Source: No Signed-off-by: jiangwensai Change-Id: I2795ffee0ad6a7229a6f813df3ba2d9983f785fc --- services/appmgr/include/app_mgr_service_inner.h | 4 ++-- services/appmgr/src/app_mgr_service_inner.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index d71d7e6883d..b0eacee3ace 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -564,7 +564,7 @@ private: bool GetBundleInfo(const std::string &bundelName, BundleInfo &bundleInfo); void MakeProcessName(std::string &processName, const std::shared_ptr &abilityInfo, - const std::shared_ptr &appInfo); + const std::shared_ptr &appInfo, HapModuleInfo &hapModuleInfo); /** * StartAbility, load the ability that needed to be started(Start on the basis of the original process). * Start on a new boot process diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index bd58cc83bca..431d7cbb685 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -111,7 +111,7 @@ void AppMgrServiceInner::LoadAbility(const sptr &token, const spt } std::string processName; - MakeProcessName(processName, abilityInfo, appInfo); + MakeProcessName(processName, abilityInfo, appInfo, hapModuleInfo); APP_LOGI("processName = [%{public}s]", processName.c_str()); auto appRecord = @@ -154,7 +154,7 @@ bool AppMgrServiceInner::CheckLoadabilityConditions(const sptr &t } void AppMgrServiceInner::MakeProcessName(std::string &processName, const std::shared_ptr &abilityInfo, - const std::shared_ptr &appInfo) + const std::shared_ptr &appInfo, HapModuleInfo &hapModuleInfo) { if (!abilityInfo || !appInfo) { return; @@ -167,6 +167,12 @@ void AppMgrServiceInner::MakeProcessName(std::string &processName, const std::sh processName = appInfo->process; return; } + // check after abilityInfo, because abilityInfo contains extension process. + if (hapModuleInfo.isStageBasedModel && !hapModuleInfo.process.empty()) { + processName = hapModuleInfo.process; + APP_LOGI("Stage mode, Make processName:%{public}s", processName.c_str()); + return; + } processName = appInfo->bundleName; } @@ -2080,7 +2086,7 @@ void AppMgrServiceInner::StartSpecifiedAbility(const AAFwk::Want &want, const Ap APP_LOGE("abilityInfoPtr is nullptr."); return; } - MakeProcessName(processName, abilityInfoPtr, appInfo); + MakeProcessName(processName, abilityInfoPtr, appInfo, hapModuleInfo); std::vector hapModules; hapModules.emplace_back(hapModuleInfo); -- Gitee From 0c3ef5937f1428fc328344af4cd2bd5fb6367fa3 Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Thu, 24 Feb 2022 11:11:40 +0800 Subject: [PATCH 19/27] zhongjianfei@huawei.com Signed-off-by: zhongjianfei Change-Id: Ieb501f524ac0a8b822cd275e791c0ce9ab6a4d38 --- .../form_manager/src/form_provider_data.cpp | 22 ++++++++++++++++--- .../form_binding_data/form_binding_data.cpp | 5 ++--- .../abilitymgr/src/ability_manager_proxy.cpp | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/interfaces/innerkits/form_manager/src/form_provider_data.cpp b/interfaces/innerkits/form_manager/src/form_provider_data.cpp index fa5d0a85d5d..66072d55240 100755 --- a/interfaces/innerkits/form_manager/src/form_provider_data.cpp +++ b/interfaces/innerkits/form_manager/src/form_provider_data.cpp @@ -57,7 +57,12 @@ FormProviderData::FormProviderData(std::string jsonDataString) if (jsonDataString.empty()) { jsonDataString = JSON_EMPTY_STRING; } - jsonFormProviderData_ = nlohmann::json::parse(jsonDataString); + nlohmann::json jsonObject = nlohmann::json::parse(jsonDataString, nullptr, false); + if (jsonObject.is_discarded()) { + HILOG_ERROR("failed to parse jsonDataString: %{public}s.", jsonDataString.c_str()); + return; + } + jsonFormProviderData_ = jsonObject; } /** @@ -164,7 +169,12 @@ void FormProviderData::SetDataString(std::string &jsonDataString) if (jsonDataString.empty()) { jsonDataString = JSON_EMPTY_STRING; } - jsonFormProviderData_ = nlohmann::json::parse(jsonDataString); + nlohmann::json jsonObject = nlohmann::json::parse(jsonDataString, nullptr, false); + if (jsonObject.is_discarded()) { + HILOG_ERROR("failed to parse jsonDataString: %{public}s.", jsonDataString.c_str()); + return; + } + jsonFormProviderData_ = jsonObject; } /** * @brief Merge new data to FormProviderData. @@ -230,7 +240,13 @@ void FormProviderData::SetImageDataMap(std::mapTypeOf() == NATIVE_OBJECT) { HILOG_DEBUG("%{public}s called, param type is object.", __func__); napi_env napiEnv = reinterpret_cast(&engine); - napi_value globalValue = nullptr; napi_get_global(napiEnv, &globalValue); napi_value jsonValue; @@ -93,7 +92,7 @@ NativeValue* FormBindingData::OnCreateFormBindingData(NativeEngine& engine, Nati NativeObject* object = ConvertNativeValueTo(objValue); formProviderData_->SetDataString(formDataStr); object->SetProperty("data", CreateJsValue(engine, formDataStr)); - HILOG_INFO("%{public}s called end.", __func__); + HILOG_INFO("%{public}s called:%{public}s", __func__, formDataStr.c_str()); return objValue; } @@ -139,4 +138,4 @@ NativeValue* FormBindingDataInit(NativeEngine* engine, NativeValue* exportObj) return exportObj; } } // namespace AbilityRuntime -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp index 7fa4da4b988..51742b52d33 100644 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -1103,7 +1103,7 @@ bool AbilityManagerProxy::IsFirstInMission(const sptr &token) MessageOption option; if (!WriteInterfaceToken(data)) { - return INNER_ERR; + return false; } if (!data.WriteParcelable(token)) { HILOG_ERROR("token write failed."); -- Gitee From 0aa5be0fa31ae6088074690887945c018c4ba2ed Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Feb 2022 11:22:18 +0800 Subject: [PATCH 20/27] delete page of systemui Signed-off-by: unknown --- services/abilitymgr/abilitymgr.gni | 1 - .../include/ability_manager_service.h | 1 - .../include/kernal_ability_manager.h | 168 ------- .../src/ability_manager_service.cpp | 82 +--- .../abilitymgr/src/kernal_ability_manager.cpp | 420 ------------------ 5 files changed, 4 insertions(+), 668 deletions(-) delete mode 100644 services/abilitymgr/include/kernal_ability_manager.h delete mode 100644 services/abilitymgr/src/kernal_ability_manager.cpp diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index 7813a63a59d..c23b483029c 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -89,7 +89,6 @@ abilityms_files = [ "${services_path}/abilitymgr/src/start_options.cpp", "${services_path}/abilitymgr/src/stop_user_callback_proxy.cpp", "${services_path}/abilitymgr/src/stop_user_callback_stub.cpp", - "${services_path}/abilitymgr/src/kernal_ability_manager.cpp", "${services_path}/abilitymgr/src/call_container.cpp", "${services_path}/abilitymgr/src/call_record.cpp", diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index f4487b43e28..924156aab59 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1166,7 +1166,6 @@ private: bool useNewMission_ {false}; std::unordered_map> missionListManagers_; std::shared_ptr currentMissionListManager_; - std::shared_ptr kernalAbilityManager_; std::shared_ptr userController_; sptr abilityController_ = nullptr; bool controllerIsAStabilityTest_ = false; diff --git a/services/abilitymgr/include/kernal_ability_manager.h b/services/abilitymgr/include/kernal_ability_manager.h deleted file mode 100644 index 950e7ffbb6d..00000000000 --- a/services/abilitymgr/include/kernal_ability_manager.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AAFWK_KERNAL_ABILITY_MANAGER_H -#define OHOS_AAFWK_KERNAL_ABILITY_MANAGER_H - -#include -#include - -#include "ability_record.h" -#include "ability_running_info.h" -#include "want.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class KernalAbilityManager - * KernalAbilityManager provides a facility for managing systerm ability life cycle. - */ -class KernalAbilityManager : public std::enable_shared_from_this { -public: - explicit KernalAbilityManager(int userId); - ~KernalAbilityManager(); - - /** - * init kernal ability manager. - * - */ - void Init(); - /** - * StartAbility with request. - * - * @param abilityRequest, the request of the ability to start. - * @return Returns ERR_OK on success, others on failure. - */ - int StartAbility(const AbilityRequest &abilityRequest); - /** - * attach ability thread ipc object. - * - * @param scheduler, ability thread ipc object. - * @param token, the token of ability. - * @return Returns ERR_OK on success, others on failure. - */ - int AttachAbilityThread(const sptr &scheduler, const sptr &token); - /** - * AbilityTransitionDone, ability call this interface after lift cycle was changed. - * - * @param token,.ability's token. - * @param state,.the state of ability lift cycle. - * @return Returns ERR_OK on success, others on failure. - */ - int AbilityTransitionDone(const sptr &token, int state); - /** - * OnAbilityRequestDone, app manager service call this interface after ability request done. - * - * @param token,ability's token. - * @param state,the state of ability lift cycle. - */ - void OnAbilityRequestDone(const sptr &token, const int32_t state); - - void OnAppStateChanged(const AppInfo &info); - - /** - * get manager's user id. - */ - int GetManagerUserId() const; - - void DumpState(std::vector &info); - - void DumpSysState(std::vector &info, bool isClient); - - void OnAbilityDied(std::shared_ptr abilityRecord); - - void OnTimeOut(uint32_t msgId, int64_t eventId); - - /** - * get the ability record by token. - * - * @return abilityRecord, target ability. - */ - std::shared_ptr GetAbilityRecordByToken(const sptr &token); - - void RestartAbility(const std::shared_ptr abilityRecord); - - void GetAbilityRunningInfos(std::vector &info); - -private: - /** - * StartAbilityLocked. - * - * @param abilityRequest the request of the ability to start. - * @return Returns ERR_OK on success, others on failure. - */ - int StartAbilityLocked(const AbilityRequest &abilityRequest); - /** - * push waitting ability to queue. - * - * @param abilityRequest, the request of ability. - */ - void EnqueueWaittingAbility(const AbilityRequest &abilityRequest); - /** - * pop waitting ability. - * - */ - void DequeueWaittingAbility(); - /** - * get current top ability of stack. - * - * @return top ability record. - */ - std::shared_ptr GetCurrentTopAbility() const; - /** - * get or create the target ability record of system app. - * - * @param abilityRequest, the request of ability. - * @param targetAbility, target ability record. - */ - void GetOrCreateAbilityRecord(const AbilityRequest &abilityRequest, std::shared_ptr &targetAbility); - /** - * get the flag of the target ability record. - * - * @param bundleName, target bundleName. - * @param abilityName, target ability name. - */ - static std::string GetFlagOfAbility(const std::string &bundleName, const std::string &abilityName); - /** - * get the ability record by eventId. - * - * @return abilityRecord, target ability. - */ - std::shared_ptr GetAbilityRecordByEventId(const int64_t eventId) const; - /** - * dispatch ability life cycle . - * - * @param abilityRecord. - * @param state. - */ - int DispatchForeground(const std::shared_ptr &abilityRecord, int state); - /** - * complete ability life cycle . - * - * @param abilityRecord. - */ - void CompleteForeground(const std::shared_ptr &abilityRecord); - - bool RemoveAbilityRecord(std::shared_ptr ability); - -private: - std::recursive_mutex stackLock_; - std::list> abilities_; - std::queue waittingAbilityQueue_; - int userId_; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_AAFWK_KERNAL_ABILITY_MANAGER_H diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 0ac2bb37eb8..7069ae16dd8 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -194,8 +194,6 @@ bool AbilityManagerService::Init() CHECK_POINTER_RETURN_BOOL(systemAppManager_); InitMissionListManager(userId, true); - kernalAbilityManager_ = std::make_shared(0); - CHECK_POINTER_RETURN_BOOL(kernalAbilityManager_); SwitchManagers(U0_USER_ID, false); int amsTimeOut = amsConfigResolver_->GetAMSTimeOutTime(); @@ -339,11 +337,6 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptrStartAbility(abilityRequest); - } - auto missionListManager = GetListManagerByUserId(validUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is nullptr. userId=%{public}d", validUserId); @@ -436,10 +429,6 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett return ERR_WOULD_BLOCK; } if (useNewMission_) { - if (IsSystemUiApp(abilityRequest.abilityInfo)) { - return kernalAbilityManager_->StartAbility(abilityRequest); - } - auto missionListManager = GetListManagerByUserId(validUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); @@ -523,13 +512,6 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); - if (IsSystemUiApp(abilityRequest.abilityInfo)) { - if (useNewMission_) { - return kernalAbilityManager_->StartAbility(abilityRequest); - } else { - return systemAppManager_->StartAbility(abilityRequest); - } - } abilityRequest.want.SetParam(Want::PARAM_RESV_DISPLAY_ID, startOptions.GetDisplayID()); abilityRequest.want.SetParam(Want::PARAM_RESV_WINDOW_MODE, startOptions.GetWindowMode()); if (useNewMission_) { @@ -1722,12 +1704,6 @@ int AbilityManagerService::AttachAbilityThread( return ERR_INVALID_VALUE; } returnCode = dataAbilityManager->AttachAbilityThread(scheduler, token); - } else if (IsSystemUiApp(abilityInfo)) { - if (useNewMission_) { - returnCode = kernalAbilityManager_->AttachAbilityThread(scheduler, token); - } else { - returnCode = systemAppManager_->AttachAbilityThread(scheduler, token); - } } else { if (useNewMission_) { auto missionListManager = GetListManagerByUserId(userId); @@ -1998,11 +1974,7 @@ void AbilityManagerService::DataDumpSysStateInner( void AbilityManagerService::SystemDumpSysStateInner( const std::string& args, std::vector& info, bool isClient, bool isUserID, int userId) { - if (useNewMission_) { - kernalAbilityManager_->DumpSysState(info, isClient); - } else { - systemAppManager_->DumpSysState(info, isClient); - } + systemAppManager_->DumpSysState(info, isClient); } void AbilityManagerService::DumpInner(const std::string &args, std::vector &info) @@ -2226,9 +2198,6 @@ int AbilityManagerService::AbilityTransitionDone(const sptr &toke return dataAbilityManager->AbilityTransitionDone(token, state); } if (useNewMission_) { - if (IsSystemUiApp(abilityInfo)) { - return kernalAbilityManager_->AbilityTransitionDone(token, state); - } auto missionListManager = GetListManagerByUserId(userId); if (!missionListManager) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", userId); @@ -2372,10 +2341,6 @@ void AbilityManagerService::OnAbilityRequestDone(const sptr &toke } default: { if (useNewMission_) { - if (IsSystemUiApp(abilityRecord->GetAbilityInfo())) { - kernalAbilityManager_->OnAbilityRequestDone(token, state); - break; - } auto missionListManager = GetListManagerByUserId(userId); if (!missionListManager) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", userId); @@ -2405,7 +2370,6 @@ void AbilityManagerService::OnAppStateChanged(const AppInfo &info) connectManager_->OnAppStateChanged(info); if (useNewMission_) { currentMissionListManager_->OnAppStateChanged(info); - kernalAbilityManager_->OnAppStateChanged(info); } else { currentStackManager_->OnAppStateChanged(info); systemAppManager_->OnAppStateChanged(info); @@ -2724,11 +2688,6 @@ void AbilityManagerService::OnAbilityDied(std::shared_ptr ability CHECK_POINTER(abilityRecord); if (useNewMission_) { - if (kernalAbilityManager_ && abilityRecord->IsKernalSystemAbility()) { - kernalAbilityManager_->OnAbilityDied(abilityRecord); - return; - } - auto manager = GetListManagerByToken(abilityRecord->GetToken()); if (manager) { manager->OnAbilityDied(abilityRecord, GetUserId()); @@ -2922,9 +2881,6 @@ void AbilityManagerService::HandleLoadTimeOut(int64_t eventId) { HILOG_DEBUG("Handle load timeout."); if (useNewMission_) { - if (kernalAbilityManager_) { - kernalAbilityManager_->OnTimeOut(AbilityManagerService::LOAD_TIMEOUT_MSG, eventId); - } for (auto& item : missionListManagers_) { if (item.second) { item.second->OnTimeOut(AbilityManagerService::LOAD_TIMEOUT_MSG, eventId); @@ -2947,9 +2903,6 @@ void AbilityManagerService::HandleActiveTimeOut(int64_t eventId) HILOG_DEBUG("Handle active timeout."); if (useNewMission_) { - if (kernalAbilityManager_) { - kernalAbilityManager_->OnTimeOut(AbilityManagerService::ACTIVE_TIMEOUT_MSG, eventId); - } for (auto& item : missionListManagers_) { if (item.second) { item.second->OnTimeOut(AbilityManagerService::ACTIVE_TIMEOUT_MSG, eventId); @@ -2989,9 +2942,6 @@ void AbilityManagerService::HandleForegroundNewTimeOut(int64_t eventId) { HILOG_DEBUG("Handle ForegroundNew timeout."); if (useNewMission_) { - if (kernalAbilityManager_) { - kernalAbilityManager_->OnTimeOut(AbilityManagerService::FOREGROUNDNEW_TIMEOUT_MSG, eventId); - } for (auto& item : missionListManagers_) { if (item.second) { item.second->OnTimeOut(AbilityManagerService::FOREGROUNDNEW_TIMEOUT_MSG, eventId); @@ -3013,9 +2963,6 @@ void AbilityManagerService::HandleBackgroundNewTimeOut(int64_t eventId) { HILOG_DEBUG("Handle BackgroundNew timeout."); if (useNewMission_) { - if (kernalAbilityManager_) { - kernalAbilityManager_->OnTimeOut(AbilityManagerService::BACKGROUNDNEW_TIMEOUT_MSG, eventId); - } for (auto& item : missionListManagers_) { if (item.second) { item.second->OnTimeOut(AbilityManagerService::BACKGROUNDNEW_TIMEOUT_MSG, eventId); @@ -3041,7 +2988,6 @@ bool AbilityManagerService::VerificationToken(const sptr &token) CHECK_POINTER_RETURN_BOOL(currentStackManager_); CHECK_POINTER_RETURN_BOOL(systemAppManager_); CHECK_POINTER_RETURN_BOOL(currentMissionListManager_); - CHECK_POINTER_RETURN_BOOL(kernalAbilityManager_); if (useNewMission_) { if (currentMissionListManager_->GetAbilityRecordByToken(token)) { @@ -3068,11 +3014,7 @@ bool AbilityManagerService::VerificationToken(const sptr &token) return true; } - if (useNewMission_) { - if (kernalAbilityManager_->GetAbilityRecordByToken(token)) { - return true; - } - } else { + if (!useNewMission_) { if (systemAppManager_->GetAbilityRecordByToken(token)) { return true; } @@ -3120,11 +3062,7 @@ bool AbilityManagerService::VerificationAllToken(const sptr &toke } } - if (useNewMission_) { - if (kernalAbilityManager_->GetAbilityRecordByToken(token)) { - return true; - } - } else { + if (!useNewMission_) { if (systemAppManager_->GetAbilityRecordByToken(token)) { return true; } @@ -3384,7 +3322,6 @@ void AbilityManagerService::RestartAbility(const sptr &token) { HILOG_INFO("%{public}s called", __func__); CHECK_POINTER(currentStackManager_); - CHECK_POINTER(kernalAbilityManager_); CHECK_POINTER(systemAppManager_); if (!VerificationAllToken(token)) { return; @@ -3394,14 +3331,6 @@ void AbilityManagerService::RestartAbility(const sptr &token) auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE; CHECK_POINTER(abilityRecord); - if (IsSystemUiApp(abilityRecord->GetAbilityInfo())) { - if (useNewMission_) { - kernalAbilityManager_->RestartAbility(abilityRecord); - } else { - systemAppManager_->RestartAbility(abilityRecord); - } - return; - } auto stackManager = GetStackManagerByUserId(userId); if (!stackManager) { HILOG_ERROR("stackManager is nullptr. userId=%{public}d", userId); @@ -3580,10 +3509,8 @@ void AbilityManagerService::StartingSettingsDataAbility() Want want; want.SetElementName(AbilityConfig::SETTINGS_DATA_BUNDLE_NAME, AbilityConfig::SETTINGS_DATA_ABILITY_NAME); uint32_t waitCnt = 0; - // Wait 5 minutes for the installation to complete. - auto userId = GetUserId(); while (!iBundleManager_->QueryAbilityInfo(want, OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, - userId, abilityInfo) && waitCnt < MAX_WAIT_SETTINGS_DATA_NUM) { + U0_USER_ID, abilityInfo) && waitCnt < MAX_WAIT_SETTINGS_DATA_NUM) { HILOG_INFO("Waiting query settings data info completed."); usleep(REPOLL_TIME_MICRO_SECONDS); waitCnt++; @@ -3805,7 +3732,6 @@ int AbilityManagerService::GetAbilityRunningInfos(std::vectorGetAbilityRunningInfos(info); - kernalAbilityManager_->GetAbilityRunningInfos(info); connectManager_->GetAbilityRunningInfos(info); dataAbilityManager_->GetAbilityRunningInfos(info); diff --git a/services/abilitymgr/src/kernal_ability_manager.cpp b/services/abilitymgr/src/kernal_ability_manager.cpp deleted file mode 100644 index 65bec598434..00000000000 --- a/services/abilitymgr/src/kernal_ability_manager.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "kernal_ability_manager.h" - -#include "ability_manager_errors.h" -#include "ability_manager_service.h" -#include "ability_util.h" -#include "app_scheduler.h" -#include "hilog_wrapper.h" - -namespace OHOS { -namespace AAFwk { -KernalAbilityManager::KernalAbilityManager(int userId) : userId_(userId) -{} - -KernalAbilityManager::~KernalAbilityManager() -{} - -int KernalAbilityManager::StartAbility(const AbilityRequest &abilityRequest) -{ - HILOG_INFO("start kernal systerm ability."); - std::lock_guard guard(stackLock_); - if (!waittingAbilityQueue_.empty()) { - HILOG_INFO("waiting queue is not empty, so enqueue systerm ui ability for waiting."); - EnqueueWaittingAbility(abilityRequest); - return START_ABILITY_WAITING; - } - - std::shared_ptr topAbilityRecord = GetCurrentTopAbility(); - auto requestFlag = GetFlagOfAbility(abilityRequest.abilityInfo.bundleName, abilityRequest.abilityInfo.name); - if (topAbilityRecord != nullptr) { - auto topFlag = - GetFlagOfAbility(topAbilityRecord->GetAbilityInfo().bundleName, topAbilityRecord->GetAbilityInfo().name); - if (topFlag == requestFlag && topAbilityRecord->GetAbilityState() == INITIAL) { - HILOG_INFO("top systerm ui ability need to restart."); - } - if (topAbilityRecord->GetAbilityState() == FOREGROUNDING_NEW) { - HILOG_INFO("top systerm ui ability is not foreground, so enqueue ability for waiting."); - EnqueueWaittingAbility(abilityRequest); - return START_ABILITY_WAITING; - } - } - - return StartAbilityLocked(abilityRequest); -} - -int KernalAbilityManager::StartAbilityLocked(const AbilityRequest &abilityRequest) -{ - std::shared_ptr targetAbility; - GetOrCreateAbilityRecord(abilityRequest, targetAbility); - CHECK_POINTER_AND_RETURN(targetAbility, ERR_INVALID_VALUE); - targetAbility->SetKernalSystemAbility(); - - HILOG_INFO("Load kernal system ability, bundleName:%{public}s , abilityName:%{public}s", - abilityRequest.abilityInfo.bundleName.c_str(), - abilityRequest.abilityInfo.name.c_str()); - - if (targetAbility->IsAbilityState(AbilityState::FOREGROUND_NEW) || - targetAbility->IsAbilityState(AbilityState::FOREGROUNDING_NEW)) { - HILOG_INFO("kernal system ability is already activing or activated."); - targetAbility->ForegroundAbility(); - return ERR_OK; - } - return targetAbility->LoadAbility(); -} - -int KernalAbilityManager::AttachAbilityThread( - const sptr &scheduler, const sptr &token) -{ - HILOG_INFO("Attach ability thread."); - std::lock_guard guard(stackLock_); - auto abilityRecord = GetAbilityRecordByToken(token); - CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE); - - std::string flag = KernalAbilityManager::GetFlagOfAbility( - abilityRecord->GetAbilityInfo().bundleName, abilityRecord->GetAbilityInfo().name); - HILOG_INFO("ability: %{public}s", flag.c_str()); - - auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); - CHECK_POINTER_AND_RETURN(handler, ERR_INVALID_VALUE); - - handler->RemoveEvent(AbilityManagerService::LOAD_TIMEOUT_MSG, abilityRecord->GetEventId()); - - abilityRecord->SetScheduler(scheduler); - DelayedSingleton::GetInstance()->MoveToForground(token); - - return ERR_OK; -} - -void KernalAbilityManager::OnAbilityRequestDone(const sptr &token, const int32_t state) -{ - HILOG_INFO("On ability request done."); - std::lock_guard guard(stackLock_); - AppAbilityState abilitState = DelayedSingleton::GetInstance()->ConvertToAppAbilityState(state); - if (abilitState == AppAbilityState::ABILITY_STATE_FOREGROUND) { - auto abilityRecord = GetAbilityRecordByToken(token); - CHECK_POINTER(abilityRecord); - abilityRecord->ForegroundAbility(); - } -} - -void KernalAbilityManager::OnAppStateChanged(const AppInfo &info) -{ - std::lock_guard guard(stackLock_); - for (auto ability : abilities_) { - if (ability && (info.processName == ability->GetAbilityInfo().process || - info.processName == ability->GetApplicationInfo().bundleName)) { - auto appName = ability->GetApplicationInfo().name; - auto isExist = [&appName](const AppData &appData) { return appData.appName == appName; }; - auto iter = std::find_if(info.appData.begin(), info.appData.end(), isExist); - if (iter != info.appData.end()) { - ability->SetAppState(info.state); - } - } - } -} - -int KernalAbilityManager::AbilityTransitionDone(const sptr &token, int state) -{ - HILOG_INFO("Ability transition done."); - std::lock_guard guard(stackLock_); - auto abilityRecord = GetAbilityRecordByToken(token); - CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE); - - std::string flag = KernalAbilityManager::GetFlagOfAbility( - abilityRecord->GetAbilityInfo().bundleName, abilityRecord->GetAbilityInfo().name); - int targetState = AbilityRecord::ConvertLifeCycleToAbilityState(static_cast(state)); - std::string abilityState = AbilityRecord::ConvertAbilityState(static_cast(targetState)); - HILOG_INFO("ability: %{public}s, state: %{public}s", flag.c_str(), abilityState.c_str()); - - switch (targetState) { - case AbilityState::FOREGROUND_NEW: { - return DispatchForeground(abilityRecord, targetState); - } - default: { - HILOG_WARN("don't support transiting state: %d", targetState); - return ERR_INVALID_VALUE; - } - } -} - -int KernalAbilityManager::DispatchForeground(const std::shared_ptr &abilityRecord, int state) -{ - auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); - CHECK_POINTER_AND_RETURN(handler, ERR_INVALID_VALUE); - CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE); - - if (!abilityRecord->IsAbilityState(AbilityState::FOREGROUNDING_NEW)) { - HILOG_ERROR("kernal ability transition life state error. start:%{public}d", state); - return ERR_INVALID_VALUE; - } - handler->RemoveEvent(AbilityManagerService::FOREGROUNDNEW_TIMEOUT_MSG, abilityRecord->GetEventId()); - - auto task = [kernalManager = shared_from_this(), abilityRecord]() { - kernalManager->CompleteForeground(abilityRecord); - }; - handler->PostTask(task); - return ERR_OK; -} - -void KernalAbilityManager::CompleteForeground(const std::shared_ptr &abilityRecord) -{ - HILOG_INFO("Complete foreground."); - std::lock_guard guard(stackLock_); - abilityRecord->SetAbilityState(AbilityState::FOREGROUND_NEW); - - auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); - CHECK_POINTER(handler); - - auto task = [kernalManager = shared_from_this()]() { kernalManager->DequeueWaittingAbility(); }; - handler->PostTask(task, "DequeueWaittingAbility"); -} - -void KernalAbilityManager::GetOrCreateAbilityRecord( - const AbilityRequest &abilityRequest, std::shared_ptr &targetAbility) -{ - std::string abilityFlag = - KernalAbilityManager::GetFlagOfAbility(abilityRequest.abilityInfo.bundleName, abilityRequest.abilityInfo.name); - auto isExist = [targetFlag = abilityFlag](const std::shared_ptr &ability) { - if (ability == nullptr) { - return false; - } - return KernalAbilityManager::GetFlagOfAbility(ability->GetAbilityInfo().bundleName, - ability->GetAbilityInfo().name) == targetFlag; - }; - auto iter = std::find_if(abilities_.begin(), abilities_.end(), isExist); - if (iter != abilities_.end()) { - targetAbility = *iter; - targetAbility->SetWant(abilityRequest.want); - targetAbility->SetIsNewWant(true); - return; - } - targetAbility = AbilityRecord::CreateAbilityRecord(abilityRequest); - targetAbility->SetUseNewMission(); - abilities_.push_front(targetAbility); -} - -std::string KernalAbilityManager::GetFlagOfAbility(const std::string &bundleName, const std::string &abilityName) -{ - return bundleName + ":" + abilityName; -} - -int KernalAbilityManager::GetManagerUserId() const -{ - return userId_; -} - -std::shared_ptr KernalAbilityManager::GetCurrentTopAbility() const -{ - if (abilities_.empty()) { - return nullptr; - } - return abilities_.front(); -} - -std::shared_ptr KernalAbilityManager::GetAbilityRecordByToken(const sptr &token) -{ - std::lock_guard guard(stackLock_); - auto abilityToFind = Token::GetAbilityRecordByToken(token); - CHECK_POINTER_AND_RETURN(abilityToFind, nullptr); - - auto isExist = [targetAbility = abilityToFind](const std::shared_ptr &ability) { - if (ability == nullptr) { - return false; - } - return targetAbility == ability; - }; - auto iter = std::find_if(abilities_.begin(), abilities_.end(), isExist); - if (iter != abilities_.end()) { - return *iter; - } - - return nullptr; -} - -std::shared_ptr KernalAbilityManager::GetAbilityRecordByEventId(const int64_t eventId) const -{ - auto isExist = [targetEventId = eventId](const std::shared_ptr &ability) { - if (ability == nullptr) { - return false; - } - return (ability->GetEventId() == targetEventId); - }; - auto iter = std::find_if(abilities_.begin(), abilities_.end(), isExist); - if (iter != abilities_.end()) { - return *iter; - } - return nullptr; -} - -bool KernalAbilityManager::RemoveAbilityRecord(std::shared_ptr ability) -{ - CHECK_POINTER_RETURN_BOOL(ability); - for (auto iter = abilities_.begin(); iter != abilities_.end(); iter++) { - if ((*iter) == ability) { - abilities_.erase(iter); - return true; - } - } - HILOG_ERROR("can not find ability"); - return false; -} - -void KernalAbilityManager::EnqueueWaittingAbility(const AbilityRequest &abilityRequest) -{ - waittingAbilityQueue_.push(abilityRequest); - return; -} - -void KernalAbilityManager::DequeueWaittingAbility() -{ - std::lock_guard guard(stackLock_); - std::shared_ptr topAbility = GetCurrentTopAbility(); - if (topAbility != nullptr && topAbility->GetAbilityState() != FOREGROUND_NEW) { - HILOG_INFO("top ability is not foreground, must return for waiting again"); - return; - } - if (!waittingAbilityQueue_.empty()) { - AbilityRequest abilityRequest = waittingAbilityQueue_.front(); - waittingAbilityQueue_.pop(); - HILOG_INFO("bundleName: %{public}s, abilityName: %{public}s", - abilityRequest.abilityInfo.bundleName.c_str(), - abilityRequest.abilityInfo.name.c_str()); - - StartAbilityLocked(abilityRequest); - } -} -void KernalAbilityManager::DumpState(std::vector &info) -{ - info.emplace_back("SystemUIRecords:"); - for (auto &ability : abilities_) { - ability->Dump(info); - } -} - -void KernalAbilityManager::DumpSysState(std::vector& info, bool isClient) -{ - info.emplace_back("SystemUIRecords:"); - for (auto &ability : abilities_) { - ability->DumpSys(info, isClient); - } -} - -void KernalAbilityManager::OnAbilityDied(std::shared_ptr abilityRecord) -{ - std::lock_guard guard(stackLock_); - CHECK_POINTER(abilityRecord); - if (!abilityRecord->IsKernalSystemAbility()) { - HILOG_ERROR("System UI on scheduler died, ability type is not system ui"); - return; - } - - if (GetAbilityRecordByToken(abilityRecord->GetToken()) == nullptr) { - HILOG_ERROR("System UI on scheduler died, record is not exist."); - return; - } - auto abilityms = DelayedSingleton::GetInstance(); - CHECK_POINTER(abilityms); - - auto handler = abilityms->GetEventHandler(); - CHECK_POINTER(handler); - - HILOG_INFO("System UI on scheduler died: '%{public}s'", abilityRecord->GetAbilityInfo().name.c_str()); - std::string name = abilityRecord->GetAbilityInfo().name; - abilityRecord->SetAbilityState(AbilityState::INITIAL); - auto timeoutTask = [abilityms, abilityRecord]() { - if (abilityRecord) { - abilityms->StartingSystemUiAbility(); - } - }; - handler->PostTask(timeoutTask, "SystemUi_Die_" + name, AbilityManagerService::RESTART_TIMEOUT); -} - -void KernalAbilityManager::OnTimeOut(uint32_t msgId, int64_t eventId) -{ - std::lock_guard guard(stackLock_); - if (abilities_.empty()) { - HILOG_ERROR("System UI on time out event: ability stack is empty."); - return; - } - - auto abilityRecord = GetAbilityRecordByEventId(eventId); - CHECK_POINTER(abilityRecord); - - auto abilityms = DelayedSingleton::GetInstance(); - CHECK_POINTER(abilityms); - - auto handler = abilityms->GetEventHandler(); - CHECK_POINTER(handler); - - switch (msgId) { - case AbilityManagerService::LOAD_TIMEOUT_MSG: - case AbilityManagerService::FOREGROUNDNEW_TIMEOUT_MSG: { - std::string bundleName = abilityRecord->GetAbilityInfo().bundleName; - std::string name = abilityRecord->GetAbilityInfo().name; - RemoveAbilityRecord(abilityRecord); - auto task = [abilityms, bundleName]() { - abilityms->KillProcess(bundleName); - HILOG_ERROR("System UI on time out event: KillProcess:%{public}s", bundleName.c_str()); - }; - handler->PostTask(task); - auto timeoutTask = [abilityms, name]() { - abilityms->StartingSystemUiAbility(); - HILOG_ERROR("System UI on time out event: restart:%{public}s", name.c_str()); - }; - handler->PostTask(timeoutTask, "SystemUi_Timeout_" + name, AbilityManagerService::RESTART_TIMEOUT); - break; - } - default: - break; - } -} - -void KernalAbilityManager::GetAbilityRunningInfos(std::vector &info) -{ - HILOG_DEBUG("Get ability running infos"); - std::lock_guard guard(stackLock_); - - for (auto &ability : abilities_) { - if (!ability) { - HILOG_DEBUG("ability is nullptr."); - continue; - } - - AbilityRunningInfo runningInfo; - AppExecFwk::RunningProcessInfo processInfo; - runningInfo.ability = ability->GetWant().GetElement(); - DelayedSingleton::GetInstance()-> - GetRunningProcessInfoByToken(ability->GetToken(), processInfo); - runningInfo.pid = processInfo.pid_; - runningInfo.uid = processInfo.uid_; - runningInfo.processName = processInfo.processName_; - runningInfo.startTime = ability->GetStartTime(); - runningInfo.abilityState = static_cast(ability->GetAbilityState()); - info.emplace_back(runningInfo); - } -} - - -void KernalAbilityManager::RestartAbility(const std::shared_ptr abilityRecord) -{ - CHECK_POINTER(abilityRecord); - HILOG_DEBUG("Restart ability system ui. %{public}s", abilityRecord->GetAbilityInfo().name.c_str()); - return; -} -} // namespace AAFwk -} // namespace OHOS \ No newline at end of file -- Gitee From 1a34936faac37727408392f6cc9ec38cb3ff8e32 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Feb 2022 14:21:57 +0800 Subject: [PATCH 21/27] add multi-user Signed-off-by: unknown --- services/abilitymgr/include/ability_manager_service.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 924156aab59..54ac8d7d97c 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -31,7 +31,6 @@ #include "data_ability_manager.h" #include "hilog_wrapper.h" #include "iremote_object.h" -#include "kernal_ability_manager.h" #include "kernal_system_app_manager.h" #include "mission_list_manager.h" #include "system_ability.h" -- Gitee From dbe91e4e0dc38351340fe7b16340aa11e77b40f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Feb 2022 14:39:23 +0800 Subject: [PATCH 22/27] add multi-user Signed-off-by: unknown --- services/abilitymgr/test/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/services/abilitymgr/test/BUILD.gn b/services/abilitymgr/test/BUILD.gn index 1309622385f..b048a156ae3 100644 --- a/services/abilitymgr/test/BUILD.gn +++ b/services/abilitymgr/test/BUILD.gn @@ -43,7 +43,6 @@ ohos_source_set("abilityms_test_source") { "${services_path}/abilitymgr/src/data_ability_record.cpp", "${services_path}/abilitymgr/src/image_info.cpp", "${services_path}/abilitymgr/src/inner_mission_info.cpp", - "${services_path}/abilitymgr/src/kernal_ability_manager.cpp", "${services_path}/abilitymgr/src/kernal_system_app_manager.cpp", "${services_path}/abilitymgr/src/launch_param.cpp", "${services_path}/abilitymgr/src/lifecycle_deal.cpp", -- Gitee From 7e1d21226b005eb1dbde3bae24e54c22b093d1a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Feb 2022 15:19:49 +0800 Subject: [PATCH 23/27] add flags Signed-off-by: unknown --- .../test/unittest/phone/ability_dump_test/ability_dump_test.cpp | 1 - .../ability_manager_service_test.cpp | 1 - .../ability_with_applications_test.cpp | 1 - .../test/unittest/phone/lifecycle_test/lifecycle_test.cpp | 1 - .../phone/terminate_ability_test/terminate_ability_test.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp b/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp index 76af83ccb3d..0fa75e58c25 100644 --- a/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_dump_test/ability_dump_test.cpp @@ -139,7 +139,6 @@ void AbilityDumpTest::OnStartAms() EXPECT_TRUE(g_abilityMs->amsConfigResolver_); g_abilityMs->amsConfigResolver_->Parse(); - g_abilityMs->kernalAbilityManager_ = std::make_shared(0); g_abilityMs->currentMissionListManager_ = std::make_shared(0); g_abilityMs->currentMissionListManager_->Init(); diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp b/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp index 827759c8945..6a0eb76d93e 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp @@ -143,7 +143,6 @@ void AbilityManagerServiceTest::OnStartAms() abilityMs_->pendingWantManager_ = std::make_shared(); EXPECT_TRUE(abilityMs_->pendingWantManager_); - abilityMs_->kernalAbilityManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_->Init(); int userId = abilityMs_->GetUserId(); diff --git a/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp b/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp index 80519e87c57..8f43d105079 100644 --- a/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_with_applications_test/ability_with_applications_test.cpp @@ -111,7 +111,6 @@ void AbilityWithApplicationsTest::OnStartabilityAms() abilityMs_->pendingWantManager_ = std::make_shared(); EXPECT_TRUE(abilityMs_->pendingWantManager_); - abilityMs_->kernalAbilityManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_->Init(); diff --git a/services/abilitymgr/test/unittest/phone/lifecycle_test/lifecycle_test.cpp b/services/abilitymgr/test/unittest/phone/lifecycle_test/lifecycle_test.cpp index 26defef799b..caba94dd3fd 100644 --- a/services/abilitymgr/test/unittest/phone/lifecycle_test/lifecycle_test.cpp +++ b/services/abilitymgr/test/unittest/phone/lifecycle_test/lifecycle_test.cpp @@ -112,7 +112,6 @@ void LifecycleTest::OnStartabilityAms() abilityMs_->amsConfigResolver_ = std::make_shared(); EXPECT_TRUE(abilityMs_->amsConfigResolver_); abilityMs_->amsConfigResolver_->Parse(); - abilityMs_->kernalAbilityManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_ = std::make_shared(0); abilityMs_->currentMissionListManager_->Init(); abilityMs_->pendingWantManager_ = std::make_shared(); diff --git a/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp b/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp index 99efb369051..cbfeec4338f 100644 --- a/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp +++ b/services/abilitymgr/test/unittest/phone/terminate_ability_test/terminate_ability_test.cpp @@ -155,7 +155,6 @@ void TerminateAbilityTest::OnStartAms() g_aams->pendingWantManager_ = std::make_shared(); EXPECT_TRUE(g_aams->pendingWantManager_); - g_aams->kernalAbilityManager_ = std::make_shared(0); g_aams->currentMissionListManager_ = std::make_shared(0); g_aams->currentMissionListManager_->Init(); -- Gitee From 4220a3216e22eb4641468623c4ad8e37b5684905 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Feb 2022 15:49:00 +0800 Subject: [PATCH 24/27] add flag Signed-off-by: unknown --- .../ability_mgr_service_test/ability_mgr_module_test.cpp | 1 - .../moduletest/ability_stack_test/ability_stack_module_test.cpp | 1 - services/test/moduletest/dump_module_test/dump_module_test.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp index f2d99cc39dc..c6e97ec5551 100644 --- a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp +++ b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp @@ -185,7 +185,6 @@ static void OnStartAms() EXPECT_TRUE(AbilityMgrModuleTest::abilityMgrServ_->amsConfigResolver_); AbilityMgrModuleTest::abilityMgrServ_->amsConfigResolver_->Parse(); - AbilityMgrModuleTest::abilityMgrServ_->kernalAbilityManager_ = std::make_shared(0); AbilityMgrModuleTest::abilityMgrServ_->currentMissionListManager_ = std::make_shared(0); AbilityMgrModuleTest::abilityMgrServ_->currentMissionListManager_->Init(); diff --git a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp index 058e3d37302..666c937d822 100644 --- a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp +++ b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp @@ -90,7 +90,6 @@ void AbilityStackModuleTest::OnStartabilityMs(std::shared_ptramsConfigResolver_ = std::make_shared(); EXPECT_TRUE(abilityMs->amsConfigResolver_); abilityMs->amsConfigResolver_->Parse(); - abilityMs->kernalAbilityManager_ = std::make_shared(0); abilityMs->currentMissionListManager_ = std::make_shared(0); abilityMs->currentMissionListManager_->Init(); abilityMs->pendingWantManager_ = std::make_shared(); diff --git a/services/test/moduletest/dump_module_test/dump_module_test.cpp b/services/test/moduletest/dump_module_test/dump_module_test.cpp index 16ff93d01a5..85d1448ceed 100644 --- a/services/test/moduletest/dump_module_test/dump_module_test.cpp +++ b/services/test/moduletest/dump_module_test/dump_module_test.cpp @@ -136,7 +136,6 @@ void DumpModuleTest::OnStartAms() g_abilityMs->dataAbilityManagers_.emplace(0, g_abilityMs->dataAbilityManager_); EXPECT_TRUE(g_abilityMs->dataAbilityManager_); - g_abilityMs->kernalAbilityManager_ = std::make_shared(0); g_abilityMs->currentMissionListManager_ = std::make_shared(0); g_abilityMs->currentMissionListManager_->Init(); g_abilityMs->pendingWantManager_ = std::make_shared(); -- Gitee From c7f588c82ea96dc0e678e60334a64522e96223dd Mon Sep 17 00:00:00 2001 From: jiangwensai Date: Wed, 23 Feb 2022 07:23:32 +0000 Subject: [PATCH 25/27] IssueNo: #I4UXOJ Description: delete API8 check. Sig: SIG_ApplicationFramework Feature or Bugfix: Bugfix Binary Source: No Signed-off-by: jiangwensai Change-Id: I4b5fc04e0572cf039a431b505d05e0580952cc02 --- .../src/ability_manager_service.cpp | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 7069ae16dd8..acc83574cc3 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -65,7 +65,6 @@ static const int EXPERIENCE_MEM_THRESHOLD = 20; constexpr auto DATA_ABILITY_START_TIMEOUT = 5s; constexpr int32_t NON_ANONYMIZE_LENGTH = 6; constexpr uint32_t SCENE_FLAG_NORMAL = 0; -const int32_t EXTENSION_SUPPORT_API_VERSION = 8; const int32_t MAX_NUMBER_OF_DISTRIBUTED_MISSIONS = 20; const int32_t MAX_NUMBER_OF_CONNECT_BMS = 15; const std::string EMPTY_DEVICE_ID = ""; @@ -2570,20 +2569,11 @@ int AbilityManagerService::GenerateAbilityRequest( return RESOLVE_ABILITY_ERR; } } - HILOG_DEBUG("Query ability name: %{public}s,", request.abilityInfo.name.c_str()); - if (request.abilityInfo.type == AppExecFwk::AbilityType::SERVICE) { - AppExecFwk::BundleInfo bundleInfo; - bool ret = bms->GetBundleInfo(request.abilityInfo.bundleName, - AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, userId); - if (!ret) { - HILOG_ERROR("Failed to get bundle info when GenerateAbilityRequest."); - return RESOLVE_ABILITY_ERR; - } - HILOG_INFO("bundleInfo.compatibleVersion:%{public}d", bundleInfo.compatibleVersion); - if (bundleInfo.compatibleVersion >= EXTENSION_SUPPORT_API_VERSION) { - HILOG_INFO("abilityInfo reset EXTENSION."); - request.abilityInfo.type = AppExecFwk::AbilityType::EXTENSION; - } + HILOG_DEBUG("Query ability name: %{public}s, is stage mode: %{public}d", + request.abilityInfo.name.c_str(), request.abilityInfo.isStageBasedModel); + if (request.abilityInfo.type == AppExecFwk::AbilityType::SERVICE && request.abilityInfo.isStageBasedModel) { + HILOG_INFO("stage mode, abilityInfo SERVICE type reset EXTENSION."); + request.abilityInfo.type = AppExecFwk::AbilityType::EXTENSION; } auto appName = request.abilityInfo.applicationInfo.name; -- Gitee From d96698729f5989d33d16d774d7c91f2d49c74548 Mon Sep 17 00:00:00 2001 From: liweifeng Date: Thu, 24 Feb 2022 15:30:32 +0800 Subject: [PATCH 26/27] adapt module source dir Signed-off-by: liweifeng Change-Id: I0aba0a7c5cb00e9ea2073942be0b4ddcba7b22ad --- interfaces/innerkits/form_manager/include/form_constants.h | 3 +++ services/formmgr/src/form_mgr_adapter.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interfaces/innerkits/form_manager/include/form_constants.h b/interfaces/innerkits/form_manager/include/form_constants.h index 796d214f81f..51a1fd8269b 100644 --- a/interfaces/innerkits/form_manager/include/form_constants.h +++ b/interfaces/innerkits/form_manager/include/form_constants.h @@ -44,6 +44,9 @@ namespace Constants { const std::string ACTION_UPDATEATTIMER = "form_update_at_timer"; const std::string KEY_WAKEUP_TIME = "wakeUpTime"; const std::string KEY_ACTION_TYPE = "form_update_action_type"; + const std::string ABS_CODE_PATH = "/data/app/el1/bundle/public"; + const std::string LOCAL_CODE_PATH = "/data/storage/el1/bundle"; + const std::string LOCAL_BUNDLES = "/data/bundles"; const int TYPE_RESET_LIMIT = 1; const int TYPE_STATIC_UPDATE = 2; const int TYPE_DYNAMIC_UPDATE = 3; diff --git a/services/formmgr/src/form_mgr_adapter.cpp b/services/formmgr/src/form_mgr_adapter.cpp index ed8dd2c6584..1534979cd21 100644 --- a/services/formmgr/src/form_mgr_adapter.cpp +++ b/services/formmgr/src/form_mgr_adapter.cpp @@ -14,6 +14,7 @@ */ #include +#include #include "appexecfwk_errors.h" #include "app_log_wrapper.h" @@ -1209,7 +1210,9 @@ ErrCode FormMgrAdapter::CreateFormItemInfo(const BundleInfo &bundleInfo, if (formInfo.moduleName == item.moduleName) { itemInfo.AddHapSourceDirs(item.moduleSourceDir); } - itemInfo.AddModuleInfo(item.moduleName, item.moduleSourceDir); + auto moduleSourceDir = std::regex_replace(item.moduleSourceDir, std::regex(Constants::ABS_CODE_PATH), + Constants::LOCAL_BUNDLES); + itemInfo.AddModuleInfo(item.moduleName, moduleSourceDir); } return ERR_OK; } @@ -1247,7 +1250,7 @@ int FormMgrAdapter::SetNextRefreshTime(const int64_t formId, const int64_t nextT APP_LOGE("%{public}s, not self form:%{public}" PRId64 "", __func__, formId); return ERR_APPEXECFWK_FORM_OPERATION_NOT_SELF; } - + // check bundleName if (bundleName != formRecord.bundleName) { APP_LOGE("%{public}s, not match bundleName:%{public}s", __func__, bundleName.c_str()); -- Gitee From 4b2aaff19145e04a8c381a62c44b3ff84954e09b Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Thu, 24 Feb 2022 23:30:11 +0800 Subject: [PATCH 27/27] zhongjianfei@huawei.com Signed-off-by: zhongjianfei Change-Id: I9e34ae441b26ee502f8b6e47c2a05ea44aa36013 --- interfaces/innerkits/runtime/include/js_runtime_utils.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/interfaces/innerkits/runtime/include/js_runtime_utils.h b/interfaces/innerkits/runtime/include/js_runtime_utils.h index 047fe42ea45..85fb368679d 100644 --- a/interfaces/innerkits/runtime/include/js_runtime_utils.h +++ b/interfaces/innerkits/runtime/include/js_runtime_utils.h @@ -81,9 +81,11 @@ inline bool ConvertFromJsValue(NativeEngine& engine, NativeValue* jsValue, T& va if (stringValue == nullptr) { return false; } - size_t len = stringValue->GetLength(); - value.resize(len); - stringValue->GetCString(value.data(), len, &len); + size_t len = stringValue->GetLength() + 1; + auto buffer = std::make_unique(len); + size_t strLength = 0; + stringValue->GetCString(buffer.get(), len, &strLength); + value = buffer.get(); return true; } else if constexpr (std::is_enum_v) { auto numberValue = ConvertNativeValueTo(jsValue); -- Gitee