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

Commit 27ebcb99 authored by Josep del Río's avatar Josep del Río Committed by Automerger Merge Worker
Browse files

Merge "Handle pointer location setting in InputSettingsObserver" into udc-qpr-dev am: 3830afc1

parents a700c5d8 3830afc1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2804,6 +2804,11 @@ public class InputManagerService extends IInputManager.Stub
         */
        void notifyConfigurationChanged();

        /**
         * This callback is invoked when the pointer location changes.
         */
        void notifyPointerLocationChanged(boolean pointerLocationEnabled);

        /**
         * This callback is invoked when the camera lens cover switch changes state.
         * @param whenNanos the time when the change occurred
@@ -3386,6 +3391,10 @@ public class InputManagerService extends IInputManager.Stub
        }
    }

    void updatePointerLocationEnabled(boolean enabled) {
        mWindowManagerCallbacks.notifyPointerLocationChanged(enabled);
    }

    void updateFocusEventDebugViewEnabled(boolean enabled) {
        FocusEventDebugView view;
        synchronized (mFocusEventDebugViewLock) {
+7 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ class InputSettingsObserver extends ContentObserver {
                        (reason) -> updateTouchpadRightClickZoneEnabled()),
                Map.entry(Settings.System.getUriFor(Settings.System.SHOW_TOUCHES),
                        (reason) -> updateShowTouches()),
                Map.entry(Settings.System.getUriFor(Settings.System.POINTER_LOCATION),
                        (reason) -> updatePointerLocation()),
                Map.entry(
                        Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON),
                        (reason) -> updateAccessibilityLargePointer()),
@@ -149,6 +151,11 @@ class InputSettingsObserver extends ContentObserver {
        mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES, false));
    }

    private void updatePointerLocation() {
        mService.updatePointerLocationEnabled(
                getBoolean(Settings.System.POINTER_LOCATION, false));
    }

    private void updateShowKeyPresses() {
        mService.updateFocusEventDebugViewEnabled(
                getBoolean(Settings.System.SHOW_KEY_PRESSES, false));
+15 −0
Original line number Diff line number Diff line
@@ -128,6 +128,21 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal
        }
    }

    /** Notifies that the pointer location configuration has changed. */
    @Override
    public void notifyPointerLocationChanged(boolean pointerLocationEnabled) {
        if (mService.mPointerLocationEnabled == pointerLocationEnabled) {
            return;
        }

        synchronized (mService.mGlobalLock) {
            mService.mPointerLocationEnabled = pointerLocationEnabled;
            mService.mRoot.forAllDisplayPolicies(
                    p -> p.setPointerLocationEnabled(mService.mPointerLocationEnabled)
            );
        }
    }

    /** Notifies that the lid switch changed state. */
    @Override
    public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
+0 −24
Original line number Diff line number Diff line
@@ -763,8 +763,6 @@ public class WindowManagerService extends IWindowManager.Stub
                Settings.Secure.getUriFor(Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS);
        private final Uri mPolicyControlUri =
                Settings.Global.getUriFor(Settings.Global.POLICY_CONTROL);
        private final Uri mPointerLocationUri =
                Settings.System.getUriFor(Settings.System.POINTER_LOCATION);
        private final Uri mForceDesktopModeOnExternalDisplaysUri = Settings.Global.getUriFor(
                        Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS);
        private final Uri mFreeformWindowUri = Settings.Global.getUriFor(
@@ -792,7 +790,6 @@ public class WindowManagerService extends IWindowManager.Stub
            resolver.registerContentObserver(mImmersiveModeConfirmationsUri, false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(mPolicyControlUri, false, this, UserHandle.USER_ALL);
            resolver.registerContentObserver(mPointerLocationUri, false, this, UserHandle.USER_ALL);
            resolver.registerContentObserver(mForceDesktopModeOnExternalDisplaysUri, false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(mFreeformWindowUri, false, this, UserHandle.USER_ALL);
@@ -816,11 +813,6 @@ public class WindowManagerService extends IWindowManager.Stub
                return;
            }

            if (mPointerLocationUri.equals(uri)) {
                updatePointerLocation();
                return;
            }

            if (mForceDesktopModeOnExternalDisplaysUri.equals(uri)) {
                updateForceDesktopModeOnExternalDisplays();
                return;
@@ -869,7 +861,6 @@ public class WindowManagerService extends IWindowManager.Stub

        void loadSettings() {
            updateSystemUiSettings(false /* handleChange */);
            updatePointerLocation();
            updateMaximumObscuringOpacityForTouch();
        }

@@ -900,21 +891,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        void updatePointerLocation() {
            ContentResolver resolver = mContext.getContentResolver();
            final boolean enablePointerLocation = Settings.System.getIntForUser(resolver,
                    Settings.System.POINTER_LOCATION, 0, UserHandle.USER_CURRENT) != 0;

            if (mPointerLocationEnabled == enablePointerLocation) {
                return;
            }
            mPointerLocationEnabled = enablePointerLocation;
            synchronized (mGlobalLock) {
                mRoot.forAllDisplayPolicies(
                        p -> p.setPointerLocationEnabled(mPointerLocationEnabled));
            }
        }

        void updateForceDesktopModeOnExternalDisplays() {
            ContentResolver resolver = mContext.getContentResolver();
            final boolean enableForceDesktopMode = Settings.Global.getInt(resolver,