Search in sources :

Example 56 with AccessibilityManager

use of android.view.accessibility.AccessibilityManager in project android_packages_apps_Settings by DirtyUnicorns.

the class ShortcutServicePickerFragment method getCandidates.

@Override
protected List<? extends DefaultAppInfo> getCandidates() {
    final AccessibilityManager accessibilityManager = getContext().getSystemService(AccessibilityManager.class);
    final List<AccessibilityServiceInfo> installedServices = accessibilityManager.getInstalledAccessibilityServiceList();
    final int numInstalledServices = installedServices.size();
    List<DefaultAppInfo> candidates = new ArrayList<>(numInstalledServices);
    for (int i = 0; i < numInstalledServices; i++) {
        AccessibilityServiceInfo installedServiceInfo = installedServices.get(i);
        candidates.add(new DefaultAppInfo(mPm, UserHandle.myUserId(), installedServiceInfo.getComponentName(), (String) installedServiceInfo.loadSummary(mPm.getPackageManager()), true));
    }
    return candidates;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityManager(android.view.accessibility.AccessibilityManager) ArrayList(java.util.ArrayList) DefaultAppInfo(com.android.settings.applications.defaultapps.DefaultAppInfo)

Example 57 with AccessibilityManager

use of android.view.accessibility.AccessibilityManager in project android_packages_apps_Dialer by MoKee.

the class GlowPadView method getScaledGlowRadiusSquared.

private float getScaledGlowRadiusSquared() {
    final float scaledTapRadius;
    final AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager.isEnabled()) {
        scaledTapRadius = TAP_RADIUS_SCALE_ACCESSIBILITY_ENABLED * mGlowRadius;
    } else {
        scaledTapRadius = mGlowRadius;
    }
    return square(scaledTapRadius);
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager)

Example 58 with AccessibilityManager

use of android.view.accessibility.AccessibilityManager in project MaxLock by Maxr1998.

the class MLImplementation method isAccessibilityEnabled.

private static boolean isAccessibilityEnabled(Context c) {
    AccessibilityManager manager = (AccessibilityManager) c.getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> infos = manager.getEnabledAccessibilityServiceList(FEEDBACK_GENERIC | FEEDBACK_VISUAL);
    for (int i = 0; i < infos.size(); i++) {
        // Ugh. Isn't there sth better? Definitely a // TODO
        String packageName = infos.get(i).getResolveInfo().serviceInfo.packageName;
        if (packageName.equals(BuildConfig.APPLICATION_ID)) {
            return true;
        }
    }
    return false;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityManager(android.view.accessibility.AccessibilityManager) SuppressLint(android.annotation.SuppressLint)

Example 59 with AccessibilityManager

use of android.view.accessibility.AccessibilityManager in project Saiy-PS by brandall76.

the class SelfAwareHelper method saiyAccessibilityRunning.

/**
 * Check the running condition of {@link SaiyAccessibilityService}
 *
 * @param ctx the application context
 */
public static boolean saiyAccessibilityRunning(@NonNull final Context ctx) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "saiyAccessibilityRunning");
    }
    final AccessibilityManager aManager = (AccessibilityManager) ctx.getSystemService(Context.ACCESSIBILITY_SERVICE);
    String className;
    for (final AccessibilityServiceInfo service : aManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)) {
        try {
            className = service.getId();
            if (className != null) {
                if (className.trim().endsWith(SaiyAccessibilityService.class.getSimpleName())) {
                    if (DEBUG) {
                        MyLog.i(CLS_NAME, "SaiyAccessibilityService running");
                    }
                    return true;
                }
            }
        } catch (final NullPointerException e) {
            if (DEBUG) {
                MyLog.w(CLS_NAME, "NullPointerException");
            }
        } catch (final Exception e) {
            if (DEBUG) {
                MyLog.w(CLS_NAME, "Exception");
            }
        }
    }
    if (DEBUG) {
        MyLog.i(CLS_NAME, "SaiyAccessibilityService not running");
    }
    return false;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityManager(android.view.accessibility.AccessibilityManager) UtilsString(ai.saiy.android.utils.UtilsString) SaiyAccessibilityService(ai.saiy.android.accessibility.SaiyAccessibilityService) RemoteException(android.os.RemoteException)

Example 60 with AccessibilityManager

use of android.view.accessibility.AccessibilityManager in project PhoneProfilesPlus by henrichg.

the class AccessibilityServiceBroadcastReceiver method isAccessibilityServiceEnabled.

static boolean isAccessibilityServiceEnabled(Context context) {
    AccessibilityManager manager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (manager != null) {
        List<AccessibilityServiceInfo> runningServices = manager.getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK);
        for (AccessibilityServiceInfo service : runningServices) {
            if (service != null) {
                PPApplication.logE("AccessibilityServiceBroadcastReceiver.isAccessibilityServiceEnabled", "serviceId=" + service.getId());
                if (PPApplication.EXTENDER_ACCESSIBILITY_SERVICE_ID.equals(service.getId())) {
                    PPApplication.logE("AccessibilityServiceBroadcastReceiver.isAccessibilityServiceEnabled", "true");
                    return true;
                }
            }
        }
        PPApplication.logE("AccessibilityServiceBroadcastReceiver.isAccessibilityServiceEnabled", "false");
        return false;
    }
    PPApplication.logE("AccessibilityServiceBroadcastReceiver.isAccessibilityServiceEnabled", "false");
    return false;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityManager(android.view.accessibility.AccessibilityManager)

Aggregations

AccessibilityManager (android.view.accessibility.AccessibilityManager)170 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)54 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)49 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)43 ArrayList (java.util.ArrayList)26 ServiceInfo (android.content.pm.ServiceInfo)20 MediumTest (android.test.suitebuilder.annotation.MediumTest)20 ComponentName (android.content.ComponentName)16 Drawable (android.graphics.drawable.Drawable)10 Bundle (android.os.Bundle)9 EnforcedAdmin (com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)8 RestrictedPreference (com.android.settingslib.RestrictedPreference)8 SuppressLint (android.annotation.SuppressLint)7 Context (android.content.Context)7 SwitchPreference (android.support.v14.preference.SwitchPreference)7 ListPreference (android.support.v7.preference.ListPreference)7 Preference (android.support.v7.preference.Preference)7 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)7 ITransientNotification (android.app.ITransientNotification)6 Notification (android.app.Notification)6