Search in sources :

Example 96 with AccessibilityServiceInfo

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

the class UiAutomationShellWrapper method setCompressedLayoutHierarchy.

public void setCompressedLayoutHierarchy(boolean compressed) {
    AccessibilityServiceInfo info = mUiAutomation.getServiceInfo();
    if (compressed)
        info.flags &= ~AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
    else
        info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
    mUiAutomation.setServiceInfo(info);
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)

Example 97 with AccessibilityServiceInfo

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

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 98 with AccessibilityServiceInfo

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

the class AccessibilityManagerService method readInstalledAccessibilityServiceLocked.

private boolean readInstalledAccessibilityServiceLocked(UserState userState) {
    mTempAccessibilityServiceInfoList.clear();
    List<ResolveInfo> installedServices = mPackageManager.queryIntentServicesAsUser(new Intent(AccessibilityService.SERVICE_INTERFACE), PackageManager.GET_SERVICES | PackageManager.GET_META_DATA | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, mCurrentUserId);
    for (int i = 0, count = installedServices.size(); i < count; i++) {
        ResolveInfo resolveInfo = installedServices.get(i);
        ServiceInfo serviceInfo = resolveInfo.serviceInfo;
        if (!android.Manifest.permission.BIND_ACCESSIBILITY_SERVICE.equals(serviceInfo.permission)) {
            Slog.w(LOG_TAG, "Skipping accessibilty service " + new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToShortString() + ": it does not require the permission " + android.Manifest.permission.BIND_ACCESSIBILITY_SERVICE);
            continue;
        }
        AccessibilityServiceInfo accessibilityServiceInfo;
        try {
            accessibilityServiceInfo = new AccessibilityServiceInfo(resolveInfo, mContext);
            mTempAccessibilityServiceInfoList.add(accessibilityServiceInfo);
        } catch (XmlPullParserException | IOException xppe) {
            Slog.e(LOG_TAG, "Error while initializing AccessibilityServiceInfo", xppe);
        }
    }
    if (!mTempAccessibilityServiceInfoList.equals(userState.mInstalledServices)) {
        userState.mInstalledServices.clear();
        userState.mInstalledServices.addAll(mTempAccessibilityServiceInfoList);
        mTempAccessibilityServiceInfoList.clear();
        return true;
    }
    mTempAccessibilityServiceInfoList.clear();
    return false;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) ServiceInfo(android.content.pm.ServiceInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) ComponentName(android.content.ComponentName) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) IOException(java.io.IOException) Point(android.graphics.Point)

Example 99 with AccessibilityServiceInfo

use of android.accessibilityservice.AccessibilityServiceInfo in project android-support-v4-googlemaps by petedoyle.

the class AccessibilityManagerSupportActivity method updateAccessibilityStateView.

/**
     * Updates the content of a TextView with description of the enabled
     * accessibility services.
     */
private void updateAccessibilityStateView() {
    // The API for getting the enabled accessibility services based on feedback
    // type was added in ICS. Therefore to be backwards compatible we use the
    // APIs in the support library. Note that if the platform API version is lower
    // and the called API is not available an empty list of services is returned.
    List<AccessibilityServiceInfo> enabledServices = AccessibilityManagerCompat.getEnabledAccessibilityServiceList(mAccessibilityManager, AccessibilityServiceInfo.FEEDBACK_SPOKEN);
    if (!enabledServices.isEmpty()) {
        StringBuilder builder = new StringBuilder();
        final int enabledServiceCount = enabledServices.size();
        for (int i = 0; i < enabledServiceCount; i++) {
            AccessibilityServiceInfo service = enabledServices.get(i);
            // Some new APIs were added in ICS for getting more information about
            // an accessibility service. Again accessed them via the support library.
            ResolveInfo resolveInfo = AccessibilityServiceInfoCompat.getResolveInfo(service);
            String serviceDescription = getString(R.string.accessibility_manager_enabled_service, resolveInfo.loadLabel(getPackageManager()), AccessibilityServiceInfoCompat.feedbackTypeToString(service.feedbackType), AccessibilityServiceInfoCompat.getDescription(service), AccessibilityServiceInfoCompat.getSettingsActivityName(service));
            builder.append(serviceDescription);
        }
        mAccessibilityStateView.setText(builder);
    } else {
        // Either no services or the platform API version is not high enough.
        mAccessibilityStateView.setText(getString(R.string.accessibility_manager_no_enabled_services));
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)

Example 100 with AccessibilityServiceInfo

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

the class AccessibilityManagerService method getEnabledAccessibilityServiceList.

@Override
public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackType, int userId) {
    List<AccessibilityServiceInfo> result = null;
    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 can suppress other services.
        UserState userState = getUserStateLocked(resolvedUserId);
        if (userState.isUiAutomationSuppressingOtherServices()) {
            return Collections.emptyList();
        }
        result = mEnabledServicesForFeedbackTempList;
        result.clear();
        List<Service> services = userState.mBoundServices;
        while (feedbackType != 0) {
            final int feedbackTypeBit = (1 << Integer.numberOfTrailingZeros(feedbackType));
            feedbackType &= ~feedbackTypeBit;
            final int serviceCount = services.size();
            for (int i = 0; i < serviceCount; i++) {
                Service service = services.get(i);
                // Don't report the UIAutomation (fake service)
                if (!sFakeAccessibilityServiceComponentName.equals(service.mComponentName) && (service.mFeedbackType & feedbackTypeBit) != 0) {
                    result.add(service.mAccessibilityServiceInfo);
                }
            }
        }
    }
    return result;
}
Also used : AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityService(android.accessibilityservice.AccessibilityService) Point(android.graphics.Point)

Aggregations

AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)123 ComponentName (android.content.ComponentName)30 Point (android.graphics.Point)30 ServiceInfo (android.content.pm.ServiceInfo)29 ArrayList (java.util.ArrayList)26 LargeTest (android.test.suitebuilder.annotation.LargeTest)25 ResolveInfo (android.content.pm.ResolveInfo)20 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)20 AccessibilityManager (android.view.accessibility.AccessibilityManager)19 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)17 AccessibilityService (android.accessibilityservice.AccessibilityService)13 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)13 RemoteException (android.os.RemoteException)7 PendingIntent (android.app.PendingIntent)6 Intent (android.content.Intent)6 UserInfo (android.content.pm.UserInfo)6 ParcelableString (com.android.internal.util.ParcelableString)6 IOException (java.io.IOException)6 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)6 UserManager (android.os.UserManager)5