Search in sources :

Example 11 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ResurrectionRemix.

the class MockAccessibilityService method createDefaultInfo.

/**
     * Creates an {@link AccessibilityServiceInfo} populated with default
     * values.
     *
     * @return The default info.
     */
public static AccessibilityServiceInfo createDefaultInfo() {
    AccessibilityServiceInfo defaultInfo = new AccessibilityServiceInfo();
    defaultInfo.eventTypes = AccessibilityEvent.TYPE_ANNOUNCEMENT;
    defaultInfo.feedbackType = AccessibilityServiceInfo.FEEDBACK_AUDIBLE;
    defaultInfo.flags = 0;
    defaultInfo.notificationTimeout = 0;
    defaultInfo.packageNames = new String[] { "foo.bar.baz" };
    return defaultInfo;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)

Example 12 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ResurrectionRemix.

the class AccessibilityManager method getAccessibilityServiceList.

/**
     * Returns the {@link ServiceInfo}s of the installed accessibility services.
     *
     * @return An unmodifiable list with {@link ServiceInfo}s.
     *
     * @deprecated Use {@link #getInstalledAccessibilityServiceList()}
     */
@Deprecated
public List<ServiceInfo> getAccessibilityServiceList() {
    List<AccessibilityServiceInfo> infos = getInstalledAccessibilityServiceList();
    List<ServiceInfo> services = new ArrayList<>();
    final int infoCount = infos.size();
    for (int i = 0; i < infoCount; i++) {
        AccessibilityServiceInfo info = infos.get(i);
        services.add(info.getResolveInfo().serviceInfo);
    }
    return Collections.unmodifiableList(services);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) ServiceInfo(android.content.pm.ServiceInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 13 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ResurrectionRemix.

the class AccessibilityManagerService method getInstalledAccessibilityServiceList.

@Override
public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList(int userId) {
    synchronized (mLock) {
        // We treat calls from a profile as if made by its parent as profiles
        // share the accessibility state of the parent. The call below
        // performs the current profile parent resolution.
        final int resolvedUserId = mSecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(userId);
        // The automation service is a fake one and should not be reported
        // to clients as being installed - it really is not.
        UserState userState = getUserStateLocked(resolvedUserId);
        if (userState.mUiAutomationService != null) {
            List<AccessibilityServiceInfo> installedServices = new ArrayList<>();
            installedServices.addAll(userState.mInstalledServices);
            installedServices.remove(userState.mUiAutomationService.mAccessibilityServiceInfo);
            return installedServices;
        }
        return userState.mInstalledServices;
    }
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) Point(android.graphics.Point)

Example 14 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ResurrectionRemix.

the class AccessibilityManagerService method updateServicesLocked.

private void updateServicesLocked(UserState userState) {
    Map<ComponentName, Service> componentNameToServiceMap = userState.mComponentNameToServiceMap;
    boolean isUnlockingOrUnlocked = mContext.getSystemService(UserManager.class).isUserUnlockingOrUnlocked(userState.mUserId);
    for (int i = 0, count = userState.mInstalledServices.size(); i < count; i++) {
        AccessibilityServiceInfo installedService = userState.mInstalledServices.get(i);
        ComponentName componentName = ComponentName.unflattenFromString(installedService.getId());
        Service service = componentNameToServiceMap.get(componentName);
        // Ignore non-encryption-aware services until user is unlocked
        if (!isUnlockingOrUnlocked && !installedService.isDirectBootAware()) {
            Slog.d(LOG_TAG, "Ignoring non-encryption-aware service " + componentName);
            continue;
        }
        // Wait for the binding if it is in process.
        if (userState.mBindingServices.contains(componentName)) {
            continue;
        }
        if (userState.mEnabledServices.contains(componentName)) {
            if (service == null) {
                service = new Service(userState.mUserId, componentName, installedService);
            } else if (userState.mBoundServices.contains(service)) {
                continue;
            }
            service.bindLocked();
        } else {
            if (service != null) {
                service.unbindLocked();
            }
        }
    }
    updateAccessibilityEnabledSetting(userState);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) UserManager(android.os.UserManager) AccessibilityService(android.accessibilityservice.AccessibilityService) ComponentName(android.content.ComponentName) Point(android.graphics.Point)

Example 15 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ResurrectionRemix.

the class AccessibilityManagerService method updateLegacyCapabilitiesLocked.

private void updateLegacyCapabilitiesLocked(UserState userState) {
    // Up to JB-MR1 we had a white list with services that can enable touch
    // exploration. When a service is first started we show a dialog to the
    // use to get a permission to white list the service.
    final int installedServiceCount = userState.mInstalledServices.size();
    for (int i = 0; i < installedServiceCount; i++) {
        AccessibilityServiceInfo serviceInfo = userState.mInstalledServices.get(i);
        ResolveInfo resolveInfo = serviceInfo.getResolveInfo();
        if ((serviceInfo.getCapabilities() & AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION) == 0 && resolveInfo.serviceInfo.applicationInfo.targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            ComponentName componentName = new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name);
            if (userState.mTouchExplorationGrantedServices.contains(componentName)) {
                serviceInfo.setCapabilities(serviceInfo.getCapabilities() | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION);
            }
        }
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) ComponentName(android.content.ComponentName) Point(android.graphics.Point)

Aggregations

AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)210 ServiceInfo (android.content.pm.ServiceInfo)69 ComponentName (android.content.ComponentName)64 AccessibilityManager (android.view.accessibility.AccessibilityManager)54 ArrayList (java.util.ArrayList)50 ResolveInfo (android.content.pm.ResolveInfo)45 Point (android.graphics.Point)30 LargeTest (android.test.suitebuilder.annotation.LargeTest)25 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)20 Bundle (android.os.Bundle)17 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)17 AccessibilityService (android.accessibilityservice.AccessibilityService)13 Drawable (android.graphics.drawable.Drawable)13 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)13 Intent (android.content.Intent)12 HashSet (java.util.HashSet)12 RemoteException (android.os.RemoteException)9 EnforcedAdmin (com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)8 RestrictedPreference (com.android.settingslib.RestrictedPreference)8 IOException (java.io.IOException)8