增加维测日志

Signed-off-by: xlw <xialiangwei1@huawei.com>
Change-Id: Icaae9a715bc8f65fc39d02c353d61a42e4641b35
This commit is contained in:
xlw 2024-06-28 11:32:09 +08:00
parent 8a8b45d033
commit cf93811eb9
9 changed files with 67 additions and 4 deletions

View File

@ -462,6 +462,7 @@ ohos_shared_library("extensionkit_native") {
"eventhandler:libeventhandler", "eventhandler:libeventhandler",
"hilog:libhilog", "hilog:libhilog",
"hitrace:hitrace_meter", "hitrace:hitrace_meter",
"ipc:ipc_core",
"json:nlohmann_json_static", "json:nlohmann_json_static",
"napi:ace_napi", "napi:ace_napi",
] ]

View File

@ -19,13 +19,20 @@
#include "ability_local_record.h" #include "ability_local_record.h"
#include "ability_transaction_callback_info.h" #include "ability_transaction_callback_info.h"
#include "hitrace_meter.h" #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "extension_context.h" #include "extension_context.h"
#include "hilog_tag_wrapper.h" #include "hilog_tag_wrapper.h"
#include "hilog_wrapper.h" #include "hilog_wrapper.h"
#include "ui_extension_utils.h" #include "ui_extension_utils.h"
namespace OHOS { namespace OHOS {
namespace AbilityRuntime { namespace AbilityRuntime {
ExtensionImpl::~ExtensionImpl()
{
TAG_LOGI(AAFwkTag::EXT, "~ExtensionImpl");
}
void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &application, void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record, const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record,
std::shared_ptr<Extension> &extension, std::shared_ptr<Extension> &extension,
@ -48,12 +55,33 @@ void ExtensionImpl::Init(const std::shared_ptr<AppExecFwk::OHOSApplication> &app
extension_->SetExtensionWindowLifeCycleListener( extension_->SetExtensionWindowLifeCycleListener(
sptr<ExtensionWindowLifeCycleImpl>(new ExtensionWindowLifeCycleImpl(token_, shared_from_this()))); sptr<ExtensionWindowLifeCycleImpl>(new ExtensionWindowLifeCycleImpl(token_, shared_from_this())));
} }
if (record->GetAbilityInfo()->name == "com.ohos.callui.ServiceAbility") {
PrintTokenInfo();
}
} }
extension_->Init(record, application, handler, token); extension_->Init(record, application, handler, token);
lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL; lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL;
skipCommandExtensionWithIntent_ = false; 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. * @brief Handling the life cycle switching of Extension.
* *

View File

@ -31,6 +31,7 @@
#include "hilog_tag_wrapper.h" #include "hilog_tag_wrapper.h"
#include "hilog_wrapper.h" #include "hilog_wrapper.h"
#include "hitrace_meter.h" #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "ipc_singleton.h" #include "ipc_singleton.h"
#include "js_runtime_utils.h" #include "js_runtime_utils.h"
#ifdef SUPPORT_SCREEN #ifdef SUPPORT_SCREEN
@ -1000,6 +1001,9 @@ void ContextImpl::SetToken(const sptr<IRemoteObject> &token)
return; return;
} }
token_ = token; token_ = token;
if (GetBundleName() == "com.ohos.callui") {
PrintTokenInfo();
}
} }
sptr<IRemoteObject> ContextImpl::GetToken() sptr<IRemoteObject> ContextImpl::GetToken()
@ -1248,5 +1252,23 @@ int32_t ContextImpl::SetSupportedProcessCacheSelf(bool isSupport)
} }
return appMgrClient->SetSupportedProcessCacheSelf(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 AbilityRuntime
} // namespace OHOS } // namespace OHOS

View File

