am 9c71716e: Merge change 9063 into donut
Merge commit '9c71716e3de9b6a7e1830cae13da35ebdeeaaa80'
* commit '9c71716e3de9b6a7e1830cae13da35ebdeeaaa80':
Fixing bug #2023024 - there is an out of bounds exception that
diff --git a/services/java/com/android/server/AccessibilityManagerService.java b/services/java/com/android/server/AccessibilityManagerService.java
index 63c9eaa..55007ba 100644
--- a/services/java/com/android/server/AccessibilityManagerService.java
+++ b/services/java/com/android/server/AccessibilityManagerService.java
@@ -323,15 +323,22 @@
*/
private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,
boolean isDefault) {
- for (int i = 0, count = mServices.size(); i < count; i++) {
- Service service = mServices.get(i);
+ try {
+ for (int i = 0, count = mServices.size(); i < count; i++) {
+ Service service = mServices.get(i);
- if (service.mIsDefault == isDefault) {
- if (canDispathEventLocked(service, event, mHandledFeedbackTypes)) {
- mHandledFeedbackTypes |= service.mFeedbackType;
- notifyAccessibilityServiceDelayedLocked(service, event);
+ if (service.mIsDefault == isDefault) {
+ if (canDispathEventLocked(service, event, mHandledFeedbackTypes)) {
+ mHandledFeedbackTypes |= service.mFeedbackType;
+ notifyAccessibilityServiceDelayedLocked(service, event);
+ }
}
}
+ } catch (IndexOutOfBoundsException oobe) {
+ // An out of bounds exception can happen if services are going away
+ // as the for loop is running. If that happens, just bail because
+ // there are no more services to notify.
+ return;
}
}