mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
feat: add StartSelfUIAbilityWithPidResult
Signed-off-by: Nathan Yang <yangxuguang3@huawei.com>
This commit is contained in:
@@ -49,6 +49,7 @@ ohos_shared_library("ability_runtime") {
|
||||
sources = [
|
||||
"src/ability_business_error_utils.cpp",
|
||||
"src/application_context.cpp",
|
||||
"src/load_ability_callback_impl.cpp",
|
||||
"src/start_options.cpp",
|
||||
"src/start_options_impl.cpp",
|
||||
"src/want_utils.cpp",
|
||||
@@ -59,6 +60,7 @@ ohos_shared_library("ability_runtime") {
|
||||
"${ability_runtime_innerkits_path}/ability_manager:ability_start_options",
|
||||
"${ability_runtime_innerkits_path}/ability_manager:process_options",
|
||||
"${ability_runtime_innerkits_path}/ability_manager:start_window_option",
|
||||
"${ability_runtime_innerkits_path}/app_manager:app_manager",
|
||||
"${ability_runtime_native_path}/appkit:app_context",
|
||||
]
|
||||
|
||||
@@ -66,11 +68,13 @@ ohos_shared_library("ability_runtime") {
|
||||
"ability_base:ability_base_want",
|
||||
"ability_base:want",
|
||||
"c_utils:utils",
|
||||
"ffrt:libffrt",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image_native",
|
||||
"image_framework:pixelmap",
|
||||
"ipc:ipc_core",
|
||||
"napi:ace_napi",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToCommonBusinessErrorCode(int32_t abilityManagerErrorCode);
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToAPI18BusinessErrorCode(int32_t abilityManagerErrorCode);
|
||||
AbilityRuntime_ErrorCode ConvertToAPI17BusinessErrorCode(int32_t abilityManagerErrorCode);
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToAPI21BusinessErrorCode(int32_t abilityManagerErrorCode);
|
||||
|
||||
#endif // ABILITY_RUNTIME_ABILITY_BUSINESS_ERROR_UTILS_H
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_IMPL_H
|
||||
#define ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_IMPL_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "ffrt.h"
|
||||
#include "load_ability_callback_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
using OHOS::AppExecFwk::LoadAbilityCallbackStub;
|
||||
using OnFinishTask = std::function<void(int32_t)>;
|
||||
class LoadAbilityCallbackImpl : public LoadAbilityCallbackStub {
|
||||
public:
|
||||
explicit LoadAbilityCallbackImpl(OnFinishTask &&task) : task_(task) {}
|
||||
virtual ~LoadAbilityCallbackImpl() = default;
|
||||
|
||||
/**
|
||||
* Callback to return pid.
|
||||
*
|
||||
* @param pid Process id.
|
||||
*/
|
||||
virtual void OnFinish(int32_t pid) override;
|
||||
|
||||
void Cancel();
|
||||
|
||||
private:
|
||||
ffrt::mutex taskMutex_;
|
||||
OnFinishTask task_;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_IMPL_H
|
||||
@@ -42,13 +42,17 @@ std::unordered_map<int32_t, AbilityRuntime_ErrorCode> g_innerToBusinessErrorComm
|
||||
{ OHOS::AAFwk::ERR_APP_INSTANCE_KEY_NOT_SUPPORT, ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED },
|
||||
{ OHOS::AAFwk::ERR_NOT_SELF_APPLICATION, ABILITY_RUNTIME_ERROR_CODE_CROSS_APP },
|
||||
};
|
||||
|
||||
std::unordered_map<int32_t, AbilityRuntime_ErrorCode> g_innerToBusinessErrorApi18Map {
|
||||
|
||||
std::unordered_map<int32_t, AbilityRuntime_ErrorCode> g_innerToBusinessErrorApi17Map {
|
||||
{ OHOS::AAFwk::ERR_MULTI_APP_NOT_SUPPORTED, ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED },
|
||||
{ OHOS::AAFwk::ERR_INVALID_APP_INSTANCE_KEY, ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY },
|
||||
{ OHOS::AAFwk::ERR_MULTI_INSTANCE_NOT_SUPPORTED, ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED },
|
||||
};
|
||||
|
||||
std::unordered_map<int32_t, AbilityRuntime_ErrorCode> g_innerToBusinessErrorApi21Map {
|
||||
{ OHOS::AAFwk::ERR_ATTACH_ABILITY_THREAD_FAILED, ABILITY_RUNTIME_ERROR_CODE_START_TIMEOUT },
|
||||
};
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToCommonBusinessErrorCode(int32_t abilityManagerErrorCode)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ability errCode:%{public}d", abilityManagerErrorCode);
|
||||
@@ -60,7 +64,7 @@ AbilityRuntime_ErrorCode ConvertToCommonBusinessErrorCode(int32_t abilityManager
|
||||
return ABILITY_RUNTIME_ERROR_CODE_INTERNAL;
|
||||
}
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToAPI18BusinessErrorCode(int32_t abilityManagerErrorCode)
|
||||
AbilityRuntime_ErrorCode ConvertToAPI17BusinessErrorCode(int32_t abilityManagerErrorCode)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ability errCode:%{public}d", abilityManagerErrorCode);
|
||||
auto errCode = ConvertToCommonBusinessErrorCode(abilityManagerErrorCode);
|
||||
@@ -68,8 +72,24 @@ AbilityRuntime_ErrorCode ConvertToAPI18BusinessErrorCode(int32_t abilityManagerE
|
||||
return errCode;
|
||||
}
|
||||
|
||||
auto it = g_innerToBusinessErrorApi18Map.find(abilityManagerErrorCode);
|
||||
if (it != g_innerToBusinessErrorApi18Map.end()) {
|
||||
auto it = g_innerToBusinessErrorApi17Map.find(abilityManagerErrorCode);
|
||||
if (it != g_innerToBusinessErrorApi17Map.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return ABILITY_RUNTIME_ERROR_CODE_INTERNAL;
|
||||
}
|
||||
|
||||
AbilityRuntime_ErrorCode ConvertToAPI21BusinessErrorCode(int32_t abilityManagerErrorCode)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "ability errCode:%{public}d", abilityManagerErrorCode);
|
||||
auto errCode = ConvertToAPI17BusinessErrorCode(abilityManagerErrorCode);
|
||||
if (errCode != ABILITY_RUNTIME_ERROR_CODE_INTERNAL) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
auto it = g_innerToBusinessErrorApi21Map.find(abilityManagerErrorCode);
|
||||
if (it != g_innerToBusinessErrorApi21Map.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,14 +13,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unistd.h>
|
||||
#include "cpp/condition_variable.h"
|
||||
|
||||
#include "application_context.h"
|
||||
|
||||
#include "ability_business_error_utils.h"
|
||||
#include "ability_manager_client.h"
|
||||
#include "app_mgr_interface.h"
|
||||
#include "context.h"
|
||||
#include "context/application_context.h"
|
||||
#include "ffrt.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "load_ability_callback_impl.h"
|
||||
#include "start_options_impl.h"
|
||||
#include "sys_mgr_client.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "want_manager.h"
|
||||
#include "want_utils.h"
|
||||
|
||||
@@ -29,6 +40,9 @@ using namespace OHOS::AAFwk;
|
||||
using namespace OHOS;
|
||||
|
||||
namespace {
|
||||
constexpr int32_t ATTACH_ABILITY_THREAD_TIMEOUT_TIME = 100 * 1000; // attach ability thread timeout, 100s
|
||||
sptr<AppExecFwk::IAppMgr> g_appMgr = nullptr;
|
||||
|
||||
AbilityRuntime_ErrorCode WriteStringToBuffer(
|
||||
const std::string &src, char* buffer, const int32_t bufferSize, int32_t* writeLength)
|
||||
{
|
||||
@@ -55,6 +69,40 @@ AbilityRuntime_ErrorCode CheckParameters(char* buffer, int32_t* writeLength)
|
||||
}
|
||||
return ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::IAppMgr> GetAppMgr()
|
||||
{
|
||||
if (g_appMgr) {
|
||||
return g_appMgr;
|
||||
}
|
||||
|
||||
auto sysMgrClient = DelayedSingleton<AppExecFwk::SysMrgClient>::GetInstance();
|
||||
if (sysMgrClient == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto object = sysMgrClient->GetSystemAbility(APP_MGR_SERVICE_ID);
|
||||
if (object == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
g_appMgr = OHOS::iface_cast<OHOS::AppExecFwk::IAppMgr>(object);
|
||||
return g_appMgr;
|
||||
}
|
||||
|
||||
AbilityRuntime_ErrorCode CheckAppMainThread()
|
||||
{
|
||||
auto appMgrClient = GetAppMgr();
|
||||
if (appMgrClient == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null appMgr");
|
||||
return ABILITY_RUNTIME_ERROR_CODE_INTERNAL;
|
||||
}
|
||||
AppExecFwk::ChildProcessInfo childProcessInfo;
|
||||
auto ret = appMgrClient->GetChildProcessInfoForSelf(childProcessInfo);
|
||||
if (ret != ERR_OK && getpid() == gettid()) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "calling in app's main thread is not supported");
|
||||
return ABILITY_RUNTIME_ERROR_CODE_MAIN_THREAD_NOT_SUPPORTED;
|
||||
}
|
||||
return ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir(
|
||||
@@ -376,7 +424,7 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions(Ab
|
||||
return ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
OHOS::AAFwk::StartOptions startOptions = options->GetInnerStartOptions();
|
||||
return ConvertToAPI18BusinessErrorCode(AbilityManagerClient::GetInstance()->StartSelfUIAbilityWithStartOptions(
|
||||
return ConvertToAPI17BusinessErrorCode(AbilityManagerClient::GetInstance()->StartSelfUIAbilityWithStartOptions(
|
||||
abilityWant, startOptions));
|
||||
}
|
||||
|
||||
@@ -399,4 +447,56 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetVersionCode(int6
|
||||
}
|
||||
*versionCode = static_cast<int64_t>(appApplicationInfo->versionCode);
|
||||
return ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithPidResult(AbilityBase_Want *want,
|
||||
AbilityRuntime_StartOptions *options, int32_t &targetPid)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "StartSelfUIAbilityWithPidResult called");
|
||||
auto ret = CheckAppMainThread();
|
||||
if (ret != ABILITY_RUNTIME_ERROR_CODE_NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CheckAppMainThread failed, ret=%{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = CheckWant(want);
|
||||
if (ret != ABILITY_RUNTIME_ERROR_CODE_NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "CheckWant failed: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
if (options == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null options");
|
||||
return ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
Want abilityWant;
|
||||
AbilityBase_ErrorCode errCode = CWantManager::TransformToWant(*want, false, abilityWant);
|
||||
if (errCode != ABILITY_BASE_ERROR_CODE_NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "transform error:%{public}d", errCode);
|
||||
return ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
StartOptions startOptions = options->GetInnerStartOptions();
|
||||
ffrt::condition_variable callbackDoneCv;
|
||||
std::atomic_bool done = false;
|
||||
auto task = [&targetPid, &callbackDoneCv, &done](int32_t pidResult) {
|
||||
targetPid = pidResult;
|
||||
done.store(true);
|
||||
callbackDoneCv.notify_all();
|
||||
};
|
||||
sptr<LoadAbilityCallbackImpl> callback = sptr<LoadAbilityCallbackImpl>::MakeSptr(std::move(task));
|
||||
auto result = AbilityManagerClient::GetInstance()->StartSelfUIAbilityWithPidResult(
|
||||
abilityWant, startOptions, callback);
|
||||
if (result != ERR_OK) {
|
||||
callback->Cancel();
|
||||
return ConvertToAPI21BusinessErrorCode(result);
|
||||
}
|
||||
auto condition = [&done] {
|
||||
return done.load();
|
||||
};
|
||||
ffrt::mutex callbackDoneMutex;
|
||||
std::unique_lock<ffrt::mutex> lock(callbackDoneMutex);
|
||||
if (!callbackDoneCv.wait_for(lock, std::chrono::milliseconds(ATTACH_ABILITY_THREAD_TIMEOUT_TIME), condition) ||
|
||||
targetPid < 0) {
|
||||
callback->Cancel();
|
||||
return ABILITY_RUNTIME_ERROR_CODE_START_TIMEOUT;
|
||||
}
|
||||
return ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 "load_ability_callback_impl.h"
|
||||
|
||||
#include "hilog_tag_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
void LoadAbilityCallbackImpl::OnFinish(int32_t pid)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call OnFinish");
|
||||
std::unique_lock<ffrt::mutex> lock(taskMutex_);
|
||||
if (task_) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "pid:%{public}d", pid);
|
||||
task_(pid);
|
||||
}
|
||||
}
|
||||
|
||||
void LoadAbilityCallbackImpl::Cancel()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call Cancel");
|
||||
std::unique_lock<ffrt::mutex> lock(taskMutex_);
|
||||
task_ = nullptr;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
@@ -30,8 +30,12 @@
|
||||
#include "want.h"
|
||||
#include "intent_exemption_info.h"
|
||||
#include "ihidden_start_observer.h"
|
||||
#include "iload_ability_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class ILoadAbilityCallback;
|
||||
}
|
||||
namespace AAFwk {
|
||||
class Snapshot;
|
||||
class ISnapshotHandler;
|
||||
@@ -63,6 +67,17 @@ public:
|
||||
*/
|
||||
ErrCode StartSelfUIAbilityWithStartOptions(const Want &want, const StartOptions &options);
|
||||
|
||||
/**
|
||||
* Starts self UIAbility with start options and receives the process ID. Supported only on 2-in-1 devices.
|
||||
*
|
||||
* @param want, the want of the ability to start.
|
||||
* @param options, the startOptions of the ability to start.
|
||||
* @param callback, the callback to get target process id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback);
|
||||
|
||||
/**
|
||||
* AttachAbilityThread, ability call this interface after loaded.
|
||||
*
|
||||
|
||||
@@ -1317,6 +1317,11 @@ enum NativeFreeInstallError {
|
||||
*/
|
||||
ERR_WRITE_INT_FAILED = 29360221,
|
||||
|
||||
/*
|
||||
* Result(29360222) for attaching ability failed.
|
||||
*/
|
||||
ERR_ATTACH_ABILITY_THREAD_FAILED = 29360222,
|
||||
|
||||
/**
|
||||
* Undefine error code.
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "iability_controller.h"
|
||||
#include "iability_manager_collaborator.h"
|
||||
#include "iacquire_share_data_callback_interface.h"
|
||||
#include "iload_ability_callback.h"
|
||||
#include "insight_intent/insight_intent_execute_param.h"
|
||||
#include "insight_intent/insight_intent_execute_result.h"
|
||||
#include "insight_intent/insight_intent_info_for_query.h"
|
||||
@@ -131,6 +132,20 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts self UIAbility with start options and receives the process ID. Supported only on 2-in-1 devices.
|
||||
*
|
||||
* @param want, the want of the ability to start.
|
||||
* @param options, the startOptions of the ability to start.
|
||||
* @param callback, the callback to get target process id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* StartAbility with want, send want to ability manager service.
|
||||
*
|
||||
|
||||
@@ -674,6 +674,9 @@ enum class AbilityManagerInterfaceCode {
|
||||
|
||||
// preload application
|
||||
PRELOAD_APPLICATION = 6151,
|
||||
|
||||
// start self uiability with startOptions and receives the pid
|
||||
START_SELF_UI_ABILITY_WITH_PID_RESULT = 6152,
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2024-2025 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
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
bool isRestartKeepAlive = false;
|
||||
bool isStartFromNDK = false;
|
||||
bool isPreloadStart = false;
|
||||
bool shouldReturnPid = false;
|
||||
ProcessMode processMode = ProcessMode::UNSPECIFIED;
|
||||
StartupVisibility startupVisibility = StartupVisibility::UNSPECIFIED;
|
||||
std::string processName;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "ability_window_configuration.h"
|
||||
#include "iremote_object.h"
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -80,6 +81,7 @@ public:
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes_;
|
||||
std::string requestId_;
|
||||
std::shared_ptr<Rosen::WindowCreateParams> windowCreateParams_ = nullptr;
|
||||
sptr<IRemoteObject> loadAbilityCallback_ = nullptr;
|
||||
|
||||
StartOptions() = default;
|
||||
~StartOptions() = default;
|
||||
|
||||
@@ -101,6 +101,8 @@ ohos_shared_library("app_manager") {
|
||||
"src/appmgr/fault_data.cpp",
|
||||
"src/appmgr/kia_interceptor_proxy.cpp",
|
||||
"src/appmgr/kia_interceptor_stub.cpp",
|
||||
"src/appmgr/load_ability_callback_proxy.cpp",
|
||||
"src/appmgr/load_ability_callback_stub.cpp",
|
||||
"src/appmgr/memory_level_info.cpp",
|
||||
"src/appmgr/native_child_notify_proxy.cpp",
|
||||
"src/appmgr/native_child_notify_stub.cpp",
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "application_info.h"
|
||||
#include "configuration.h"
|
||||
#include "iapp_state_callback.h"
|
||||
#include "iload_ability_callback.h"
|
||||
#include "iremote_broker.h"
|
||||
#include "iremote_object.h"
|
||||
#include "istart_specified_ability_response.h"
|
||||
@@ -45,11 +46,13 @@ public:
|
||||
* @param preToken, the unique identification to call the ability.
|
||||
* @param abilityInfo, the ability information.
|
||||
* @param appInfo, the app information.
|
||||
* @param callback, the callback to get process id.
|
||||
* @return
|
||||
*/
|
||||
virtual void LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const std::shared_ptr<ApplicationInfo> &appInfo,
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam) {};
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback = nullptr) {};
|
||||
|
||||
/**
|
||||
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
|
||||
|
||||
@@ -34,11 +34,13 @@ public:
|
||||
* @param preToken, the unique identification to call the ability.
|
||||
* @param abilityInfo, the ability information.
|
||||
* @param appInfo, the app information.
|
||||
* @param callback, the callback to get process id.
|
||||
* @return
|
||||
*/
|
||||
virtual void LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const std::shared_ptr<ApplicationInfo> &appInfo,
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam) override;
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback = nullptr) override;
|
||||
|
||||
/**
|
||||
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
|
||||
|
||||
@@ -62,10 +62,12 @@ public:
|
||||
* @param appInfo Application information.
|
||||
* @param want Want.
|
||||
* @param loadParam load ability param.
|
||||
* @param callback, the callback to get process id.
|
||||
* @return Returns RESULT_OK on success, others on failure.
|
||||
*/
|
||||
virtual AppMgrResultCode LoadAbility(const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo,
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam);
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = nullptr);
|
||||
|
||||
/**
|
||||
* Terminate ability.
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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_ABILITY_RUNTIME_ILOAD_ABILITY_CALLBACK_H
|
||||
#define OHOS_ABILITY_RUNTIME_ILOAD_ABILITY_CALLBACK_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class ILoadAbilityCallback : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.ILoadAbilityCallback");
|
||||
|
||||
/**
|
||||
* Callback to return pid.
|
||||
*
|
||||
* @param pid Process id.
|
||||
*/
|
||||
virtual void OnFinish(int32_t pid) = 0;
|
||||
|
||||
enum class Message {
|
||||
TRANSACT_ON_FINISH = 0,
|
||||
};
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_ILOAD_ABILITY_CALLBACK_H
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_PROXY_H
|
||||
#define OHOS_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_PROXY_H
|
||||
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
#include "iload_ability_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class LoadAbilityCallbackProxy : public IRemoteProxy<ILoadAbilityCallback> {
|
||||
public:
|
||||
explicit LoadAbilityCallbackProxy(const sptr<IRemoteObject> &impl);
|
||||
virtual ~LoadAbilityCallbackProxy() = default;
|
||||
|
||||
/**
|
||||
* Callback to return pid.
|
||||
*
|
||||
* @param pid Process id.
|
||||
*/
|
||||
virtual void OnFinish(int32_t pid) override;
|
||||
|
||||
private:
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
static inline BrokerDelegator<LoadAbilityCallbackProxy> delegator_;
|
||||
int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_PROXY_H
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_STUB_H
|
||||
#define OHOS_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_STUB_H
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
#include "iload_ability_callback.h"
|
||||
#include "iremote_stub.h"
|
||||
#include "nocopyable.h"
|
||||
#include "string_ex.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class LoadAbilityCallbackStub : public IRemoteStub<ILoadAbilityCallback> {
|
||||
public:
|
||||
LoadAbilityCallbackStub() = default;
|
||||
virtual ~LoadAbilityCallbackStub() = default;
|
||||
|
||||
virtual int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
int32_t HandleOnFinish(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
DISALLOW_COPY_AND_MOVE(LoadAbilityCallbackStub);
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_LOAD_ABILITY_CALLBACK_STUB_H
|
||||
@@ -68,7 +68,8 @@ bool AmsMgrProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
|
||||
void AmsMgrProxy::LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const std::shared_ptr<ApplicationInfo> &appInfo,
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam)
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "start");
|
||||
if (!abilityInfo || !appInfo) {
|
||||
@@ -98,6 +99,17 @@ void AmsMgrProxy::LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write data loadParam failed");
|
||||
return;
|
||||
}
|
||||
if (callback != nullptr && callback->AsObject() != nullptr) {
|
||||
if (!data.WriteBool(true) || !data.WriteRemoteObject(callback->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Failed to write flag and callback");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!data.WriteBool(false)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Failed to write flag");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ret = SendTransactCmd(static_cast<uint32_t>(IAmsMgr::Message::LOAD_ABILITY), data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
|
||||
@@ -264,8 +264,13 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply)
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "ReadParcelable loadParam failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
sptr<ILoadAbilityCallback> callback = nullptr;
|
||||
if (data.ReadBool()) {
|
||||
sptr<IRemoteObject> obj = data.ReadRemoteObject();
|
||||
callback = iface_cast<ILoadAbilityCallback>(obj);
|
||||
}
|
||||
|
||||
LoadAbility(abilityInfo, appInfo, want, loadParam);
|
||||
LoadAbility(abilityInfo, appInfo, want, loadParam, callback);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ AppMgrClient::~AppMgrClient()
|
||||
{}
|
||||
|
||||
AppMgrResultCode AppMgrClient::LoadAbility(const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo,
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam)
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam, sptr<ILoadAbilityCallback> callback)
|
||||
{
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
if (service != nullptr) {
|
||||
@@ -171,7 +171,7 @@ AppMgrResultCode AppMgrClient::LoadAbility(const AbilityInfo &abilityInfo, const
|
||||
std::shared_ptr<ApplicationInfo> appInfoPtr = std::make_shared<ApplicationInfo>(appInfo);
|
||||
std::shared_ptr<AAFwk::Want> wantPtr = std::make_shared<AAFwk::Want>(want);
|
||||
auto loadParamPtr = std::make_shared<AbilityRuntime::LoadParam>(loadParam);
|
||||
amsService->LoadAbility(abilityInfoPtr, appInfoPtr, wantPtr, loadParamPtr);
|
||||
amsService->LoadAbility(abilityInfoPtr, appInfoPtr, wantPtr, loadParamPtr, callback);
|
||||
return AppMgrResultCode::RESULT_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 "load_ability_callback_proxy.h"
|
||||
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "ipc_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
namespace {
|
||||
const int32_t ERR_INVALID_STUB = 32;
|
||||
}
|
||||
LoadAbilityCallbackProxy::LoadAbilityCallbackProxy(
|
||||
const sptr<IRemoteObject> &impl) : IRemoteProxy<ILoadAbilityCallback>(impl)
|
||||
{}
|
||||
|
||||
bool LoadAbilityCallbackProxy::WriteInterfaceToken(MessageParcel &data)
|
||||
{
|
||||
if (!data.WriteInterfaceToken(LoadAbilityCallbackProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "write interface token failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t LoadAbilityCallbackProxy::SendTransactCmd(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr.");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
return remote->SendRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
void LoadAbilityCallbackProxy::OnFinish(int32_t pid)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
if (!data.WriteInt32(pid)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "write pid failed");
|
||||
return;
|
||||
}
|
||||
int32_t ret = SendTransactCmd(
|
||||
static_cast<uint32_t>(ILoadAbilityCallback::Message::TRANSACT_ON_FINISH),
|
||||
data, reply, option);
|
||||
if (ret != NO_ERROR && ret != ERR_INVALID_STUB) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d.", ret);
|
||||
}
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 "load_ability_callback_stub.h"
|
||||
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "ipc_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
int LoadAbilityCallbackStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
std::u16string descriptor = LoadAbilityCallbackStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "local descriptor is not equal to remote.");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (static_cast<Message>(code) == Message::TRANSACT_ON_FINISH) {
|
||||
return HandleOnFinish(data, reply);
|
||||
}
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "LoadAbilityCallbackStub::OnRemoteRequest, default case, need check");
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
int32_t LoadAbilityCallbackStub::HandleOnFinish(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t pid = data.ReadInt32();
|
||||
OnFinish(pid);
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
@@ -143,6 +143,16 @@ typedef enum {
|
||||
* @since 21
|
||||
*/
|
||||
ABILITY_RUNTIME_ERROR_CODE_GET_APPLICATION_INFO_FAILED = 16000081,
|
||||
/**
|
||||
* @error Starting UIAbility times out.
|
||||
* @since 21
|
||||
*/
|
||||
ABILITY_RUNTIME_ERROR_CODE_START_TIMEOUT = 16000133,
|
||||
/**
|
||||
* @error The API does not support being called in the main thread.
|
||||
* @since 21
|
||||
*/
|
||||
ABILITY_RUNTIME_ERROR_CODE_MAIN_THREAD_NOT_SUPPORTED = 16000134,
|
||||
} AbilityRuntime_ErrorCode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -343,6 +343,46 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetLaunchParameter(
|
||||
*/
|
||||
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetLatestParameter(
|
||||
char* buffer, const int32_t bufferSize, int32_t* writeLength);
|
||||
|
||||
/**
|
||||
* @brief Starts self UIAbility with start options and receives the process ID.
|
||||
*
|
||||
* @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY}
|
||||
* @param want The arguments passed to start self UIAbility.
|
||||
* For details, see {@link AbilityBase_Want}.
|
||||
* @param options The start options passed to start self UIAbility.
|
||||
* For details, see {@link AbilityRuntime_StartOptions}.
|
||||
* @param pid The process ID of the started UIAbility.
|
||||
* @return Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the call is successful.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} if the caller has no correct permission.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the arguments provided is invalid.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} if the device does not support starting self uiability.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} if the target ability does not exist.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} if the ability type is incorrect.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} if the crowdtesting application expires.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} if the ability cannot be started in Wukong mode.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} if the app is controlled.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} if the app is controlled by EDM.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} if the caller tries to start a different application.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if internal error occurs.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} if the caller is not foreground process.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED} if setting visibility is disabled.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED}
|
||||
* if the app clone or multi-instance is not supported.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY} if the app instance key is invalid.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} if the number of app instances reached the limit.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED} if the multi-instance is not supported.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED}
|
||||
* if the APP_INSTANCE_KEY cannot be specified.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_START_TIMEOUT} if starting UIAbility times out.
|
||||
* Returns {@link ABILITY_RUNTIME_ERROR_CODE_MAIN_THREAD_NOT_SUPPORTED}
|
||||
* if the API is called in the main thread of the app.
|
||||
* For details, see {@link AbilityRuntime_ErrorCode}.
|
||||
* @since 21
|
||||
*/
|
||||
AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithPidResult(AbilityBase_Want *want,
|
||||
AbilityRuntime_StartOptions *options, int32_t &targetPid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -55,6 +55,17 @@ public:
|
||||
virtual int StartSelfUIAbilityWithStartOptions(const Want &want,
|
||||
const StartOptions &options) override;
|
||||
|
||||
/**
|
||||
* Starts self UIAbility with start options and receives the process ID. Supported only on 2-in-1 devices.
|
||||
*
|
||||
* @param want, the want of the ability to start.
|
||||
* @param options, the startOptions of the ability to start.
|
||||
* @param callback, the callback to get target process id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback) override;
|
||||
|
||||
/**
|
||||
* StartAbility with want, send want to ability manager service.
|
||||
*
|
||||
|
||||
@@ -141,6 +141,17 @@ public:
|
||||
virtual int StartSelfUIAbilityWithStartOptions(const Want &want,
|
||||
const StartOptions &options) override;
|
||||
|
||||
/**
|
||||
* Starts self UIAbility with start options and receives the process ID. Supported only on 2-in-1 devices.
|
||||
*
|
||||
* @param want, the want of the ability to start.
|
||||
* @param options, the startOptions of the ability to start.
|
||||
* @param callback, the callback to get target process id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback) override;
|
||||
|
||||
/**
|
||||
* StartAbility with want, send want to ability manager service.
|
||||
*
|
||||
|
||||
@@ -81,6 +81,7 @@ private:
|
||||
int MinimizeUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int MinimizeUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply);
|
||||
int AttachAbilityThreadInner(MessageParcel &data, MessageParcel &reply);
|
||||
int NotifyAttachAbilityThreadDoneInner(MessageParcel &data, MessageParcel &reply);
|
||||
int AbilityTransitionDoneInner(MessageParcel &data, MessageParcel &reply);
|
||||
int AbilityWindowConfigTransitionDoneInner(MessageParcel &data, MessageParcel &reply);
|
||||
int ScheduleConnectAbilityDoneInner(MessageParcel &data, MessageParcel &reply);
|
||||
@@ -95,6 +96,7 @@ private:
|
||||
int32_t UpgradeAppInner(MessageParcel &data, MessageParcel &reply);
|
||||
int StartSelfUIAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int StartSelfUIAbilityWithStartOptionsInner(MessageParcel &data, MessageParcel &reply);
|
||||
int StartSelfUIAbilityWithPidResultInner(MessageParcel &data, MessageParcel &reply);
|
||||
int StartAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int StartAbilityInnerSpecifyTokenId(MessageParcel &data, MessageParcel &reply);
|
||||
int StartAbilityByUIContentSessionAddCallerInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class ILoadAbilityCallback;
|
||||
}
|
||||
namespace AAFwk {
|
||||
using Closure = std::function<void()>;
|
||||
|
||||
@@ -411,7 +414,8 @@ public:
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int LoadAbility(bool isShellCall = false, bool isStartupHide = false);
|
||||
int LoadAbility(bool isShellCall = false, bool isStartupHide = false,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = nullptr);
|
||||
|
||||
/**
|
||||
* foreground the ability.
|
||||
@@ -425,7 +429,8 @@ public:
|
||||
*
|
||||
*/
|
||||
void ProcessForegroundAbility(
|
||||
uint32_t tokenId, uint32_t sceneFlag = 0, bool isShellCall = false, bool isStartupHide = false);
|
||||
uint32_t tokenId, uint32_t sceneFlag = 0, bool isShellCall = false, bool isStartupHide = false,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = nullptr);
|
||||
|
||||
/**
|
||||
* post foreground timeout task for ui ability.
|
||||
@@ -1270,6 +1275,16 @@ public:
|
||||
return isPreloadStart_.load();
|
||||
}
|
||||
|
||||
inline void SetShouldReturnPid(bool shouldReturnPid)
|
||||
{
|
||||
shouldReturnPid_.store(shouldReturnPid);
|
||||
}
|
||||
|
||||
inline bool ShouldReturnPid() const
|
||||
{
|
||||
return shouldReturnPid_.load();
|
||||
}
|
||||
|
||||
inline void SetPreloaded()
|
||||
{
|
||||
isPreloaded_.store(true);
|
||||
@@ -1395,6 +1410,7 @@ private:
|
||||
#endif
|
||||
void SendAppStartupTypeEvent(const AppExecFwk::AppStartType startType);
|
||||
std::atomic<bool> isPreloadStart_ = false; // is ability started via preload
|
||||
std::atomic<bool> shouldReturnPid_ = false;
|
||||
|
||||
static std::atomic<int64_t> abilityRecordId;
|
||||
bool isReady_ = false; // is ability thread attached?
|
||||
|
||||
@@ -159,10 +159,12 @@ public:
|
||||
* @param abilityInfo, ability info.
|
||||
* @param applicationInfo, application info.
|
||||
* @param want ability want
|
||||
* @param callback, the callback to get process id.
|
||||
* @return true on success ,false on failure.
|
||||
*/
|
||||
int LoadAbility(const AbilityRuntime::LoadParam &loadParam, const AppExecFwk::AbilityInfo &abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want);
|
||||
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = nullptr);
|
||||
|
||||
/**
|
||||
* terminate ability with token.
|
||||
|
||||
@@ -442,7 +442,7 @@ private:
|
||||
|
||||
// byCall
|
||||
int CallAbilityLocked(const AbilityRequest &abilityRequest, std::string &errMsg);
|
||||
sptr<SessionInfo> CreateSessionInfo(const AbilityRequest &abilityRequest, int32_t requestId) const;
|
||||
sptr<SessionInfo> CreateSessionInfo(const AbilityRequest &abilityRequest, int32_t requestId);
|
||||
int NotifySCBPendingActivation(sptr<SessionInfo> &sessionInfo,
|
||||
const AbilityRequest &abilityRequest, std::string &errMsg);
|
||||
std::pair<std::vector<sptr<SessionInfo>>, std::vector<Rosen::PendingSessionActivationConfig>>
|
||||
@@ -529,6 +529,7 @@ private:
|
||||
void HandleAbilitiesNormalSessionInfo(AbilityRequest &abilityRequest,
|
||||
std::shared_ptr<AbilitiesRequest> abilitiesRequest, int32_t requestId);
|
||||
void RemoveInstanceKey(const AbilityRequest &abilityRequest) const;
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> GetLoadAbilityCallback(int32_t requestId);
|
||||
|
||||
int32_t userId_ = -1;
|
||||
mutable ffrt::mutex sessionLock_;
|
||||
@@ -536,6 +537,7 @@ private:
|
||||
std::unordered_map<int32_t, std::shared_ptr<AbilityRecord>> lowMemKillAbilityMap_;
|
||||
std::unordered_map<int32_t, std::shared_ptr<AbilityRecord>> tmpAbilityMap_;
|
||||
std::unordered_map<std::shared_ptr<AbilityRecord>, std::list<AbilityRequest>> callRequestCache_;
|
||||
std::map<int32_t, sptr<AppExecFwk::ILoadAbilityCallback>> loadAbilityCallbackMap_;
|
||||
std::list<std::shared_ptr<AbilityRecord>> terminateAbilityList_;
|
||||
sptr<IRemoteObject> rootSceneSession_;
|
||||
sptr<ISessionHandler> handler_;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#endif // WITH_DLP
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "iload_ability_callback.h"
|
||||
#include "iservice_registry.h"
|
||||
#ifdef SUPPORT_SCREEN
|
||||
#include "scene_board_judgement.h"
|
||||
@@ -2192,7 +2193,7 @@ ErrCode AbilityManagerClient::QueryAtomicServiceStartupRule(sptr<IRemoteObject>
|
||||
|
||||
ErrCode AbilityManagerClient::StartSelfUIAbility(const Want &want)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call StartSelfUIAbilityWithStartOptions");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->StartSelfUIAbility(want);
|
||||
@@ -2201,12 +2202,21 @@ ErrCode AbilityManagerClient::StartSelfUIAbility(const Want &want)
|
||||
ErrCode AbilityManagerClient::StartSelfUIAbilityWithStartOptions(const Want &want,
|
||||
const StartOptions &options)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call StartSelfUIAbilityWithStartOptions");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->StartSelfUIAbilityWithStartOptions(want, options);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::StartSelfUIAbilityWithPidResult(const Want &want,
|
||||
StartOptions &options, sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call StartSelfUIAbilityWithPidResult");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->StartSelfUIAbilityWithPidResult(want, options, callback);
|
||||
}
|
||||
|
||||
void AbilityManagerClient::PrepareTerminateAbilityDone(sptr<IRemoteObject> token, bool isTerminate)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call PrepareTerminateAbilityDone");
|
||||
|
||||
@@ -6485,6 +6485,47 @@ int32_t AbilityManagerProxy::StartSelfUIAbilityWithStartOptions(const Want &want
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t AbilityManagerProxy::StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
if (callback == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "null callback");
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write token fail");
|
||||
return ERR_WRITE_INTERFACE_CODE;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&want)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write want fail");
|
||||
return ERR_WRITE_WANT;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&options)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write startOptions fail");
|
||||
return ERR_WRITE_START_OPTIONS;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(callback->AsObject())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write callback fail");
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
auto error = SendRequest(AbilityManagerInterfaceCode::START_SELF_UI_ABILITY_WITH_PID_RESULT,
|
||||
data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "request error:%{public}d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
void AbilityManagerProxy::PrepareTerminateAbilityDone(const sptr<IRemoteObject> &token, bool isTerminate)
|
||||
{
|
||||
MessageParcel data;
|
||||
|
||||
@@ -6503,7 +6503,7 @@ int AbilityManagerService::AttachAbilityThread(
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "called");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "AttachAbilityThread called");
|
||||
CHECK_POINTER_AND_RETURN(scheduler, ERR_INVALID_VALUE);
|
||||
if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() && !VerificationAllToken(token)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
@@ -14770,6 +14770,26 @@ int AbilityManagerService::StartSelfUIAbilityWithStartOptions(const Want &want,
|
||||
return StartSelfUIAbilityInner(param);
|
||||
}
|
||||
|
||||
int AbilityManagerService::StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "StartSelfUIAbilityWithPidResult");
|
||||
CHECK_POINTER_AND_RETURN(callback, ERR_INVALID_VALUE);
|
||||
|
||||
if (options.processOptions == nullptr) {
|
||||
options.processOptions = std::make_shared<ProcessOptions>();
|
||||
}
|
||||
options.processOptions->shouldReturnPid = true;
|
||||
options.loadAbilityCallback_ = callback->AsObject();
|
||||
auto ret = StartSelfUIAbilityWithStartOptions(want, options);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "StartSelfUIAbilityWithStartOptions failed:%{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool AbilityManagerService::CheckCrossUser(const int32_t userId, AppExecFwk::ExtensionAbilityType extensionType)
|
||||
{
|
||||
if (AAFwk::UIExtensionUtils::IsEnterpriseAdmin(extensionType) || JudgeMultiUserConcurrency(userId)) {
|
||||
|
||||
@@ -909,6 +909,9 @@ int AbilityManagerStub::OnRemoteRequestInnerTwentyFirst(uint32_t code, MessagePa
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::PRELOAD_APPLICATION) {
|
||||
return PreloadApplicationInner(data, reply);
|
||||
}
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::START_SELF_UI_ABILITY_WITH_PID_RESULT) {
|
||||
return StartSelfUIAbilityWithPidResultInner(data, reply);
|
||||
}
|
||||
return ERR_CODE_NOT_EXIST;
|
||||
}
|
||||
|
||||
@@ -4614,6 +4617,28 @@ int32_t AbilityManagerStub::StartSelfUIAbilityWithStartOptionsInner(MessageParce
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AbilityManagerStub::StartSelfUIAbilityWithPidResultInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<Want> want = data.ReadParcelable<Want>();
|
||||
if (want == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "want null");
|
||||
return ERR_READ_WANT;
|
||||
}
|
||||
sptr<StartOptions> options = data.ReadParcelable<StartOptions>();
|
||||
if (options == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null");
|
||||
return ERR_READ_START_OPTIONS;
|
||||
}
|
||||
auto callback = iface_cast<AppExecFwk::ILoadAbilityCallback>(data.ReadRemoteObject());
|
||||
int32_t result = StartSelfUIAbilityWithPidResult(*want, *options, callback);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write StartSelfUIAbilityWithPidResult result fail");
|
||||
return ERR_WRITE_START_SELF_UI_ABILITY_RESULT;
|
||||
}
|
||||
want->CloseAllFd();
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AbilityManagerStub::PrepareTerminateAbilityDoneInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call PrepareTerminateAbilityDoneInner");
|
||||
|
||||
@@ -246,16 +246,17 @@ std::shared_ptr<AbilityRecord> AbilityRecord::CreateAbilityRecord(const AbilityR
|
||||
abilityRecord->SetAppIndex(appIndex);
|
||||
abilityRecord->SetSecurityFlag(abilityRequest.want.GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false));
|
||||
abilityRecord->SetCallerAccessTokenId(abilityRequest.callerAccessTokenId);
|
||||
if (abilityRequest.processOptions != nullptr && abilityRequest.processOptions->isPreloadStart) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "start by preload");
|
||||
abilityRecord->SetPreloadStart(true);
|
||||
if (abilityRequest.processOptions != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "isPreloadStart:%{public}d,shouldReturnPid:%{public}d",
|
||||
abilityRequest.processOptions->isPreloadStart, abilityRequest.processOptions->shouldReturnPid);
|
||||
abilityRecord->SetPreloadStart(abilityRequest.processOptions->isPreloadStart);
|
||||
abilityRecord->SetShouldReturnPid(abilityRequest.processOptions->shouldReturnPid);
|
||||
}
|
||||
abilityRecord->sessionInfo_ = abilityRequest.sessionInfo;
|
||||
if (AppUtils::GetInstance().IsMultiProcessModel() && abilityRequest.abilityInfo.isStageBasedModel &&
|
||||
abilityRequest.abilityInfo.type == AppExecFwk::AbilityType::PAGE &&
|
||||
!abilityRequest.customProcess.empty()) {
|
||||
abilityRecord->SetCustomProcessFlag(abilityRequest.customProcess);
|
||||
}
|
||||
abilityRequest.abilityInfo.type == AppExecFwk::AbilityType::PAGE && !abilityRequest.customProcess.empty()) {
|
||||
abilityRecord->SetCustomProcessFlag(abilityRequest.customProcess);
|
||||
}
|
||||
if (abilityRequest.sessionInfo != nullptr) {
|
||||
abilityRecord->instanceKey_ = abilityRequest.sessionInfo->instanceKey;
|
||||
}
|
||||
@@ -278,8 +279,7 @@ std::shared_ptr<AbilityRecord> AbilityRecord::CreateAbilityRecord(const AbilityR
|
||||
abilityRecord->missionAffinity_ = abilityRequest.want.GetStringParam(PARAM_MISSION_AFFINITY_KEY);
|
||||
|
||||
auto userId = abilityRequest.appInfo.uid / BASE_USER_RANGE;
|
||||
if ((userId == 0 ||
|
||||
AppUtils::GetInstance().InResidentWhiteList(abilityRequest.abilityInfo.bundleName)) &&
|
||||
if ((userId == 0 || AppUtils::GetInstance().InResidentWhiteList(abilityRequest.abilityInfo.bundleName)) &&
|
||||
DelayedSingleton<ResidentProcessManager>::GetInstance()->IsResidentAbility(
|
||||
abilityRequest.abilityInfo.bundleName, abilityRequest.abilityInfo.name, userId)) {
|
||||
abilityRecord->keepAliveBundle_ = true;
|
||||
@@ -340,7 +340,7 @@ void AbilityRecord::LoadUIAbility()
|
||||
g_addLifecycleEventTask(token_, methodName);
|
||||
}
|
||||
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide)
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide, sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "LoadLifecycle: abilityName:%{public}s", abilityInfo_.name.c_str());
|
||||
@@ -382,7 +382,7 @@ int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide)
|
||||
MainElementUtils::SetMainUIAbilityKeepAliveFlag(isMainUIAbility,
|
||||
abilityInfo_.bundleName, loadParam);
|
||||
auto result = DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
|
||||
loadParam, abilityInfo_, abilityInfo_.applicationInfo, want_);
|
||||
loadParam, abilityInfo_, abilityInfo_.applicationInfo, want_, callback);
|
||||
want_.RemoveParam(IS_HOOK);
|
||||
want_.RemoveParam(ABILITY_OWNER_USERID);
|
||||
want_.RemoveParam(Want::PARAMS_REAL_CALLER_KEY);
|
||||
@@ -491,7 +491,8 @@ void AbilityRecord::ForegroundUIExtensionAbility(uint32_t sceneFlag)
|
||||
}
|
||||
|
||||
void AbilityRecord::ProcessForegroundAbility(
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide)
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
std::string element = GetElementName().GetURI();
|
||||
@@ -505,7 +506,7 @@ void AbilityRecord::ProcessForegroundAbility(
|
||||
if (!isReady_) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "To load ability.");
|
||||
lifeCycleStateInfo_.sceneFlagBak = sceneFlag;
|
||||
LoadAbility(isShellCall, isStartupHide);
|
||||
LoadAbility(isShellCall, isStartupHide, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback> &callback)
|
||||
}
|
||||
|
||||
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam &loadParam, const AppExecFwk::AbilityInfo &abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want)
|
||||
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
if (AppUtils::GetInstance().IsForbidStart()) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", abilityInfo.bundleName.c_str());
|
||||
@@ -80,7 +81,7 @@ int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam &loadParam, const
|
||||
/* because the errcode type of AppMgr Client API will be changed to int,
|
||||
* so must to covert the return result */
|
||||
int ret = static_cast<int>(IN_PROCESS_CALL(
|
||||
appMgrClient_->LoadAbility(abilityInfo, applicationInfo, want, loadParam)));
|
||||
appMgrClient_->LoadAbility(abilityInfo, applicationInfo, want, loadParam, callback)));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::SERVICE_EXT, "AppScheduler fail to LoadAbility. ret %{public}d", ret);
|
||||
return INNER_ERR;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2024-2025 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
|
||||
@@ -27,6 +27,7 @@ bool ProcessOptions::ReadFromParcel(Parcel &parcel)
|
||||
isRestartKeepAlive = parcel.ReadBool();
|
||||
isStartFromNDK = parcel.ReadBool();
|
||||
isPreloadStart = parcel.ReadBool();
|
||||
shouldReturnPid = parcel.ReadBool();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,6 +72,10 @@ bool ProcessOptions::Marshalling(Parcel &parcel) const
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "isPreloadStart write failed");
|
||||
return false;
|
||||
}
|
||||
if (!parcel.WriteBool(shouldReturnPid)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "shouldReturnPid write failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,8 +203,10 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
if (preloadStartCheck) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, preload start");
|
||||
bool shouldReturnPid = sessionInfo->processOptions != nullptr && sessionInfo->processOptions->shouldReturnPid;
|
||||
if (preloadStartCheck || shouldReturnPid) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, preloadStartCheck=%{public}d,shouldReturnPid=%{public}d",
|
||||
preloadStartCheck, shouldReturnPid);
|
||||
abilityRequest.processOptions = sessionInfo->processOptions;
|
||||
}
|
||||
auto isCallBySCB = sessionInfo->want.GetBoolParam(ServerConstant::IS_CALL_BY_SCB, true);
|
||||
@@ -267,7 +269,8 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp
|
||||
if (abilityRequest.processOptions) {
|
||||
isStartupHide = abilityRequest.processOptions->startupVisibility == StartupVisibility::STARTUP_HIDE;
|
||||
}
|
||||
uiAbilityRecord->ProcessForegroundAbility(callerTokenId, sceneFlag, isShellCall, isStartupHide);
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = GetLoadAbilityCallback(sessionInfo->requestId);
|
||||
uiAbilityRecord->ProcessForegroundAbility(callerTokenId, sceneFlag, isShellCall, isStartupHide, callback);
|
||||
if (uiAbilityRecord->GetSpecifiedFlag().empty() && !sessionInfo->specifiedFlag.empty()) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "update specified: %{public}d--%{public}s", sessionInfo->requestId,
|
||||
sessionInfo->specifiedFlag.c_str());
|
||||
@@ -277,6 +280,18 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> UIAbilityLifecycleManager::GetLoadAbilityCallback(int32_t requestId)
|
||||
{
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = nullptr;
|
||||
auto iter = loadAbilityCallbackMap_.find(requestId);
|
||||
if (iter != loadAbilityCallbackMap_.end()) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "find loadability callback, requestId: %{public}d", requestId);
|
||||
callback = iter->second;
|
||||
loadAbilityCallbackMap_.erase(iter);
|
||||
}
|
||||
return callback;
|
||||
}
|
||||
|
||||
std::shared_ptr<AbilityRecord> UIAbilityLifecycleManager::GenerateAbilityRecord(AbilityRequest &abilityRequest,
|
||||
sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
{
|
||||
@@ -1415,7 +1430,8 @@ int UIAbilityLifecycleManager::CallAbilityLocked(const AbilityRequest &abilityRe
|
||||
return NotifySCBPendingActivation(sessionInfo, abilityRequest, errMsg);
|
||||
}
|
||||
uiAbilityRecord->SetPendingState(AbilityState::FOREGROUND);
|
||||
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId);
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = GetLoadAbilityCallback(requestId);
|
||||
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId, 0, false, false, callback);
|
||||
return NotifySCBPendingActivation(sessionInfo, abilityRequest, errMsg);
|
||||
} else {
|
||||
if ((persistentId != 0) && abilityRequest.want.GetBoolParam(IS_CALLING_FROM_DMS, false)) {
|
||||
@@ -1513,7 +1529,7 @@ void UIAbilityLifecycleManager::CallUIAbilityBySCB(const sptr<SessionInfo> &sess
|
||||
}
|
||||
|
||||
sptr<SessionInfo> UIAbilityLifecycleManager::CreateSessionInfo(const AbilityRequest &abilityRequest,
|
||||
int32_t requestId) const
|
||||
int32_t requestId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Create session.");
|
||||
sptr<SessionInfo> sessionInfo = new SessionInfo();
|
||||
@@ -1530,6 +1546,12 @@ sptr<SessionInfo> UIAbilityLifecycleManager::CreateSessionInfo(const AbilityRequ
|
||||
sessionInfo->callingTokenId = static_cast<uint32_t>(abilityRequest.want.GetIntParam(Want::PARAM_RESV_CALLER_TOKEN,
|
||||
IPCSkeleton::GetCallingTokenID()));
|
||||
sessionInfo->instanceKey = abilityRequest.want.GetStringParam(Want::APP_INSTANCE_KEY);
|
||||
if (abilityRequest.startOptions.loadAbilityCallback_ != nullptr) {
|
||||
auto callback = iface_cast<AppExecFwk::ILoadAbilityCallback>(abilityRequest.startOptions.loadAbilityCallback_);
|
||||
if (callback != nullptr) {
|
||||
loadAbilityCallbackMap_.emplace(requestId, callback);
|
||||
}
|
||||
}
|
||||
return sessionInfo;
|
||||
}
|
||||
|
||||
@@ -3963,8 +3985,9 @@ bool UIAbilityLifecycleManager::HandleColdAcceptWantDone(const AAFwk::Want &want
|
||||
UpdateSpecifiedFlag(uiAbilityRecord, flag);
|
||||
uiAbilityRecord->SetSpecifiedFlag(flag);
|
||||
auto isShellCall = specifiedRequest.abilityRequest.want.GetBoolParam(IS_SHELL_CALL, false);
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = GetLoadAbilityCallback(specifiedRequest.requestId);
|
||||
uiAbilityRecord->ProcessForegroundAbility(specifiedRequest.callingTokenId,
|
||||
specifiedRequest.sceneFlag, isShellCall);
|
||||
specifiedRequest.sceneFlag, isShellCall, callback);
|
||||
SendKeyEvent(specifiedRequest.abilityRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ StartOptions::StartOptions(const StartOptions &other)
|
||||
supportWindowModes_ = other.supportWindowModes_;
|
||||
requestId_ = other.requestId_;
|
||||
windowCreateParams_ = other.windowCreateParams_;
|
||||
loadAbilityCallback_ = other.loadAbilityCallback_;
|
||||
}
|
||||
|
||||
StartOptions &StartOptions::operator=(const StartOptions &other)
|
||||
@@ -83,6 +84,7 @@ StartOptions &StartOptions::operator=(const StartOptions &other)
|
||||
supportWindowModes_ = other.supportWindowModes_;
|
||||
requestId_ = other.requestId_;
|
||||
windowCreateParams_ = other.windowCreateParams_;
|
||||
loadAbilityCallback_ = other.loadAbilityCallback_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,11 @@ int32_t StartOptionsUtils::CheckStartSelfUIAbilityStartOptions(const Want &want,
|
||||
CHECK_TRUE_RETURN_RET(!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() || !isEnable,
|
||||
ERR_CAPABILITY_NOT_SUPPORT, "not support process options");
|
||||
|
||||
if (options.processOptions->startupVisibility == StartupVisibility::UNSPECIFIED &&
|
||||
options.processOptions->shouldReturnPid) {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
auto uiAbilityManager = DelayedSingleton<AbilityManagerService>::GetInstance()->GetUIAbilityManagerByUid(
|
||||
IPCSkeleton::GetCallingUid());
|
||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||
|
||||
@@ -49,10 +49,12 @@ public:
|
||||
* @param abilityInfo, the ability information.
|
||||
* @param appInfo, the app information.
|
||||
* @param want, the starting information.
|
||||
* @param callback, the callback to get process id.
|
||||
*/
|
||||
virtual void LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const std::shared_ptr<ApplicationInfo> &appInfo,
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam) override;
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback = nullptr) override;
|
||||
|
||||
/**
|
||||
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "iapp_state_callback.h"
|
||||
#include "iapplication_state_observer.h"
|
||||
#include "iconfiguration_observer.h"
|
||||
#include "iload_ability_callback.h"
|
||||
#include "iremote_object.h"
|
||||
#include "irender_state_observer.h"
|
||||
#include "istart_specified_ability_response.h"
|
||||
@@ -101,6 +102,14 @@ class WindowPidVisibilityChangedListener;
|
||||
using LoadAbilityTaskFunc = std::function<void()>;
|
||||
constexpr int32_t BASE_USER_RANGE = 200000;
|
||||
|
||||
struct LoadAbilityCallbackGuard {
|
||||
sptr<ILoadAbilityCallback> callback_ = nullptr;
|
||||
std::shared_ptr<AppRunningRecord> appRecord_ = nullptr;
|
||||
|
||||
LoadAbilityCallbackGuard(sptr<ILoadAbilityCallback> callback) : callback_(callback) {}
|
||||
~LoadAbilityCallbackGuard();
|
||||
};
|
||||
|
||||
class AppMgrServiceInner : public std::enable_shared_from_this<AppMgrServiceInner> {
|
||||
public:
|
||||
struct ConfigurationObserverWithUserId {
|
||||
@@ -127,11 +136,13 @@ public:
|
||||
* @param abilityInfo, the ability information.
|
||||
* @param appInfo, the app information.
|
||||
* @param want the ability want.
|
||||
* @param callback, the callback to get process id.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual void LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam);
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback = nullptr);
|
||||
|
||||
/**
|
||||
* TerminateAbility, terminate the token ability.
|
||||
|
||||
@@ -68,7 +68,8 @@ AmsMgrScheduler::~AmsMgrScheduler()
|
||||
|
||||
void AmsMgrScheduler::LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const std::shared_ptr<ApplicationInfo> &appInfo,
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam)
|
||||
const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback)
|
||||
{
|
||||
if (!abilityInfo || !appInfo) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "param error");
|
||||
@@ -87,8 +88,8 @@ void AmsMgrScheduler::LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInf
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "SubmitLoadTask: %{public}s-%{public}s", abilityInfo->bundleName.c_str(),
|
||||
abilityInfo->name.c_str());
|
||||
std::function<void()> loadAbilityFunc = [amsMgrServiceInner = amsMgrServiceInner_,
|
||||
abilityInfo, appInfo, want, loadParam]() {
|
||||
amsMgrServiceInner->LoadAbility(abilityInfo, appInfo, want, loadParam);
|
||||
abilityInfo, appInfo, want, loadParam, callback]() {
|
||||
amsMgrServiceInner->LoadAbility(abilityInfo, appInfo, want, loadParam, callback);
|
||||
};
|
||||
|
||||
// cache other application load ability task before scene board attach
|
||||
|
||||
@@ -871,9 +871,25 @@ void AppMgrServiceInner::ReportEventToRSS(const AppExecFwk::AbilityInfo &ability
|
||||
});
|
||||
}
|
||||
|
||||
void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam)
|
||||
LoadAbilityCallbackGuard::~LoadAbilityCallbackGuard()
|
||||
{
|
||||
if (callback_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (appRecord_ == nullptr || appRecord_->GetPriorityObject() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "loadability failed");
|
||||
callback_->OnFinish(-1);
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "loadability callback, pid:%{public}d", appRecord_->GetPriorityObject()->GetPid());
|
||||
callback_->OnFinish(appRecord_->GetPriorityObject()->GetPid());
|
||||
}
|
||||
|
||||
void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback)
|
||||
{
|
||||
LoadAbilityCallbackGuard guard(callback);
|
||||
if (AAFwk::AppUtils::GetInstance().IsForbidStart()) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "forbid start: %{public}s", abilityInfo ? abilityInfo->bundleName.c_str() : "");
|
||||
return;
|
||||
@@ -1054,6 +1070,7 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, s
|
||||
}
|
||||
want->RemoveParam(UIEXTENSION_BIND_ABILITY_ID);
|
||||
}
|
||||
guard.appRecord_ = appRecord;
|
||||
AfterLoadAbility(appRecord, abilityInfo, loadParam);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ public:
|
||||
virtual ~MockAppMgrServiceInner()
|
||||
{}
|
||||
|
||||
MOCK_METHOD4(LoadAbility, void(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam));
|
||||
MOCK_METHOD5(LoadAbility, void(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback));
|
||||
MOCK_METHOD2(AttachApplication, void(const pid_t pid, const sptr<IAppScheduler>& app));
|
||||
MOCK_METHOD1(ApplicationForegrounded, void(const int32_t recordId));
|
||||
MOCK_METHOD1(ApplicationBackgrounded, void(const int32_t recordId));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2025 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
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
virtual ~MockAppMgrClient() {};
|
||||
|
||||
virtual AppMgrResultCode LoadAbility(const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo,
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam)
|
||||
const AAFwk::Want &want, AbilityRuntime::LoadParam loadParam, sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "MockAppMgrClient LoadAbility enter.");
|
||||
token_ = loadParam.token;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 MOCK_OHOS_ABILITY_RUNTIME_MOCK_LOAD_ABILITY_CALLBACK_H
|
||||
#define MOCK_OHOS_ABILITY_RUNTIME_MOCK_LOAD_ABILITY_CALLBACK_H
|
||||
|
||||
#include "load_ability_callback_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
class MockLoadAbilityCallback : public AppExecFwk::LoadAbilityCallbackStub {
|
||||
public:
|
||||
MockLoadAbilityCallback() {};
|
||||
virtual ~MockLoadAbilityCallback() {};
|
||||
virtual void OnFinish(int32_t pid) override;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_LOAD_ABILITY_CALLBACK_H
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 "mock_load_ability_callback.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
void MockLoadAbilityCallback::OnFinish(int32_t __attribute__((unused)) pid)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::TEST, "mock MockLoadAbilityCallback::OnFinish");
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
+2
-1
@@ -42,7 +42,8 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback>& callback)
|
||||
}
|
||||
|
||||
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam &loadParam, const AppExecFwk::AbilityInfo& abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want)
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "Test AppScheduler::LoadAbility()");
|
||||
if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) {
|
||||
|
||||
@@ -26,9 +26,10 @@ struct LoadParam;
|
||||
namespace AppExecFwk {
|
||||
class MockAmsMgrScheduler : public AmsMgrStub {
|
||||
public:
|
||||
MOCK_METHOD4(LoadAbility,
|
||||
MOCK_METHOD5(LoadAbility,
|
||||
void(const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
|
||||
const std::shared_ptr<AAFwk::Want>& want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam));
|
||||
const std::shared_ptr<AAFwk::Want>& want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<ILoadAbilityCallback> callback));
|
||||
MOCK_METHOD2(TerminateAbility, void(const sptr<IRemoteObject>& token, bool clearMissionFlag));
|
||||
MOCK_METHOD2(UpdateAbilityState, void(const sptr<IRemoteObject>& token, const AbilityState state));
|
||||
MOCK_METHOD0(Reset, void());
|
||||
|
||||
@@ -32,8 +32,9 @@ public:
|
||||
virtual ~MockAppMgrServiceInner()
|
||||
{}
|
||||
|
||||
MOCK_METHOD4(LoadAbility, void(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam));
|
||||
MOCK_METHOD5(LoadAbility, void(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
|
||||
std::shared_ptr<AAFwk::Want> want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback));
|
||||
MOCK_METHOD2(AttachApplication, void(const pid_t pid, const sptr<IAppScheduler>& app));
|
||||
MOCK_METHOD1(ApplicationForegrounded, void(const int32_t recordId));
|
||||
MOCK_METHOD1(ApplicationBackgrounded, void(const int32_t recordId));
|
||||
|
||||
@@ -358,6 +358,22 @@ HWTEST_F(AbilityManagerClientTest, StartSelfUIAbilityWithStartOptions_0100, Test
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartSelfUIAbilityWithStartOptions_0100 end");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AbilityManagerClient_StartSelfUIAbilityWithPidResult_0100
|
||||
* @tc.desc: StartSelfUIAbilityWithPidResult
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AbilityManagerClientTest, StartSelfUIAbilityWithPidResult_0100, TestSize.Level1)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartSelfUIAbilityWithPidResult_0100 start");
|
||||
AAFwk::Want want;
|
||||
AAFwk::StartOptions options;
|
||||
auto result = AbilityManagerClient::GetInstance()->StartSelfUIAbilityWithPidResult(want, options, nullptr);
|
||||
sptr<IRemoteObject> token_(new IPCObjectStub());
|
||||
AbilityManagerClient::GetInstance()->SubmitSaveRecoveryInfo(token_);
|
||||
EXPECT_EQ(result, ERR_OK);
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartSelfUIAbilityWithPidResult_0100 end");
|
||||
}
|
||||
/**
|
||||
* @tc.name: AddQueryERMSObserver_0100
|
||||
* @tc.name: AbilityManagerClient_AddQueryERMSObserver_0100
|
||||
|
||||
@@ -26,8 +26,8 @@ class MockAppMgrClient : public AppMgrClient {
|
||||
public:
|
||||
MockAppMgrClient();
|
||||
~MockAppMgrClient();
|
||||
MOCK_METHOD4(LoadAbility, AppMgrResultCode(const AbilityInfo&, const ApplicationInfo&,
|
||||
const AAFwk::Want&, AbilityRuntime::LoadParam));
|
||||
MOCK_METHOD5(LoadAbility, AppMgrResultCode(const AbilityInfo&, const ApplicationInfo&,
|
||||
const AAFwk::Want&, AbilityRuntime::LoadParam, sptr<AppExecFwk::ILoadAbilityCallback>));
|
||||
MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool));
|
||||
MOCK_METHOD2(UpdateAbilityState, AppMgrResultCode(const sptr<IRemoteObject>& token, const AbilityState state));
|
||||
MOCK_METHOD3(KillApplication, AppMgrResultCode(const std::string&, const bool clearPageStack, int32_t));
|
||||
|
||||
@@ -396,6 +396,7 @@ group("unittest") {
|
||||
"kiosk_manager_test:unittest",
|
||||
"lifecycle_deal_test:unittest",
|
||||
"lifecycle_test:unittest",
|
||||
"load_ability_callback_impl_test:unittest",
|
||||
"local_pending_want_test:unittest",
|
||||
"local_want_agent_info_test:unittest",
|
||||
"main_element_utils_test:unittest",
|
||||
|
||||
@@ -30,6 +30,7 @@ ohos_unittest("ability_manager_proxy_third_test") {
|
||||
|
||||
sources = [
|
||||
"${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp",
|
||||
"${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit/src/mock_load_ability_callback.cpp",
|
||||
"ability_manager_proxy_third_test.cpp",
|
||||
]
|
||||
|
||||
|
||||
+36
-4
@@ -27,6 +27,7 @@
|
||||
#include "mission_snapshot.h"
|
||||
#include "mock_ability_connect_callback.h"
|
||||
#include "mock_ability_token.h"
|
||||
#include "mock_load_ability_callback.h"
|
||||
#include "want_sender_info.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
@@ -186,13 +187,13 @@ HWTEST_F(AbilityManagerProxyTest, StartSelfUIAbility_0100, TestSize.Level1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartSelfUIAbilityWithStartOptions_0200
|
||||
* @tc.name: StartSelfUIAbilityWithStartOptions_0100
|
||||
* @tc.desc: StartSelfUIAbilityWithStartOptions
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, StartSelfUIAbilityWithStartOptions_0200, TestSize.Level1)
|
||||
HWTEST_F(AbilityManagerProxyTest, StartSelfUIAbilityWithStartOptions_0100, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithStartOptions_0200 start";
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithStartOptions_0100 start";
|
||||
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@@ -212,7 +213,38 @@ HWTEST_F(AbilityManagerProxyTest, StartSelfUIAbilityWithStartOptions_0200, TestS
|
||||
static_cast<uint32_t>(AbilityManagerInterfaceCode::START_SELF_UI_ABILITY_WITH_START_OPTIONS), mock_->code_);
|
||||
EXPECT_EQ(result, NO_ERROR);
|
||||
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithStartOptions_0200 end";
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithStartOptions_0100 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartSelfUIAbilityWithPidResult_0100
|
||||
* @tc.desc: StartSelfUIAbilityWithPidResult
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, StartSelfUIAbilityWithPidResult_0100, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithPidResult_0100 start";
|
||||
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
.WillOnce(Invoke(mock_.GetRefPtr(), &AbilityManagerStubMock::InvokeErrorSendRequest));
|
||||
Want want;
|
||||
StartOptions options;
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback = sptr<AbilityRuntime::MockLoadAbilityCallback>::MakeSptr();
|
||||
int32_t result = proxy_->StartSelfUIAbilityWithPidResult(want, options, callback);
|
||||
EXPECT_EQ(
|
||||
static_cast<uint32_t>(AbilityManagerInterfaceCode::START_SELF_UI_ABILITY_WITH_PID_RESULT), mock_->code_);
|
||||
EXPECT_NE(result, NO_ERROR);
|
||||
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
.WillOnce(Invoke(mock_.GetRefPtr(), &AbilityManagerStubMock::InvokeSendRequest));
|
||||
result = proxy_->StartSelfUIAbilityWithPidResult(want, options, callback);
|
||||
EXPECT_EQ(
|
||||
static_cast<uint32_t>(AbilityManagerInterfaceCode::START_SELF_UI_ABILITY_WITH_PID_RESULT), mock_->code_);
|
||||
EXPECT_EQ(result, NO_ERROR);
|
||||
|
||||
GTEST_LOG_(INFO) << "StartSelfUIAbilityWithPidResult_0100 end";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -295,7 +295,7 @@ void AbilityRecord::LoadUIAbility()
|
||||
g_addLifecycleEventTask(token_, methodName);
|
||||
}
|
||||
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide)
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide, sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "LoadLifecycle: abilityName:%{public}s", abilityInfo_.name.c_str());
|
||||
@@ -367,7 +367,8 @@ void AbilityRecord::ForegroundUIExtensionAbility(uint32_t sceneFlag)
|
||||
}
|
||||
|
||||
void AbilityRecord::ProcessForegroundAbility(
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide)
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -307,7 +307,7 @@ void AbilityRecord::LoadUIAbility()
|
||||
g_addLifecycleEventTask(token_, methodName);
|
||||
}
|
||||
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide)
|
||||
int AbilityRecord::LoadAbility(bool isShellCall, bool isStartupHide, sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "LoadLifecycle: abilityName:%{public}s", abilityInfo_.name.c_str());
|
||||
@@ -379,7 +379,8 @@ void AbilityRecord::ForegroundUIExtensionAbility(uint32_t sceneFlag)
|
||||
}
|
||||
|
||||
void AbilityRecord::ProcessForegroundAbility(
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide)
|
||||
uint32_t tokenId, uint32_t sceneFlag, bool isShellCall, bool isStartupHide,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -41,7 +41,8 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback>& callback)
|
||||
}
|
||||
|
||||
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam& loadParam, const AppExecFwk::AbilityInfo& abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want)
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "Test AppScheduler::LoadAbility()");
|
||||
if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) {
|
||||
|
||||
@@ -42,7 +42,8 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback>& callback)
|
||||
}
|
||||
|
||||
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam& loadParam, const AppExecFwk::AbilityInfo& abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want)
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "Test AppScheduler::LoadAbility()");
|
||||
if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2025 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
|
||||
@@ -122,7 +122,7 @@ HWTEST_F(AmsAppMgrClientTest, AppMgrClient_001, TestSize.Level1)
|
||||
sptr<IAmsMgr> amsMgrScheduler(new MockAmsMgrScheduler());
|
||||
|
||||
EXPECT_CALL(*(static_cast<MockAmsMgrScheduler*>(amsMgrScheduler.GetRefPtr())),
|
||||
LoadAbility(_, _, _, _)).Times(1);
|
||||
LoadAbility(_, _, _, _, _)).Times(1);
|
||||
|
||||
EXPECT_CALL(*(static_cast<MockAppMgrService*>((iface_cast<IAppMgr>(client_->GetRemoteObject())).GetRefPtr())),
|
||||
GetAmsMgr())
|
||||
|
||||
@@ -114,7 +114,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_001, TestSize.Level1)
|
||||
std::shared_ptr<ApplicationInfo> applicationInfo = std::make_shared<ApplicationInfo>();
|
||||
applicationInfo->name = GetTestAppName();
|
||||
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _))
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _))
|
||||
.WillOnce(InvokeWithoutArgs(mockAppMgrServiceInner.get(), &MockAppMgrServiceInner::Post));
|
||||
AbilityRuntime::LoadParam loadParam;
|
||||
loadParam.token = new MockAbilityToken();
|
||||
@@ -150,7 +150,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_002, TestSize.Level1)
|
||||
applicationInfo->name = GetTestAppName();
|
||||
|
||||
// check token parameter
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _)).Times(0);
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0);
|
||||
AbilityRuntime::LoadParam loadParam;
|
||||
loadParam.token = new MockAbilityToken();
|
||||
loadParam.preToken = new MockAbilityToken();
|
||||
@@ -158,7 +158,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_002, TestSize.Level1)
|
||||
amsMgrScheduler->LoadAbility(nullptr, applicationInfo, nullptr, loadParamPtr);
|
||||
|
||||
// check pretoken parameter
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _)).Times(0);
|
||||
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0);
|
||||
amsMgrScheduler->LoadAbility(abilityInfo, nullptr, nullptr, loadParamPtr);
|
||||
|
||||
TAG_LOGD(AAFwkTag::TEST, "AmsMgrScheduler_002 end.");
|
||||
|
||||
@@ -41,7 +41,8 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback>& callback)
|
||||
}
|
||||
|
||||
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam& loadParam, const AppExecFwk::AbilityInfo& abilityInfo,
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want)
|
||||
const AppExecFwk::ApplicationInfo& applicationInfo, const AAFwk::Want& want,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "Test AppScheduler::LoadAbility()");
|
||||
if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2025 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
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
{}
|
||||
MOCK_METHOD0(ConnectAppMgrService, AppMgrResultCode());
|
||||
MOCK_METHOD1(RegisterAppStateCallback, AppMgrResultCode(const sptr<IAppStateCallback> &callback));
|
||||
MOCK_METHOD4(LoadAbility, AppMgrResultCode(const AbilityInfo&, const ApplicationInfo&,
|
||||
const AAFwk::Want&, AbilityRuntime::LoadParam));
|
||||
MOCK_METHOD5(LoadAbility, AppMgrResultCode(const AbilityInfo&, const ApplicationInfo&,
|
||||
const AAFwk::Want&, AbilityRuntime::LoadParam, sptr<ILoadAbilityCallback>));
|
||||
MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool));
|
||||
MOCK_METHOD2(UpdateExtensionState, AppMgrResultCode(const sptr<IRemoteObject> &token, const ExtensionState state));
|
||||
MOCK_METHOD4(UpdateApplicationInfoInstalled, AppMgrResultCode(const std::string &bundleName, const int uid,
|
||||
|
||||
@@ -248,7 +248,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_LoadAbility_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*clientMock_, LoadAbility(_, _, _, _)).Times(1)
|
||||
EXPECT_CALL(*clientMock_, LoadAbility(_, _, _, _, _)).Times(1)
|
||||
.WillOnce(Return(AppMgrResultCode::ERROR_SERVICE_NOT_READY));
|
||||
sptr<IRemoteObject> token;
|
||||
sptr<IRemoteObject> preToken;
|
||||
|
||||
+111
-31
@@ -2647,124 +2647,155 @@ HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToCommonBusinessErrorC
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ConvertToAPI18BusinessErrorCode_001
|
||||
* @tc.desc: ConvertToAPI18BusinessErrorCode
|
||||
* @tc.number: ConvertToAPI17BusinessErrorCode_001
|
||||
* @tc.desc: ConvertToAPI17BusinessErrorCode
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToAPI18BusinessErrorCode_001, TestSize.Level2)
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToAPI17BusinessErrorCode_001, TestSize.Level2)
|
||||
{
|
||||
int32_t abilityManagerError = OHOS::ERR_OK;
|
||||
AbilityRuntime_ErrorCode errCode = ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
|
||||
abilityManagerError = OHOS::ERR_OK;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NO_ERROR);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::CHECK_PERMISSION_FAILED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED);
|
||||
|
||||
abilityManagerError = OHOS::ERR_PERMISSION_DENIED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_CAPABILITY_NOT_SUPPORT;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::RESOLVE_ABILITY_ERR;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::TARGET_BUNDLE_NOT_EXIST;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_NOT_ALLOW_IMPLICIT_START;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_WRONG_INTERFACE_CALL;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::TARGET_ABILITY_NOT_SERVICE;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::RESOLVE_CALL_ABILITY_TYPE_ERR;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_CROWDTEST_EXPIRED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED);
|
||||
|
||||
abilityManagerError = OHOS::ERR_WOULD_BLOCK;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE);
|
||||
|
||||
abilityManagerError = -1;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INTERNAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ConvertToAPI18BusinessErrorCode_002
|
||||
* @tc.desc: ConvertToAPI18BusinessErrorCode
|
||||
* @tc.number: ConvertToAPI17BusinessErrorCode_002
|
||||
* @tc.desc: ConvertToAPI17BusinessErrorCode
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToAPI18BusinessErrorCode_002, TestSize.Level2)
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToAPI17BusinessErrorCode_002, TestSize.Level2)
|
||||
{
|
||||
int32_t abilityManagerError = OHOS::ERR_OK;
|
||||
AbilityRuntime_ErrorCode errCode = ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_APP_CONTROLLED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_CONTROLLED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_EDM_APP_CONTROLLED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_START_OTHER_APP_FAILED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_CROSS_APP);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::NOT_TOP_ABILITY;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_START_OPTIONS_CHECK_FAILED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_UPPER_LIMIT;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_APP_INSTANCE_KEY_NOT_SUPPORT;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_NOT_SELF_APPLICATION;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_CROSS_APP);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_MULTI_APP_NOT_SUPPORTED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_INVALID_APP_INSTANCE_KEY;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_MULTI_INSTANCE_NOT_SUPPORTED;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED);
|
||||
|
||||
abilityManagerError = -1;
|
||||
errCode = ConvertToAPI18BusinessErrorCode(abilityManagerError);
|
||||
errCode = ConvertToAPI17BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INTERNAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ConvertToAPI21BusinessErrorCode_001
|
||||
* @tc.desc: ConvertToAPI21BusinessErrorCode
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, ConvertToAPI21BusinessErrorCode_001, TestSize.Level2)
|
||||
{
|
||||
int32_t abilityManagerError = OHOS::ERR_OK;
|
||||
AbilityRuntime_ErrorCode errCode = ABILITY_RUNTIME_ERROR_CODE_NO_ERROR;
|
||||
|
||||
abilityManagerError = OHOS::ERR_OK;
|
||||
errCode = ConvertToAPI21BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_NO_ERROR);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::CHECK_PERMISSION_FAILED;
|
||||
errCode = ConvertToAPI21BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_MULTI_APP_NOT_SUPPORTED;
|
||||
errCode = ConvertToAPI21BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_ATTACH_ABILITY_THREAD_FAILED;
|
||||
errCode = ConvertToAPI21BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_START_TIMEOUT);
|
||||
|
||||
abilityManagerError = OHOS::AAFwk::ERR_WRITE_INT_FAILED;
|
||||
errCode = ConvertToAPI21BusinessErrorCode(abilityManagerError);
|
||||
EXPECT_EQ(errCode, ABILITY_RUNTIME_ERROR_CODE_INTERNAL);
|
||||
}
|
||||
|
||||
@@ -2790,4 +2821,53 @@ HWTEST_F(CapiAbilityRuntimeApplicationContextTest, GetVersionCode_001, TestSize.
|
||||
ASSERT_EQ(code, ABILITY_RUNTIME_ERROR_CODE_NO_ERROR);
|
||||
ASSERT_EQ(versionCode, 111);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: OH_AbilityRuntime_StartSelfUIAbilityWithPidResult_001
|
||||
* @tc.desc: OH_AbilityRuntime_StartSelfUIAbilityWithPidResult returns 16000134
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, OH_AbilityRuntime_StartSelfUIAbilityWithPidResult_001,
|
||||
TestSize.Level2)
|
||||
{
|
||||
// Act
|
||||
int32_t pid = -1;
|
||||
AbilityRuntime_ErrorCode result = OH_AbilityRuntime_StartSelfUIAbilityWithPidResult(nullptr, nullptr, pid);
|
||||
|
||||
// Assert
|
||||
EXPECT_EQ(ABILITY_RUNTIME_ERROR_CODE_MAIN_THREAD_NOT_SUPPORTED, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: OH_AbilityRuntime_StartSelfUIAbilityWithPidResult_002
|
||||
* @tc.desc: OH_AbilityRuntime_StartSelfUIAbilityWithPidResult does not return ERR_OK when everything is ok
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CapiAbilityRuntimeApplicationContextTest, OH_AbilityRuntime_StartSelfUIAbilityWithPidResult_002,
|
||||
TestSize.Level2)
|
||||
{
|
||||
// Arrange
|
||||
AbilityBase_Want want;
|
||||
char bundleName[] = "com.example.myapplication";
|
||||
want.element.bundleName = bundleName;
|
||||
|
||||
char abilityName[] = "com.test.Ability";
|
||||
want.element.abilityName = abilityName;
|
||||
|
||||
char moduleName[] = "com.test.module";
|
||||
want.element.moduleName = moduleName;
|
||||
|
||||
AbilityRuntime_StartOptions *options = OH_AbilityRuntime_CreateStartOptions();
|
||||
ASSERT_NE(options, nullptr);
|
||||
|
||||
// Act
|
||||
int32_t pid = -1;
|
||||
AbilityRuntime_ErrorCode result = OH_AbilityRuntime_StartSelfUIAbilityWithPidResult(&want, options, pid);
|
||||
|
||||
// Assert
|
||||
EXPECT_NE(ABILITY_RUNTIME_ERROR_CODE_NO_ERROR, result);
|
||||
|
||||
ASSERT_EQ(OH_AbilityRuntime_DestroyStartOptions(&options), ABILITY_RUNTIME_ERROR_CODE_NO_ERROR);
|
||||
ASSERT_EQ(options, nullptr);
|
||||
}
|
||||
} // namespace OHOS::AbilityRuntime
|
||||
|
||||
+6
@@ -1043,6 +1043,12 @@ ErrCode AbilityManagerClient::StartSelfUIAbilityWithStartOptions(const Want &wan
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int AbilityManagerClient::StartSelfUIAbilityWithPidResult(const Want &want, StartOptions &options,
|
||||
sptr<AppExecFwk::ILoadAbilityCallback> callback)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void AbilityManagerClient::PrepareTerminateAbilityDone(sptr<IRemoteObject> token, bool isTerminate)
|
||||
{}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# Copyright (c) 2025 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("//build/test.gni")
|
||||
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
||||
|
||||
module_output_path = "ability_runtime/ability_runtime/abilitymgr"
|
||||
|
||||
ohos_unittest("load_ability_callback_impl_test") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
blocklist = "../../cfi_blocklist.txt"
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"${ability_runtime_path}/frameworks/c/ability_runtime/include",
|
||||
"${ability_runtime_path}/services/common/include",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${ability_runtime_path}/frameworks/c/ability_runtime/src/load_ability_callback_impl.cpp",
|
||||
"load_ability_callback_impl_test.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${ability_runtime_innerkits_path}/app_manager:app_manager",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"ffrt:libffrt",
|
||||
"googletest:gmock_main",
|
||||
"googletest:gtest_main",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
|
||||
cflags_cc = []
|
||||
if (os_dlp_part_enabled) {
|
||||
cflags_cc += [ "-DWITH_DLP" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
deps = [ ":load_ability_callback_impl_test" ]
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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 <gtest/gtest.h>
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "load_ability_callback_impl.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace testing;
|
||||
using namespace OHOS::AbilityRuntime;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class LoadAbilityCallbackImplTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
void LoadAbilityCallbackImplTest::SetUpTestCase(void) {}
|
||||
void LoadAbilityCallbackImplTest::TearDownTestCase(void) {}
|
||||
void LoadAbilityCallbackImplTest::TearDown() {}
|
||||
void LoadAbilityCallbackImplTest::SetUp() {}
|
||||
|
||||
/**
|
||||
* @tc.name: LoadAbilityCallbackImplTest_OnFinish_0001
|
||||
* @tc.desc: Test the state of OnFinish
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(LoadAbilityCallbackImplTest, OnFinish_0001, TestSize.Level1)
|
||||
{
|
||||
bool called = false;
|
||||
int32_t targetPid = -1;
|
||||
OnFinishTask task = [&called, &targetPid](int32_t pid) {
|
||||
targetPid = pid;
|
||||
called = true;
|
||||
};
|
||||
auto callbackImpl = std::make_shared<LoadAbilityCallbackImpl>(std::move(task));
|
||||
int32_t pid = 10000;
|
||||
callbackImpl->OnFinish(pid);
|
||||
EXPECT_NE(callbackImpl->task_, nullptr);
|
||||
EXPECT_TRUE(called);
|
||||
EXPECT_EQ(targetPid, pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: LoadAbilityCallbackImplTest_Cancel_0001
|
||||
* @tc.desc: Test the state of Cancel
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(LoadAbilityCallbackImplTest, Cancel_0001, TestSize.Level1)
|
||||
{
|
||||
bool called = false;
|
||||
int32_t targetPid = -1;
|
||||
OnFinishTask task = [&called, &targetPid](int32_t pid) {
|
||||
targetPid = pid;
|
||||
called = true;
|
||||
};
|
||||
auto callbackImpl = std::make_shared<LoadAbilityCallbackImpl>(std::move(task));
|
||||
EXPECT_NE(callbackImpl->task_, nullptr);
|
||||
|
||||
callbackImpl->Cancel();
|
||||
int32_t pid = 10000;
|
||||
callbackImpl->OnFinish(pid);
|
||||
EXPECT_EQ(callbackImpl->task_, nullptr);
|
||||
EXPECT_FALSE(called);
|
||||
EXPECT_NE(targetPid, pid);
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
@@ -243,6 +243,31 @@ HWTEST_F(StartOptionsUtilsTest, CheckStartSelfUIAbilityStartOptions_006, TestSiz
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartOptionsUtilsTest CheckStartSelfUIAbilityStartOptions_006 end");
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: StartOptionsUtils
|
||||
* Function: CheckStartSelfUIAbilityStartOptions
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: StartOptionsUtils CheckStartSelfUIAbilityStartOptions
|
||||
*/
|
||||
HWTEST_F(StartOptionsUtilsTest, CheckStartSelfUIAbilityStartOptions_007, TestSize.Level1)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartOptionsUtilsTest CheckStartSelfUIAbilityStartOptions_007 start");
|
||||
|
||||
MyFlag::GetInstance().isScbEnabled_ = true;
|
||||
MyFlag::GetInstance().isStartOptionsWithProcessOptions_ = true;
|
||||
MyFlag::GetInstance().uiManager_ = nullptr;
|
||||
|
||||
Want want;
|
||||
StartOptions startOptions;
|
||||
startOptions.processOptions = std::make_shared<ProcessOptions>();
|
||||
startOptions.processOptions->startupVisibility = StartupVisibility::UNSPECIFIED;
|
||||
startOptions.processOptions->shouldReturnPid = true;
|
||||
auto ret = StartOptionsUtils::CheckStartSelfUIAbilityStartOptions(want, startOptions);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartOptionsUtilsTest CheckStartSelfUIAbilityStartOptions_007 end");
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: StartOptionsUtils
|
||||
* Name: CheckProcessOptionsInner_001
|
||||
|
||||
Reference in New Issue
Block a user