mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 01:45:30 -04:00
!268 remove unused form ability code
Merge pull request !268 from zero-cyc/master_1015
This commit is contained in:
@@ -63,12 +63,6 @@ void AceServiceAbility::OnStart(const OHOS::AAFwk::Want& want)
|
||||
{
|
||||
Ability::OnStart(want);
|
||||
LOGI("AceServiceAbility::OnStart called");
|
||||
|
||||
if (type_ == BackendType::FORM) {
|
||||
LOGI("AceServiceAbility::OnStart is form");
|
||||
return;
|
||||
}
|
||||
|
||||
// get url
|
||||
std::string parsedUrl;
|
||||
if (want.HasParameter(URI)) {
|
||||
@@ -116,10 +110,6 @@ void AceServiceAbility::OnStop()
|
||||
sptr<IRemoteObject> AceServiceAbility::OnConnect(const Want& want)
|
||||
{
|
||||
LOGI("AceServiceAbility::OnConnect start");
|
||||
if (type_ == BackendType::FORM) {
|
||||
LOGI("AceServiceAbility::OnConnect is form");
|
||||
return GetFormRemoteObject();
|
||||
}
|
||||
Ability::OnConnect(want);
|
||||
auto ret = Platform::PaContainer::OnConnect(abilityId_, want);
|
||||
if (ret == nullptr) {
|
||||
@@ -146,79 +136,5 @@ void AceServiceAbility::OnCommand(const AAFwk::Want &want, bool restart, int sta
|
||||
LOGI("AceServiceAbility::OnCommand end");
|
||||
}
|
||||
|
||||
OHOS::AppExecFwk::FormProviderInfo AceServiceAbility::OnCreate(const OHOS::AAFwk::Want& want)
|
||||
{
|
||||
LOGI("AceServiceAbility::OnCreate called");
|
||||
// get url
|
||||
std::string parsedUrl;
|
||||
if (want.HasParameter(URI)) {
|
||||
parsedUrl = want.GetStringParam(URI);
|
||||
} else {
|
||||
parsedUrl = "app.js";
|
||||
}
|
||||
|
||||
int32_t wantId = abilityId_;
|
||||
if (want.HasParameter(AppExecFwk::Constants::PARAM_FORM_IDENTITY_KEY)) {
|
||||
std::string wantIdStr = want.GetStringParam(AppExecFwk::Constants::PARAM_FORM_IDENTITY_KEY);
|
||||
wantId = atoi(wantIdStr.c_str());
|
||||
LOGI("AceServiceAbility:: wantId = %{public}s, %{public}d", wantIdStr.c_str(), wantId);
|
||||
} else {
|
||||
LOGE("AceServiceAbility:: has not formId in want");
|
||||
}
|
||||
|
||||
// init service
|
||||
BackendType backendType = BackendType::FORM;
|
||||
Platform::PaContainer::CreateContainer(
|
||||
wantId, backendType, this, std::make_unique<ServicePlatformEventCallback>([this]() { TerminateAbility(); }));
|
||||
|
||||
// get asset
|
||||
auto packagePathStr = GetBundleCodePath();
|
||||
auto moduleInfo = GetHapModuleInfo();
|
||||
if (moduleInfo != nullptr) {
|
||||
packagePathStr += "/" + moduleInfo->name + "/";
|
||||
}
|
||||
auto assetBasePathStr = { std::string("assets/js/default/"), std::string("assets/js/share/") };
|
||||
Platform::PaContainer::AddAssetPath(wantId, packagePathStr, assetBasePathStr);
|
||||
|
||||
// run service
|
||||
Platform::PaContainer::RunPa(wantId, parsedUrl, want);
|
||||
|
||||
OHOS::AppExecFwk::FormProviderInfo formProviderInfo;
|
||||
formProviderInfo.SetFormData(Platform::PaContainer::GetFormData(wantId));
|
||||
std::string formData = formProviderInfo.GetFormData().GetDataString();
|
||||
LOGI("AceServiceAbility::OnCreate return ok, formData: %{public}s", formData.c_str());
|
||||
return formProviderInfo;
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnDelete(const int64_t formId)
|
||||
{
|
||||
Platform::PaContainer::OnDelete(formId);
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnTriggerEvent(const int64_t formId, const std::string& message)
|
||||
{
|
||||
Platform::PaContainer::OnTriggerEvent(formId, message);
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnUpdate(const int64_t formId)
|
||||
{
|
||||
Platform::PaContainer::OnUpdate(formId);
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnCastTemptoNormal(const int64_t formId)
|
||||
{
|
||||
Platform::PaContainer::OnCastTemptoNormal(formId);
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnVisibilityChanged(const std::map<int64_t, int32_t>& formEventsMap)
|
||||
{
|
||||
Platform::PaContainer::OnVisibilityChanged(formEventsMap);
|
||||
}
|
||||
|
||||
void AceServiceAbility::OnAcquireState(const OHOS::AAFwk::Want& want)
|
||||
{
|
||||
Platform::PaContainer::OnAcquireState(want);
|
||||
}
|
||||
|
||||
} // namespace Ace
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -43,21 +43,12 @@ public:
|
||||
void OnDisconnect(const OHOS::AAFwk::Want &want) override;
|
||||
void OnCommand(const AAFwk::Want &want, bool restart, int startId) override;
|
||||
|
||||
virtual OHOS::AppExecFwk::FormProviderInfo OnCreate(const OHOS::AAFwk::Want& want) override;
|
||||
virtual void OnDelete(const int64_t formId) override;
|
||||
virtual void OnTriggerEvent(const int64_t formId, const std::string& message) override;
|
||||
virtual void OnUpdate(const int64_t formId) override;
|
||||
virtual void OnCastTemptoNormal(const int64_t formId) override;
|
||||
virtual void OnVisibilityChanged(const std::map<int64_t, int32_t>& formEventsMap) override;
|
||||
virtual void OnAcquireState(const OHOS::AAFwk::Want& want);
|
||||
|
||||
private:
|
||||
int32_t abilityId_ = 100000;
|
||||
|
||||
static int32_t instanceId_;
|
||||
static const std::string START_PARAMS_KEY;
|
||||
static const std::string URI;
|
||||
BackendType type_ = BackendType::FORM;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
Reference in New Issue
Block a user