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

Commit fba2c8fb authored by Qasid Sadiq's avatar Qasid Sadiq
Browse files

After an ax service permanently crashes, it won't eat keys

The volume keys will work again, the ax button will reset back to the
correct state, and a bunch of other things.
This is cause we are not tracking the state of the service correctly in
this "Service won't run, but is on" state. Previously we just assumed it
was on.

Bug: 74593001
Test: Verified on device. By getting testback to crash. Tested, turning
service on and off in settings. Crashing it once, and having it restart
automiatically. Continuesouly crashing it until the system decides this
is bad. And after that state rebooting to make sure the service starts
up again.

Change-Id: I00e9c978d6807d8508968286a7545e48f9ae5800
parent c2baedb5
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -3743,6 +3743,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub

        /**
         * Removes a service.
         * There are three states to a service here: off, bound, and binding.
         * This stops tracking the service as bound.
         *
         * @param serviceConnection The service.
         */
@@ -3759,6 +3761,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            scheduleNotifyClientsOfServicesStateChange(this);
        }

        /**
         * Make sure a services disconnected but still 'on' state is reflected in UserState
         * There are three states to a service here: off, bound, and binding.
         * This drops a service from a bound state, to the binding state.
         * The binding state describes the situation where a service is on, but not bound.
         *
         * @param serviceConnection The service.
         */
        public void serviceDisconnectedLocked(AccessibilityServiceConnection serviceConnection) {
            removeServiceLocked(serviceConnection);
            mBindingServices.add(serviceConnection.getComponentName());
        }

        public Set<ComponentName> getBindingServicesLocked() {
            return mBindingServices;
        }
+4 −1
Original line number Diff line number Diff line
@@ -258,7 +258,10 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
                return;
            }
            mWasConnectedAndDied = true;
            resetLocked();
            UserState userState = mUserStateWeakReference.get();
            if (userState != null) {
                userState.serviceDisconnectedLocked(this);
            }
            if (mId == mSystemSupport.getMagnificationController().getIdOfLastServiceToMagnify()) {
                mSystemSupport.getMagnificationController().resetIfNeeded(true);
            }