use of android.view.accessibility.AccessibilityManager in project platform_frameworks_base by android.
the class AccessibilityManagerTest method createManager.
private AccessibilityManager createManager(boolean enabled) throws Exception {
if (enabled) {
when(mMockService.addClient(any(IAccessibilityManagerClient.class), anyInt())).thenReturn(AccessibilityManager.STATE_FLAG_ACCESSIBILITY_ENABLED);
} else {
when(mMockService.addClient(any(IAccessibilityManagerClient.class), anyInt())).thenReturn(0);
}
AccessibilityManager manager = new AccessibilityManager(mContext, mMockService, UserHandle.USER_CURRENT);
verify(mMockService).addClient(any(IAccessibilityManagerClient.class), anyInt());
return manager;
}
use of android.view.accessibility.AccessibilityManager in project platform_frameworks_base by android.
the class TouchExplorer method sendAccessibilityEvent.
/**
* Sends an accessibility event of the given type.
*
* @param type The event type.
*/
private void sendAccessibilityEvent(int type) {
AccessibilityManager accessibilityManager = AccessibilityManager.getInstance(mContext);
if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(type);
event.setWindowId(mAms.getActiveWindowId());
accessibilityManager.sendAccessibilityEvent(event);
switch(type) {
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
{
mTouchExplorationInProgress = true;
}
break;
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END:
{
mTouchExplorationInProgress = false;
}
break;
}
}
}
use of android.view.accessibility.AccessibilityManager in project android_frameworks_base by DirtyUnicorns.
the class TouchExplorer method sendAccessibilityEvent.
/**
* Sends an accessibility event of the given type.
*
* @param type The event type.
*/
private void sendAccessibilityEvent(int type) {
AccessibilityManager accessibilityManager = AccessibilityManager.getInstance(mContext);
if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(type);
event.setWindowId(mAms.getActiveWindowId());
accessibilityManager.sendAccessibilityEvent(event);
switch(type) {
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
{
mTouchExplorationInProgress = true;
}
break;
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END:
{
mTouchExplorationInProgress = false;
}
break;
}
}
}
use of android.view.accessibility.AccessibilityManager in project android_frameworks_base by DirtyUnicorns.
the class EnableAccessibilityController method isAccessibilityEnabled.
public static boolean isAccessibilityEnabled(Context context) {
final AccessibilityManager accessibilityManager = context.getSystemService(AccessibilityManager.class);
List enabledServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN);
return enabledServices != null && !enabledServices.isEmpty();
}
use of android.view.accessibility.AccessibilityManager in project Etar-Calendar by Etar-Group.
the class EditEventView method sendAccessibilityEvent.
private void sendAccessibilityEvent() {
AccessibilityManager am = (AccessibilityManager) mActivity.getSystemService(Service.ACCESSIBILITY_SERVICE);
if (!am.isEnabled() || mModel == null) {
return;
}
StringBuilder b = new StringBuilder();
addFieldsRecursive(b, mView);
CharSequence msg = b.toString();
AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
event.setClassName(getClass().getName());
event.setPackageName(mActivity.getPackageName());
event.getText().add(msg);
event.setAddedCount(msg.length());
am.sendAccessibilityEvent(event);
}
Aggregations