@ -132,6 +132,9 @@ ErrCode ServiceExtensionContext::StartAbilityWithAccount(const AAFwk::Want &want
TAG_LOGI(AAFwkTag::APPKIT, "accountId: %{public}d, ability: %{public}s, caller: %{public}s", TAG_LOGI(AAFwkTag::APPKIT, "accountId: %{public}d, ability: %{public}s, caller: %{public}s",
accountId, want.GetElement().GetURI().c_str(), callerName.c_str()); accountId, want.GetElement().GetURI().c_str(), callerName.c_str());
(const_cast<Want &>(want)).SetParam(START_ABILITY_TYPE, true); (const_cast<Want &>(want)).SetParam(START_ABILITY_TYPE, true);
if (callerName == "com.ohos.callui.ServiceAbility") {
PrintTokenInfo();
}
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility( ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(
want, token_, ILLEGAL_REQUEST_CODE, accountId); want, token_, ILLEGAL_REQUEST_CODE, accountId);
TAG_LOGD(AAFwkTag::APPKIT, "%{public}s. End calling StartAbilityWithAccount. ret=%{public}d", __func__, err); TAG_LOGD(AAFwkTag::APPKIT, "%{public}s. End calling StartAbilityWithAccount. ret=%{public}d", __func__, err);

View File

@ -39,7 +39,6 @@ std::shared_ptr<C> ExtensionBase<C>::CreateAndInitContext(const std::shared_ptr<
{ {
TAG_LOGD(AAFwkTag::EXT, "begin init base"); TAG_LOGD(AAFwkTag::EXT, "begin init base");
std::shared_ptr<C> context = std::make_shared<C>(); std::shared_ptr<C> context = std::make_shared<C>();
context->SetToken(token);
auto appContext = Context::GetApplicationContext(); auto appContext = Context::GetApplicationContext();
if (appContext == nullptr) { if (appContext == nullptr) {
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext appContext is 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->SetApplicationInfo(appContext->GetApplicationInfo());
context->SetResourceManager(appContext->GetResourceManager()); context->SetResourceManager(appContext->GetResourceManager());
context->SetParentContext(appContext); context->SetParentContext(appContext);
context->SetToken(token);
if (record == nullptr) { if (record == nullptr) {
TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext record is nullptr"); TAG_LOGE(AAFwkTag::EXT, "ServiceExtension::CreateAndInitContext record is nullptr");
return context; return context;

View File

@ -38,7 +38,7 @@ namespace AbilityRuntime {
class ExtensionImpl : public std::enable_shared_from_this<ExtensionImpl> { class ExtensionImpl : public std::enable_shared_from_this<ExtensionImpl> {
public: public:
ExtensionImpl() = default; ExtensionImpl() = default;
virtual ~ExtensionImpl() = default; virtual ~ExtensionImpl();
/** /**
* @brief Init the object. * @brief Init the object.
@ -205,6 +205,8 @@ protected:
private: private:
inline bool UIExtensionAbilityExecuteInsightIntent(const Want &want); inline bool UIExtensionAbilityExecuteInsightIntent(const Want &want);
void PrintTokenInfo() const;
int lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL; int lifecycleState_ = AAFwk::ABILITY_STATE_INITIAL;
sptr<IRemoteObject> token_; sptr<IRemoteObject> token_;
std::shared_ptr<Extension> extension_; std::shared_ptr<Extension> extension_;

View File

@ -364,6 +364,8 @@ public:
int32_t SetSupportedProcessCacheSelf(bool isSupport); int32_t SetSupportedProcessCacheSelf(bool isSupport);
void PrintTokenInfo() const;
static const int EL_DEFAULT = 1; static const int EL_DEFAULT = 1;
protected: protected:

View File

@ -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_BUNDLE_NAME = "com.ohos.permissionmanager";
constexpr const char* GRANT_ABILITY_ABILITY_NAME = "com.ohos.permissionmanager.GrantAbility"; constexpr const char* GRANT_ABILITY_ABILITY_NAME = "com.ohos.permissionmanager.GrantAbility";
constexpr const char* PARAMS_STREAM = "ability.params.stream"; 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_MARK_HEAD = "#";
constexpr const char* MISSION_NAME_SEPARATOR = ":"; constexpr const char* MISSION_NAME_SEPARATOR = ":";
} // namespace AbilityConfig } // namespace AbilityConfig

View File

@ -764,6 +764,7 @@ int AbilityConnectManager::DisconnectAbilityLocked(const sptr<IAbilityConnection
void AbilityConnectManager::TerminateRecord(std::shared_ptr<AbilityRecord> abilityRecord) void AbilityConnectManager::TerminateRecord(std::shared_ptr<AbilityRecord> abilityRecord)
{ {
TAG_LOGI(AAFwkTag::ABILITYMGR, "terminate record called.");
if (!GetAbilityRecordById(abilityRecord->GetRecordId())) { if (!GetAbilityRecordById(abilityRecord->GetRecordId())) {
return; return;
} }
@ -2011,15 +2012,18 @@ void AbilityConnectManager::OnTimeOut(uint32_t msgId, int64_t abilityRecordId)
void AbilityConnectManager::HandleInactiveTimeout(const std::shared_ptr<AbilityRecord> &ability) void AbilityConnectManager::HandleInactiveTimeout(const std::shared_ptr<AbilityRecord> &ability)
{ {
TAG_LOGD(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout start"); TAG_LOGI(AAFwkTag::ABILITYMGR, "HandleInactiveTimeout start");
CHECK_POINTER(ability); CHECK_POINTER(ability);
if (ability->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME) { if (ability->GetAbilityInfo().name == AbilityConfig::LAUNCHER_ABILITY_NAME) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Handle root launcher inactive timeout."); TAG_LOGD(AAFwkTag::ABILITYMGR, "Handle root launcher inactive timeout.");
// terminate the timeout root launcher. // terminate the timeout root launcher.
DelayedSingleton<AppScheduler>::GetInstance()->AttachTimeOut(ability->GetToken()); 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) bool AbilityConnectManager::IsAbilityNeedKeepAlive(const std::shared_ptr<AbilityRecord> &abilityRecord)