Java Code Examples for android.accessibilityservice.AccessibilityServiceInfo#DEFAULT

The following examples show how to use android.accessibilityservice.AccessibilityServiceInfo#DEFAULT . 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: 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);
}
 
Example 3
Source File: LgcAccessibilityService.java    From live-group-chat with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onServiceConnected() {
    super.onServiceConnected();
    run = true;
    if (Build.VERSION.SDK_INT < 14) {
        AccessibilityServiceInfo serverInfo = new AccessibilityServiceInfo();
        serverInfo.eventTypes =
                AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED
                        | AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
        serverInfo.feedbackType = AccessibilityServiceInfo.FEEDBACK_VISUAL;
        serverInfo.flags = AccessibilityServiceInfo.DEFAULT;
        serverInfo.notificationTimeout = 0L;
        setServiceInfo(serverInfo);
    }
}
 
Example 4
Source File: NotificationListenerAccessibilityService.java    From heads-up with GNU General Public License v3.0 4 votes vote down vote up
@Override
   protected void onServiceConnected()
{
       PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
               .edit()
               .putBoolean("running", true)
               .apply();
       if (isInit)
           return;

       AccessibilityServiceInfo info = new AccessibilityServiceInfo();
       info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
       info.feedbackType = AccessibilityServiceInfo.FEEDBACK_VISUAL;
       info.flags = AccessibilityServiceInfo.DEFAULT;
       setServiceInfo(info);
       isInit = true;
       doLoadSettings();

       if (Build.VERSION.SDK_INT >= 18) {
           Intent intent = new Intent();
           intent.setClass(getApplicationContext(), OverlayServiceCommon.class);
           intent.setAction("STAY");
           intent.putExtra("packageName", getPackageName());
           intent.putExtra("title", getString(R.string.app_name));

           if (isNotificationListenerEnabled())
               intent.putExtra("text", getString(R.string.intro_warning_both_services));
           else {
               final String str = getString(R.string.accessibility_desc);
               intent.putExtra("text", str.substring(str.lastIndexOf("\n") + 1));
           }
           intent.putExtra("action", PendingIntent.getActivity(getApplicationContext(), 0, new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), 0));

           if (Build.VERSION.SDK_INT >= 11) {
               Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_dismiss_white);
               intent.putExtra("iconLarge", bitmap);
           }
           intent.putExtra("icon", R.drawable.ic_dismiss_white);
           startService(intent);
           stopSelf();
       }
   }