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

Commit de0afc20 authored by Gavin Williams's avatar Gavin Williams
Browse files

Autoclick: Fix mouse disconnect logic

Trigger the input device observer when the Autoclick panel is initiated.
This fixes the bug of the panel not hiding itself the first time the
mouse is disconnected

Bug: 439772850
Test: AutoclickControllerTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: I52fddb7bc86ae74ce938c409b10f18f0d22c7903
parent 65388286
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -416,6 +416,8 @@ public class AutoclickController extends BaseEventStreamTransformation implement
                    new InputManagerWrapper(mContext.getSystemService(InputManager.class));
        }
        mInputManagerWrapper.registerInputDeviceListener(mInputDeviceListener, handler);
        // Trigger listener to register currently connected input device.
        mInputDeviceListener.onInputDeviceChanged(/* deviceId= */ 0);
    }

    @Override
+0 −8
Original line number Diff line number Diff line
@@ -1660,10 +1660,6 @@ public class AutoclickControllerTest {
                .registerInputDeviceListener(listenerCaptor.capture(), any());
        InputManager.InputDeviceListener listener = listenerCaptor.getValue();

        // Manually trigger once to establish initial connected state.
        listener.onInputDeviceChanged(1);
        mTestableLooper.processAllMessages();

        // Mock panels to verify interactions.
        AutoclickTypePanel mockTypePanel = mock(AutoclickTypePanel.class);
        AutoclickScrollPanel mockScrollPanel = mock(AutoclickScrollPanel.class);
@@ -1773,10 +1769,6 @@ public class AutoclickControllerTest {
                .registerInputDeviceListener(listenerCaptor.capture(), any());
        InputManager.InputDeviceListener listener = listenerCaptor.getValue();

        // Manually trigger once to establish initial connected state.
        listener.onInputDeviceChanged(1);
        mTestableLooper.processAllMessages();

        // Mock panels to verify interactions.
        AutoclickTypePanel mockTypePanel = mock(AutoclickTypePanel.class);
        AutoclickScrollPanel mockScrollPanel = mock(AutoclickScrollPanel.class);