Search in sources :

Example 91 with AccessibilityManager

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;
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) IAccessibilityManagerClient(android.view.accessibility.IAccessibilityManagerClient)

Example 92 with AccessibilityManager

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;
        }
    }
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 93 with AccessibilityManager

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;
        }
    }
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 94 with AccessibilityManager

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();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) ArrayList(java.util.ArrayList) List(java.util.List)

Example 95 with AccessibilityManager

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);
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Aggregations

AccessibilityManager (android.view.accessibility.AccessibilityManager)170 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)54 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)49 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)43 ArrayList (java.util.ArrayList)26 ServiceInfo (android.content.pm.ServiceInfo)20 MediumTest (android.test.suitebuilder.annotation.MediumTest)20 ComponentName (android.content.ComponentName)16 Drawable (android.graphics.drawable.Drawable)10 Bundle (android.os.Bundle)9 EnforcedAdmin (com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)8 RestrictedPreference (com.android.settingslib.RestrictedPreference)8 SuppressLint (android.annotation.SuppressLint)7 Context (android.content.Context)7 SwitchPreference (android.support.v14.preference.SwitchPreference)7 ListPreference (android.support.v7.preference.ListPreference)7 Preference (android.support.v7.preference.Preference)7 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)7 ITransientNotification (android.app.ITransientNotification)6 Notification (android.app.Notification)6