Update the public APIs for finding views by text to optionally use content description.

1. Added flags to the search method to specify whether to match text or
   content description or both.

2. Added test case for the seach by content description.

3. Updated the code in AccessibilityManager service to reflect the latest
   changes there so test automation service works - this is the fake
   service used for UI automation.

Change-Id: I14a6779a920ff0430e78947ea5aaf876c2e66076
This commit is contained in:
Svetoslav Ganov
2011-09-14 18:15:32 -07:00
parent b07f6e09ea
commit ea515aeafa
9 changed files with 84 additions and 24 deletions

View File

@ -489,14 +489,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
if (oldService != null) {
tryRemoveServiceLocked(oldService);
}
// Now this service is enabled.
mEnabledServices.add(componentName);
// Also make sure this service is the only one.
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
componentName.flattenToString());
// This API is intended for testing so enable accessibility to make
// sure clients can start poking with the window content.
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 1);
// Also disable all accessibility services to avoid interference
// with the tests.
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "");
}
AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
accessibilityServiceInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;