mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
!1392 隐私空间开启/关闭屏幕朗读,重启后主空间状态不同步
Merge pull request !1392 from 小发发/accessibility_240902
This commit is contained in:
commit
01da47d722
@ -279,6 +279,7 @@ public:
|
||||
const std::string &bundleName, const std::string &abilityName);
|
||||
void RemoveUITestClient(sptr<AccessibleAbilityConnection> &connection, const std::string &bundleName);
|
||||
void SetAbilityAutoStartState(const std::string &name, const bool state);
|
||||
void SetScreenReaderExtInAllAccounts(const bool state);
|
||||
void DelAutoStartPrefKeyInRemovePkg(const std::string &bundleName);
|
||||
bool GetAbilityAutoStartState(const std::string &name);
|
||||
void GetConfigValueAtoHos(ConfigValueAtoHosUpdate &value);
|
||||
@ -366,6 +367,7 @@ public:
|
||||
sptr<AccessibilityAccountData> GetCurrentAccountData(int32_t accountId);
|
||||
sptr<AccessibilityAccountData> GetAccountData(int32_t accountId);
|
||||
sptr<AccessibilityAccountData> RemoveAccountData(int32_t accountId);
|
||||
std::vector<int32_t> GetAllAccountIds();
|
||||
void Clear();
|
||||
private:
|
||||
std::map<int32_t, sptr<AccessibilityAccountData>> accountDataMap_;
|
||||
|
@ -197,6 +197,7 @@ public:
|
||||
|
||||
sptr<AccessibilityAccountData> GetAccountData(int32_t accountId);
|
||||
sptr<AccessibilityAccountData> GetCurrentAccountData();
|
||||
std::vector<int32_t> GetAllAccountIds();
|
||||
sptr<AppExecFwk::IBundleMgr> GetBundleMgrProxy();
|
||||
|
||||
/* For common event */
|
||||
|
@ -450,11 +450,34 @@ void AccessibilityAccountData::UpdateMagnificationCapability()
|
||||
isScreenMagnification_ = false;
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::SetScreenReaderExtInAllAccounts(const bool state)
|
||||
{
|
||||
RetError rtn = RET_OK;
|
||||
std::vector<int32_t> accountIds = Singleton<AccessibleAbilityManagerService>::GetInstance().GetAllAccountIds();
|
||||
for (auto accountId : accountIds) {
|
||||
auto accountData = Singleton<AccessibleAbilityManagerService>::GetInstance().GetAccountData(accountId);
|
||||
std::shared_ptr<AccessibilitySettingsConfig> config = accountData->GetConfig();
|
||||
if (config == nullptr) {
|
||||
HILOG_WARN("config is nullptr, accountId = %{public}d", accountId);
|
||||
continue;
|
||||
}
|
||||
if (state) {
|
||||
rtn = config->AddEnabledAccessibilityService(SCREEN_READER_BUNDLE_ABILITY_NAME);
|
||||
} else {
|
||||
rtn = config->RemoveEnabledAccessibilityService(SCREEN_READER_BUNDLE_ABILITY_NAME);
|
||||
}
|
||||
HILOG_INFO("set screenReader state = %{public}d, rtn = %{public}d, accountId = %{public}d", state, rtn,
|
||||
accountId);
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::SetAbilityAutoStartState(const std::string &name, const bool state)
|
||||
{
|
||||
RetError rtn = RET_OK;
|
||||
if (name == SCREEN_READER_BUNDLE_ABILITY_NAME) {
|
||||
SetScreenReaderState(screenReaderKey_, state ? "1" : "0");
|
||||
SetScreenReaderExtInAllAccounts(state);
|
||||
return;
|
||||
}
|
||||
if (!config_) {
|
||||
HILOG_WARN("conig_ is nullptr.");
|
||||
@ -1273,6 +1296,16 @@ sptr<AccessibilityAccountData> AccessibilityAccountDataMap::RemoveAccountData(
|
||||
return accountData;
|
||||
}
|
||||
|
||||
std::vector<int32_t> AccessibilityAccountDataMap::GetAllAccountIds()
|
||||
{
|
||||
std::lock_guard<ffrt::mutex> lock(accountDataMutex_);
|
||||
std::vector<int32_t> accountIds;
|
||||
for (auto it = accountDataMap_.begin(); it != accountDataMap_.end(); it++) {
|
||||
accountIds.push_back(it->first);
|
||||
}
|
||||
return accountIds;
|
||||
}
|
||||
|
||||
void AccessibilityAccountDataMap::Clear()
|
||||
{
|
||||
std::lock_guard<ffrt::mutex> lock(accountDataMutex_);
|
||||
|
@ -468,7 +468,6 @@ RetError AccessibilitySettingsConfig::SetClickResponseTime(const uint32_t time)
|
||||
RetError AccessibilitySettingsConfig::SetIgnoreRepeatClickState(const bool state)
|
||||
{
|
||||
HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
|
||||
ignoreRepeatClickState_ = state;
|
||||
auto ret = SetConfigState(IGNORE_REPEAT_CLICK_SWITCH, state);
|
||||
if (ret != RET_OK) {
|
||||
HILOG_ERROR("set ignoreRepeatClickState_ failed");
|
||||
|
@ -1493,6 +1493,12 @@ sptr<AccessibilityAccountData> AccessibleAbilityManagerService::GetAccountData(i
|
||||
return a11yAccountsData_.GetAccountData(accountId);
|
||||
}
|
||||
|
||||
std::vector<int32_t> AccessibleAbilityManagerService::GetAllAccountIds()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
return a11yAccountsData_.GetAllAccountIds();
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> AccessibleAbilityManagerService::GetBundleMgrProxy()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
@ -123,7 +123,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetEnabled_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetEnabled(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetEnabledState());
|
||||
EXPECT_FALSE(settingConfig_->GetEnabledState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetEnabled_002 end";
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetTouchGuideState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetTouchGuideState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetTouchGuideState());
|
||||
EXPECT_FALSE(settingConfig_->GetTouchGuideState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetTouchGuideState_002 end";
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetGestureState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetGestureState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetGestureState());
|
||||
EXPECT_FALSE(settingConfig_->GetGestureState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetGestureState_002 end";
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetKeyEventObserverState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetKeyEventObserverState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetKeyEventObserverState());
|
||||
EXPECT_FALSE(settingConfig_->GetKeyEventObserverState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetKeyEventObserverState_002 end";
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetCaptionState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetCaptionState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetCaptionState());
|
||||
EXPECT_FALSE(settingConfig_->GetCaptionState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetCaptionState_002 end";
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetShortKeyState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetShortKeyState());
|
||||
EXPECT_FALSE(settingConfig_->GetShortKeyState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyState_002 end";
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyOnLockScreenState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetShortKeyOnLockScreenState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetShortKeyOnLockScreenState());
|
||||
EXPECT_FALSE(settingConfig_->GetShortKeyOnLockScreenState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyOnLockScreenState_002 end";
|
||||
}
|
||||
|
||||
@ -398,7 +398,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyTimeout_002 start";
|
||||
settingConfig_->SetShortKeyTimeout(SHORT_KEY_TIMEOUT);
|
||||
EXPECT_TRUE(settingConfig_->GetShortKeyTimeout() != SHORT_KEY_TIMEOUT);
|
||||
EXPECT_FALSE(settingConfig_->GetShortKeyTimeout() == SHORT_KEY_TIMEOUT);
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetShortKeyTimeout_002 end";
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetMouseKeyState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetMouseKeyState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetMouseKeyState());
|
||||
EXPECT_FALSE(settingConfig_->GetMouseKeyState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetMouseKeyState_002 end";
|
||||
}
|
||||
|
||||
@ -524,7 +524,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetHighContrastTextState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetHighContrastTextState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetHighContrastTextState());
|
||||
EXPECT_FALSE(settingConfig_->GetHighContrastTextState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetHighContrastTextState_002 end";
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetDaltonizationState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetDaltonizationState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetDaltonizationState());
|
||||
EXPECT_FALSE(settingConfig_->GetDaltonizationState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_DaltonizationState_002 end";
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ HWTEST_F(AccessibilitySettingsConfigTest,
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetInvertColorState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetInvertColorState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetInvertColorState());
|
||||
EXPECT_FALSE(settingConfig_->GetInvertColorState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetInvertColorState_002 end";
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetAnimationOffState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetAnimationOffState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetAnimationOffState());
|
||||
EXPECT_FALSE(settingConfig_->GetAnimationOffState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetAnimationOffState_002 end";
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetAudioMonoState_002 start";
|
||||
bool state = true;
|
||||
settingConfig_->SetAudioMonoState(state);
|
||||
EXPECT_TRUE(!settingConfig_->GetAudioMonoState());
|
||||
EXPECT_FALSE(settingConfig_->GetAudioMonoState());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetAudioMonoState_002 end";
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ HWTEST_F(AccessibilitySettingsConfigTest, AccessibilitySettingsConfig_Unittest_S
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetDaltonizationColorFilter_002 start";
|
||||
uint32_t filter = 1;
|
||||
settingConfig_->SetDaltonizationColorFilter(filter);
|
||||
EXPECT_TRUE(!settingConfig_->GetDaltonizationColorFilter());
|
||||
EXPECT_FALSE(settingConfig_->GetDaltonizationColorFilter());
|
||||
GTEST_LOG_(INFO) << "AccessibilitySettingsConfig_Unittest_SetDaltonizationColorFilter_002 end";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user