Java Code Examples for android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_GENERIC

The following examples show how to use android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_GENERIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UiAutomationConnection.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void registerUiTestAutomationServiceLocked(IAccessibilityServiceClient client,
        int flags) {
    IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(
            ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
    final AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
    info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
            | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
            | AccessibilityServiceInfo.FLAG_FORCE_DIRECT_BOOT_AWARE;
    info.setCapabilities(AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
            | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
            | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
            | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS);
    try {
        // Calling out with a lock held is fine since if the system
        // process is gone the client calling in will be killed.
        manager.registerUiTestAutomationService(mToken, client, info, flags);
        mClient = client;
    } catch (RemoteException re) {
        throw new IllegalStateException("Error while registering UiTestAutomationService.", re);
    }
}
 
Example 2
Source File: AccessibilityService.java    From Status with Apache License 2.0 6 votes vote down vote up
@Override
protected void onServiceConnected() {
    super.onServiceConnected();

    packageManager = getPackageManager();

    volumeReceiver = new VolumeReceiver(this);
    registerReceiver(volumeReceiver, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));

    notifications = new ArrayList<>();
    AccessibilityServiceInfo config = new AccessibilityServiceInfo();
    config.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED | AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
    config.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        config.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;

    setServiceInfo(config);
}
 
Example 3
Source File: NotificationAccessibilityService.java    From OpenFit with MIT License 6 votes vote down vote up
@Override
protected void onServiceConnected() {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    // Set the type of events that this service wants to listen to.
    info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;

    // Set package names to listen for or listen for all applications
    //info.packageNames = new String[] {"com.appone.totest.accessibility", "com.apptwo.totest.accessibility"};
 
    // Set the type of feedback your service will provide.
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_ALL_MASK;
    }
    else {
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
    }

    // info.flags = AccessibilityServiceInfo.DEFAULT;

    info.notificationTimeout = 100;
    this.setServiceInfo(info);
}
 
Example 4
Source File: AccessibilityServiceInfoCompat.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the string representation of a feedback type. For example,
 * {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
 * string FEEDBACK_SPOKEN.
 *
 * @param feedbackType The feedback type.
 * @return The string representation.
 */
public static String feedbackTypeToString(int feedbackType) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    while (feedbackType > 0) {
        final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
        feedbackType &= ~feedbackTypeFlag;
        if (builder.length() > 1) {
            builder.append(", ");
        }
        switch (feedbackTypeFlag) {
            case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
                builder.append("FEEDBACK_AUDIBLE");
                break;
            case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
                builder.append("FEEDBACK_HAPTIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_GENERIC:
                builder.append("FEEDBACK_GENERIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
                builder.append("FEEDBACK_SPOKEN");
                break;
            case AccessibilityServiceInfo.FEEDBACK_VISUAL:
                builder.append("FEEDBACK_VISUAL");
                break;
        }
    }
    builder.append("]");
    return builder.toString();
}
 
Example 5
Source File: AccessibilityServiceInfoCompat.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the string representation of a feedback type. For example,
 * {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
 * string FEEDBACK_SPOKEN.
 *
 * @param feedbackType The feedback type.
 * @return The string representation.
 */
public static String feedbackTypeToString(int feedbackType) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    while (feedbackType > 0) {
        final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
        feedbackType &= ~feedbackTypeFlag;
        if (builder.length() > 1) {
            builder.append(", ");
        }
        switch (feedbackTypeFlag) {
            case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
                builder.append("FEEDBACK_AUDIBLE");
                break;
            case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
                builder.append("FEEDBACK_HAPTIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_GENERIC:
                builder.append("FEEDBACK_GENERIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
                builder.append("FEEDBACK_SPOKEN");
                break;
            case AccessibilityServiceInfo.FEEDBACK_VISUAL:
                builder.append("FEEDBACK_VISUAL");
                break;
        }
    }
    builder.append("]");
    return builder.toString();
}
 
Example 6
Source File: AccessibilityService.java    From AcDisplay with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onServiceConnected() {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
    info.notificationTimeout = 100;
    setServiceInfo(info);
}
 
Example 7
Source File: AccessibilityServiceInfoCompat.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the string representation of a feedback type. For example,
 * {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
 * string FEEDBACK_SPOKEN.
 *
 * @param feedbackType The feedback type.
 * @return The string representation.
 */
public static String feedbackTypeToString(int feedbackType) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    while (feedbackType > 0) {
        final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
        feedbackType &= ~feedbackTypeFlag;
        if (builder.length() > 1) {
            builder.append(", ");
        }
        switch (feedbackTypeFlag) {
            case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
                builder.append("FEEDBACK_AUDIBLE");
                break;
            case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
                builder.append("FEEDBACK_HAPTIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_GENERIC:
                builder.append("FEEDBACK_GENERIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
                builder.append("FEEDBACK_SPOKEN");
                break;
            case AccessibilityServiceInfo.FEEDBACK_VISUAL:
                builder.append("FEEDBACK_VISUAL");
                break;
        }
    }
    builder.append("]");
    return builder.toString();
}
 
Example 8
Source File: AccessibilityServiceInfoCompat.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
/**
 * Returns the string representation of a feedback type. For example,
 * {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
 * string FEEDBACK_SPOKEN.
 *
 * @param feedbackType The feedback type.
 * @return The string representation.
 */
public static String feedbackTypeToString(int feedbackType) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    while (feedbackType > 0) {
        final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
        feedbackType &= ~feedbackTypeFlag;
        if (builder.length() > 1) {
            builder.append(", ");
        }
        switch (feedbackTypeFlag) {
            case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
                builder.append("FEEDBACK_AUDIBLE");
                break;
            case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
                builder.append("FEEDBACK_HAPTIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_GENERIC:
                builder.append("FEEDBACK_GENERIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
                builder.append("FEEDBACK_SPOKEN");
                break;
            case AccessibilityServiceInfo.FEEDBACK_VISUAL:
                builder.append("FEEDBACK_VISUAL");
                break;
        }
    }
    builder.append("]");
    return builder.toString();
}
 
Example 9
Source File: AccessibilityServiceInfoCompat.java    From guideshow with MIT License 5 votes vote down vote up
/**
 * Returns the string representation of a feedback type. For example,
 * {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
 * string FEEDBACK_SPOKEN.
 *
 * @param feedbackType The feedback type.
 * @return The string representation.
 */
public static String feedbackTypeToString(int feedbackType) {
    StringBuilder builder = new StringBuilder();
    builder.append("[");
    while (feedbackType > 0) {
        final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
        feedbackType &= ~feedbackTypeFlag;
        if (builder.length() > 1) {
            builder.append(", ");
        }
        switch (feedbackTypeFlag) {
            case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
                builder.append("FEEDBACK_AUDIBLE");
                break;
            case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
                builder.append("FEEDBACK_HAPTIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_GENERIC:
                builder.append("FEEDBACK_GENERIC");
                break;
            case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
                builder.append("FEEDBACK_SPOKEN");
                break;
            case AccessibilityServiceInfo.FEEDBACK_VISUAL:
                builder.append("FEEDBACK_VISUAL");
                break;
        }
    }
    builder.append("]");
    return builder.toString();
}
 
Example 10
Source File: AccessibilityService.java    From HeadsUp with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onServiceConnected() {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
    info.notificationTimeout = 100;
    setServiceInfo(info);
}