mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-23 06:50:30 +00:00
description
Signed-off-by: 小发发 <lianghui35@huawei.com>
This commit is contained in:
parent
2a3afa495c
commit
5c5add6248
@ -50,7 +50,8 @@ struct ConfigValueAtoHosUpdate {
|
||||
int ignoreRepeatClickTime = 0;
|
||||
int displayDaltonizer = 0;
|
||||
bool shortcutEnabled = false;
|
||||
bool shortcutEnabledOnLockScreen = false;
|
||||
int shortcutEnabledOnLockScreen = 0;
|
||||
int shortcutOnLockScreen = 0;
|
||||
int shortcutTimeout = 0;
|
||||
bool screenMagnificationState = false;
|
||||
};
|
||||
|
@ -38,6 +38,7 @@ namespace {
|
||||
constexpr int DEFAULT_ACCOUNT_ID = 100;
|
||||
constexpr int SHORT_KEY_TIMEOUT_AFTER_USE = 1000; // ms
|
||||
constexpr int SHORT_KEY_TIMEOUT_BEFORE_USE = 3000; // ms
|
||||
constexpt int INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE = 2;
|
||||
const std::string HIGH_TEXT_CONTRAST_ENABLED = "high_text_contrast_enabled";
|
||||
const std::string ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
|
||||
const std::string ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED = "accessibility_display_daltonizer_enabled";
|
||||
@ -53,6 +54,7 @@ namespace {
|
||||
const std::string ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_ENABLED = "accessibility_shortcut_enabled";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_ENABLED_ON_LOCK_SCREEN = "accessibility_shortcut_enabled_on_lock_screen";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN = "accessibility_shortcut_on_lock_screen";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_TIMEOUT = "accessibility_shortcut_timeout";
|
||||
const std::string SCREEN_MAGNIFICATION_KEY = "accessibility_display_magnification_enabled";
|
||||
const std::string ACCESSIBILITY_CLONE_FLAG = "accessibility_config_clone";
|
||||
@ -575,8 +577,11 @@ void AccessibilityAccountData::GetConfigValueAtoHos(ConfigValueAtoHosUpdate &val
|
||||
value.daltonizationState = config_->GetDbHandle()->GetBoolValue(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, false);
|
||||
value.displayDaltonizer = config_->GetDbHandle()->GetIntValue(ACCESSIBILITY_DISPLAY_DALTONIZER, 0);
|
||||
value.shortcutEnabled = config_->GetDbHandle()->GetBoolValue(ACCESSIBILITY_SHORTCUT_ENABLED, false);
|
||||
value.shortcutEnabledOnLockScreen = config_->GetDbHandle()->GetBoolValue(
|
||||
ACCESSIBILITY_SHORTCUT_ENABLED_ON_LOCK_SCREEN, false);
|
||||
value.shortcutEnabledOnLockScreen = config_->GetDbHandle()->GetIntValue(
|
||||
ACCESSIBILITY_SHORTCUT_ENABLED_ON_LOCK_SCREEN, INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
value.shortcutOnLockScreen = config_->GetDbHandle()->GetIntValue(
|
||||
ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
config_->GetDbHandle()->PutIntValue(ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
value.shortcutTimeout = config_->GetDbHandle()->GetIntValue(ACCESSIBILITY_SHORTCUT_TIMEOUT,
|
||||
SHORT_KEY_TIMEOUT_BEFORE_USE);
|
||||
value.clickResponseTime = config_->GetDbHandle()->GetIntValue(CLICK_RESPONSE_TIME, 0);
|
||||
|
@ -34,6 +34,7 @@ namespace {
|
||||
const std::string SCREEN_READER_BUNDLE_ABILITY_NAME = "com.huawei.hmos.screenreader/AccessibilityExtAbility";
|
||||
const int32_t SHORT_KEY_TIMEOUT_BEFORE_USE = 3000; // ms
|
||||
const int32_t SHORT_KEY_TIMEOUT_AFTER_USE = 1000; // ms
|
||||
const int32_t INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE = 2;
|
||||
}
|
||||
|
||||
void AccessibilitySettings::RegisterSettingsHandler(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
|
||||
@ -512,8 +513,20 @@ void AccessibilitySettings::UpdateSettingsInAtoHosStatePart(ConfigValueAtoHosUpd
|
||||
if (atoHosValue.shortcutEnabled) {
|
||||
accountData->GetConfig()->SetShortKeyState(atoHosValue.shortcutEnabled);
|
||||
}
|
||||
if (atoHosValue.shortcutEnabledOnLockScreen) {
|
||||
accountData->GetConfig()->SetShortKeyOnLockScreenState(atoHosValue.shortcutEnabledOnLockScreen);
|
||||
bool shortKeyOnLockScreenAutoOn = false;
|
||||
if (atoHosValue.shortcutTimeout == 1) {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_AFTER_USE);
|
||||
if (atoHosValue.shortcutOnLockScreen == INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
|
||||
shortKeyOnLockScreenAutoOn = true;
|
||||
accountData->GetConfig()->SetShortKeyOnLockScreenState(true);
|
||||
}
|
||||
} else if (atoHosValue.shortcutTimeout == 0) {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_BEFORE_USE);
|
||||
}
|
||||
if (atoHosValue.shortcutOnLockScreen != INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
|
||||
accountData->GetConfig()->SetShortKeyOnLockScreenState(atoHosValue.shortcutOnLockScreen == 1);
|
||||
} else if (!shortKeyOnLockScreenAutoOn) {
|
||||
accountData->GetConfig()->SetShortKeyOnLockScreenState(atoHosValue.shortcutEnabledOnLockScreen == 1);
|
||||
}
|
||||
if (atoHosValue.screenMagnificationState) {
|
||||
accountData->GetConfig()->SetScreenMagnificationState(atoHosValue.screenMagnificationState);
|
||||
@ -558,11 +571,6 @@ void AccessibilitySettings::UpdateSettingsInAtoHos()
|
||||
accountData->GetConfig()->SetDaltonizationColorFilter(static_cast<uint32_t>(atoHosValue.displayDaltonizer));
|
||||
UpdateDaltonizationColorFilter();
|
||||
}
|
||||
if (atoHosValue.shortcutTimeout == 1) {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_AFTER_USE);
|
||||
} else if (atoHosValue.shortcutTimeout == 0) {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_BEFORE_USE);
|
||||
}
|
||||
|
||||
if (atoHosValue.isScreenReaderEnabled) {
|
||||
uint32_t capabilities = CAPABILITY_GESTURE | CAPABILITY_KEY_EVENT_OBSERVER | CAPABILITY_RETRIEVE |
|
||||
|
@ -56,7 +56,8 @@ namespace {
|
||||
const std::string WINDOW_COLOR = "accessibility_window_color";
|
||||
const std::string FONT_SCALE = "accessibility_font_scale";
|
||||
const std::string ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services";
|
||||
const std::string SHORTCUT_ENABLED_ON_LOCK_SCREEN = "accessibility_shortcut_enabled_on_lock_screen";
|
||||
const std::string SHORTCUT_ENABLED_ON_LOCK_SCREEN = "accessibility_shortcut_enabled_on_lock_screen"; // HMOS key
|
||||
const std::string SHORTCUT_ON_LOCK_SCREEN = "accessibility_shortcut_on_lock_screen"; // AOS key
|
||||
const std::string SHORTCUT_TIMEOUT = "accessibility_shortcut_timeout";
|
||||
const std::string ACCESSIBILITY_CLONE_FLAG = "accessibility_config_clone";
|
||||
const std::string SCREENREADER_TAG = "screenreader";
|
||||
@ -819,12 +820,14 @@ void AccessibilitySettingsConfig::InitShortKeyConfig()
|
||||
isShortKeyState_ = datashare_->GetBoolValue(SHORTCUT_ENABLED, true);
|
||||
int isShortKeyEnabledOnLockScreen = datashare_->GetIntValue(SHORTCUT_ENABLED_ON_LOCK_SCREEN,
|
||||
INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
int isShortKeyOnLockScreen = datashare_->GetIntValue(SHORTCUT_ON_LOCK_SCREEN,
|
||||
INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
shortKeyTimeout_ = static_cast<int32_t>(datashare_->GetIntValue(SHORTCUT_TIMEOUT, SHORT_KEY_TIMEOUT_BEFORE_USE));
|
||||
bool shortKeyOnLockScreenAutoOn = false;
|
||||
|
||||
if (shortKeyTimeout_ == 1) {
|
||||
SetShortKeyTimeout(SHORT_KEY_TIMEOUT_AFTER_USE);
|
||||
if (isShortKeyEnabledOnLockScreen == INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
|
||||
if (isShortKeyOnLockScreen == INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
|
||||
shortKeyOnLockScreenAutoOn = true;
|
||||
SetShortKeyOnLockScreenState(true);
|
||||
}
|
||||
@ -832,9 +835,16 @@ void AccessibilitySettingsConfig::InitShortKeyConfig()
|
||||
SetShortKeyTimeout(SHORT_KEY_TIMEOUT_BEFORE_USE);
|
||||
}
|
||||
|
||||
if (!shortKeyOnLockScreenAutoOn) {
|
||||
if (isShortKeyOnLockScreen != INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
|
||||
SetShortKeyOnLockScreenState(isShortKeyOnLockScreen == 1);
|
||||
} else if (!shortKeyOnLockScreenAutoOn) {
|
||||
SetShortKeyOnLockScreenState(isShortKeyEnabledOnLockScreen == 1);
|
||||
}
|
||||
|
||||
auto ret = dataShare_->PutIntValue(SHORTCUT_ON_LOCK_SCREEN, INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
|
||||
if (ret != RET_OK) {
|
||||
HILOG_ERROR("reset shortcut on lock screen failed");
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilitySettingsConfig::InitSetting()
|
||||
@ -934,15 +944,24 @@ void AccessibilitySettingsConfig::CloneAudioState()
|
||||
return;
|
||||
}
|
||||
|
||||
RetError ret = RET_OK;
|
||||
int32_t monoValue = static_cast<int32_t>(systemDatashare_->GetIntValue(AUDIO_MONO_KEY, INVALID_MASTER_MONO_VALUE));
|
||||
if (monoValue != INVALID_MASTER_MONO_VALUE) {
|
||||
SetAudioMonoState(monoValue == 1);
|
||||
ret = systemDatashare_->PutIntValue(AUDIO_MONO_KEY, INVALID_MASTER_MONO_VALUE);
|
||||
if (ret != RET_OK) {
|
||||
HILOG_ERROR("reset monoValue in system table failed");
|
||||
}
|
||||
}
|
||||
|
||||
float audioBalance = static_cast<float>(systemDatashare_->GetFloatValue(AUDIO_BALANCE_KEY,
|
||||
INVALID_MASTER_BALANCE_VALUE));
|
||||
if (fabs(audioBalance - INVALID_MASTER_BALANCE_VALUE) < FLT_EPSILON) {
|
||||
SetAudioBalance(audioBalance);
|
||||
ret = systemDatashare_->PutFloatValue(AUDIO_BALANCE_KEY, INVALID_MASTER_BALANCE_VALUE);
|
||||
if (ret != RET_OK) {
|
||||
HILOG_ERROR("reset audioBalance in system table failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user