summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2013-06-19 16:28:30 -0700
committerSvetoslav <svetoslavganov@google.com>2013-06-21 18:38:20 -0700
commit3b817aed7dba4405c764784baaf7308196d16481 (patch)
treef0e0b835e269d913f0956796a76ea84788c8802d
parentc80e3d434f034d8594014df2fe028e9420930ea8 (diff)
downloadframeworks_base-3b817aed7dba4405c764784baaf7308196d16481.zip
frameworks_base-3b817aed7dba4405c764784baaf7308196d16481.tar.gz
frameworks_base-3b817aed7dba4405c764784baaf7308196d16481.tar.bz2
Improper initialization of the accessibility manager service.
Initially the current user in the accessibility manager service is the owner. This is correct since the system should be able to respond to queries immediately and their result depends on the current user. However, the system is calling the user switch callback with the current user which is the same as the one we initialized with. Switching the user causes clearing state for the old user winch is in case the current one. Hence, we are losing state for the current user. This behavior was masked from the fact that accidentally no events in the system were fired before the first use user switch call. repo Losing current user state puts the manager service in an inconsistent state and it binds to accessibility services more than once. As a result the accessibility layer starts to misbehave rendering the device useless to a blind user. Now we are ignoring user switch callbacks if the new user is the same as the current one. Since we can no longer initialize at the first user switch, this change adds explicit system ready method called from the system server at the right moment. bug:9496697 Change-Id: Icb39e929ea44e6c0360aba7ddc12f941ca2c9f98
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 2f8250f..f1e4b0c 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -195,6 +195,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private int mCurrentUserId = UserHandle.USER_OWNER;
+ //TODO: Remove this hack
+ private boolean mInitialized;
+
private UserState getCurrentUserStateLocked() {
return getUserStateLocked(mCurrentUserId);
}
@@ -771,6 +774,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void switchUser(int userId) {
synchronized (mLock) {
+ if (mCurrentUserId == userId && mInitialized) {
+ return;
+ }
+
// Disconnect from services for the old user.
UserState oldUserState = getUserStateLocked(mCurrentUserId);
oldUserState.onSwitchToAnotherUser();
@@ -1283,6 +1290,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
private void onUserStateChangedLocked(UserState userState) {
+ // TODO: Remove this hack
+ mInitialized = true;
updateLegacyCapabilities(userState);
updateServicesLocked(userState);
updateFilterKeyEventsLocked(userState);