mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 07:10:19 +00:00
!11542 IDE支持UIextension调试
Merge pull request !11542 from chenzexin/pr_11508
This commit is contained in:
commit
e25616070d
@ -1098,6 +1098,8 @@ public:
|
||||
|
||||
void UpdateDmsCallerInfo(Want &want);
|
||||
|
||||
void SetDebugUIExtension();
|
||||
|
||||
inline std::string GetInstanceKey() const
|
||||
{
|
||||
return instanceKey_;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user