summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2013-05-03 01:13:05 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2013-05-03 01:20:56 -0700
commitbfa1bf020859a03668f1af1d59f035c53a97c7e8 (patch)
tree842fc4e10bdcfd9ecc91cf92f070460ef34ca469 /services/java
parent245a3e1c1ed265a13d07000ef6e786ec321b85c4 (diff)
downloadframeworks_base-bfa1bf020859a03668f1af1d59f035c53a97c7e8.zip
frameworks_base-bfa1bf020859a03668f1af1d59f035c53a97c7e8.tar.gz
frameworks_base-bfa1bf020859a03668f1af1d59f035c53a97c7e8.tar.bz2
Multiple bindings to the same accessiblity serice if it dies.
1. When a service dies we clear its state and remove it from the bound services waiting for new onServiceConnected call in which to initialize and add the service. The problem is that after clearing and removing a dead service there is a call to onUserStateChangedLocked with will end up rebinding to the service, so we get multiple onServiceConnected calls as a result of which we add the service twice and it becomes a mess. Note that every time the service dies we end up being bound to it twice as many times - royal mess! onUserStateChangedLocked is not even needed since we cleare and remove the serivce and this method will be called when the service is recreated. 2. When a service dies and is recreated by the system we were not adding it properly since we regarded only services that we bond to and wait for the connecton. Now we are also regarding service which died and are recreated. bug:8796109 Change-Id: I5ec60c67bd3b057446bb8d90b48511c35d45289d
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 138c51b..4ae9eb5 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1711,6 +1711,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
final KeyEventDispatcher mKeyEventDispatcher = new KeyEventDispatcher();
+ boolean mWasConnectedAndDied;
+
// Handler only for dispatching accessibility events since we use event
// types as message types allowing us to remove messages per event type.
public Handler mEventDispatchHandler = new Handler(mMainHandler.getLooper()) {
@@ -1865,8 +1867,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service);
UserState userState = getUserStateLocked(mUserId);
addServiceLocked(this, userState);
- if (userState.mBindingServices.contains(mComponentName)) {
+ if (userState.mBindingServices.contains(mComponentName) || mWasConnectedAndDied) {
userState.mBindingServices.remove(mComponentName);
+ mWasConnectedAndDied = false;
try {
mServiceInterface.setConnection(this, mId);
onUserStateChangedLocked(userState);
@@ -2220,7 +2223,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
mServiceInterface = null;
}
- public boolean isInitializedLocked() {
+ public boolean isConnectedLocked() {
return (mService != null);
}
@@ -2230,9 +2233,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// whose handling the death recipient is unlinked and still get a call
// on binderDied since the call was made before we unlink but was
// waiting on the lock we held during the force stop handling.
- if (!isInitializedLocked()) {
+ if (!isConnectedLocked()) {
return;
}
+ mWasConnectedAndDied = true;
mKeyEventDispatcher.flush();
UserState userState = getUserStateLocked(mUserId);
// The death recipient is unregistered in removeServiceLocked
@@ -2245,7 +2249,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
userState.mEnabledServices.remove(mComponentName);
userState.destroyUiAutomationService();
}
- onUserStateChangedLocked(userState);
}
}