Android examples for User Interface:AccessibilityEvent
is Accessibility Service On
//package com.java2s; import java.util.ArrayList; import android.content.Context; import android.provider.Settings; import android.text.TextUtils; public class Main { public static boolean isAccessibilityServiceOn(Context context, String packageName, String className) { ArrayList<String> allAccessibilityServices = getAllAccessibilityServices(context); StringBuffer concat = new StringBuffer(); concat.append(packageName);//from ww w . j a v a 2s. c om concat.append('/'); concat.append(className); return allAccessibilityServices.contains(concat.toString()); } public static ArrayList<String> getAllAccessibilityServices( Context context) { TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter( ':'); ArrayList<String> allAccessibilityServices = new ArrayList<String>(); String settingValue = Settings.Secure.getString(context .getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); if (settingValue != null) { colonSplitter.setString(settingValue); while (colonSplitter.hasNext()) { String accessabilityService = colonSplitter.next(); allAccessibilityServices.add(accessabilityService); } } return allAccessibilityServices; } }