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

Commit c0c7efc4 authored by Phil Weaver's avatar Phil Weaver
Browse files

Add null check to destroyUiAutomationService

Fixes: 129704196
Test: atest UiAutomationManagerTest, atest CtsUiAutomationTestCases
Change-Id: I257c4f7321e9b3b54efe45e46ede50b010494c6e
parent 4fb4320a
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -64,10 +64,8 @@ class UiAutomationManager {
                public void binderDied() {
                    mUiAutomationServiceOwner.unlinkToDeath(this, 0);
                    mUiAutomationServiceOwner = null;
                    if (mUiAutomationService != null) {
                    destroyUiAutomationService();
                }
                }
            };

    /**
@@ -201,19 +199,22 @@ class UiAutomationManager {

    private void destroyUiAutomationService() {
        synchronized (mLock) {
            mUiAutomationService.mServiceInterface.asBinder().unlinkToDeath(mUiAutomationService,
                    0);
            if (mUiAutomationService != null) {
                mUiAutomationService.mServiceInterface.asBinder().unlinkToDeath(
                        mUiAutomationService, 0);
                mUiAutomationService.onRemoved();
                mUiAutomationService.resetLocked();
                mUiAutomationService = null;
                mUiAutomationFlags = 0;
                if (mUiAutomationServiceOwner != null) {
                mUiAutomationServiceOwner.unlinkToDeath(mUiAutomationServiceOwnerDeathRecipient, 0);
                    mUiAutomationServiceOwner.unlinkToDeath(
                            mUiAutomationServiceOwnerDeathRecipient, 0);
                    mUiAutomationServiceOwner = null;
                }
                mSystemSupport.onClientChangeLocked(false);
            }
        }
    }

    private class UiAutomationService extends AbstractAccessibilityServiceConnection {
        private final Handler mMainHandler;