Skip to content

Commit 419036b

Browse files
committed
Invalid accessibility state if UI test process crashes in a bad time.
We allow a fake accessibility service to connect to the system for UI automation. If the process hosting the fake service dies right after registering it, the accessibility layer ends up in a bad state and subsequent attempts to connect UI automation service fail. bug:17725904 Change-Id: Idad288eab41bbdd486d95e1e5803220640653fb7
1 parent d146224 commit 419036b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,15 @@ mIntent, this, Context.BIND_AUTO_CREATE, new UserHandle(mUserId))) {
19821982
} else {
19831983
userState.mBindingServices.add(mComponentName);
19841984
mService = userState.mUiAutomationServiceClient.asBinder();
1985-
onServiceConnected(mComponentName, mService);
1985+
mMainHandler.post(new Runnable() {
1986+
@Override
1987+
public void run() {
1988+
// Simulate asynchronous connection since in onServiceConnected
1989+
// we may modify the state data in case of an error but bind is
1990+
// called while iterating over the data and bad things can happen.
1991+
onServiceConnected(mComponentName, mService);
1992+
}
1993+
});
19861994
userState.mUiAutomationService = this;
19871995
}
19881996
return false;

0 commit comments

Comments
 (0)