NPE in AccessibilityManagerService.
If an accessibility service is connected but already removed from the list of connecting services we get a NPE since the call to set the service connection is made over a null remove interface. Note that service connection is asynchronous. bug:8229877 Change-Id: I7b05f219dd0c1da6286ee4ec90b1ef310908545d
This commit is contained in:
@@ -1741,25 +1741,23 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder service) {
|
||||
final int connectionId;
|
||||
synchronized (mLock) {
|
||||
connectionId = mId;
|
||||
mService = service;
|
||||
mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service);
|
||||
UserState userState = getUserStateLocked(mUserId);
|
||||
addServiceLocked(this, userState);
|
||||
if (!userState.mBindingServices.contains(mComponentName)) {
|
||||
binderDied();
|
||||
} else {
|
||||
if (userState.mBindingServices.contains(mComponentName)) {
|
||||
userState.mBindingServices.remove(mComponentName);
|
||||
onUserStateChangedLocked(userState);
|
||||
try {
|
||||
mServiceInterface.setConnection(this, mId);
|
||||
} catch (RemoteException re) {
|
||||
Slog.w(LOG_TAG, "Error while setting connection for service: " + service, re);
|
||||
}
|
||||
} else {
|
||||
binderDied();
|
||||
}
|
||||
}
|
||||
try {
|
||||
mServiceInterface.setConnection(this, connectionId);
|
||||
} catch (RemoteException re) {
|
||||
Slog.w(LOG_TAG, "Error while setting connection for service: " + service, re);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user