mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 09:01:34 +00:00
bugfix: can't get root when closed the app
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
3702cc51a0
commit
1f0c6044a5
@ -133,7 +133,7 @@ public:
|
||||
private:
|
||||
class AccessibleAbilityConnectionDeathRecipient final : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
AccessibleAbilityConnectionDeathRecipient(wptr<AccessibilityAccountData>& accountData,
|
||||
AccessibleAbilityConnectionDeathRecipient(sptr<AccessibilityAccountData> accountData,
|
||||
AppExecFwk::ElementName& elementName)
|
||||
: recipientAccountData_(accountData), recipientElementName_(elementName) {};
|
||||
~AccessibleAbilityConnectionDeathRecipient() = default;
|
||||
@ -141,7 +141,7 @@ private:
|
||||
|
||||
void OnRemoteDied(const wptr<IRemoteObject>& remote);
|
||||
|
||||
wptr<AccessibilityAccountData>& recipientAccountData_;
|
||||
sptr<AccessibilityAccountData> recipientAccountData_;
|
||||
AppExecFwk::ElementName& recipientElementName_;
|
||||
};
|
||||
|
||||
|
@ -24,10 +24,6 @@ void AccessibilityWindowListener::OnWindowUpdate(const sptr<Rosen::WindowInfo>&
|
||||
HILOG_DEBUG("windowId[%{public}d] type[%{public}d]", windowInfo->wid_, type);
|
||||
auto aams = DelayedSingleton<AccessibleAbilityManagerService>::GetInstance();
|
||||
auto accountData = aams->GetCurrentAccountData();
|
||||
if (accountData->GetAccessibilityWindowConnection(windowInfo->wid_) == nullptr) {
|
||||
HILOG_ERROR("GetAccessibilityWindowConnection failed by window id(%{public}d)!!", windowInfo->wid_);
|
||||
return;
|
||||
}
|
||||
|
||||
auto& winMgr = AccessibilityWindowInfoManager::GetInstance();
|
||||
switch (type) {
|
||||
|
@ -327,8 +327,7 @@ void AccessibleAbilityConnection::OnAbilityConnectDone(const AppExecFwk::Element
|
||||
HILOG_DEBUG("AccessibleAbilityConnection::OnAbilityConnectDone get AccessibleAbilityClientProxy successfully");
|
||||
|
||||
if (!deathRecipient_) {
|
||||
wptr<AccessibilityAccountData> data(accountData_);
|
||||
deathRecipient_ = new AccessibleAbilityConnectionDeathRecipient(data, elementName_);
|
||||
deathRecipient_ = new AccessibleAbilityConnectionDeathRecipient(accountData_, elementName_);
|
||||
}
|
||||
|
||||
if (!proxy_->AsObject()->AddDeathRecipient(deathRecipient_)) {
|
||||
@ -531,16 +530,21 @@ void AccessibleAbilityConnection::AccessibleAbilityConnectionDeathRecipient::OnR
|
||||
const wptr<IRemoteObject>& remote)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
sptr<AccessibilityAccountData> accountData = recipientAccountData_.promote();
|
||||
if (!accountData) {
|
||||
if (!recipientAccountData_) {
|
||||
HILOG_ERROR("recipientAccountData_ is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
accountData->GetAccessibleAbilityConnection(recipientElementName_.GetURI());
|
||||
accountData->RemoveConnectedAbility(connection);
|
||||
accountData->RemoveEnabledAbility(recipientElementName_);
|
||||
recipientAccountData_->GetAccessibleAbilityConnection(recipientElementName_.GetURI());
|
||||
recipientAccountData_->RemoveConnectedAbility(connection);
|
||||
recipientAccountData_->RemoveEnabledAbility(recipientElementName_);
|
||||
|
||||
// clear ui test data
|
||||
sptr<AccessibleAbilityConnection> uiTestConnection =
|
||||
recipientAccountData_->GetUITestConnectedAbilityConnection();
|
||||
recipientAccountData_->RemoveUITestConnectedAbility(uiTestConnection);
|
||||
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->UpdateAbilities();
|
||||
DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->UpdateAccessibilityManagerService();
|
||||
// temp deal: notify setting
|
||||
|
Loading…
Reference in New Issue
Block a user