mirror of
https://github.com/openharmony/accessibility.git
synced 2026-08-24 22:11:28 -04:00
@@ -65,6 +65,7 @@ namespace Accessibility {
|
||||
DISCONNECT,
|
||||
ON_ACCESSIBILITY_EVENT,
|
||||
ON_KEY_PRESS_EVENT,
|
||||
EXECUTE_DISCONNECT_CALLBACK,
|
||||
|
||||
ON_PROPERTY_CHANGED = 600,
|
||||
|
||||
@@ -149,6 +150,8 @@ namespace Accessibility {
|
||||
REMOVE_REQUEST_ID,
|
||||
SERVICE_CODE_END,
|
||||
GET_SCREEN_READER_STATE,
|
||||
SET_IS_REGISTER_DISCONNECT_CALLBACK,
|
||||
NOTIFY_DISCONNECT,
|
||||
|
||||
ON_STATE_CHANGED = 900,
|
||||
};
|
||||
|
||||
+15
@@ -79,6 +79,21 @@ class AccessibilityExtensionContext extends ExtensionContext {
|
||||
console.log('unholdRunningLockSync');
|
||||
return this.__context_impl__.unholdRunningLockSync();
|
||||
}
|
||||
|
||||
on(type, callback) {
|
||||
console.log('on');
|
||||
return this.__context_impl__.on(type, callback);
|
||||
}
|
||||
|
||||
off(type, callback) {
|
||||
console.log('off');
|
||||
return this.__context_impl__.off(type, callback);
|
||||
}
|
||||
|
||||
notifyDisconnect() {
|
||||
console.log('notifyDisconnect');
|
||||
return this.__context_impl__.notifyDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
export default AccessibilityExtensionContext;
|
||||
@@ -808,5 +808,36 @@ bool AccessibleAbilityChannel::CheckWinFromAwm(const int32_t windowId)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RetError AccessibleAbilityChannel::SetIsRegisterDisconnectCallback(bool isRegister)
|
||||
{
|
||||
HILOG_INFO();
|
||||
sptr<AccessibleAbilityConnection> clientConnection = GetConnection(accountId_, clientName_);
|
||||
if (clientConnection == nullptr) {
|
||||
HILOG_ERROR("GetConnection failed, clientName: %{public}s", clientName_.c_str());
|
||||
return RET_ERR_NULLPTR;
|
||||
}
|
||||
clientConnection->SetIsRegisterDisconnectCallback(isRegister);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
RetError AccessibleAbilityChannel::NotifyDisconnect()
|
||||
{
|
||||
HILOG_INFO();
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetAccountData(accountId_);
|
||||
if (accountData == nullptr) {
|
||||
HILOG_ERROR("accountData is nullptr");
|
||||
return RET_ERR_NULLPTR;
|
||||
}
|
||||
sptr<AccessibleAbilityConnection> clientConnection = accountData->GetWaitDisConnectAbility(clientName_);
|
||||
accountData->RemoveWaitDisconnectAbility(clientName_);
|
||||
if (clientConnection == nullptr) {
|
||||
HILOG_ERROR("GetConnection failed, clientName: %{public}s", clientName_.c_str());
|
||||
return RET_ERR_NULLPTR;
|
||||
}
|
||||
clientConnection->NotifyDisconnect();
|
||||
return RET_OK;
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
Reference in New Issue
Block a user