!11525 IDE支持UIextension调试

Merge pull request !11525 from chenzexin/1106
This commit is contained in:
openharmony_ci 2024-11-08 06:16:38 +00:00 committed by Gitee
commit ec23c5d516
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 41 additions and 0 deletions

View File

@ -1100,6 +1100,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

@ -3767,5 +3767,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_LOGE(AAFwkTag::ABILITYMGR, "No caller record");
return;
}
if (!callerRecord->IsDebug() ||
callerRecord->GetApplicationInfo().appProvisionType !=
AppExecFwk::Constants::APP_PROVISION_TYPE_DEBUG) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Invalid to debug UIExtension");
return;
}
auto callerBundleName = callerRecord->GetAbilityInfo().bundleName;
auto isSameApp = callerBundleName == abilityRequest.abilityInfo.bundleName;
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