Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a60fdfac authored by Svetoslav's avatar Svetoslav
Browse files

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
parent 9ad66541
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -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, connectionId);
                        mServiceInterface.setConnection(this, mId);
                    } catch (RemoteException re) {
                        Slog.w(LOG_TAG, "Error while setting connection for service: " + service, re);
                    }
                } else {
                    binderDied();
                }
            }
        }

        @Override