Java Code Examples for android.accessibilityservice.AccessibilityServiceInfo#getId()

The following examples show how to use android.accessibilityservice.AccessibilityServiceInfo#getId() . 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: AccessibilityUtil.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
/**
 * Checks whether Google accessibility services are enabled, including
 * TalkBack, Switch Access, and others
 *
 * @return boolean
 */
private boolean containsGoogleAccessibilityService()
{
    android.view.accessibility.AccessibilityManager accessibilityManager = getAccessibilityManager();
    List<AccessibilityServiceInfo> enabledServices =
            accessibilityManager
                    .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
    if (enabledServices != null)
    {
        for (AccessibilityServiceInfo enabledService : enabledServices)
        {
            String serviceId = enabledService.getId();
            if (serviceId != null && serviceId.startsWith(ACCESSIBILITY_PACKAGE_NAME_PREFIX))
            {
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Source File: PerAppMonitor.java    From KA27 with Apache License 2.0 6 votes vote down vote up
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityServiceInfo serviceInfo = this.getServiceInfo();
    accessibilityId = serviceInfo.getId();

    if (event.getPackageName() == null || event.getEventType() != AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
        return;

    sPackageName = event.getPackageName().toString();
    Log.d(TAG, "Package Name is " + sPackageName);
    if (sPackageName.equals("com.android.systemui"))
        return;

    if ((System.currentTimeMillis() - time) < 2000) {
        if (!sPackageName.equals(UserLauncher())) {
            process_window_change(sPackageName);
        }
    } else {
        process_window_change(sPackageName);
    }

}
 
Example 3
Source File: PerAppMonitor.java    From kernel_adiutor with Apache License 2.0 6 votes vote down vote up
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityServiceInfo serviceInfo = this.getServiceInfo();
    accessibilityId = serviceInfo.getId();

    PackageManager localPackageManager = getPackageManager();
    Intent intent = new Intent("android.intent.action.MAIN");
    intent.addCategory("android.intent.category.HOME");
    String launcher = localPackageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName;

    if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && event.getPackageName() != null) {
        sPackageName = event.getPackageName().toString();
        Log.d(TAG, "Package Name is "+sPackageName);
        if ((System.currentTimeMillis() - time) < 1000) {
            if (!sPackageName.equals(launcher) || !sPackageName.equals("com.android.systemui")) {
                process_window_change(sPackageName);
            }
        }
        else if ((System.currentTimeMillis() - time) >= 1000) {
            process_window_change(sPackageName);
        }
    }
}
 
Example 4
Source File: AccessibilityServiceEnabler.java    From test-butler with Apache License 2.0 5 votes vote down vote up
@Nullable
private String findButlerAccessibilityServiceId() throws RemoteException {
    List<AccessibilityServiceInfo> accessibilityServices =
            serviceProvider.getInstalledAccessibilityServiceList();
    for (AccessibilityServiceInfo service : accessibilityServices) {
        String serviceId = service.getId();
        if (serviceId.endsWith(ButlerAccessibilityService.SERVICE_NAME)) {
            return serviceId;
        }
    }
    return null;
}
 
Example 5
Source File: e.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static String c(AccessibilityServiceInfo accessibilityserviceinfo)
{
    return accessibilityserviceinfo.getId();
}
 
Example 6
Source File: AccessibilityServiceInfoCompatIcs.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static String getId(AccessibilityServiceInfo info) {
    return info.getId();
}
 
Example 7
Source File: AccessibilityServiceInfoCompatIcs.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static String getId(AccessibilityServiceInfo info) {
    return info.getId();
}
 
Example 8
Source File: AccessibilityServiceInfoCompatIcs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static String getId(AccessibilityServiceInfo info) {
    return info.getId();
}
 
Example 9
Source File: AccessibilityServiceInfoCompatIcs.java    From guideshow with MIT License 4 votes vote down vote up
public static String getId(AccessibilityServiceInfo info) {
    return info.getId();
}