From 072906eef827cd8d92b48f79975d4f2e21d1c958 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Mon, 15 Apr 2013 12:10:36 -0700 Subject: Fully setup newly bound service before state management. If the connected service is not entirely setup when calling the method for handling a change in the current user state we get a potential NPE since the management method may have discarded the service, thus nullifying the connection to it. Now the service is fully configured before calling the state change management method. bug:8600489 Change-Id: Ib0bf7c6d575e15c620da419d43ece22f4187fd34 --- .../android/server/accessibility/AccessibilityManagerService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'services/java/com/android/server/accessibility') diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 110c4da..ac4f970 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -1817,11 +1817,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { addServiceLocked(this, userState); if (userState.mBindingServices.contains(mComponentName)) { userState.mBindingServices.remove(mComponentName); - onUserStateChangedLocked(userState); try { - mServiceInterface.setConnection(this, mId); + mServiceInterface.setConnection(this, mId); + onUserStateChangedLocked(userState); } catch (RemoteException re) { - Slog.w(LOG_TAG, "Error while setting connection for service: " + service, re); + Slog.w(LOG_TAG, "Error while setting connection for service: " + + service, re); + binderDied(); } } else { binderDied(); -- cgit v1.1