mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 09:21:28 +00:00
增加维测日志
Signed-off-by: xlw <xialiangwei1@huawei.com> Change-Id: Icaae9a715bc8f65fc39d02c353d61a42e4641b35
This commit is contained in:
parent
8a8b45d033
commit
cf93811eb9
@ -462,6 +462,7 @@ ohos_shared_library("extensionkit_native") {
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"ipc:ipc_core",
|
||||
"json:nlohmann_json_static",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
@ -19,13 +19,20 @@
|
||||
#include "ability_local_record.h"
|
||||
#include "ability_transaction_callback_info.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "ipc_object_proxy.h"
|
||||
#include "extension_context.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "ui_extension_utils.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
ExtensionImpl::~ExtensionImpl()
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::EXT, "~ExtensionImpl");
|
||||
}
|
||||
|
||||
void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
|
||||
const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record,
|
||||
std::shared_ptr<Extension> &extension,
|
||||
@ -48,12 +55,33 @@ void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &app
|
||||
extension_->SetExtensionWindowLifeCycleListener(
|
||||
sptr<ExtensionWindowLifeCycleImpl>(new ExtensionWindowLifeCycleImpl(token_, shared_from_this())));
|
||||
}
|
||||
if (record->GetAbilityInfo()->name == "com.ohos.callui.ServiceAbility") {
|
||||
PrintTokenInfo();
|
||||
}
|
||||
}
|
||||
extension_->Init(record, application, handler, token);
|
||||
lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL;
|
||||
skipCommandExtensionWithIntent_ = false;
|
||||
}
|
||||
|
||||
void ExtensionImpl::PrintTokenInfo() const
|
||||
{
|
||||
if (token_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is null");
|
||||
return;
|
||||
}
|
||||
if (!token_->IsProxyObject()) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is not proxy");
|
||||
return;
|
||||
}
|
||||
IPCObjectProxy *tokenProxyObject = reinterpret_cast<IPCObjectProxy *>(token_.GetRefPtr());
|
||||
if (tokenProxyObject != nullptr) {
|
||||
std::string remoteDescriptor = Str16ToStr8(tokenProxyObject->GetInterfaceDescriptor());
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility handle: %{public}d, descriptor: %{public}s",
|
||||
tokenProxyObject->GetHandle(), remoteDescriptor.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handling the life cycle switching of Extension.
|
||||
*
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "ipc_object_proxy.h"
|
||||
#include "ipc_singleton.h"
|
||||
#include "js_runtime_utils.h"
|
||||
#ifdef SUPPORT_SCREEN
|
||||
@ -1000,6 +1001,9 @@ void ContextImpl::SetToken(const sptr<IRemoteObject> &token)
|
||||
return;
|
||||
}
|
||||
token_ = token;
|
||||
if (GetBundleName() == "com.ohos.callui") {
|
||||
PrintTokenInfo();
|
||||
}
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> ContextImpl::GetToken()
|
||||
@ -1248,5 +1252,23 @@ int32_t ContextImpl::SetSupportedProcessCacheSelf(bool isSupport)
|
||||
}
|
||||
return appMgrClient->SetSupportedProcessCacheSelf(isSupport);
|
||||
}
|
||||
|
||||
void ContextImpl::PrintTokenInfo() const
|
||||
{
|
||||
if (token_ == nullptr) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is null");
|
||||
return;
|
||||
}
|
||||
if (!token_->IsProxyObject()) {
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility token is not proxy");
|
||||
return;
|
||||
}
|
||||
IPCObjectProxy *tokenProxyObject = reinterpret_cast<IPCObjectProxy *>(token_.GetRefPtr());
|
||||
if (tokenProxyObject != nullptr) {
|
||||
std::string remoteDescriptor = Str16ToStr8(tokenProxyObject->GetInterfaceDescriptor());
|
||||
TAG_LOGI(AAFwkTag::EXT, "com.ohos.callui.ServiceAbility handle: %{public}d, descriptor: %{public}s",
|
||||
tokenProxyObject->GetHandle(), remoteDescriptor.c_str());
|
||||
}
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -132,6 +132,9 @@ ErrCode ServiceExtensionContext::StartAbilityWithAccount(const AAFwk::Want &want
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "accountId: %{public}d, ability: %{public}s, caller: %{public}s",
|
||||
accountId, want.GetElement().GetURI().c_str(), callerName.c_str());
|
||||
(const_cast<Want &>(want)).SetParam(START_ABILITY_TYPE, true);
|
||||
if (callerName == "com.ohos.callui.ServiceAbility") {
|
||||
PrintTokenInfo();
|
||||
}
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(
|
||||
want, token_, ILLEGAL_REQUEST_CODE, accountId);
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s. End calling StartAbilityWithAccount. ret=%{public}d", __func__, err);
|
||||
|
@ -39,7 +39,6 @@ std::shared_ptr<C> ExtensionBase<C>::CreateAndInitContext(const std::shared_ptr<
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::EXT, "begin init base");
|
||||
std::shared_ptr<C> context = std::make_shared<C>();
|
||||
context->SetToken(token);
|
||||
auto appContext = Context::GetApplicationContext();
|
||||
if (appContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext appContext is nullptr");
|
||||
@ -48,6 +47,7 @@ std::shared_ptr<C> ExtensionBase<C>::CreateAndInitContext(const std::shared_ptr<
|
||||
context->SetApplicationInfo(appContext->GetApplicationInfo());
|
||||
context->SetResourceManager(appContext->GetResourceManager());
|
||||
context->SetParentContext(appContext);
|
||||
context->SetToken(token);
|
||||
if (record == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext record is nullptr");
|
||||
return context;
|
||||
|
@ -38,7 +38,7 @@ namespace AbilityRuntime {
|
||||
class ExtensionImpl : public std::enable_shared_from_this<ExtensionImpl> {
|
||||
public:
|
||||
ExtensionImpl() = default;
|
||||
virtual ~ExtensionImpl() = default;
|
||||
virtual ~ExtensionImpl();
|
||||
|
||||
/**
|
||||
* @brief Init the object.
|
||||
@ -205,6 +205,8 @@ protected:
|
||||
private:
|
||||
inline bool UIExtensionAbilityExecuteInsightIntent(const Want &want);
|
||||
|
||||
void PrintTokenInfo() const;
|
||||
|
||||
int lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL;
|
||||
sptr<IRemoteObject> token_;
|
||||
std::shared_ptr<Extension> extension_;
|
||||
|
@ -364,6 +364,8 @@ public:
|
||||
|
||||
int32_t SetSupportedProcessCacheSelf(bool isSupport);
|
||||
|
||||
void PrintTokenInfo() const;
|
||||
|
||||
static const int EL_DEFAULT = 1;
|
||||
|
||||
protected:
|
||||
|
@ -38,6 +38,7 @@ constexpr const char* SCENEBOARD_ABILITY_NAME = "com.ohos.sceneboard.MainAbility
|
||||
constexpr const char* GRANT_ABILITY_BUNDLE_NAME = "com.ohos.permissionmanager";
|
||||
constexpr const char* GRANT_ABILITY_ABILITY_NAME = "com.ohos.permissionmanager.GrantAbility";
|
||||
constexpr const char* PARAMS_STREAM = "ability.params.stream";
|
||||
constexpr const char* CALLUI_ABILITY_NAME = "com.ohos.callui.ServiceAbility";
|
||||
constexpr const char* MISSION_NAME_MARK_HEAD = "#";
|
||||
constexpr const char* MISSION_NAME_SEPARATOR = ":";
|
||||
} // namespace AbilityConfig
|
||||
|
@ -764,6 +764,7 @@ int AbilityConnectManager::DisconnectAbilityLocked(const sptr<IAbilityConnection
|
||||
|
||||
void AbilityConnectManager::TerminateRecord(std::shared_ptr<AbilityRecord> abilityRecord)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "terminate record called.");
|
||||
if (!GetAbilityRecordById(abilityRecord->GetRecordId())) {
|
||||
return;
|
||||
}
|
||||
@ -2011,15 +2012,18 @@ void AbilityConnectManager::OnTimeOut(uint32_t msgId, int64_t abilityRecordId)
|
||||
|
||||
void AbilityConnectManager::HandleInactiveTimeout(const std::shared_ptr<AbilityRecord> &ability)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout start");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout start");
|
||||
CHECK_POINTER(ability);
|
||||
if (ability->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Handle root launcher inactive timeout.");
|
||||
// terminate the timeout root launcher.
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(ability->GetToken());
|
||||
}
|
||||
if (ability->GetAbilityInfo().name == AbilityConfig::CALLUI_ABILITY_NAME && ability->GetStartId() == 0) {
|
||||
HandleConnectTimeoutTask(ability);
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout end");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout end");
|
||||
}
|
||||
|
||||
bool AbilityConnectManager::IsAbilityNeedKeepAlive(const std::shared_ptr<AbilityRecord> &abilityRecord)
|
||||
|
Loading…
Reference in New Issue
Block a user