!76 codex修复

Merge pull request !76 from yichengzhao/master
This commit is contained in:
openharmony_ci 2022-03-16 08:06:04 +00:00 committed by Gitee
commit e0fee17bf9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 47 additions and 9 deletions

View File

@ -124,7 +124,11 @@ void AccessibilityInputInterceptor::CreateTransmitters()
sptr<EventTransmission> current = nullptr;
if (availableFunctions_& FEATURE_INJECT_TOUCH_EVENTS) {
sptr<TouchEventInjector> touchEventInjector = new TouchEventInjector();
sptr<TouchEventInjector> touchEventInjector = new(std::nothrow) TouchEventInjector();
if (!touchEventInjector) {
HILOG_ERROR("touchEventInjector is null");
return;
}
SetNextEventTransmitter(header, current, touchEventInjector);
aams_->SetTouchEventInjector(touchEventInjector);
}
@ -139,7 +143,11 @@ void AccessibilityInputInterceptor::CreateTransmitters()
}
if (availableFunctions_& FEATURE_TOUCH_EXPLORATION) {
sptr<TouchGuider> touchGuider = new TouchGuider();
sptr<TouchGuider> touchGuider = new(std::nothrow) TouchGuider();
if (!touchGuider) {
HILOG_ERROR("touchGuider is null");
return;
}
touchGuider->StartUp();
SetNextEventTransmitter(header, current, touchGuider);
}

View File

@ -47,8 +47,17 @@ AccessibilityInteractionBridge::AccessibilityInteractionBridge()
}
abilityInfo->SetCapabilityValues(Capability::CAPABILITY_RETRIEVE);
accountData_ = DelayedSingleton<AccessibleAbilityManagerService>::GetInstance()->GetCurrentAccountData();
connection_ = new AccessibleAbilityConnection(accountData_, INTERACTION_BRIDGE_CHANNEL_ID, *abilityInfo);
channel_ = new AccessibleAbilityChannelStubImpl(*connection_);
connection_ = new(std::nothrow) AccessibleAbilityConnection(accountData_,
INTERACTION_BRIDGE_CHANNEL_ID, *abilityInfo);
if (!connection_) {
HILOG_ERROR("connection_ is null");
return;
}
channel_ = new(std::nothrow) AccessibleAbilityChannelStubImpl(*connection_);
if (!channel_) {
HILOG_ERROR("channel_ is null");
return;
}
if (!channel_) {
HILOG_DEBUG("channel is nullptr.");
AccessibilityOperator::GetInstance().RemoveChannel(INTERACTION_BRIDGE_CHANNEL_ID);

View File

@ -317,7 +317,11 @@ void AccessibleAbilityConnection::OnAbilityConnectDone(const AppExecFwk::Element
}
if (!proxy_) {
proxy_ = new AccessibleAbilityClientProxy(remoteObject);
proxy_ = new(std::nothrow) AccessibleAbilityClientProxy(remoteObject);
if (!proxy_) {
HILOG_ERROR("proxy_ is null");
return;
}
}
if (!proxy_) {
@ -327,7 +331,11 @@ void AccessibleAbilityConnection::OnAbilityConnectDone(const AppExecFwk::Element
HILOG_DEBUG("AccessibleAbilityConnection::OnAbilityConnectDone get AccessibleAbilityClientProxy successfully");
if (!deathRecipient_) {
deathRecipient_ = new AccessibleAbilityConnectionDeathRecipient(accountData_, elementName_);
deathRecipient_ = new(std::nothrow) AccessibleAbilityConnectionDeathRecipient(accountData_, elementName_);
if (!deathRecipient_) {
HILOG_ERROR("deathRecipient_ is null");
return;
}
}
if (!proxy_->AsObject()->AddDeathRecipient(deathRecipient_)) {

View File

@ -196,6 +196,7 @@ uint32_t AccessibleAbilityManagerService::RegisterCaptionPropertyCallback(
captionPropertyCallbackDeathRecipient_ = new(std::nothrow) CaptionPropertyCallbackDeathRecipient();
if (!captionPropertyCallbackDeathRecipient_) {
HILOG_ERROR("captionPropertyCallbackDeathRecipient_ is null");
return ERR_INVALID_VALUE;
}
}
@ -284,7 +285,11 @@ void AccessibleAbilityManagerService::RegisterElementOperator(
accountData->AddAccessibilityWindowConnection(windowId, connection);
if (!interactionOperationDeathRecipient_) {
interactionOperationDeathRecipient_ = new InteractionOperationDeathRecipient(windowId);
interactionOperationDeathRecipient_ = new(std::nothrow) InteractionOperationDeathRecipient(windowId);
if (!interactionOperationDeathRecipient_) {
HILOG_ERROR("interactionOperationDeathRecipient_ is null");
return;
}
}
if (connection->GetProxy()) {
@ -989,11 +994,19 @@ void AccessibleAbilityManagerService::AddUITestClient(const sptr<IRemoteObject>&
currentAccountData->AddInstalledAbility(*abilityInfo);
// add connected ability
sptr<AppExecFwk::ElementName> elementName = new AppExecFwk::ElementName();
sptr<AppExecFwk::ElementName> elementName = new(std::nothrow) AppExecFwk::ElementName();
if (!elementName) {
HILOG_ERROR("elementName is null");
return;
}
elementName->SetBundleName(UI_TEST_BUNDLE_NAME);
elementName->SetAbilityName(UI_TEST_ABILITY_NAME);
sptr<AccessibleAbilityConnection> connection = new AccessibleAbilityConnection(
sptr<AccessibleAbilityConnection> connection = new(std::nothrow) AccessibleAbilityConnection(
currentAccountData, connectCounter_++, *abilityInfo);
if (!connection) {
HILOG_ERROR("connection is null");
return;
}
connection->OnAbilityConnectDone(*elementName, obj, 0);
}