summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-02-10 14:55:41 -0800
committerSvetoslav Ganov <svetoslavganov@google.com>2012-02-10 14:55:45 -0800
commit9b666d0faadd26827ca5b7cf6af3aa94af6adcd9 (patch)
treeca882b35d791faeb85e9f4641479e5e836bbff91 /services
parentd36ad9b1ff99675dd0eca6a3fda1f52353f451a4 (diff)
downloadframeworks_base-9b666d0faadd26827ca5b7cf6af3aa94af6adcd9.zip
frameworks_base-9b666d0faadd26827ca5b7cf6af3aa94af6adcd9.tar.gz
frameworks_base-9b666d0faadd26827ca5b7cf6af3aa94af6adcd9.tar.bz2
UI automation service disconnected upon package change.
1. The AccessibilityManagerService used to disable the IU automation service on package change. This behavior was incorrect since the automation service has to survive package installations. bug:5975207 Change-Id: Idb5e76d02625c333a5842a6b5c5bc90c9b9634c9
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java37
1 files changed, 12 insertions, 25 deletions
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 8bda755..586a67e 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -143,6 +143,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
private final SecurityPolicy mSecurityPolicy;
+ private Service mUiAutomationService;
+
/**
* Handler for delayed event dispatch.
*/
@@ -494,19 +496,15 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
}
// Hook the automation service up.
- Service service = new Service(componentName, accessibilityServiceInfo, true);
- service.onServiceConnected(componentName, listener.asBinder());
+ mUiAutomationService = new Service(componentName, accessibilityServiceInfo, true);
+ mUiAutomationService.onServiceConnected(componentName, listener.asBinder());
}
public void unregisterUiTestAutomationService(IEventListener listener) {
synchronized (mLock) {
- final int serviceCount = mServices.size();
- for (int i = 0; i < serviceCount; i++) {
- Service service = mServices.get(i);
- if (service.mServiceInterface == listener && service.mIsAutomation) {
- // Automation service is not bound, so pretend it died to perform clean up.
- service.binderDied();
- }
+ // Automation service is not bound, so pretend it died to perform clean up.
+ if (mUiAutomationService != null) {
+ mUiAutomationService.binderDied();
}
}
}
@@ -741,7 +739,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
* Manages services by starting enabled ones and stopping disabled ones.
*/
private void manageServicesLocked() {
- unbindAutomationService();
+ // While the UI automation service is running it takes over.
+ if (mUiAutomationService != null) {
+ return;
+ }
populateEnabledServicesLocked(mEnabledServices);
final int enabledInstalledServicesCount = updateServicesStateLocked(mInstalledServices,
mEnabledServices);
@@ -769,21 +770,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
/**
- * Unbinds the automation service if such is running.
- */
- private void unbindAutomationService() {
- List<Service> runningServices = mServices;
- int runningServiceCount = mServices.size();
- for (int i = 0; i < runningServiceCount; i++) {
- Service service = runningServices.get(i);
- if (service.mIsAutomation) {
- service.unbind();
- return;
- }
- }
- }
-
- /**
* Populates a list with the {@link ComponentName}s of all enabled
* {@link AccessibilityService}s.
*
@@ -1248,6 +1234,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
// We no longer have an automation service, so restore
// the state based on values in the settings database.
if (mIsAutomation) {
+ mUiAutomationService = null;
handleAccessibilityEnabledSettingChangedLocked();
}
}