fix autofill unfocus problems

Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
xinking129
2024-04-09 21:40:44 +08:00
parent 997a7e31ad
commit fbeb6e7acc
2 changed files with 20 additions and 10 deletions
@@ -69,8 +69,11 @@ private:
AbilityBase::ViewData viewData_;
bool isReloadInModal_ = false;
bool isSmartAutoFill_ = false;
bool isOnResult_ = false;
AAFwk::Want want_;
int32_t errCode_ = 0;
AbilityBase::AutoFillType autoFillType_ = AbilityBase::AutoFillType::UNSPECIFIED;
};
} // AbilityRuntime
} // OHOS
#endif // OHOS_ABILITY_RUNTIME_AUTO_FILL_EXTENSION_CALLBACK_H
#endif // OHOS_ABILITY_RUNTIME_AUTO_FILL_EXTENSION_CALLBACK_H
@@ -33,14 +33,10 @@ void AutoFillExtensionCallback::OnResult(int32_t errCode, const AAFwk::Want &wan
TAG_LOGD(AAFwkTag::AUTOFILLMGR, "Called, result code is %{public}d.", errCode);
AutoFillManager::GetInstance().RemoveEvent(eventId_);
CloseModalUIExtension();
if (errCode == AutoFill::AUTO_FILL_SUCCESS) {
SendAutoFillSucess(want);
} else {
auto resultCode = (errCode == AutoFill::AUTO_FILL_CANCEL) ?
AutoFill::AUTO_FILL_CANCEL : AutoFill::AUTO_FILL_FAILED;
SendAutoFillFailed(resultCode);
}
isOnResult_ = true;
want_ = want;
errCode_ = errCode;
}
void AutoFillExtensionCallback::OnRelease(int32_t errCode)
@@ -128,6 +124,17 @@ void AutoFillExtensionCallback::onDestroy()
isReloadInModal_ = false;
return;
}
if (isOnResult_) {
isOnResult_ = false;
if (errCode_ == AutoFill::AUTO_FILL_SUCCESS) {
SendAutoFillSucess(want_);
} else {
auto resultCode = (errCode_ == AutoFill::AUTO_FILL_CANCEL) ?
AutoFill::AUTO_FILL_CANCEL : AutoFill::AUTO_FILL_FAILED;
SendAutoFillFailed(resultCode);
}
return;
}
SendAutoFillFailed(AutoFill::AUTO_FILL_CANCEL);
CloseModalUIExtension();
}
@@ -233,4 +240,4 @@ void AutoFillExtensionCallback::CloseModalUIExtension()
uiContent_ = nullptr;
}
} // namespace AbilityRuntime
} // namespace OHOS
} // namespace OHOS