Java Code Examples for android.accessibilityservice.AccessibilityServiceInfo#FLAG_REPORT_VIEW_IDS

The following examples show how to use android.accessibilityservice.AccessibilityServiceInfo#FLAG_REPORT_VIEW_IDS . 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: AccessibilityServiceImpl.java    From SoloPi with Apache License 2.0 6 votes vote down vote up
private void setServiceInfoToTouchBlockMode() {
    AccessibilityServiceInfo info = getServiceInfo();
    if (info == null) {
        LogUtil.e(TAG, "ServiceInfo为空");
        return;
    }
    info.flags = AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS |
            AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY |
            AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
            AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS |
            AccessibilityServiceInfo.DEFAULT |
            AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE;

    LogUtil.d(TAG, "辅助功能进入触摸监控模式");
    setServiceInfo(info);
}
 
Example 2
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 3
Source File: AccessibilityServiceImpl.java    From SoloPi with Apache License 2.0 5 votes vote down vote up
private void setServiceToNormalMode() {
    AccessibilityServiceInfo info = getServiceInfo();
    if (info == null) {
        LogUtil.e(TAG, "ServiceInfo为空");
        return;
    }
    info.flags = AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS |
            AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
            AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY |
            AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS |
            AccessibilityServiceInfo.DEFAULT;

    LogUtil.d(TAG, "辅助功能进入正常模式");
    setServiceInfo(info);
}