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

Commit ad119d9a authored by Jacky Kao's avatar Jacky Kao
Browse files

Keep changed focus data after service disable

Since in reality only one service at a time (and maybe ever) will care
about these focus data, letting services change these parameters and
leaving it alone even that service is disable.

Bug: 175732114
Test: a11y CTS & unit tests
Change-Id: Ic1f9d29c35ebccbabb6b35b9f113920b992af0df
parent 1a55dfc1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2120,6 +2120,10 @@ public abstract class AccessibilityService extends Service {

    /**
     * Sets the strokeWidth and color of the accessibility focus rectangle.
     * <p>
     * <strong>Note:</strong> This setting persists until this or another active
     * AccessibilityService changes it or the device reboots.
     * </p>
     *
     * @param strokeWidth The stroke width of the rectangle in pixels.
     *                    Setting this value to zero results in no focus rectangle being drawn.
+0 −4
Original line number Diff line number Diff line
@@ -120,8 +120,6 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
        AccessibilityUserState userState = mUserStateWeakReference.get();
        if (userState == null) return;
        userState.removeServiceLocked(this);
        userState.resetFocusAppearanceLocked();
        mSystemSupport.onClientChangeLocked(false);
        mSystemSupport.getFullScreenMagnificationController().resetAllIfNeeded(mId);
        mActivityTaskManagerService.setAllowAppSwitches(mComponentName.flattenToString(), -1,
                userState.mUserId);
@@ -146,7 +144,6 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
                userState.resetFocusAppearanceLocked();
                mSystemSupport.onClientChangeLocked(false);
            }
        }
@@ -313,7 +310,6 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
            AccessibilityUserState userState = mUserStateWeakReference.get();
            if (userState != null) {
                userState.serviceDisconnectedLocked(this);
                userState.resetFocusAppearanceLocked();
            }
            resetLocked();
            mSystemSupport.getFullScreenMagnificationController().resetAllIfNeeded(mId);
+2 −10
Original line number Diff line number Diff line
@@ -194,7 +194,8 @@ class AccessibilityUserState {
        mUserNonInteractiveUiTimeout = 0;
        mUserInteractiveUiTimeout = 0;
        mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
        resetFocusAppearanceLocked();
        mFocusStrokeWidth = mFocusStrokeWidthDefaultValue;
        mFocusColor = mFocusColorDefaultValue;
    }

    void addServiceLocked(AccessibilityServiceConnection serviceConnection) {
@@ -924,13 +925,4 @@ class AccessibilityUserState {
        mFocusStrokeWidth = strokeWidth;
        mFocusColor = color;
    }

    /**
     * Resets the stroke width and color of the focus rectangle to the default value.
     *
     */
    public void resetFocusAppearanceLocked() {
        mFocusStrokeWidth = mFocusStrokeWidthDefaultValue;
        mFocusColor = mFocusColorDefaultValue;
    }
}