mirror of
https://github.com/openharmony/accessibility.git
synced 2026-08-24 22:11:28 -04:00
修正disableAbility返回值有错误的问题
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
@@ -133,9 +133,9 @@ public:
|
||||
/**
|
||||
* @brief Remove accessibility that have been opened.
|
||||
* @param name bundle name + / + ability name.
|
||||
* @return
|
||||
* @return return true if removes enabled ability successfully, else return false.
|
||||
*/
|
||||
void RemoveEnabledAbility(const std::string &name);
|
||||
bool RemoveEnabledAbility(const std::string &name);
|
||||
|
||||
void AddInstalledAbility(AccessibilityAbilityInfo& abilityInfo); // For UT
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ void AccessibilityAccountData::RemoveEnabledFromPref(const std::string &name)
|
||||
config_->UpdateEnabledAbilities(vecvalue);
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::RemoveEnabledAbility(const std::string &name)
|
||||
bool AccessibilityAccountData::RemoveEnabledAbility(const std::string &name)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
for (auto it = enabledAbilities_.begin(); it != enabledAbilities_.end(); it++) {
|
||||
@@ -260,10 +260,11 @@ void AccessibilityAccountData::RemoveEnabledAbility(const std::string &name)
|
||||
enabledAbilities_.erase(it);
|
||||
UpdateEnableAbilityListsState();
|
||||
HILOG_DEBUG("EnabledAbility size(%{public}zu)", enabledAbilities_.size());
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
HILOG_ERROR("The ability(%{public}s) is not enabled.", name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::AddInstalledAbility(AccessibilityAbilityInfo& abilityInfo)
|
||||
|
||||
@@ -773,7 +773,10 @@ bool AccessibleAbilityManagerService::InnerDisableAbility(const std::string &nam
|
||||
HILOG_ERROR("accountData is nullptr");
|
||||
return false;
|
||||
}
|
||||
accountData->RemoveEnabledAbility(name);
|
||||
if (!accountData->RemoveEnabledAbility(name)) {
|
||||
HILOG_ERROR("RemoveEnabledAbility failed");
|
||||
return false;
|
||||
}
|
||||
UpdateAbilities();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user