mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 01:10:52 +00:00
!11525 IDE支持UIextension调试
Merge pull request !11525 from chenzexin/1106
This commit is contained in:
commit
ec23c5d516
@ -1100,6 +1100,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user