!11542 IDE支持UIextension调试

Merge pull request !11542 from chenzexin/pr_11508
This commit is contained in:
openharmony_ci 2024-11-13 02:31:37 +00:00 committed by Gitee
commit e25616070d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 41 additions and 0 deletions

View File

@ -1098,6 +1098,8 @@ public:
void UpdateDmsCallerInfo(Want &want);
void SetDebugUIExtension();
inline std::string GetInstanceKey() const
{
return instanceKey_;

View File

@ -31,6 +31,9 @@ public:
int32_t CreateRecord(
const AAFwk::AbilityRequest &abilityRequest, std::shared_ptr<ExtensionRecord> &extensionRecord) override;
private:
void CreateDebugRecord(
const AAFwk::AbilityRequest &abilityRequest, std::shared_ptr<AAFwk::AbilityRecord> abilityRecord);
};
} // namespace AbilityRuntime
} // namespace OHOS

View File

@ -3739,5 +3739,17 @@ void AbilityRecord::UpdateDmsCallerInfo(Want &want)
want.SetParam(Want::PARAM_RESV_CALLER_APP_IDENTIFIER, want.GetStringParam(DMS_CALLER_APP_IDENTIFIER));
want.RemoveParam(DMS_CALLER_APP_IDENTIFIER);
}
void AbilityRecord::SetDebugUIExtension()
{
if (!UIExtensionUtils::IsUIExtension(GetAbilityInfo().extensionAbilityType)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Not UIExtension");
return;
}
std::lock_guard guard(wantLock_);
want_.SetParam(DEBUG_APP, true);
launchDebugInfo_.isDebugAppSet = true;
launchDebugInfo_.debugApp = true;
}
} // namespace AAFwk
} // namespace OHOS

View File

@ -59,9 +59,33 @@ int32_t UIExtensionRecordFactory::CreateRecord(
if (AAFwk::MultiInstanceUtils::IsMultiInstanceApp(abilityRequest.appInfo)) {
abilityRecord->SetInstanceKey(AAFwk::MultiInstanceUtils::GetValidExtensionInstanceKey(abilityRequest));
}
CreateDebugRecord(abilityRequest, abilityRecord);
extensionRecord = std::make_shared<UIExtensionRecord>(abilityRecord);
extensionRecord->processMode_ = GetExtensionProcessMode(abilityRequest, extensionRecord->isHostSpecified_);
return ERR_OK;
}
void UIExtensionRecordFactory::CreateDebugRecord(
const AAFwk::AbilityRequest &abilityRequest, std::shared_ptr<AAFwk::AbilityRecord> abilityRecord)
{
auto callerRecord = AAFwk::Token::GetAbilityRecordByToken(abilityRequest.callerToken);
if (!callerRecord) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "No caller record");
return;
}
if (!callerRecord->IsDebug() ||
callerRecord->GetApplicationInfo().appProvisionType !=
AppExecFwk::Constants::APP_PROVISION_TYPE_DEBUG) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Not debug UIExtension");
return;
}
auto callerBundleName = callerRecord->GetAbilityInfo().bundleName;
auto isSameApp = strcmp(callerBundleName.c_str(), abilityRequest.abilityInfo.bundleName.c_str()) == 0;
auto isCallerUIAbility = callerRecord->GetAbilityInfo().type == AppExecFwk::AbilityType::PAGE;
if (isSameApp && isCallerUIAbility) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Setting up debug UIExtension");
abilityRecord->SetDebugUIExtension();
}
}
} // namespace AbilityRuntime
} // namespace OHOS