mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
Merge branch 'master' of gitee.com:openharmony/ability_ability_runtime into master
Signed-off-by: 孙旭辉 <sunxuhui7@huawei.com>
This commit is contained in:
@@ -74,6 +74,8 @@ static int32_t ErrorCodeReturn(int32_t code)
|
||||
return CONTINUE_ALREADY_IN_PROGRESS;
|
||||
case MISSION_FOR_CONTINUING_IS_NOT_ALIVE:
|
||||
return MISSION_FOR_CONTINUING_IS_NOT_ALIVE;
|
||||
case ERR_NOT_SYSTEM_APP:
|
||||
return NOT_SYSTEM_APP;
|
||||
default:
|
||||
return SYSTEM_WORK_ABNORMALLY;
|
||||
};
|
||||
@@ -115,6 +117,8 @@ static std::string ErrorMessageReturn(int32_t code)
|
||||
case ERR_BIND_REMOTE_IN_BUSY_LINK:
|
||||
return std::string("the remote device has been linked with other devices, try again when "
|
||||
"the remote device is idle.");
|
||||
case NOT_SYSTEM_APP:
|
||||
return std::string("The app is not system-app.");
|
||||
default:
|
||||
return std::string("the system ability work abnormally.");
|
||||
};
|
||||
|
||||
@@ -226,6 +226,10 @@ enum ErrorCode {
|
||||
* Result(201) for permission denied.
|
||||
*/
|
||||
PERMISSION_DENIED = 201,
|
||||
/**
|
||||
* Result(202) for non-system-app use system-api.
|
||||
*/
|
||||
NOT_SYSTEM_APP = 202,
|
||||
/**
|
||||
* Result(401) for parameter check failed.
|
||||
*/
|
||||
|
||||
@@ -1425,7 +1425,7 @@ napi_value JsAbilityContext::OnTerminateSelfWithResult(napi_env env, NapiCallbac
|
||||
|
||||
NapiAsyncTask::CompleteCallback complete =
|
||||
[weak = context_, want, resultCode](napi_env env, NapiAsyncTask& task, int32_t status) {
|
||||
TAG_LOGI(AAFwkTag::CONTEXT, "async terminateSelfWithResult ");
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "terminateSelfWithResult");
|
||||
auto context = weak.lock();
|
||||
if (!context) {
|
||||
TAG_LOGW(AAFwkTag::CONTEXT, "released context");
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
const int32_t BLOCK_ABILITY_TIME = 20;
|
||||
#endif
|
||||
void AbilityThread::AbilityThreadMain(const std::shared_ptr<OHOSApplication> &application,
|
||||
const std::shared_ptr<AbilityLocalRecord> &abilityRecord, const std::shared_ptr<EventRunner> &mainRunner,
|
||||
const std::shared_ptr<AbilityRuntime::Context> &stageContext)
|
||||
@@ -287,23 +284,5 @@ void AbilityThread::UpdateSessionToken(sptr<IRemoteObject> sessionToken)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "called");
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilityThread::BlockAbility()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "begin");
|
||||
if (abilityHandler_) {
|
||||
auto task = []() {
|
||||
while (1) {
|
||||
std::this_thread::sleep_for(BLOCK_ABILITY_TIME * 1s);
|
||||
}
|
||||
};
|
||||
abilityHandler_->PostTask(task, "AbilityThread:BlockAbility");
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "end");
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
#endif
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -113,6 +113,46 @@ void ConfigurationUtils::UpdateDisplayConfig(Rosen::DisplayId displayId, std::sh
|
||||
Rosen::Window::UpdateConfigurationForAll(diffConfiguration);
|
||||
}
|
||||
|
||||
void ConfigurationUtils::InitDisplayConfig(std::shared_ptr<Configuration> configuration,
|
||||
std::shared_ptr<ResourceManager> resourceManager, Rosen::DisplayId displayId, float density, int32_t orientation)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "Init display config");
|
||||
if (configuration == nullptr || resourceManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY, "Input invalid");
|
||||
return;
|
||||
}
|
||||
auto direction = GetDirectionStr(orientation);
|
||||
configuration->AddItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density));
|
||||
configuration->AddItem(displayId, ConfigurationInner::APPLICATION_DIRECTION, direction);
|
||||
configuration->AddItem(ConfigurationInner::APPLICATION_DISPLAYID, std::to_string(displayId));
|
||||
UpdateDisplayResConfig(resourceManager, density, direction);
|
||||
}
|
||||
|
||||
bool ConfigurationUtils::UpdateDisplayConfig(std::shared_ptr<Configuration> configuration,
|
||||
std::shared_ptr<ResourceManager> resourceManager, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "Update display config");
|
||||
if (configuration == nullptr || resourceManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITY, "Input invalid");
|
||||
return false;
|
||||
}
|
||||
auto direction = GetDirectionStr(static_cast<int32_t>(orientation));
|
||||
Configuration newConfig;
|
||||
newConfig.AddItem(displayId, ConfigurationInner::APPLICATION_DENSITYDPI, GetDensityStr(density));
|
||||
newConfig.AddItem(displayId, ConfigurationInner::APPLICATION_DIRECTION, direction);
|
||||
|
||||
std::vector<std::string> changeKeyV;
|
||||
configuration->CompareDifferent(changeKeyV, newConfig);
|
||||
if (changeKeyV.empty()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "There's no changed config");
|
||||
return false;
|
||||
}
|
||||
configuration->Merge(changeKeyV, newConfig);
|
||||
UpdateDisplayResConfig(resourceManager, density, direction);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigurationUtils::GetDisplayConfig(Rosen::DisplayId displayId, float &density,
|
||||
std::string &directionStr)
|
||||
{
|
||||
|
||||
@@ -189,7 +189,8 @@ void ExtensionImpl::Start(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::EXT, "ExtensionImpl::Start");
|
||||
if (extension_->abilityInfo_->extensionAbilityType == AppExecFwk::ExtensionAbilityType::WINDOW) {
|
||||
if (extension_->abilityInfo_->extensionAbilityType == AppExecFwk::ExtensionAbilityType::WINDOW ||
|
||||
AAFwk::UIExtensionUtils::IsUIExtension(extension_->abilityInfo_->extensionAbilityType)) {
|
||||
extension_->OnStart(want, sessionInfo);
|
||||
} else {
|
||||
extension_->OnStart(want);
|
||||
|
||||
+3
-3
@@ -483,9 +483,9 @@ napi_value JsEmbeddableUIAbilityContext::OnRequestModalUIExtension(napi_env env,
|
||||
napi_value JsEmbeddableUIAbilityContext::OnOpenAtomicService(napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
if (screenMode_ == AAFwk::EMBEDDED_FULL_SCREEN_MODE) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "OnOpenAtomicService in half screen mode.");
|
||||
ThrowError(env, static_cast<int32_t>(AbilityErrorCode::ERROR_CODE_INNER), ERR_MSG_NOT_SUPPORT);
|
||||
return CreateJsUndefined(env);
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "OpenAtomicService in embedded screen mode.");
|
||||
CHECK_POINTER_RETURN(env, jsUIExtensionContext_);
|
||||
return jsUIExtensionContext_->OnOpenAtomicService(env, info);
|
||||
}
|
||||
CHECK_POINTER_RETURN(env, jsAbilityContext_);
|
||||
return jsAbilityContext_->OnOpenAtomicService(env, info);
|
||||
|
||||
@@ -173,6 +173,8 @@ void JsUIExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
|
||||
SetExtensionCommon(
|
||||
JsExtensionCommon::Create(jsRuntime_, static_cast<NativeReference&>(*jsObj_), shellContextRef_));
|
||||
handler_ = handler;
|
||||
RegisterDisplayInfoChangedListener();
|
||||
}
|
||||
|
||||
void JsUIExtension::CreateJSContext(napi_env env, napi_value &contextObj,
|
||||
@@ -234,19 +236,17 @@ void JsUIExtension::BindContext(napi_env env, napi_value obj, std::shared_ptr<AA
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::OnStart(const AAFwk::Want &want)
|
||||
void JsUIExtension::OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
Extension::OnStart(want);
|
||||
auto context = GetContext();
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
if (context != nullptr) {
|
||||
int32_t displayId = static_cast<int32_t>(Rosen::DisplayManager::GetInstance().GetDefaultDisplayId());
|
||||
displayId = want.GetIntParam(Want::PARAM_RESV_DISPLAY_ID, displayId);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "displayId %{public}d", displayId);
|
||||
if (context != nullptr && sessionInfo != nullptr) {
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
configUtils->InitDisplayConfig(displayId, context->GetConfiguration(), context->GetResourceManager());
|
||||
configUtils->InitDisplayConfig(context->GetConfiguration(), context->GetResourceManager(),
|
||||
sessionInfo->displayId, sessionInfo->density, sessionInfo->orientation);
|
||||
}
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
|
||||
@@ -279,6 +279,9 @@ void JsUIExtension::OnStop()
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallObjectMethod("onDestroy");
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
UnregisterDisplayInfoChangedListener();
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
OnStopCallBack();
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
@@ -294,6 +297,9 @@ void JsUIExtension::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbac
|
||||
UIExtension::OnStop();
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_value result = CallObjectMethod("onDestroy", nullptr, 0, true);
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
UnregisterDisplayInfoChangedListener();
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
if (!CheckPromise(result)) {
|
||||
OnStopCallBack();
|
||||
isAsyncCallback = false;
|
||||
@@ -353,6 +359,7 @@ bool JsUIExtension::CheckPromise(napi_value result)
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
napi_value PromiseCallback(napi_env env, napi_callback_info info)
|
||||
{
|
||||
void *data = nullptr;
|
||||
@@ -367,6 +374,7 @@ napi_value PromiseCallback(napi_env env, napi_callback_info info)
|
||||
data = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool JsUIExtension::CallPromise(napi_value result, AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo)
|
||||
{
|
||||
@@ -927,9 +935,6 @@ void JsUIExtension::OnConfigurationUpdated(const AppExecFwk::Configuration& conf
|
||||
Extension::OnConfigurationUpdated(configuration);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
|
||||
// Notify extension context
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
@@ -940,15 +945,7 @@ void JsUIExtension::OnConfigurationUpdated(const AppExecFwk::Configuration& conf
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
configUtils->UpdateGlobalConfig(configuration, context->GetResourceManager());
|
||||
|
||||
auto fullConfig = context->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
|
||||
napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration(env, *fullConfig);
|
||||
CallObjectMethod("onConfigurationUpdate", &napiConfiguration, ARGC_ONE);
|
||||
ConfigurationUpdated();
|
||||
}
|
||||
|
||||
void JsUIExtension::Dump(const std::vector<std::string> ¶ms, std::vector<std::string> &info)
|
||||
@@ -1019,5 +1016,95 @@ void JsUIExtension::OnAbilityResult(int requestCode, int resultCode, const Want
|
||||
abilityResultListeners_->OnAbilityResult(requestCode, resultCode, resultData);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtension::ConfigurationUpdated()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
|
||||
// Notify extension context
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
|
||||
auto fullConfig = context->GetConfiguration();
|
||||
if (fullConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
|
||||
napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration(env, *fullConfig);
|
||||
CallObjectMethod("onConfigurationUpdate", &napiConfiguration, ARGC_ONE);
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
void JsUIExtension::OnDisplayInfoChange(
|
||||
const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density, Rosen::DisplayOrientation orientation)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "displayId: %{public}" PRIu64 "", displayId);
|
||||
auto context = GetContext();
|
||||
if (context == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
auto contextConfig = context->GetConfiguration();
|
||||
if (contextConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Configuration is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Config dump: %{public}s", contextConfig->GetName().c_str());
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
auto result =
|
||||
configUtils->UpdateDisplayConfig(contextConfig, context->GetResourceManager(), displayId, density, orientation);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Config dump after update: %{public}s", contextConfig->GetName().c_str());
|
||||
if (result) {
|
||||
auto jsUiExtension = std::static_pointer_cast<JsUIExtension>(shared_from_this());
|
||||
auto task = [jsUiExtension]() {
|
||||
if (jsUiExtension) {
|
||||
jsUiExtension->ConfigurationUpdated();
|
||||
}
|
||||
};
|
||||
if (handler_ != nullptr) {
|
||||
handler_->PostTask(task, "JsUIExtension:OnChange");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JsUIExtension::RegisterDisplayInfoChangedListener()
|
||||
{
|
||||
// register displayid change callback
|
||||
auto jsUiExtension = std::static_pointer_cast<JsUIExtension>(shared_from_this());
|
||||
jsUiExtensionAbilityDisplayListener_ = sptr<JsUIExtensionAbilityDisplayListener>::MakeSptr(jsUiExtension);
|
||||
if (jsUiExtensionAbilityDisplayListener_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "jsUiExtensionAbilityDisplayListener is nullptr");
|
||||
return;
|
||||
}
|
||||
auto context = GetContext();
|
||||
if (context == nullptr || context->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Param is invalid");
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "RegisterDisplayInfoChangedListener");
|
||||
Rosen::WindowManager::GetInstance().RegisterDisplayInfoChangedListener(
|
||||
context->GetToken(), jsUiExtensionAbilityDisplayListener_);
|
||||
}
|
||||
|
||||
void JsUIExtension::UnregisterDisplayInfoChangedListener()
|
||||
{
|
||||
auto context = GetContext();
|
||||
if (context == nullptr || context->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Param is invalid");
|
||||
return;
|
||||
}
|
||||
Rosen::WindowManager::GetInstance().UnregisterDisplayInfoChangedListener(
|
||||
context->GetToken(), jsUiExtensionAbilityDisplayListener_);
|
||||
}
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
#include "ability_info.h"
|
||||
#include "ability_manager_client.h"
|
||||
#include "configuration_utils.h"
|
||||
#include "connection_manager.h"
|
||||
#include "context.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "insight_intent_executor_info.h"
|
||||
#include "insight_intent_executor_mgr.h"
|
||||
@@ -149,7 +152,8 @@ std::shared_ptr<ExtensionCommon> JsUIExtensionBase::Init(const std::shared_ptr<A
|
||||
}
|
||||
|
||||
BindContext();
|
||||
|
||||
handler_ = handler;
|
||||
RegisterDisplayInfoChangedListener();
|
||||
return JsExtensionCommon::Create(jsRuntime_, static_cast<NativeReference&>(*jsObj_), shellContextRef_);
|
||||
}
|
||||
|
||||
@@ -204,12 +208,25 @@ void JsUIExtensionBase::BindContext()
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnStart(const AAFwk::Want &want, AAFwk::LaunchParam &launchParam)
|
||||
void JsUIExtensionBase::OnStart(
|
||||
const AAFwk::Want &want, AAFwk::LaunchParam &launchParam, sptr<AAFwk::SessionInfo> sessionInfo)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
if (context_ != nullptr && sessionInfo != nullptr) {
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
configUtils->InitDisplayConfig(context_->GetConfiguration(), context_->GetResourceManager(),
|
||||
sessionInfo->displayId, sessionInfo->density, sessionInfo->orientation);
|
||||
}
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
|
||||
if (context_ != nullptr) {
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, context_->GetConfiguration());
|
||||
}
|
||||
napi_value napiWant = OHOS::AppExecFwk::WrapWant(env, want);
|
||||
if (InsightIntentExecuteParam::IsInsightIntentExecute(want)) {
|
||||
launchParam.launchReason = AAFwk::LaunchReason::LAUNCHREASON_INSIGHT_INTENT;
|
||||
@@ -227,6 +244,134 @@ void JsUIExtensionBase::OnStop()
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "called");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
CallObjectMethod("onDestroy");
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
UnregisterDisplayInfoChangedListener();
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
|
||||
OnStopCallBack();
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo, bool &isAsyncCallback)
|
||||
{
|
||||
if (callbackInfo == nullptr) {
|
||||
isAsyncCallback = false;
|
||||
OnStop();
|
||||
return;
|
||||
}
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_value result = CallObjectMethod("onDestroy", nullptr, 0, true);
|
||||
if (!CheckPromise(result)) {
|
||||
OnStopCallBack();
|
||||
isAsyncCallback = false;
|
||||
return;
|
||||
}
|
||||
|
||||
auto asyncCallback = [extensionWeakPtr = weak_from_this()]() {
|
||||
auto jsUIExtensionBase = extensionWeakPtr.lock();
|
||||
if (jsUIExtensionBase == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "extension is nullptr");
|
||||
return;
|
||||
}
|
||||
jsUIExtensionBase->OnStopCallBack();
|
||||
};
|
||||
callbackInfo->Push(asyncCallback);
|
||||
isAsyncCallback = CallPromise(result, callbackInfo);
|
||||
if (!isAsyncCallback) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to call promise");
|
||||
OnStopCallBack();
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "end");
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnStopCallBack()
|
||||
{
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
auto ret = ConnectionManager::GetInstance().DisconnectCaller(context_->GetToken());
|
||||
if (ret) {
|
||||
ConnectionManager::GetInstance().ReportConnectionLeakEvent(getpid(), gettid());
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "service connection not disconnected");
|
||||
}
|
||||
|
||||
auto applicationContext = Context::GetApplicationContext();
|
||||
if (applicationContext != nullptr) {
|
||||
applicationContext->DispatchOnAbilityDestroy(jsObj_);
|
||||
}
|
||||
}
|
||||
|
||||
bool JsUIExtensionBase::CheckPromise(napi_value result)
|
||||
{
|
||||
if (result == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result is nullptr");
|
||||
return false;
|
||||
}
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
bool isPromise = false;
|
||||
napi_is_promise(env, result, &isPromise);
|
||||
if (!isPromise) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "result isn't promise");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
napi_value PromiseCallback(napi_env env, napi_callback_info info)
|
||||
{
|
||||
void *data = nullptr;
|
||||
NAPI_CALL_NO_THROW(napi_get_cb_info(env, info, nullptr, nullptr, nullptr, &data), nullptr);
|
||||
auto *callbackInfo = static_cast<AppExecFwk::AbilityTransactionCallbackInfo<> *>(data);
|
||||
if (callbackInfo == nullptr) {
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "Invalid input");
|
||||
return nullptr;
|
||||
}
|
||||
callbackInfo->Call();
|
||||
AppExecFwk::AbilityTransactionCallbackInfo<>::Destroy(callbackInfo);
|
||||
data = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool JsUIExtensionBase::CallPromise(napi_value result, AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo)
|
||||
{
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
if (!CheckTypeForNapiValue(env, result, napi_object)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to convert native value to NativeObject");
|
||||
return false;
|
||||
}
|
||||
napi_value then = nullptr;
|
||||
napi_get_named_property(env, result, "then", &then);
|
||||
if (then == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get property: then");
|
||||
return false;
|
||||
}
|
||||
bool isCallable = false;
|
||||
napi_is_callable(env, then, &isCallable);
|
||||
if (!isCallable) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "property then is not callable");
|
||||
return false;
|
||||
}
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_value promiseCallback = nullptr;
|
||||
napi_status createStatus = napi_create_function(env, "promiseCallback", strlen("promiseCallback"), PromiseCallback,
|
||||
callbackInfo, &promiseCallback);
|
||||
if (createStatus != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to create promiseCallback, %{public}d", createStatus);
|
||||
return false;
|
||||
}
|
||||
napi_value argv[1] = { promiseCallback };
|
||||
napi_status callStatus = napi_call_function(env, result, then, 1, argv, nullptr);
|
||||
if (callStatus != napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to call promiseCallback, %{public}d", callStatus);
|
||||
return false;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "exit");
|
||||
return true;
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::OnCommandWindow(
|
||||
@@ -594,7 +739,7 @@ void JsUIExtensionBase::DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInf
|
||||
}
|
||||
}
|
||||
|
||||
napi_value JsUIExtensionBase::CallObjectMethod(const char *name, napi_value const *argv, size_t argc)
|
||||
napi_value JsUIExtensionBase::CallObjectMethod(const char *name, napi_value const *argv, size_t argc, bool withResult)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "CallObjectMethod(%{public}s), begin", name);
|
||||
if (!jsObj_) {
|
||||
@@ -607,13 +752,18 @@ napi_value JsUIExtensionBase::CallObjectMethod(const char *name, napi_value cons
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get object");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HandleEscape handleEscape(jsRuntime_);
|
||||
napi_value method = nullptr;
|
||||
napi_get_named_property(env, obj, name, &method);
|
||||
if (!CheckTypeForNapiValue(env, method, napi_function)) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get '%{public}s' object", name);
|
||||
return nullptr;
|
||||
}
|
||||
if (withResult) {
|
||||
napi_value result = nullptr;
|
||||
napi_call_function(env, obj, method, argc, argv, &result);
|
||||
return handleEscape.Escape(result);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "CallFunction(%{public}s), success", name);
|
||||
napi_value result = nullptr;
|
||||
napi_call_function(env, obj, method, argc, argv, &result);
|
||||
@@ -632,22 +782,7 @@ void JsUIExtensionBase::OnConfigurationUpdated(const AppExecFwk::Configuration &
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
configUtils->UpdateGlobalConfig(configuration, context_->GetResourceManager());
|
||||
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto fullConfig = context_->GetConfiguration();
|
||||
if (!fullConfig) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
|
||||
napi_value napiConfiguration =
|
||||
OHOS::AppExecFwk::WrapConfiguration(env, *fullConfig);
|
||||
if (napiConfiguration == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get configuration");
|
||||
return;
|
||||
}
|
||||
CallObjectMethod("onConfigurationUpdate", &napiConfiguration, ARGC_ONE);
|
||||
ConfigurationUpdated();
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::Dump(const std::vector<std::string> ¶ms, std::vector<std::string> &info)
|
||||
@@ -722,5 +857,91 @@ void JsUIExtensionBase::SetContext(const std::shared_ptr<UIExtensionContext> &co
|
||||
{
|
||||
context_ = context;
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::ConfigurationUpdated()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::UI_EXT, "begin");
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
napi_env env = jsRuntime_.GetNapiEnv();
|
||||
|
||||
// Notify extension context
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Failed to get context");
|
||||
return;
|
||||
}
|
||||
|
||||
auto fullConfig = context_->GetConfiguration();
|
||||
if (fullConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Configuration is nullptr");
|
||||
return;
|
||||
}
|
||||
JsExtensionContext::ConfigurationUpdated(env, shellContextRef_, fullConfig);
|
||||
|
||||
napi_value napiConfiguration = OHOS::AppExecFwk::WrapConfiguration(env, *fullConfig);
|
||||
CallObjectMethod("onConfigurationUpdate", &napiConfiguration, ARGC_ONE);
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
void JsUIExtensionBase::OnDisplayInfoChange(
|
||||
const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density, Rosen::DisplayOrientation orientation)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "displayId: %{public}" PRIu64 "", displayId);
|
||||
if (context_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Context is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
auto contextConfig = context_->GetConfiguration();
|
||||
if (contextConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Configuration is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Config dump: %{public}s", contextConfig->GetName().c_str());
|
||||
auto configUtils = std::make_shared<ConfigurationUtils>();
|
||||
auto result = configUtils->UpdateDisplayConfig(
|
||||
contextConfig, context_->GetResourceManager(), displayId, density, orientation);
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "Config dump after update: %{public}s", contextConfig->GetName().c_str());
|
||||
if (result) {
|
||||
auto jsUiExtension = std::static_pointer_cast<JsUIExtensionBase>(shared_from_this());
|
||||
auto task = [jsUiExtension]() {
|
||||
if (jsUiExtension) {
|
||||
jsUiExtension->ConfigurationUpdated();
|
||||
}
|
||||
};
|
||||
if (handler_ != nullptr) {
|
||||
handler_->PostTask(task, "JsUIExtensionBase:OnChange");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::RegisterDisplayInfoChangedListener()
|
||||
{
|
||||
// register displayid change callback
|
||||
auto jsUiExtensionBase = std::static_pointer_cast<JsUIExtensionBase>(shared_from_this());
|
||||
jsUIExtensionBaseDisplayListener_ = sptr<JsUIExtensionBaseDisplayListener>::MakeSptr(jsUiExtensionBase);
|
||||
if (jsUIExtensionBaseDisplayListener_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "JsUIExtensionBaseDisplayListener is nullptr");
|
||||
return;
|
||||
}
|
||||
if (context_ == nullptr || context_->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Param is invalid");
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::UI_EXT, "RegisterDisplayInfoChangedListener");
|
||||
Rosen::WindowManager::GetInstance().RegisterDisplayInfoChangedListener(
|
||||
context_->GetToken(), jsUIExtensionBaseDisplayListener_);
|
||||
}
|
||||
|
||||
void JsUIExtensionBase::UnregisterDisplayInfoChangedListener()
|
||||
{
|
||||
if (context_ == nullptr || context_->GetToken() == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "Param is invalid");
|
||||
return;
|
||||
}
|
||||
Rosen::WindowManager::GetInstance().UnregisterDisplayInfoChangedListener(
|
||||
context_->GetToken(), jsUIExtensionBaseDisplayListener_);
|
||||
}
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -473,7 +473,10 @@ ohos_shared_library("appkit_delegator") {
|
||||
}
|
||||
|
||||
config("application_context_manager_config") {
|
||||
include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context" ]
|
||||
include_dirs = [
|
||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
|
||||
"${ability_runtime_services_path}/common/include",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("appkit_manager_helper") {
|
||||
@@ -530,6 +533,7 @@ ohos_shared_library("application_context_manager") {
|
||||
|
||||
external_deps = [
|
||||
"ets_runtime:libark_jsruntime",
|
||||
"hilog:libhilog",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "application_context_manager.h"
|
||||
|
||||
#include "hilog_tag_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
namespace {
|
||||
@@ -52,7 +54,10 @@ void ApplicationContextManager::AddGlobalObject(napi_env env,
|
||||
if (envData == nullptr) {
|
||||
return;
|
||||
}
|
||||
napi_add_env_cleanup_hook(env, HandleClean, static_cast<void*>(envData));
|
||||
auto ret = napi_add_env_cleanup_hook(env, HandleClean, static_cast<void*>(envData));
|
||||
if (ret != napi_status::napi_ok) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "add hook err");
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(applicationContextMutex_);
|
||||
auto iter = applicationContextMap_.find(env);
|
||||
if (iter == applicationContextMap_.end()) {
|
||||
|
||||
@@ -993,12 +993,13 @@ bool MainThread::InitResourceManager(std::shared_ptr<Global::Resource::ResourceM
|
||||
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
|
||||
#if defined(SUPPORT_GRAPHICS) && defined(SUPPORT_APP_PREFERRED_LANGUAGE)
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
icu::Locale locale = icu::Locale::forLanguageTag(Global::I18n::PreferredLanguage::GetAppPreferredLanguage(), status);
|
||||
resConfig->SetLocaleInfo(locale);
|
||||
const icu::Locale *localeInfo = resConfig->GetLocaleInfo();
|
||||
if (localeInfo != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "Language: %{public}s, script: %{public}s, region: %{public}s",
|
||||
localeInfo->getLanguage(), localeInfo->getScript(), localeInfo->getCountry());
|
||||
icu::Locale systemLocale = icu::Locale::forLanguageTag(Global::I18n::LocaleConfig::GetSystemLanguage(), status);
|
||||
resConfig->SetLocaleInfo(systemLocale);
|
||||
|
||||
if (Global::I18n::PreferredLanguage::IsSetAppPreferredLanguage()) {
|
||||
icu::Locale preferredLocale =
|
||||
icu::Locale::forLanguageTag(Global::I18n::PreferredLanguage::GetAppPreferredLanguage(), status);
|
||||
resConfig->SetPreferredLocaleInfo(preferredLocale);
|
||||
}
|
||||
#endif
|
||||
std::string colormode = config.GetItem(AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE);
|
||||
@@ -2093,17 +2094,10 @@ void MainThread::HandleCleanAbilityLocal(const sptr<IRemoteObject> &token)
|
||||
}
|
||||
|
||||
std::shared_ptr<AbilityLocalRecord> record = abilityRecordMgr_->GetAbilityItem(token);
|
||||
if (record == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRecord not found");
|
||||
return;
|
||||
}
|
||||
CHECK_POINTER_TAG_LOG(record, AAFwkTag::APPKIT, "abilityRecord not found");
|
||||
std::shared_ptr<AbilityInfo> abilityInfo = record->GetAbilityInfo();
|
||||
if (abilityInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "record->GetAbilityInfo() failed");
|
||||
return;
|
||||
}
|
||||
CHECK_POINTER_TAG_LOG(abilityInfo, AAFwkTag::APPKIT, "record->GetAbilityInfo() failed");
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "ability name: %{public}s", abilityInfo->name.c_str());
|
||||
|
||||
abilityRecordMgr_->RemoveAbilityRecord(token);
|
||||
application_->CleanAbilityStage(token, abilityInfo, false);
|
||||
#ifdef APP_ABILITY_USE_TWO_RUNNER
|
||||
@@ -2119,6 +2113,7 @@ void MainThread::HandleCleanAbilityLocal(const sptr<IRemoteObject> &token)
|
||||
TAG_LOGW(AAFwkTag::APPKIT, "runner not found");
|
||||
}
|
||||
#endif
|
||||
AfterCleanAbilityGC();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2141,29 +2136,16 @@ void MainThread::HandleCleanAbility(const sptr<IRemoteObject> &token, bool isCac
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "should launch application first");
|
||||
return;
|
||||
}
|
||||
|
||||
if (token == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "token is null");
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_POINTER_TAG_LOG(token, AAFwkTag::APPKIT, "token is null");
|
||||
std::shared_ptr<AbilityLocalRecord> record = abilityRecordMgr_->GetAbilityItem(token);
|
||||
if (record == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "abilityRecord not found");
|
||||
return;
|
||||
}
|
||||
CHECK_POINTER_TAG_LOG(record, AAFwkTag::APPKIT, "abilityRecord not found");
|
||||
std::shared_ptr<AbilityInfo> abilityInfo = record->GetAbilityInfo();
|
||||
if (abilityInfo == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "record->GetAbilityInfo() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_POINTER_TAG_LOG(abilityInfo, AAFwkTag::APPKIT, "record->GetAbilityInfo() failed");
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
if (abilityInfo->type == AbilityType::PAGE && abilityInfo->isStageBasedModel) {
|
||||
AppRecovery::GetInstance().RemoveAbility(token);
|
||||
}
|
||||
#endif
|
||||
|
||||
abilityRecordMgr_->RemoveAbilityRecord(token);
|
||||
application_->CleanAbilityStage(token, abilityInfo, isCacheProcess);
|
||||
#ifdef APP_ABILITY_USE_TWO_RUNNER
|
||||
@@ -2180,10 +2162,20 @@ void MainThread::HandleCleanAbility(const sptr<IRemoteObject> &token, bool isCac
|
||||
}
|
||||
#endif
|
||||
appMgr_->AbilityCleaned(token);
|
||||
AfterCleanAbilityGC();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "end. app: %{public}s, ability: %{public}s.",
|
||||
applicationInfo_->name.c_str(), abilityInfo->name.c_str());
|
||||
}
|
||||
|
||||
void MainThread::AfterCleanAbilityGC()
|
||||
{
|
||||
bool appBackground = applicationImpl_ ?
|
||||
applicationImpl_->GetState() != ApplicationImpl::APP_STATE_FOREGROUND : false;
|
||||
if (appBackground) {
|
||||
ForceFullGC();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Foreground the application.
|
||||
|
||||
@@ -813,15 +813,6 @@ void OHOSApplication::CleanAbilityStage(const sptr<IRemoteObject> &token,
|
||||
abilityStage->OnDestroy();
|
||||
abilityStages_.erase(moduleName);
|
||||
}
|
||||
DoCleanWorkAfterStageCleaned(*abilityInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void OHOSApplication::DoCleanWorkAfterStageCleaned(const AbilityInfo &abilityInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "language: %{public}s", abilityInfo.srcLanguage.c_str());
|
||||
if (runtime_) {
|
||||
runtime_->DoCleanWorkAfterStageCleaned();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ constexpr size_t PARAM_TWO = 2;
|
||||
constexpr uint8_t SYSCAP_MAX_SIZE = 100;
|
||||
constexpr int64_t DEFAULT_GC_POOL_SIZE = 0x10000000; // 256MB
|
||||
constexpr int32_t DEFAULT_INTER_VAL = 500;
|
||||
constexpr int32_t TRIGGER_GC_AFTER_CLEAR_STAGE_MS = 3000;
|
||||
constexpr int32_t API8 = 8;
|
||||
const std::string SANDBOX_ARK_CACHE_PATH = "/data/storage/ark-cache/";
|
||||
const std::string SANDBOX_ARK_PROIFILE_PATH = "/data/storage/ark-profile";
|
||||
@@ -914,18 +913,6 @@ void JsRuntime::ReloadFormComponent()
|
||||
#endif
|
||||
}
|
||||
|
||||
void JsRuntime::DoCleanWorkAfterStageCleaned()
|
||||
{
|
||||
// Force gc. If the jsRuntime is destroyed, this task should not be executed.
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "called");
|
||||
RemoveTask("ability_destruct_gc");
|
||||
auto gcTask = [this]() {
|
||||
panda::JSNApi::TriggerGC(GetEcmaVm(), panda::ecmascript::GCReason::TRIGGER_BY_ABILITY,
|
||||
panda::JSNApi::TRIGGER_GC_TYPE::FULL_GC);
|
||||
};
|
||||
PostTask(gcTask, "ability_destruct_gc", TRIGGER_GC_AFTER_CLEAR_STAGE_MS);
|
||||
}
|
||||
|
||||
bool JsRuntime::InitLoop(bool isStage)
|
||||
{
|
||||
CHECK_POINTER_AND_RETURN(jsEnv_, false);
|
||||
|
||||
@@ -600,7 +600,7 @@ public:
|
||||
* @param clearPageStack.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode KillProcess(const std::string &bundleName, const bool clearpagestack = false);
|
||||
ErrCode KillProcess(const std::string &bundleName, const bool clearPageStack = true);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
@@ -1142,30 +1142,6 @@ public:
|
||||
virtual int SetAbilityController(sptr<AppExecFwk::IAbilityController> abilityController,
|
||||
bool imAStabilityTest);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability manager service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode BlockAmsService();
|
||||
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode BlockAbility(int32_t abilityRecordId);
|
||||
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode BlockAppService();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Free install ability from remote DMS.
|
||||
*
|
||||
|
||||
@@ -749,7 +749,7 @@ public:
|
||||
* @param bundleName.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearpagestack = false) = 0;
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) = 0;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
@@ -1142,30 +1142,6 @@ public:
|
||||
*/
|
||||
virtual void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) = 0;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability manager service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAmsService() = 0;
|
||||
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAbility(int32_t abilityRecordId) = 0;
|
||||
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called when client complete dump.
|
||||
*
|
||||
|
||||
@@ -310,12 +310,6 @@ enum class AbilityManagerInterfaceCode {
|
||||
|
||||
START_ABILITY_FOR_OPTIONS = 1028,
|
||||
|
||||
BLOCK_AMS_SERVICE = 1029,
|
||||
|
||||
BLOCK_ABILITY = 1030,
|
||||
|
||||
BLOCK_APP_SERVICE = 1031,
|
||||
|
||||
// ipc id for call ability
|
||||
START_CALL_ABILITY = 1032,
|
||||
|
||||
|
||||
@@ -296,10 +296,6 @@ public:
|
||||
|
||||
virtual void OnExecuteIntent(const Want &want) = 0;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
virtual int BlockAbility() = 0;
|
||||
#endif
|
||||
|
||||
virtual void CallRequest() = 0;
|
||||
|
||||
/**
|
||||
@@ -392,9 +388,6 @@ public:
|
||||
// ipc id for dump ability runner
|
||||
DUMP_ABILITY_RUNNER_INNER,
|
||||
|
||||
// block ability runner
|
||||
BLOCK_ABILITY_INNER,
|
||||
|
||||
SCHEDULE_CALL,
|
||||
|
||||
SCHEDULE_SHARE_DATA,
|
||||
|
||||
@@ -177,6 +177,11 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
virtual int32_t CheckStaticCfgPermission(const Want &want)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
NOTIFY_START_ABILITY = 1,
|
||||
NOTIFY_MISSION_CREATED,
|
||||
@@ -195,6 +200,7 @@ public:
|
||||
UPDATE_CONFIGURATION,
|
||||
OPEN_FILE,
|
||||
NOTIFY_MISSION_BIND_PID,
|
||||
CHECK_STATIC_CFG_PERMISSION,
|
||||
};
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int KillProcessWithAccount(
|
||||
const std::string &bundleName, const int accountId, const bool clearpagestack = false) = 0;
|
||||
const std::string &bundleName, const int accountId, const bool clearPageStack = true) = 0;
|
||||
|
||||
/**
|
||||
* UpdateApplicationInfoInstalled, call UpdateApplicationInfoInstalled() through proxy object,
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
* @param bundleName, bundle name in Application record.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int KillApplication(const std::string &bundleName, const bool clearpagestack = false) = 0;
|
||||
virtual int KillApplication(const std::string &bundleName, const bool clearPageStack = true) = 0;
|
||||
|
||||
/**
|
||||
* ForceKillApplication, call ForceKillApplication() through proxy object, force kill the application.
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int KillApplicationSelf(const bool clearpagestack = false)
|
||||
virtual int KillApplicationSelf(const bool clearPageStack = true)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillProcessWithAccount(
|
||||
const std::string &bundleName, const int accountId, const bool clearpagestack = false) override;
|
||||
const std::string &bundleName, const int accountId, const bool clearPageStack = true) override;
|
||||
|
||||
/**
|
||||
* UpdateApplicationInfoInstalled, call UpdateApplicationInfoInstalled() through proxy object,
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
* @param bundleName, bundle name in Application record.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearpagestack = false) override;
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearPageStack = true) override;
|
||||
|
||||
/**
|
||||
* ForceKillApplication, call ForceKillApplication() through proxy object, force kill the application.
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
*/
|
||||
virtual int32_t KillApplicationByUid(const std::string &bundleName, const int uid) override;
|
||||
|
||||
virtual int KillApplicationSelf(const bool clearpagestack = false) override;
|
||||
virtual int KillApplicationSelf(const bool clearPageStack = true) override;
|
||||
|
||||
virtual int GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application,
|
||||
bool &debug) override;
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
* @param bundleName, bundle name in Application record.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual AppMgrResultCode KillApplication(const std::string &bundleName, const bool clearpagestack = false);
|
||||
virtual AppMgrResultCode KillApplication(const std::string &bundleName, const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* ForceKillApplication, call ForceKillApplication() through proxy object, force kill the application.
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual AppMgrResultCode KillApplicationSelf(const bool clearpagestack = false);
|
||||
virtual AppMgrResultCode KillApplicationSelf(const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* ClearUpApplicationData, call ClearUpApplicationData() through proxy project,
|
||||
@@ -257,6 +257,15 @@ public:
|
||||
*/
|
||||
virtual AppMgrResultCode GetAllRenderProcesses(std::vector<RenderProcessInfo> &info);
|
||||
|
||||
/**
|
||||
* GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
|
||||
* Obtains information about children processes that are running on the device.
|
||||
*
|
||||
* @param info, child process info.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual AppMgrResultCode GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info);
|
||||
|
||||
/**
|
||||
* NotifyMemoryLevel, call NotifyMemoryLevel() through proxy project.
|
||||
* Notify abilities background the current memory level.
|
||||
@@ -378,15 +387,6 @@ public:
|
||||
*/
|
||||
virtual AppMgrResultCode UnregisterConfigurationObserver(const sptr<IConfigurationObserver> &observer);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Start a user test
|
||||
*/
|
||||
|
||||
@@ -177,6 +177,15 @@ public:
|
||||
*/
|
||||
virtual int GetAllRenderProcesses(std::vector<RenderProcessInfo> &info) = 0;
|
||||
|
||||
/**
|
||||
* GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
|
||||
* Obtains information about children processes that are running on the device.
|
||||
*
|
||||
* @param info, child process info.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info) = 0;
|
||||
|
||||
/**
|
||||
* JudgeSandboxByPid, call JudgeSandboxByPid() through proxy project.
|
||||
* Obtains information about application processes that are running on the device.
|
||||
@@ -324,14 +333,6 @@ public:
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int GetAbilityRecordsByProcessID(const int pid, std::vector<sptr<IRemoteObject>> &tokens) = 0;
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Prestart nwebspawn process.
|
||||
|
||||
@@ -38,7 +38,6 @@ enum class AppMgrInterfaceCode {
|
||||
START_USER_TEST_PROCESS = 15,
|
||||
FINISH_USER_TEST = 16,
|
||||
SCHEDULE_ACCEPT_WANT_DONE = 17,
|
||||
BLOCK_APP_SERVICE = 18,
|
||||
APP_GET_ABILITY_RECORDS_BY_PROCESS_ID = 19,
|
||||
START_RENDER_PROCESS = 20,
|
||||
ATTACH_RENDER_PROCESS = 21,
|
||||
@@ -112,6 +111,7 @@ enum class AppMgrInterfaceCode {
|
||||
KILL_PROCESS_DEPENDED_ON_WEB = 85,
|
||||
RESTART_RESIDENT_PROCESS_DEPENDED_ON_WEB = 86,
|
||||
GET_SUPPORTED_PROCESS_CACHE_PIDS = 87,
|
||||
GET_ALL_CHILDREN_PROCESSES = 88,
|
||||
};
|
||||
} // AppExecFwk
|
||||
} // OHOS
|
||||
|
||||
@@ -155,6 +155,15 @@ public:
|
||||
*/
|
||||
virtual int32_t GetAllRenderProcesses(std::vector<RenderProcessInfo> &info) override;
|
||||
|
||||
/**
|
||||
* GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
|
||||
* Obtains information about children processes that are running on the device.
|
||||
*
|
||||
* @param info, child process info.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info) override;
|
||||
|
||||
/**
|
||||
* JudgeSandboxByPid, call JudgeSandboxByPid() through proxy project.
|
||||
* Obtains information about application processes that are running on the device.
|
||||
@@ -366,15 +375,6 @@ public:
|
||||
*/
|
||||
virtual bool SetAppFreezeFilter(int32_t pid) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() override;
|
||||
#endif
|
||||
|
||||
virtual int32_t GetConfiguration(Configuration& config) override;
|
||||
|
||||
virtual int32_t UpdateConfiguration(const Configuration &config) override;
|
||||
|
||||
@@ -78,6 +78,7 @@ private:
|
||||
int32_t HandleGetProcessRunningInfosByUserId(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetProcessRunningInformation(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetAllRenderProcesses(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetAllChildrenProcesses(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleAddAbilityStageDone(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyMemoryLevel(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyProcMemoryLevel(MessageParcel &data, MessageParcel &reply);
|
||||
@@ -105,9 +106,6 @@ private:
|
||||
int32_t HandleDumpJsHeapMemory(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetRunningMultiAppInfoByBundleName(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleIsAppRunning(MessageParcel &data, MessageParcel &reply);
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int32_t HandleBlockAppServiceDone(MessageParcel &data, MessageParcel &reply);
|
||||
#endif
|
||||
int32_t HandleGetAppRunningStateByBundleName(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyLoadRepairPatch(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyHotReloadPage(MessageParcel &data, MessageParcel &reply);
|
||||
@@ -137,7 +135,7 @@ private:
|
||||
int32_t HandleGetChildProcessInfoForSelf(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleAttachChildProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleExitChildProcessSafely(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleClearUpApplicationDataBySelf(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleClearUpApplicationDataBySelf(MessageParcel &data, MessageParcel& reply);
|
||||
int32_t HandleIsFinalAppProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterRenderStateObserver(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleUnregisterRenderStateObserver(MessageParcel &data, MessageParcel &reply);
|
||||
@@ -147,11 +145,11 @@ private:
|
||||
int32_t HandleGetAllUIExtensionRootHostPid(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleGetAllUIExtensionProviderPid(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleNotifyMemorySizeStateChanged(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSetAppAssertionPauseState(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleSetAppAssertionPauseState(MessageParcel &data, MessageParcel& reply);
|
||||
int32_t HandleSetSupportedProcessCacheSelf(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSaveBrowserChannel(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleCheckCallingIsUserTestMode(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleStartNativeChildProcess(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t HandleStartNativeChildProcess(MessageParcel &data, MessageParcel& reply);
|
||||
int32_t HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
@@ -65,8 +65,8 @@ private:
|
||||
int32_t HandleScheduleDumpIpcStart(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleScheduleDumpIpcStop(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleScheduleDumpIpcStat(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleScheduleDumpFfrt(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleScheduleCacheProcess(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleScheduleDumpFfrt(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t OnRemoteRequestInner(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option);
|
||||
int32_t OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data,
|
||||
|
||||
@@ -264,6 +264,8 @@ public:
|
||||
*/
|
||||
virtual int32_t ScheduleDumpIpcStat(std::string& result) = 0;
|
||||
|
||||
virtual void ScheduleCacheProcess() = 0;
|
||||
|
||||
/**
|
||||
* ScheduleDumpFfrt, call ScheduleDumpFfrt(std::string& result) through proxy project,
|
||||
* Start querying the application's ffrt usage.
|
||||
@@ -274,8 +276,6 @@ public:
|
||||
*/
|
||||
virtual int32_t ScheduleDumpFfrt(std::string& result) = 0;
|
||||
|
||||
virtual void ScheduleCacheProcess() = 0;
|
||||
|
||||
enum class Message {
|
||||
SCHEDULE_FOREGROUND_APPLICATION_TRANSACTION = 0,
|
||||
SCHEDULE_BACKGROUND_APPLICATION_TRANSACTION,
|
||||
|
||||
@@ -224,6 +224,8 @@ public:
|
||||
*/
|
||||
virtual int32_t ScheduleDumpIpcStat(std::string& result) override;
|
||||
|
||||
virtual void ScheduleCacheProcess() override;
|
||||
|
||||
/**
|
||||
* ScheduleDumpFfrt, call ScheduleDumpFfrt(std::string& result) through proxy project,
|
||||
* Start querying the application's ffrt usage.
|
||||
@@ -234,8 +236,6 @@ public:
|
||||
*/
|
||||
virtual int32_t ScheduleDumpFfrt(std::string& result) override;
|
||||
|
||||
virtual void ScheduleCacheProcess() override;
|
||||
|
||||
private:
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
void ScheduleMemoryCommon(const int32_t level, const uint32_t operation);
|
||||
|
||||
@@ -33,6 +33,8 @@ struct ChildProcessInfo : public Parcelable {
|
||||
int32_t pid = 0;
|
||||
int32_t hostPid = 0;
|
||||
int32_t uid = -1;
|
||||
int32_t hostUid = -1;
|
||||
int32_t userId = -1;
|
||||
int32_t childProcessType = CHILD_PROCESS_TYPE_JS;
|
||||
std::string bundleName;
|
||||
std::string processName;
|
||||
|
||||
@@ -398,17 +398,14 @@ int32_t AmsMgrProxy::KillApplication(const std::string &bundleName, const bool c
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (!data.WriteString(bundleName)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "WriteString failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
|
||||
if (!data.WriteBool(clearPageStack)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "parcel bool failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
|
||||
int32_t ret =
|
||||
SendTransactCmd(static_cast<uint32_t>(IAmsMgr::Message::KILL_APPLICATION), data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
|
||||
@@ -444,6 +444,21 @@ AppMgrResultCode AppMgrClient::GetAllRenderProcesses(std::vector<RenderProcessIn
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
AppMgrResultCode AppMgrClient::GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info)
|
||||
{
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
if (service == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "service is nullptr");
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
int32_t result = service->GetAllChildrenProcesses(info);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "service->GetAllChildrenProcesses failed,result=%{public}d", result);
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_READY;
|
||||
}
|
||||
return AppMgrResultCode::RESULT_OK;
|
||||
}
|
||||
|
||||
AppMgrResultCode AppMgrClient::NotifyMemoryLevel(MemoryLevel level)
|
||||
{
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
@@ -841,19 +856,6 @@ sptr<IRemoteObject> AppMgrClient::GetRemoteObject()
|
||||
return mgrHolder_->GetRemoteObject();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AppMgrClient::BlockAppService()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "%{public}s", __func__);
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
if (service == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "service is nullptr");
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_READY;
|
||||
}
|
||||
return service->BlockAppService();
|
||||
}
|
||||
#endif
|
||||
|
||||
void AppMgrClient::SetCurrentUserId(const int32_t userId)
|
||||
{
|
||||
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
|
||||
|
||||
@@ -262,6 +262,26 @@ int32_t AppMgrProxy::GetAllRenderProcesses(std::vector<RenderProcessInfo> &info)
|
||||
return result;
|
||||
}
|
||||
|
||||
int AppMgrProxy::GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
if (!SendTransactCmd(AppMgrInterfaceCode::GET_ALL_CHILDREN_PROCESSES, data, reply)) {
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
auto error = GetParcelableInfos<ChildProcessInfo>(reply, info);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "GetParcelableInfos fail, error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
int result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t AppMgrProxy::JudgeSandboxByPid(pid_t pid, bool &isSandbox)
|
||||
{
|
||||
MessageParcel data;
|
||||
@@ -964,26 +984,6 @@ int32_t AppMgrProxy::UnregisterConfigurationObserver(const sptr<IConfigurationOb
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AppMgrProxy::BlockAppService()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
|
||||
int32_t ret = SendRequest(AppMgrInterfaceCode::BLOCK_APP_SERVICE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AppMgrProxy::GetAppRunningStateByBundleName(const std::string &bundleName)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
|
||||
@@ -37,6 +37,22 @@
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
constexpr int32_t CYCLE_LIMIT = 1000;
|
||||
namespace {
|
||||
#ifdef __aarch64__
|
||||
constexpr uint32_t OBJECT_MASK = 0xffffffff;
|
||||
#else
|
||||
constexpr uint32_t OBJECT_MASK = 0xffffff;
|
||||
#endif
|
||||
|
||||
uint32_t ConvertAddr(const void *ptr)
|
||||
{
|
||||
if (ptr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "ptr is null");
|
||||
return 0;
|
||||
}
|
||||
return static_cast<uint32_t>((reinterpret_cast<uintptr_t>(ptr)) & OBJECT_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
AppMgrStub::AppMgrStub() {}
|
||||
|
||||
@@ -179,10 +195,6 @@ int32_t AppMgrStub::OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
switch (static_cast<uint32_t>(code)) {
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
case AppMgrInterfaceCode::BLOCK_APP_SERVICE:
|
||||
return HandleBlockAppServiceDone(data, reply);
|
||||
#endif
|
||||
case static_cast<uint32_t>(AppMgrInterfaceCode::GET_APP_RUNNING_STATE):
|
||||
return HandleGetAppRunningStateByBundleName(data, reply);
|
||||
case static_cast<uint32_t>(AppMgrInterfaceCode::NOTIFY_LOAD_REPAIR_PATCH):
|
||||
@@ -337,6 +349,8 @@ int32_t AppMgrStub::OnRemoteRequestInnerSeventh(uint32_t code, MessageParcel &da
|
||||
return HandleRestartResidentProcessDependedOnWeb(data, reply);
|
||||
case static_cast<uint32_t>(AppMgrInterfaceCode::GET_SUPPORTED_PROCESS_CACHE_PIDS):
|
||||
return HandleGetSupportedProcessCachePids(data, reply);
|
||||
case static_cast<uint32_t>(AppMgrInterfaceCode::GET_ALL_CHILDREN_PROCESSES):
|
||||
return HandleGetAllChildrenProcesses(data, reply);
|
||||
}
|
||||
return INVALID_FD;
|
||||
}
|
||||
@@ -348,6 +362,12 @@ int32_t AppMgrStub::HandleAttachApplication(MessageParcel &data, MessageParcel &
|
||||
if (client == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "remote object null");
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "remote: %{public}u", ConvertAddr(client.GetRefPtr()));
|
||||
IPCObjectProxy *proxy = reinterpret_cast<IPCObjectProxy *>(client.GetRefPtr());
|
||||
if (proxy != nullptr) {
|
||||
int32_t pid = static_cast<int32_t>(IPCSkeleton::GetCallingPid());
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "handle:%{public}u, callingPid:%{public}d", proxy->GetHandle(), pid);
|
||||
}
|
||||
AttachApplication(client);
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -521,6 +541,25 @@ int32_t AppMgrStub::HandleGetAllRenderProcesses(MessageParcel &data, MessageParc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AppMgrStub::HandleGetAllChildrenProcesses(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
std::vector<ChildProcessInfo> info;
|
||||
auto result = GetAllChildrenProcesses(info);
|
||||
reply.WriteInt32(info.size());
|
||||
for (auto &it : info) {
|
||||
if (!reply.WriteParcelable(&it)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write ChildProcessInfo faild, child pid=%{public}d", it.pid);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write result faild");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AppMgrStub::HandleJudgeSandboxByPid(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
@@ -934,16 +973,6 @@ int32_t AppMgrStub::HandleUnregisterConfigurationObserver(MessageParcel &data, M
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int32_t AppMgrStub::HandleBlockAppServiceDone(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "%{public}s", __func__);
|
||||
int32_t result = BlockAppService();
|
||||
reply.WriteInt32(result);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t AppMgrStub::HandleGetAppRunningStateByBundleName(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
|
||||
@@ -36,6 +36,14 @@ bool ChildProcessInfo::ReadFromParcel(Parcel &parcel)
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, uidData);
|
||||
uid = static_cast<int32_t>(uidData);
|
||||
|
||||
int32_t hostUidData;
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, hostUidData);
|
||||
hostUid = static_cast<int32_t>(hostUidData);
|
||||
|
||||
int32_t userIdData;
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, userIdData);
|
||||
userId = static_cast<int32_t>(userIdData);
|
||||
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, childProcessType);
|
||||
|
||||
bundleName = Str16ToStr8(parcel.ReadString16());
|
||||
@@ -67,6 +75,8 @@ bool ChildProcessInfo::Marshalling(Parcel &parcel) const
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(pid));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(hostPid));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(uid));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(hostUid));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(userId));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(childProcessType));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(bundleName));
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(processName));
|
||||
|
||||
@@ -33,11 +33,11 @@ const int32_t UID_TRANSFORM_DIVISOR = 200000;
|
||||
ErrCode OsAccountManagerWrapper::QueryActiveOsAccountIds(std::vector<int32_t>& ids)
|
||||
{
|
||||
#ifndef OS_ACCOUNT_PART_ENABLED
|
||||
TAG_LOGI(AAFwkTag::DEFAULT, "Without os account subsystem");
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "Without os account subsystem");
|
||||
ids.emplace_back(DEFAULT_OS_ACCOUNT_ID);
|
||||
return ERR_OK;
|
||||
#else
|
||||
TAG_LOGI(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
return AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
#endif // OS_ACCOUNT_PART_ENABLED
|
||||
}
|
||||
@@ -45,11 +45,11 @@ ErrCode OsAccountManagerWrapper::QueryActiveOsAccountIds(std::vector<int32_t>& i
|
||||
ErrCode OsAccountManagerWrapper::GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id)
|
||||
{
|
||||
#ifndef OS_ACCOUNT_PART_ENABLED
|
||||
TAG_LOGI(AAFwkTag::DEFAULT, "Without os account subsystem");
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "Without os account subsystem");
|
||||
id = uid / UID_TRANSFORM_DIVISOR;
|
||||
return ERR_OK;
|
||||
#else
|
||||
TAG_LOGI(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
return AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, id);
|
||||
#endif // OS_ACCOUNT_PART_ENABLED
|
||||
}
|
||||
@@ -100,7 +100,7 @@ ErrCode OsAccountManagerWrapper::RemoveOsAccount(const int id)
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "Without os account subsystem");
|
||||
return ERR_OK;
|
||||
#else // OS_ACCOUNT_PART_ENABLED
|
||||
TAG_LOGI(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "os account subsystem");
|
||||
return AccountSA::OsAccountManager::RemoveOsAccount(id);
|
||||
#endif // OS_ACCOUNT_PART_ENABLED
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
bool UnLoadRepairPatch(const std::string& patchFile) override { return false; }
|
||||
void RegisterQuickFixQueryFunc(const std::map<std::string, std::string>& moduleAndPath) override {};
|
||||
void StartProfiler(const DebugOption debugOption) override {};
|
||||
void DoCleanWorkAfterStageCleaned() override {};
|
||||
void SetModuleLoadChecker(const std::shared_ptr<ModuleCheckerDelegate> moduleCheckerDelegate) const override {}
|
||||
void SetDeviceDisconnectCallback(const std::function<bool()> &cb) override {};
|
||||
bool IsAppLibLoaded() const { return appLibLoaded_; }
|
||||
|
||||
@@ -127,7 +127,6 @@ public:
|
||||
void DebuggerConnectionManager(bool isDebugApp, bool isStartWithDebug, const DebugOption dOption);
|
||||
|
||||
void ReloadFormComponent(); // Reload ArkTS-Card component
|
||||
void DoCleanWorkAfterStageCleaned() override;
|
||||
void SetModuleLoadChecker(const std::shared_ptr<ModuleCheckerDelegate> moduleCheckerDelegate) const override;
|
||||
|
||||
static std::unique_ptr<NativeReference> LoadSystemModuleByEngine(napi_env env,
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
virtual bool UnLoadRepairPatch(const std::string& patchFile) = 0;
|
||||
virtual void RegisterQuickFixQueryFunc(const std::map<std::string, std::string>& moduleAndPath) = 0;
|
||||
virtual void StartProfiler(const DebugOption debugOption) = 0;
|
||||
virtual void DoCleanWorkAfterStageCleaned() = 0;
|
||||
virtual void DoCleanWorkAfterStageCleaned() {}
|
||||
virtual void SetModuleLoadChecker(const std::shared_ptr<ModuleCheckerDelegate> moduleCheckerDelegate) const {}
|
||||
virtual void SetDeviceDisconnectCallback(const std::function<bool()> &cb) = 0;
|
||||
virtual void UpdatePkgContextInfoJson(std::string moduleName, std::string hapPath, std::string packageName) = 0;
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
*
|
||||
* @param agent Indicates the WantAgent to cancel.
|
||||
*/
|
||||
static ErrCode Cancel(const std::shared_ptr<WantAgent> &agent);
|
||||
static ErrCode Cancel(const std::shared_ptr<WantAgent> agent);
|
||||
|
||||
/**
|
||||
* Checks whether two WantAgent objects are the same.
|
||||
|
||||
@@ -292,7 +292,7 @@ int PendingWant::SendAndReturnResult(int resultCode, const std::shared_ptr<Want>
|
||||
const std::shared_ptr<WantParams> &options, const std::shared_ptr<StartOptions> &startOptions,
|
||||
const sptr<AAFwk::IWantSender> &target)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::WANTAGENT, "call");
|
||||
TAG_LOGD(AAFwkTag::WANTAGENT, "call");
|
||||
SenderInfo senderInfo;
|
||||
senderInfo.resolvedType = want != nullptr ? want->GetType() : "";
|
||||
if (want != nullptr) {
|
||||
|
||||
@@ -357,7 +357,7 @@ sptr<IRemoteObject> WantAgentClient::GetAbilityManager()
|
||||
return nullptr;
|
||||
}
|
||||
if (!remoteObj->AddDeathRecipient(deathRecipient_)) {
|
||||
TAG_LOGI(AAFwkTag::WANTAGENT, "Add death recipient to failed");
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "Add death recipient to failed");
|
||||
}
|
||||
proxy_ = remoteObj;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ WantAgentConstant::OperationType WantAgentHelper::GetType(std::shared_ptr<WantAg
|
||||
ErrCode WantAgentHelper::TriggerWantAgent(std::shared_ptr<WantAgent> agent,
|
||||
const std::shared_ptr<CompletedCallback> &callback, const TriggerInfo ¶msInfo)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::WANTAGENT, "call");
|
||||
TAG_LOGD(AAFwkTag::WANTAGENT, "call");
|
||||
if (agent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
return ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER;
|
||||
@@ -209,7 +209,7 @@ ErrCode WantAgentHelper::TriggerWantAgent(std::shared_ptr<WantAgent> agent,
|
||||
ErrCode WantAgentHelper::Send(const std::shared_ptr<PendingWant> &pendingWant,
|
||||
WantAgentConstant::OperationType type, const sptr<CompletedDispatcher> &callBack, const TriggerInfo ¶msInfo)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::WANTAGENT, "call");
|
||||
TAG_LOGD(AAFwkTag::WANTAGENT, "call");
|
||||
if (pendingWant == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
return ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER;
|
||||
@@ -224,7 +224,7 @@ ErrCode WantAgentHelper::Send(const std::shared_ptr<PendingWant> &pendingWant,
|
||||
pendingWant->GetTarget());
|
||||
}
|
||||
|
||||
ErrCode WantAgentHelper::Cancel(const std::shared_ptr<WantAgent> &agent)
|
||||
ErrCode WantAgentHelper::Cancel(const std::shared_ptr<WantAgent> agent)
|
||||
{
|
||||
if (agent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
@@ -340,19 +340,19 @@ void WantAgentHelper::UnregisterCancelListener(
|
||||
std::string WantAgentHelper::ToString(const std::shared_ptr<WantAgent> &agent)
|
||||
{
|
||||
if (agent == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid param");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::shared_ptr<PendingWant> pendingWant = agent->GetPendingWant();
|
||||
if (pendingWant == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid param");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::shared_ptr<WantSenderInfo> info = pendingWant->GetWantSenderInfo(pendingWant->GetTarget());
|
||||
if (info == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid input param");
|
||||
TAG_LOGE(AAFwkTag::WANTAGENT, "invalid param");
|
||||
return "";
|
||||
}
|
||||
nlohmann::json jsonObject;
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ enum class AbilityErrorCode {
|
||||
|
||||
// extension start service has been controlled.
|
||||
ERROR_CODE_EXTENSION_START_SERVICE_CONTROLLED = 16000070,
|
||||
|
||||
|
||||
// app is not Clone.
|
||||
ERROR_NOT_APP_CLONE = 16000071,
|
||||
|
||||
|
||||
@@ -356,13 +356,6 @@ public:
|
||||
*/
|
||||
void UpdateSessionToken(sptr<IRemoteObject> sessionToken) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* @brief Block ability.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int BlockAbility() override;
|
||||
#endif
|
||||
sptr<IRemoteObject> token_;
|
||||
std::shared_ptr<AbilityHandler> abilityHandler_ = nullptr;
|
||||
std::shared_ptr<EventRunner> runner_ = nullptr;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -67,6 +67,33 @@ public:
|
||||
void UpdateDisplayConfig(Rosen::DisplayId displayId, std::shared_ptr<Configuration> configuration,
|
||||
std::shared_ptr<ResourceManager> resourceManager, bool &configChanged);
|
||||
|
||||
/**
|
||||
* @brief Init display configuration to resource manager.
|
||||
*
|
||||
* @param configuration Context configuration need to update display config
|
||||
* @param resourceManager Resource manager instance need to update display config
|
||||
* @param displayId display Id
|
||||
* @param density display density
|
||||
* @param orientation display orientation
|
||||
*/
|
||||
void InitDisplayConfig(std::shared_ptr<Configuration> configuration,
|
||||
std::shared_ptr<ResourceManager> resourceManager, Rosen::DisplayId displayId, float density,
|
||||
int32_t orientation);
|
||||
|
||||
/**
|
||||
* @brief Update display configuration to context configuration and resource manager.
|
||||
*
|
||||
* @param configuration Context configuration need to update display config
|
||||
* @param resourceManager Resource manager instance need to update display config
|
||||
* @param displayId display Id
|
||||
* @param density display density
|
||||
* @param orientation display orientation
|
||||
* @return Returns true on update success, false on update failure.
|
||||
*/
|
||||
bool UpdateDisplayConfig(std::shared_ptr<Configuration> configuration,
|
||||
std::shared_ptr<ResourceManager> resourceManager, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation);
|
||||
|
||||
private:
|
||||
bool GetDisplayConfig(Rosen::DisplayId displayId, float &density, std::string &directionStr);
|
||||
void UpdateDisplayResConfig(std::shared_ptr<ResourceManager> resourceManager, float &density,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -16,9 +16,11 @@
|
||||
#ifndef OHOS_ABILITY_RUNTIME_JS_UI_EXTENSION_H
|
||||
#define OHOS_ABILITY_RUNTIME_JS_UI_EXTENSION_H
|
||||
|
||||
#include "ability_handler.h"
|
||||
#include "configuration.h"
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
#include "display_manager.h"
|
||||
#include "window_manager.h"
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
#include "js_ui_extension_content_session.h"
|
||||
#include "ui_extension.h"
|
||||
@@ -67,8 +69,9 @@ public:
|
||||
* This function can be called only once in the entire lifecycle of an ui extension.
|
||||
*
|
||||
* @param Want Indicates the {@link Want} structure containing startup information about the ui extension.
|
||||
* @param sessionInfo The session info of the ability.
|
||||
*/
|
||||
virtual void OnStart(const AAFwk::Want &want) override;
|
||||
virtual void OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessionInfo) override;
|
||||
|
||||
/**
|
||||
* @brief Called when this ui extension is connected for the first time.
|
||||
@@ -165,6 +168,11 @@ public:
|
||||
*/
|
||||
void OnAbilityResult(int requestCode, int resultCode, const Want &resultData) override;
|
||||
|
||||
/**
|
||||
* @brief Called when configuration changed, including system configuration and window configuration.
|
||||
*/
|
||||
void ConfigurationUpdated();
|
||||
|
||||
private:
|
||||
virtual void BindContext(napi_env env, napi_value obj, std::shared_ptr<AAFwk::Want> want);
|
||||
void CreateJSContext(napi_env env, napi_value &contextObj,
|
||||
@@ -207,6 +215,36 @@ private:
|
||||
int32_t screenMode_ = AAFwk::IDLE_SCREEN_MODE;
|
||||
std::shared_ptr<int32_t> screenModePtr_;
|
||||
sptr<IRemoteObject> token_ = nullptr;
|
||||
std::shared_ptr<AbilityHandler> handler_ = nullptr;
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
class JsUIExtensionAbilityDisplayListener : public OHOS::Rosen::IDisplayInfoChangedListener {
|
||||
public:
|
||||
explicit JsUIExtensionAbilityDisplayListener(const std::weak_ptr<JsUIExtension> &jsUiExtension)
|
||||
{
|
||||
jsUiExtension_ = jsUiExtension;
|
||||
}
|
||||
|
||||
void OnDisplayInfoChange(const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation) override
|
||||
{
|
||||
auto sptr = jsUiExtension_.lock();
|
||||
if (sptr != nullptr) {
|
||||
sptr->OnDisplayInfoChange(token, displayId, density, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::weak_ptr<JsUIExtension> jsUiExtension_;
|
||||
};
|
||||
|
||||
void RegisterDisplayInfoChangedListener();
|
||||
void UnregisterDisplayInfoChangedListener();
|
||||
void OnDisplayInfoChange(const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation);
|
||||
|
||||
sptr<JsUIExtensionAbilityDisplayListener> jsUiExtensionAbilityDisplayListener_ = nullptr;
|
||||
#endif
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -24,11 +24,15 @@
|
||||
#include "native_engine/native_engine.h"
|
||||
#include "ohos_application.h"
|
||||
#include "session_info.h"
|
||||
#include "ui_extension_base.h"
|
||||
#include "ui_extension_base_impl.h"
|
||||
#include "ui_extension_context.h"
|
||||
#include "ui_extension_window_command.h"
|
||||
#include "want.h"
|
||||
#include "window.h"
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
#include "display_manager.h"
|
||||
#include "window_manager.h"
|
||||
#endif // SUPPORT_GRAPHICS
|
||||
|
||||
class NativeReference;
|
||||
|
||||
@@ -66,8 +70,10 @@ public:
|
||||
*
|
||||
* @param Want Indicates the {@link Want} structure containing startup information about the ui extension.
|
||||
* @param launchParam The launch param.
|
||||
* @param sessionInfo The session info of the ability.
|
||||
*/
|
||||
void OnStart(const AAFwk::Want &want, AAFwk::LaunchParam &launchParam) override;
|
||||
void OnStart(
|
||||
const AAFwk::Want &want, AAFwk::LaunchParam &launchParam, sptr<AAFwk::SessionInfo> sessionInfo) override;
|
||||
|
||||
/**
|
||||
* @brief Called back when ui extension is started.
|
||||
@@ -95,6 +101,11 @@ public:
|
||||
* You can override this function to implement your own processing logic.
|
||||
*/
|
||||
void OnStop() override;
|
||||
virtual void OnStop(AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo, bool &isAsyncCallback);
|
||||
/**
|
||||
* @brief The callback of OnStop.
|
||||
*/
|
||||
virtual void OnStopCallBack();
|
||||
|
||||
/**
|
||||
* @brief Called when the system configuration is updated.
|
||||
@@ -152,8 +163,17 @@ public:
|
||||
void SetContext(const std::shared_ptr<UIExtensionContext> &context) override;
|
||||
|
||||
void BindContext() override;
|
||||
|
||||
/**
|
||||
* @brief Called when configuration changed, including system configuration and window configuration.
|
||||
*/
|
||||
void ConfigurationUpdated();
|
||||
|
||||
protected:
|
||||
napi_value CallObjectMethod(const char *name, napi_value const *argv = nullptr, size_t argc = 0);
|
||||
napi_value CallObjectMethod(const char *name, napi_value const *argv = nullptr, size_t argc = 0,
|
||||
bool withResult = false);
|
||||
bool CheckPromise(napi_value result);
|
||||
bool CallPromise(napi_value result, AppExecFwk::AbilityTransactionCallbackInfo<> *callbackInfo);
|
||||
void ForegroundWindow(const AAFwk::Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo);
|
||||
void BackgroundWindow(const sptr<AAFwk::SessionInfo> &sessionInfo);
|
||||
void DestroyWindow(const sptr<AAFwk::SessionInfo> &sessionInfo);
|
||||
@@ -171,7 +191,7 @@ protected:
|
||||
protected:
|
||||
JsRuntime &jsRuntime_;
|
||||
std::shared_ptr<NativeReference> shellContextRef_;
|
||||
std::unique_ptr<NativeReference> jsObj_;
|
||||
std::shared_ptr<NativeReference> jsObj_;
|
||||
std::shared_ptr<UIExtensionContext> context_;
|
||||
std::map<uint64_t, sptr<Rosen::Window>> uiWindowMap_;
|
||||
std::set<uint64_t> foregroundWindows_;
|
||||
@@ -179,6 +199,37 @@ protected:
|
||||
std::shared_ptr<AbilityResultListeners> abilityResultListeners_ = nullptr;
|
||||
std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo_;
|
||||
sptr<IRemoteObject> token_ = nullptr;
|
||||
std::shared_ptr<AbilityHandler> handler_ = nullptr;
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
private:
|
||||
class JsUIExtensionBaseDisplayListener : public OHOS::Rosen::IDisplayInfoChangedListener {
|
||||
public:
|
||||
explicit JsUIExtensionBaseDisplayListener(const std::weak_ptr<JsUIExtensionBase> &jsUiExtensionBase)
|
||||
{
|
||||
jsUiExtensionBase_ = jsUiExtensionBase;
|
||||
}
|
||||
|
||||
void OnDisplayInfoChange(const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation) override
|
||||
{
|
||||
auto sptr = jsUiExtensionBase_.lock();
|
||||
if (sptr != nullptr) {
|
||||
sptr->OnDisplayInfoChange(token, displayId, density, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::weak_ptr<JsUIExtensionBase> jsUiExtensionBase_;
|
||||
};
|
||||
|
||||
void RegisterDisplayInfoChangedListener();
|
||||
void UnregisterDisplayInfoChangedListener();
|
||||
void OnDisplayInfoChange(const sptr<IRemoteObject> &token, Rosen::DisplayId displayId, float density,
|
||||
Rosen::DisplayOrientation orientation);
|
||||
|
||||
sptr<JsUIExtensionBaseDisplayListener> jsUIExtensionBaseDisplayListener_ = nullptr;
|
||||
#endif
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -52,12 +52,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnStart(const AAFwk::Want &want) override
|
||||
void OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessionInfo) override
|
||||
{
|
||||
Extension::OnStart(want);
|
||||
if (impl_ != nullptr) {
|
||||
auto launchParam = Extension::GetLaunchParam();
|
||||
impl_->OnStart(want, launchParam);
|
||||
impl_->OnStart(want, launchParam, sessionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
std::shared_ptr<AppExecFwk::AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token) = 0;
|
||||
|
||||
virtual void OnStart(const AAFwk::Want &want, AAFwk::LaunchParam &launchParam) = 0;
|
||||
virtual void OnStart(
|
||||
const AAFwk::Want &want, AAFwk::LaunchParam &launchParam, sptr<AAFwk::SessionInfo> sessionInfo) = 0;
|
||||
|
||||
virtual void OnCommand(const AAFwk::Want &want, bool restart, int startId) = 0;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
void AppHasDarkRes(bool &darkRes);
|
||||
std::string GetBaseDir() const override;
|
||||
Global::Resource::DeviceType GetDeviceType() const override;
|
||||
void KillProcessBySelf(const bool clearpagestack = false);
|
||||
void KillProcessBySelf(const bool clearPageStack = true);
|
||||
int32_t GetProcessRunningInformation(AppExecFwk::RunningProcessInfo &info);
|
||||
int32_t RestartApp(const AAFwk::Want& want);
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
*
|
||||
* @return error code
|
||||
*/
|
||||
void KillProcessBySelf(const bool clearpagestack = false);
|
||||
void KillProcessBySelf(const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* @brief Get running informationfor cuirrent process
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
* @param bundleName.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int KillProcessesByBundleName(const std::string &bundleName, const bool clearpagestack = false);
|
||||
int KillProcessesByBundleName(const std::string &bundleName, const bool clearPageStack = true);
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -131,7 +131,6 @@ public:
|
||||
*/
|
||||
void PerformConfigurationUpdated(const Configuration &config);
|
||||
|
||||
private:
|
||||
enum {
|
||||
APP_STATE_CREATE = 0,
|
||||
APP_STATE_READY = 1,
|
||||
@@ -139,6 +138,7 @@ private:
|
||||
APP_STATE_BACKGROUND = 3,
|
||||
APP_STATE_TERMINATED = 4
|
||||
};
|
||||
private:
|
||||
int curState_;
|
||||
int recordId_;
|
||||
std::shared_ptr<OHOSApplication> application_ = nullptr;
|
||||
|
||||
@@ -425,6 +425,7 @@ private:
|
||||
*
|
||||
*/
|
||||
void HandleCleanAbility(const sptr<IRemoteObject> &token, bool isCacheProcess = false);
|
||||
void AfterCleanAbilityGC();
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -672,7 +673,7 @@ private:
|
||||
*/
|
||||
void LoadAbilityLibrary(const std::vector<std::string> &libraryPaths);
|
||||
void LoadAceAbilityLibrary();
|
||||
|
||||
|
||||
void CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
|
||||
void LoadNativeLiabrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
* @param config Indicates the new Configuration object.
|
||||
*/
|
||||
virtual void OnConfigurationUpdated(Configuration config);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Will be Called when the application font of the device changes.
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
* @param abilityInfo
|
||||
*/
|
||||
void CleanAbilityStage(const sptr<IRemoteObject> &token, const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
bool isCacheProcess = false);
|
||||
bool isCacheProcess);
|
||||
|
||||
/**
|
||||
* @brief return the application context
|
||||
@@ -318,7 +318,6 @@ public:
|
||||
void CleanEmptyAbilityStage();
|
||||
|
||||
private:
|
||||
void DoCleanWorkAfterStageCleaned(const AbilityInfo &abilityInfo);
|
||||
void UpdateAppContextResMgr(const Configuration &config);
|
||||
bool isUpdateColor(Configuration &config, std::string colorMode, std::string globalColorMode,
|
||||
std::string globalColorModeIsSetBySa, std::string colorModeIsSetByApp, std::string colorModeIsSetBySa);
|
||||
|
||||
@@ -152,6 +152,8 @@ public:
|
||||
virtual int OpenFile(const Uri& uri, uint32_t flag) override;
|
||||
|
||||
virtual void NotifyMissionBindPid(int32_t missionId, int32_t pid) override;
|
||||
|
||||
virtual int32_t CheckStaticCfgPermission(const Want &want) override;
|
||||
private:
|
||||
static inline BrokerDelegator<AbilityManagerCollaboratorProxy> delegator_;
|
||||
int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||
|
||||
@@ -590,7 +590,7 @@ public:
|
||||
* @param bundleName.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearpagestack = false) override;
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
@@ -878,30 +878,6 @@ public:
|
||||
*/
|
||||
void GetAbilityTokenByCalleeObj(const sptr<IRemoteObject> &callStub, sptr<IRemoteObject> &token) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability manager service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAmsService() override;
|
||||
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAbility(int32_t abilityRecordId) override;
|
||||
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Call free install from remote.
|
||||
*
|
||||
|
||||
@@ -839,7 +839,7 @@ public:
|
||||
* @param bundleName.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearpagestack = false) override;
|
||||
virtual int KillProcess(const std::string &bundleName, const bool clearPageStack = true) override;
|
||||
|
||||
/**
|
||||
* Uninstall app
|
||||
@@ -1288,26 +1288,6 @@ public:
|
||||
bool IsAbilityControllerStartById(int32_t missionId);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability manager service.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAmsService() override;
|
||||
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAbility(int32_t abilityRecordId) override;
|
||||
|
||||
/**
|
||||
* Block app manager service.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() override;
|
||||
|
||||
/**
|
||||
* force timeout ability.
|
||||
*
|
||||
|
||||
@@ -220,11 +220,6 @@ private:
|
||||
int FreeInstallAbilityFromRemoteInner(MessageParcel &data, MessageParcel &reply);
|
||||
int AddFreeInstallObserverInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int BlockAmsServiceInner(MessageParcel &data, MessageParcel &reply);
|
||||
int BlockAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int BlockAppServiceInner(MessageParcel &data, MessageParcel &reply);
|
||||
#endif
|
||||
int EnableRecoverAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int SubmitSaveRecoveryInfoInner(MessageParcel &data, MessageParcel &reply);
|
||||
int ScheduleRecoverAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
@@ -295,10 +290,10 @@ private:
|
||||
int32_t StartAbilityByInsightIntentInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t ExecuteInsightIntentDoneInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t GetForegroundUIAbilitiesInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t RestartAppInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
int32_t GetUIExtensionRootHostInfoInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t GetUIExtensionSessionInfoInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t RestartAppInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t RequestAssertFaultDialogInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t NotifyDebugAssertResultInner(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t StartShortcutInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
|
||||
static const uint32_t TIME_OUT_SECONDS = 30;
|
||||
|
||||
class AbilityManagerXCollie {
|
||||
public:
|
||||
AbilityManagerXCollie(const std::string &tag, uint32_t timeoutSeconds = TIME_OUT_SECONDS,
|
||||
@@ -34,6 +31,8 @@ public:
|
||||
~AbilityManagerXCollie();
|
||||
|
||||
void CancelAbilityManagerXCollie();
|
||||
|
||||
static const uint32_t TIME_OUT_SECONDS;
|
||||
private:
|
||||
int32_t id_ = -1;
|
||||
std::string tag_;
|
||||
|
||||
@@ -1002,9 +1002,6 @@ public:
|
||||
void SetWindowMode(int32_t windowMode);
|
||||
void RemoveWindowMode();
|
||||
LifeCycleStateInfo lifeCycleStateInfo_; // target life state info
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int BlockAbility();
|
||||
#endif
|
||||
|
||||
bool CanRestartRootLauncher();
|
||||
|
||||
|
||||
@@ -331,10 +331,6 @@ public:
|
||||
*/
|
||||
void UpdateSessionToken(sptr<IRemoteObject> sessionToken) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int BlockAbility() override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||
|
||||
@@ -67,10 +67,6 @@ private:
|
||||
int DumpAbilityInfoInner(MessageParcel& data, MessageParcel& reply);
|
||||
int CallRequestInner(MessageParcel &data, MessageParcel &reply);
|
||||
int OnExecuteIntentInner(MessageParcel &data, MessageParcel &reply);
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int BlockAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
#endif
|
||||
|
||||
int ContinueAbilityInner(MessageParcel &data, MessageParcel &reply);
|
||||
int ShareDataInner(MessageParcel &data, MessageParcel &reply);
|
||||
int CreateModalUIExtensionInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
@@ -76,6 +76,12 @@ constexpr const char* JUMP_INTERCEPTOR_DIALOG_CALLER_PKG = "interceptor_callerPk
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CHECK_POINTER_TAG_LOG(object, tag, log) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(tag, "%{public}s:", log); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define CHECK_POINTER_AND_RETURN(object, value) \
|
||||
if (!object) { \
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "nullptr"); \
|
||||
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
*
|
||||
* @param bundleName.
|
||||
*/
|
||||
int KillApplication(const std::string &bundleName, const bool clearpagestack = false);
|
||||
int KillApplication(const std::string &bundleName, const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* ForceKillApplication, force kill the application.
|
||||
@@ -364,15 +364,6 @@ public:
|
||||
*/
|
||||
void SetCurrentUserId(int32_t userId);
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int BlockAppService();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get bundleName by pid.
|
||||
*
|
||||
|
||||
@@ -26,6 +26,8 @@ constexpr const char *PROCESS_MODE_HOST_INSTANCE_KEY = "ohos.extension.processMo
|
||||
constexpr uint32_t PROCESS_MODE_INSTANCE = 1 << static_cast<uint32_t>(AppExecFwk::ExtensionProcessMode::INSTANCE);
|
||||
constexpr uint32_t PROCESS_MODE_TYPE = 1 << static_cast<uint32_t>(AppExecFwk::ExtensionProcessMode::TYPE);
|
||||
constexpr uint32_t PROCESS_MODE_BUNDLE = 1 << static_cast<uint32_t>(AppExecFwk::ExtensionProcessMode::BUNDLE);
|
||||
constexpr uint32_t PROCESS_MODE_RUN_WITH_MAIN_PROCESS =
|
||||
1 << static_cast<uint32_t>(AppExecFwk::ExtensionProcessMode::RUN_WITH_MAIN_PROCESS);
|
||||
constexpr uint32_t PROCESS_INNER_MODE_OFFSET = 16;
|
||||
constexpr uint32_t PROCESS_MODE_HOST_SPECIFIED = 1 << (PROCESS_INNER_MODE_OFFSET + 0);
|
||||
constexpr uint32_t PROCESS_MODE_HOST_INSTANCE = 1 << (PROCESS_INNER_MODE_OFFSET + 1);
|
||||
|
||||
@@ -216,9 +216,6 @@ public:
|
||||
std::vector<std::string> &info, bool isClient, int32_t abilityRecordId, const std::vector<std::string> ¶ms);
|
||||
|
||||
std::shared_ptr<Mission> GetMissionBySpecifiedFlag(const AAFwk::Want &want, const std::string &flag) const;
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int BlockAbilityByRecordId(int32_t abilityRecordId);
|
||||
#endif
|
||||
|
||||
int32_t GetMissionCountByUid(int32_t targetUid) const;
|
||||
void FindEarliestMission(std::shared_ptr<Mission>& targetMission) const;
|
||||
|
||||
@@ -342,16 +342,6 @@ public:
|
||||
|
||||
void EnableRecoverAbility(int32_t missionId) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int BlockAbility(int abilityRecordId) override;
|
||||
#endif
|
||||
|
||||
void UninstallApp(const std::string &bundleName, int32_t uid) override;
|
||||
|
||||
bool IsStarted() override;
|
||||
|
||||
@@ -98,10 +98,6 @@ public:
|
||||
|
||||
virtual void EnableRecoverAbility(int32_t missionId) = 0;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
virtual int BlockAbility(int abilityRecordId) = 0;
|
||||
#endif
|
||||
|
||||
virtual void UninstallApp(const std::string &bundleName, int32_t uid) = 0;
|
||||
|
||||
virtual bool IsStarted() = 0;
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
|
||||
private:
|
||||
void BuildSendWant(SenderInfo &senderInfo, Want &want);
|
||||
int32_t ExecuteOperation(
|
||||
std::shared_ptr<PendingWantManager> pendingWantManager, SenderInfo &senderInfo, Want &want);
|
||||
|
||||
private:
|
||||
std::weak_ptr<PendingWantManager> pendingWantManager_ = {};
|
||||
|
||||
@@ -310,16 +310,6 @@ public:
|
||||
|
||||
void GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info, bool isPerm) const;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block ability.
|
||||
*
|
||||
* @param abilityRecordId The Ability Record Id.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int BlockAbility(int abilityRecordId) const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief dump all abilities
|
||||
*
|
||||
|
||||
@@ -689,10 +689,12 @@ void AbilityConnectManager::HandleActiveAbility(std::shared_ptr<AbilityRecord> &
|
||||
int connectRecordId = connectRecord->GetRecordId();
|
||||
ConnectUIServiceExtAbility(targetService, connectRecordId, want);
|
||||
}
|
||||
targetService->RemoveSignatureInfo();
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetService->GetConnectRecordList().size() > 1) {
|
||||
targetService->RemoveSignatureInfo();
|
||||
if (taskHandler_ != nullptr && targetService->GetConnRemoteObject()) {
|
||||
auto task = [connectRecord]() { connectRecord->CompleteConnect(ERR_OK); };
|
||||
taskHandler_->SubmitTask(task, TaskQoS::USER_INTERACTIVE);
|
||||
@@ -941,7 +943,6 @@ int AbilityConnectManager::AbilityTransitionDone(const sptr<IRemoteObject> &toke
|
||||
}
|
||||
|
||||
CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE);
|
||||
abilityRecord->RemoveSignatureInfo();
|
||||
std::string element = abilityRecord->GetURI();
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Ability:%{public}s, state:%{public}s", element.c_str(), abilityState.c_str());
|
||||
|
||||
@@ -968,6 +969,7 @@ int AbilityConnectManager::AbilityTransitionDone(const sptr<IRemoteObject> &toke
|
||||
return DispatchInactive(abilityRecord, state);
|
||||
}
|
||||
case AbilityState::FOREGROUND: {
|
||||
abilityRecord->RemoveSignatureInfo();
|
||||
return DispatchForeground(abilityRecord);
|
||||
}
|
||||
case AbilityState::BACKGROUND: {
|
||||
@@ -1032,6 +1034,7 @@ int AbilityConnectManager::ScheduleConnectAbilityDoneLocked(
|
||||
return INVALID_CONNECTION_STATE;
|
||||
}
|
||||
abilityRecord->RemoveConnectWant();
|
||||
abilityRecord->RemoveSignatureInfo();
|
||||
|
||||
if (abilityRecord->GetAbilityInfo().type == AbilityType::SERVICE) {
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->UpdateAbilityState(
|
||||
@@ -1177,6 +1180,7 @@ int AbilityConnectManager::ScheduleCommandAbilityDoneLocked(const sptr<IRemoteOb
|
||||
}
|
||||
EventInfo eventInfo = BuildEventInfo(abilityRecord);
|
||||
EventReport::SendStartServiceEvent(EventName::START_SERVICE, eventInfo);
|
||||
abilityRecord->RemoveSignatureInfo();
|
||||
// complete command and pop waiting start ability from queue.
|
||||
CompleteCommandAbility(abilityRecord);
|
||||
|
||||
@@ -1584,19 +1588,21 @@ void AbilityConnectManager::HandleStartTimeoutTask(const std::shared_ptr<Ability
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Timeout ability record is not exist in service map.");
|
||||
return;
|
||||
}
|
||||
MoveToTerminatingMap(abilityRecord);
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Load timeout:%{public}s,user:%{public}d.",
|
||||
abilityRecord->GetURI().c_str(), userId_);
|
||||
RemoveServiceAbility(abilityRecord);
|
||||
if (abilityRecord->IsSceneBoard()) {
|
||||
auto isAttached = IN_PROCESS_CALL(DelayedSingleton<AppScheduler>::GetInstance()->IsProcessAttached(
|
||||
abilityRecord->GetToken()));
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(abilityRecord->GetToken());
|
||||
if (!isAttached) {
|
||||
MoveToTerminatingMap(abilityRecord);
|
||||
RemoveServiceAbility(abilityRecord);
|
||||
RestartAbility(abilityRecord, userId_);
|
||||
}
|
||||
return;
|
||||
}
|
||||
MoveToTerminatingMap(abilityRecord);
|
||||
RemoveServiceAbility(abilityRecord);
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(abilityRecord->GetToken());
|
||||
if (IsAbilityNeedKeepAlive(abilityRecord)) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Load time out, try to restart");
|
||||
@@ -1607,7 +1613,7 @@ void AbilityConnectManager::HandleStartTimeoutTask(const std::shared_ptr<Ability
|
||||
void AbilityConnectManager::HandleCommandTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord)
|
||||
{
|
||||
CHECK_POINTER(abilityRecord);
|
||||
if (AppUtils::GetInstance().IsLauncherAbility(abilityRecord->GetAbilityInfo().name)) {
|
||||
if (abilityRecord->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Handle root launcher command timeout.");
|
||||
// terminate the timeout root launcher.
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(abilityRecord->GetToken());
|
||||
@@ -2119,7 +2125,7 @@ void AbilityConnectManager::HandleInactiveTimeout(const std::shared_ptr<AbilityR
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout start");
|
||||
CHECK_POINTER(ability);
|
||||
if (AppUtils::GetInstance().IsLauncherAbility(ability->GetAbilityInfo().name)) {
|
||||
if (ability->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Handle root launcher inactive timeout.");
|
||||
// terminate the timeout root launcher.
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(ability->GetToken());
|
||||
|
||||
@@ -1426,32 +1426,6 @@ void AbilityManagerClient::ScheduleClearRecoveryPageStack()
|
||||
return abms->ScheduleClearRecoveryPageStack();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
ErrCode AbilityManagerClient::BlockAmsService()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "enter");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->BlockAmsService();
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "enter");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->BlockAbility(abilityRecordId);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::BlockAppService()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "enter");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->BlockAppService();
|
||||
}
|
||||
#endif
|
||||
|
||||
sptr<IAbilityManager> AbilityManagerClient::GetAbilityManager()
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
|
||||
@@ -499,6 +499,28 @@ void AbilityManagerCollaboratorProxy::NotifyMissionBindPid(int32_t missionId, in
|
||||
}
|
||||
}
|
||||
|
||||
int32_t AbilityManagerCollaboratorProxy::CheckStaticCfgPermission(const Want &want)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!data.WriteInterfaceToken(AbilityManagerCollaboratorProxy::GetDescriptor())) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Write interface token failed.");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
if (!data.WriteParcelable(&want)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "want write failed.");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
int32_t ret = SendTransactCmd(IAbilityManagerCollaborator::CHECK_STATIC_CFG_PERMISSION,
|
||||
data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t AbilityManagerCollaboratorProxy::SendTransactCmd(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
|
||||
@@ -3913,62 +3913,6 @@ int32_t AbilityManagerProxy::GetMissionIdByToken(const sptr<IRemoteObject> &toke
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilityManagerProxy::BlockAmsService()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
auto error = SendRequest(AbilityManagerInterfaceCode::BLOCK_AMS_SERVICE, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "BlockAmsService error: %d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteInt32(abilityRecordId)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "pid WriteInt32 fail.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto error = SendRequest(AbilityManagerInterfaceCode::BLOCK_ABILITY, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "BlockAbility error: %d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::BlockAppService()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
auto error = SendRequest(AbilityManagerInterfaceCode::BLOCK_APP_SERVICE, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "BlockAmsService error: %d", error);
|
||||
return error;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
#endif
|
||||
int AbilityManagerProxy::FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
|
||||
int32_t userId, int requestCode)
|
||||
{
|
||||
|
||||
@@ -204,9 +204,6 @@ constexpr int32_t NON_ANONYMIZE_LENGTH = 6;
|
||||
constexpr uint32_t SCENE_FLAG_NORMAL = 0;
|
||||
constexpr int32_t MAX_NUMBER_OF_DISTRIBUTED_MISSIONS = 20;
|
||||
constexpr int32_t SWITCH_ACCOUNT_TRY = 3;
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
constexpr int32_t BLOCK_AMS_SERVICE_TIME = 65;
|
||||
#endif
|
||||
constexpr int32_t CONVERT_CALLBACK_TIMEOUT_SECONDS = 2; // 2s
|
||||
constexpr const char* EMPTY_DEVICE_ID = "";
|
||||
constexpr int32_t APP_MEMORY_SIZE = 512;
|
||||
@@ -1032,6 +1029,12 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((want.GetFlags() & Want::FLAG_ABILITY_PREPARE_CONTINUATION) == Want::FLAG_ABILITY_PREPARE_CONTINUATION &&
|
||||
IPCSkeleton::GetCallingUid() != DMS_UID) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "The flag only support for DMS, flag is %{public}d", want.GetFlags());
|
||||
return ERR_INVALID_CONTINUATION_FLAG;
|
||||
}
|
||||
|
||||
if (callerToken != nullptr && CheckIfOperateRemote(want)) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "try to StartRemoteAbility");
|
||||
return StartRemoteAbility(want, requestCode, validUserId, callerToken);
|
||||
@@ -1313,6 +1316,14 @@ int AbilityManagerService::StartAbilityDetails(const Want &want, const AbilitySt
|
||||
}
|
||||
#endif // WITH_DLP
|
||||
|
||||
if ((want.GetFlags() & Want::FLAG_ABILITY_PREPARE_CONTINUATION) == Want::FLAG_ABILITY_PREPARE_CONTINUATION &&
|
||||
IPCSkeleton::GetCallingUid() != DMS_UID) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "The flag only support for DMS, flag is %{public}d", want.GetFlags());
|
||||
eventInfo.errCode = ERR_INVALID_VALUE;
|
||||
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
|
||||
return ERR_INVALID_CONTINUATION_FLAG;
|
||||
}
|
||||
|
||||
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
|
||||
eventInfo.errCode = ERR_INVALID_VALUE;
|
||||
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
|
||||
@@ -1597,6 +1608,14 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St
|
||||
}
|
||||
#endif // WITH_DLP
|
||||
|
||||
if ((want.GetFlags() & Want::FLAG_ABILITY_PREPARE_CONTINUATION) == Want::FLAG_ABILITY_PREPARE_CONTINUATION &&
|
||||
IPCSkeleton::GetCallingUid() != DMS_UID) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "The flag only support for DMS, flag is %{public}d", want.GetFlags());
|
||||
eventInfo.errCode = ERR_INVALID_VALUE;
|
||||
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
|
||||
return ERR_INVALID_CONTINUATION_FLAG;
|
||||
}
|
||||
|
||||
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
|
||||
eventInfo.errCode = ERR_INVALID_VALUE;
|
||||
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
|
||||
@@ -4102,6 +4121,7 @@ int AbilityManagerService::DisconnectRemoteAbility(const sptr<IRemoteObject> &co
|
||||
int AbilityManagerService::ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId,
|
||||
int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams)
|
||||
{
|
||||
CHECK_CALLER_IS_SYSTEM_APP;
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "ContinueMission missionId: %{public}d", missionId);
|
||||
if (!PermissionVerification::GetInstance()->VerifyMissionPermission()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s: Permission verification failed", __func__);
|
||||
@@ -4115,6 +4135,7 @@ int AbilityManagerService::ContinueMission(const std::string &srcDeviceId, const
|
||||
int AbilityManagerService::ContinueMission(AAFwk::ContinueMissionInfo continueMissionInfo,
|
||||
const sptr<IRemoteObject> &callback)
|
||||
{
|
||||
CHECK_CALLER_IS_SYSTEM_APP;
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "called");
|
||||
AAFWK::ContinueRadar::GetInstance().ClickIconContinue("ContinueMission");
|
||||
if (!PermissionVerification::GetInstance()->VerifyMissionPermission()) {
|
||||
@@ -4246,6 +4267,7 @@ int AbilityManagerService::NotifyContinuationResult(int32_t missionId, int32_t r
|
||||
|
||||
int AbilityManagerService::StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag)
|
||||
{
|
||||
CHECK_CALLER_IS_SYSTEM_APP;
|
||||
if (!PermissionVerification::GetInstance()->VerifyMissionPermission()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s: Permission verification failed", __func__);
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
@@ -4256,6 +4278,7 @@ int AbilityManagerService::StartSyncRemoteMissions(const std::string& devId, boo
|
||||
|
||||
int AbilityManagerService::StopSyncRemoteMissions(const std::string& devId)
|
||||
{
|
||||
CHECK_CALLER_IS_SYSTEM_APP;
|
||||
if (!PermissionVerification::GetInstance()->VerifyMissionPermission()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s: Permission verification failed", __func__);
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
@@ -8441,6 +8464,21 @@ int AbilityManagerService::CheckStaticCfgPermission(const AppExecFwk::AbilityReq
|
||||
{
|
||||
auto abilityInfo = abilityRequest.abilityInfo;
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (AppUtils::GetInstance().IsSupportAncoApp() &&
|
||||
StartAbilityUtils::IsCallFromAncoShellOrBroker(abilityRequest.callerToken)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR,
|
||||
"Check static permission, name is %{public}s.", abilityInfo.name.c_str());
|
||||
auto collaborator = GetCollaborator(CollaboratorType::RESERVE_TYPE);
|
||||
if (collaborator == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Collaborator is nullptr.");
|
||||
return AppExecFwk::Constants::PERMISSION_NOT_GRANTED;
|
||||
}
|
||||
int result = collaborator->CheckStaticCfgPermission(abilityRequest.want);
|
||||
if (result != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Check permission failed from broker.");
|
||||
return AppExecFwk::Constants::PERMISSION_NOT_GRANTED;
|
||||
}
|
||||
}
|
||||
if (!isData) {
|
||||
isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall();
|
||||
}
|
||||
@@ -8599,56 +8637,6 @@ int AbilityManagerService::VerifyAccountPermission(int32_t userId)
|
||||
return AAFwk::PermissionVerification::GetInstance()->VerifyAccountPermission();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilityManagerService::BlockAmsService()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s", __func__);
|
||||
if (AAFwk::PermissionVerification::GetInstance()->IsShellCall()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Not shell call");
|
||||
return ERR_PERMISSION_DENIED;
|
||||
}
|
||||
if (taskHandler_) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s begin post block ability manager service task", __func__);
|
||||
auto BlockAmsServiceTask = [aams = shared_from_this()]() {
|
||||
while (1) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s begin waiting", __func__);
|
||||
std::this_thread::sleep_for(BLOCK_AMS_SERVICE_TIME*1s);
|
||||
}
|
||||
};
|
||||
taskHandler_->SubmitTask(BlockAmsServiceTask, "blockamsservice");
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
|
||||
int AbilityManagerService::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s", __func__);
|
||||
if (AAFwk::PermissionVerification::GetInstance()->IsShellCall()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Not shell call");
|
||||
return ERR_PERMISSION_DENIED;
|
||||
}
|
||||
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
auto uiAbilityManager = GetCurrentUIAbilityManager();
|
||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||
return uiAbilityManager->BlockAbility(abilityRecordId);
|
||||
}
|
||||
auto missionListManager = GetCurrentMissionListManager();
|
||||
CHECK_POINTER_AND_RETURN(missionListManager, ERR_NO_INIT);
|
||||
return missionListManager->BlockAbility(abilityRecordId);
|
||||
}
|
||||
|
||||
int AbilityManagerService::BlockAppService()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s", __func__);
|
||||
if (AAFwk::PermissionVerification::GetInstance()->IsShellCall()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Not shell call");
|
||||
return ERR_PERMISSION_DENIED;
|
||||
}
|
||||
return DelayedSingleton<AppScheduler>::GetInstance()->BlockAppService();
|
||||
}
|
||||
#endif
|
||||
|
||||
int AbilityManagerService::FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
|
||||
int32_t userId, int requestCode)
|
||||
{
|
||||
@@ -9427,15 +9415,19 @@ bool AbilityManagerService::CheckUIExtensionCallerIsForeground(const AbilityRequ
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check caller ability firstly.
|
||||
bool isBackgroundCall = true;
|
||||
auto ret = IsCallFromBackground(abilityRequest, isBackgroundCall);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::UI_EXT, "start uea when background");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isBackgroundCall) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto callerAbility = Token::GetAbilityRecordByToken(abilityRequest.callerToken);
|
||||
if (callerAbility != nullptr) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Caller ability is %{public}s, state: %{public}d",
|
||||
callerAbility->GetURI().c_str(), callerAbility->GetAbilityState());
|
||||
if (callerAbility->IsForeground() || callerAbility->GetAbilityForegroundingFlag()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (UIExtensionUtils::IsUIExtension(callerAbility->GetAbilityInfo().extensionAbilityType)) {
|
||||
auto tokenId = callerAbility->GetApplicationInfo().accessTokenId;
|
||||
bool isFocused = false;
|
||||
@@ -9450,23 +9442,13 @@ bool AbilityManagerService::CheckUIExtensionCallerIsForeground(const AbilityRequ
|
||||
}
|
||||
}
|
||||
|
||||
// Check caller app.
|
||||
auto callerPid = IPCSkeleton::GetCallingPid();
|
||||
AppExecFwk::RunningProcessInfo processInfo;
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->GetRunningProcessInfoByPid(callerPid, processInfo);
|
||||
if (processInfo.isFocused || processInfo.isAbilityForegrounding ||
|
||||
processInfo.state_ == AppExecFwk::AppProcessState::APP_STATE_FOREGROUND) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Caller app %{public}s is foreground", processInfo.processName_.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PermissionVerification::GetInstance()->VerifyCallingPermission(
|
||||
PermissionConstants::PERMISSION_START_ABILITIES_FROM_BACKGROUND)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Caller app %{public}s is not foreground, can't start %{public}s",
|
||||
processInfo.processName_.c_str(), abilityRequest.want.GetElement().GetURI().c_str());
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Caller app is not foreground, can't start %{public}s",
|
||||
abilityRequest.want.GetElement().GetURI().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -442,17 +442,6 @@ int AbilityManagerStub::OnRemoteRequestInnerEleventh(uint32_t code, MessageParce
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_SESSION_HANDLER) {
|
||||
return RegisterSessionHandlerInner(data, reply);
|
||||
}
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_ABILITY) {
|
||||
return BlockAbilityInner(data, reply);
|
||||
}
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_AMS_SERVICE) {
|
||||
return BlockAmsServiceInner(data, reply);
|
||||
}
|
||||
if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_APP_SERVICE) {
|
||||
return BlockAppServiceInner(data, reply);
|
||||
}
|
||||
#endif
|
||||
return ERR_CODE_NOT_EXIST;
|
||||
}
|
||||
|
||||
@@ -2688,37 +2677,6 @@ int AbilityManagerStub::ForceTimeoutForTestInner(MessageParcel &data, MessagePar
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerStub::BlockAbilityInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t abilityRecordId = data.ReadInt32();
|
||||
int32_t result = BlockAbility(abilityRecordId);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write failed.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerStub::BlockAmsServiceInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t result = BlockAmsService();
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write failed.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerStub::BlockAppServiceInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t result = BlockAppService();
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write failed.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
int AbilityManagerStub::FreeInstallAbilityFromRemoteInner(MessageParcel &data, MessageParcel &reply)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2024 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
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "ability_manager_xcollie.h"
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
const uint32_t AbilityManagerXCollie::TIME_OUT_SECONDS = 30;
|
||||
AbilityManagerXCollie::AbilityManagerXCollie(const std::string &tag, uint32_t timeoutSeconds,
|
||||
std::function<void(void *)> func, void* arg, uint32_t flag)
|
||||
{
|
||||
|
||||
@@ -504,13 +504,13 @@ void AbilityRecord::PostUIExtensionAbilityTimeoutTask(uint32_t messageId)
|
||||
switch (messageId) {
|
||||
case AbilityManagerService::LOAD_TIMEOUT_MSG: {
|
||||
uint32_t timeout = AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() *
|
||||
LOAD_TIMEOUT_MULTIPLE;
|
||||
static_cast<uint32_t>(LOAD_TIMEOUT_MULTIPLE);
|
||||
SendEvent(AbilityManagerService::LOAD_TIMEOUT_MSG, timeout / HALF_TIMEOUT, recordId_, true);
|
||||
break;
|
||||
}
|
||||
case AbilityManagerService::FOREGROUND_TIMEOUT_MSG: {
|
||||
uint32_t timeout = AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() *
|
||||
FOREGROUND_TIMEOUT_MULTIPLE;
|
||||
static_cast<uint32_t>(FOREGROUND_TIMEOUT_MULTIPLE);
|
||||
SendEvent(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, timeout / HALF_TIMEOUT, recordId_, true);
|
||||
break;
|
||||
}
|
||||
@@ -3462,18 +3462,6 @@ AbilityState AbilityRecord::GetPendingState() const
|
||||
return pendingState_.load();
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilityRecord::BlockAbility()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "BlockAbility.");
|
||||
if (scheduler_) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "scheduler_ begin to call BlockAbility %{public}s", __func__);
|
||||
return scheduler_->BlockAbility();
|
||||
}
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AbilityRecord::IsNeedBackToOtherMissionStack()
|
||||
{
|
||||
return isNeedBackToOtherMissionStack_;
|
||||
|
||||
@@ -1170,31 +1170,6 @@ void AbilitySchedulerProxy::UpdateSessionToken(sptr<IRemoteObject> sessionToken)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilitySchedulerProxy::BlockAbility()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "AbilitySchedulerProxy::BlockAbility start");
|
||||
int ret = -1;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return ret;
|
||||
}
|
||||
int32_t err = SendTransactCmd(IAbilityScheduler::BLOCK_ABILITY_INNER, data, reply, option);
|
||||
if (err != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "BlockAbility fail to SendRequest. err: %d", err);
|
||||
return ret;
|
||||
}
|
||||
if (!reply.ReadInt32(ret)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail to ReadInt32 ret");
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t AbilitySchedulerProxy::SendTransactCmd(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
|
||||
@@ -154,10 +154,6 @@ int AbilitySchedulerStub::OnRemoteRequestInnerThird(
|
||||
return CreateModalUIExtensionInner(data, reply);
|
||||
case UPDATE_SESSION_TOKEN:
|
||||
return UpdateSessionTokenInner(data, reply);
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
case BLOCK_ABILITY_INNER:
|
||||
return BlockAbilityInner(data, reply);
|
||||
#endif
|
||||
}
|
||||
return ERR_CODE_NOT_EXIST;
|
||||
}
|
||||
@@ -742,20 +738,6 @@ int AbilitySchedulerStub::UpdateSessionTokenInner(MessageParcel &data, MessagePa
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AbilitySchedulerStub::BlockAbilityInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "AbilitySchedulerStub::BlockAbilityInner start");
|
||||
|
||||
auto result = BlockAbility();
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail to WriteInt32 result");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
void AbilitySchedulerRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "call");
|
||||
|
||||
@@ -484,20 +484,6 @@ int32_t AppScheduler::NotifyAppMgrRecordExitReason(int32_t pid, int32_t reason,
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AppScheduler::BlockAppService()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "[%{public}s(%{public}s)] enter", __FILE__, __FUNCTION__);
|
||||
CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR);
|
||||
auto ret = static_cast<int>(IN_PROCESS_CALL(appMgrClient_->BlockAppService()));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "BlockAppService failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t AppScheduler::GetBundleNameByPid(const int pid, std::string &bundleName, int32_t &uid)
|
||||
{
|
||||
CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR);
|
||||
|
||||
@@ -26,6 +26,9 @@ const std::map<AppExecFwk::ExtensionAbilityType, ExtensionRecordConfig> EXTENSIO
|
||||
{ AppExecFwk::ExtensionAbilityType::EMBEDDED_UI,
|
||||
{ PROCESS_MODE_BUNDLE, PROCESS_MODE_SUPPORT_DEFAULT | PROCESS_MODE_HOST_SPECIFIED | PROCESS_MODE_HOST_INSTANCE,
|
||||
PRE_CHECK_FLAG_CALLED_WITHIN_THE_BUNDLE | PRE_CHECK_FLAG_MULTIPLE_PROCESSES }},
|
||||
{ AppExecFwk::ExtensionAbilityType::STATUS_BAR_VIEW,
|
||||
{ PROCESS_MODE_BUNDLE, PROCESS_MODE_SUPPORT_DEFAULT | PROCESS_MODE_RUN_WITH_MAIN_PROCESS,
|
||||
PRE_CHECK_FLAG_NONE }},
|
||||
};
|
||||
|
||||
uint32_t GetPreCheckFlag(ExtensionAbilityType type)
|
||||
|
||||
@@ -265,6 +265,14 @@ int32_t ExtensionRecordManager::UpdateProcessName(const AAFwk::AbilityRequest &a
|
||||
abilityRecord->SetProcessName(process);
|
||||
break;
|
||||
}
|
||||
case PROCESS_MODE_RUN_WITH_MAIN_PROCESS: {
|
||||
if (!abilityRequest.appInfo.process.empty()) {
|
||||
abilityRecord->SetProcessName(abilityRequest.appInfo.process);
|
||||
} else {
|
||||
abilityRecord->SetProcessName(abilityRequest.abilityInfo.bundleName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: // AppExecFwk::ExtensionProcessMode::UNDEFINED or AppExecFwk::ExtensionProcessMode::BUNDLE
|
||||
// no need to update
|
||||
break;
|
||||
|
||||
@@ -31,6 +31,7 @@ bool MissionInfo::ReadFromParcel(Parcel &parcel)
|
||||
return false;
|
||||
}
|
||||
want = *parcelWant;
|
||||
want.CloseAllFd();
|
||||
abilityState = parcel.ReadInt32();
|
||||
unclearable = parcel.ReadBool();
|
||||
continueState = static_cast<AAFwk::ContinueState>(parcel.ReadInt32());
|
||||
|
||||
@@ -401,25 +401,6 @@ void MissionList::DumpList(std::vector<std::string> &info, bool isClient)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int MissionList::BlockAbilityByRecordId(int32_t abilityRecordId)
|
||||
{
|
||||
int ret = -1;
|
||||
for (const auto& mission : missions_) {
|
||||
if (mission) {
|
||||
auto abilityRecord = mission->GetAbilityRecord();
|
||||
if (abilityRecord) {
|
||||
if (abilityRecord->GetRecordId() == abilityRecordId) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "record begin to call BlockAbilityByRecordId %{public}s", __func__);
|
||||
return abilityRecord->BlockAbility();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t MissionList::GetMissionCountByUid(int32_t targetUid) const
|
||||
{
|
||||
int32_t count = 0;
|
||||
|
||||
@@ -3923,47 +3923,6 @@ bool MissionListManager::IsExcludeFromMissions(const std::shared_ptr<Mission> &m
|
||||
return abilityRecord && abilityRecord->GetAbilityInfo().excludeFromMissions;
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int MissionListManager::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
int ret = -1;
|
||||
for (const auto &missionList : currentMissionLists_) {
|
||||
if (missionList && missionList != launcherList_) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "missionList begin to call BlockAbilityByRecordId %{public}s", __func__);
|
||||
if (missionList->BlockAbilityByRecordId(abilityRecordId) == ERR_OK) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "missionList call BlockAbilityByRecordId success");
|
||||
ret = ERR_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultStandardList_) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "defaultStandardList begin to call BlockAbilityByRecordId %{public}s", __func__);
|
||||
if (defaultStandardList_->BlockAbilityByRecordId(abilityRecordId) == ERR_OK) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "defaultStandardList call BlockAbilityByRecordId success");
|
||||
ret = ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultSingleList_) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "defaultSingleList begin to call BlockAbilityByRecordId %{public}s", __func__);
|
||||
if (defaultSingleList_->BlockAbilityByRecordId(abilityRecordId) == ERR_OK) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "defaultSingleList_ call BlockAbilityByRecordId success");
|
||||
ret = ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (launcherList_) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "launcherList begin to call BlockAbilityByRecordId %{public}s", __func__);
|
||||
if (launcherList_->BlockAbilityByRecordId(abilityRecordId) == ERR_OK) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "launcherList_ call BlockAbilityByRecordId success");
|
||||
ret = ERR_OK;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
void MissionListManager::SetMissionANRStateByTokens(const std::vector<sptr<IRemoteObject>> &tokens)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "call");
|
||||
|
||||
@@ -118,7 +118,7 @@ sptr<IWantSender> PendingWantManager::GetWantSenderLocked(const int32_t callingU
|
||||
rec->SetCallerUid(callingUid);
|
||||
pendingKey->SetCode(PendingRecordIdCreate());
|
||||
wantRecords_.insert(std::make_pair(pendingKey, rec));
|
||||
TAG_LOGI(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
||||
TAG_LOGD(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
||||
return rec;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -85,7 +85,19 @@ int32_t PendingWantRecord::SenderInner(SenderInfo &senderInfo)
|
||||
BuildSendWant(senderInfo, want);
|
||||
|
||||
bool sendFinish = (senderInfo.finishedReceiver != nullptr);
|
||||
int res = NO_ERROR;
|
||||
int32_t res = ExecuteOperation(pendingWantManager, senderInfo, want);
|
||||
if (sendFinish && res != START_CANCELED) {
|
||||
WantParams wantParams = {};
|
||||
senderInfo.finishedReceiver->PerformReceive(want, senderInfo.code, "", wantParams, false, false, 0);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int32_t PendingWantRecord::ExecuteOperation(
|
||||
std::shared_ptr<PendingWantManager> pendingWantManager, SenderInfo &senderInfo, Want &want)
|
||||
{
|
||||
int32_t res = NO_ERROR;
|
||||
switch (key_->GetType()) {
|
||||
case static_cast<int32_t>(OperationType::START_ABILITY):
|
||||
res = pendingWantManager->PendingWantStartAbility(want, senderInfo.startOptions,
|
||||
@@ -112,12 +124,6 @@ int32_t PendingWantRecord::SenderInner(SenderInfo &senderInfo)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sendFinish && res != START_CANCELED) {
|
||||
WantParams wantParams = {};
|
||||
senderInfo.finishedReceiver->PerformReceive(want, senderInfo.code, "", wantParams, false, false, 0);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -2250,27 +2250,6 @@ void UIAbilityLifecycleManager::GetAbilityRunningInfos(std::vector<AbilityRunnin
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int UIAbilityLifecycleManager::BlockAbility(int32_t abilityRecordId) const
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call.");
|
||||
for (const auto& [first, second] : sessionAbilityMap_) {
|
||||
if (second == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "abilityRecord is nullptr.");
|
||||
continue;
|
||||
}
|
||||
if (second->GetRecordId() == abilityRecordId) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call BlockAbility.");
|
||||
return second->BlockAbility();
|
||||
}
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "The abilityRecordId is invalid.");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIAbilityLifecycleManager::Dump(std::vector<std::string> &info)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call begin.");
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillProcessWithAccount(
|
||||
const std::string &bundleName, const int accountId, const bool clearpagestack = false) override;
|
||||
const std::string &bundleName, const int accountId, const bool clearPageStack = true) override;
|
||||
|
||||
/**
|
||||
* UpdateApplicationInfoInstalled, call UpdateApplicationInfoInstalled() through proxy object,
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
* @param bundleName, bundle name in Application record.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearpagestack = false) override;
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearPageStack = true) override;
|
||||
|
||||
/**
|
||||
* ForceKillApplication, force kill the application.
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
*/
|
||||
virtual int KillApplicationByUid(const std::string &bundleName, const int uid) override;
|
||||
|
||||
virtual int KillApplicationSelf(const bool clearpagestack = false) override;
|
||||
virtual int KillApplicationSelf(const bool clearPageStack = true) override;
|
||||
|
||||
int GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application, bool &debug) override;
|
||||
|
||||
|
||||
@@ -180,6 +180,15 @@ public:
|
||||
*/
|
||||
virtual int32_t GetAllRenderProcesses(std::vector<RenderProcessInfo> &info) override;
|
||||
|
||||
/**
|
||||
* GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
|
||||
* Obtains information about children processes that are running on the device.
|
||||
*
|
||||
* @param info, child process info.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info) override;
|
||||
|
||||
/**
|
||||
* JudgeSandboxByPid, call JudgeSandboxByPid() through proxy project.
|
||||
* Obtains information about application processes that are running on the device.
|
||||
@@ -338,15 +347,6 @@ public:
|
||||
|
||||
virtual int32_t UnregisterConfigurationObserver(const sptr<IConfigurationObserver> &observer) override;
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
/**
|
||||
* Block app service.
|
||||
*
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int BlockAppService() override;
|
||||
#endif
|
||||
|
||||
bool GetAppRunningStateByBundleName(const std::string &bundleName) override;
|
||||
|
||||
int32_t NotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback) override;
|
||||
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
*
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearpagestack = false);
|
||||
virtual int32_t KillApplication(const std::string &bundleName, const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* ForceKillApplication, force kill the application.
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
*/
|
||||
virtual int32_t KillApplicationByUid(const std::string &bundleName, const int uid);
|
||||
|
||||
virtual int32_t KillApplicationSelf(const bool clearpagestack = false);
|
||||
virtual int32_t KillApplicationSelf(const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* KillApplicationByUserId, kill the application by user ID.
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int32_t KillApplicationByUserId(const std::string &bundleName, int32_t appCloneIndex, int userId,
|
||||
const bool clearpagestack = false);
|
||||
const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* ClearUpApplicationData, clear the application data.
|
||||
@@ -388,6 +388,15 @@ public:
|
||||
*/
|
||||
virtual int32_t GetAllRenderProcesses(std::vector<RenderProcessInfo> &info);
|
||||
|
||||
/**
|
||||
* GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
|
||||
* Obtains information about children processes that are running on the device.
|
||||
*
|
||||
* @param info, child process info.
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
virtual int GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info);
|
||||
|
||||
/**
|
||||
* NotifyMemoryLevel, Notify applications background the current memory level.
|
||||
*
|
||||
@@ -1237,7 +1246,7 @@ private:
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
int32_t KillApplicationByUserIdLocked(const std::string &bundleName, int32_t appCloneIndex, int32_t userId,
|
||||
const bool clearpagestack = false);
|
||||
const bool clearPageStack = true);
|
||||
|
||||
/**
|
||||
* WaitForRemoteProcessExit, Wait for the process to exit normally.
|
||||
@@ -1305,6 +1314,8 @@ private:
|
||||
|
||||
void GetRenderProcesses(const std::shared_ptr<AppRunningRecord> &appRecord, std::vector<RenderProcessInfo> &info);
|
||||
|
||||
void GetChildrenProcesses(const std::shared_ptr<AppRunningRecord> &appRecord, std::vector<ChildProcessInfo> &info);
|
||||
|
||||
int StartRenderProcessImpl(const std::shared_ptr<RenderRecord> &renderRecord,
|
||||
const std::shared_ptr<AppRunningRecord> appRecord, pid_t &renderPid, bool isGPU = false);
|
||||
|
||||
@@ -1339,7 +1350,8 @@ private:
|
||||
const ChildProcessOptions &options);
|
||||
|
||||
int32_t GetChildProcessInfo(const std::shared_ptr<ChildProcessRecord> childProcessRecord,
|
||||
const std::shared_ptr<AppRunningRecord> appRecord, ChildProcessInfo &info);
|
||||
const std::shared_ptr<AppRunningRecord> appRecord, ChildProcessInfo &info,
|
||||
bool isCallFromGetChildrenProcesses = false);
|
||||
|
||||
void OnChildProcessRemoteDied(const wptr<IRemoteObject> &remote);
|
||||
|
||||
@@ -1368,7 +1380,7 @@ private:
|
||||
bool CheckGetRunningInfoPermission() const;
|
||||
|
||||
int32_t KillApplicationByBundleName(
|
||||
const std::string &bundleName, const bool clearpagestack = false);
|
||||
const std::string &bundleName, const bool clearPageStack = true);
|
||||
|
||||
bool SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord);
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
* @return Return true if found, otherwise return false.
|
||||
*/
|
||||
bool ProcessExitByBundleName(
|
||||
const std::string &bundleName, std::list<pid_t> &pids, const bool clearpagestack = false);
|
||||
const std::string &bundleName, std::list<pid_t> &pids, const bool clearPageStack = true);
|
||||
/**
|
||||
* Get Foreground Applications.
|
||||
*
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
int32_t ProcessUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo);
|
||||
|
||||
bool ProcessExitByBundleNameAndUid(
|
||||
const std::string &bundleName, const int uid, std::list<pid_t> &pids, const bool clearpagestack = false);
|
||||
const std::string &bundleName, const int uid, std::list<pid_t> &pids, const bool clearPageStack = true);
|
||||
bool GetPidsByUserId(int32_t userId, std::list<pid_t> &pids);
|
||||
|
||||
void PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag = false);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "freeze_util.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "ipc_object_proxy.h"
|
||||
#include "time_util.h"
|
||||
#include "app_mgr_service_const.h"
|
||||
#include "app_mgr_service_dump_error_code.h"
|
||||
@@ -39,6 +40,12 @@ void AppLifeCycleDeal::LaunchApplication(const AppLaunchData &launchData, const
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
auto appThread = GetApplicationClient();
|
||||
if (appThread) {
|
||||
auto remoteObject = appThread->AsObject();
|
||||
IPCObjectProxy *proxy = reinterpret_cast<IPCObjectProxy *>(remoteObject.GetRefPtr());
|
||||
if (proxy != nullptr) {
|
||||
int32_t pid = static_cast<int32_t>(launchData.GetProcessInfo().GetPid());
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "handle:%{public}u, pid:%{public}d", proxy->GetHandle(), pid);
|
||||
}
|
||||
appThread->ScheduleLaunchApplication(launchData, config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,6 @@ constexpr const int BASE_TEN = 10;
|
||||
constexpr const char SIGN_TERMINAL = '\0';
|
||||
namespace {
|
||||
using namespace std::chrono_literals;
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
static const int APP_MS_BLOCK = 65;
|
||||
#endif
|
||||
constexpr const char* TASK_INIT_APPMGRSERVICEINNER = "InitAppMgrServiceInnerTask";
|
||||
constexpr const char* TASK_ATTACH_APPLICATION = "AttachApplicationTask";
|
||||
constexpr const char* TASK_APPLICATION_FOREGROUNDED = "ApplicationForegroundedTask";
|
||||
@@ -417,6 +414,14 @@ int32_t AppMgrService::GetAllRenderProcesses(std::vector<RenderProcessInfo> &inf
|
||||
return appMgrServiceInner_->GetAllRenderProcesses(info);
|
||||
}
|
||||
|
||||
int AppMgrService::GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info)
|
||||
{
|
||||
if (!IsReady()) {
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
return appMgrServiceInner_->GetAllChildrenProcesses(info);
|
||||
}
|
||||
|
||||
int32_t AppMgrService::JudgeSandboxByPid(pid_t pid, bool &isSandbox)
|
||||
{
|
||||
if (!IsReady()) {
|
||||
@@ -1034,24 +1039,6 @@ int32_t AppMgrService::UnregisterConfigurationObserver(const sptr<IConfiguration
|
||||
return appMgrServiceInner_->UnregisterConfigurationObserver(observer);
|
||||
}
|
||||
|
||||
#ifdef ABILITY_COMMAND_FOR_TEST
|
||||
int AppMgrService::BlockAppService()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "begin");
|
||||
if (!IsReady()) {
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
auto task = [=]() {
|
||||
while (1) {
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "begin block app service");
|
||||
std::this_thread::sleep_for(APP_MS_BLOCK*1s);
|
||||
}
|
||||
};
|
||||
taskHandler_->SubmitTask(task);
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AppMgrService::GetAppRunningStateByBundleName(const std::string &bundleName)
|
||||
{
|
||||
if (!IsReady()) {
|
||||
|
||||
@@ -1781,6 +1781,29 @@ int32_t AppMgrServiceInner::GetAllRenderProcesses(std::vector<RenderProcessInfo>
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int AppMgrServiceInner::GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info)
|
||||
{
|
||||
auto isPerm = AAFwk::PermissionVerification::GetInstance()->VerifyRunningInfoPerm();
|
||||
// check permission
|
||||
for (const auto &item : appRunningManager_->GetAppRunningRecordMap()) {
|
||||
const auto &appRecord = item.second;
|
||||
if (isPerm) {
|
||||
GetChildrenProcesses(appRecord, info);
|
||||
} else {
|
||||
auto applicationInfo = appRecord->GetApplicationInfo();
|
||||
if (!applicationInfo) {
|
||||
continue;
|
||||
}
|
||||
auto callingTokenId = IPCSkeleton::GetCallingTokenID();
|
||||
auto tokenId = applicationInfo->accessTokenId;
|
||||
if (callingTokenId == tokenId) {
|
||||
GetChildrenProcesses(appRecord, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t AppMgrServiceInner::NotifyMemoryLevel(int32_t level)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "start");
|
||||
@@ -1917,6 +1940,30 @@ void AppMgrServiceInner::GetRenderProcesses(const std::shared_ptr<AppRunningReco
|
||||
}
|
||||
}
|
||||
|
||||
void AppMgrServiceInner::GetChildrenProcesses(const std::shared_ptr<AppRunningRecord> &appRecord,
|
||||
std::vector<ChildProcessInfo> &info)
|
||||
{
|
||||
auto childProcessRecordMap = appRecord->GetChildProcessRecordMap();
|
||||
if (childProcessRecordMap.empty()) {
|
||||
return;
|
||||
}
|
||||
int32_t retCode = ERR_OK;
|
||||
for (auto iter : childProcessRecordMap) {
|
||||
auto childProcessRecord = iter.second;
|
||||
if (childProcessRecord != nullptr) {
|
||||
ChildProcessInfo childProcessInfo;
|
||||
retCode = GetChildProcessInfo(childProcessRecord, appRecord, childProcessInfo, true);
|
||||
if (retCode != ERR_OK) {
|
||||
TAG_LOGW(
|
||||
AAFwkTag::APPMGR, "GetChildProcessInfo failed. host pid=%{public}d, child pid=%{public}d",
|
||||
appRecord->GetPriorityObject()->GetPid(), childProcessRecord->GetPid());
|
||||
continue;
|
||||
}
|
||||
info.emplace_back(childProcessInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t AppMgrServiceInner::KillProcessByPid(const pid_t pid, const std::string& reason)
|
||||
{
|
||||
if (!ProcessExist(pid)) {
|
||||
@@ -6532,7 +6579,7 @@ int32_t AppMgrServiceInner::GetChildProcessInfoForSelf(ChildProcessInfo &info)
|
||||
}
|
||||
|
||||
int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptr<ChildProcessRecord> childProcessRecord,
|
||||
const std::shared_ptr<AppRunningRecord> appRecord, ChildProcessInfo &info)
|
||||
const std::shared_ptr<AppRunningRecord> appRecord, ChildProcessInfo &info, bool isCallFromGetChildrenProcesses)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
if (!childProcessRecord) {
|
||||
@@ -6543,23 +6590,38 @@ int32_t AppMgrServiceInner::GetChildProcessInfo(const std::shared_ptr<ChildProce
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "No such appRecord.");
|
||||
return ERR_NAME_NOT_FOUND;
|
||||
}
|
||||
auto osAccountMgr = DelayedSingleton<OsAccountManagerWrapper>::GetInstance();
|
||||
if (osAccountMgr == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "osAccountMgr is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
int32_t userId = -1;
|
||||
int errCode = osAccountMgr->GetOsAccountLocalIdFromUid(appRecord->GetUid(), userId);
|
||||
if (errCode != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "GetOsAccountLocalIdFromUid failed,errcode=%{public}d", errCode);
|
||||
return errCode;
|
||||
}
|
||||
info.userId = userId;
|
||||
info.pid = childProcessRecord->GetPid();
|
||||
info.hostPid = childProcessRecord->GetHostPid();
|
||||
info.uid = childProcessRecord->GetUid();
|
||||
info.childProcessType = childProcessRecord->GetChildProcessType();
|
||||
info.hostUid = appRecord->GetUid();
|
||||
info.bundleName = appRecord->GetBundleName();
|
||||
info.processName = childProcessRecord->GetProcessName();
|
||||
info.srcEntry = childProcessRecord->GetSrcEntry();
|
||||
info.entryFunc = childProcessRecord->GetEntryFunc();
|
||||
info.entryParams = childProcessRecord->GetEntryParams();
|
||||
info.jitEnabled = appRecord->IsJITEnabled();
|
||||
info.isStartWithDebug = childProcessRecord->isStartWithDebug();
|
||||
auto applicationInfo = appRecord->GetApplicationInfo();
|
||||
if (applicationInfo) {
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "applicationInfo is exist, debug:%{public}d", applicationInfo->debug);
|
||||
info.isDebugApp = applicationInfo->debug;
|
||||
if (!isCallFromGetChildrenProcesses) {
|
||||
info.childProcessType = childProcessRecord->GetChildProcessType();
|
||||
info.srcEntry = childProcessRecord->GetSrcEntry();
|
||||
info.entryFunc = childProcessRecord->GetEntryFunc();
|
||||
info.entryParams = childProcessRecord->GetEntryParams();
|
||||
info.jitEnabled = appRecord->IsJITEnabled();
|
||||
info.isStartWithDebug = childProcessRecord->isStartWithDebug();
|
||||
auto applicationInfo = appRecord->GetApplicationInfo();
|
||||
if (applicationInfo) {
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "applicationInfo is exist, debug:%{public}d", applicationInfo->debug);
|
||||
info.isDebugApp = applicationInfo->debug;
|
||||
}
|
||||
info.isStartWithNative = appRecord->isNativeStart();
|
||||
}
|
||||
info.isStartWithNative = appRecord->isNativeStart();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ void EventReport::SendProcessStartFailedEvent(const EventName &eventName, const
|
||||
HiSysEventWrite(
|
||||
HiSysEvent::Domain::AAFWK,
|
||||
name,
|
||||
HiSysEventType::BEHAVIOR,
|
||||
HiSysEventType::FAULT,
|
||||
EVENT_KEY_STARTUP_TIME, eventInfo.time,
|
||||
EVENT_KEY_STARTUP_ABILITY_TYPE, eventInfo.abilityType,
|
||||
EVENT_KEY_CALLER_BUNDLE_NAME, eventInfo.callerBundleName,
|
||||
@@ -505,7 +505,7 @@ void EventReport::SendProcessStartFailedEvent(const EventName &eventName, const
|
||||
HiSysEventWrite(
|
||||
HiSysEvent::Domain::AAFWK,
|
||||
name,
|
||||
HiSysEventType::BEHAVIOR,
|
||||
HiSysEventType::FAULT,
|
||||
EVENT_KEY_STARTUP_TIME, eventInfo.time,
|
||||
EVENT_KEY_STARTUP_ABILITY_TYPE, eventInfo.abilityType,
|
||||
EVENT_KEY_STARTUP_EXTENSION_TYPE, eventInfo.extensionType,
|
||||
|
||||
@@ -364,11 +364,6 @@ bool PermissionVerification::JudgeStartAbilityFromBackground(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (withContinuousTask) {
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "continuousTask: true");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Temporarily supports permissions with two different spellings
|
||||
// PERMISSION_START_ABILIIES_FROM_BACKGROUND will be removed later due to misspelling
|
||||
if (VerifyCallingPermission(PermissionConstants::PERMISSION_START_ABILITIES_FROM_BACKGROUND) ||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user