mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 07:10:19 +00:00
Merge branch 'master' of gitee.com:openharmony/ability_ability_runtime into DuliBianYi_20241016
Signed-off-by: jiangzhijun8 <jiangzhijun7@huawei.com>
This commit is contained in:
commit
864d0d8ea3
@ -56,6 +56,7 @@
|
|||||||
"dlp_permission_service",
|
"dlp_permission_service",
|
||||||
"dsoftbus",
|
"dsoftbus",
|
||||||
"eventhandler",
|
"eventhandler",
|
||||||
|
"ets_frontend",
|
||||||
"ets_runtime",
|
"ets_runtime",
|
||||||
"ets_utils",
|
"ets_utils",
|
||||||
"faultloggerd",
|
"faultloggerd",
|
||||||
@ -99,9 +100,7 @@
|
|||||||
"toolchain",
|
"toolchain",
|
||||||
"webview",
|
"webview",
|
||||||
"window_manager",
|
"window_manager",
|
||||||
"zlib",
|
"zlib"
|
||||||
"ets_frontend",
|
|
||||||
"runtime_core"
|
|
||||||
],
|
],
|
||||||
"third_party": [
|
"third_party": [
|
||||||
"libjpeg-turbo"
|
"libjpeg-turbo"
|
||||||
@ -437,7 +436,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": {
|
"header": {
|
||||||
"header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_ability",
|
"header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"header_files": [
|
"header_files": [
|
||||||
"ui_extension_context.h"
|
"ui_extension_context.h"
|
||||||
]
|
]
|
||||||
|
@ -27,7 +27,6 @@ ohos_shared_library("ark_interop_helper_ffi") {
|
|||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
"napi:ace_napi",
|
||||||
"napi:ark_interop",
|
"napi:ark_interop",
|
||||||
"runtime_core:libarkbase_static",
|
|
||||||
]
|
]
|
||||||
sanitize = {
|
sanitize = {
|
||||||
cfi = true
|
cfi = true
|
||||||
|
@ -44,7 +44,7 @@ ohos_shared_library("autostartupcallback") {
|
|||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"napi:ace_napi",
|
"napi:ace_napi",
|
||||||
"window_manager:libwm"
|
"window_manager:libwm",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
|
@ -56,8 +56,8 @@ template("delegator") {
|
|||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"hitrace:hitrace_meter",
|
"hitrace:hitrace_meter",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
]
|
]
|
||||||
|
|
||||||
cflags_cc = []
|
cflags_cc = []
|
||||||
|
@ -48,9 +48,9 @@ ohos_shared_library("napi_ability_common") {
|
|||||||
external_deps = [
|
external_deps = [
|
||||||
"ability_base:base",
|
"ability_base:base",
|
||||||
"ability_base:want",
|
"ability_base:want",
|
||||||
"bundle_framework:appexecfwk_base",
|
|
||||||
"access_token:libtokenid_sdk",
|
"access_token:libtokenid_sdk",
|
||||||
"bundle_framework:appexecfwk_base",
|
"bundle_framework:appexecfwk_base",
|
||||||
|
"bundle_framework:appexecfwk_base",
|
||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"common_event_service:cesfwk_innerkits",
|
"common_event_service:cesfwk_innerkits",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
|
@ -63,6 +63,7 @@ ohos_shared_library("napi_common") {
|
|||||||
"json:nlohmann_json_static",
|
"json:nlohmann_json_static",
|
||||||
"libuv:uv",
|
"libuv:uv",
|
||||||
"napi:ace_napi",
|
"napi:ace_napi",
|
||||||
|
"samgr:samgr_proxy",
|
||||||
]
|
]
|
||||||
|
|
||||||
public_external_deps = [
|
public_external_deps = [
|
||||||
@ -78,6 +79,7 @@ ohos_shared_library("napi_common") {
|
|||||||
]
|
]
|
||||||
public_external_deps += [
|
public_external_deps += [
|
||||||
"form_fwk:form_manager",
|
"form_fwk:form_manager",
|
||||||
|
"graphic_2d:EGL",
|
||||||
"window_manager:libdm",
|
"window_manager:libdm",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ int LocalCallContainer::ReleaseCall(const std::shared_ptr<CallerCallBack>& callb
|
|||||||
|
|
||||||
void LocalCallContainer::ClearFailedCallConnection(const std::shared_ptr<CallerCallBack> &callback)
|
void LocalCallContainer::ClearFailedCallConnection(const std::shared_ptr<CallerCallBack> &callback)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::LOCAL_CALL, "called");
|
TAG_LOGI(AAFwkTag::LOCAL_CALL, "called");
|
||||||
if (callback == nullptr) {
|
if (callback == nullptr) {
|
||||||
TAG_LOGE(AAFwkTag::LOCAL_CALL, "callback is nullptr");
|
TAG_LOGE(AAFwkTag::LOCAL_CALL, "callback is nullptr");
|
||||||
return;
|
return;
|
||||||
@ -141,7 +141,16 @@ void LocalCallContainer::ClearFailedCallConnection(const std::shared_ptr<CallerC
|
|||||||
TAG_LOGE(AAFwkTag::LOCAL_CALL, "connection conversion failed");
|
TAG_LOGE(AAFwkTag::LOCAL_CALL, "connection conversion failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::string deviceId = localCallRecord->GetElementName().GetDeviceID();
|
||||||
|
if (deviceId.empty()) {
|
||||||
|
connections_.erase(connect);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TAG_LOGI(AAFwkTag::LOCAL_CALL, "try releaseCall");
|
||||||
|
auto abilityClient = AAFwk::AbilityManagerClient::GetInstance();
|
||||||
|
if (abilityClient != nullptr) {
|
||||||
|
abilityClient->ReleaseCall(connect, localCallRecord->GetElementName());
|
||||||
|
}
|
||||||
connections_.erase(connect);
|
connections_.erase(connect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,9 +419,7 @@ ohos_shared_library("abilitykit_native") {
|
|||||||
"window_manager:libwsutils",
|
"window_manager:libwsutils",
|
||||||
]
|
]
|
||||||
|
|
||||||
public_external_deps += [
|
public_external_deps += [ "window_manager:libdm" ]
|
||||||
"window_manager:libdm",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
innerapi_tags = [ "platformsdk" ]
|
innerapi_tags = [ "platformsdk" ]
|
||||||
@ -571,6 +569,7 @@ config("uiability_config") {
|
|||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/distributed",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/distributed",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/kits",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/continuation/kits",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/recovery/",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/recovery/",
|
||||||
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/app",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/app",
|
||||||
"${ability_runtime_services_path}/abilitymgr/include/utils",
|
"${ability_runtime_services_path}/abilitymgr/include/utils",
|
||||||
@ -1163,16 +1162,10 @@ ohos_shared_library("continuation_ipc") {
|
|||||||
"json:nlohmann_json_static",
|
"json:nlohmann_json_static",
|
||||||
"resource_management:global_resmgr",
|
"resource_management:global_resmgr",
|
||||||
]
|
]
|
||||||
public_external_deps = [
|
public_external_deps = []
|
||||||
# "accessibility:accessibility_common",
|
|
||||||
# "libuv:uv",
|
|
||||||
]
|
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
public_external_deps += [
|
public_external_deps += []
|
||||||
# "form_fwk:form_manager",
|
|
||||||
# "window_manager:libdm",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
@ -1253,9 +1246,9 @@ ohos_shared_library("service_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"json:nlohmann_json_static",
|
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"json:nlohmann_json_static",
|
||||||
"napi:ace_napi",
|
"napi:ace_napi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1380,6 +1373,7 @@ config("ui_extension_public_config") {
|
|||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/insight_intent_executor",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/insight_intent_executor",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
||||||
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${windowmanager_path}/interfaces/kits/napi/embeddable_window_stage",
|
"${windowmanager_path}/interfaces/kits/napi/embeddable_window_stage",
|
||||||
"${windowmanager_path}/interfaces/kits/napi/extension_window",
|
"${windowmanager_path}/interfaces/kits/napi/extension_window",
|
||||||
]
|
]
|
||||||
@ -1390,13 +1384,13 @@ ohos_shared_library("ui_extension") {
|
|||||||
sources = [
|
sources = [
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_embeddable_ui_ability_context.cpp",
|
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_embeddable_ui_ability_context.cpp",
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_ui_extension.cpp",
|
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_ui_extension.cpp",
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_ui_extension_base.cpp",
|
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_ui_extension_content_session.cpp",
|
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_ui_extension_context.cpp",
|
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/js_uiservice_uiext_connection.cpp",
|
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/ui_extension.cpp",
|
"${ability_runtime_native_path}/ability/native/ui_extension_ability/ui_extension.cpp",
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/ui_extension_context.cpp",
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/js_ui_extension_base.cpp",
|
||||||
"${ability_runtime_native_path}/ability/native/ui_extension_ability/ui_extension_servicehost_stub_impl.cpp",
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/js_ui_extension_content_session.cpp",
|
||||||
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/js_ui_extension_context.cpp",
|
||||||
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/js_uiservice_uiext_connection.cpp",
|
||||||
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/ui_extension_context.cpp",
|
||||||
|
"${ability_runtime_native_path}/ability/native/ui_extension_base/ui_extension_servicehost_stub_impl.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
public_configs = [ ":ui_extension_public_config" ]
|
public_configs = [ ":ui_extension_public_config" ]
|
||||||
@ -1469,8 +1463,8 @@ ohos_shared_library("ui_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
"window_manager:libwm",
|
"window_manager:libwm",
|
||||||
]
|
]
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
@ -1487,7 +1481,7 @@ config("share_extension_config") {
|
|||||||
include_dirs = [
|
include_dirs = [
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/share_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/share_extension_ability",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
||||||
@ -1538,7 +1532,7 @@ config("action_extension_config") {
|
|||||||
include_dirs = [
|
include_dirs = [
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/action_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/action_extension_ability",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
||||||
@ -1606,15 +1600,13 @@ ohos_shared_library("share_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
external_deps += [
|
external_deps += [ "window_manager:libwm" ]
|
||||||
"window_manager:libwm",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
relative_install_dir = "extensionability/"
|
relative_install_dir = "extensionability/"
|
||||||
@ -1671,15 +1663,13 @@ ohos_shared_library("action_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
external_deps += [
|
external_deps += [ "window_manager:libwm" ]
|
||||||
"window_manager:libwm",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
relative_install_dir = "extensionability/"
|
relative_install_dir = "extensionability/"
|
||||||
@ -1692,7 +1682,7 @@ config("embedded_ui_extension_config") {
|
|||||||
include_dirs = [
|
include_dirs = [
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/embedded_ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/embedded_ui_extension_ability",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
||||||
@ -1855,7 +1845,7 @@ config("auto_fill_extension_config") {
|
|||||||
include_dirs = [
|
include_dirs = [
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/auto_fill_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/auto_fill_extension_ability",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1932,9 +1922,9 @@ ohos_shared_library("auto_fill_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
"window_manager:libwm",
|
"window_manager:libwm",
|
||||||
]
|
]
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
@ -1950,7 +1940,7 @@ config("photo_editor_extension_config") {
|
|||||||
visibility = [ ":*" ]
|
visibility = [ ":*" ]
|
||||||
include_dirs = [
|
include_dirs = [
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_base",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
"${ability_runtime_path}/interfaces/kits/native/ability/native",
|
||||||
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime",
|
||||||
@ -2041,9 +2031,9 @@ ohos_shared_library("photo_editor_extension_module") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"napi:ace_napi",
|
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"ipc:ipc_napi",
|
"ipc:ipc_napi",
|
||||||
|
"napi:ace_napi",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <charconv>
|
||||||
|
|
||||||
#include "hilog_tag_wrapper.h"
|
#include "hilog_tag_wrapper.h"
|
||||||
#include "form_mgr_errors.h"
|
#include "form_mgr_errors.h"
|
||||||
@ -112,10 +113,10 @@ private:
|
|||||||
std::string strFormId;
|
std::string strFormId;
|
||||||
ConvertFromJsValue(env, info.argv[0], strFormId);
|
ConvertFromJsValue(env, info.argv[0], strFormId);
|
||||||
int64_t formId = 0;
|
int64_t formId = 0;
|
||||||
try {
|
auto res = std::from_chars(strFormId.c_str(), strFormId.c_str() + strFormId.size(), formId);
|
||||||
formId = strFormId.empty() ? -1 : std::stoll(strFormId);
|
if (res.ec != std::errc()) {
|
||||||
}catch (...) {
|
TAG_LOGE(AAFwkTag::FORM_EXT, "from_chars error strFormId:%{public}s", strFormId.c_str());
|
||||||
TAG_LOGE(AAFwkTag::FORM_EXT, "stoll error strFormId:%{public}s", strFormId.c_str());
|
formId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppExecFwk::FormProviderData formProviderData;
|
AppExecFwk::FormProviderData formProviderData;
|
||||||
|
@ -151,7 +151,13 @@ void ResourceConfigHelper::UpdateResConfig(std::unique_ptr<Global::Resource::Res
|
|||||||
TAG_LOGD(AAFwkTag::ABILITY, "set themeId: %{public}u", resConfig->GetThemeId());
|
TAG_LOGD(AAFwkTag::ABILITY, "set themeId: %{public}u", resConfig->GetThemeId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resConfig->SetThemeIcon(!themeIcon_.empty());
|
if (!themeIcon_.empty()) {
|
||||||
|
uint32_t themeIcon = 0;
|
||||||
|
if (ConvertStringToUint32(themeIcon_, themeIcon)) {
|
||||||
|
resConfig->SetThemeIcon(themeIcon);
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITY, "set themeIcon: %{public}u", themeIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResourceConfigHelper::ConvertStringToUint32(std::string source, uint32_t &result)
|
bool ResourceConfigHelper::ConvertStringToUint32(std::string source, uint32_t &result)
|
||||||
|
@ -387,6 +387,7 @@ bool UIAbilityThread::SchedulePrepareTerminateAbility()
|
|||||||
TAG_LOGI(AAFwkTag::UIABILITY, "ret: %{public}d", ret);
|
TAG_LOGI(AAFwkTag::UIABILITY, "ret: %{public}d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
isPrepareTerminateAbilityDone_.store(false);
|
||||||
wptr<UIAbilityThread> weak = this;
|
wptr<UIAbilityThread> weak = this;
|
||||||
auto task = [weak]() {
|
auto task = [weak]() {
|
||||||
TAG_LOGI(AAFwkTag::UIABILITY, "prepare terminate task");
|
TAG_LOGI(AAFwkTag::UIABILITY, "prepare terminate task");
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import("//build/config/components/ets_frontend/es2abc_config.gni")
|
import("//build/config/components/ets_frontend/es2abc_config.gni")
|
||||||
import("//commonlibrary/memory_utils/purgeable_mem_config.gni")
|
|
||||||
import("//build/ohos.gni")
|
import("//build/ohos.gni")
|
||||||
import("//build/templates/abc/ohos_abc.gni")
|
import("//build/templates/abc/ohos_abc.gni")
|
||||||
|
import("//commonlibrary/memory_utils/purgeable_mem_config.gni")
|
||||||
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
||||||
|
|
||||||
ohos_abc("delegator_mgmt") {
|
ohos_abc("delegator_mgmt") {
|
||||||
@ -187,9 +187,9 @@ ohos_shared_library("appkit_native") {
|
|||||||
"faultloggerd:libfaultloggerd",
|
"faultloggerd:libfaultloggerd",
|
||||||
"ffrt:libffrt",
|
"ffrt:libffrt",
|
||||||
"graphic_2d:2d_graphics",
|
"graphic_2d:2d_graphics",
|
||||||
|
"graphic_2d:EGL",
|
||||||
"graphic_2d:libcomposer",
|
"graphic_2d:libcomposer",
|
||||||
"graphic_2d:librender_service_base",
|
"graphic_2d:librender_service_base",
|
||||||
"graphic_2d:EGL",
|
|
||||||
"hicollie:libhicollie",
|
"hicollie:libhicollie",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
"hisysevent:libhisysevent",
|
"hisysevent:libhisysevent",
|
||||||
|
@ -955,6 +955,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr<Global::Resource::Res
|
|||||||
const std::string &name, const std::string &hapModuleName, std::string &loadPath,
|
const std::string &name, const std::string &hapModuleName, std::string &loadPath,
|
||||||
std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos)
|
std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(overlaySubscriberMutex_);
|
||||||
if (overlaySubscriber_ != nullptr) {
|
if (overlaySubscriber_ != nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -976,6 +977,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr<Global::Resource::Res
|
|||||||
|
|
||||||
void ContextImpl::UnsubscribeToOverlayEvents()
|
void ContextImpl::UnsubscribeToOverlayEvents()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(overlaySubscriberMutex_);
|
||||||
if (overlaySubscriber_ != nullptr) {
|
if (overlaySubscriber_ != nullptr) {
|
||||||
EventFwk::CommonEventManager::UnSubscribeCommonEvent(overlaySubscriber_);
|
EventFwk::CommonEventManager::UnSubscribeCommonEvent(overlaySubscriber_);
|
||||||
overlaySubscriber_ = nullptr;
|
overlaySubscriber_ = nullptr;
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
#include "locale_config.h"
|
#include "locale_config.h"
|
||||||
#include "ace_forward_compatibility.h"
|
#include "ace_forward_compatibility.h"
|
||||||
#include "form_constants.h"
|
#include "form_constants.h"
|
||||||
#include "include/private/EGL/cache.h"
|
#include "cache.h"
|
||||||
#ifdef SUPPORT_APP_PREFERRED_LANGUAGE
|
#ifdef SUPPORT_APP_PREFERRED_LANGUAGE
|
||||||
#include "preferred_language.h"
|
#include "preferred_language.h"
|
||||||
#endif
|
#endif
|
||||||
@ -191,6 +191,8 @@ void MainThread::GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &h
|
|||||||
libPath += (libPath.back() == '/') ? nativeLibraryPath : "/" + nativeLibraryPath;
|
libPath += (libPath.back() == '/') ? nativeLibraryPath : "/" + nativeLibraryPath;
|
||||||
TAG_LOGD(AAFwkTag::APPKIT, "lib path = %{private}s", libPath.c_str());
|
TAG_LOGD(AAFwkTag::APPKIT, "lib path = %{private}s", libPath.c_str());
|
||||||
appLibPaths["default"].emplace_back(libPath);
|
appLibPaths["default"].emplace_back(libPath);
|
||||||
|
} else {
|
||||||
|
TAG_LOGI(AAFwkTag::APPKIT, "nativeLibraryPath is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &hapInfo : bundleInfo.hapModuleInfos) {
|
for (auto &hapInfo : bundleInfo.hapModuleInfos) {
|
||||||
@ -2628,7 +2630,6 @@ void MainThread::ForceFullGC()
|
|||||||
|
|
||||||
void MainThread::Start()
|
void MainThread::Start()
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
|
||||||
TAG_LOGI(AAFwkTag::APPKIT, "App main thread create, pid:%{public}d", getprocpid());
|
TAG_LOGI(AAFwkTag::APPKIT, "App main thread create, pid:%{public}d", getprocpid());
|
||||||
|
|
||||||
std::shared_ptr<EventRunner> runner = EventRunner::GetMainEventRunner();
|
std::shared_ptr<EventRunner> runner = EventRunner::GetMainEventRunner();
|
||||||
|
@ -62,6 +62,7 @@ using SetRecordCallBack = void (*)(const std::function<void(void)> &startRecordF
|
|||||||
std::mutex g_debuggerMutex;
|
std::mutex g_debuggerMutex;
|
||||||
std::mutex g_loadsoMutex;
|
std::mutex g_loadsoMutex;
|
||||||
std::mutex ConnectServerManager::instanceMutex_;
|
std::mutex ConnectServerManager::instanceMutex_;
|
||||||
|
std::mutex ConnectServerManager::callbackMutex_;
|
||||||
std::unordered_map<int, std::pair<void*, const DebuggerPostTask>> g_debuggerInfo;
|
std::unordered_map<int, std::pair<void*, const DebuggerPostTask>> g_debuggerInfo;
|
||||||
|
|
||||||
ConnectServerManager::~ConnectServerManager()
|
ConnectServerManager::~ConnectServerManager()
|
||||||
@ -110,6 +111,13 @@ void ConnectServerManager::StartConnectServer(const std::string& bundleName, int
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startServerForSocketPair(socketFd);
|
startServerForSocketPair(socketFd);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(callbackMutex_);
|
||||||
|
for (const auto &callback : connectServerCallbacks_) {
|
||||||
|
if (callback != nullptr) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectServerManager::StopConnectServer(bool isCloseSo)
|
void ConnectServerManager::StopConnectServer(bool isCloseSo)
|
||||||
@ -444,4 +452,22 @@ void ConnectServerManager::SetRecordResults(const std::string &jsonArrayStr)
|
|||||||
}
|
}
|
||||||
sendLayoutMessage(jsonArrayStr);
|
sendLayoutMessage(jsonArrayStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectServerManager::RegistConnectServerCallback(const ServerConnectCallback &connectServerCallback)
|
||||||
|
{
|
||||||
|
if (connectServerCallback == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::JSRUNTIME, "null callback");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::lock_guard<std::mutex> lock(callbackMutex_);
|
||||||
|
for (const auto &callback : connectServerCallbacks_) {
|
||||||
|
if (callback == connectServerCallback) {
|
||||||
|
TAG_LOGE(AAFwkTag::JSRUNTIME, "callback exist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connectServerCallbacks_.emplace_back(connectServerCallback);
|
||||||
|
TAG_LOGD(AAFwkTag::JSRUNTIME, "regist succeed");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OHOS::AbilityRuntime
|
} // namespace OHOS::AbilityRuntime
|
@ -22,6 +22,7 @@
|
|||||||
using DebuggerPostTask = std::function<void(std::function<void()>&&)>;
|
using DebuggerPostTask = std::function<void(std::function<void()>&&)>;
|
||||||
using DebuggerInfo = std::unordered_map<int, std::pair<void*, const DebuggerPostTask>>;
|
using DebuggerInfo = std::unordered_map<int, std::pair<void*, const DebuggerPostTask>>;
|
||||||
using InstanceMap = std::unordered_map<int32_t, std::string>;
|
using InstanceMap = std::unordered_map<int32_t, std::string>;
|
||||||
|
using ServerConnectCallback = void(*)(void);
|
||||||
#ifdef APP_USE_ARM
|
#ifdef APP_USE_ARM
|
||||||
constexpr char ARK_DEBUGGER_LIB_PATH[] = "libark_inspector.z.so";
|
constexpr char ARK_DEBUGGER_LIB_PATH[] = "libark_inspector.z.so";
|
||||||
#elif defined(APP_USE_X86_64)
|
#elif defined(APP_USE_X86_64)
|
||||||
@ -58,6 +59,7 @@ public:
|
|||||||
bool SetRecordCallback(const std::function<void(void)> &startRecordFunc,
|
bool SetRecordCallback(const std::function<void(void)> &startRecordFunc,
|
||||||
const std::function<void(void)> &stopRecordFunc);
|
const std::function<void(void)> &stopRecordFunc);
|
||||||
void SetRecordResults(const std::string &jsonArrayStr);
|
void SetRecordResults(const std::string &jsonArrayStr);
|
||||||
|
void RegistConnectServerCallback(const ServerConnectCallback &connectServerCallback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConnectServerManager() = default;
|
ConnectServerManager() = default;
|
||||||
@ -68,11 +70,13 @@ private:
|
|||||||
|
|
||||||
std::mutex mutex_;
|
std::mutex mutex_;
|
||||||
static std::mutex instanceMutex_;
|
static std::mutex instanceMutex_;
|
||||||
|
static std::mutex callbackMutex_;
|
||||||
std::atomic<bool> isConnected_ = false;
|
std::atomic<bool> isConnected_ = false;
|
||||||
std::unordered_map<int32_t, std::pair<std::string, int32_t>> instanceMap_;
|
std::unordered_map<int32_t, std::pair<std::string, int32_t>> instanceMap_;
|
||||||
std::function<void(int32_t)> createLayoutInfo_;
|
std::function<void(int32_t)> createLayoutInfo_;
|
||||||
std::function<void(int32_t)> setStatus_;
|
std::function<void(int32_t)> setStatus_;
|
||||||
std::function<void(int32_t)> setArkUIStateProfilerStatus_;
|
std::function<void(int32_t)> setArkUIStateProfilerStatus_;
|
||||||
|
std::vector<ServerConnectCallback> connectServerCallbacks_;
|
||||||
ConnectServerManager(const ConnectServerManager&) = delete;
|
ConnectServerManager(const ConnectServerManager&) = delete;
|
||||||
ConnectServerManager(ConnectServerManager&&) = delete;
|
ConnectServerManager(ConnectServerManager&&) = delete;
|
||||||
ConnectServerManager& operator=(const ConnectServerManager&) = delete;
|
ConnectServerManager& operator=(const ConnectServerManager&) = delete;
|
||||||
|
@ -97,6 +97,7 @@ const std::string TARGET_OHM = "targetohm";
|
|||||||
const std::string SINCE_VERSION = "sinceVersion";
|
const std::string SINCE_VERSION = "sinceVersion";
|
||||||
|
|
||||||
constexpr char DEVELOPER_MODE_STATE[] = "const.security.developermode.state";
|
constexpr char DEVELOPER_MODE_STATE[] = "const.security.developermode.state";
|
||||||
|
const std::string MERGE_SOURCE_MAP_PATH = "ets/sourceMaps.map";
|
||||||
static auto PermissionCheckFunc = []() {
|
static auto PermissionCheckFunc = []() {
|
||||||
Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
|
Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
|
||||||
|
|
||||||
@ -732,8 +733,17 @@ bool JsRuntime::Initialize(const Options& options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!options.preload) {
|
if (!options.preload) {
|
||||||
|
std::string loadPath = ExtractorUtil::GetLoadFilePath(options.hapPath);
|
||||||
|
bool newCreate = false;
|
||||||
|
std::shared_ptr<Extractor> extractor = ExtractorUtil::GetExtractor(loadPath, newCreate);
|
||||||
|
bool hasFile = false;
|
||||||
|
if (!extractor) {
|
||||||
|
TAG_LOGD(AAFwkTag::JSRUNTIME, "Get extractor failed. hapPath[%{private}s]", loadPath.c_str());
|
||||||
|
} else {
|
||||||
|
hasFile = extractor->HasEntry(MERGE_SOURCE_MAP_PATH);
|
||||||
|
}
|
||||||
auto operatorObj = std::make_shared<JsEnv::SourceMapOperator>(options.bundleName, isModular,
|
auto operatorObj = std::make_shared<JsEnv::SourceMapOperator>(options.bundleName, isModular,
|
||||||
options.isDebugVersion);
|
hasFile);
|
||||||
InitSourceMap(operatorObj);
|
InitSourceMap(operatorObj);
|
||||||
|
|
||||||
if (options.isUnique) {
|
if (options.isUnique) {
|
||||||
@ -1294,11 +1304,16 @@ bool JsRuntime::PopPreloadObj(const std::string& key, std::unique_ptr<NativeRefe
|
|||||||
if (preloadList_.find(key) == preloadList_.end()) {
|
if (preloadList_.find(key) == preloadList_.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (preloadList_[key] != nullptr) {
|
||||||
obj = std::move(preloadList_[key]);
|
obj = std::move(preloadList_[key]);
|
||||||
preloadList_.erase(key);
|
preloadList_.erase(key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preloadList_.erase(key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NativeEngine& JsRuntime::GetNativeEngine() const
|
NativeEngine& JsRuntime::GetNativeEngine() const
|
||||||
{
|
{
|
||||||
return *GetNativeEnginePointer();
|
return *GetNativeEnginePointer();
|
||||||
|
@ -113,7 +113,7 @@ void OHOSJsEnvironmentImpl::InitTimerModule(NativeEngine* engine)
|
|||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "called");
|
TAG_LOGD(AAFwkTag::JSRUNTIME, "called");
|
||||||
CHECK_POINTER(engine);
|
CHECK_POINTER(engine);
|
||||||
auto ret = OHOS::JsSysModule::Timer::RegisterTime(reinterpret_cast<napi_env>(engine));
|
auto ret = JsSysModule::Timer::RegisterTime(reinterpret_cast<napi_env>(engine));
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "Register timer failed");
|
TAG_LOGE(AAFwkTag::JSRUNTIME, "Register timer failed");
|
||||||
}
|
}
|
||||||
|
@ -325,6 +325,7 @@ PROCESS_EXIT:
|
|||||||
EXIT_PID: {type: INT32, desc: pid}
|
EXIT_PID: {type: INT32, desc: pid}
|
||||||
PROCESS_NAME: {type: STRING, desc: process name}
|
PROCESS_NAME: {type: STRING, desc: process name}
|
||||||
EXTENSION_TYPE: {type: INT32, desc: process exit extension type}
|
EXTENSION_TYPE: {type: INT32, desc: process exit extension type}
|
||||||
|
EXIT_REASON: {type: INT32, desc: process exit reason}
|
||||||
|
|
||||||
PROCESS_START_FAILED:
|
PROCESS_START_FAILED:
|
||||||
__BASE: {type: FAULT, level: CRITICAL, tag: app, desc: process start failed, preserve: true}
|
__BASE: {type: FAULT, level: CRITICAL, tag: app, desc: process start failed, preserve: true}
|
||||||
|
@ -730,10 +730,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief mark a process which is going restart.
|
* @brief mark a process which is going restart.
|
||||||
* @param uid the uid of the process.
|
* @param uid the uid of the process.
|
||||||
|
* @param instanceKey the instance key of the process.
|
||||||
*
|
*
|
||||||
* @return Returns ERR_OK on success, others on failure.
|
* @return Returns ERR_OK on success, others on failure.
|
||||||
*/
|
*/
|
||||||
virtual int32_t SignRestartAppFlag(int32_t uid)
|
virtual int32_t SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -855,13 +856,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int32_t GetSupportedProcessCachePids(const std::string &bundleName, std::vector<int32_t> &pidList) = 0;
|
virtual int32_t GetSupportedProcessCachePids(const std::string &bundleName, std::vector<int32_t> &pidList) = 0;
|
||||||
|
|
||||||
/**
|
virtual int32_t KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
* Get appIndex of pid.
|
const std::string& reason)
|
||||||
* @param pid The pid.
|
|
||||||
* @param appIndex appIndex of pid.
|
|
||||||
* @return Returns ERR_OK on success, others on failure.
|
|
||||||
*/
|
|
||||||
virtual int32_t GetAppIndexByPid(pid_t pid, int32_t &appIndex)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ enum class AppMgrInterfaceCode {
|
|||||||
CHECK_IS_KIA_PROCESS = 91,
|
CHECK_IS_KIA_PROCESS = 91,
|
||||||
GET_All_RUNNING_INSTANCE_KEYS_BY_BUNDLENAME = 92,
|
GET_All_RUNNING_INSTANCE_KEYS_BY_BUNDLENAME = 92,
|
||||||
GET_All_RUNNING_INSTANCE_KEYS_BY_SELF = 93,
|
GET_All_RUNNING_INSTANCE_KEYS_BY_SELF = 93,
|
||||||
GET_APP_INDEX_BY_PID = 94,
|
KILL_APP_SELF_WITH_INSTANCE_KEY = 94,
|
||||||
};
|
};
|
||||||
} // AppExecFwk
|
} // AppExecFwk
|
||||||
} // OHOS
|
} // OHOS
|
||||||
|
@ -641,10 +641,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief mark a process which is going restart.
|
* @brief mark a process which is going restart.
|
||||||
* @param uid the uid of the process.
|
* @param uid the uid of the process.
|
||||||
|
* @param instanceKey the instance key of the process.
|
||||||
*
|
*
|
||||||
* @return Returns ERR_OK on success, others on failure.
|
* @return Returns ERR_OK on success, others on failure.
|
||||||
*/
|
*/
|
||||||
int32_t SignRestartAppFlag(int32_t uid) override;
|
int32_t SignRestartAppFlag(int32_t uid, const std::string &instanceKey) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get appRunningUniqueId by pid.
|
* Get appRunningUniqueId by pid.
|
||||||
@ -740,7 +741,8 @@ public:
|
|||||||
virtual int32_t GetSupportedProcessCachePids(const std::string &bundleName,
|
virtual int32_t GetSupportedProcessCachePids(const std::string &bundleName,
|
||||||
std::vector<int32_t> &pidList) override;
|
std::vector<int32_t> &pidList) override;
|
||||||
|
|
||||||
virtual int32_t GetAppIndexByPid(pid_t pid, int32_t &appIndex) override;
|
virtual int32_t KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
|
const std::string& reason) override;
|
||||||
private:
|
private:
|
||||||
bool SendTransactCmd(AppMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply);
|
bool SendTransactCmd(AppMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply);
|
||||||
bool WriteInterfaceToken(MessageParcel &data);
|
bool WriteInterfaceToken(MessageParcel &data);
|
||||||
|
@ -158,7 +158,7 @@ private:
|
|||||||
int32_t HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
int32_t HandleNotifyProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||||
int32_t HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
int32_t HandleKillProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||||
int32_t HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
int32_t HandleRestartResidentProcessDependedOnWeb(MessageParcel &data, MessageParcel &reply);
|
||||||
int32_t HandleGetAppIndexByPid(MessageParcel &data, MessageParcel &reply);
|
int32_t HandleKillAppSelfWithInstanceKey(MessageParcel &data, MessageParcel &reply);
|
||||||
int32_t OnRemoteRequestInner(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
int32_t OnRemoteRequestInner(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||||
int32_t OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data,
|
int32_t OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data,
|
||||||
MessageParcel &reply, MessageOption &option);
|
MessageParcel &reply, MessageOption &option);
|
||||||
|
@ -65,6 +65,8 @@ struct RunningProcessInfo : public Parcelable {
|
|||||||
bool isStrictMode = false;
|
bool isStrictMode = false;
|
||||||
std::int32_t bundleType = 0;
|
std::int32_t bundleType = 0;
|
||||||
std::int32_t appCloneIndex = -1;
|
std::int32_t appCloneIndex = -1;
|
||||||
|
std::string instanceKey = "";
|
||||||
|
AppExecFwk::MultiAppModeType appMode = AppExecFwk::MultiAppModeType::UNSPECIFIED;
|
||||||
|
|
||||||
bool ReadFromParcel(Parcel &parcel);
|
bool ReadFromParcel(Parcel &parcel);
|
||||||
virtual bool Marshalling(Parcel &parcel) const override;
|
virtual bool Marshalling(Parcel &parcel) const override;
|
||||||
|
@ -1750,7 +1750,7 @@ int32_t AppMgrProxy::UpdateRenderState(pid_t renderPid, int32_t state)
|
|||||||
return reply.ReadInt32();
|
return reply.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrProxy::SignRestartAppFlag(int32_t uid)
|
int32_t AppMgrProxy::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||||
MessageParcel data;
|
MessageParcel data;
|
||||||
@ -1761,6 +1761,7 @@ int32_t AppMgrProxy::SignRestartAppFlag(int32_t uid)
|
|||||||
return IPC_PROXY_ERR;
|
return IPC_PROXY_ERR;
|
||||||
}
|
}
|
||||||
PARCEL_UTIL_WRITE_RET_INT(data, Int32, uid);
|
PARCEL_UTIL_WRITE_RET_INT(data, Int32, uid);
|
||||||
|
PARCEL_UTIL_WRITE_RET_INT(data, String, instanceKey);
|
||||||
|
|
||||||
PARCEL_UTIL_SENDREQ_RET_INT(AppMgrInterfaceCode::SIGN_RESTART_APP_FLAG, data, reply, option);
|
PARCEL_UTIL_SENDREQ_RET_INT(AppMgrInterfaceCode::SIGN_RESTART_APP_FLAG, data, reply, option);
|
||||||
return reply.ReadInt32();
|
return reply.ReadInt32();
|
||||||
@ -2073,25 +2074,22 @@ int32_t AppMgrProxy::CheckIsKiaProcess(pid_t pid, bool &isKia)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrProxy::GetAppIndexByPid(pid_t pid, int32_t &appIndex)
|
int32_t AppMgrProxy::KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
|
const std::string& reason)
|
||||||
{
|
{
|
||||||
MessageParcel data;
|
MessageParcel data;
|
||||||
MessageParcel reply;
|
|
||||||
MessageOption option(MessageOption::TF_SYNC);
|
|
||||||
if (!WriteInterfaceToken(data)) {
|
if (!WriteInterfaceToken(data)) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed.");
|
TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed.");
|
||||||
return ERR_INVALID_VALUE;
|
return ERR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
PARCEL_UTIL_WRITE_RET_INT(data, Int32, pid);
|
PARCEL_UTIL_WRITE_RET_INT(data, String, instanceKey);
|
||||||
|
PARCEL_UTIL_WRITE_RET_INT(data, Bool, clearPageStack);
|
||||||
|
PARCEL_UTIL_WRITE_RET_INT(data, String, reason);
|
||||||
|
|
||||||
PARCEL_UTIL_SENDREQ_RET_INT(AppMgrInterfaceCode::GET_APP_INDEX_BY_PID, data, reply, option);
|
MessageParcel reply;
|
||||||
int32_t ret = reply.ReadInt32();
|
MessageOption option(MessageOption::TF_SYNC);
|
||||||
if (ret != ERR_OK) {
|
PARCEL_UTIL_SENDREQ_RET_INT(AppMgrInterfaceCode::KILL_APP_SELF_WITH_INSTANCE_KEY, data, reply, option);
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "failed,ret=%{public}d.", ret);
|
return reply.ReadInt32();
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
appIndex = reply.ReadInt32();
|
|
||||||
return ERR_OK;
|
|
||||||
}
|
}
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -345,8 +345,8 @@ int32_t AppMgrStub::OnRemoteRequestInnerSeventh(uint32_t code, MessageParcel &da
|
|||||||
return HandleRegisterKiaInterceptor(data, reply);
|
return HandleRegisterKiaInterceptor(data, reply);
|
||||||
case static_cast<uint32_t>(AppMgrInterfaceCode::CHECK_IS_KIA_PROCESS):
|
case static_cast<uint32_t>(AppMgrInterfaceCode::CHECK_IS_KIA_PROCESS):
|
||||||
return HandleCheckIsKiaProcess(data, reply);
|
return HandleCheckIsKiaProcess(data, reply);
|
||||||
case static_cast<uint32_t>(AppMgrInterfaceCode::GET_APP_INDEX_BY_PID):
|
case static_cast<uint32_t>(AppMgrInterfaceCode::KILL_APP_SELF_WITH_INSTANCE_KEY):
|
||||||
return HandleGetAppIndexByPid(data, reply);
|
return HandleKillAppSelfWithInstanceKey(data, reply);
|
||||||
}
|
}
|
||||||
return INVALID_FD;
|
return INVALID_FD;
|
||||||
}
|
}
|
||||||
@ -1468,7 +1468,8 @@ int32_t AppMgrStub::HandleSignRestartAppFlag(MessageParcel &data, MessageParcel
|
|||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||||
auto uid = data.ReadInt32();
|
auto uid = data.ReadInt32();
|
||||||
auto ret = SignRestartAppFlag(uid);
|
auto instanceKey = data.ReadString();
|
||||||
|
auto ret = SignRestartAppFlag(uid, instanceKey);
|
||||||
if (!reply.WriteInt32(ret)) {
|
if (!reply.WriteInt32(ret)) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "Write ret error.");
|
TAG_LOGE(AAFwkTag::APPMGR, "Write ret error.");
|
||||||
return IPC_STUB_ERR;
|
return IPC_STUB_ERR;
|
||||||
@ -1691,19 +1692,16 @@ int32_t AppMgrStub::HandleCheckIsKiaProcess(MessageParcel &data, MessageParcel &
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrStub::HandleGetAppIndexByPid(MessageParcel &data, MessageParcel &reply)
|
int32_t AppMgrStub::HandleKillAppSelfWithInstanceKey(MessageParcel &data, MessageParcel &reply)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "call");
|
TAG_LOGD(AAFwkTag::APPMGR, "call");
|
||||||
auto pid = data.ReadInt32();
|
auto instanceKey = data.ReadString();
|
||||||
int32_t appIndex = -1;
|
auto clearPageStack = data.ReadBool();
|
||||||
int32_t result = GetAppIndexByPid(pid, appIndex);
|
auto reason = data.ReadString();
|
||||||
|
auto result = KillAppSelfWithInstanceKey(instanceKey, clearPageStack, reason);
|
||||||
if (!reply.WriteInt32(result)) {
|
if (!reply.WriteInt32(result)) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "fail to write GetAppIndexByPid result.");
|
TAG_LOGE(AAFwkTag::APPMGR, "fail to write result.");
|
||||||
return IPC_STUB_ERR;
|
return ERR_INVALID_VALUE;
|
||||||
}
|
|
||||||
if (!reply.WriteInt32(appIndex)) {
|
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "fail to write appIndex.");
|
|
||||||
return IPC_STUB_ERR;
|
|
||||||
}
|
}
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,10 @@ bool RunningProcessInfo::ReadFromParcel(Parcel &parcel)
|
|||||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, extensionType);
|
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, extensionType);
|
||||||
extensionType_ = static_cast<ExtensionAbilityType>(extensionType);
|
extensionType_ = static_cast<ExtensionAbilityType>(extensionType);
|
||||||
appCloneIndex = parcel.ReadInt32();
|
appCloneIndex = parcel.ReadInt32();
|
||||||
|
instanceKey = Str16ToStr8(parcel.ReadString16());
|
||||||
|
int32_t appModeType;
|
||||||
|
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, appModeType);
|
||||||
|
appMode = static_cast<AppExecFwk::MultiAppModeType>(appModeType);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +99,8 @@ bool RunningProcessInfo::Marshalling(Parcel &parcel) const
|
|||||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(processType_));
|
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(processType_));
|
||||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(extensionType_));
|
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(extensionType_));
|
||||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, appCloneIndex);
|
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, appCloneIndex);
|
||||||
|
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(instanceKey));
|
||||||
|
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int32_t>(appMode));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import("//build/config/components/idl_tool/idl.gni")
|
||||||
import("//build/ohos.gni")
|
import("//build/ohos.gni")
|
||||||
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
||||||
import("//build/config/components/idl_tool/idl.gni")
|
|
||||||
|
|
||||||
idl_interface_sources = [
|
idl_interface_sources = [
|
||||||
"${target_gen_dir}/quick_fix_manager_proxy.cpp",
|
"${target_gen_dir}/quick_fix_manager_proxy.cpp",
|
||||||
|
@ -104,8 +104,8 @@ ohos_shared_library("runtime") {
|
|||||||
"config_policy:configpolicy_util",
|
"config_policy:configpolicy_util",
|
||||||
"ets_runtime:libark_jsruntime",
|
"ets_runtime:libark_jsruntime",
|
||||||
"ets_utils:console",
|
"ets_utils:console",
|
||||||
"ets_utils:worker",
|
|
||||||
"ets_utils:timer",
|
"ets_utils:timer",
|
||||||
|
"ets_utils:worker",
|
||||||
"eventhandler:libeventhandler",
|
"eventhandler:libeventhandler",
|
||||||
"ffrt:libffrt",
|
"ffrt:libffrt",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
@ -116,7 +116,6 @@ ohos_shared_library("runtime") {
|
|||||||
"jsoncpp:jsoncpp",
|
"jsoncpp:jsoncpp",
|
||||||
"napi:ace_napi",
|
"napi:ace_napi",
|
||||||
"resource_management:global_resmgr",
|
"resource_management:global_resmgr",
|
||||||
"runtime_core:libarkbase_static",
|
|
||||||
"samgr:samgr_proxy",
|
"samgr:samgr_proxy",
|
||||||
"zlib:shared_libz",
|
"zlib:shared_libz",
|
||||||
]
|
]
|
||||||
@ -124,7 +123,6 @@ ohos_shared_library("runtime") {
|
|||||||
public_external_deps = [
|
public_external_deps = [
|
||||||
"ability_base:session_info",
|
"ability_base:session_info",
|
||||||
"ability_base:want",
|
"ability_base:want",
|
||||||
"ets_utils:console",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
|
@ -495,6 +495,7 @@ private:
|
|||||||
// False: no need to get a new fms remote object.
|
// False: no need to get a new fms remote object.
|
||||||
volatile bool resetFlag_ = false;
|
volatile bool resetFlag_ = false;
|
||||||
|
|
||||||
|
std::mutex overlaySubscriberMutex_;
|
||||||
std::shared_ptr<AppExecFwk::OverlayEventSubscriber> overlaySubscriber_;
|
std::shared_ptr<AppExecFwk::OverlayEventSubscriber> overlaySubscriber_;
|
||||||
};
|
};
|
||||||
} // namespace AbilityRuntime
|
} // namespace AbilityRuntime
|
||||||
|
@ -29,8 +29,8 @@ enum InitStatus { NOT_EXECUTED, EXECUTED_SUCCESSFULLY };
|
|||||||
}
|
}
|
||||||
class SourceMapOperator : public std::enable_shared_from_this<SourceMapOperator> {
|
class SourceMapOperator : public std::enable_shared_from_this<SourceMapOperator> {
|
||||||
public:
|
public:
|
||||||
SourceMapOperator(const std::string bundleName, bool isModular, bool isDebugVersion)
|
SourceMapOperator(const std::string bundleName, bool isModular, bool hasFile)
|
||||||
: bundleName_(bundleName), isModular_(isModular), isDebugVersion_(isDebugVersion), initStatus_(NOT_EXECUTED) {}
|
: bundleName_(bundleName), isModular_(isModular), hasFile_(hasFile), initStatus_(NOT_EXECUTED) {}
|
||||||
|
|
||||||
~SourceMapOperator() = default;
|
~SourceMapOperator() = default;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public:
|
|||||||
if (sourceMapObj_ == nullptr) {
|
if (sourceMapObj_ == nullptr) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (isDebugVersion_) {
|
if (hasFile_) {
|
||||||
return sourceMapObj_->TranslateBySourceMap(stackStr);
|
return sourceMapObj_->TranslateBySourceMap(stackStr);
|
||||||
} else {
|
} else {
|
||||||
return NOT_FOUNDMAP + stackStr;
|
return NOT_FOUNDMAP + stackStr;
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
const std::string bundleName_;
|
const std::string bundleName_;
|
||||||
bool isModular_ = false;
|
bool isModular_ = false;
|
||||||
bool isDebugVersion_ = false;
|
bool hasFile_ = false;
|
||||||
std::shared_ptr<SourceMap> sourceMapObj_;
|
std::shared_ptr<SourceMap> sourceMapObj_;
|
||||||
InitStatus initStatus_;
|
InitStatus initStatus_;
|
||||||
};
|
};
|
||||||
|
@ -66,6 +66,7 @@ abilityms_files = [
|
|||||||
"src/interceptor/screen_unlock_interceptor.cpp",
|
"src/interceptor/screen_unlock_interceptor.cpp",
|
||||||
"src/interceptor/start_other_app_interceptor.cpp",
|
"src/interceptor/start_other_app_interceptor.cpp",
|
||||||
"src/window_focus_changed_listener.cpp",
|
"src/window_focus_changed_listener.cpp",
|
||||||
|
"src/window_visibility_changed_listener.cpp",
|
||||||
|
|
||||||
# start ability handler
|
# start ability handler
|
||||||
"src/start_ability_handler.cpp",
|
"src/start_ability_handler.cpp",
|
||||||
|
@ -102,8 +102,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Sign the restart flag by uid of ability from ability cache manager.
|
* Sign the restart flag by uid of ability from ability cache manager.
|
||||||
* @param uid the ability uid to be searched in cache manager.
|
* @param uid the ability uid to be searched in cache manager.
|
||||||
|
* @param instanceKey the instance key of the process.
|
||||||
*/
|
*/
|
||||||
void SignRestartAppFlag(int32_t uid);
|
void SignRestartAppFlag(int32_t uid, const std::string &instanceKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the invalid ability by bundleName from ability cache manager.
|
* Delete the invalid ability by bundleName from ability cache manager.
|
||||||
|
@ -325,7 +325,7 @@ public:
|
|||||||
|
|
||||||
void CloseAssertDialog(const std::string &assertSessionId);
|
void CloseAssertDialog(const std::string &assertSessionId);
|
||||||
|
|
||||||
void SignRestartAppFlag(int32_t uid);
|
void SignRestartAppFlag(int32_t uid, const std::string &instanceKey);
|
||||||
|
|
||||||
std::shared_ptr<AAFwk::AbilityRecord> GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token);
|
std::shared_ptr<AAFwk::AbilityRecord> GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token);
|
||||||
void UninstallApp(const std::string &bundleName);
|
void UninstallApp(const std::string &bundleName);
|
||||||
|
@ -75,6 +75,7 @@ class IStatusBarDelegate;
|
|||||||
}
|
}
|
||||||
namespace Rosen {
|
namespace Rosen {
|
||||||
class FocusChangeInfo;
|
class FocusChangeInfo;
|
||||||
|
class WindowVisibilityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace AAFwk {
|
namespace AAFwk {
|
||||||
@ -87,6 +88,7 @@ constexpr const char* KEY_SESSION_ID = "com.ohos.param.sessionId";
|
|||||||
using OHOS::AppExecFwk::IAbilityController;
|
using OHOS::AppExecFwk::IAbilityController;
|
||||||
struct StartAbilityInfo;
|
struct StartAbilityInfo;
|
||||||
class WindowFocusChangedListener;
|
class WindowFocusChangedListener;
|
||||||
|
class WindowVisibilityChangedListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class AbilityManagerService
|
* @class AbilityManagerService
|
||||||
@ -1197,6 +1199,9 @@ public:
|
|||||||
|
|
||||||
void HandleUnfocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);
|
void HandleUnfocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);
|
||||||
|
|
||||||
|
void HandleWindowVisibilityChanged(
|
||||||
|
const std::vector<sptr<OHOS::Rosen::WindowVisibilityInfo>> &windowVisibilityInfos);
|
||||||
|
|
||||||
virtual int GetDialogSessionInfo(const std::string &dialogSessionId,
|
virtual int GetDialogSessionInfo(const std::string &dialogSessionId,
|
||||||
sptr<DialogSessionInfo> &dialogSessionInfo) override;
|
sptr<DialogSessionInfo> &dialogSessionInfo) override;
|
||||||
|
|
||||||
@ -1921,6 +1926,9 @@ private:
|
|||||||
int StartAbilityPublicPrechainCheck(StartAbilityParams ¶ms);
|
int StartAbilityPublicPrechainCheck(StartAbilityParams ¶ms);
|
||||||
int StartAbilityPrechainInterceptor(StartAbilityParams ¶ms);
|
int StartAbilityPrechainInterceptor(StartAbilityParams ¶ms);
|
||||||
bool StartAbilityInChain(StartAbilityParams ¶ms, int &result);
|
bool StartAbilityInChain(StartAbilityParams ¶ms, int &result);
|
||||||
|
void InitWindowVisibilityChangedListener();
|
||||||
|
void FreeWindowVisibilityChangedListener();
|
||||||
|
bool CheckProcessIsBackground(int32_t pid, AbilityState currentState);
|
||||||
|
|
||||||
bool CheckIfOperateRemote(const Want &want);
|
bool CheckIfOperateRemote(const Want &want);
|
||||||
std::string AnonymizeDeviceId(const std::string& deviceId);
|
std::string AnonymizeDeviceId(const std::string& deviceId);
|
||||||
@ -2255,8 +2263,9 @@ private:
|
|||||||
|
|
||||||
void WaitBootAnimationStart();
|
void WaitBootAnimationStart();
|
||||||
|
|
||||||
int32_t SignRestartAppFlag(int32_t userId, int32_t uid, bool isAppRecovery = false);
|
int32_t SignRestartAppFlag(int32_t userId, int32_t uid, const std::string &instanceKey,
|
||||||
int32_t CheckRestartAppWant(const AAFwk::Want &want, int32_t appIndex);
|
AppExecFwk::MultiAppModeType type, bool isAppRecovery = false);
|
||||||
|
int32_t CheckRestartAppWant(const AAFwk::Want &want, int32_t appIndex, int32_t userId);
|
||||||
|
|
||||||
int StartUIAbilityForOptionWrap(const Want &want, const StartOptions &options, sptr<IRemoteObject> callerToken,
|
int StartUIAbilityForOptionWrap(const Want &want, const StartOptions &options, sptr<IRemoteObject> callerToken,
|
||||||
bool isPendingWantCaller, int32_t userId, int requestCode, uint32_t callerTokenId = 0, bool isImplicit = false,
|
bool isPendingWantCaller, int32_t userId, int requestCode, uint32_t callerTokenId = 0, bool isImplicit = false,
|
||||||
@ -2323,6 +2332,7 @@ private:
|
|||||||
|
|
||||||
bool CheckWorkSchedulerPermission(const sptr<IRemoteObject> &callerToken, const uint32_t uid);
|
bool CheckWorkSchedulerPermission(const sptr<IRemoteObject> &callerToken, const uint32_t uid);
|
||||||
|
|
||||||
|
sptr<WindowVisibilityChangedListener> windowVisibilityChangedListener_;
|
||||||
std::shared_ptr<TaskHandlerWrap> taskHandler_;
|
std::shared_ptr<TaskHandlerWrap> taskHandler_;
|
||||||
std::shared_ptr<AbilityEventHandler> eventHandler_;
|
std::shared_ptr<AbilityEventHandler> eventHandler_;
|
||||||
ServiceRunningState state_;
|
ServiceRunningState state_;
|
||||||
@ -2334,10 +2344,13 @@ private:
|
|||||||
std::shared_ptr<UserController> userController_;
|
std::shared_ptr<UserController> userController_;
|
||||||
sptr<AppExecFwk::IAbilityController> abilityController_ = nullptr;
|
sptr<AppExecFwk::IAbilityController> abilityController_ = nullptr;
|
||||||
bool controllerIsAStabilityTest_ = false;
|
bool controllerIsAStabilityTest_ = false;
|
||||||
|
std::unordered_set<int32_t> windowVisibleList_;
|
||||||
|
|
||||||
ffrt::mutex globalLock_;
|
ffrt::mutex globalLock_;
|
||||||
ffrt::mutex bgtaskObserverMutex_;
|
ffrt::mutex bgtaskObserverMutex_;
|
||||||
ffrt::mutex abilityTokenLock_;
|
ffrt::mutex abilityTokenLock_;
|
||||||
ffrt::mutex preStartSessionMapLock_;
|
ffrt::mutex preStartSessionMapLock_;
|
||||||
|
ffrt::mutex windowVisibleListLock_;
|
||||||
|
|
||||||
std::multimap<std::string, std::string> timeoutMap_;
|
std::multimap<std::string, std::string> timeoutMap_;
|
||||||
std::map<std::string, sptr<SessionInfo>> preStartSessionMap_;
|
std::map<std::string, sptr<SessionInfo>> preStartSessionMap_;
|
||||||
|
@ -277,6 +277,7 @@ struct AbilityRequest {
|
|||||||
bool uriReservedFlag = false;
|
bool uriReservedFlag = false;
|
||||||
std::string reservedBundleName;
|
std::string reservedBundleName;
|
||||||
bool isFromIcon = false;
|
bool isFromIcon = false;
|
||||||
|
bool isShellCall = false;
|
||||||
std::pair<bool, LaunchReason> IsContinuation() const
|
std::pair<bool, LaunchReason> IsContinuation() const
|
||||||
{
|
{
|
||||||
auto flags = want.GetFlags();
|
auto flags = want.GetFlags();
|
||||||
@ -400,7 +401,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return Returns ERR_OK on success, others on failure.
|
* @return Returns ERR_OK on success, others on failure.
|
||||||
*/
|
*/
|
||||||
int LoadAbility();
|
int LoadAbility(bool isShellCall = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* foreground the ability.
|
* foreground the ability.
|
||||||
@ -413,7 +414,7 @@ public:
|
|||||||
* process request of foregrounding the ability.
|
* process request of foregrounding the ability.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void ProcessForegroundAbility(uint32_t tokenId, uint32_t sceneFlag = 0);
|
void ProcessForegroundAbility(uint32_t tokenId, uint32_t sceneFlag = 0, bool isShellCall = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* post foreground timeout task for ui ability.
|
* post foreground timeout task for ui ability.
|
||||||
|
@ -40,6 +40,9 @@ namespace OHOS {
|
|||||||
namespace AppExecFwk {
|
namespace AppExecFwk {
|
||||||
class Configuration;
|
class Configuration;
|
||||||
}
|
}
|
||||||
|
namespace AbilityRuntime {
|
||||||
|
struct LoadParam;
|
||||||
|
}
|
||||||
namespace AAFwk {
|
namespace AAFwk {
|
||||||
/**
|
/**
|
||||||
* @enum AppAbilityState
|
* @enum AppAbilityState
|
||||||
@ -139,16 +142,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* load ability with token, ability info and application info.
|
* load ability with token, ability info and application info.
|
||||||
*
|
*
|
||||||
* @param token, the token of ability.
|
* @param loadParam, the loadParam of ability.
|
||||||
* @param preToken, the token of ability's caller.
|
|
||||||
* @param abilityInfo, ability info.
|
* @param abilityInfo, ability info.
|
||||||
* @param applicationInfo, application info.
|
* @param applicationInfo, application info.
|
||||||
* @param want ability want
|
* @param want ability want
|
||||||
* @return true on success ,false on failure.
|
* @return true on success ,false on failure.
|
||||||
*/
|
*/
|
||||||
int LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
|
int LoadAbility(const AbilityRuntime::LoadParam &loadParam, const AppExecFwk::AbilityInfo &abilityInfo,
|
||||||
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo,
|
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want);
|
||||||
const Want &want, int32_t abilityRecordId, const std::string &instanceKey);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* terminate ability with token.
|
* terminate ability with token.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "ability_interceptor_interface.h"
|
#include "ability_interceptor_interface.h"
|
||||||
|
|
||||||
|
#include "ability_record.h"
|
||||||
#include "app_mgr_interface.h"
|
#include "app_mgr_interface.h"
|
||||||
#include "disposed_observer.h"
|
#include "disposed_observer.h"
|
||||||
#include "task_utils_wrap.h"
|
#include "task_utils_wrap.h"
|
||||||
|
@ -222,7 +222,7 @@ public:
|
|||||||
int32_t GetMissionCount() const;
|
int32_t GetMissionCount() const;
|
||||||
void GetActiveAbilityList(int32_t uid, std::vector<std::string> &abilityList, int32_t pid = NO_PID);
|
void GetActiveAbilityList(int32_t uid, std::vector<std::string> &abilityList, int32_t pid = NO_PID);
|
||||||
|
|
||||||
void SignRestartAppFlag(int32_t uid);
|
void SignRestartAppFlag(int32_t uid, const std::string &instanceKey);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string GetTypeName();
|
std::string GetTypeName();
|
||||||
|
@ -365,7 +365,7 @@ public:
|
|||||||
|
|
||||||
bool IsAbilityStarted(AbilityRequest &abilityRequest, std::shared_ptr<AbilityRecord> &targetRecord) override;
|
bool IsAbilityStarted(AbilityRequest &abilityRequest, std::shared_ptr<AbilityRecord> &targetRecord) override;
|
||||||
|
|
||||||
void SignRestartAppFlag(int32_t uid) override;
|
void SignRestartAppFlag(int32_t uid, const std::string &instanceKey) override;
|
||||||
|
|
||||||
void SetAnimationFlag(bool IsAnimationEnabled);
|
void SetAnimationFlag(bool IsAnimationEnabled);
|
||||||
#ifdef SUPPORT_SCREEN
|
#ifdef SUPPORT_SCREEN
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
const AAFwk::ContinueState &state) = 0;
|
const AAFwk::ContinueState &state) = 0;
|
||||||
|
|
||||||
virtual bool IsAbilityStarted(AbilityRequest &abilityRequest, std::shared_ptr<AbilityRecord> &targetRecord) = 0;
|
virtual bool IsAbilityStarted(AbilityRequest &abilityRequest, std::shared_ptr<AbilityRecord> &targetRecord) = 0;
|
||||||
virtual void SignRestartAppFlag(int32_t uid) = 0;
|
virtual void SignRestartAppFlag(int32_t uid, const std::string &instanceKey) = 0;
|
||||||
#ifdef SUPPORT_SCREEN
|
#ifdef SUPPORT_SCREEN
|
||||||
public:
|
public:
|
||||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0;
|
virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0;
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
int32_t GetUserId();
|
int32_t GetUserId();
|
||||||
bool IsEqualsRequestWant(const Want &otherWant);
|
bool IsEqualsRequestWant(const Want &otherWant);
|
||||||
int32_t GetAppIndex();
|
int32_t GetAppIndex();
|
||||||
|
void GetAllBundleNames(std::vector<std::string> &bundleNames);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t type_ = {};
|
int32_t type_ = {};
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "pending_want_record.h"
|
#include "pending_want_record.h"
|
||||||
#include "pending_want_common_event.h"
|
#include "pending_want_common_event.h"
|
||||||
#include "sender_info.h"
|
#include "sender_info.h"
|
||||||
|
#include "task_handler_wrap.h"
|
||||||
#include "want_sender_info.h"
|
#include "want_sender_info.h"
|
||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
@ -184,17 +185,10 @@ private:
|
|||||||
|
|
||||||
bool CheckWindowState(int32_t pid);
|
bool CheckWindowState(int32_t pid);
|
||||||
|
|
||||||
void EraseBundleRecord(const std::vector<WantsInfo> &wantsInfos, std::shared_ptr<PendingWantKey> key);
|
|
||||||
|
|
||||||
void InsertBundleRecord(const std::vector<WantsInfo> &wantsInfos, std::shared_ptr<PendingWantKey> key);
|
|
||||||
|
|
||||||
bool QueryRecordByBundle(const std::string &bundleName);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::shared_ptr<TaskHandlerWrap> taskHandler_;
|
||||||
std::map<std::shared_ptr<PendingWantKey>, sptr<PendingWantRecord>> wantRecords_;
|
std::map<std::shared_ptr<PendingWantKey>, sptr<PendingWantRecord>> wantRecords_;
|
||||||
std::map<std::string, std::vector<std::shared_ptr<PendingWantKey>>> bundleRecords_;
|
|
||||||
ffrt::mutex mutex_;
|
ffrt::mutex mutex_;
|
||||||
ffrt::mutex bundleRecordsMutex_;
|
|
||||||
};
|
};
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -24,25 +24,47 @@
|
|||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
namespace AAFwk {
|
namespace AAFwk {
|
||||||
|
typedef struct RestartAppKey {
|
||||||
|
int32_t uid = 0;
|
||||||
|
std::string instanceKey = "";
|
||||||
|
|
||||||
|
RestartAppKey(std::string callingInstanceKey, int32_t callingUid)
|
||||||
|
{
|
||||||
|
instanceKey = callingInstanceKey;
|
||||||
|
uid = callingUid;
|
||||||
|
}
|
||||||
|
bool operator ==(const struct RestartAppKey &other) const
|
||||||
|
{
|
||||||
|
return instanceKey == other.instanceKey && uid == other.uid;
|
||||||
|
}
|
||||||
|
} RestartAppKeyType;
|
||||||
|
|
||||||
|
struct RestartAppKeyHash {
|
||||||
|
size_t operator()(const RestartAppKeyType &p) const
|
||||||
|
{
|
||||||
|
return std::hash<std::string>()(p.instanceKey) ^ std::hash<int>()(p.uid);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class RestartAppManager
|
* @class RestartAppManager
|
||||||
* RestartAppManager provides a facility for managing restart app history.
|
* RestartAppManager provides a facility for managing restart app history.
|
||||||
*/
|
*/
|
||||||
class RestartAppManager {
|
class RestartAppManager {
|
||||||
public:
|
public:
|
||||||
|
using RestartAppMapType = std::unordered_map<RestartAppKeyType, time_t, RestartAppKeyHash>;
|
||||||
virtual ~RestartAppManager() = default;
|
virtual ~RestartAppManager() = default;
|
||||||
static RestartAppManager &GetInstance();
|
static RestartAppManager &GetInstance();
|
||||||
|
|
||||||
bool IsRestartAppFrequent(int32_t uid, time_t time);
|
bool IsRestartAppFrequent(const RestartAppKeyType &key, time_t time);
|
||||||
void AddRestartAppHistory(int32_t uid, time_t time);
|
void AddRestartAppHistory(const RestartAppKeyType &key, time_t time);
|
||||||
bool IsForegroundToRestartApp() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RestartAppManager() = default;
|
RestartAppManager() = default;
|
||||||
DISALLOW_COPY_AND_MOVE(RestartAppManager);
|
DISALLOW_COPY_AND_MOVE(RestartAppManager);
|
||||||
|
|
||||||
ffrt::mutex restartAppMapLock_;
|
ffrt::mutex restartAppMapLock_;
|
||||||
std::unordered_map<int32_t, time_t> restartAppHistory_; // RestartAppKey:time
|
RestartAppMapType restartAppHistory_; // RestartAppKey:time
|
||||||
};
|
};
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void SignRestartAppFlag(int32_t uid, bool isAppRecovery = false);
|
void SignRestartAppFlag(int32_t uid, const std::string &instanceKey, bool isAppRecovery = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StartUIAbility with request.
|
* StartUIAbility with request.
|
||||||
@ -162,7 +162,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession);
|
void SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession);
|
||||||
|
|
||||||
int NotifySCBToStartUIAbility(const AbilityRequest &abilityRequest);
|
int NotifySCBToStartUIAbility(AbilityRequest &abilityRequest);
|
||||||
void CancelSameAbilityTimeoutTask(const AppExecFwk::AbilityInfo &abilityInfo);
|
void CancelSameAbilityTimeoutTask(const AppExecFwk::AbilityInfo &abilityInfo);
|
||||||
|
|
||||||
int NotifySCBToPreStartUIAbility(const AbilityRequest &abilityRequest,
|
int NotifySCBToPreStartUIAbility(const AbilityRequest &abilityRequest,
|
||||||
|
@ -85,6 +85,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
int32_t CheckMultiInstanceKeyForExtension(const AbilityRequest &abilityRequest);
|
int32_t CheckMultiInstanceKeyForExtension(const AbilityRequest &abilityRequest);
|
||||||
|
|
||||||
|
bool VerifyCallerToken(AbilityRequest &abilityRequest);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* AbilityPermissionUtil, the private constructor.
|
* AbilityPermissionUtil, the private constructor.
|
||||||
|
@ -54,14 +54,6 @@ public:
|
|||||||
* @return Flag if the want contains atomic service url.
|
* @return Flag if the want contains atomic service url.
|
||||||
*/
|
*/
|
||||||
static bool IsAtomicServiceUrl(const Want& want);
|
static bool IsAtomicServiceUrl(const Want& want);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get app index.
|
|
||||||
*
|
|
||||||
* @param want The want.
|
|
||||||
* @return AppIndex if the want contains app index.
|
|
||||||
*/
|
|
||||||
static int32_t GetAppIndex(const Want& want);
|
|
||||||
};
|
};
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OHOS_ABILITY_MANAGER_WINDOW_VISIBILITY_CHANGE_LISTENER_H
|
||||||
|
#define OHOS_ABILITY_MANAGER_WINDOW_VISIBILITY_CHANGE_LISTENER_H
|
||||||
|
|
||||||
|
#include "task_handler_wrap.h"
|
||||||
|
#include "window_manager.h"
|
||||||
|
|
||||||
|
namespace OHOS {
|
||||||
|
namespace AAFwk {
|
||||||
|
class AbilityManagerService;
|
||||||
|
|
||||||
|
class WindowVisibilityChangedListener : public OHOS::Rosen::IVisibilityChangedListener {
|
||||||
|
public:
|
||||||
|
WindowVisibilityChangedListener(
|
||||||
|
const std::weak_ptr<AbilityManagerService> &owner, const std::shared_ptr<AAFwk::TaskHandlerWrap> &handler);
|
||||||
|
virtual ~WindowVisibilityChangedListener() = default;
|
||||||
|
|
||||||
|
void OnWindowVisibilityChanged(
|
||||||
|
const std::vector<sptr<OHOS::Rosen::WindowVisibilityInfo>> &windowVisibilityInfos) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::weak_ptr<AbilityManagerService> owner_;
|
||||||
|
std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_;
|
||||||
|
};
|
||||||
|
} // namespace AAFwk
|
||||||
|
} // namespace OHOS
|
||||||
|
#endif // OHOS_ABILITY_MANAGER_WINDOW_VISIBILITY_CHANGE_LISTENER_H
|
@ -284,13 +284,14 @@ void AbilityCacheManager::RemoveLauncherDeathRecipient()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbilityCacheManager::SignRestartAppFlag(int32_t uid)
|
void AbilityCacheManager::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
auto it = devRecLru_.begin();
|
auto it = devRecLru_.begin();
|
||||||
while (it != devRecLru_.end()) {
|
while (it != devRecLru_.end()) {
|
||||||
auto abilityRecord = *it;
|
auto abilityRecord = *it;
|
||||||
if (abilityRecord != nullptr && abilityRecord->GetUid() == uid) {
|
if (abilityRecord != nullptr && abilityRecord->GetUid() == uid &&
|
||||||
|
abilityRecord->GetInstanceKey() == instanceKey) {
|
||||||
abilityRecord->SetRestartAppFlag(true);
|
abilityRecord->SetRestartAppFlag(true);
|
||||||
}
|
}
|
||||||
it++;
|
it++;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "hitrace_meter.h"
|
#include "hitrace_meter.h"
|
||||||
#include "int_wrapper.h"
|
#include "int_wrapper.h"
|
||||||
#include "multi_instance_utils.h"
|
#include "multi_instance_utils.h"
|
||||||
|
#include "param.h"
|
||||||
#include "res_sched_util.h"
|
#include "res_sched_util.h"
|
||||||
#include "session/host/include/zidl/session_interface.h"
|
#include "session/host/include/zidl/session_interface.h"
|
||||||
#include "startup_util.h"
|
#include "startup_util.h"
|
||||||
@ -1030,7 +1031,7 @@ int AbilityConnectManager::ScheduleConnectAbilityDoneLocked(
|
|||||||
}
|
}
|
||||||
CompleteStartServiceReq(abilityRecord->GetURI());
|
CompleteStartServiceReq(abilityRecord->GetURI());
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::CONNECT_END, abilityRecord->GetPid(),
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::CONNECT_END, abilityRecord->GetPid(),
|
||||||
abilityRecord->GetUid());
|
abilityRecord->GetUid(), 0, abilityRecord->GetAbilityRecordId());
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1433,9 +1434,14 @@ void AbilityConnectManager::LoadAbility(const std::shared_ptr<AbilityRecord> &ab
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateUIExtensionInfo(abilityRecord);
|
UpdateUIExtensionInfo(abilityRecord);
|
||||||
|
AbilityRuntime::LoadParam loadParam;
|
||||||
|
loadParam.abilityRecordId = abilityRecord->GetRecordId();
|
||||||
|
loadParam.isShellCall = AAFwk::PermissionVerification::GetInstance()->IsShellCall();
|
||||||
|
loadParam.token = token;
|
||||||
|
loadParam.preToken = perToken;
|
||||||
|
loadParam.instanceKey = abilityRecord->GetInstanceKey();
|
||||||
DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
|
DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
|
||||||
token, perToken, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo(),
|
loadParam, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo(), abilityRecord->GetWant());
|
||||||
abilityRecord->GetWant(), abilityRecord->GetRecordId(), abilityRecord->GetInstanceKey());
|
|
||||||
abilityRecord->SetLoadState(AbilityLoadState::LOADING);
|
abilityRecord->SetLoadState(AbilityLoadState::LOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,7 +1512,7 @@ void AbilityConnectManager::PostTimeOutTask(const std::shared_ptr<AbilityRecord>
|
|||||||
taskName = std::string("ConnectTimeout_") + std::to_string(connectRecordId);
|
taskName = std::string("ConnectTimeout_") + std::to_string(connectRecordId);
|
||||||
delayTime = AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() * CONNECT_TIMEOUT_MULTIPLE;
|
delayTime = AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() * CONNECT_TIMEOUT_MULTIPLE;
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::CONNECT_BEGIN, abilityRecord->GetPid(),
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::CONNECT_BEGIN, abilityRecord->GetPid(),
|
||||||
abilityRecord->GetUid(), delayTime);
|
abilityRecord->GetUid(), delayTime, abilityRecord->GetAbilityRecordId());
|
||||||
} else {
|
} else {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "messageId error");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "messageId error");
|
||||||
return;
|
return;
|
||||||
@ -1668,6 +1674,11 @@ int AbilityConnectManager::DispatchInactive(const std::shared_ptr<AbilityRecord>
|
|||||||
}
|
}
|
||||||
eventHandler_->RemoveEvent(AbilityManagerService::INACTIVE_TIMEOUT_MSG, abilityRecord->GetAbilityRecordId());
|
eventHandler_->RemoveEvent(AbilityManagerService::INACTIVE_TIMEOUT_MSG, abilityRecord->GetAbilityRecordId());
|
||||||
|
|
||||||
|
if (abilityRecord->GetAbilityInfo().extensionAbilityType == AppExecFwk::ExtensionAbilityType::SERVICE) {
|
||||||
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::LOAD_END,
|
||||||
|
abilityRecord->GetPid(), abilityRecord->GetUid(), 0, abilityRecord->GetAbilityRecordId());
|
||||||
|
}
|
||||||
|
|
||||||
// complete inactive
|
// complete inactive
|
||||||
abilityRecord->SetAbilityState(AbilityState::INACTIVE);
|
abilityRecord->SetAbilityState(AbilityState::INACTIVE);
|
||||||
if (abilityRecord->IsCreateByConnect()) {
|
if (abilityRecord->IsCreateByConnect()) {
|
||||||
@ -3115,18 +3126,19 @@ int32_t AbilityConnectManager::GetUIExtensionSessionInfo(const sptr<IRemoteObjec
|
|||||||
return uiExtensionAbilityRecordMgr_->GetUIExtensionSessionInfo(token, uiExtensionSessionInfo);
|
return uiExtensionAbilityRecordMgr_->GetUIExtensionSessionInfo(token, uiExtensionSessionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbilityConnectManager::SignRestartAppFlag(int32_t uid)
|
void AbilityConnectManager::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard lock(serviceMapMutex_);
|
std::lock_guard lock(serviceMapMutex_);
|
||||||
for (auto &[key, abilityRecord] : serviceMap_) {
|
for (auto &[key, abilityRecord] : serviceMap_) {
|
||||||
if (abilityRecord == nullptr || abilityRecord->GetUid() != uid) {
|
if (abilityRecord == nullptr || abilityRecord->GetUid() != uid ||
|
||||||
|
abilityRecord->GetInstanceKey() != instanceKey) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
abilityRecord->SetRestartAppFlag(true);
|
abilityRecord->SetRestartAppFlag(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AbilityCacheManager::GetInstance().SignRestartAppFlag(uid);
|
AbilityCacheManager::GetInstance().SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbilityConnectManager::AddToServiceMap(const std::string &key, std::shared_ptr<AbilityRecord> abilityRecord)
|
bool AbilityConnectManager::AddToServiceMap(const std::string &key, std::shared_ptr<AbilityRecord> abilityRecord)
|
||||||
|
@ -465,8 +465,7 @@ ErrCode AbilityManagerClient::CloseUIAbilityBySCB(sptr<SessionInfo> sessionInfo)
|
|||||||
}
|
}
|
||||||
auto abms = GetAbilityManager();
|
auto abms = GetAbilityManager();
|
||||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, CloseUIAbilityBySCB target: %{public}s",
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, CloseUIAbilityBySCB");
|
||||||
sessionInfo->want.GetElement().GetURI().c_str());
|
|
||||||
return abms->CloseUIAbilityBySCB(sessionInfo);
|
return abms->CloseUIAbilityBySCB(sessionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
#include "session_manager_lite.h"
|
#include "session_manager_lite.h"
|
||||||
#include "window_focus_changed_listener.h"
|
#include "window_focus_changed_listener.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "window_visibility_changed_listener.h"
|
||||||
|
|
||||||
using OHOS::AppExecFwk::ElementName;
|
using OHOS::AppExecFwk::ElementName;
|
||||||
using OHOS::Security::AccessToken::AccessTokenKit;
|
using OHOS::Security::AccessToken::AccessTokenKit;
|
||||||
@ -241,6 +242,7 @@ constexpr const char* BOOTEVENT_BOOT_ANIMATION_READY = "bootevent.bootanimation.
|
|||||||
constexpr const char* NEED_STARTINGWINDOW = "ohos.ability.NeedStartingWindow";
|
constexpr const char* NEED_STARTINGWINDOW = "ohos.ability.NeedStartingWindow";
|
||||||
constexpr const char* PERMISSIONMGR_BUNDLE_NAME = "com.ohos.permissionmanager";
|
constexpr const char* PERMISSIONMGR_BUNDLE_NAME = "com.ohos.permissionmanager";
|
||||||
constexpr const char* PERMISSIONMGR_ABILITY_NAME = "com.ohos.permissionmanager.GrantAbility";
|
constexpr const char* PERMISSIONMGR_ABILITY_NAME = "com.ohos.permissionmanager.GrantAbility";
|
||||||
|
constexpr const char* SCENEBOARD_BUNDLE_NAME = "com.ohos.sceneboard";
|
||||||
constexpr const char* IS_CALL_BY_SCB = "isCallBySCB";
|
constexpr const char* IS_CALL_BY_SCB = "isCallBySCB";
|
||||||
constexpr const char* SPECIFY_TOKEN_ID = "specifyTokenId";
|
constexpr const char* SPECIFY_TOKEN_ID = "specifyTokenId";
|
||||||
constexpr const char* PROCESS_SUFFIX = "embeddable";
|
constexpr const char* PROCESS_SUFFIX = "embeddable";
|
||||||
@ -301,6 +303,7 @@ void AbilityManagerService::OnStart()
|
|||||||
#ifdef SUPPORT_SCREEN
|
#ifdef SUPPORT_SCREEN
|
||||||
AddSystemAbilityListener(MULTIMODAL_INPUT_SERVICE_ID);
|
AddSystemAbilityListener(MULTIMODAL_INPUT_SERVICE_ID);
|
||||||
#endif
|
#endif
|
||||||
|
AddSystemAbilityListener(WINDOW_MANAGER_SERVICE_ID);
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "onStart success");
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "onStart success");
|
||||||
auto pid = getpid();
|
auto pid = getpid();
|
||||||
std::unordered_map<std::string, std::string> payload;
|
std::unordered_map<std::string, std::string> payload;
|
||||||
@ -1019,13 +1022,6 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
|
|||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "caller invalid");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "caller invalid");
|
||||||
return ERR_INVALID_CALLER;
|
return ERR_INVALID_CALLER;
|
||||||
}
|
}
|
||||||
if (callerToken != nullptr) {
|
|
||||||
bool isAppKilling = IN_PROCESS_CALL(DelayedSingleton<AppScheduler>::GetInstance()->IsAppKilling(callerToken));
|
|
||||||
if (isAppKilling) {
|
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "caller killing");
|
|
||||||
return ERR_INVALID_CALLER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
#ifdef WITH_DLP
|
#ifdef WITH_DLP
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "CHECK_DLP");
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "CHECK_DLP");
|
||||||
@ -2518,6 +2514,10 @@ void AbilityManagerService::OnAddSystemAbility(int32_t systemAbilityId, const st
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
case WINDOW_MANAGER_SERVICE_ID: {
|
||||||
|
InitWindowVisibilityChangedListener();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2539,6 +2539,10 @@ void AbilityManagerService::OnRemoveSystemAbility(int32_t systemAbilityId, const
|
|||||||
UnsubscribeBundleEventCallback();
|
UnsubscribeBundleEventCallback();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WINDOW_MANAGER_SERVICE_ID: {
|
||||||
|
FreeWindowVisibilityChangedListener();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3644,8 +3648,8 @@ int AbilityManagerService::CloseUIAbilityBySCB(const sptr<SessionInfo> &sessionI
|
|||||||
|
|
||||||
auto uiAbilityManager = GetUIAbilityManagerByUid(IPCSkeleton::GetCallingUid());
|
auto uiAbilityManager = GetUIAbilityManagerByUid(IPCSkeleton::GetCallingUid());
|
||||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR,
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "close session: %{public}d, resultCode: %{public}d, isClearSession: %{public}d",
|
||||||
"close session: %{public}d, resultCode: %{public}d", sessionInfo->persistentId, sessionInfo->resultCode);
|
sessionInfo->persistentId, sessionInfo->resultCode, sessionInfo->isClearSession);
|
||||||
auto abilityRecord = uiAbilityManager->GetUIAbilityRecordBySessionInfo(sessionInfo);
|
auto abilityRecord = uiAbilityManager->GetUIAbilityRecordBySessionInfo(sessionInfo);
|
||||||
CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE);
|
CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE);
|
||||||
if (!IsAbilityControllerForeground(abilityRecord->GetAbilityInfo().bundleName)) {
|
if (!IsAbilityControllerForeground(abilityRecord->GetAbilityInfo().bundleName)) {
|
||||||
@ -7499,6 +7503,7 @@ int AbilityManagerService::StopUser(int userId, const sptr<IUserCallback> &callb
|
|||||||
|
|
||||||
int AbilityManagerService::LogoutUser(int32_t userId)
|
int AbilityManagerService::LogoutUser(int32_t userId)
|
||||||
{
|
{
|
||||||
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "LogoutUser in service:%{public}d", userId);
|
||||||
if (IPCSkeleton::GetCallingUid() != ACCOUNT_MGR_SERVICE_UID) {
|
if (IPCSkeleton::GetCallingUid() != ACCOUNT_MGR_SERVICE_UID) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "permission verification failed, not account process");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "permission verification failed, not account process");
|
||||||
return CHECK_PERMISSION_FAILED;
|
return CHECK_PERMISSION_FAILED;
|
||||||
@ -11257,55 +11262,50 @@ int32_t AbilityManagerService::GetUIExtensionSessionInfo(const sptr<IRemoteObjec
|
|||||||
int32_t AbilityManagerService::RestartApp(const AAFwk::Want &want, bool isAppRecovery)
|
int32_t AbilityManagerService::RestartApp(const AAFwk::Want &want, bool isAppRecovery)
|
||||||
{
|
{
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "RestartApp, isAppRecovery: %{public}d", isAppRecovery);
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "RestartApp, isAppRecovery: %{public}d", isAppRecovery);
|
||||||
auto appIndex = WantUtils::GetAppIndex(want);
|
auto callerPid = IPCSkeleton::GetCallingPid();
|
||||||
int result = CheckRestartAppWant(want, appIndex);
|
AppExecFwk::RunningProcessInfo processInfo;
|
||||||
|
DelayedSingleton<AppScheduler>::GetInstance()->GetRunningProcessInfoByPid(callerPid, processInfo);
|
||||||
|
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
||||||
|
int32_t userId = callerUid / BASE_USER_RANGE;
|
||||||
|
auto result = CheckRestartAppWant(want, processInfo.appCloneIndex, userId);
|
||||||
if (result != ERR_OK) {
|
if (result != ERR_OK) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "checkRestartAppWant error");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "checkRestartAppWant error");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (!processInfo.isFocused && !processInfo.isAbilityForegrounding) {
|
||||||
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "restartApp, is not foreground");
|
||||||
int64_t now = time(nullptr);
|
|
||||||
if (!isAppRecovery && RestartAppManager::GetInstance().IsRestartAppFrequent(callerUid, now)) {
|
|
||||||
return AAFwk::ERR_RESTART_APP_FREQUENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isForegroundToRestartApp = RestartAppManager::GetInstance().IsForegroundToRestartApp();
|
|
||||||
if (!isForegroundToRestartApp) {
|
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "restartApp, isForegroundToRestartApp failed");
|
|
||||||
return AAFwk::NOT_TOP_ABILITY;
|
return AAFwk::NOT_TOP_ABILITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t userId = IPCSkeleton::GetCallingUid() / BASE_USER_RANGE;
|
RestartAppKeyType key(processInfo.instanceKey, callerUid);
|
||||||
result = SignRestartAppFlag(userId, callerUid, isAppRecovery);
|
int64_t now = time(nullptr);
|
||||||
|
if (!isAppRecovery && RestartAppManager::GetInstance().IsRestartAppFrequent(key, now)) {
|
||||||
|
return AAFwk::ERR_RESTART_APP_FREQUENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = SignRestartAppFlag(userId, callerUid, processInfo.instanceKey, processInfo.appMode, isAppRecovery);
|
||||||
if (result != ERR_OK) {
|
if (result != ERR_OK) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "signRestartAppFlag error");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "signRestartAppFlag error");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->KillApplicationSelf(false, "RestartApp");
|
|
||||||
if (result != ERR_OK) {
|
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "killApplicationSelf error");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "restartApp, without checkCallAbilityPermission.");
|
(const_cast<Want &>(want)).SetParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, processInfo.appCloneIndex);
|
||||||
(const_cast<Want &>(want)).SetParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, appIndex);
|
(const_cast<Want &>(want)).SetParam(AAFwk::Want::APP_INSTANCE_KEY, processInfo.instanceKey);
|
||||||
result = StartAbilityWrap(want, nullptr,
|
(const_cast<Want &>(want)).RemoveParam(Want::CREATE_APP_INSTANCE_KEY);
|
||||||
DEFAULT_INVAL_VALUE, false, DEFAULT_INVAL_VALUE, false, 0, isForegroundToRestartApp);
|
result = StartAbilityWrap(want, nullptr, DEFAULT_INVAL_VALUE, false, DEFAULT_INVAL_VALUE, false, 0, true);
|
||||||
if (result != ERR_OK) {
|
if (result != ERR_OK) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "startAbility error");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "startAbility error");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (!isAppRecovery) {
|
if (!isAppRecovery) {
|
||||||
RestartAppManager::GetInstance().AddRestartAppHistory(callerUid, now);
|
RestartAppManager::GetInstance().AddRestartAppHistory(key, now);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AbilityManagerService::CheckRestartAppWant(const AAFwk::Want &want, int32_t appIndex)
|
int32_t AbilityManagerService::CheckRestartAppWant(const AAFwk::Want &want, int32_t appIndex, int32_t userId)
|
||||||
{
|
{
|
||||||
std::string bundleName = want.GetElement().GetBundleName();
|
std::string bundleName = want.GetElement().GetBundleName();
|
||||||
auto userId = IPCSkeleton::GetCallingUid() / BASE_USER_RANGE;
|
|
||||||
if (!CheckCallingTokenId(bundleName, userId, appIndex)) {
|
if (!CheckCallingTokenId(bundleName, userId, appIndex)) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "no itself called, no allowed");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "no itself called, no allowed");
|
||||||
return AAFwk::ERR_RESTART_APP_INCORRECT_ABILITY;
|
return AAFwk::ERR_RESTART_APP_INCORRECT_ABILITY;
|
||||||
@ -11325,34 +11325,40 @@ int32_t AbilityManagerService::CheckRestartAppWant(const AAFwk::Want &want, int3
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AbilityManagerService::SignRestartAppFlag(int32_t userId, int32_t uid, bool isAppRecovery)
|
int32_t AbilityManagerService::SignRestartAppFlag(int32_t userId, int32_t uid, const std::string &instanceKey,
|
||||||
|
AppExecFwk::MultiAppModeType type, bool isAppRecovery)
|
||||||
{
|
{
|
||||||
auto appMgr = AppMgrUtil::GetAppMgr();
|
auto appMgr = AppMgrUtil::GetAppMgr();
|
||||||
if (appMgr == nullptr) {
|
if (appMgr == nullptr) {
|
||||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "AppMgrUtil::GetAppMgr failed");
|
TAG_LOGW(AAFwkTag::ABILITYMGR, "AppMgrUtil::GetAppMgr failed");
|
||||||
return ERR_INVALID_VALUE;
|
return ERR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
auto ret = IN_PROCESS_CALL(appMgr->SignRestartAppFlag(uid));
|
auto ret = IN_PROCESS_CALL(appMgr->SignRestartAppFlag(uid, instanceKey));
|
||||||
if (ret != ERR_OK) {
|
if (ret != ERR_OK) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "appMgr signRestartAppFlag error");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "appMgr signRestartAppFlag error");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto connectManager = GetConnectManagerByUserId(userId);
|
auto connectManager = GetConnectManagerByUserId(userId);
|
||||||
connectManager->SignRestartAppFlag(uid);
|
connectManager->SignRestartAppFlag(uid, instanceKey);
|
||||||
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||||
auto uiAbilityManager = GetUIAbilityManagerByUserId(userId);
|
auto uiAbilityManager = GetUIAbilityManagerByUserId(userId);
|
||||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||||
uiAbilityManager->SignRestartAppFlag(uid, isAppRecovery);
|
uiAbilityManager->SignRestartAppFlag(uid, instanceKey, isAppRecovery);
|
||||||
return ERR_OK;
|
} else {
|
||||||
}
|
|
||||||
auto missionListManager = GetMissionListManagerByUserId(userId);
|
auto missionListManager = GetMissionListManagerByUserId(userId);
|
||||||
if (missionListManager == nullptr) {
|
if (missionListManager == nullptr) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "missionListManager null userId:%{public}d", userId);
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "missionListManager null userId:%{public}d", userId);
|
||||||
return ERR_INVALID_VALUE;
|
return ERR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
missionListManager->SignRestartAppFlag(uid);
|
missionListManager->SignRestartAppFlag(uid, instanceKey);
|
||||||
return ERR_OK;
|
}
|
||||||
|
|
||||||
|
if (type == AppExecFwk::MultiAppModeType::MULTI_INSTANCE) {
|
||||||
|
return appMgr->KillAppSelfWithInstanceKey(instanceKey, false, "RestartInstance");
|
||||||
|
} else {
|
||||||
|
return DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->KillApplicationSelf(false, "RestartApp");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbilityManagerService::IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId)
|
bool AbilityManagerService::IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToken, const std::string &appId)
|
||||||
@ -11398,6 +11404,81 @@ bool AbilityManagerService::IsEmbeddedOpenAllowed(sptr<IRemoteObject> callerToke
|
|||||||
return erms->DoProcess(want, GetUserId());
|
return erms->DoProcess(want, GetUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbilityManagerService::CheckProcessIsBackground(int32_t pid, AbilityState currentState)
|
||||||
|
{
|
||||||
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "pid:%{public}d, currentState:%{public}d", pid, currentState);
|
||||||
|
std::lock_guard<ffrt::mutex> myLockGuard(windowVisibleListLock_);
|
||||||
|
if (currentState == AAFwk::AbilityState::BACKGROUND &&
|
||||||
|
windowVisibleList_.find(pid) != windowVisibleList_.end()) {
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "Process window is occluded");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentState != AAFwk::AbilityState::BACKGROUND) {
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "Process is not on background Pass");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbilityManagerService::InitWindowVisibilityChangedListener()
|
||||||
|
{
|
||||||
|
if (windowVisibilityChangedListener_ != nullptr) {
|
||||||
|
TAG_LOGW(AAFwkTag::ABILITYMGR, "visibility already initiate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
windowVisibilityChangedListener_ =
|
||||||
|
new (std::nothrow) WindowVisibilityChangedListener(weak_from_this(), taskHandler_);
|
||||||
|
if (windowVisibilityChangedListener_ == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "window visibility changed listener null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rosen::WindowManager::GetInstance().RegisterVisibilityChangedListener(windowVisibilityChangedListener_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbilityManagerService::FreeWindowVisibilityChangedListener()
|
||||||
|
{
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||||
|
if (windowVisibilityChangedListener_ == nullptr) {
|
||||||
|
TAG_LOGW(AAFwkTag::ABILITYMGR, "visibility listener already free");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Rosen::WindowManager::GetInstance().UnregisterVisibilityChangedListener(windowVisibilityChangedListener_);
|
||||||
|
windowVisibilityChangedListener_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbilityManagerService::HandleWindowVisibilityChanged(
|
||||||
|
const std::vector<sptr<OHOS::Rosen::WindowVisibilityInfo>> &windowVisibilityInfos)
|
||||||
|
{
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||||
|
if (windowVisibilityInfos.empty()) {
|
||||||
|
TAG_LOGW(AAFwkTag::ABILITYMGR, "window visibility info empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::lock_guard<ffrt::mutex> myLockGuard(windowVisibleListLock_);
|
||||||
|
for (const auto &info : windowVisibilityInfos) {
|
||||||
|
if (info == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "null info");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int uid = 0;
|
||||||
|
std::string bundleName;
|
||||||
|
if (info->windowType_ == Rosen::WindowType::WINDOW_TYPE_DESKTOP &&
|
||||||
|
info->visibilityState_ == Rosen::WINDOW_VISIBILITY_STATE_NO_OCCLUSION) {
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "desktop is visible clear windowVisibleList_");
|
||||||
|
windowVisibleList_.clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DelayedSingleton<AppScheduler>::GetInstance()->GetBundleNameByPid(info->pid_, bundleName, uid);
|
||||||
|
if (info->visibilityState_ == Rosen::WINDOW_VISIBILITY_STATE_NO_OCCLUSION &&
|
||||||
|
bundleName != SCENEBOARD_BUNDLE_NAME) {
|
||||||
|
windowVisibleList_.insert(info->pid_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool AbilityManagerService::ShouldPreventStartAbility(const AbilityRequest &abilityRequest)
|
bool AbilityManagerService::ShouldPreventStartAbility(const AbilityRequest &abilityRequest)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AbilityRecord> abilityRecord = Token::GetAbilityRecordByToken(abilityRequest.callerToken);
|
std::shared_ptr<AbilityRecord> abilityRecord = Token::GetAbilityRecordByToken(abilityRequest.callerToken);
|
||||||
@ -11432,8 +11513,7 @@ bool AbilityManagerService::ShouldPreventStartAbility(const AbilityRequest &abil
|
|||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Is not UI Ability Pass");
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "Is not UI Ability Pass");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (abilityRecord->GetAbilityState() != AAFwk::AbilityState::BACKGROUND) {
|
if (!CheckProcessIsBackground(abilityRecord->GetPid(), abilityRecord->GetAbilityState())) {
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Process is not on background Pass");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (continuousFlag) {
|
if (continuousFlag) {
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "system_ability_token_callback.h"
|
#include "system_ability_token_callback.h"
|
||||||
#include "ui_extension_utils.h"
|
#include "ui_extension_utils.h"
|
||||||
#include "uri_permission_manager_client.h"
|
#include "uri_permission_manager_client.h"
|
||||||
|
#include "param.h"
|
||||||
#include "permission_constants.h"
|
#include "permission_constants.h"
|
||||||
#include "process_options.h"
|
#include "process_options.h"
|
||||||
#include "uri_utils.h"
|
#include "uri_utils.h"
|
||||||
@ -308,7 +309,7 @@ void AbilityRecord::LoadUIAbility()
|
|||||||
g_addLifecycleEventTask(token_, FreezeUtil::TimeoutState::LOAD, methodName);
|
g_addLifecycleEventTask(token_, FreezeUtil::TimeoutState::LOAD, methodName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AbilityRecord::LoadAbility()
|
int AbilityRecord::LoadAbility(bool isShellCall)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "LoadLifecycle: abilityName:%{public}s", abilityInfo_.name.c_str());
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "LoadLifecycle: abilityName:%{public}s", abilityInfo_.name.c_str());
|
||||||
@ -344,9 +345,20 @@ int AbilityRecord::LoadAbility()
|
|||||||
|
|
||||||
std::lock_guard guard(wantLock_);
|
std::lock_guard guard(wantLock_);
|
||||||
want_.SetParam(ABILITY_OWNER_USERID, ownerMissionUserId_);
|
want_.SetParam(ABILITY_OWNER_USERID, ownerMissionUserId_);
|
||||||
|
AbilityRuntime::LoadParam loadParam;
|
||||||
|
loadParam.abilityRecordId = recordId_;
|
||||||
|
if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||||
|
loadParam.isShellCall = isShellCall;
|
||||||
|
} else {
|
||||||
|
loadParam.isShellCall = AAFwk::PermissionVerification::GetInstance()->IsShellCall();
|
||||||
|
}
|
||||||
|
loadParam.token = token_;
|
||||||
|
loadParam.preToken = callerToken_;
|
||||||
|
loadParam.instanceKey = instanceKey_;
|
||||||
auto result = DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
|
auto result = DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
|
||||||
token_, callerToken_, abilityInfo_, abilityInfo_.applicationInfo, want_, recordId_, instanceKey_);
|
loadParam, abilityInfo_, abilityInfo_.applicationInfo, want_);
|
||||||
want_.RemoveParam(ABILITY_OWNER_USERID);
|
want_.RemoveParam(ABILITY_OWNER_USERID);
|
||||||
|
want_.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
SetLoadState(AbilityLoadState::LOADING);
|
SetLoadState(AbilityLoadState::LOADING);
|
||||||
|
|
||||||
auto isAttachDebug = DelayedSingleton<AppScheduler>::GetInstance()->IsAttachDebug(abilityInfo_.bundleName);
|
auto isAttachDebug = DelayedSingleton<AppScheduler>::GetInstance()->IsAttachDebug(abilityInfo_.bundleName);
|
||||||
@ -448,7 +460,7 @@ void AbilityRecord::ForegroundUIExtensionAbility(uint32_t sceneFlag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbilityRecord::ProcessForegroundAbility(uint32_t tokenId, uint32_t sceneFlag)
|
void AbilityRecord::ProcessForegroundAbility(uint32_t tokenId, uint32_t sceneFlag, bool isShellCall)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||||
std::string element = GetElementName().GetURI();
|
std::string element = GetElementName().GetURI();
|
||||||
@ -476,7 +488,7 @@ void AbilityRecord::ProcessForegroundAbility(uint32_t tokenId, uint32_t sceneFla
|
|||||||
} else {
|
} else {
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "To load ability.");
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "To load ability.");
|
||||||
lifeCycleStateInfo_.sceneFlagBak = sceneFlag;
|
lifeCycleStateInfo_.sceneFlagBak = sceneFlag;
|
||||||
LoadAbility();
|
LoadAbility(isShellCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,10 +501,10 @@ void AbilityRecord::PostForegroundTimeoutTask()
|
|||||||
AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() * FOREGROUND_TIMEOUT_MULTIPLE;
|
AmsConfigurationParameter::GetInstance().GetAppStartTimeoutTime() * FOREGROUND_TIMEOUT_MULTIPLE;
|
||||||
SendEvent(AbilityManagerService::FOREGROUND_HALF_TIMEOUT_MSG, foregroundTimeout / HALF_TIMEOUT);
|
SendEvent(AbilityManagerService::FOREGROUND_HALF_TIMEOUT_MSG, foregroundTimeout / HALF_TIMEOUT);
|
||||||
SendEvent(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, foregroundTimeout);
|
SendEvent(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, foregroundTimeout);
|
||||||
std::string methodName = "ForegroundAbility";
|
std::string methodName = "ProcessForegroundAbility";
|
||||||
g_addLifecycleEventTask(token_, FreezeUtil::TimeoutState::FOREGROUND, methodName);
|
g_addLifecycleEventTask(token_, FreezeUtil::TimeoutState::FOREGROUND, methodName);
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_BEGIN, GetPid(), GetUid(),
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_BEGIN, GetPid(), GetUid(),
|
||||||
foregroundTimeout);
|
foregroundTimeout, GetAbilityRecordId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbilityRecord::RemoveForegroundTimeoutTask()
|
void AbilityRecord::RemoveForegroundTimeoutTask()
|
||||||
@ -534,7 +546,7 @@ void AbilityRecord::PostUIExtensionAbilityTimeoutTask(uint32_t messageId)
|
|||||||
SendEvent(AbilityManagerService::FOREGROUND_HALF_TIMEOUT_MSG, timeout / HALF_TIMEOUT, recordId_, true);
|
SendEvent(AbilityManagerService::FOREGROUND_HALF_TIMEOUT_MSG, timeout / HALF_TIMEOUT, recordId_, true);
|
||||||
SendEvent(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, timeout, recordId_, true);
|
SendEvent(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, timeout, recordId_, true);
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_BEGIN, GetPid(), GetUid(),
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_BEGIN, GetPid(), GetUid(),
|
||||||
timeout);
|
timeout, GetAbilityRecordId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -1444,7 +1456,8 @@ void AbilityRecord::SetAbilityState(AbilityState state)
|
|||||||
SetRestarting(false);
|
SetRestarting(false);
|
||||||
}
|
}
|
||||||
if (state == AbilityState::FOREGROUND) {
|
if (state == AbilityState::FOREGROUND) {
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_END, GetPid(), GetUid());
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::FOREGROUND_END, GetPid(),
|
||||||
|
GetUid(), 0, GetAbilityRecordId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // SUPPORT_SCREEN
|
#endif // SUPPORT_SCREEN
|
||||||
@ -1503,7 +1516,11 @@ void AbilityRecord::SetScheduler(const sptr<IAbilityScheduler> &scheduler)
|
|||||||
void AbilityRecord::AfterLoaded()
|
void AbilityRecord::AfterLoaded()
|
||||||
{
|
{
|
||||||
FreezeUtil::GetInstance().DeleteAppLifecycleEvent(GetPid());
|
FreezeUtil::GetInstance().DeleteAppLifecycleEvent(GetPid());
|
||||||
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::LOAD_END, GetPid(), GetUid());
|
if (GetAbilityInfo().extensionAbilityType != AppExecFwk::ExtensionAbilityType::SERVICE) {
|
||||||
|
ResSchedUtil::GetInstance().ReportLoadingEventToRss(LoadingStage::LOAD_END, GetPid(),
|
||||||
|
GetUid(), 0, GetAbilityRecordId());
|
||||||
|
}
|
||||||
|
|
||||||
if (IsSceneBoard()) {
|
if (IsSceneBoard()) {
|
||||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Sceneboard Added");
|
TAG_LOGI(AAFwkTag::ABILITYMGR, "Sceneboard Added");
|
||||||
}
|
}
|
||||||
|
@ -66,21 +66,14 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback> &callback)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppScheduler::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
|
int AppScheduler::LoadAbility(const AbilityRuntime::LoadParam &loadParam, const AppExecFwk::AbilityInfo &abilityInfo,
|
||||||
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo,
|
const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want)
|
||||||
const Want &want, int32_t abilityRecordId, const std::string &instanceKey)
|
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||||
CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR);
|
CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR);
|
||||||
/* because the errcode type of AppMgr Client API will be changed to int,
|
/* because the errcode type of AppMgr Client API will be changed to int,
|
||||||
* so must to covert the return result */
|
* so must to covert the return result */
|
||||||
AbilityRuntime::LoadParam loadParam;
|
|
||||||
loadParam.abilityRecordId = abilityRecordId;
|
|
||||||
loadParam.isShellCall = AAFwk::PermissionVerification::GetInstance()->IsShellCall();
|
|
||||||
loadParam.token = token;
|
|
||||||
loadParam.preToken = preToken;
|
|
||||||
loadParam.instanceKey = instanceKey;
|
|
||||||
int ret = static_cast<int>(IN_PROCESS_CALL(
|
int ret = static_cast<int>(IN_PROCESS_CALL(
|
||||||
appMgrClient_->LoadAbility(abilityInfo, applicationInfo, want, loadParam)));
|
appMgrClient_->LoadAbility(abilityInfo, applicationInfo, want, loadParam)));
|
||||||
if (ret != ERR_OK) {
|
if (ret != ERR_OK) {
|
||||||
|
@ -175,7 +175,7 @@ void ConnectionRecord::CompleteDisconnect(int resultCode, bool isCallerDied, boo
|
|||||||
}
|
}
|
||||||
CHECK_POINTER(targetService_);
|
CHECK_POINTER(targetService_);
|
||||||
const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo();
|
const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo();
|
||||||
AppExecFwk::ElementName element(abilityInfo.deviceId, abilityInfo.bundleName,
|
AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceId(), abilityInfo.bundleName,
|
||||||
abilityInfo.name, abilityInfo.moduleName);
|
abilityInfo.name, abilityInfo.moduleName);
|
||||||
auto code = isTargetDied ? (resultCode - 1) : resultCode;
|
auto code = isTargetDied ? (resultCode - 1) : resultCode;
|
||||||
auto onDisconnectDoneTask = [connCallback = GetAbilityConnectCallback(), element, code]() {
|
auto onDisconnectDoneTask = [connCallback = GetAbilityConnectCallback(), element, code]() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "interceptor/disposed_rule_interceptor.h"
|
#include "interceptor/disposed_rule_interceptor.h"
|
||||||
|
|
||||||
#include "ability_record.h"
|
#include "ability_manager_service.h"
|
||||||
#include "global_constant.h"
|
#include "global_constant.h"
|
||||||
#include "hitrace_meter.h"
|
#include "hitrace_meter.h"
|
||||||
#include "iservice_registry.h"
|
#include "iservice_registry.h"
|
||||||
@ -250,7 +250,7 @@ ErrCode DisposedRuleInterceptor::CreateModalUIExtension(const Want &want, const
|
|||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||||
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||||
if (abilityRecord == nullptr) {
|
if (abilityRecord == nullptr || abilityRecord->GetAbilityInfo().type != AppExecFwk::AbilityType::PAGE) {
|
||||||
auto systemUIExtension = std::make_shared<OHOS::Rosen::ModalSystemUiExtension>();
|
auto systemUIExtension = std::make_shared<OHOS::Rosen::ModalSystemUiExtension>();
|
||||||
(const_cast<Want &>(want)).SetParam(UIEXTENSION_MODAL_TYPE, 1);
|
(const_cast<Want &>(want)).SetParam(UIEXTENSION_MODAL_TYPE, 1);
|
||||||
return IN_PROCESS_CALL(systemUIExtension->CreateModalUIExtension(want)) ? ERR_OK : INNER_ERR;
|
return IN_PROCESS_CALL(systemUIExtension->CreateModalUIExtension(want)) ? ERR_OK : INNER_ERR;
|
||||||
|
@ -117,9 +117,7 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId)
|
|||||||
InitErmsCallerInfo(want, nullptr, callerInfo, userId);
|
InitErmsCallerInfo(want, nullptr, callerInfo, userId);
|
||||||
|
|
||||||
ExperienceRule rule;
|
ExperienceRule rule;
|
||||||
AAFwk::Want newWant = want;
|
auto ret = IN_PROCESS_CALL(AbilityEcologicalRuleMgrServiceClient::GetInstance()->QueryStartExperience(want,
|
||||||
newWant.RemoveAllFd();
|
|
||||||
auto ret = IN_PROCESS_CALL(AbilityEcologicalRuleMgrServiceClient::GetInstance()->QueryStartExperience(newWant,
|
|
||||||
callerInfo, rule));
|
callerInfo, rule));
|
||||||
if (ret != ERR_OK) {
|
if (ret != ERR_OK) {
|
||||||
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed");
|
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "check ecological rule failed");
|
||||||
|
@ -468,7 +468,7 @@ void MissionList::GetActiveAbilityList(int32_t uid, std::vector<std::string> &ab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionList::SignRestartAppFlag(int32_t uid)
|
void MissionList::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
for (auto it = missions_.begin(); it != missions_.end();) {
|
for (auto it = missions_.begin(); it != missions_.end();) {
|
||||||
auto mission = *it;
|
auto mission = *it;
|
||||||
@ -485,6 +485,10 @@ void MissionList::SignRestartAppFlag(int32_t uid)
|
|||||||
it++;
|
it++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (abilityRecord->GetInstanceKey() != instanceKey) {
|
||||||
|
it++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
abilityRecord->SetRestartAppFlag(true);
|
abilityRecord->SetRestartAppFlag(true);
|
||||||
it = missions_.erase(it);
|
it = missions_.erase(it);
|
||||||
}
|
}
|
||||||
|
@ -4272,20 +4272,20 @@ void MissionListManager::SendKeyEvent(const AbilityRequest &abilityRequest)
|
|||||||
EventReport::SendKeyEvent(EventName::START_PRIVATE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo);
|
EventReport::SendKeyEvent(EventName::START_PRIVATE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionListManager::SignRestartAppFlag(int32_t uid)
|
void MissionListManager::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
std::lock_guard guard(managerLock_);
|
std::lock_guard guard(managerLock_);
|
||||||
for (const auto& missionList : currentMissionLists_) {
|
for (const auto& missionList : currentMissionLists_) {
|
||||||
if (!missionList) {
|
if (!missionList) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
missionList->SignRestartAppFlag(uid);
|
missionList->SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
}
|
||||||
if (defaultStandardList_) {
|
if (defaultStandardList_) {
|
||||||
defaultStandardList_->SignRestartAppFlag(uid);
|
defaultStandardList_->SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
}
|
||||||
if (defaultSingleList_) {
|
if (defaultSingleList_) {
|
||||||
defaultSingleList_->SignRestartAppFlag(uid);
|
defaultSingleList_->SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,5 +142,13 @@ bool PendingWantKey::IsEqualsRequestWant(const Want &otherWant)
|
|||||||
std::lock_guard<std::mutex> lock(requestWantMutex_);
|
std::lock_guard<std::mutex> lock(requestWantMutex_);
|
||||||
return requestWant_.IsEquals(otherWant);
|
return requestWant_.IsEquals(otherWant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PendingWantKey::GetAllBundleNames(std::vector<std::string> &bundleNames)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(wantsInfosMutex_);
|
||||||
|
for (const auto &wantInfo : allWantsInfos_) {
|
||||||
|
bundleNames.emplace_back(wantInfo.want.GetBundle());
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -29,9 +29,11 @@ namespace AAFwk {
|
|||||||
using namespace OHOS::EventFwk;
|
using namespace OHOS::EventFwk;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
constexpr const char* PENDING_WANT_MANAGER = "PendingWantManager";
|
||||||
|
|
||||||
PendingWantManager::PendingWantManager()
|
PendingWantManager::PendingWantManager()
|
||||||
{
|
{
|
||||||
|
taskHandler_ = TaskHandlerWrap::CreateQueueHandler(PENDING_WANT_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingWantManager::~PendingWantManager()
|
PendingWantManager::~PendingWantManager()
|
||||||
@ -114,7 +116,6 @@ sptr<IWantSender> PendingWantManager::GetWantSenderLocked(const int32_t callingU
|
|||||||
}
|
}
|
||||||
MakeWantSenderCanceledLocked(*ref);
|
MakeWantSenderCanceledLocked(*ref);
|
||||||
wantRecords_.erase(ref->GetKey());
|
wantRecords_.erase(ref->GetKey());
|
||||||
EraseBundleRecord(wantSenderInfo.allWants, ref->GetKey());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!needCreate) {
|
if (!needCreate) {
|
||||||
@ -128,7 +129,6 @@ sptr<IWantSender> PendingWantManager::GetWantSenderLocked(const int32_t callingU
|
|||||||
rec->SetCallerUid(callingUid);
|
rec->SetCallerUid(callingUid);
|
||||||
pendingKey->SetCode(PendingRecordIdCreate());
|
pendingKey->SetCode(PendingRecordIdCreate());
|
||||||
wantRecords_.insert(std::make_pair(pendingKey, rec));
|
wantRecords_.insert(std::make_pair(pendingKey, rec));
|
||||||
InsertBundleRecord(wantSenderInfo.allWants, pendingKey);
|
|
||||||
TAG_LOGD(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
TAG_LOGD(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
@ -252,9 +252,6 @@ void PendingWantManager::CancelWantSenderLocked(PendingWantRecord &record, bool
|
|||||||
MakeWantSenderCanceledLocked(record);
|
MakeWantSenderCanceledLocked(record);
|
||||||
if (cleanAbility) {
|
if (cleanAbility) {
|
||||||
wantRecords_.erase(record.GetKey());
|
wantRecords_.erase(record.GetKey());
|
||||||
if (record.GetKey() != nullptr) {
|
|
||||||
EraseBundleRecord(record.GetKey()->GetAllWantsInfos(), record.GetKey());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,37 +601,30 @@ int32_t PendingWantManager::GetWantSenderInfo(const sptr<IWantSender> &target, s
|
|||||||
|
|
||||||
void PendingWantManager::ClearPendingWantRecord(const std::string &bundleName, int32_t uid)
|
void PendingWantManager::ClearPendingWantRecord(const std::string &bundleName, int32_t uid)
|
||||||
{
|
{
|
||||||
auto abilityManagerService = DelayedSingleton<AbilityManagerService>::GetInstance();
|
CHECK_POINTER(taskHandler_);
|
||||||
CHECK_POINTER(abilityManagerService);
|
TAG_LOGI(AAFwkTag::WANTAGENT, "begin");
|
||||||
auto handler = abilityManagerService->GetTaskHandler();
|
|
||||||
CHECK_POINTER(handler);
|
|
||||||
auto task = [bundleName, uid, self = shared_from_this()]() { self->ClearPendingWantRecordTask(bundleName, uid); };
|
auto task = [bundleName, uid, self = shared_from_this()]() { self->ClearPendingWantRecordTask(bundleName, uid); };
|
||||||
handler->SubmitTask(task);
|
taskHandler_->SubmitTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PendingWantManager::ClearPendingWantRecordTask(const std::string &bundleName, int32_t uid)
|
void PendingWantManager::ClearPendingWantRecordTask(const std::string &bundleName, int32_t uid)
|
||||||
{
|
{
|
||||||
if (!QueryRecordByBundle(bundleName)) {
|
TAG_LOGI(AAFwkTag::WANTAGENT, "begin");
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::lock_guard<ffrt::mutex> locker(mutex_);
|
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||||
if (!QueryRecordByBundle(bundleName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto iter = wantRecords_.begin();
|
auto iter = wantRecords_.begin();
|
||||||
while (iter != wantRecords_.end()) {
|
while (iter != wantRecords_.end()) {
|
||||||
bool hasBundle = false;
|
bool hasBundle = false;
|
||||||
const auto &pendingRecord = iter->second;
|
const auto &pendingRecord = iter->second;
|
||||||
if ((pendingRecord != nullptr)) {
|
if ((pendingRecord != nullptr)) {
|
||||||
auto wantInfos = pendingRecord->GetKey()->GetAllWantsInfos();
|
std::vector<std::string> bundleNameVec;
|
||||||
for (const auto &wantInfo: wantInfos) {
|
pendingRecord->GetKey()->GetAllBundleNames(bundleNameVec);
|
||||||
if (wantInfo.want.GetBundle() == bundleName && uid == pendingRecord->GetUid()) {
|
for (const auto &bundleItem: bundleNameVec) {
|
||||||
|
if (bundleItem == bundleName && uid == pendingRecord->GetUid()) {
|
||||||
hasBundle = true;
|
hasBundle = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasBundle) {
|
if (hasBundle) {
|
||||||
EraseBundleRecord(wantInfos, pendingRecord->GetKey());
|
|
||||||
iter = wantRecords_.erase(iter);
|
iter = wantRecords_.erase(iter);
|
||||||
TAG_LOGI(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
TAG_LOGI(AAFwkTag::WANTAGENT, "wantRecords_ size %{public}zu", wantRecords_.size());
|
||||||
} else {
|
} else {
|
||||||
@ -697,6 +687,7 @@ void PendingWantManager::Dump(std::vector<std::string> &info)
|
|||||||
std::string dumpInfo = " PendingWantRecords:";
|
std::string dumpInfo = " PendingWantRecords:";
|
||||||
info.push_back(dumpInfo);
|
info.push_back(dumpInfo);
|
||||||
|
|
||||||
|
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||||
for (const auto &item : wantRecords_) {
|
for (const auto &item : wantRecords_) {
|
||||||
const auto &pendingKey = item.first;
|
const auto &pendingKey = item.first;
|
||||||
dumpInfo = " PendWantRecord ID #" + std::to_string(pendingKey->GetCode()) +
|
dumpInfo = " PendWantRecord ID #" + std::to_string(pendingKey->GetCode()) +
|
||||||
@ -729,6 +720,7 @@ void PendingWantManager::DumpByRecordId(std::vector<std::string> &info, const st
|
|||||||
std::string dumpInfo = " PendingWantRecords:";
|
std::string dumpInfo = " PendingWantRecords:";
|
||||||
info.push_back(dumpInfo);
|
info.push_back(dumpInfo);
|
||||||
|
|
||||||
|
std::lock_guard<ffrt::mutex> locker(mutex_);
|
||||||
for (const auto &item : wantRecords_) {
|
for (const auto &item : wantRecords_) {
|
||||||
const auto &pendingKey = item.first;
|
const auto &pendingKey = item.first;
|
||||||
if (args == std::to_string(pendingKey->GetCode())) {
|
if (args == std::to_string(pendingKey->GetCode())) {
|
||||||
@ -774,52 +766,5 @@ int32_t PendingWantManager::GetAllRunningInstanceKeysByBundleName(
|
|||||||
|
|
||||||
return IN_PROCESS_CALL(appMgr->GetAllRunningInstanceKeysByBundleName(bundleName, appKeyVec));
|
return IN_PROCESS_CALL(appMgr->GetAllRunningInstanceKeysByBundleName(bundleName, appKeyVec));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PendingWantManager::EraseBundleRecord(
|
|
||||||
const std::vector<WantsInfo> &wantsInfos, std::shared_ptr<PendingWantKey> key)
|
|
||||||
{
|
|
||||||
std::lock_guard<ffrt::mutex> locker(bundleRecordsMutex_);
|
|
||||||
for (const auto &wantInfo : wantsInfos) {
|
|
||||||
auto it = bundleRecords_.find(wantInfo.want.GetBundle());
|
|
||||||
if (it != bundleRecords_.end()) {
|
|
||||||
auto &recordVec = it->second;
|
|
||||||
recordVec.erase(std::remove_if(recordVec.begin(), recordVec.end(),
|
|
||||||
[key](std::shared_ptr<PendingWantKey> value) {
|
|
||||||
return value == key;
|
|
||||||
}),
|
|
||||||
recordVec.end());
|
|
||||||
if (recordVec.empty()) {
|
|
||||||
bundleRecords_.erase(wantInfo.want.GetBundle());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PendingWantManager::InsertBundleRecord(
|
|
||||||
const std::vector<WantsInfo> &wantsInfos, std::shared_ptr<PendingWantKey> key)
|
|
||||||
{
|
|
||||||
std::lock_guard<ffrt::mutex> locker(bundleRecordsMutex_);
|
|
||||||
for (const auto &wantInfo : wantsInfos) {
|
|
||||||
auto it = bundleRecords_.find(wantInfo.want.GetBundle());
|
|
||||||
if (it != bundleRecords_.end()) {
|
|
||||||
auto &recordVec = it->second;
|
|
||||||
recordVec.emplace_back(key);
|
|
||||||
} else {
|
|
||||||
std::vector<std::shared_ptr<PendingWantKey>> pendingWantVector;
|
|
||||||
pendingWantVector.emplace_back(key);
|
|
||||||
bundleRecords_[wantInfo.want.GetBundle()] = pendingWantVector;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PendingWantManager::QueryRecordByBundle(const std::string &bundleName)
|
|
||||||
{
|
|
||||||
std::lock_guard<ffrt::mutex> locker(bundleRecordsMutex_);
|
|
||||||
auto bundleIter = bundleRecords_.find(bundleName);
|
|
||||||
if (bundleIter != bundleRecords_.end()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ability_resident_process_rdb.h"
|
#include "ability_resident_process_rdb.h"
|
||||||
|
#include <charconv>
|
||||||
|
|
||||||
#include "hilog_tag_wrapper.h"
|
#include "hilog_tag_wrapper.h"
|
||||||
#include "parser_util.h"
|
#include "parser_util.h"
|
||||||
@ -205,12 +206,13 @@ int32_t AmsResidentProcessRdb::GetResidentProcessEnable(const std::string &bundl
|
|||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret);
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret);
|
||||||
return Rdb_Search_Record_Err;
|
return Rdb_Search_Record_Err;
|
||||||
}
|
}
|
||||||
try {
|
unsigned long value = 0;
|
||||||
enable = static_cast<bool>(std::stoul(flag));
|
auto res = std::from_chars(flag.c_str(), flag.c_str() + flag.size(), value);
|
||||||
} catch (...) {
|
if (res.ec != std::errc()) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "stoul fail, flag: %{public}s", flag.c_str());
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "from_chars error flag:%{public}s", flag.c_str());
|
||||||
return Rdb_Search_Record_Err;
|
return Rdb_Search_Record_Err;
|
||||||
}
|
}
|
||||||
|
enable = static_cast<bool>(value);
|
||||||
|
|
||||||
return Rdb_OK;
|
return Rdb_OK;
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,11 @@ RestartAppManager &RestartAppManager::GetInstance()
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RestartAppManager::IsRestartAppFrequent(int32_t uid, time_t time)
|
bool RestartAppManager::IsRestartAppFrequent(const RestartAppKeyType &key, time_t time)
|
||||||
{
|
{
|
||||||
std::lock_guard<ffrt::mutex> lock(restartAppMapLock_);
|
std::lock_guard<ffrt::mutex> lock(restartAppMapLock_);
|
||||||
constexpr int64_t MIN_RESTART_TIME = 10;
|
constexpr int64_t MIN_RESTART_TIME = 10;
|
||||||
auto it = restartAppHistory_.find(uid);
|
auto it = restartAppHistory_.find(key);
|
||||||
if ((it != restartAppHistory_.end()) && (it->second + MIN_RESTART_TIME > time)) {
|
if ((it != restartAppHistory_.end()) && (it->second + MIN_RESTART_TIME > time)) {
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "restart too frequently. try again at least 10s later");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "restart too frequently. try again at least 10s later");
|
||||||
return true;
|
return true;
|
||||||
@ -40,24 +40,11 @@ bool RestartAppManager::IsRestartAppFrequent(int32_t uid, time_t time)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestartAppManager::AddRestartAppHistory(int32_t uid, time_t time)
|
void RestartAppManager::AddRestartAppHistory(const RestartAppKeyType &key, time_t time)
|
||||||
{
|
{
|
||||||
std::lock_guard<ffrt::mutex> lock(restartAppMapLock_);
|
std::lock_guard<ffrt::mutex> lock(restartAppMapLock_);
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Refresh history, uid=%{public}d", uid);
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "Refresh uid=%{public}d, instanceKey:%{public}s", key.uid, key.instanceKey.c_str());
|
||||||
restartAppHistory_[uid] = time;
|
restartAppHistory_[key] = time;
|
||||||
}
|
|
||||||
|
|
||||||
bool RestartAppManager::IsForegroundToRestartApp() const
|
|
||||||
{
|
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
|
||||||
auto callerPid = IPCSkeleton::GetCallingPid();
|
|
||||||
AppExecFwk::RunningProcessInfo processInfo;
|
|
||||||
DelayedSingleton<AppScheduler>::GetInstance()->GetRunningProcessInfoByPid(callerPid, processInfo);
|
|
||||||
if (processInfo.isFocused || processInfo.isAbilityForegrounding) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "IsForegroundToRestartApp, state not foreground");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "session/host/include/zidl/session_interface.h"
|
#include "session/host/include/zidl/session_interface.h"
|
||||||
#include "startup_util.h"
|
#include "startup_util.h"
|
||||||
#include "ui_extension_utils.h"
|
#include "ui_extension_utils.h"
|
||||||
|
#include "utils/ability_permission_util.h"
|
||||||
#ifdef SUPPORT_GRAPHICS
|
#ifdef SUPPORT_GRAPHICS
|
||||||
#include "ability_first_frame_state_observer_manager.h"
|
#include "ability_first_frame_state_observer_manager.h"
|
||||||
#endif
|
#endif
|
||||||
@ -46,6 +47,7 @@ constexpr int DEFAULT_DMS_MISSION_ID = -1;
|
|||||||
constexpr const char* PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag";
|
constexpr const char* PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag";
|
||||||
constexpr const char* DMS_PROCESS_NAME = "distributedsched";
|
constexpr const char* DMS_PROCESS_NAME = "distributedsched";
|
||||||
constexpr const char* DMS_PERSISTENT_ID = "ohos.dms.persistentId";
|
constexpr const char* DMS_PERSISTENT_ID = "ohos.dms.persistentId";
|
||||||
|
constexpr const char* IS_SHELL_CALL = "isShellCall";
|
||||||
#ifdef SUPPORT_ASAN
|
#ifdef SUPPORT_ASAN
|
||||||
constexpr int KILL_TIMEOUT_MULTIPLE = 45;
|
constexpr int KILL_TIMEOUT_MULTIPLE = 45;
|
||||||
#else
|
#else
|
||||||
@ -108,7 +110,8 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp
|
|||||||
if (!uiAbilityRecord->IsReady() || sessionInfo->isNewWant) {
|
if (!uiAbilityRecord->IsReady() || sessionInfo->isNewWant) {
|
||||||
AddCallerRecord(abilityRequest, sessionInfo, uiAbilityRecord);
|
AddCallerRecord(abilityRequest, sessionInfo, uiAbilityRecord);
|
||||||
}
|
}
|
||||||
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId, sceneFlag);
|
auto isShellCall = abilityRequest.want.GetBoolParam(IS_SHELL_CALL, false);
|
||||||
|
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId, sceneFlag, isShellCall);
|
||||||
CheckSpecified(abilityRequest, uiAbilityRecord);
|
CheckSpecified(abilityRequest, uiAbilityRecord);
|
||||||
SendKeyEvent(abilityRequest);
|
SendKeyEvent(abilityRequest);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -130,6 +133,7 @@ std::shared_ptr<AbilityRecord> UIAbilityLifecycleManager::GenerateAbilityRecord(
|
|||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionToken invalid");
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionToken invalid");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
abilityRequest.want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
uiAbilityRecord->SetIsNewWant(sessionInfo->isNewWant);
|
uiAbilityRecord->SetIsNewWant(sessionInfo->isNewWant);
|
||||||
if (sessionInfo->isNewWant) {
|
if (sessionInfo->isNewWant) {
|
||||||
uiAbilityRecord->SetWant(abilityRequest.want);
|
uiAbilityRecord->SetWant(abilityRequest.want);
|
||||||
@ -164,6 +168,14 @@ bool UIAbilityLifecycleManager::CheckSessionInfo(sptr<SessionInfo> sessionInfo)
|
|||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "token's Descriptor: %{public}s", descriptor.c_str());
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "token's Descriptor: %{public}s", descriptor.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool needCheckCallerIsExist = sessionInfo->want.GetBoolParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST, false);
|
||||||
|
if (needCheckCallerIsExist && sessionInfo->callerToken) {
|
||||||
|
auto callerAbility = Token::GetAbilityRecordByToken(sessionInfo->callerToken);
|
||||||
|
if (callerAbility == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "callerAbility not exist");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,11 +347,15 @@ int UIAbilityLifecycleManager::AbilityWindowConfigTransactionDone(const sptr<IRe
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UIAbilityLifecycleManager::NotifySCBToStartUIAbility(const AbilityRequest &abilityRequest)
|
int UIAbilityLifecycleManager::NotifySCBToStartUIAbility(AbilityRequest &abilityRequest)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||||
|
abilityRequest.want.SetParam(IS_SHELL_CALL, AAFwk::PermissionVerification::GetInstance()->IsShellCall());
|
||||||
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
||||||
// start abilty with persistentId by dms
|
if (!AbilityPermissionUtil::GetInstance().VerifyCallerToken(abilityRequest)) {
|
||||||
|
return ERR_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
// start ability with persistentId by dms
|
||||||
int32_t persistentId = abilityRequest.want.GetIntParam(DMS_PERSISTENT_ID, 0);
|
int32_t persistentId = abilityRequest.want.GetIntParam(DMS_PERSISTENT_ID, 0);
|
||||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "NotifySCBToStartUIAbility, want with persistentId: %{public}d.", persistentId);
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "NotifySCBToStartUIAbility, want with persistentId: %{public}d.", persistentId);
|
||||||
if (persistentId != 0 &&
|
if (persistentId != 0 &&
|
||||||
@ -362,9 +378,10 @@ int UIAbilityLifecycleManager::NotifySCBToStartUIAbility(const AbilityRequest &a
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
auto isSpecified = (abilityRequest.abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED);
|
auto isSpecified = (abilityRequest.abilityInfo.launchMode == AppExecFwk::LaunchMode::SPECIFIED);
|
||||||
if (isSpecified) {
|
auto isCreating = abilityRequest.want.GetBoolParam(Want::CREATE_APP_INSTANCE_KEY, false);
|
||||||
|
if (isSpecified && !isCreating) {
|
||||||
CancelSameAbilityTimeoutTask(abilityInfo);
|
CancelSameAbilityTimeoutTask(abilityInfo);
|
||||||
PreCreateProcessName(const_cast<AbilityRequest &>(abilityRequest));
|
PreCreateProcessName(abilityRequest);
|
||||||
specifiedRequestMap_.emplace(specifiedRequestId_, abilityRequest);
|
specifiedRequestMap_.emplace(specifiedRequestId_, abilityRequest);
|
||||||
DelayedSingleton<AppScheduler>::GetInstance()->StartSpecifiedAbility(
|
DelayedSingleton<AppScheduler>::GetInstance()->StartSpecifiedAbility(
|
||||||
abilityRequest.want, abilityRequest.abilityInfo, specifiedRequestId_);
|
abilityRequest.want, abilityRequest.abilityInfo, specifiedRequestId_);
|
||||||
@ -373,7 +390,6 @@ int UIAbilityLifecycleManager::NotifySCBToStartUIAbility(const AbilityRequest &a
|
|||||||
}
|
}
|
||||||
auto sessionInfo = CreateSessionInfo(abilityRequest);
|
auto sessionInfo = CreateSessionInfo(abilityRequest);
|
||||||
sessionInfo->requestCode = abilityRequest.requestCode;
|
sessionInfo->requestCode = abilityRequest.requestCode;
|
||||||
auto isCreating = abilityRequest.want.GetBoolParam(Want::CREATE_APP_INSTANCE_KEY, false);
|
|
||||||
if (abilityInfo.applicationInfo.multiAppMode.multiAppModeType != AppExecFwk::MultiAppModeType::MULTI_INSTANCE ||
|
if (abilityInfo.applicationInfo.multiAppMode.multiAppModeType != AppExecFwk::MultiAppModeType::MULTI_INSTANCE ||
|
||||||
!isCreating) {
|
!isCreating) {
|
||||||
sessionInfo->persistentId = GetPersistentIdByAbilityRequest(abilityRequest, sessionInfo->reuse);
|
sessionInfo->persistentId = GetPersistentIdByAbilityRequest(abilityRequest, sessionInfo->reuse);
|
||||||
@ -2652,12 +2668,13 @@ int32_t UIAbilityLifecycleManager::UpdateSessionInfoBySCB(std::list<SessionInfo>
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIAbilityLifecycleManager::SignRestartAppFlag(int32_t uid, bool isAppRecovery)
|
void UIAbilityLifecycleManager::SignRestartAppFlag(int32_t uid, const std::string &instanceKey, bool isAppRecovery)
|
||||||
{
|
{
|
||||||
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
||||||
auto tempSessionAbilityMap = sessionAbilityMap_;
|
auto tempSessionAbilityMap = sessionAbilityMap_;
|
||||||
for (auto &[sessionId, abilityRecord] : tempSessionAbilityMap) {
|
for (auto &[sessionId, abilityRecord] : tempSessionAbilityMap) {
|
||||||
if (abilityRecord == nullptr || abilityRecord->GetUid() != uid) {
|
if (abilityRecord == nullptr || abilityRecord->GetUid() != uid ||
|
||||||
|
abilityRecord->GetInstanceKey() != instanceKey) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
abilityRecord->SetRestartAppFlag(true);
|
abilityRecord->SetRestartAppFlag(true);
|
||||||
|
@ -231,5 +231,23 @@ int32_t AbilityPermissionUtil::CheckMultiInstanceKeyForExtension(const AbilityRe
|
|||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbilityPermissionUtil::VerifyCallerToken(AbilityRequest &abilityRequest)
|
||||||
|
{
|
||||||
|
if (abilityRequest.callerToken == nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PermissionVerification::GetInstance()->JudgeCallerIsAllowedToUseSystemAPI()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
abilityRequest.want.SetParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST, true);
|
||||||
|
bool isAppKilling = IN_PROCESS_CALL(DelayedSingleton<AppScheduler>::GetInstance()->IsAppKilling(
|
||||||
|
abilityRequest.callerToken));
|
||||||
|
if (isAppKilling) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "caller killing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} // AAFwk
|
} // AAFwk
|
||||||
} // OHOS
|
} // OHOS
|
@ -40,6 +40,7 @@ constexpr const char* PARAM_RESV_ANCO_CALLER_UID = "ohos.anco.param.callerUid";
|
|||||||
constexpr const char* PARAM_RESV_ANCO_CALLER_BUNDLENAME = "ohos.anco.param.callerBundleName";
|
constexpr const char* PARAM_RESV_ANCO_CALLER_BUNDLENAME = "ohos.anco.param.callerBundleName";
|
||||||
constexpr const char* WANT_PARAMS_APP_RESTART_FLAG = "ohos.aafwk.app.restart";
|
constexpr const char* WANT_PARAMS_APP_RESTART_FLAG = "ohos.aafwk.app.restart";
|
||||||
constexpr const char* CALLER_REQUEST_CODE = "ohos.extra.param.key.callerRequestCode";
|
constexpr const char* CALLER_REQUEST_CODE = "ohos.extra.param.key.callerRequestCode";
|
||||||
|
constexpr const char* IS_SHELL_CALL = "isShellCall";
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCallerInfoUtil &UpdateCallerInfoUtil::GetInstance()
|
UpdateCallerInfoUtil &UpdateCallerInfoUtil::GetInstance()
|
||||||
@ -66,6 +67,8 @@ void UpdateCallerInfoUtil::UpdateCallerInfo(Want& want, const sptr<IRemoteObject
|
|||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
|
||||||
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
|
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
|
||||||
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
||||||
|
want.RemoveParam(IS_SHELL_CALL);
|
||||||
|
want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
|
|
||||||
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||||
if (!abilityRecord) {
|
if (!abilityRecord) {
|
||||||
@ -145,6 +148,8 @@ void UpdateCallerInfoUtil::UpdateAsCallerInfoFromToken(Want& want, sptr<IRemoteO
|
|||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
|
||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
|
||||||
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
||||||
|
want.RemoveParam(IS_SHELL_CALL);
|
||||||
|
want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
|
|
||||||
auto abilityRecord = Token::GetAbilityRecordByToken(asCallerSourceToken);
|
auto abilityRecord = Token::GetAbilityRecordByToken(asCallerSourceToken);
|
||||||
if (abilityRecord == nullptr) {
|
if (abilityRecord == nullptr) {
|
||||||
@ -179,6 +184,8 @@ void UpdateCallerInfoUtil::UpdateAsCallerInfoFromCallerRecord(Want& want, sptr<I
|
|||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
|
||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
|
||||||
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
||||||
|
want.RemoveParam(IS_SHELL_CALL);
|
||||||
|
want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
auto callerRecord = Token::GetAbilityRecordByToken(callerToken);
|
auto callerRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||||
CHECK_POINTER(callerRecord);
|
CHECK_POINTER(callerRecord);
|
||||||
auto sourceInfo = callerRecord->GetCallerInfo();
|
auto sourceInfo = callerRecord->GetCallerInfo();
|
||||||
@ -217,6 +224,8 @@ bool UpdateCallerInfoUtil::UpdateAsCallerInfoFromDialog(Want& want)
|
|||||||
want.SetParam(Want::PARAM_RESV_CALLER_ABILITY_NAME, callerAbilityName);
|
want.SetParam(Want::PARAM_RESV_CALLER_ABILITY_NAME, callerAbilityName);
|
||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
|
||||||
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
||||||
|
want.RemoveParam(IS_SHELL_CALL);
|
||||||
|
want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
if (callerBundleName == "") {
|
if (callerBundleName == "") {
|
||||||
want.SetParam(Want::PARAM_RESV_CALLER_NATIVE_NAME,
|
want.SetParam(Want::PARAM_RESV_CALLER_NATIVE_NAME,
|
||||||
dialogCallerWant.GetStringParam(Want::PARAM_RESV_CALLER_NATIVE_NAME));
|
dialogCallerWant.GetStringParam(Want::PARAM_RESV_CALLER_NATIVE_NAME));
|
||||||
@ -244,6 +253,8 @@ void UpdateCallerInfoUtil::UpdateCallerInfoFromToken(Want& want, const sptr<IRem
|
|||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
|
||||||
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
|
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
|
||||||
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
|
||||||
|
want.RemoveParam(IS_SHELL_CALL);
|
||||||
|
want.RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
|
|
||||||
std::string callerBundleName = abilityRecord->GetAbilityInfo().bundleName;
|
std::string callerBundleName = abilityRecord->GetAbilityInfo().bundleName;
|
||||||
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
|
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
|
||||||
|
@ -81,23 +81,5 @@ bool WantUtils::IsAtomicServiceUrl(const Want& want)
|
|||||||
}
|
}
|
||||||
return isAtomicServiceShortUrl;
|
return isAtomicServiceShortUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t WantUtils::GetAppIndex(const Want& want)
|
|
||||||
{
|
|
||||||
int32_t appIndex = want.GetIntParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, -1);
|
|
||||||
if (appIndex == -1) {
|
|
||||||
auto appMgr = AppMgrUtil::GetAppMgr();
|
|
||||||
if (appMgr == nullptr) {
|
|
||||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "AppMgrUtil::GetAppMgr failed");
|
|
||||||
return appIndex;
|
|
||||||
}
|
|
||||||
auto callingPid = IPCSkeleton::GetCallingPid();
|
|
||||||
auto ret = IN_PROCESS_CALL(appMgr->GetAppIndexByPid(callingPid, appIndex));
|
|
||||||
if (ret != ERR_OK) {
|
|
||||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "appMgr GetAppIndexByPid error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return appIndex;
|
|
||||||
}
|
|
||||||
} // namespace AAFwk
|
} // namespace AAFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "window_visibility_changed_listener.h"
|
||||||
|
|
||||||
|
#include "ability_manager_service.h"
|
||||||
|
#include "hilog_tag_wrapper.h"
|
||||||
|
|
||||||
|
namespace OHOS {
|
||||||
|
namespace AAFwk {
|
||||||
|
using namespace OHOS::Rosen;
|
||||||
|
WindowVisibilityChangedListener::WindowVisibilityChangedListener(
|
||||||
|
const std::weak_ptr<AbilityManagerService> &owner, const std::shared_ptr<AAFwk::TaskHandlerWrap> &handler)
|
||||||
|
: owner_(owner), taskHandler_(handler)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void WindowVisibilityChangedListener::OnWindowVisibilityChanged(
|
||||||
|
const std::vector<sptr<WindowVisibilityInfo>> &windowVisibilityInfos)
|
||||||
|
{
|
||||||
|
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||||
|
if (windowVisibilityInfos.empty()) {
|
||||||
|
TAG_LOGW(AAFwkTag::ABILITYMGR, "windowVisibilityInfo is empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskHandler_ == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "null taskHandler");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto task = [inner = owner_, windowVisibilityInfos] {
|
||||||
|
auto owner = inner.lock();
|
||||||
|
if (owner == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::ABILITYMGR, "get fail");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
owner->HandleWindowVisibilityChanged(windowVisibilityInfos);
|
||||||
|
};
|
||||||
|
taskHandler_->SubmitTask(task);
|
||||||
|
}
|
||||||
|
} // namespace AAFwk
|
||||||
|
} // namespace OHOS
|
@ -683,10 +683,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief mark a process which is going restart.
|
* @brief mark a process which is going restart.
|
||||||
* @param uid the uid of the process.
|
* @param uid the uid of the process.
|
||||||
|
* @param instanceKey the instance key of the process.
|
||||||
*
|
*
|
||||||
* @return Returns ERR_OK on success, others on failure.
|
* @return Returns ERR_OK on success, others on failure.
|
||||||
*/
|
*/
|
||||||
int32_t SignRestartAppFlag(int32_t uid) override;
|
int32_t SignRestartAppFlag(int32_t uid, const std::string &instanceKey) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get appRunningUniqueId by pid.
|
* Get appRunningUniqueId by pid.
|
||||||
@ -772,7 +773,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void RestartResidentProcessDependedOnWeb() override;
|
virtual void RestartResidentProcessDependedOnWeb() override;
|
||||||
|
|
||||||
int32_t GetAppIndexByPid(pid_t pid, int32_t &appIndex) override;
|
virtual int32_t KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
|
const std::string& reason) override;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Init, Initialize application services.
|
* Init, Initialize application services.
|
||||||
|
@ -314,6 +314,8 @@ public:
|
|||||||
virtual int32_t KillApplicationSelf(const bool clearPageStack = false,
|
virtual int32_t KillApplicationSelf(const bool clearPageStack = false,
|
||||||
const std::string& reason = "KillApplicationSelf");
|
const std::string& reason = "KillApplicationSelf");
|
||||||
|
|
||||||
|
int32_t KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack, const std::string& reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* KillApplicationByUserId, kill the application by user ID.
|
* KillApplicationByUserId, kill the application by user ID.
|
||||||
*
|
*
|
||||||
@ -1237,9 +1239,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Mark processes of the uid as the app is going to be restarted.
|
* Mark processes of the uid as the app is going to be restarted.
|
||||||
*/
|
*/
|
||||||
int32_t SignRestartAppFlag(int32_t uid);
|
int32_t SignRestartAppFlag(int32_t uid, const std::string &instanceKey);
|
||||||
|
|
||||||
int32_t GetAppIndexByPid(pid_t pid, int32_t &appIndex) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set application assertion pause state.
|
* Set application assertion pause state.
|
||||||
@ -1402,8 +1402,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
void RestartResidentProcess(std::shared_ptr<AppRunningRecord> appRecord);
|
void RestartResidentProcess(std::shared_ptr<AppRunningRecord> appRecord);
|
||||||
|
|
||||||
bool CheckLoadAbilityConditions(const sptr<IRemoteObject> &token,
|
bool CheckLoadAbilityConditions(std::shared_ptr<AAFwk::Want> want,
|
||||||
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo);
|
std::shared_ptr<AbilityRuntime::LoadParam> loadParam, const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||||
|
const std::shared_ptr<ApplicationInfo> &appInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* query bundle info for the given bundleName
|
* query bundle info for the given bundleName
|
||||||
@ -1471,7 +1472,8 @@ private:
|
|||||||
void StartProcess(const std::string &appName, const std::string &processName, uint32_t startFlags,
|
void StartProcess(const std::string &appName, const std::string &processName, uint32_t startFlags,
|
||||||
std::shared_ptr<AppRunningRecord> appRecord, const int uid, const BundleInfo &bundleInfo,
|
std::shared_ptr<AppRunningRecord> appRecord, const int uid, const BundleInfo &bundleInfo,
|
||||||
const std::string &bundleName, const int32_t bundleIndex, bool appExistFlag = true,
|
const std::string &bundleName, const int32_t bundleIndex, bool appExistFlag = true,
|
||||||
bool isPreload = false, const std::string &moduleName = "", const std::string &abilityName = "",
|
bool isPreload = false, AppExecFwk::PreloadMode preloadMode = AppExecFwk::PreloadMode::PRE_MAKE,
|
||||||
|
const std::string &moduleName = "", const std::string &abilityName = "",
|
||||||
bool strictMode = false, sptr<IRemoteObject> token = nullptr,
|
bool strictMode = false, sptr<IRemoteObject> token = nullptr,
|
||||||
std::shared_ptr<AAFwk::Want> want = nullptr,
|
std::shared_ptr<AAFwk::Want> want = nullptr,
|
||||||
ExtensionAbilityType ExtensionAbilityType = ExtensionAbilityType::UNSPECIFIED);
|
ExtensionAbilityType ExtensionAbilityType = ExtensionAbilityType::UNSPECIFIED);
|
||||||
@ -1625,6 +1627,8 @@ private:
|
|||||||
void AfterLoadAbility(std::shared_ptr<AppRunningRecord> appRecord, std::shared_ptr<AbilityInfo> abilityInfo,
|
void AfterLoadAbility(std::shared_ptr<AppRunningRecord> appRecord, std::shared_ptr<AbilityInfo> abilityInfo,
|
||||||
std::shared_ptr<AbilityRuntime::LoadParam> loadParam);
|
std::shared_ptr<AbilityRuntime::LoadParam> loadParam);
|
||||||
|
|
||||||
|
void RemoveRenderRecordNoAttach(const std::shared_ptr<AppRunningRecord> &hostRecord, int32_t renderPid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* ClearUpApplicationData, clear the application data.
|
* ClearUpApplicationData, clear the application data.
|
||||||
@ -1654,7 +1658,8 @@ private:
|
|||||||
int32_t KillApplicationByBundleName(const std::string &bundleName, const bool clearPageStack = false,
|
int32_t KillApplicationByBundleName(const std::string &bundleName, const bool clearPageStack = false,
|
||||||
const std::string& reason = "KillApplicationByBundleName");
|
const std::string& reason = "KillApplicationByBundleName");
|
||||||
|
|
||||||
bool SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord);
|
bool SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord, bool isPreload,
|
||||||
|
AppExecFwk::PreloadMode preloadMode);
|
||||||
|
|
||||||
bool SendProcessStartFailedEvent(std::shared_ptr<AppRunningRecord> appRecord, ProcessStartFailedReason reason,
|
bool SendProcessStartFailedEvent(std::shared_ptr<AppRunningRecord> appRecord, ProcessStartFailedReason reason,
|
||||||
int32_t subReason);
|
int32_t subReason);
|
||||||
@ -1727,7 +1732,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool NotifyMemMgrPriorityChanged(const std::shared_ptr<AppRunningRecord> appRecord);
|
bool NotifyMemMgrPriorityChanged(const std::shared_ptr<AppRunningRecord> appRecord);
|
||||||
|
|
||||||
void HandlePreloadApplication(const PreloadRequest &request, AppExecFwk::PreloadMode preloadMode);
|
void HandlePreloadApplication(const PreloadRequest &request);
|
||||||
|
|
||||||
std::string GetSpecifiedProcessFlag(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AAFwk::Want> want);
|
std::string GetSpecifiedProcessFlag(std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AAFwk::Want> want);
|
||||||
|
|
||||||
@ -1736,7 +1741,8 @@ private:
|
|||||||
std::shared_ptr<AbilityInfo> abilityInfo, const std::string &processName,
|
std::shared_ptr<AbilityInfo> abilityInfo, const std::string &processName,
|
||||||
const std::string &specifiedProcessFlag, const BundleInfo &bundleInfo,
|
const std::string &specifiedProcessFlag, const BundleInfo &bundleInfo,
|
||||||
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want,
|
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want,
|
||||||
bool appExistFlag, bool isPreload, sptr<IRemoteObject> token = nullptr);
|
bool appExistFlag, bool isPreload, AppExecFwk::PreloadMode preloadMode,
|
||||||
|
sptr<IRemoteObject> token = nullptr);
|
||||||
|
|
||||||
int32_t CreatNewStartMsg(const Want &want, const AbilityInfo &abilityInfo,
|
int32_t CreatNewStartMsg(const Want &want, const AbilityInfo &abilityInfo,
|
||||||
const std::shared_ptr<ApplicationInfo> &appInfo, const std::string &processName,
|
const std::shared_ptr<ApplicationInfo> &appInfo, const std::string &processName,
|
||||||
@ -1776,6 +1782,8 @@ private:
|
|||||||
* @param appRecord indicates the process is going to die.
|
* @param appRecord indicates the process is going to die.
|
||||||
*/
|
*/
|
||||||
void NotifyAppAttachFailed(std::shared_ptr<AppRunningRecord> appRecord);
|
void NotifyAppAttachFailed(std::shared_ptr<AppRunningRecord> appRecord);
|
||||||
|
|
||||||
|
void NotifyLoadAbilityFailed(sptr<IRemoteObject> token);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Notify application status.
|
* Notify application status.
|
||||||
|
@ -32,6 +32,7 @@ struct PreloadRequest {
|
|||||||
BundleInfo bundleInfo;
|
BundleInfo bundleInfo;
|
||||||
HapModuleInfo hapModuleInfo;
|
HapModuleInfo hapModuleInfo;
|
||||||
int32_t appIndex = 0; // not used
|
int32_t appIndex = 0; // not used
|
||||||
|
AppExecFwk::PreloadMode preloadMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AppPreloader {
|
class AppPreloader {
|
||||||
|
@ -254,6 +254,8 @@ public:
|
|||||||
|
|
||||||
bool ProcessExitByBundleNameAndUid(
|
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 = false);
|
||||||
|
bool ProcessExitByTokenIdAndInstance(uint32_t accessTokenId, const std::string &instanceKey, std::list<pid_t> &pids,
|
||||||
|
bool clearPageStack);
|
||||||
bool GetPidsByUserId(int32_t userId, std::list<pid_t> &pids);
|
bool GetPidsByUserId(int32_t userId, std::list<pid_t> &pids);
|
||||||
|
|
||||||
void PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag = false);
|
void PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag = false);
|
||||||
@ -310,7 +312,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int32_t GetAllAppRunningRecordCountByBundleName(const std::string &bundleName);
|
int32_t GetAllAppRunningRecordCountByBundleName(const std::string &bundleName);
|
||||||
|
|
||||||
int32_t SignRestartAppFlag(int32_t uid);
|
int32_t SignRestartAppFlag(int32_t uid, const std::string &instanceKey);
|
||||||
|
|
||||||
int32_t GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId);
|
int32_t GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId);
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ namespace AppExecFwk {
|
|||||||
enum class SpawnConnectionState { STATE_NOT_CONNECT, STATE_CONNECTED, STATE_CONNECT_FAILED };
|
enum class SpawnConnectionState { STATE_NOT_CONNECT, STATE_CONNECTED, STATE_CONNECT_FAILED };
|
||||||
using HspList = std::vector<BaseSharedBundleInfo>;
|
using HspList = std::vector<BaseSharedBundleInfo>;
|
||||||
using DataGroupInfoList = std::vector<DataGroupInfo>;
|
using DataGroupInfoList = std::vector<DataGroupInfo>;
|
||||||
|
using JITPermissionsList = std::vector<std::string>;
|
||||||
const int32_t MAX_FLAG_INDEX = 32;
|
const int32_t MAX_FLAG_INDEX = 32;
|
||||||
const int32_t MAX_PROC_NAME_LEN = 256;
|
const int32_t MAX_PROC_NAME_LEN = 256;
|
||||||
const int32_t START_FLAG_BASE = 1;
|
const int32_t START_FLAG_BASE = 1;
|
||||||
@ -78,6 +79,7 @@ struct AppSpawnStartMsg {
|
|||||||
int32_t childProcessType = CHILD_PROCESS_TYPE_NOT_CHILD;
|
int32_t childProcessType = CHILD_PROCESS_TYPE_NOT_CHILD;
|
||||||
std::map<std::string, int32_t> fds;
|
std::map<std::string, int32_t> fds;
|
||||||
bool isolationMode = false;
|
bool isolationMode = false;
|
||||||
|
JITPermissionsList jitPermissionsList; // list of JIT permissions
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto LEN_PID = sizeof(pid_t);
|
constexpr auto LEN_PID = sizeof(pid_t);
|
||||||
|
@ -19,12 +19,17 @@
|
|||||||
#include "ability_info.h"
|
#include "ability_info.h"
|
||||||
#include "app_spawn_client.h"
|
#include "app_spawn_client.h"
|
||||||
#include "global_constant.h"
|
#include "global_constant.h"
|
||||||
|
#include "hitrace_meter.h"
|
||||||
#include "want.h"
|
#include "want.h"
|
||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
namespace AppExecFwk {
|
namespace AppExecFwk {
|
||||||
namespace AppspawnUtil {
|
namespace AppspawnUtil {
|
||||||
constexpr const char* DLP_PARAMS_INDEX = "ohos.dlp.params.index";
|
constexpr const char* DLP_PARAMS_INDEX = "ohos.dlp.params.index";
|
||||||
|
constexpr const char*
|
||||||
|
JIT_PERMISSION_ALLOW_WRITABLE_CODE_MEMORY = "ohos.permission.kernel.ALLOW_WRITABLE_CODE_MEMORY";
|
||||||
|
constexpr const char*
|
||||||
|
JIT_PERMISSION_DISABLE_CODE_MEMORY_PROTECTION = "ohos.permission.kernel.DISABLE_CODE_MEMORY_PROTECTION";
|
||||||
|
|
||||||
static uint32_t BuildStartFlags(const AAFwk::Want &want, const ApplicationInfo &applicationInfo)
|
static uint32_t BuildStartFlags(const AAFwk::Want &want, const ApplicationInfo &applicationInfo)
|
||||||
{
|
{
|
||||||
@ -84,6 +89,23 @@ static uint32_t BuildStartFlags(const AAFwk::Want &want, const AbilityInfo &abil
|
|||||||
|
|
||||||
return startFlags;
|
return startFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetJITPermissions(uint32_t accessTokenId, JITPermissionsList &jitPermissionsList)
|
||||||
|
{
|
||||||
|
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||||
|
if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(
|
||||||
|
accessTokenId,
|
||||||
|
JIT_PERMISSION_ALLOW_WRITABLE_CODE_MEMORY,
|
||||||
|
false) == Security::AccessToken::PERMISSION_GRANTED) {
|
||||||
|
jitPermissionsList.emplace_back(JIT_PERMISSION_ALLOW_WRITABLE_CODE_MEMORY);
|
||||||
|
}
|
||||||
|
if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(
|
||||||
|
accessTokenId,
|
||||||
|
JIT_PERMISSION_DISABLE_CODE_MEMORY_PROTECTION,
|
||||||
|
false) == Security::AccessToken::PERMISSION_GRANTED) {
|
||||||
|
jitPermissionsList.emplace_back(JIT_PERMISSION_DISABLE_CODE_MEMORY_PROTECTION);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace AppspawnUtil
|
} // namespace AppspawnUtil
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -51,8 +51,9 @@ constexpr const char* SCENEBOARD_ABILITY_NAME = "com.ohos.sceneboard.MainAbility
|
|||||||
constexpr const char* TASK_SCENE_BOARD_ATTACH_TIMEOUT = "sceneBoardAttachTimeoutTask";
|
constexpr const char* TASK_SCENE_BOARD_ATTACH_TIMEOUT = "sceneBoardAttachTimeoutTask";
|
||||||
constexpr const char* TASK_ATTACHED_TO_STATUS_BAR = "AttachedToStatusBar";
|
constexpr const char* TASK_ATTACHED_TO_STATUS_BAR = "AttachedToStatusBar";
|
||||||
constexpr const char* TASK_BLOCK_PROCESS_CACHE_BY_PIDS = "BlockProcessCacheByPids";
|
constexpr const char* TASK_BLOCK_PROCESS_CACHE_BY_PIDS = "BlockProcessCacheByPids";
|
||||||
|
constexpr const char* POWER_OFF_ABILITY = "BlockProcessCacheByPids";
|
||||||
constexpr int32_t SCENE_BOARD_ATTACH_TIMEOUT_TASK_TIME = 1000;
|
constexpr int32_t SCENE_BOARD_ATTACH_TIMEOUT_TASK_TIME = 1000;
|
||||||
constexpr const char* TASK_LOAD_ABILITY = "LoadAbilityTask";
|
constexpr int32_t LOAD_TASK_TIMEOUT = 30000; // ms
|
||||||
}; // namespace
|
}; // namespace
|
||||||
|
|
||||||
AmsMgrScheduler::AmsMgrScheduler(
|
AmsMgrScheduler::AmsMgrScheduler(
|
||||||
@ -109,16 +110,20 @@ void AmsMgrScheduler::LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInf
|
|||||||
amsHandler_->SubmitTask(timeoutTask, TASK_SCENE_BOARD_ATTACH_TIMEOUT, SCENE_BOARD_ATTACH_TIMEOUT_TASK_TIME);
|
amsHandler_->SubmitTask(timeoutTask, TASK_SCENE_BOARD_ATTACH_TIMEOUT, SCENE_BOARD_ATTACH_TIMEOUT_TASK_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abilityInfo->bundleName == AAFwk::AppUtils::GetInstance().GetMigrateClientBundleName()) {
|
AAFwk::TaskAttribute taskAttr{
|
||||||
amsHandler_->SubmitTask(loadAbilityFunc, AAFwk::TaskAttribute{
|
.taskName_ = "LoadAbilityTask",
|
||||||
.taskName_ = TASK_LOAD_ABILITY,
|
|
||||||
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE,
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE,
|
||||||
.taskPriority_ = AAFwk::TaskQueuePriority::IMMEDIATE
|
.timeoutMillis_ = LOAD_TASK_TIMEOUT
|
||||||
});
|
};
|
||||||
return;
|
|
||||||
|
if (abilityInfo->bundleName == AAFwk::AppUtils::GetInstance().GetMigrateClientBundleName()) {
|
||||||
|
taskAttr.taskPriority_ = AAFwk::TaskQueuePriority::IMMEDIATE;
|
||||||
|
}
|
||||||
|
if (abilityInfo->bundleName == SCENE_BOARD_BUNDLE_NAME && abilityInfo->name == POWER_OFF_ABILITY) {
|
||||||
|
taskAttr.insertHead_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
amsHandler_->SubmitTask(loadAbilityFunc);
|
amsHandler_->SubmitTask(loadAbilityFunc, taskAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsMgrScheduler::UpdateAbilityState(const sptr<IRemoteObject> &token, const AbilityState state)
|
void AmsMgrScheduler::UpdateAbilityState(const sptr<IRemoteObject> &token, const AbilityState state)
|
||||||
@ -300,7 +305,7 @@ void AmsMgrScheduler::AbilityAttachTimeOut(const sptr<IRemoteObject> &token)
|
|||||||
auto task = [amsMgrServiceInner = amsMgrServiceInner_, token]() {
|
auto task = [amsMgrServiceInner = amsMgrServiceInner_, token]() {
|
||||||
amsMgrServiceInner->HandleAbilityAttachTimeOut(token);
|
amsMgrServiceInner->HandleAbilityAttachTimeOut(token);
|
||||||
};
|
};
|
||||||
amsHandler_->SubmitTask(task);
|
amsHandler_->SubmitTask(task, "AbilityAttachTimeOut");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsMgrScheduler::PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag)
|
void AmsMgrScheduler::PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag)
|
||||||
@ -315,7 +320,10 @@ void AmsMgrScheduler::PrepareTerminate(const sptr<IRemoteObject> &token, bool cl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto task = [=]() { amsMgrServiceInner_->PrepareTerminate(token, clearMissionFlag); };
|
auto task = [=]() { amsMgrServiceInner_->PrepareTerminate(token, clearMissionFlag); };
|
||||||
amsHandler_->SubmitTask(task, AAFwk::TaskQoS::USER_INTERACTIVE);
|
amsHandler_->SubmitTask(task, {
|
||||||
|
.taskName_ = "PrepareTerminate",
|
||||||
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AmsMgrScheduler::UpdateApplicationInfoInstalled(const std::string &bundleName, const int uid)
|
int32_t AmsMgrScheduler::UpdateApplicationInfoInstalled(const std::string &bundleName, const int uid)
|
||||||
@ -421,7 +429,10 @@ void AmsMgrScheduler::StartSpecifiedAbility(const AAFwk::Want &want, const AppEx
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto task = [=]() { amsMgrServiceInner_->StartSpecifiedAbility(want, abilityInfo, requestId); };
|
auto task = [=]() { amsMgrServiceInner_->StartSpecifiedAbility(want, abilityInfo, requestId); };
|
||||||
amsHandler_->SubmitTask(task, AAFwk::TaskQoS::USER_INTERACTIVE);
|
amsHandler_->SubmitTask(task, {
|
||||||
|
.taskName_ = "StartSpecifiedAbility",
|
||||||
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsMgrScheduler::StartSpecifiedProcess(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo,
|
void AmsMgrScheduler::StartSpecifiedProcess(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo,
|
||||||
@ -437,7 +448,10 @@ void AmsMgrScheduler::StartSpecifiedProcess(const AAFwk::Want &want, const AppEx
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto task = [=]() { amsMgrServiceInner_->StartSpecifiedProcess(want, abilityInfo, requestId); };
|
auto task = [=]() { amsMgrServiceInner_->StartSpecifiedProcess(want, abilityInfo, requestId); };
|
||||||
amsHandler_->SubmitTask(task, AAFwk::TaskQoS::USER_INTERACTIVE);
|
amsHandler_->SubmitTask(task, {
|
||||||
|
.taskName_ = "StartSpecifiedProcess",
|
||||||
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsMgrScheduler::RegisterStartSpecifiedAbilityResponse(const sptr<IStartSpecifiedAbilityResponse> &response)
|
void AmsMgrScheduler::RegisterStartSpecifiedAbilityResponse(const sptr<IStartSpecifiedAbilityResponse> &response)
|
||||||
@ -450,7 +464,7 @@ void AmsMgrScheduler::RegisterStartSpecifiedAbilityResponse(const sptr<IStartSpe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto task = [=]() { amsMgrServiceInner_->RegisterStartSpecifiedAbilityResponse(response); };
|
auto task = [=]() { amsMgrServiceInner_->RegisterStartSpecifiedAbilityResponse(response); };
|
||||||
amsHandler_->SubmitTask(task);
|
amsHandler_->SubmitTask(task, "RegisterStartSpecifiedAbilityResponse");
|
||||||
}
|
}
|
||||||
|
|
||||||
int AmsMgrScheduler::GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application, bool &debug)
|
int AmsMgrScheduler::GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application, bool &debug)
|
||||||
|
@ -97,6 +97,10 @@ bool AppMgrEventUtil::SendProcessStartEvent(const std::shared_ptr<AppRunningReco
|
|||||||
} else {
|
} else {
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "abilities failed");
|
TAG_LOGI(AAFwkTag::APPMGR, "abilities failed");
|
||||||
}
|
}
|
||||||
|
#define START_UP_ABILITY_TYPE_PREMAKE 100
|
||||||
|
if (eventInfo.isPreload) {
|
||||||
|
eventInfo.abilityType = START_UP_ABILITY_TYPE_PREMAKE + eventInfo.preloadMode;
|
||||||
|
}
|
||||||
if (!callerAppRecord) {
|
if (!callerAppRecord) {
|
||||||
Security::AccessToken::NativeTokenInfo nativeTokenInfo = {};
|
Security::AccessToken::NativeTokenInfo nativeTokenInfo = {};
|
||||||
auto token = appRecord->GetCallerTokenId() == -1 ?
|
auto token = appRecord->GetCallerTokenId() == -1 ?
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "app_death_recipient.h"
|
#include "app_death_recipient.h"
|
||||||
#include "app_mgr_constants.h"
|
#include "app_mgr_constants.h"
|
||||||
#include "datetime_ex.h"
|
#include "datetime_ex.h"
|
||||||
|
#include "fd_guard.h"
|
||||||
#include "freeze_util.h"
|
#include "freeze_util.h"
|
||||||
#include "global_constant.h"
|
#include "global_constant.h"
|
||||||
#include "hilog_tag_wrapper.h"
|
#include "hilog_tag_wrapper.h"
|
||||||
@ -42,6 +43,7 @@
|
|||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
namespace AppExecFwk {
|
namespace AppExecFwk {
|
||||||
|
using AAFwk::FdGuard;
|
||||||
constexpr const char* OPTION_KEY_HELP = "-h";
|
constexpr const char* OPTION_KEY_HELP = "-h";
|
||||||
constexpr const char* OPTION_KEY_DUMP_IPC = "--ipc";
|
constexpr const char* OPTION_KEY_DUMP_IPC = "--ipc";
|
||||||
constexpr const char* OPTION_KEY_DUMP_FFRT = "--ffrt";
|
constexpr const char* OPTION_KEY_DUMP_FFRT = "--ffrt";
|
||||||
@ -149,6 +151,7 @@ ErrCode AppMgrService::Init()
|
|||||||
|
|
||||||
taskHandler_ = AAFwk::TaskHandlerWrap::CreateConcurrentQueueHandler("app_mgr_task_queue",
|
taskHandler_ = AAFwk::TaskHandlerWrap::CreateConcurrentQueueHandler("app_mgr_task_queue",
|
||||||
DEFAULT_CONCURRENT_NUMBER);
|
DEFAULT_CONCURRENT_NUMBER);
|
||||||
|
taskHandler_->SetPrintTaskLog(true);
|
||||||
eventHandler_ = std::make_shared<AMSEventHandler>(taskHandler_, appMgrServiceInner_);
|
eventHandler_ = std::make_shared<AMSEventHandler>(taskHandler_, appMgrServiceInner_);
|
||||||
appMgrServiceInner_->SetTaskHandler(taskHandler_);
|
appMgrServiceInner_->SetTaskHandler(taskHandler_);
|
||||||
appMgrServiceInner_->SetEventHandler(eventHandler_);
|
appMgrServiceInner_->SetEventHandler(eventHandler_);
|
||||||
@ -922,7 +925,7 @@ void AppMgrService::ScheduleAcceptWantDone(const int32_t recordId, const AAFwk::
|
|||||||
auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() {
|
auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() {
|
||||||
appMgrServiceInner->ScheduleAcceptWantDone(recordId, want, flag);
|
appMgrServiceInner->ScheduleAcceptWantDone(recordId, want, flag);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task);
|
taskHandler_->SubmitTask(task, "ScheduleAcceptWantDone");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMgrService::ScheduleNewProcessRequestDone(const int32_t recordId, const AAFwk::Want &want,
|
void AppMgrService::ScheduleNewProcessRequestDone(const int32_t recordId, const AAFwk::Want &want,
|
||||||
@ -938,7 +941,10 @@ void AppMgrService::ScheduleNewProcessRequestDone(const int32_t recordId, const
|
|||||||
auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() {
|
auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() {
|
||||||
appMgrServiceInner->ScheduleNewProcessRequestDone(recordId, want, flag);
|
appMgrServiceInner->ScheduleNewProcessRequestDone(recordId, want, flag);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task, AAFwk::TaskQoS::USER_INTERACTIVE);
|
taskHandler_->SubmitTask(task, AAFwk::TaskAttribute{
|
||||||
|
.taskName_ = "ScheduleNewProcessRequestDone",
|
||||||
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppMgrService::GetAbilityRecordsByProcessID(const int pid, std::vector<sptr<IRemoteObject>> &tokens)
|
int AppMgrService::GetAbilityRecordsByProcessID(const int pid, std::vector<sptr<IRemoteObject>> &tokens)
|
||||||
@ -969,13 +975,22 @@ int32_t AppMgrService::PreStartNWebSpawnProcess()
|
|||||||
int32_t AppMgrService::StartRenderProcess(const std::string &renderParam, int32_t ipcFd,
|
int32_t AppMgrService::StartRenderProcess(const std::string &renderParam, int32_t ipcFd,
|
||||||
int32_t sharedFd, int32_t crashFd, pid_t &renderPid, bool isGPU)
|
int32_t sharedFd, int32_t crashFd, pid_t &renderPid, bool isGPU)
|
||||||
{
|
{
|
||||||
|
FdGuard ipcFdGuard(ipcFd);
|
||||||
|
FdGuard sharedFdGuard(sharedFd);
|
||||||
|
FdGuard crashFdGuard(crashFd);
|
||||||
if (!IsReady()) {
|
if (!IsReady()) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
||||||
return ERR_INVALID_OPERATION;
|
return ERR_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
return appMgrServiceInner_->StartRenderProcess(IPCSkeleton::GetCallingPid(),
|
auto result = appMgrServiceInner_->StartRenderProcess(IPCSkeleton::GetCallingPid(),
|
||||||
renderParam, ipcFd, sharedFd, crashFd, renderPid, isGPU);
|
renderParam, ipcFd, sharedFd, crashFd, renderPid, isGPU);
|
||||||
|
if (result == ERR_OK) {
|
||||||
|
ipcFdGuard.Release();
|
||||||
|
sharedFdGuard.Release();
|
||||||
|
crashFdGuard.Release();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMgrService::AttachRenderProcess(const sptr<IRemoteObject> &scheduler)
|
void AppMgrService::AttachRenderProcess(const sptr<IRemoteObject> &scheduler)
|
||||||
@ -1371,11 +1386,22 @@ int32_t AppMgrService::IsAppRunning(const std::string &bundleName, int32_t appCl
|
|||||||
int32_t AppMgrService::StartChildProcess(pid_t &childPid, const ChildProcessRequest &request)
|
int32_t AppMgrService::StartChildProcess(pid_t &childPid, const ChildProcessRequest &request)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||||
|
std::vector<FdGuard> fds;
|
||||||
|
for (const auto &[name, fd] : request.args.fds) {
|
||||||
|
fds.emplace_back(fd);
|
||||||
|
}
|
||||||
if (!IsReady()) {
|
if (!IsReady()) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
||||||
return ERR_INVALID_OPERATION;
|
return ERR_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
return appMgrServiceInner_->StartChildProcess(IPCSkeleton::GetCallingPid(), childPid, request);
|
|
||||||
|
auto result = appMgrServiceInner_->StartChildProcess(IPCSkeleton::GetCallingPid(), childPid, request);
|
||||||
|
if (result == ERR_OK) {
|
||||||
|
for (auto &fd : fds) {
|
||||||
|
fd.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrService::GetChildProcessInfoForSelf(ChildProcessInfo &info)
|
int32_t AppMgrService::GetChildProcessInfoForSelf(ChildProcessInfo &info)
|
||||||
@ -1474,7 +1500,7 @@ int32_t AppMgrService::UpdateRenderState(pid_t renderPid, int32_t state)
|
|||||||
return appMgrServiceInner_->UpdateRenderState(renderPid, state);
|
return appMgrServiceInner_->UpdateRenderState(renderPid, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrService::SignRestartAppFlag(int32_t uid)
|
int32_t AppMgrService::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
if (!IsReady()) {
|
if (!IsReady()) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
||||||
@ -1486,7 +1512,7 @@ int32_t AppMgrService::SignRestartAppFlag(int32_t uid)
|
|||||||
TAG_LOGE(AAFwkTag::APPMGR, "verification failed");
|
TAG_LOGE(AAFwkTag::APPMGR, "verification failed");
|
||||||
return ERR_PERMISSION_DENIED;
|
return ERR_PERMISSION_DENIED;
|
||||||
}
|
}
|
||||||
return appMgrServiceInner_->SignRestartAppFlag(uid);
|
return appMgrServiceInner_->SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrService::GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId)
|
int32_t AppMgrService::GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId)
|
||||||
@ -1667,19 +1693,14 @@ int32_t AppMgrService::CheckIsKiaProcess(pid_t pid, bool &isKia)
|
|||||||
return appMgrServiceInner_->CheckIsKiaProcess(pid, isKia);
|
return appMgrServiceInner_->CheckIsKiaProcess(pid, isKia);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrService::GetAppIndexByPid(pid_t pid, int32_t &appIndex)
|
int32_t AppMgrService::KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
|
const std::string& reason)
|
||||||
{
|
{
|
||||||
bool isCallingPermission =
|
|
||||||
AAFwk::PermissionVerification::GetInstance()->CheckSpecificSystemAbilityAccessPermission(FOUNDATION_PROCESS);
|
|
||||||
if (!isCallingPermission) {
|
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "verification failed");
|
|
||||||
return ERR_PERMISSION_DENIED;
|
|
||||||
}
|
|
||||||
if (!appMgrServiceInner_) {
|
if (!appMgrServiceInner_) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "appMgrServiceInner_ is nullptr");
|
TAG_LOGE(AAFwkTag::APPMGR, "appMgrServiceInner_ is nullptr");
|
||||||
return ERR_INVALID_VALUE;
|
return ERR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
return appMgrServiceInner_->GetAppIndexByPid(pid, appIndex);
|
return appMgrServiceInner_->KillAppSelfWithInstanceKey(instanceKey, clearPageStack, reason);
|
||||||
}
|
}
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -215,6 +215,7 @@ constexpr const char* EVENT_KEY_PID = "PID";
|
|||||||
constexpr const char* EVENT_KEY_PACKAGE_NAME = "PACKAGE_NAME";
|
constexpr const char* EVENT_KEY_PACKAGE_NAME = "PACKAGE_NAME";
|
||||||
constexpr const char* EVENT_KEY_PROCESS_NAME = "PROCESS_NAME";
|
constexpr const char* EVENT_KEY_PROCESS_NAME = "PROCESS_NAME";
|
||||||
constexpr const char* EVENT_KEY_MESSAGE = "MSG";
|
constexpr const char* EVENT_KEY_MESSAGE = "MSG";
|
||||||
|
constexpr const char* EVENT_KEY_FOREGROUND = "FOREGROUND";
|
||||||
|
|
||||||
// Developer mode param
|
// Developer mode param
|
||||||
constexpr const char* DEVELOPER_MODE_STATE = "const.security.developermode.state";
|
constexpr const char* DEVELOPER_MODE_STATE = "const.security.developermode.state";
|
||||||
@ -379,7 +380,9 @@ void AppMgrServiceInner::Init()
|
|||||||
DelayedSingleton<AppStateObserverManager>::GetInstance()->Init();
|
DelayedSingleton<AppStateObserverManager>::GetInstance()->Init();
|
||||||
DelayedSingleton<RenderStateObserverManager>::GetInstance()->Init();
|
DelayedSingleton<RenderStateObserverManager>::GetInstance()->Init();
|
||||||
dfxTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("dfx_freeze_task_queue");
|
dfxTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("dfx_freeze_task_queue");
|
||||||
|
dfxTaskHandler_->SetPrintTaskLog(true);
|
||||||
otherTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("other_app_mgr_task_queue");
|
otherTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("other_app_mgr_task_queue");
|
||||||
|
otherTaskHandler_->SetPrintTaskLog(true);
|
||||||
willKillPidsNum_ = 0;
|
willKillPidsNum_ = 0;
|
||||||
delayKillTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("delay_kill_task_queue");
|
delayKillTaskHandler_ = AAFwk::TaskHandlerWrap::CreateQueueHandler("delay_kill_task_queue");
|
||||||
if (securityModeManager_) {
|
if (securityModeManager_) {
|
||||||
@ -474,12 +477,13 @@ int32_t AppMgrServiceInner::PreloadApplication(const std::string &bundleName, in
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto task = [inner = shared_from_this(), request, preloadMode] () {
|
request.preloadMode = preloadMode;
|
||||||
|
auto task = [inner = shared_from_this(), request] () {
|
||||||
if (!inner) {
|
if (!inner) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "null appMgrServiceInner");
|
TAG_LOGE(AAFwkTag::APPMGR, "null appMgrServiceInner");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
inner->HandlePreloadApplication(request, preloadMode);
|
inner->HandlePreloadApplication(request);
|
||||||
};
|
};
|
||||||
if (!taskHandler_) {
|
if (!taskHandler_) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "null taskHandler_");
|
TAG_LOGE(AAFwkTag::APPMGR, "null taskHandler_");
|
||||||
@ -491,7 +495,7 @@ int32_t AppMgrServiceInner::PreloadApplication(const std::string &bundleName, in
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMgrServiceInner::HandlePreloadApplication(const PreloadRequest &request, AppExecFwk::PreloadMode preloadMode)
|
void AppMgrServiceInner::HandlePreloadApplication(const PreloadRequest &request)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||||
auto abilityInfo = request.abilityInfo;
|
auto abilityInfo = request.abilityInfo;
|
||||||
@ -534,9 +538,9 @@ void AppMgrServiceInner::HandlePreloadApplication(const PreloadRequest &request,
|
|||||||
appRecord = CreateAppRunningRecord(loadParam, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, want);
|
appRecord = CreateAppRunningRecord(loadParam, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, want);
|
||||||
if (appRecord != nullptr) {
|
if (appRecord != nullptr) {
|
||||||
appRecord->SetPreloadState(PreloadState::PRELOADING);
|
appRecord->SetPreloadState(PreloadState::PRELOADING);
|
||||||
appRecord->SetNeedPreloadModule(preloadMode == AppExecFwk::PreloadMode::PRELOAD_MODULE);
|
appRecord->SetNeedPreloadModule(request.preloadMode == AppExecFwk::PreloadMode::PRELOAD_MODULE);
|
||||||
LoadAbilityNoAppRecord(appRecord, false, appInfo, abilityInfo, processName, specifiedProcessFlag, bundleInfo,
|
LoadAbilityNoAppRecord(appRecord, false, appInfo, abilityInfo, processName, specifiedProcessFlag, bundleInfo,
|
||||||
hapModuleInfo, want, appExistFlag, true);
|
hapModuleInfo, want, appExistFlag, true, request.preloadMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,8 +612,9 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, s
|
|||||||
TAG_LOGE(AAFwkTag::APPMGR, "null loadParam");
|
TAG_LOGE(AAFwkTag::APPMGR, "null loadParam");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CheckLoadAbilityConditions(loadParam->token, abilityInfo, appInfo)) {
|
if (!CheckLoadAbilityConditions(want, loadParam, abilityInfo, appInfo)) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "checkLoadAbilityConditions fail");
|
TAG_LOGE(AAFwkTag::APPMGR, "checkLoadAbilityConditions fail");
|
||||||
|
NotifyLoadAbilityFailed(loadParam->token);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (abilityInfo->type == AbilityType::PAGE) {
|
if (abilityInfo->type == AbilityType::PAGE) {
|
||||||
@ -660,6 +665,7 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, s
|
|||||||
appRecord = appRunningManager_->CheckAppRunningRecordIsExist(appInfo->name,
|
appRecord = appRunningManager_->CheckAppRunningRecordIsExist(appInfo->name,
|
||||||
processName, appInfo->uid, bundleInfo, specifiedProcessFlag, &isProcCache, loadParam->instanceKey);
|
processName, appInfo->uid, bundleInfo, specifiedProcessFlag, &isProcCache, loadParam->instanceKey);
|
||||||
if (appRecord && appRecord->IsCaching()) {
|
if (appRecord && appRecord->IsCaching()) {
|
||||||
|
TAG_LOGD(AAFwkTag::APPMGR, "process %{public}s is caching start ability set to blocked", processName.c_str());
|
||||||
appRecord->SetProcessCacheBlocked(true);
|
appRecord->SetProcessCacheBlocked(true);
|
||||||
appRecord = nullptr;
|
appRecord = nullptr;
|
||||||
}
|
}
|
||||||
@ -678,13 +684,15 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr<AbilityInfo> abilityInfo, s
|
|||||||
appRecord = CreateAppRunningRecord(loadParam, appInfo, abilityInfo,
|
appRecord = CreateAppRunningRecord(loadParam, appInfo, abilityInfo,
|
||||||
processName, bundleInfo, hapModuleInfo, want, isKia);
|
processName, bundleInfo, hapModuleInfo, want, isKia);
|
||||||
LoadAbilityNoAppRecord(appRecord, loadParam->isShellCall, appInfo, abilityInfo, processName,
|
LoadAbilityNoAppRecord(appRecord, loadParam->isShellCall, appInfo, abilityInfo, processName,
|
||||||
specifiedProcessFlag, bundleInfo, hapModuleInfo, want, appExistFlag, false, loadParam->token);
|
specifiedProcessFlag, bundleInfo, hapModuleInfo, want, appExistFlag, false,
|
||||||
|
AppExecFwk::PreloadMode::PRESS_DOWN, loadParam->token);
|
||||||
if (ProcessKia(isKia, appRecord, watermarkBusinessName, isWatermarkEnabled) != ERR_OK) {
|
if (ProcessKia(isKia, appRecord, watermarkBusinessName, isWatermarkEnabled) != ERR_OK) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "ProcessKia failed");
|
TAG_LOGE(AAFwkTag::APPMGR, "ProcessKia failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "have apprecord");
|
TAG_LOGI(AAFwkTag::APPMGR, "have apprecord");
|
||||||
|
appRunningManager_->UpdateConfigurationDelayed(appRecord);
|
||||||
if (!isProcCache) {
|
if (!isProcCache) {
|
||||||
SendAppStartupTypeEvent(appRecord, abilityInfo, AppStartType::MULTI_INSTANCE);
|
SendAppStartupTypeEvent(appRecord, abilityInfo, AppStartType::MULTI_INSTANCE);
|
||||||
} else {
|
} else {
|
||||||
@ -727,17 +735,22 @@ void AppMgrServiceInner::AfterLoadAbility(std::shared_ptr<AppRunningRecord> appR
|
|||||||
PerfProfile::GetInstance().Dump();
|
PerfProfile::GetInstance().Dump();
|
||||||
PerfProfile::GetInstance().Reset();
|
PerfProfile::GetInstance().Reset();
|
||||||
|
|
||||||
auto reportLoadTask = [appRecord]() {
|
auto reportLoadTask = [appRecord, abilityRecordId = loadParam->abilityRecordId]() {
|
||||||
auto priorityObj = appRecord->GetPriorityObject();
|
auto priorityObj = appRecord->GetPriorityObject();
|
||||||
if (priorityObj) {
|
if (priorityObj) {
|
||||||
auto timeOut = AbilityRuntime::GlobalConstant::GetLoadTimeOutBase() *
|
auto timeOut = AbilityRuntime::GlobalConstant::GetLoadTimeOutBase() *
|
||||||
AAFwk::AppUtils::GetInstance().GetTimeoutUnitTimeRatio();
|
AAFwk::AppUtils::GetInstance().GetTimeoutUnitTimeRatio();
|
||||||
|
if (appRecord->GetExtensionType() == ExtensionAbilityType::SERVICE) {
|
||||||
|
timeOut = AbilityRuntime::GlobalConstant::GetLoadAndInactiveTimeout() *
|
||||||
|
AAFwk::AppUtils::GetInstance().GetTimeoutUnitTimeRatio();
|
||||||
|
}
|
||||||
|
|
||||||
AAFwk::ResSchedUtil::GetInstance().ReportLoadingEventToRss(AAFwk::LoadingStage::LOAD_BEGIN,
|
AAFwk::ResSchedUtil::GetInstance().ReportLoadingEventToRss(AAFwk::LoadingStage::LOAD_BEGIN,
|
||||||
priorityObj->GetPid(), appRecord->GetUid(), timeOut);
|
priorityObj->GetPid(), appRecord->GetUid(), timeOut, static_cast<int64_t>(abilityRecordId));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (taskHandler_) {
|
if (taskHandler_) {
|
||||||
taskHandler_->SubmitTask(reportLoadTask);
|
taskHandler_->SubmitTask(reportLoadTask, "reportLoadTask");
|
||||||
}
|
}
|
||||||
|
|
||||||
appRecord->UpdateAbilityState(loadParam->token, AbilityState::ABILITY_STATE_CREATE);
|
appRecord->UpdateAbilityState(loadParam->token, AbilityState::ABILITY_STATE_CREATE);
|
||||||
@ -798,10 +811,11 @@ void AppMgrServiceInner::RemoveUIExtensionLauncherItem(std::shared_ptr<AppRunnin
|
|||||||
appRunningManager_->RemoveUIExtensionLauncherItemById(uiExtensionAbilityId);
|
appRunningManager_->RemoveUIExtensionLauncherItemById(uiExtensionAbilityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppMgrServiceInner::CheckLoadAbilityConditions(const sptr<IRemoteObject> &token,
|
bool AppMgrServiceInner::CheckLoadAbilityConditions(std::shared_ptr<AAFwk::Want> want,
|
||||||
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo)
|
std::shared_ptr<AbilityRuntime::LoadParam> loadParam, const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||||
|
const std::shared_ptr<ApplicationInfo> &appInfo)
|
||||||
{
|
{
|
||||||
if (!token || !abilityInfo || !appInfo) {
|
if (!loadParam || !loadParam->token || !abilityInfo || !appInfo) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "param error");
|
TAG_LOGE(AAFwkTag::APPMGR, "param error");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -813,6 +827,22 @@ bool AppMgrServiceInner::CheckLoadAbilityConditions(const sptr<IRemoteObject> &t
|
|||||||
TAG_LOGE(AAFwkTag::APPMGR, "abilityInfo and appInfo have diff appName");
|
TAG_LOGE(AAFwkTag::APPMGR, "abilityInfo and appInfo have diff appName");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool needCheckCallerIsExist = false;
|
||||||
|
if (want) {
|
||||||
|
needCheckCallerIsExist = want->GetBoolParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST, false);
|
||||||
|
want->RemoveParam(Want::PARAMS_NEED_CHECK_CALLER_IS_EXIST);
|
||||||
|
}
|
||||||
|
if (needCheckCallerIsExist && loadParam->preToken) {
|
||||||
|
auto appRecord = GetAppRunningRecordByAbilityToken(loadParam->preToken);
|
||||||
|
if (appRecord == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "preToken not exist");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (appRecord->IsKilling()) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "app is killing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -905,7 +935,8 @@ void AppMgrServiceInner::LoadAbilityNoAppRecord(const std::shared_ptr<AppRunning
|
|||||||
bool isShellCall, std::shared_ptr<ApplicationInfo> appInfo,
|
bool isShellCall, std::shared_ptr<ApplicationInfo> appInfo,
|
||||||
std::shared_ptr<AbilityInfo> abilityInfo, const std::string &processName,
|
std::shared_ptr<AbilityInfo> abilityInfo, const std::string &processName,
|
||||||
const std::string &specifiedProcessFlag, const BundleInfo &bundleInfo, const HapModuleInfo &hapModuleInfo,
|
const std::string &specifiedProcessFlag, const BundleInfo &bundleInfo, const HapModuleInfo &hapModuleInfo,
|
||||||
std::shared_ptr<AAFwk::Want> want, bool appExistFlag, bool isPreload, sptr<IRemoteObject> token)
|
std::shared_ptr<AAFwk::Want> want, bool appExistFlag, bool isPreload, AppExecFwk::PreloadMode preloadMode,
|
||||||
|
sptr<IRemoteObject> token)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "processName:%{public}s, isPreload:%{public}d",
|
TAG_LOGI(AAFwkTag::APPMGR, "processName:%{public}s, isPreload:%{public}d",
|
||||||
@ -927,7 +958,7 @@ void AppMgrServiceInner::LoadAbilityNoAppRecord(const std::shared_ptr<AppRunning
|
|||||||
otherTaskHandler_->SubmitTask([appRecord, abilityInfo, pThis = shared_from_this()]() {
|
otherTaskHandler_->SubmitTask([appRecord, abilityInfo, pThis = shared_from_this()]() {
|
||||||
pThis->OnAppStateChanged(appRecord, ApplicationState::APP_STATE_SET_COLD_START, false, false);
|
pThis->OnAppStateChanged(appRecord, ApplicationState::APP_STATE_SET_COLD_START, false, false);
|
||||||
pThis->SendAppStartupTypeEvent(appRecord, abilityInfo, AppStartType::COLD);
|
pThis->SendAppStartupTypeEvent(appRecord, abilityInfo, AppStartType::COLD);
|
||||||
}, FIRST_FRAME_NOTIFY_TASK_DELAY);
|
}, "AppStateChangedNotify", FIRST_FRAME_NOTIFY_TASK_DELAY);
|
||||||
}
|
}
|
||||||
uint32_t startFlags = (want == nullptr) ? 0 : AppspawnUtil::BuildStartFlags(*want, *abilityInfo);
|
uint32_t startFlags = (want == nullptr) ? 0 : AppspawnUtil::BuildStartFlags(*want, *abilityInfo);
|
||||||
int32_t bundleIndex = 0;
|
int32_t bundleIndex = 0;
|
||||||
@ -937,8 +968,8 @@ void AppMgrServiceInner::LoadAbilityNoAppRecord(const std::shared_ptr<AppRunning
|
|||||||
bool strictMode = (want == nullptr) ? false : want->GetBoolParam(STRICT_MODE, false);
|
bool strictMode = (want == nullptr) ? false : want->GetBoolParam(STRICT_MODE, false);
|
||||||
appRecord->SetStrictMode(strictMode);
|
appRecord->SetStrictMode(strictMode);
|
||||||
StartProcess(abilityInfo->applicationName, processName, startFlags, appRecord,
|
StartProcess(abilityInfo->applicationName, processName, startFlags, appRecord,
|
||||||
appInfo->uid, bundleInfo, appInfo->bundleName, bundleIndex, appExistFlag, isPreload, abilityInfo->moduleName,
|
appInfo->uid, bundleInfo, appInfo->bundleName, bundleIndex, appExistFlag, isPreload, preloadMode,
|
||||||
abilityInfo->name, strictMode, token, want, abilityInfo->extensionAbilityType);
|
abilityInfo->moduleName, abilityInfo->name, strictMode, token, want, abilityInfo->extensionAbilityType);
|
||||||
if (isShellCall) {
|
if (isShellCall) {
|
||||||
std::string perfCmd = (want == nullptr) ? "" : want->GetStringParam(PERF_CMD);
|
std::string perfCmd = (want == nullptr) ? "" : want->GetStringParam(PERF_CMD);
|
||||||
bool isSandboxApp = (want == nullptr) ? false : want->GetBoolParam(ENTER_SANDBOX, false);
|
bool isSandboxApp = (want == nullptr) ? false : want->GetBoolParam(ENTER_SANDBOX, false);
|
||||||
@ -1119,6 +1150,19 @@ void AppMgrServiceInner::NotifyAppAttachFailed(std::shared_ptr<AppRunningRecord>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppMgrServiceInner::NotifyLoadAbilityFailed(sptr<IRemoteObject> token)
|
||||||
|
{
|
||||||
|
CHECK_POINTER_AND_RETURN_LOG(token, "token null.");
|
||||||
|
std::vector<sptr<IRemoteObject>> abilityTokens;
|
||||||
|
abilityTokens.emplace_back(token);
|
||||||
|
std::lock_guard lock(appStateCallbacksLock_);
|
||||||
|
for (const auto &item : appStateCallbacks_) {
|
||||||
|
if (item.callback != nullptr) {
|
||||||
|
item.callback->OnAppRemoteDied(abilityTokens);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppMgrServiceInner::LaunchApplication(const std::shared_ptr<AppRunningRecord> &appRecord)
|
void AppMgrServiceInner::LaunchApplication(const std::shared_ptr<AppRunningRecord> &appRecord)
|
||||||
{
|
{
|
||||||
CHECK_POINTER_AND_RETURN_LOG(appRecord, "appRecord null");
|
CHECK_POINTER_AND_RETURN_LOG(appRecord, "appRecord null");
|
||||||
@ -1327,7 +1371,6 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId)
|
|||||||
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto appRecord = GetAppRunningRecordByAppRecordId(recordId);
|
auto appRecord = GetAppRunningRecordByAppRecordId(recordId);
|
||||||
if (!appRecord) {
|
if (!appRecord) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "get appRecord fail");
|
TAG_LOGE(AAFwkTag::APPMGR, "get appRecord fail");
|
||||||
@ -1363,15 +1406,16 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId)
|
|||||||
|
|
||||||
ApplicationTerminatedSendProcessEvent(appRecord);
|
ApplicationTerminatedSendProcessEvent(appRecord);
|
||||||
taskHandler_->CancelTask("DELAY_KILL_PROCESS_" + std::to_string(recordId));
|
taskHandler_->CancelTask("DELAY_KILL_PROCESS_" + std::to_string(recordId));
|
||||||
|
|
||||||
auto uid = appRecord->GetUid();
|
auto uid = appRecord->GetUid();
|
||||||
|
bool foreground = appRecord->GetState() == ApplicationState::APP_STATE_FOREGROUND ||
|
||||||
|
appRecord->GetState() == ApplicationState::APP_STATE_FOCUS;
|
||||||
auto result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
|
auto result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
|
||||||
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
|
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
|
||||||
EVENT_KEY_PID, std::to_string(eventInfo.pid),
|
EVENT_KEY_PID, std::to_string(eventInfo.pid), EVENT_KEY_PROCESS_NAME, eventInfo.processName,
|
||||||
EVENT_KEY_PROCESS_NAME, eventInfo.processName,
|
EVENT_KEY_MESSAGE, "Kill Reason:app exit", EVENT_KEY_FOREGROUND, foreground);
|
||||||
EVENT_KEY_MESSAGE, "Kill Reason:app exit");
|
|
||||||
TAG_LOGW(AAFwkTag::APPMGR, "hisysevent write result=%{public}d, send [FRAMEWORK,PROCESS_KILL], pid=%{public}d,"
|
TAG_LOGW(AAFwkTag::APPMGR, "hisysevent write result=%{public}d, send [FRAMEWORK,PROCESS_KILL], pid=%{public}d,"
|
||||||
" processName=%{public}s, msg=Kill Reason:app exit", result, eventInfo.pid, eventInfo.processName.c_str());
|
" processName=%{public}s, msg=Kill Reason:app exit, FOREGROUND = %{public}d",
|
||||||
|
result, eventInfo.pid, eventInfo.processName.c_str(), foreground);
|
||||||
NotifyAppRunningStatusEvent(appRecord->GetBundleName(), uid, AbilityRuntime::RunningStatus::APP_RUNNING_STOP);
|
NotifyAppRunningStatusEvent(appRecord->GetBundleName(), uid, AbilityRuntime::RunningStatus::APP_RUNNING_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1576,20 +1620,17 @@ void AppMgrServiceInner::SendProcessExitEventTask(
|
|||||||
eventInfo.pid = pid;
|
eventInfo.pid = pid;
|
||||||
eventInfo.processName = appRecord->GetProcessName();
|
eventInfo.processName = appRecord->GetProcessName();
|
||||||
eventInfo.extensionType = static_cast<int32_t>(appRecord->GetExtensionType());
|
eventInfo.extensionType = static_cast<int32_t>(appRecord->GetExtensionType());
|
||||||
|
eventInfo.exitReason = appRecord->GetExitReason();
|
||||||
|
|
||||||
if (exitResult) {
|
if (exitResult) {
|
||||||
eventInfo.exitResult = EXIT_SUCESS;
|
eventInfo.exitResult = EXIT_SUCESS;
|
||||||
AAFwk::EventReport::SendProcessExitEvent(AAFwk::EventName::PROCESS_EXIT, eventInfo);
|
AAFwk::EventReport::SendProcessExitEvent(AAFwk::EventName::PROCESS_EXIT, eventInfo);
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "time: %{public}" PRId64 ", exitResult: %{public}d, pid: %{public}d",
|
|
||||||
eventInfo.time, eventInfo.exitResult, eventInfo.pid);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--count <= 0) {
|
if (--count <= 0) {
|
||||||
eventInfo.exitResult = EXIT_FAILED;
|
eventInfo.exitResult = EXIT_FAILED;
|
||||||
AAFwk::EventReport::SendProcessExitEvent(AAFwk::EventName::PROCESS_EXIT, eventInfo);
|
AAFwk::EventReport::SendProcessExitEvent(AAFwk::EventName::PROCESS_EXIT, eventInfo);
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "time: %{public}" PRId64 ", exitResult: %{public}d, pid: %{public}d",
|
|
||||||
eventInfo.time, eventInfo.exitResult, eventInfo.pid);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1636,16 +1677,48 @@ int32_t AppMgrServiceInner::KillApplicationSelf(const bool clearPageStack, const
|
|||||||
TAG_LOGI(AAFwkTag::APPMGR, "remote process exited successs");
|
TAG_LOGI(AAFwkTag::APPMGR, "remote process exited successs");
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
int32_t result = ERR_OK;
|
||||||
for (auto iter = pids.begin(); iter != pids.end(); ++iter) {
|
for (auto iter = pids.begin(); iter != pids.end(); ++iter) {
|
||||||
auto result = KillProcessByPid(*iter, reason);
|
auto singleRet = KillProcessByPid(*iter, reason);
|
||||||
if (result < 0) {
|
if (singleRet < 0) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "killApplication fail for bundleName:%{public}s pid:%{public}d",
|
TAG_LOGE(AAFwkTag::APPMGR, "killApplication fail for bundleName:%{public}s pid:%{public}d",
|
||||||
bundleName.c_str(), *iter);
|
bundleName.c_str(), *iter);
|
||||||
|
result = singleRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t AppMgrServiceInner::KillAppSelfWithInstanceKey(const std::string &instanceKey, bool clearPageStack,
|
||||||
|
const std::string& reason)
|
||||||
|
{
|
||||||
|
if (!appRunningManager_) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
||||||
|
return ERR_NO_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t startTime = SystemTimeMillisecond();
|
||||||
|
auto callingTokenId = IPCSkeleton::GetCallingTokenID();
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "callingTokenId value: %{public}d", callingTokenId);
|
||||||
|
std::list<pid_t> pids;
|
||||||
|
if (!appRunningManager_->ProcessExitByTokenIdAndInstance(callingTokenId, instanceKey, pids, clearPageStack)) {
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "not exist");
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
if (WaitForRemoteProcessExit(pids, startTime)) {
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "remote process exited success");
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
int32_t result = ERR_OK;
|
||||||
|
for (auto iter = pids.begin(); iter != pids.end(); ++iter) {
|
||||||
|
auto singleRet = KillProcessByPid(*iter, reason);
|
||||||
|
if (singleRet < 0) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "Failed to kill pid:%{public}d", *iter);
|
||||||
|
result = singleRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t AppMgrServiceInner::KillApplicationByBundleName(
|
int32_t AppMgrServiceInner::KillApplicationByBundleName(
|
||||||
const std::string &bundleName, const bool clearPageStack, const std::string& reason)
|
const std::string &bundleName, const bool clearPageStack, const std::string& reason)
|
||||||
@ -2409,13 +2482,16 @@ int32_t AppMgrServiceInner::KillProcessByPidInner(const pid_t pid, const std::st
|
|||||||
DelayedSingleton<CacheProcessManager>::GetInstance()->OnProcessKilled(appRecord);
|
DelayedSingleton<CacheProcessManager>::GetInstance()->OnProcessKilled(appRecord);
|
||||||
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
|
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
|
||||||
eventInfo.processName = appRecord->GetProcessName();
|
eventInfo.processName = appRecord->GetProcessName();
|
||||||
|
bool foreground = appRecord->GetState() == ApplicationState::APP_STATE_FOREGROUND ||
|
||||||
|
appRecord->GetState() == ApplicationState::APP_STATE_FOCUS;
|
||||||
AAFwk::EventReport::SendAppEvent(AAFwk::EventName::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo);
|
AAFwk::EventReport::SendAppEvent(AAFwk::EventName::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo);
|
||||||
int result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
|
int result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
|
||||||
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, EVENT_KEY_PID, std::to_string(eventInfo.pid),
|
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, EVENT_KEY_PID, std::to_string(eventInfo.pid),
|
||||||
EVENT_KEY_PROCESS_NAME, eventInfo.processName, EVENT_KEY_MESSAGE, killReason);
|
EVENT_KEY_PROCESS_NAME, eventInfo.processName, EVENT_KEY_MESSAGE, killReason,
|
||||||
|
EVENT_KEY_FOREGROUND, foreground);
|
||||||
TAG_LOGW(AAFwkTag::APPMGR, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL], pid="
|
TAG_LOGW(AAFwkTag::APPMGR, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL], pid="
|
||||||
"%{public}d, processName=%{public}s, msg=%{public}s", result, pid, eventInfo.processName.c_str(),
|
"%{public}d, processName=%{public}s, msg=%{public}s, FOREGROUND = %{public}d",
|
||||||
killReason.c_str());
|
result, pid, eventInfo.processName.c_str(), killReason.c_str(), foreground);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3341,6 +3417,9 @@ int32_t AppMgrServiceInner::CreateStartMsg(const std::string &processName, uint3
|
|||||||
|
|
||||||
AAFwk::AutoSyncTaskHandle autoSync(otherTaskHandler_->SubmitTask([&]() {
|
AAFwk::AutoSyncTaskHandle autoSync(otherTaskHandler_->SubmitTask([&]() {
|
||||||
AddMountPermission(bundleInfo.applicationInfo.accessTokenId, startMsg.permissions);
|
AddMountPermission(bundleInfo.applicationInfo.accessTokenId, startMsg.permissions);
|
||||||
|
}, AAFwk::TaskAttribute{
|
||||||
|
.taskName_ = "AddMountPermission",
|
||||||
|
.taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE
|
||||||
}));
|
}));
|
||||||
|
|
||||||
HspList hspList;
|
HspList hspList;
|
||||||
@ -3368,7 +3447,7 @@ int32_t AppMgrServiceInner::CreateStartMsg(const std::string &processName, uint3
|
|||||||
SetAtomicServiceInfo(bundleType, startMsg);
|
SetAtomicServiceInfo(bundleType, startMsg);
|
||||||
SetOverlayInfo(bundleInfo.name, userId, startMsg);
|
SetOverlayInfo(bundleInfo.name, userId, startMsg);
|
||||||
SetAppInfo(bundleInfo, startMsg);
|
SetAppInfo(bundleInfo, startMsg);
|
||||||
|
AppspawnUtil::SetJITPermissions(bundleInfo.applicationInfo.accessTokenId, startMsg.jitPermissionsList);
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "apl: %{public}s, bundleName: %{public}s, startFlags: %{public}d",
|
TAG_LOGI(AAFwkTag::APPMGR, "apl: %{public}s, bundleName: %{public}s, startFlags: %{public}d",
|
||||||
startMsg.apl.c_str(), bundleInfo.name.c_str(), startFlags);
|
startMsg.apl.c_str(), bundleInfo.name.c_str(), startFlags);
|
||||||
|
|
||||||
@ -3432,8 +3511,9 @@ void AppMgrServiceInner::QueryExtensionSandBox(const std::string &moduleName, co
|
|||||||
void AppMgrServiceInner::StartProcess(const std::string &appName, const std::string &processName, uint32_t startFlags,
|
void AppMgrServiceInner::StartProcess(const std::string &appName, const std::string &processName, uint32_t startFlags,
|
||||||
std::shared_ptr<AppRunningRecord> appRecord, const int uid, const BundleInfo &bundleInfo,
|
std::shared_ptr<AppRunningRecord> appRecord, const int uid, const BundleInfo &bundleInfo,
|
||||||
const std::string &bundleName, const int32_t bundleIndex, bool appExistFlag, bool isPreload,
|
const std::string &bundleName, const int32_t bundleIndex, bool appExistFlag, bool isPreload,
|
||||||
const std::string &moduleName, const std::string &abilityName, bool strictMode, sptr<IRemoteObject> token,
|
AppExecFwk::PreloadMode preloadMode, const std::string &moduleName, const std::string &abilityName,
|
||||||
std::shared_ptr<AAFwk::Want> want, ExtensionAbilityType ExtensionAbilityType)
|
bool strictMode, sptr<IRemoteObject> token, std::shared_ptr<AAFwk::Want> want,
|
||||||
|
ExtensionAbilityType ExtensionAbilityType)
|
||||||
{
|
{
|
||||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "bundleName: %{public}s, isPreload: %{public}d", bundleName.c_str(), isPreload);
|
TAG_LOGD(AAFwkTag::APPMGR, "bundleName: %{public}s, isPreload: %{public}d", bundleName.c_str(), isPreload);
|
||||||
@ -3521,7 +3601,7 @@ void AppMgrServiceInner::StartProcess(const std::string &appName, const std::str
|
|||||||
OnAppStarted(appRecord);
|
OnAppStarted(appRecord);
|
||||||
}
|
}
|
||||||
PerfProfile::GetInstance().SetAppForkEndTime(GetTickCount());
|
PerfProfile::GetInstance().SetAppForkEndTime(GetTickCount());
|
||||||
SendProcessStartEvent(appRecord);
|
SendProcessStartEvent(appRecord, isPreload, preloadMode);
|
||||||
ProcessAppDebug(appRecord, appRecord->IsDebugApp());
|
ProcessAppDebug(appRecord, appRecord->IsDebugApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3608,7 +3688,8 @@ bool AppMgrServiceInner::SendCreateAtomicServiceProcessEvent(const std::shared_p
|
|||||||
return AppMgrEventUtil::SendCreateAtomicServiceProcessEvent(callerAppRecord, appRecord, moduleName, abilityName);
|
return AppMgrEventUtil::SendCreateAtomicServiceProcessEvent(callerAppRecord, appRecord, moduleName, abilityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppMgrServiceInner::SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord)
|
bool AppMgrServiceInner::SendProcessStartEvent(const std::shared_ptr<AppRunningRecord> &appRecord, bool isPreload,
|
||||||
|
AppExecFwk::PreloadMode preloadMode)
|
||||||
{
|
{
|
||||||
if (!appRecord) {
|
if (!appRecord) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "appRecord null");
|
TAG_LOGE(AAFwkTag::APPMGR, "appRecord null");
|
||||||
@ -3617,6 +3698,8 @@ bool AppMgrServiceInner::SendProcessStartEvent(const std::shared_ptr<AppRunningR
|
|||||||
AAFwk::EventInfo eventInfo;
|
AAFwk::EventInfo eventInfo;
|
||||||
auto callerPid = appRecord->GetCallerPid() == -1 ? IPCSkeleton::GetCallingPid() : appRecord->GetCallerPid();
|
auto callerPid = appRecord->GetCallerPid() == -1 ? IPCSkeleton::GetCallingPid() : appRecord->GetCallerPid();
|
||||||
auto callerAppRecord = GetAppRunningRecordByPid(callerPid);
|
auto callerAppRecord = GetAppRunningRecordByPid(callerPid);
|
||||||
|
eventInfo.isPreload = isPreload;
|
||||||
|
eventInfo.preloadMode = static_cast<int32_t>(preloadMode);
|
||||||
AppMgrEventUtil::SendProcessStartEvent(callerAppRecord, appRecord, eventInfo);
|
AppMgrEventUtil::SendProcessStartEvent(callerAppRecord, appRecord, eventInfo);
|
||||||
SendReStartProcessEvent(eventInfo, appRecord->GetUid());
|
SendReStartProcessEvent(eventInfo, appRecord->GetUid());
|
||||||
return true;
|
return true;
|
||||||
@ -4643,7 +4726,8 @@ int32_t AppMgrServiceInner::UpdateConfiguration(const Configuration &config, con
|
|||||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "configuration_->CompareDifferent");
|
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "configuration_->CompareDifferent");
|
||||||
configuration_->CompareDifferent(changeKeyV, config);
|
configuration_->CompareDifferent(changeKeyV, config);
|
||||||
}
|
}
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "changeKeyV size: %{public}zu", changeKeyV.size());
|
TAG_LOGI(AAFwkTag::APPMGR, "changeKeyV size: %{public}zu Config: %{public}s",
|
||||||
|
changeKeyV.size(), config.GetName().c_str());
|
||||||
if (config.GetItem(AAFwk::GlobalConfigurationKey::THEME).empty() && changeKeyV.empty()) {
|
if (config.GetItem(AAFwk::GlobalConfigurationKey::THEME).empty() && changeKeyV.empty()) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "changeKeyV empty");
|
TAG_LOGE(AAFwkTag::APPMGR, "changeKeyV empty");
|
||||||
return ERR_INVALID_VALUE;
|
return ERR_INVALID_VALUE;
|
||||||
@ -4783,6 +4867,7 @@ void AppMgrServiceInner::InitGlobalConfiguration()
|
|||||||
configuration_->AddItem(AAFwk::GlobalConfigurationKey::DEVICE_TYPE, deviceType);
|
configuration_->AddItem(AAFwk::GlobalConfigurationKey::DEVICE_TYPE, deviceType);
|
||||||
configuration_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_SIZE_SCALE, "1.0");
|
configuration_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_SIZE_SCALE, "1.0");
|
||||||
configuration_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_WEIGHT_SCALE, "1.0");
|
configuration_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_FONT_WEIGHT_SCALE, "1.0");
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "InitGlobalConfiguration Config: %{public}s", configuration_->GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<AppExecFwk::Configuration> AppMgrServiceInner::GetConfiguration()
|
std::shared_ptr<AppExecFwk::Configuration> AppMgrServiceInner::GetConfiguration()
|
||||||
@ -5379,10 +5464,32 @@ int AppMgrServiceInner::GetRenderProcessTerminationStatus(pid_t renderPid, int &
|
|||||||
TAG_LOGD(AAFwkTag::APPMGR, "Get render process termination status success, renderPid:%{public}d, status:%{public}d",
|
TAG_LOGD(AAFwkTag::APPMGR, "Get render process termination status success, renderPid:%{public}d, status:%{public}d",
|
||||||
renderPid, status);
|
renderPid, status);
|
||||||
hostRecord->RemoveRenderPid(renderPid);
|
hostRecord->RemoveRenderPid(renderPid);
|
||||||
|
RemoveRenderRecordNoAttach(hostRecord, renderPid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppMgrServiceInner::RemoveRenderRecordNoAttach(const std::shared_ptr<AppRunningRecord> &hostRecord,
|
||||||
|
int32_t renderPid)
|
||||||
|
{
|
||||||
|
if (!hostRecord) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "hostRecord null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto renderRecord = hostRecord->GetRenderRecordByPid(renderPid);
|
||||||
|
if (!renderRecord) {
|
||||||
|
TAG_LOGD(AAFwkTag::APPMGR, "renderRecord null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (renderRecord->GetScheduler() == nullptr) {
|
||||||
|
hostRecord->RemoveRenderRecord(renderRecord);
|
||||||
|
{
|
||||||
|
std::lock_guard<ffrt::mutex> lock(renderUidSetLock_);
|
||||||
|
renderUidSet_.erase(renderRecord->GetUid());
|
||||||
|
}
|
||||||
|
DelayedSingleton<AppStateObserverManager>::GetInstance()->OnRenderProcessDied(renderRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppMgrServiceInner::OnRenderRemoteDied(const wptr<IRemoteObject> &remote)
|
void AppMgrServiceInner::OnRenderRemoteDied(const wptr<IRemoteObject> &remote)
|
||||||
{
|
{
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "on render remote died");
|
TAG_LOGE(AAFwkTag::APPMGR, "on render remote died");
|
||||||
@ -5835,6 +5942,7 @@ int32_t AppMgrServiceInner::NotifyAppFault(const FaultData &faultData)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
std::string bundleName = appRecord->GetBundleName();
|
std::string bundleName = appRecord->GetBundleName();
|
||||||
|
std::string processName = appRecord->GetProcessName();
|
||||||
if (AppExecFwk::AppfreezeManager::GetInstance()->IsProcessDebug(pid, bundleName)) {
|
if (AppExecFwk::AppfreezeManager::GetInstance()->IsProcessDebug(pid, bundleName)) {
|
||||||
TAG_LOGW(AAFwkTag::APPMGR,
|
TAG_LOGW(AAFwkTag::APPMGR,
|
||||||
"don't report event and kill:%{public}s, pid:%{public}d, bundleName:%{public}s",
|
"don't report event and kill:%{public}s, pid:%{public}d, bundleName:%{public}s",
|
||||||
@ -5852,22 +5960,23 @@ int32_t AppMgrServiceInner::NotifyAppFault(const FaultData &faultData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto notifyAppTask = [appRecord, pid, callerUid, bundleName, faultData, innerService = shared_from_this()]() {
|
auto notifyAppTask = [appRecord, pid, callerUid, bundleName, processName, faultData,
|
||||||
|
innerService = shared_from_this()]() {
|
||||||
if (faultData.faultType == FaultDataType::APP_FREEZE) {
|
if (faultData.faultType == FaultDataType::APP_FREEZE) {
|
||||||
AppfreezeManager::AppInfo info = {
|
AppfreezeManager::AppInfo info = {
|
||||||
.pid = pid,
|
.pid = pid,
|
||||||
.uid = callerUid,
|
.uid = callerUid,
|
||||||
.bundleName = bundleName,
|
.bundleName = bundleName,
|
||||||
.processName = bundleName,
|
.processName = processName,
|
||||||
};
|
};
|
||||||
AppExecFwk::AppfreezeManager::GetInstance()->AppfreezeHandleWithStack(faultData, info);
|
AppExecFwk::AppfreezeManager::GetInstance()->AppfreezeHandleWithStack(faultData, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAG_LOGW(AAFwkTag::APPMGR,
|
TAG_LOGW(AAFwkTag::APPMGR,
|
||||||
"name: %{public}s, faultType: %{public}d, uid: %{public}d, pid: %{public}d,"
|
"name: %{public}s, faultType: %{public}d, uid: %{public}d, pid: %{public}d, bundleName: %{public}s,"
|
||||||
"bundleName: %{public}s, faultData.forceExit:%{public}d, faultData.waitSaveState:%{public}d",
|
" processName: %{public}s, faultData.forceExit:%{public}d, faultData.waitSaveState:%{public}d",
|
||||||
faultData.errorObject.name.c_str(), faultData.faultType,
|
faultData.errorObject.name.c_str(), faultData.faultType, callerUid, pid, bundleName.c_str(),
|
||||||
callerUid, pid, bundleName.c_str(), faultData.forceExit, faultData.waitSaveState);
|
processName.c_str(), faultData.forceExit, faultData.waitSaveState);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!dfxTaskHandler_) {
|
if (!dfxTaskHandler_) {
|
||||||
@ -6790,7 +6899,8 @@ void AppMgrServiceInner::ClearAppRunningDataForKeepAlive(const std::shared_ptr<A
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto userId = GetUserIdByUid(appRecord->GetUid());
|
auto userId = GetUserIdByUid(appRecord->GetUid());
|
||||||
if (appRecord->IsKeepAliveApp() && (userId == 0 || userId == currentUserId_)) {
|
if (appRecord->IsKeepAliveApp() && (userId == 0 || userId == currentUserId_) &&
|
||||||
|
appRecord->GetBundleName() != SCENE_BOARD_BUNDLE_NAME) {
|
||||||
if (ExitResidentProcessManager::GetInstance().IsKilledForUpgradeWeb(appRecord->GetBundleName())) {
|
if (ExitResidentProcessManager::GetInstance().IsKilledForUpgradeWeb(appRecord->GetBundleName())) {
|
||||||
TAG_LOGI(AAFwkTag::APPMGR, "is killed for upgrade web");
|
TAG_LOGI(AAFwkTag::APPMGR, "is killed for upgrade web");
|
||||||
return;
|
return;
|
||||||
@ -7510,25 +7620,14 @@ int32_t AppMgrServiceInner::UpdateRenderState(pid_t renderPid, int32_t state)
|
|||||||
renderRecord, state);
|
renderRecord, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrServiceInner::SignRestartAppFlag(int32_t uid)
|
int32_t AppMgrServiceInner::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "call.");
|
TAG_LOGD(AAFwkTag::APPMGR, "call.");
|
||||||
if (!appRunningManager_) {
|
if (!appRunningManager_) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
||||||
return ERR_NO_INIT;
|
return ERR_NO_INIT;
|
||||||
}
|
}
|
||||||
return appRunningManager_->SignRestartAppFlag(uid);
|
return appRunningManager_->SignRestartAppFlag(uid, instanceKey);
|
||||||
}
|
|
||||||
|
|
||||||
int32_t AppMgrServiceInner::GetAppIndexByPid(pid_t pid, int32_t &appIndex) const
|
|
||||||
{
|
|
||||||
auto appRecord = GetAppRunningRecordByPid(pid);
|
|
||||||
if (appRecord == nullptr) {
|
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "no appRecord, pid:%{public}d", pid);
|
|
||||||
return ERR_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
appIndex = appRecord->GetAppIndex();
|
|
||||||
return ERR_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppMgrServiceInner::GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId)
|
int32_t AppMgrServiceInner::GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId)
|
||||||
@ -7879,7 +7978,7 @@ void AppMgrServiceInner::SubmitCacheLoadAbilityTask()
|
|||||||
[taskHandler](LoadAbilityTaskFunc loadAbilityFunc) {
|
[taskHandler](LoadAbilityTaskFunc loadAbilityFunc) {
|
||||||
auto LoadAbilityhandler = taskHandler.lock();
|
auto LoadAbilityhandler = taskHandler.lock();
|
||||||
if (LoadAbilityhandler != nullptr && loadAbilityFunc) {
|
if (LoadAbilityhandler != nullptr && loadAbilityFunc) {
|
||||||
LoadAbilityhandler->SubmitTask(loadAbilityFunc);
|
LoadAbilityhandler->SubmitTask(loadAbilityFunc, "loadAbilityFunc");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
loadAbilityTaskFuncList_.clear();
|
loadAbilityTaskFuncList_.clear();
|
||||||
@ -8114,6 +8213,10 @@ bool AppMgrServiceInner::IsProcessContainsOnlyUIAbility(const pid_t pid)
|
|||||||
void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||||
const HapModuleInfo &hapModuleInfo, std::string &processName) const
|
const HapModuleInfo &hapModuleInfo, std::string &processName) const
|
||||||
{
|
{
|
||||||
|
if (abilityInfo == nullptr) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "abilityInfo nullptr");
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto type = abilityInfo->type;
|
auto type = abilityInfo->type;
|
||||||
auto extensionType = abilityInfo->extensionAbilityType;
|
auto extensionType = abilityInfo->extensionAbilityType;
|
||||||
if (type != AppExecFwk::AbilityType::EXTENSION ||
|
if (type != AppExecFwk::AbilityType::EXTENSION ||
|
||||||
@ -8121,10 +8224,13 @@ void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr<Abi
|
|||||||
extensionType == AppExecFwk::ExtensionAbilityType::SERVICE) {
|
extensionType == AppExecFwk::ExtensionAbilityType::SERVICE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto extensionInfo: hapModuleInfo.extensionInfos) {
|
for (const auto& extensionInfo: hapModuleInfo.extensionInfos) {
|
||||||
if (extensionInfo.name == abilityInfo->name && extensionInfo.needCreateSandbox) {
|
if (extensionInfo.name == abilityInfo->name) {
|
||||||
|
if (extensionInfo.needCreateSandbox) {
|
||||||
processName = (processName + ":" + abilityInfo->name);
|
processName = (processName + ":" + abilityInfo->name);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,6 +365,46 @@ bool AppRunningManager::ProcessExitByBundleNameAndUid(
|
|||||||
return (pids.empty() ? false : true);
|
return (pids.empty() ? false : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppRunningManager::ProcessExitByTokenIdAndInstance(uint32_t accessTokenId, const std::string &instanceKey,
|
||||||
|
std::list<pid_t> &pids, bool clearPageStack)
|
||||||
|
{
|
||||||
|
auto appRunningMap = GetAppRunningRecordMap();
|
||||||
|
for (const auto &item : appRunningMap) {
|
||||||
|
const auto &appRecord = item.second;
|
||||||
|
if (appRecord == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto appInfo = appRecord->GetApplicationInfo();
|
||||||
|
if (appInfo == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (appInfo->multiAppMode.multiAppModeType != MultiAppModeType::MULTI_INSTANCE) {
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "not multi-instance");
|
||||||
|
}
|
||||||
|
if (appInfo->accessTokenId != accessTokenId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (appRecord->GetInstanceKey() != instanceKey) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (appRecord->GetPriorityObject() == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pid_t pid = appRecord->GetPriorityObject()->GetPid();
|
||||||
|
if (pid <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pids.push_back(pid);
|
||||||
|
if (clearPageStack) {
|
||||||
|
appRecord->ScheduleClearPageStack();
|
||||||
|
}
|
||||||
|
appRecord->SetKilling();
|
||||||
|
appRecord->ScheduleProcessSecurityExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pids.empty() ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
bool AppRunningManager::GetPidsByBundleNameUserIdAndAppIndex(const std::string &bundleName,
|
bool AppRunningManager::GetPidsByBundleNameUserIdAndAppIndex(const std::string &bundleName,
|
||||||
const int userId, const int appIndex, std::list<pid_t> &pids)
|
const int userId, const int appIndex, std::list<pid_t> &pids)
|
||||||
{
|
{
|
||||||
@ -651,7 +691,10 @@ void AppRunningManager::TerminateAbility(const sptr<IRemoteObject> &token, bool
|
|||||||
}
|
}
|
||||||
#endif //SUPPORT_SCREEN
|
#endif //SUPPORT_SCREEN
|
||||||
auto isLauncherApp = appRecord->GetApplicationInfo()->isLauncherApp;
|
auto isLauncherApp = appRecord->GetApplicationInfo()->isLauncherApp;
|
||||||
if (isLastAbility && (!appRecord->IsKeepAliveApp() ||
|
auto isKeepAliveApp = appRecord->IsKeepAliveApp();
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "TerminateAbility:isLast:%{public}d,keepAlive:%{public}d",
|
||||||
|
isLastAbility, isKeepAliveApp);
|
||||||
|
if (isLastAbility && (!isKeepAliveApp ||
|
||||||
!ExitResidentProcessManager::GetInstance().IsMemorySizeSufficient()) && !isLauncherApp) {
|
!ExitResidentProcessManager::GetInstance().IsMemorySizeSufficient()) && !isLauncherApp) {
|
||||||
auto cacheProcMgr = DelayedSingleton<CacheProcessManager>::GetInstance();
|
auto cacheProcMgr = DelayedSingleton<CacheProcessManager>::GetInstance();
|
||||||
if (cacheProcMgr != nullptr) {
|
if (cacheProcMgr != nullptr) {
|
||||||
@ -666,7 +709,7 @@ void AppRunningManager::TerminateAbility(const sptr<IRemoteObject> &token, bool
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "The ability is the last in the app:%{public}s.", appRecord->GetName().c_str());
|
TAG_LOGI(AAFwkTag::APPMGR, "Terminate last ability in app:%{public}s.", appRecord->GetName().c_str());
|
||||||
appRecord->SetTerminating();
|
appRecord->SetTerminating();
|
||||||
if (clearMissionFlag && appMgrServiceInner != nullptr) {
|
if (clearMissionFlag && appMgrServiceInner != nullptr) {
|
||||||
auto delayTime = appRecord->ExtensionAbilityRecordExists() ?
|
auto delayTime = appRecord->ExtensionAbilityRecordExists() ?
|
||||||
@ -740,11 +783,10 @@ int32_t AppRunningManager::AssignRunningProcessInfoByAppRecord(
|
|||||||
auto appInfo = appRecord->GetApplicationInfo();
|
auto appInfo = appRecord->GetApplicationInfo();
|
||||||
if (appInfo) {
|
if (appInfo) {
|
||||||
info.bundleType = static_cast<int32_t>(appInfo->bundleType);
|
info.bundleType = static_cast<int32_t>(appInfo->bundleType);
|
||||||
|
info.appMode = appInfo->multiAppMode.multiAppModeType;
|
||||||
}
|
}
|
||||||
if (appInfo && (static_cast<int32_t>(appInfo->multiAppMode.multiAppModeType) ==
|
|
||||||
static_cast<int32_t>(MultiAppModeType::APP_CLONE))) {
|
|
||||||
info.appCloneIndex = appRecord->GetAppIndex();
|
info.appCloneIndex = appRecord->GetAppIndex();
|
||||||
}
|
info.instanceKey = appRecord->GetInstanceKey();
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,13 +1413,13 @@ std::shared_ptr<ChildProcessRecord> AppRunningManager::OnChildProcessRemoteDied(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AppRunningManager::SignRestartAppFlag(int32_t uid)
|
int32_t AppRunningManager::SignRestartAppFlag(int32_t uid, const std::string &instanceKey)
|
||||||
{
|
{
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||||
std::lock_guard guard(runningRecordMapMutex_);
|
std::lock_guard guard(runningRecordMapMutex_);
|
||||||
for (const auto &item : appRunningRecordMap_) {
|
for (const auto &item : appRunningRecordMap_) {
|
||||||
const auto &appRecord = item.second;
|
const auto &appRecord = item.second;
|
||||||
if (appRecord == nullptr || appRecord->GetUid() != uid) {
|
if (appRecord == nullptr || appRecord->GetUid() != uid || appRecord->GetInstanceKey() != instanceKey) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TAG_LOGD(AAFwkTag::APPMGR, "sign");
|
TAG_LOGD(AAFwkTag::APPMGR, "sign");
|
||||||
@ -1607,7 +1649,10 @@ bool AppRunningManager::HandleUserRequestClean(const sptr<IRemoteObject> &abilit
|
|||||||
TAG_LOGE(AAFwkTag::APPMGR, "null appRecord");
|
TAG_LOGE(AAFwkTag::APPMGR, "null appRecord");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (appRecord->GetSupportProcessCacheState() == SupportProcessCacheState::SUPPORT) {
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "support porcess cache should not force clean");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
auto abilityRecord = appRecord->GetAbilityRunningRecordByToken(abilityToken);
|
auto abilityRecord = appRecord->GetAbilityRunningRecordByToken(abilityToken);
|
||||||
if (!abilityRecord) {
|
if (!abilityRecord) {
|
||||||
TAG_LOGE(AAFwkTag::APPMGR, "null abilityRecord");
|
TAG_LOGE(AAFwkTag::APPMGR, "null abilityRecord");
|
||||||
@ -1616,8 +1661,7 @@ bool AppRunningManager::HandleUserRequestClean(const sptr<IRemoteObject> &abilit
|
|||||||
abilityRecord->SetUserRequestCleaningStatus();
|
abilityRecord->SetUserRequestCleaningStatus();
|
||||||
|
|
||||||
bool canKill = appRecord->IsAllAbilityReadyToCleanedByUserRequest();
|
bool canKill = appRecord->IsAllAbilityReadyToCleanedByUserRequest();
|
||||||
bool isProcessSupportCache = appRecord->GetSupportProcessCacheState() == SupportProcessCacheState::SUPPORT;
|
if (!canKill || appRecord->IsKeepAliveApp()) {
|
||||||
if (!canKill || isProcessSupportCache ||appRecord->IsKeepAliveApp()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1661,6 +1705,9 @@ int32_t AppRunningManager::UpdateConfigurationDelayed(const std::shared_ptr<AppR
|
|||||||
auto it = updateConfigurationDelayedMap_.find(appRecord->GetRecordId());
|
auto it = updateConfigurationDelayedMap_.find(appRecord->GetRecordId());
|
||||||
if (it != updateConfigurationDelayedMap_.end() && it->second) {
|
if (it != updateConfigurationDelayedMap_.end() && it->second) {
|
||||||
auto delayConfig = appRecord->GetDelayConfiguration();
|
auto delayConfig = appRecord->GetDelayConfiguration();
|
||||||
|
if (delayConfig == nullptr) {
|
||||||
|
appRecord->ResetDelayConfiguration();
|
||||||
|
}
|
||||||
TAG_LOGI(AAFwkTag::APPKIT, "delayConfig: %{public}s", delayConfig->GetName().c_str());
|
TAG_LOGI(AAFwkTag::APPKIT, "delayConfig: %{public}s", delayConfig->GetName().c_str());
|
||||||
result = appRecord->UpdateConfiguration(*delayConfig);
|
result = appRecord->UpdateConfiguration(*delayConfig);
|
||||||
appRecord->ResetDelayConfiguration();
|
appRecord->ResetDelayConfiguration();
|
||||||
|
@ -1177,6 +1177,9 @@ void AppRunningRecord::TerminateAbility(const sptr<IRemoteObject> &token, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto abilityRecord = GetAbilityRunningRecordByToken(token);
|
auto abilityRecord = GetAbilityRunningRecordByToken(token);
|
||||||
|
if (abilityRecord) {
|
||||||
|
TAG_LOGI(AAFwkTag::APPMGR, "TerminateAbility:%{public}s", abilityRecord->GetName().c_str());
|
||||||
|
}
|
||||||
if (!isTimeout) {
|
if (!isTimeout) {
|
||||||
StateChangedNotifyObserver(
|
StateChangedNotifyObserver(
|
||||||
abilityRecord, static_cast<int32_t>(AbilityState::ABILITY_STATE_TERMINATED), true, false);
|
abilityRecord, static_cast<int32_t>(AbilityState::ABILITY_STATE_TERMINATED), true, false);
|
||||||
|
@ -38,6 +38,10 @@ constexpr const char* VERSION_PREFIX = "v";
|
|||||||
constexpr const char* APPSPAWN_CLIENT_USER_NAME = "APP_MANAGER_SERVICE";
|
constexpr const char* APPSPAWN_CLIENT_USER_NAME = "APP_MANAGER_SERVICE";
|
||||||
constexpr int32_t RIGHT_SHIFT_STEP = 1;
|
constexpr int32_t RIGHT_SHIFT_STEP = 1;
|
||||||
constexpr int32_t START_FLAG_TEST_NUM = 1;
|
constexpr int32_t START_FLAG_TEST_NUM = 1;
|
||||||
|
constexpr const char* JITPERMISSIONSLIST_NAME = "name";
|
||||||
|
constexpr const char* JITPERMISSIONSLIST_NAME_VALUE = "JITPermissions";
|
||||||
|
constexpr const char* JITPERMISSIONSLIST_COUNT = "ohos.encaps.count";
|
||||||
|
constexpr const char* JITPERMISSIONSLIST_PERMISSIONS_NAME = "permissions";
|
||||||
}
|
}
|
||||||
AppSpawnClient::AppSpawnClient(bool isNWebSpawn)
|
AppSpawnClient::AppSpawnClient(bool isNWebSpawn)
|
||||||
{
|
{
|
||||||
@ -145,6 +149,17 @@ static std::string DumpHspListToJson(const HspList &hspList)
|
|||||||
return hspListJson.dump();
|
return hspListJson.dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string DumpJITPermissionListToJson(const JITPermissionsList &jitPermissionsList)
|
||||||
|
{
|
||||||
|
nlohmann::json jitPermissionsListJson;
|
||||||
|
jitPermissionsListJson[JITPERMISSIONSLIST_NAME] = JITPERMISSIONSLIST_NAME_VALUE;
|
||||||
|
jitPermissionsListJson[JITPERMISSIONSLIST_COUNT] = jitPermissionsList.size();
|
||||||
|
for (auto& jitPermission : jitPermissionsList) {
|
||||||
|
jitPermissionsListJson[JITPERMISSIONSLIST_PERMISSIONS_NAME].emplace_back(jitPermission);
|
||||||
|
}
|
||||||
|
return jitPermissionsListJson.dump();
|
||||||
|
}
|
||||||
|
|
||||||
static std::string DumpAppEnvToJson(const std::map<std::string, std::string> &appEnv)
|
static std::string DumpAppEnvToJson(const std::map<std::string, std::string> &appEnv)
|
||||||
{
|
{
|
||||||
nlohmann::json appEnvJson;
|
nlohmann::json appEnvJson;
|
||||||
@ -154,15 +169,6 @@ static std::string DumpAppEnvToJson(const std::map<std::string, std::string> &ap
|
|||||||
return appEnvJson.dump();
|
return appEnvJson.dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string DumpExtensionSandboxDirsToJson(const std::map<std::string, std::string> &extensionSandboxDirs)
|
|
||||||
{
|
|
||||||
nlohmann::json extensionSandboxDirsJson;
|
|
||||||
for (auto &[userId, sandboxDir] : extensionSandboxDirs) {
|
|
||||||
extensionSandboxDirsJson[userId] = sandboxDir;
|
|
||||||
}
|
|
||||||
return extensionSandboxDirsJson.dump();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t AppSpawnClient::SetDacInfo(const AppSpawnStartMsg &startMsg, AppSpawnReqMsgHandle reqHandle)
|
int32_t AppSpawnClient::SetDacInfo(const AppSpawnStartMsg &startMsg, AppSpawnReqMsgHandle reqHandle)
|
||||||
{
|
{
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
@ -350,6 +356,16 @@ int32_t AppSpawnClient::AppspawnSetExtMsgMore(const AppSpawnStartMsg &startMsg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!startMsg.jitPermissionsList.empty()) {
|
||||||
|
std::string jitPermissionsStr = DumpJITPermissionListToJson(startMsg.jitPermissionsList);
|
||||||
|
ret = AppSpawnReqMsgAddStringInfo(reqHandle, MSG_EXT_NAME_JIT_PERMISSIONS, jitPermissionsStr.c_str());
|
||||||
|
if (ret) {
|
||||||
|
TAG_LOGE(AAFwkTag::APPMGR, "fail, ret: %{public}d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
TAG_LOGD(AAFwkTag::APPMGR, "Send JIT Permission: %{public}s", jitPermissionsStr.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ void WindowFocusChangedListener::OnFocused(const sptr<FocusChangeInfo> &focusCha
|
|||||||
}
|
}
|
||||||
owner->HandleFocused(focusChangeInfo);
|
owner->HandleFocused(focusChangeInfo);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task);
|
taskHandler_->SubmitTask(task, "WindowFocusChangedListener::OnFocused");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void WindowFocusChangedListener::OnUnfocused(const sptr<FocusChangeInfo> &focusC
|
|||||||
}
|
}
|
||||||
owner->HandleUnfocused(focusChangeInfo);
|
owner->HandleUnfocused(focusChangeInfo);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task);
|
taskHandler_->SubmitTask(task, "WindowFocusChangedListener::OnUnfocused");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // SUPPORT_SCREEN
|
#endif // SUPPORT_SCREEN
|
||||||
|
@ -50,7 +50,7 @@ void WindowPidVisibilityChangedListener::NotifyWindowPidVisibilityChanged(
|
|||||||
}
|
}
|
||||||
serviceInner->HandleWindowPidVisibilityChanged(windowPidVisibilityInfo);
|
serviceInner->HandleWindowPidVisibilityChanged(windowPidVisibilityInfo);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task);
|
taskHandler_->SubmitTask(task, "NotifyWindowPidVisibilityChanged");
|
||||||
}
|
}
|
||||||
#endif // SUPPORT_SCREEN
|
#endif // SUPPORT_SCREEN
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
|
@ -49,7 +49,7 @@ void WindowVisibilityChangedListener::OnWindowVisibilityChanged(
|
|||||||
}
|
}
|
||||||
serviceInner->HandleWindowVisibilityChanged(windowVisibilityInfos);
|
serviceInner->HandleWindowVisibilityChanged(windowVisibilityInfos);
|
||||||
};
|
};
|
||||||
taskHandler_->SubmitTask(task);
|
taskHandler_->SubmitTask(task, "OnWindowVisibilityChanged");
|
||||||
}
|
}
|
||||||
#endif // SUPPORT_SCREEN
|
#endif // SUPPORT_SCREEN
|
||||||
} // namespace AppExecFwk
|
} // namespace AppExecFwk
|
||||||
|
@ -55,6 +55,9 @@ struct EventInfo {
|
|||||||
int64_t duration = 0;
|
int64_t duration = 0;
|
||||||
int32_t reason = -1;
|
int32_t reason = -1;
|
||||||
int32_t subReason = -1;
|
int32_t subReason = -1;
|
||||||
|
int32_t exitReason = -1;
|
||||||
|
bool isPreload = false;
|
||||||
|
int32_t preloadMode = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EventName {
|
enum class EventName {
|
||||||
|
75
services/common/include/fd_guard.h
Normal file
75
services/common/include/fd_guard.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OHOS_ABILITY_RUNTIME_FD_GUARD_H
|
||||||
|
#define OHOS_ABILITY_RUNTIME_FD_GUARD_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
namespace OHOS {
|
||||||
|
namespace AAFwk {
|
||||||
|
class FdGuard {
|
||||||
|
public:
|
||||||
|
FdGuard() = default;
|
||||||
|
explicit FdGuard(int32_t fd) : fd_(fd) {}
|
||||||
|
~FdGuard()
|
||||||
|
{
|
||||||
|
if (fd_ > -1) {
|
||||||
|
close(fd_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FdGuard(const FdGuard &) = delete;
|
||||||
|
FdGuard(FdGuard &&other) : fd_(other.fd_)
|
||||||
|
{
|
||||||
|
other.fd_ = -1;
|
||||||
|
}
|
||||||
|
void operator=(const FdGuard &) = delete;
|
||||||
|
FdGuard &operator=(FdGuard &&other)
|
||||||
|
{
|
||||||
|
if (fd_ > -1) {
|
||||||
|
close(fd_);
|
||||||
|
}
|
||||||
|
fd_ = other.fd_;
|
||||||
|
other.fd_ = -1;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t GetFd() const
|
||||||
|
{
|
||||||
|
return fd_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Release()
|
||||||
|
{
|
||||||
|
auto ret = fd_;
|
||||||
|
fd_ = -1;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
if (fd_ > -1) {
|
||||||
|
close(fd_);
|
||||||
|
}
|
||||||
|
fd_ = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32_t fd_ = -1;
|
||||||
|
};
|
||||||
|
} // AAFwk
|
||||||
|
} // OHOS
|
||||||
|
#endif // OHOS_ABILITY_RUNTIME_FD_GUARD_H
|
@ -50,7 +50,8 @@ public:
|
|||||||
std::string GetThawReasonByAbilityType(const AbilityInfo &abilityInfo);
|
std::string GetThawReasonByAbilityType(const AbilityInfo &abilityInfo);
|
||||||
void GetAllFrozenPidsFromRSS(std::unordered_set<int32_t> &frozenPids);
|
void GetAllFrozenPidsFromRSS(std::unordered_set<int32_t> &frozenPids);
|
||||||
bool CheckShouldForceKillProcess(int32_t pid);
|
bool CheckShouldForceKillProcess(int32_t pid);
|
||||||
void ReportLoadingEventToRss(LoadingStage stage, int32_t pid, int32_t uid, int64_t timeDuration = 0);
|
void ReportLoadingEventToRss(LoadingStage stage, int32_t pid, int32_t uid,
|
||||||
|
int64_t timeDuration = 0, int64_t abilityRecordId = -1);
|
||||||
private:
|
private:
|
||||||
ResSchedUtil() = default;
|
ResSchedUtil() = default;
|
||||||
~ResSchedUtil() = default;
|
~ResSchedUtil() = default;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user