mirror of
https://gitee.com/openharmony/accessibility
synced 2025-03-03 18:47:17 +00:00
Merge branch 'master' of gitee.com:openharmony/accessibility into master
Signed-off-by: zhaoqi <zhaoqi107@h-partners.com>
This commit is contained in:
commit
346bc0fae6
@ -595,7 +595,7 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data)
|
||||
NAccessibilityConfigData* NAccessibilityConfig::GetCallbackInfo(napi_env env, napi_callback_info info,
|
||||
napi_value* parameters, size_t& argc, NAccessibilityConfigClass*& obj)
|
||||
{
|
||||
napi_value jsthis;
|
||||
napi_value jsthis = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, parameters, &jsthis, nullptr);
|
||||
|
||||
napi_status status = napi_unwrap(env, jsthis, reinterpret_cast<void**>(&obj));
|
||||
@ -763,7 +763,7 @@ napi_value NAccessibilityConfig::GetConfig(napi_env env, napi_callback_info info
|
||||
HILOG_DEBUG();
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
napi_value jsthis;
|
||||
napi_value jsthis = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, parameters, &jsthis, nullptr);
|
||||
|
||||
NAccessibilityConfigClass* obj;
|
||||
@ -821,7 +821,7 @@ napi_value NAccessibilityConfig::SubscribeConfigObserver(napi_env env, napi_call
|
||||
}
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
napi_value jsthis;
|
||||
napi_value jsthis = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, parameters, &jsthis, nullptr);
|
||||
NAccessibilityConfigClass* obj;
|
||||
napi_status status = napi_unwrap(env, jsthis, reinterpret_cast<void**>(&obj));
|
||||
@ -870,7 +870,7 @@ napi_value NAccessibilityConfig::UnSubscribeConfigObserver(napi_env env, napi_ca
|
||||
if (!IsAvailable(env, info)) {
|
||||
return nullptr;
|
||||
}
|
||||
napi_value jsthis;
|
||||
napi_value jsthis = nullptr;
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value parameters[ARGS_SIZE_ONE] = {0};
|
||||
napi_get_cb_info(env, info, &argc, parameters, &jsthis, nullptr);
|
||||
|
@ -37,8 +37,12 @@ static napi_property_descriptor configDesc[] = {
|
||||
|
||||
static napi_value InitHighContrastText(napi_env env)
|
||||
{
|
||||
napi_value highContrastTextValue;
|
||||
napi_value highContrastTextValue = nullptr;
|
||||
napi_create_object(env, &highContrastTextValue);
|
||||
if (highContrastTextValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return highContrastTextValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, highContrastTextValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -56,8 +60,12 @@ static napi_value InitHighContrastText(napi_env env)
|
||||
|
||||
static napi_value InitInvertColor(napi_env env)
|
||||
{
|
||||
napi_value invertColorValue;
|
||||
napi_value invertColorValue = nullptr;
|
||||
napi_create_object(env, &invertColorValue);
|
||||
if (invertColorValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return invertColorValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, invertColorValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -75,8 +83,12 @@ static napi_value InitInvertColor(napi_env env)
|
||||
|
||||
static napi_value InitDaltonizationState(napi_env env)
|
||||
{
|
||||
napi_value daltonizationStateValue;
|
||||
napi_value daltonizationStateValue = nullptr;
|
||||
napi_create_object(env, &daltonizationStateValue);
|
||||
if (daltonizationStateValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return daltonizationStateValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, daltonizationStateValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -94,8 +106,12 @@ static napi_value InitDaltonizationState(napi_env env)
|
||||
|
||||
static napi_value InitDaltonizationColorFilter(napi_env env)
|
||||
{
|
||||
napi_value daltonizationColorFilterValue;
|
||||
napi_value daltonizationColorFilterValue = nullptr;
|
||||
napi_create_object(env, &daltonizationColorFilterValue);
|
||||
if (daltonizationColorFilterValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return daltonizationColorFilterValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, daltonizationColorFilterValue,
|
||||
sizeof(configDesc) /
|
||||
sizeof(configDesc[0]),
|
||||
@ -114,8 +130,12 @@ static napi_value InitDaltonizationColorFilter(napi_env env)
|
||||
|
||||
static napi_value InitContentTimeout(napi_env env)
|
||||
{
|
||||
napi_value contentTimeoutValue;
|
||||
napi_value contentTimeoutValue = nullptr;
|
||||
napi_create_object(env, &contentTimeoutValue);
|
||||
if (contentTimeoutValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return contentTimeoutValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, contentTimeoutValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -133,8 +153,12 @@ static napi_value InitContentTimeout(napi_env env)
|
||||
|
||||
static napi_value InitAnimationOff(napi_env env)
|
||||
{
|
||||
napi_value animationOffValue;
|
||||
napi_value animationOffValue = nullptr;
|
||||
napi_create_object(env, &animationOffValue);
|
||||
if (animationOffValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return animationOffValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, animationOffValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -152,8 +176,12 @@ static napi_value InitAnimationOff(napi_env env)
|
||||
|
||||
static napi_value InitBrightnessDiscount(napi_env env)
|
||||
{
|
||||
napi_value brightnessDiscountValue;
|
||||
napi_value brightnessDiscountValue = nullptr;
|
||||
napi_create_object(env, &brightnessDiscountValue);
|
||||
if (brightnessDiscountValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return brightnessDiscountValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, brightnessDiscountValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -171,8 +199,12 @@ static napi_value InitBrightnessDiscount(napi_env env)
|
||||
|
||||
static napi_value InitScreenMagnifier(napi_env env)
|
||||
{
|
||||
napi_value screenMagnifierValue;
|
||||
napi_value screenMagnifierValue = nullptr;
|
||||
napi_create_object(env, &screenMagnifierValue);
|
||||
if (screenMagnifierValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return screenMagnifierValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, screenMagnifierValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -190,8 +222,12 @@ static napi_value InitScreenMagnifier(napi_env env)
|
||||
|
||||
static napi_value InitAudioMono(napi_env env)
|
||||
{
|
||||
napi_value audioMonoValue;
|
||||
napi_value audioMonoValue = nullptr;
|
||||
napi_create_object(env, &audioMonoValue);
|
||||
if (audioMonoValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return audioMonoValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, audioMonoValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -209,8 +245,12 @@ static napi_value InitAudioMono(napi_env env)
|
||||
|
||||
static napi_value InitAudioBalance(napi_env env)
|
||||
{
|
||||
napi_value audioBalanceValue;
|
||||
napi_value audioBalanceValue = nullptr;
|
||||
napi_create_object(env, &audioBalanceValue);
|
||||
if (audioBalanceValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return audioBalanceValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, audioBalanceValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -228,8 +268,12 @@ static napi_value InitAudioBalance(napi_env env)
|
||||
|
||||
static napi_value InitMouseKey(napi_env env)
|
||||
{
|
||||
napi_value mouseKeyValue;
|
||||
napi_value mouseKeyValue = nullptr;
|
||||
napi_create_object(env, &mouseKeyValue);
|
||||
if (mouseKeyValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return mouseKeyValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, mouseKeyValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -247,8 +291,12 @@ static napi_value InitMouseKey(napi_env env)
|
||||
|
||||
static napi_value InitMouseAutoClick(napi_env env)
|
||||
{
|
||||
napi_value mouseAutoClickValue;
|
||||
napi_value mouseAutoClickValue = nullptr;
|
||||
napi_create_object(env, &mouseAutoClickValue);
|
||||
if (mouseAutoClickValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return mouseAutoClickValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, mouseAutoClickValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -266,8 +314,12 @@ static napi_value InitMouseAutoClick(napi_env env)
|
||||
|
||||
static napi_value InitShortKey(napi_env env)
|
||||
{
|
||||
napi_value shortKeyValue;
|
||||
napi_value shortKeyValue = nullptr;
|
||||
napi_create_object(env, &shortKeyValue);
|
||||
if (shortKeyValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return shortKeyValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, shortKeyValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -285,8 +337,12 @@ static napi_value InitShortKey(napi_env env)
|
||||
|
||||
static napi_value InitShortKeyTarget(napi_env env)
|
||||
{
|
||||
napi_value shortKeyTargetValue;
|
||||
napi_value shortKeyTargetValue = nullptr;
|
||||
napi_create_object(env, &shortKeyTargetValue);
|
||||
if (shortKeyTargetValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return shortKeyTargetValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, shortKeyTargetValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -304,8 +360,12 @@ static napi_value InitShortKeyTarget(napi_env env)
|
||||
|
||||
static napi_value InitShortKeyMultiTarget(napi_env env)
|
||||
{
|
||||
napi_value shortKeyMultiTargetValue;
|
||||
napi_value shortKeyMultiTargetValue = nullptr;
|
||||
napi_create_object(env, &shortKeyMultiTargetValue);
|
||||
if (shortKeyMultiTargetValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return shortKeyMultiTargetValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, shortKeyMultiTargetValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -323,8 +383,12 @@ static napi_value InitShortKeyMultiTarget(napi_env env)
|
||||
|
||||
static napi_value InitCaptionsState(napi_env env)
|
||||
{
|
||||
napi_value captionsValue;
|
||||
napi_value captionsValue = nullptr;
|
||||
napi_create_object(env, &captionsValue);
|
||||
if (captionsValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return captionsValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, captionsValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -342,8 +406,12 @@ static napi_value InitCaptionsState(napi_env env)
|
||||
|
||||
static napi_value InitCaptionsStyle(napi_env env)
|
||||
{
|
||||
napi_value captionsStyleValue;
|
||||
napi_value captionsStyleValue = nullptr;
|
||||
napi_create_object(env, &captionsStyleValue);
|
||||
if (captionsStyleValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return captionsStyleValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, captionsStyleValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -361,8 +429,12 @@ static napi_value InitCaptionsStyle(napi_env env)
|
||||
|
||||
static napi_value InitClickResponseTime(napi_env env)
|
||||
{
|
||||
napi_value clickResponseTimeValue;
|
||||
napi_value clickResponseTimeValue = nullptr;
|
||||
napi_create_object(env, &clickResponseTimeValue);
|
||||
if (clickResponseTimeValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return clickResponseTimeValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, clickResponseTimeValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -380,8 +452,12 @@ static napi_value InitClickResponseTime(napi_env env)
|
||||
|
||||
static napi_value InitIgnoreRepeatClickState(napi_env env)
|
||||
{
|
||||
napi_value ignoreRepeatClickStateValue;
|
||||
napi_value ignoreRepeatClickStateValue = nullptr;
|
||||
napi_create_object(env, &ignoreRepeatClickStateValue);
|
||||
if (ignoreRepeatClickStateValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return ignoreRepeatClickStateValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, ignoreRepeatClickStateValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
@ -399,8 +475,12 @@ static napi_value InitIgnoreRepeatClickState(napi_env env)
|
||||
|
||||
static napi_value InitIgnoreRepeatClickTime(napi_env env)
|
||||
{
|
||||
napi_value ignoreRepeatClickTimeValue;
|
||||
napi_value ignoreRepeatClickTimeValue = nullptr;
|
||||
napi_create_object(env, &ignoreRepeatClickTimeValue);
|
||||
if (ignoreRepeatClickTimeValue == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return ignoreRepeatClickTimeValue;
|
||||
}
|
||||
NAPI_CALL(env, napi_define_properties(env, ignoreRepeatClickTimeValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
|
@ -260,7 +260,7 @@ void NAccessibilityElement::AttributeNamesComplete(napi_env env, napi_status sta
|
||||
// Callback mode
|
||||
result[PARAM0] = CreateBusinessError(env, OHOS::Accessibility::RetError::RET_OK);
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -438,11 +438,11 @@ void NAccessibilityElement::AttributeValueComplete(napi_env env, napi_status sta
|
||||
HILOG_DEBUG("result is %{public}d", callbackInfo->ret_);
|
||||
result[PARAM0] = CreateBusinessError(env, callbackInfo->ret_);
|
||||
if (callbackInfo->callback_) {
|
||||
napi_value callback;
|
||||
napi_value returnVal;
|
||||
napi_value undefined;
|
||||
napi_value callback = nullptr;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_value undefined = nullptr;
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_get_undefined(env, &undefined);
|
||||
napi_get_undefined(env, &undefined); // 是否加判断
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -1391,7 +1391,7 @@ void NAccessibilityElement::ActionNamesComplete(napi_env env, napi_status status
|
||||
if (callbackInfo->callback_) {
|
||||
// Callback mode
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -1437,7 +1437,7 @@ napi_value NAccessibilityElement::PerformAction(napi_env env, napi_callback_info
|
||||
{
|
||||
size_t argc = ARGS_SIZE_THREE;
|
||||
napi_value argv[ARGS_SIZE_THREE] = {0};
|
||||
napi_value thisVar;
|
||||
napi_value thisVar = nullptr;
|
||||
void* data = nullptr;
|
||||
napi_status status = napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
|
||||
if (status != napi_ok) {
|
||||
@ -1592,7 +1592,7 @@ void NAccessibilityElement::PerformActionComplete(napi_env env, napi_status stat
|
||||
if (callbackInfo->callback_) {
|
||||
// Callback mode
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -1613,7 +1613,7 @@ napi_value NAccessibilityElement::FindElement(napi_env env, napi_callback_info i
|
||||
{
|
||||
size_t argc = ARGS_SIZE_THREE;
|
||||
napi_value argv[ARGS_SIZE_THREE] = {0};
|
||||
napi_value thisVar;
|
||||
napi_value thisVar = nullptr;
|
||||
void* data = nullptr;
|
||||
napi_status status = napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
|
||||
if (status != napi_ok) {
|
||||
@ -1864,7 +1864,7 @@ void NAccessibilityElement::GetCursorPositionComplete(napi_env env, napi_status
|
||||
if (callbackInfo->callback_) {
|
||||
// Callback mode
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
HILOG_INFO("NAccessibilityElement::GetCursorPositionComplete in CallbackMode");
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
@ -1897,7 +1897,7 @@ void NAccessibilityElement::FindElementComplete(napi_env env, napi_status status
|
||||
HILOG_DEBUG("callback mode. result is %{public}d", callbackInfo->ret_);
|
||||
napi_value callback = 0;
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_value undefined = 0;
|
||||
napi_get_undefined(env, &undefined);
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
@ -2007,7 +2007,7 @@ napi_value NAccessibilityElement::ErrorOperation(NAccessibilityElementData *call
|
||||
// Callback mode
|
||||
result[PARAM1] = undefined;
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -2028,7 +2028,7 @@ napi_value NAccessibilityElement::GetCursorPosition(napi_env env, napi_callback_
|
||||
{
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv[ARGS_SIZE_ONE] = {0};
|
||||
napi_value thisVar;
|
||||
napi_value thisVar = nullptr;
|
||||
void* data = nullptr;
|
||||
napi_status status = napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
|
||||
if (status != napi_ok) {
|
||||
|
@ -350,7 +350,7 @@ napi_status SetNapiEventInfoIntProperty(napi_env env, const char *property, int6
|
||||
HILOG_ERROR("property is null");
|
||||
return napi_invalid_arg;
|
||||
}
|
||||
napi_value nValue;
|
||||
napi_value nValue = nullptr;
|
||||
napi_status status = napi_create_int64(env, value, &nValue);
|
||||
if (status != napi_ok) {
|
||||
return status;
|
||||
@ -364,7 +364,7 @@ napi_status SetEventInfoStrProperty(napi_env env, const char *property, std::str
|
||||
HILOG_ERROR("property is null");
|
||||
return napi_invalid_arg;
|
||||
}
|
||||
napi_value nValue;
|
||||
napi_value nValue = nullptr;
|
||||
napi_status status = napi_create_string_utf8(env, value.c_str(), NAPI_AUTO_LENGTH, &nValue);
|
||||
if (status != napi_ok) {
|
||||
HILOG_ERROR();
|
||||
@ -481,13 +481,13 @@ void NAccessibilityExtension::OnAccessibilityEventCompleteCallback(uv_work_t* wo
|
||||
napi_value napiEventInfo = nullptr;
|
||||
napi_create_object(data->env_, &napiEventInfo);
|
||||
|
||||
napi_value nType;
|
||||
napi_value nType = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(data->env_, napi_create_string_utf8(data->env_, data->eventType_.c_str(),
|
||||
NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(data->env_, napi_set_named_property(data->env_, napiEventInfo, "eventType", nType));
|
||||
HILOG_DEBUG("eventType[%{public}s]", data->eventType_.c_str());
|
||||
|
||||
napi_value nTimeStamp;
|
||||
napi_value nTimeStamp = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(data->env_, napi_create_int64(data->env_, data->timeStamp_, &nTimeStamp));
|
||||
NAPI_CALL_RETURN_VOID(data->env_, napi_set_named_property(data->env_, napiEventInfo, "timeStamp", nTimeStamp));
|
||||
|
||||
|
@ -37,7 +37,7 @@ napi_value NAccessibilityGesturePath::JSConstructor(napi_env env, napi_callback_
|
||||
HILOG_ERROR("valueType %{public}d is not napi_number", valueType);
|
||||
return nullptr;
|
||||
}
|
||||
napi_value points;
|
||||
napi_value points = nullptr;
|
||||
NAPI_CALL(env, napi_create_array(env, &points));
|
||||
NAPI_CALL(env, napi_set_named_property(env, jsthis, "points", points));
|
||||
NAPI_CALL(env, napi_set_named_property(env, jsthis, "durationTime", argv[PARAM0]));
|
||||
|
@ -122,8 +122,12 @@ int NAccessibilityConfigObserver::NotifyStateChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_object(callbackInfo->env_, &jsEvent);
|
||||
if (jsEvent == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return;
|
||||
}
|
||||
napi_get_boolean(callbackInfo->env_, callbackInfo->state_, &jsEvent);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
@ -161,8 +165,12 @@ int NAccessibilityConfigObserver::NotifyPropertyChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_object(callbackInfo->env_, &jsEvent);
|
||||
if (jsEvent == nullptr) {
|
||||
HILOG_ERROR("napi_create_object fail.");
|
||||
return;
|
||||
}
|
||||
ConvertCaptionPropertyToJS(callbackInfo->env_, jsEvent, callbackInfo->caption_);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
@ -200,7 +208,7 @@ int NAccessibilityConfigObserver::NotifyStringChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_string_utf8(callbackInfo->env_, callbackInfo->stringValue_.c_str(),
|
||||
callbackInfo->stringValue_.length(), &jsEvent);
|
||||
napi_value handler = nullptr;
|
||||
@ -240,7 +248,7 @@ int NAccessibilityConfigObserver::NotifyStringVectorChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_array(callbackInfo->env_, &jsEvent);
|
||||
ConvertStringVecToJS(callbackInfo->env_, jsEvent, callbackInfo->stringVector_);
|
||||
|
||||
@ -284,7 +292,7 @@ int NAccessibilityConfigObserver::NotifyIntChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_int32(callbackInfo->env_, callbackInfo->int32Value_, &jsEvent);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
@ -325,7 +333,7 @@ int NAccessibilityConfigObserver::NotifyUintChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_uint32(callbackInfo->env_, callbackInfo->uint32Value_, &jsEvent);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
@ -366,7 +374,7 @@ int NAccessibilityConfigObserver::NotifyFloatChanged(uv_work_t *work)
|
||||
};
|
||||
std::unique_ptr<napi_handle_scope__, decltype(closeScope)> scopes(
|
||||
OHOS::Accessibility::TmpOpenScope(callbackInfo->env_), closeScope);
|
||||
napi_value jsEvent;
|
||||
napi_value jsEvent = nullptr;
|
||||
napi_create_double(callbackInfo->env_, double(callbackInfo->floatValue_), &jsEvent);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
|
@ -60,7 +60,7 @@ napi_value NAccessibilityClient::IsOpenAccessibilitySync(napi_env env, napi_call
|
||||
{
|
||||
HILOG_INFO();
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv;
|
||||
napi_value argv = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, &argv, nullptr, nullptr);
|
||||
ACCESSIBILITY_NAPI_ASSERT(env, argc == ARGS_SIZE_ZERO, OHOS::Accessibility::RET_ERR_INVALID_PARAM);
|
||||
|
||||
@ -69,7 +69,7 @@ napi_value NAccessibilityClient::IsOpenAccessibilitySync(napi_env env, napi_call
|
||||
bool status = false;
|
||||
auto ret = asaClient->IsEnabled(status);
|
||||
ACCESSIBILITY_NAPI_ASSERT(env, ret == RET_OK, OHOS::Accessibility::RET_ERR_FAILED);
|
||||
napi_value result;
|
||||
napi_value result = nullptr;
|
||||
napi_get_boolean(env, status, &result);
|
||||
return result;
|
||||
}
|
||||
@ -78,7 +78,7 @@ napi_value NAccessibilityClient::IsOpenAccessibility(napi_env env, napi_callback
|
||||
{
|
||||
HILOG_INFO();
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv;
|
||||
napi_value argv = nullptr;
|
||||
NAccessibilitySystemAbilityClient* callbackInfo = new(std::nothrow) NAccessibilitySystemAbilityClient();
|
||||
if (!callbackInfo) {
|
||||
HILOG_ERROR("Failed to create callbackInfo.");
|
||||
@ -121,7 +121,7 @@ napi_value NAccessibilityClient::IsOpenTouchExplorationSync(napi_env env, napi_c
|
||||
{
|
||||
HILOG_INFO();
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv;
|
||||
napi_value argv = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, &argv, nullptr, nullptr);
|
||||
ACCESSIBILITY_NAPI_ASSERT(env, argc == ARGS_SIZE_ZERO, OHOS::Accessibility::RET_ERR_INVALID_PARAM);
|
||||
|
||||
@ -130,7 +130,7 @@ napi_value NAccessibilityClient::IsOpenTouchExplorationSync(napi_env env, napi_c
|
||||
bool status = false;
|
||||
auto ret = asaClient->IsTouchExplorationEnabled(status);
|
||||
ACCESSIBILITY_NAPI_ASSERT(env, ret == RET_OK, OHOS::Accessibility::RET_ERR_FAILED);
|
||||
napi_value result;
|
||||
napi_value result = nullptr;
|
||||
napi_get_boolean(env, status, &result);
|
||||
return result;
|
||||
}
|
||||
@ -144,7 +144,7 @@ napi_value NAccessibilityClient::IsOpenTouchExploration(napi_env env, napi_callb
|
||||
return nullptr;
|
||||
}
|
||||
size_t argc = ARGS_SIZE_ONE;
|
||||
napi_value argv;
|
||||
napi_value argv = nullptr;
|
||||
napi_get_cb_info(env, info, &argc, &argv, nullptr, nullptr);
|
||||
|
||||
napi_value promise = nullptr;
|
||||
@ -198,7 +198,7 @@ void NAccessibilityClient::Completefunction(napi_env env, std::string type, void
|
||||
result[PARAM0] = CreateBusinessError(env, callbackInfo->ret_);
|
||||
if (callbackInfo->callback_) {
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -237,7 +237,7 @@ void NAccessibilityClient::GetAbilityListComplete(napi_env env, napi_status stat
|
||||
result[PARAM0] = CreateBusinessError(env, callbackInfo->ret_);
|
||||
if (callbackInfo->callback_) {
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
@ -432,7 +432,7 @@ napi_value NAccessibilityClient::GetAccessibilityExtensionListSync(napi_env env,
|
||||
ACCESSIBILITY_NAPI_ASSERT(env, errCode == OHOS::Accessibility::RET_OK,
|
||||
OHOS::Accessibility::RET_ERR_INVALID_PARAM);
|
||||
|
||||
napi_value resultAbilityList;
|
||||
napi_value resultAbilityList = nullptr;
|
||||
napi_create_array(env, &resultAbilityList);
|
||||
ConvertAccessibleAbilityInfosToJS(env, resultAbilityList, abilityList);
|
||||
return resultAbilityList;
|
||||
@ -486,7 +486,7 @@ void NAccessibilityClient::SendEventComplete(napi_env env, napi_status status, v
|
||||
result[PARAM1] = ret;
|
||||
if (callbackInfo->callback_) {
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
napi_value returnVal = nullptr;
|
||||
napi_call_function(env, undefined, callback, ARGS_SIZE_TWO, result, &returnVal);
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
} else {
|
||||
|
@ -257,20 +257,20 @@ bool CheckObserverEqual(napi_env env, napi_value observer, napi_env iterEnv, nap
|
||||
*********************************************************/
|
||||
void ConvertRectToJS(napi_env env, napi_value result, const Accessibility::Rect& rect)
|
||||
{
|
||||
napi_value nLeftTopX;
|
||||
napi_value nLeftTopX = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, rect.GetLeftTopXScreenPostion(), &nLeftTopX));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "left", nLeftTopX));
|
||||
|
||||
napi_value nLeftTopY;
|
||||
napi_value nLeftTopY = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, rect.GetLeftTopYScreenPostion(), &nLeftTopY));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "top", nLeftTopY));
|
||||
|
||||
napi_value nWidth;
|
||||
napi_value nWidth = nullptr;
|
||||
int32_t width = rect.GetRightBottomXScreenPostion() - rect.GetLeftTopXScreenPostion();
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, width, &nWidth));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "width", nWidth));
|
||||
|
||||
napi_value nHeight;
|
||||
napi_value nHeight = nullptr;
|
||||
int32_t height = rect.GetRightBottomYScreenPostion() - rect.GetLeftTopYScreenPostion();
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, height, &nHeight));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "height", nHeight));
|
||||
@ -434,25 +434,25 @@ void ConvertAccessibleAbilityInfoToJSPart1(
|
||||
napi_env env, napi_value& result, OHOS::Accessibility::AccessibilityAbilityInfo& info)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
napi_value nId;
|
||||
napi_value nId = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, info.GetId().c_str(), NAPI_AUTO_LENGTH, &nId));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "id", nId));
|
||||
|
||||
napi_value nName;
|
||||
napi_value nName = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, info.GetName().c_str(), NAPI_AUTO_LENGTH, &nName));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "name", nName));
|
||||
|
||||
napi_value nBundleName;
|
||||
napi_value nBundleName = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(
|
||||
env, napi_create_string_utf8(env, info.GetPackageName().c_str(), NAPI_AUTO_LENGTH, &nBundleName));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "bundleName", nBundleName));
|
||||
|
||||
napi_value nAbilityType;
|
||||
napi_value nAbilityType = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nAbilityType));
|
||||
uint32_t abilityTypesValue = info.GetAccessibilityAbilityType();
|
||||
std::vector<std::string> abilityTypes = ParseAbilityTypesToVec(abilityTypesValue);
|
||||
for (size_t idxType = 0; idxType < abilityTypes.size(); idxType++) {
|
||||
napi_value nType;
|
||||
napi_value nType = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, abilityTypes[idxType].c_str(),
|
||||
NAPI_AUTO_LENGTH, &nType));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nAbilityType, idxType, nType));
|
||||
@ -464,40 +464,40 @@ void ConvertAccessibleAbilityInfoToJSPart2(
|
||||
napi_env env, napi_value& result, OHOS::Accessibility::AccessibilityAbilityInfo& info)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
napi_value nCapabilities;
|
||||
napi_value nCapabilities = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nCapabilities));
|
||||
uint32_t capabilitiesValue = info.GetStaticCapabilityValues();
|
||||
std::vector<std::string> capabilities = ParseCapabilitiesToVec(capabilitiesValue);
|
||||
for (size_t idxCap = 0; idxCap < capabilities.size(); idxCap++) {
|
||||
napi_value nCap;
|
||||
napi_value nCap = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, capabilities[idxCap].c_str(),
|
||||
NAPI_AUTO_LENGTH, &nCap));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nCapabilities, idxCap, nCap));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "capabilities", nCapabilities));
|
||||
|
||||
napi_value description;
|
||||
napi_value description = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(
|
||||
env, napi_create_string_utf8(env, info.GetDescription().c_str(), NAPI_AUTO_LENGTH, &description));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "description", description));
|
||||
|
||||
napi_value nEventTypes;
|
||||
napi_value nEventTypes = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nEventTypes));
|
||||
uint32_t eventTypesValue = info.GetEventTypes();
|
||||
std::vector<std::string> eventTypes = ParseEventTypesToVec(eventTypesValue);
|
||||
for (size_t idxEve = 0; idxEve < eventTypes.size(); idxEve++) {
|
||||
napi_value nEve;
|
||||
napi_value nEve = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, eventTypes[idxEve].c_str(), NAPI_AUTO_LENGTH, &nEve));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nEventTypes, idxEve, nEve));
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "eventTypes", nEventTypes));
|
||||
|
||||
napi_value filterBundleNames;
|
||||
napi_value filterBundleNames = nullptr;
|
||||
size_t idx = 0;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &filterBundleNames));
|
||||
std::vector<std::string> strFilterBundleNames = info.GetFilterBundleNames();
|
||||
for (auto &filterBundleName : strFilterBundleNames) {
|
||||
napi_value bundleName;
|
||||
napi_value bundleName = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(
|
||||
env, napi_create_string_utf8(env, filterBundleName.c_str(), NAPI_AUTO_LENGTH, &bundleName));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_element(env, filterBundleNames, idx, bundleName));
|
||||
@ -510,7 +510,7 @@ void ConvertAccessibleAbilityInfoToJSPart3(
|
||||
napi_env env, napi_value& result, OHOS::Accessibility::AccessibilityAbilityInfo& info)
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
napi_value nNeedHide;
|
||||
napi_value nNeedHide = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_boolean(env, info.NeedHide(), &nNeedHide));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "needHide", nNeedHide));
|
||||
}
|
||||
@ -1510,7 +1510,7 @@ void ConvertCaptionPropertyToJS(
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
|
||||
napi_value value;
|
||||
napi_value value = nullptr;
|
||||
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &value));
|
||||
|
@ -49,6 +49,8 @@ struct ConfigValueAtoHosUpdate {
|
||||
bool ignoreRepeatClickState = false;
|
||||
int ignoreRepeatClickTime = 0;
|
||||
int displayDaltonizer = 0;
|
||||
bool shortcutEnabledOnLockScreen = false;
|
||||
bool shortcutDialogShown = false;
|
||||
};
|
||||
|
||||
class AccessibilityAccountData final : public RefBase {
|
||||
@ -249,6 +251,7 @@ public:
|
||||
|
||||
void SetScreenReaderState(const std::string &name, const std::string &state);
|
||||
bool GetDefaultUserScreenReaderState();
|
||||
AccountSA::OsAccountType GetAccountType();
|
||||
|
||||
void Init();
|
||||
|
||||
@ -307,8 +310,6 @@ private:
|
||||
*/
|
||||
void UpdateMagnificationCapability();
|
||||
|
||||
AccountSA::OsAccountType GetAccountType();
|
||||
|
||||
class AccessibilityAbility {
|
||||
public:
|
||||
AccessibilityAbility() = default;
|
||||
|
@ -32,7 +32,7 @@ private:
|
||||
void SubscribeShortKey(std::set<int32_t> preKeys, int32_t finalKey, int32_t holdTime);
|
||||
void OnShortKey();
|
||||
|
||||
std::list<int32_t> subscribeIds_;
|
||||
int32_t subscribeId_ = -1;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -40,7 +40,6 @@ namespace {
|
||||
constexpr int DISPLAY_DALTONIZER_GREEN = 12;
|
||||
constexpr int DISPLAY_DALTONIZER_RED = 11;
|
||||
constexpr int DISPLAY_DALTONIZER_BLUE = 13;
|
||||
constexpr int DEFAULT_ACCOUNT_ID = 100;
|
||||
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";
|
||||
@ -54,6 +53,8 @@ namespace {
|
||||
const std::string SCREEN_READER_BUNDLE_ABILITY_NAME = "com.huawei.hmos.screenreader/AccessibilityExtAbility";
|
||||
const std::string DEVICE_PROVISIONED = "device_provisioned";
|
||||
const std::string ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN = "accessibility_shortcut_on_lock_screen";
|
||||
const std::string ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN = "accessibility_shortcut_dialog_shown";
|
||||
} // namespace
|
||||
|
||||
AccessibilityAccountData::AccessibilityAccountData(int32_t accountId)
|
||||
@ -468,13 +469,7 @@ void AccessibilityAccountData::SetScreenReaderState(const std::string &name, con
|
||||
bool AccessibilityAccountData::GetDefaultUserScreenReaderState()
|
||||
{
|
||||
HILOG_DEBUG();
|
||||
auto datashare = std::make_shared<AccessibilityDatashareHelper>(DATASHARE_TYPE::SECURE, DEFAULT_ACCOUNT_ID);
|
||||
if (datashare == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::string tmpString = datashare->GetStringValue(ENABLED_ACCESSIBILITY_SERVICES, "");
|
||||
std::vector<std::string> services;
|
||||
Utils::StringToVector(tmpString, services);
|
||||
std::vector<std::string> services = config_->GetEnabledAccessibilityServices();
|
||||
auto iter = std::find(services.begin(), services.end(), SCREEN_READER_BUNDLE_ABILITY_NAME);
|
||||
return iter != services.end();
|
||||
}
|
||||
@ -530,6 +525,8 @@ void AccessibilityAccountData::GetConfigValueAtoHos(ConfigValueAtoHosUpdate &val
|
||||
provider.GetBoolValue(MASTER_MONO, value.audioMono);
|
||||
provider.GetBoolValue(ACCESSIBILITY_SCREENREADER_ENABLED, value.isScreenReaderEnabled);
|
||||
provider.GetFloatValue(MASTER_BALENCE, value.audioBalance);
|
||||
provider.GetBoolValue(ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, value.shortcutEnabledOnLockScreen);
|
||||
provider.GetBoolValue(ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, value.shortcutDialogShown);
|
||||
int tmpClickResTime = 0;
|
||||
provider.GetIntValue(CLICK_RESPONSE_TIME, tmpClickResTime);
|
||||
if (tmpClickResTime == DOUBLE_CLICK_RESPONSE_TIME_MEDIUM) {
|
||||
@ -638,6 +635,10 @@ void AccessibilityAccountData::Init()
|
||||
config_ = std::make_shared<AccessibilitySettingsConfig>(id_);
|
||||
config_->Init();
|
||||
}
|
||||
ErrCode rtn = AccountSA::OsAccountManager::GetOsAccountType(id_, accountType_);
|
||||
if (rtn != ERR_OK) {
|
||||
HILOG_ERROR("get account type failed for accountId [%{public}d]", id_);
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityAccountData::AddConfigCallback(
|
||||
@ -998,12 +999,6 @@ void AccessibilityAccountData::RemoveUITestClient(sptr<AccessibleAbilityConnecti
|
||||
|
||||
AccountSA::OsAccountType AccessibilityAccountData::GetAccountType()
|
||||
{
|
||||
if (accountType_ == AccountSA::OsAccountType::END) {
|
||||
ErrCode rtn = AccountSA::OsAccountManager::GetOsAccountType(id_, accountType_);
|
||||
if (rtn != ERR_OK) {
|
||||
HILOG_ERROR("get account type failed for accountId [%{public}d]", id_);
|
||||
}
|
||||
}
|
||||
return accountType_;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ namespace {
|
||||
const std::string GRAPHIC_ANIMATION_SCALE_NAME = "persist.sys.graphic.animationscale";
|
||||
const std::string ARKUI_ANIMATION_SCALE_NAME = "persist.sys.arkui.animationscale";
|
||||
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
|
||||
}
|
||||
|
||||
void AccessibilitySettings::RegisterSettingsHandler(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
|
||||
@ -479,6 +481,9 @@ void AccessibilitySettings::UpdateSettingsInAtoHosStatePart(ConfigValueAtoHosUpd
|
||||
if (atoHosValue.ignoreRepeatClickState) {
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(atoHosValue.ignoreRepeatClickState);
|
||||
}
|
||||
if (atoHosValue.shortcutEnabledOnLockScreen) {
|
||||
accountData->GetConfig()->SetShortKeyOnLockScreenState(atoHosValue.shortcutEnabledOnLockScreen);
|
||||
}
|
||||
UpdateConfigState();
|
||||
}
|
||||
|
||||
@ -515,6 +520,11 @@ void AccessibilitySettings::UpdateSettingsInAtoHos()
|
||||
accountData->GetConfig()->SetDaltonizationColorFilter(static_cast<uint32_t>(atoHosValue.displayDaltonizer));
|
||||
UpdateDaltonizationColorFilter();
|
||||
}
|
||||
if (atoHosValue.shortcutDialogShown) {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_AFTER_USE);
|
||||
} else {
|
||||
accountData->GetConfig()->SetShortKeyTimeout(SHORT_KEY_TIMEOUT_BEFORE_USE);
|
||||
}
|
||||
|
||||
if (atoHosValue.isScreenReaderEnabled) {
|
||||
uint32_t capabilities = CAPABILITY_GESTURE | CAPABILITY_KEY_EVENT_OBSERVER | CAPABILITY_RETRIEVE |
|
||||
|
@ -27,15 +27,11 @@ AccessibilityShortKey::~AccessibilityShortKey()
|
||||
{
|
||||
HILOG_INFO();
|
||||
|
||||
if (subscribeIds_.empty()) {
|
||||
if (subscribeId_ < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = subscribeIds_.begin(); it != subscribeIds_.end(); it = subscribeIds_.erase(it)) {
|
||||
if (*it >= 0) {
|
||||
MMI::InputManager::GetInstance()->UnsubscribeKeyEvent(*it);
|
||||
}
|
||||
}
|
||||
MMI::InputManager::GetInstance()->UnsubscribeKeyEvent(subscribeId_);
|
||||
}
|
||||
|
||||
void AccessibilityShortKey::SubscribeShortKey(std::set<int32_t> preKeys, int32_t finalKey, int32_t holdTime)
|
||||
@ -54,11 +50,11 @@ void AccessibilityShortKey::SubscribeShortKey(std::set<int32_t> preKeys, int32_t
|
||||
|
||||
auto keyEventCallBack = std::bind(&AccessibilityShortKey::OnShortKey, this);
|
||||
int32_t subscribeId = MMI::InputManager::GetInstance()->SubscribeKeyEvent(keyOption, keyEventCallBack);
|
||||
subscribeId_ = subscribeId;
|
||||
if (subscribeId < 0) {
|
||||
HILOG_ERROR("Subscribe key event failed, finalKey: %{public}d id: %{public}d", finalKey, subscribeId);
|
||||
return;
|
||||
}
|
||||
subscribeIds_.emplace_back(subscribeId);
|
||||
}
|
||||
|
||||
void AccessibilityShortKey::Register()
|
||||
@ -68,9 +64,6 @@ void AccessibilityShortKey::Register()
|
||||
std::set<int32_t> preDownKeysUp;
|
||||
preDownKeysUp.insert(MMI::KeyEvent::KEYCODE_VOLUME_UP);
|
||||
SubscribeShortKey(preDownKeysUp, MMI::KeyEvent::KEYCODE_VOLUME_DOWN, SHORTCUT_TIMEOUT);
|
||||
std::set<int32_t> preUpKeysDown;
|
||||
preUpKeysDown.insert(MMI::KeyEvent::KEYCODE_VOLUME_DOWN);
|
||||
SubscribeShortKey(preUpKeysDown, MMI::KeyEvent::KEYCODE_VOLUME_UP, SHORTCUT_TIMEOUT);
|
||||
}
|
||||
|
||||
void AccessibilityShortKey::OnShortKey()
|
||||
|
@ -69,6 +69,11 @@ namespace {
|
||||
constexpr int32_t SHORT_KEY_TIMEOUT_AFTER_USE = 1000; // ms
|
||||
constexpr int32_t WINDOW_ID_INVALID = -1;
|
||||
constexpr int64_t ELEMENT_ID_INVALID = -1;
|
||||
enum SCREENREADER_STATE : int32_t {
|
||||
UNINIT = -1,
|
||||
OFF = 0,
|
||||
ON = 1,
|
||||
};
|
||||
} // namespace
|
||||
|
||||
const bool REGISTER_RESULT =
|
||||
@ -1468,6 +1473,7 @@ void AccessibleAbilityManagerService::SwitchedUser(int32_t accountId)
|
||||
}
|
||||
|
||||
std::map<std::string, uint32_t> importantEnabledAbilities;
|
||||
SCREENREADER_STATE screenReaderState = SCREENREADER_STATE::UNINIT;
|
||||
// Clear last account's data
|
||||
if (currentAccountId_ != -1) {
|
||||
HILOG_DEBUG();
|
||||
@ -1477,6 +1483,8 @@ void AccessibleAbilityManagerService::SwitchedUser(int32_t accountId)
|
||||
return;
|
||||
}
|
||||
defaultConfigCallbacks_ = accountData->GetConfigCallbacks();
|
||||
screenReaderState = accountData->GetDefaultUserScreenReaderState() ?
|
||||
SCREENREADER_STATE::ON : SCREENREADER_STATE::OFF;
|
||||
accountData->GetImportantEnabledAbilities(importantEnabledAbilities);
|
||||
accountData->OnAccountSwitched();
|
||||
UpdateAccessibilityManagerService();
|
||||
@ -1499,6 +1507,14 @@ void AccessibleAbilityManagerService::SwitchedUser(int32_t accountId)
|
||||
HILOG_ERROR("Failed to set brightness discount");
|
||||
}
|
||||
#endif
|
||||
AccountSA::OsAccountType accountType = accountData->GetAccountType();
|
||||
if (screenReaderState != SCREENREADER_STATE::UNINIT &&
|
||||
(accountType == AccountSA::OsAccountType::PRIVATE || accountType == AccountSA::OsAccountType::ADMIN)) {
|
||||
bool state = (screenReaderState == SCREENREADER_STATE::ON) ? true : false;
|
||||
accountData->SetAbilityAutoStartState(SCREEN_READER_BUNDLE_ABILITY_NAME, state);
|
||||
HILOG_INFO("set screenreader auto-start state = %{public}d", true);
|
||||
}
|
||||
|
||||
if (accountData->GetInstalledAbilitiesFromBMS()) {
|
||||
accountData->UpdateImportantEnabledAbilities(importantEnabledAbilities);
|
||||
accountData->UpdateAbilities();
|
||||
|
@ -19,8 +19,7 @@
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
namespace {
|
||||
constexpr int32_t SUBSCRIBE_ID_1 = 1;
|
||||
constexpr int32_t SUBSCRIBE_ID_2 = 2;
|
||||
constexpr int32_t SUBSCRIBE_ID = 1;
|
||||
constexpr int32_t KEYCODE_VOLUME_UP = 0;
|
||||
constexpr int32_t KEYCODE_VOLUME_DOWN = 1;
|
||||
constexpr int32_t SHORTCUT_TIMEOUT = 3000;
|
||||
@ -29,7 +28,7 @@ namespace {
|
||||
AccessibilityShortKey::~AccessibilityShortKey()
|
||||
{
|
||||
HILOG_DEBUG("start.");
|
||||
subscribeIds_.clear();
|
||||
subscribeId_ = -1;
|
||||
}
|
||||
|
||||
void AccessibilityShortKey::SubscribeShortKey(std::set<int32_t> preKeys, int32_t finalKey, int32_t holdTime)
|
||||
@ -38,8 +37,7 @@ void AccessibilityShortKey::SubscribeShortKey(std::set<int32_t> preKeys, int32_t
|
||||
(void)preKeys;
|
||||
(void)finalKey;
|
||||
(void)holdTime;
|
||||
subscribeIds_.emplace_back(SUBSCRIBE_ID_1);
|
||||
subscribeIds_.emplace_back(SUBSCRIBE_ID_2);
|
||||
subscribeId_ = SUBSCRIBE_ID;
|
||||
}
|
||||
|
||||
void AccessibilityShortKey::Register()
|
||||
|
Loading…
x
Reference in New Issue
Block a user