use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by crdroidandroid.
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 crdroidandroid.
the class EnableAccessibilityController method getInstalledSpeakingAccessibilityServiceComponent.
@Nullable
public static ComponentName getInstalledSpeakingAccessibilityServiceComponent(Context context) {
List<AccessibilityServiceInfo> services = getInstalledSpeakingAccessibilityServices(context);
if (services.isEmpty()) {
return null;
}
ServiceInfo serviceInfo = services.get(0).getResolveInfo().serviceInfo;
return new ComponentName(serviceInfo.packageName, serviceInfo.name);
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by crdroidandroid.
the class AccessibilityManagerServiceTest method testSendAccessibilityEvent_OneService_NotifivationAfterTimeout.
@LargeTest
public void testSendAccessibilityEvent_OneService_NotifivationAfterTimeout() throws Exception {
// enable the mock accessibility service
ensureOnlyMockServicesEnabled(mContext, true, false);
// set the accessibility setting value
ensureAccessibilityEnabled(mContext, true);
// configure the mock service
MockAccessibilityService service = MyFirstMockAccessibilityService.sInstance;
AccessibilityServiceInfo info = MockAccessibilityService.createDefaultInfo();
info.notificationTimeout = TIMEOUT_TEST_NOTIFICATION_TIMEOUT;
service.setServiceInfo(info);
// wait for the binder call to #setService to complete
Thread.sleep(TIMEOUT_BINDER_CALL);
// create and populate the first event to be sent
AccessibilityEvent firstEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(firstEvent);
// create and populate the second event to be sent
AccessibilityEvent secondEvent = AccessibilityEvent.obtain();
fullyPopulateDefaultAccessibilityEvent(secondEvent);
// set expectations
service.expectEvent(secondEvent);
service.replay();
// send the events
mManagerService.sendAccessibilityEvent(firstEvent, UserHandle.USER_CURRENT);
mManagerService.sendAccessibilityEvent(secondEvent, UserHandle.USER_CURRENT);
// wait for #sendAccessibilityEvent to reach the backing service
Thread.sleep(TIMEOUT_BINDER_CALL);
try {
service.verify();
fail("No events must be dispatched before the expiration of the notification timeout.");
} catch (IllegalStateException ise) {
/* expected */
}
// wait for the configured notification timeout to expire
Thread.sleep(TIMEOUT_TEST_NOTIFICATION_TIMEOUT);
// verify if all expected methods have been called
assertMockServiceVerifiedWithinTimeout(service);
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by crdroidandroid.
the class AccessibilityManagerServiceTest method testGetAccessibilityServicesList.
@LargeTest
public void testGetAccessibilityServicesList() throws Exception {
boolean firstMockServiceInstalled = false;
boolean secondMockServiceInstalled = false;
String packageName = getContext().getPackageName();
String firstMockServiceClassName = MyFirstMockAccessibilityService.class.getName();
String secondMockServiceClassName = MySecondMockAccessibilityService.class.getName();
// look for the two mock services
for (AccessibilityServiceInfo info : mManagerService.getInstalledAccessibilityServiceList(UserHandle.USER_CURRENT)) {
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
if (packageName.equals(serviceInfo.packageName)) {
if (firstMockServiceClassName.equals(serviceInfo.name)) {
firstMockServiceInstalled = true;
} else if (secondMockServiceClassName.equals(serviceInfo.name)) {
secondMockServiceInstalled = true;
}
}
}
// check expected result
assertTrue("First mock service must be installed", firstMockServiceInstalled);
assertTrue("Second mock service must be installed", secondMockServiceInstalled);
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by crdroidandroid.
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;
}
Aggregations