summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Svetoslav Ganov <svetoslavganov@google.com> 2013-05-17 19:12:38 -0700
committer Svetoslav Ganov <svetoslavganov@google.com> 2013-05-17 19:23:51 -0700
commit319d55bd15721982db7563711c876bb000490b7d (patch)
tree6fc78a6bb11a66715992ae642024cbecfac5744b
parent50776863a2a2ed6e4015edc60bacd4f562a907ee (diff)
Do not report the fake UI automation service to clients.
For UI test automation purposes we register a fake accessibility service and suspend all other services. When the UI automation serivce is unregistered we restore the suspended ones. Since the UI automation serivce is fake and incomplete, for example it has not resolve info, it should not be reported to clients as being installed or enabled. bug:8871034 Change-Id: I66792cd028159c1652d3c8a2982164821282ab24
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 2b5544ba0be9..2f8250fbf1a2 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -95,6 +95,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -405,7 +406,17 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
synchronized (mLock) {
final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked(userId);
- return getUserStateLocked(resolvedUserId).mInstalledServices;
+ // The automation service is a fake one and should not be reported
+ // to clients as being installed - it really is not.
+ UserState userState = getUserStateLocked(resolvedUserId);
+ if (userState.mUiAutomationService != null) {
+ List<AccessibilityServiceInfo> installedServices =
+ new ArrayList<AccessibilityServiceInfo>();
+ installedServices.addAll(userState.mInstalledServices);
+ installedServices.remove(userState.mUiAutomationService);
+ return installedServices;
+ }
+ return userState.mInstalledServices;
}
}
@@ -415,9 +426,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
synchronized (mLock) {
final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked(userId);
+
+ // The automation service is a fake one and should not be reported
+ // to clients as being enabled. The automation service is always the
+ // only active one, if it exists.
+ UserState userState = getUserStateLocked(resolvedUserId);
+ if (userState.mUiAutomationService != null) {
+ return Collections.emptyList();
+ }
+
result = mEnabledServicesForFeedbackTempList;
result.clear();
- List<Service> services = getUserStateLocked(resolvedUserId).mBoundServices;
+ List<Service> services = userState.mBoundServices;
while (feedbackType != 0) {
final int feedbackTypeBit = (1 << Integer.numberOfTrailingZeros(feedbackType));
feedbackType &= ~feedbackTypeBit;