Java Code Examples for android.view.accessibility.AccessibilityEvent#TYPES_ALL_MASK

The following examples show how to use android.view.accessibility.AccessibilityEvent#TYPES_ALL_MASK . 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: VolumeAccessibilityService.java    From Noyze with Apache License 2.0 5 votes vote down vote up
protected void initServiceInfo() {
	mInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    mInfo.notificationTimeout = 100;
    
    // This is the KEY (to KeyEvents)! Sweet deal.
    mInfo.flags = AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;

	// We'll respond with a popup (visual), and possibly a noise (audible)
	// and/ or a vibration (haptic). No spoken feedback here!
    mInfo.feedbackType = (AccessibilityServiceInfo.FEEDBACK_VISUAL	|
    					  AccessibilityServiceInfo.FEEDBACK_AUDIBLE	|
    					  AccessibilityServiceInfo.FEEDBACK_HAPTIC	);
    
    setServiceInfo(mInfo);
}
 
Example 3
Source File: TestAccessibilitySerivce.java    From Android-Plugin-Framework with MIT License 5 votes vote down vote up
@Override
protected void onServiceConnected() {
    super.onServiceConnected();
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.packageNames = null; //监听过滤的包名 null to all
    info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; //监听哪些行为
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN; //反馈
    info.notificationTimeout = 100; //通知的时间
    setServiceInfo(info);
    Log.printStackTrace();
    Log.e("TestAccessibilitySerivce onServiceConnected");
}
 
Example 4
Source File: VolumeAccessibilityService.java    From Noyze with Apache License 2.0 5 votes vote down vote up
protected void initServiceInfo() {
	mInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    mInfo.notificationTimeout = 100;
    
    // This is the KEY (to KeyEvents)! Sweet deal.
    mInfo.flags = AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;

	// We'll respond with a popup (visual), and possibly a noise (audible)
	// and/ or a vibration (haptic). No spoken feedback here!
    mInfo.feedbackType = (AccessibilityServiceInfo.FEEDBACK_VISUAL	|
    					  AccessibilityServiceInfo.FEEDBACK_AUDIBLE	|
    					  AccessibilityServiceInfo.FEEDBACK_HAPTIC	);
    
    setServiceInfo(mInfo);
}
 
Example 5
Source File: NotificationUpdateServiceOld.java    From deskcon-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onServiceConnected() {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    info.notificationTimeout = 1;
    info.feedbackType = AccessibilityEvent.TYPES_ALL_MASK;
    setServiceInfo(info);
}
 
Example 6
Source File: ClockBackService.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the {@link AccessibilityServiceInfo} which informs the system how to
 * handle this {@link AccessibilityService}.
 *
 * @param feedbackType The type of feedback this service will provide.
 * <p>
 *   Note: The feedbackType parameter is an bitwise or of all
 *   feedback types this service would like to provide.
 * </p>
 */
private void setServiceInfo(int feedbackType) {
    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    // We are interested in all types of accessibility events.
    info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
    // We want to provide specific type of feedback.
    info.feedbackType = feedbackType;
    // We want to receive events in a certain interval.
    info.notificationTimeout = EVENT_NOTIFICATION_TIMEOUT_MILLIS;
    // We want to receive accessibility events only from certain packages.
    info.packageNames = PACKAGE_NAMES;
    setServiceInfo(info);
}