Java Code Examples for android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_VISUAL

The following examples show how to use android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_VISUAL . 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: NotificationService.java    From pebble-notifier with MIT License 6 votes vote down vote up
@Override
protected void onServiceConnected() {
    // get inital preferences

    watchFile = new File(getFilesDir() + "PrefsChanged.none");
    if (!watchFile.exists()) {
        try {
            watchFile.createNewFile();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        watchFile.setLastModified(System.currentTimeMillis());
    }
    loadPrefs();

    AccessibilityServiceInfo info = new AccessibilityServiceInfo();
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_VISUAL;
    info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
    info.notificationTimeout = 100;
    setServiceInfo(info);

    mHandler = new Handler();
    queue = new LinkedList<queueItem>();
}
 
Example 2
Source File: ImageStreamUi.java    From belvedere with Apache License 2.0 5 votes vote down vote up
@Override
public boolean shouldShowFullScreen() {

    // Show full screen image stream if the app is in multi window or picture in picture mode
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        if (activity.isInMultiWindowMode() || activity.isInPictureInPictureMode()) {
            return true;
        }
    }

    // If there's a hardware keyboard attached show the picker in full screen mode
    final boolean hasHardwareKeyboard =
            activity.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
    if (hasHardwareKeyboard) {
        return true;
    }

    // If there's an accessibility service enabled, show in full screen mode
    // Exclude AccessibilityServiceInfo.FEEDBACK_GENRICE this is used by password mangers.
    final AccessibilityManager manager = (AccessibilityManager) activity.getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (manager != null) {
        int flags = AccessibilityServiceInfo.FEEDBACK_AUDIBLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN
                | AccessibilityServiceInfo.FEEDBACK_VISUAL | AccessibilityServiceInfo.FEEDBACK_BRAILLE
                | AccessibilityServiceInfo.FEEDBACK_HAPTIC;
        final List<AccessibilityServiceInfo> enabledAccessibilityServiceList = manager.getEnabledAccessibilityServiceList(flags);

        if (enabledAccessibilityServiceList != null && enabledAccessibilityServiceList.size() > 0) {
            return true;
        }
    }

    return false;
}
 
Example 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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();
       }
   }