use of android.accessibilityservice.AccessibilityServiceInfo in project platform_frameworks_base by android.
the class UiAutomatorBridge 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 platform_frameworks_base by android.
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);
}
}
}
}
use of android.accessibilityservice.AccessibilityServiceInfo in project platform_frameworks_base by android.
the class EnableAccessibilityController method getInstalledSpeakingAccessibilityServices.
public static List<AccessibilityServiceInfo> getInstalledSpeakingAccessibilityServices(Context context) {
List<AccessibilityServiceInfo> services = new ArrayList<AccessibilityServiceInfo>();
services.addAll(AccessibilityManager.getInstance(context).getInstalledAccessibilityServiceList());
Iterator<AccessibilityServiceInfo> iterator = services.iterator();
while (iterator.hasNext()) {
AccessibilityServiceInfo service = iterator.next();
if ((service.feedbackType & AccessibilityServiceInfo.FEEDBACK_SPOKEN) == 0) {
iterator.remove();
}
}
return services;
}
use of android.accessibilityservice.AccessibilityServiceInfo in project platform_frameworks_base by android.
the class DevicePolicyManagerService method setPermittedAccessibilityServices.
@Override
public boolean setPermittedAccessibilityServices(ComponentName who, List packageList) {
if (!mHasFeature) {
return false;
}
Preconditions.checkNotNull(who, "ComponentName is null");
if (packageList != null) {
int userId = UserHandle.getCallingUserId();
List<AccessibilityServiceInfo> enabledServices = null;
long id = mInjector.binderClearCallingIdentity();
try {
UserInfo user = getUserInfo(userId);
if (user.isManagedProfile()) {
userId = user.profileGroupId;
}
AccessibilityManager accessibilityManager = getAccessibilityManagerForUser(userId);
enabledServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
if (enabledServices != null) {
List<String> enabledPackages = new ArrayList<String>();
for (AccessibilityServiceInfo service : enabledServices) {
enabledPackages.add(service.getResolveInfo().serviceInfo.packageName);
}
if (!checkPackagesInPermittedListOrSystem(enabledPackages, packageList, userId)) {
Slog.e(LOG_TAG, "Cannot set permitted accessibility services, " + "because it contains already enabled accesibility services.");
return false;
}
}
}
synchronized (this) {
ActiveAdmin admin = getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
admin.permittedAccessiblityServices = packageList;
saveSettingsLocked(UserHandle.getCallingUserId());
}
return true;
}
use of android.accessibilityservice.AccessibilityServiceInfo in project platform_frameworks_base by android.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_TwoDefault.
@LargeTest
public void testSendAccessibilityEvent_TwoServices_MatchingPackageAndEventType_TwoDefault() throws Exception {
// enable the mock accessibility services
ensureOnlyMockServicesEnabled(mContext, true, true);
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// configure the first mock service
MockAccessibilityService firstService = MyFirstMockAccessibilityService.sInstance;
AccessibilityServiceInfo firstInfo = MyFirstMockAccessibilityService.createDefaultInfo();
firstInfo.flags = AccessibilityServiceInfo.DEFAULT;
firstService.setServiceInfo(firstInfo);
// configure the second mock service
MockAccessibilityService secondService = MySecondMockAccessibilityService.sInstance;
AccessibilityServiceInfo secondInfo = MyFirstMockAccessibilityService.createDefaultInfo();
secondInfo.flags = AccessibilityServiceInfo.DEFAULT;
secondService.setServiceInfo(firstInfo);
// wait for the binder calls to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate an event to be sent
AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(sentEvent);
// set expectations for the first mock service
firstService.expectEvent(sentEvent);
firstService.replay();
// set expectations for the second mock service
secondService.replay();
// send the event
mManagerService.sendAccessibilityEvent(sentEvent, UserHandle.USER_CURRENT);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(firstService);
assertMockServiceVerifiedWithinTimeout(secondService);
}
Aggregations