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);
}
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);
}
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;
}
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));
}
}
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;
}
Aggregations